Skip to content

Commit 3c40e52

Browse files
committed
Allow copying one layer of depth/stencil textures (gfx-rs#8020)
This fixes a regression introduced by gfx-rs#7935.
1 parent bf86ac3 commit 3c40e52

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

cts_runner/test.lst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ webgpu:api,operation,compute,basic:memcpy:*
55
//FAIL: webgpu:api,operation,compute,basic:large_dispatch:*
66
webgpu:api,operation,compute_pipeline,overrides:*
77
webgpu:api,operation,device,lost:*
8+
// This is all the storeOp tests, but some of them fail if run in a single invocation.
9+
// https://github.com/gfx-rs/wgpu/issues/8021
10+
webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_with_depth_stencil_attachment:*
11+
webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:*
12+
webgpu:api,operation,render_pass,storeOp:render_pass_store_op,multiple_color_attachments:*
13+
webgpu:api,operation,render_pass,storeOp:render_pass_store_op,depth_stencil_attachment_only:*
814
webgpu:api,validation,encoding,beginComputePass:*
915
webgpu:api,validation,encoding,beginRenderPass:*
1016
webgpu:api,validation,encoding,cmds,clearBuffer:*

wgpu-core/src/command/transfer.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,15 +454,17 @@ pub(crate) fn validate_texture_copy_range<T>(
454454
// physical size can be larger than the virtual
455455
let extent = extent_virtual.physical_size(desc.format);
456456

457-
// Multisampled and depth-stencil formats do not support partial copies.
457+
// Multisampled and depth-stencil formats do not support partial copies
458+
// on x and y dimensions, but do support copying a subset of layers.
458459
let requires_exact_size = desc.format.is_depth_stencil_format() || desc.sample_count > 1;
459460

460461
// Return `Ok` if a run `size` texels long starting at `start_offset` is
461462
// valid for `texture_size`. Otherwise, return an appropriate a`Err`.
462463
let check_dimension = |dimension: TextureErrorDimension,
463464
start_offset: u32,
464465
size: u32,
465-
texture_size: u32|
466+
texture_size: u32,
467+
requires_exact_size: bool|
466468
-> Result<(), TransferError> {
467469
if requires_exact_size && (start_offset != 0 || size != texture_size) {
468470
Err(TransferError::UnsupportedPartialTransfer {
@@ -494,18 +496,21 @@ pub(crate) fn validate_texture_copy_range<T>(
494496
texture_copy_view.origin.x,
495497
copy_size.width,
496498
extent.width,
499+
requires_exact_size,
497500
)?;
498501
check_dimension(
499502
TextureErrorDimension::Y,
500503
texture_copy_view.origin.y,
501504
copy_size.height,
502505
extent.height,
506+
requires_exact_size,
503507
)?;
504508
check_dimension(
505509
TextureErrorDimension::Z,
506510
texture_copy_view.origin.z,
507511
copy_size.depth_or_array_layers,
508512
extent.depth_or_array_layers,
513+
false, // partial copy always allowed on Z/layer dimension
509514
)?;
510515

511516
if texture_copy_view.origin.x % block_width != 0 {

0 commit comments

Comments
 (0)