Skip to content

Commit 5089063

Browse files
Allow copying one layer of depth/stencil textures (#8020)
This fixes a regression introduced by #7935.
1 parent 1583c24 commit 5089063

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
@@ -455,15 +455,17 @@ pub(crate) fn validate_texture_copy_range<T>(
455455
// physical size can be larger than the virtual
456456
let extent = extent_virtual.physical_size(desc.format);
457457

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

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

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

0 commit comments

Comments
 (0)