diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e47efd6341..a4b5c371d05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -226,6 +226,7 @@ By @cwfitzgerald in [#8609](https://github.com/gfx-rs/wgpu/pull/8609). - Fix race when downloading texture from compute shader pass. By @SpeedCrash100 in [#8527](https://github.com/gfx-rs/wgpu/pull/8527) - Fix double window class registration when dynamic libraries are used. By @Azorlogh in [#8548](https://github.com/gfx-rs/wgpu/pull/8548) +- Fix Firefox error in WebGL when using Queue::write_texture with a 2D texture. By @tgecho in [#8668](https://github.com/gfx-rs/wgpu/pull/8673) #### hal diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index aeecf9efcd2..e4e90a535a8 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -905,6 +905,13 @@ impl Queue { let staging_buffer = staging_buffer.flush(); + let copy_rows_per_image = + if array_layer_count > 1 || dst.desc.dimension == wgt::TextureDimension::D3 { + Some(rows_per_image) + } else { + None + }; + let regions = (0..array_layer_count) .map(|array_layer_offset| { let mut texture_base = dst_base.clone(); @@ -915,7 +922,7 @@ impl Queue { * rows_per_image as u64 * stage_bytes_per_row as u64, bytes_per_row: Some(stage_bytes_per_row), - rows_per_image: Some(rows_per_image), + rows_per_image: copy_rows_per_image, }, texture_base, size: hal_copy_size,