Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
teoxoy committed Sep 19, 2023
1 parent d6e4482 commit a68dc10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tests/tests/write_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn write_texture_subset_2d() {
layout: wgpu::ImageDataLayout {
offset: 0,
bytes_per_row: Some(size),
rows_per_image: Some(2),
rows_per_image: Some(size),
},
},
wgpu::Extent3d {
Expand All @@ -103,7 +103,7 @@ fn write_texture_subset_2d() {
layout: wgpu::ImageDataLayout {
offset: 0,
bytes_per_row: Some(size),
rows_per_image: Some(size - 2),
rows_per_image: Some(size),
},
},
wgpu::Extent3d {
Expand Down
14 changes: 4 additions & 10 deletions wgpu-hal/src/metal/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,10 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
.max_copy_size(&dst.copy_size)
.min(&copy.size);
let bytes_per_row = copy.buffer_layout.bytes_per_row.unwrap_or(0) as u64;
let image_byte_stride = if extent.depth > 1 {
copy.buffer_layout
.rows_per_image
.map_or(0, |v| v as u64 * bytes_per_row)
} else {
// Don't pass a stride when updating a single layer, otherwise metal validation
// fails when updating a subset of the image due to the stride being larger than
// the amount of data to copy.
0
};
let image_byte_stride = copy
.buffer_layout
.rows_per_image
.map_or(0, |v| v as u64 * bytes_per_row);
encoder.copy_from_buffer_to_texture(
&src.raw,
copy.buffer_layout.offset,
Expand Down

0 comments on commit a68dc10

Please sign in to comment.