Skip to content

Commit 3e76478

Browse files
committed
Don't generate a BufferTextureCopy::rows_per_image if None was specified
None is the correct value for 1D/2D textures
1 parent 21e6143 commit 3e76478

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ By @cwfitzgerald in [#8609](https://github.com/gfx-rs/wgpu/pull/8609).
226226

227227
- Fix race when downloading texture from compute shader pass. By @SpeedCrash100 in [#8527](https://github.com/gfx-rs/wgpu/pull/8527)
228228
- Fix double window class registration when dynamic libraries are used. By @Azorlogh in [#8548](https://github.com/gfx-rs/wgpu/pull/8548)
229+
- 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)
229230

230231
#### hal
231232

wgpu-core/src/device/queue.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,13 @@ impl Queue {
905905

906906
let staging_buffer = staging_buffer.flush();
907907

908+
let copy_rows_per_image =
909+
if array_layer_count > 1 || dst.desc.dimension == wgt::TextureDimension::D3 {
910+
Some(rows_per_image)
911+
} else {
912+
None
913+
};
914+
908915
let regions = (0..array_layer_count)
909916
.map(|array_layer_offset| {
910917
let mut texture_base = dst_base.clone();
@@ -915,7 +922,7 @@ impl Queue {
915922
* rows_per_image as u64
916923
* stage_bytes_per_row as u64,
917924
bytes_per_row: Some(stage_bytes_per_row),
918-
rows_per_image: Some(rows_per_image),
925+
rows_per_image: copy_rows_per_image,
919926
},
920927
texture_base,
921928
size: hal_copy_size,

0 commit comments

Comments
 (0)