Skip to content

Commit 9a4238b

Browse files
committed
Allow copying one mip level of depth/stencil textures
This fixes a regression introduced by gfx-rs#7935.
1 parent 7473844 commit 9a4238b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

cts_runner/test.lst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ 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+
webgpu:api,operation,render_pass,storeOp:*
89
webgpu:api,validation,encoding,beginComputePass:*
910
webgpu:api,validation,encoding,beginRenderPass:*
1011
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 single mip level.
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/mip dimension
509514
)?;
510515

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

0 commit comments

Comments
 (0)