@@ -455,15 +455,17 @@ pub(crate) fn validate_texture_copy_range<T>(
455
455
// physical size can be larger than the virtual
456
456
let extent = extent_virtual. physical_size ( desc. format ) ;
457
457
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.
459
460
let requires_exact_size = desc. format . is_depth_stencil_format ( ) || desc. sample_count > 1 ;
460
461
461
462
// Return `Ok` if a run `size` texels long starting at `start_offset` is
462
463
// valid for `texture_size`. Otherwise, return an appropriate a`Err`.
463
464
let check_dimension = |dimension : TextureErrorDimension ,
464
465
start_offset : u32 ,
465
466
size : u32 ,
466
- texture_size : u32 |
467
+ texture_size : u32 ,
468
+ requires_exact_size : bool |
467
469
-> Result < ( ) , TransferError > {
468
470
if requires_exact_size && ( start_offset != 0 || size != texture_size) {
469
471
Err ( TransferError :: UnsupportedPartialTransfer {
@@ -495,18 +497,21 @@ pub(crate) fn validate_texture_copy_range<T>(
495
497
texture_copy_view. origin . x ,
496
498
copy_size. width ,
497
499
extent. width ,
500
+ requires_exact_size,
498
501
) ?;
499
502
check_dimension (
500
503
TextureErrorDimension :: Y ,
501
504
texture_copy_view. origin . y ,
502
505
copy_size. height ,
503
506
extent. height ,
507
+ requires_exact_size,
504
508
) ?;
505
509
check_dimension (
506
510
TextureErrorDimension :: Z ,
507
511
texture_copy_view. origin . z ,
508
512
copy_size. depth_or_array_layers ,
509
513
extent. depth_or_array_layers ,
514
+ false , // partial copy always allowed on Z/layer dimension
510
515
) ?;
511
516
512
517
if texture_copy_view. origin . x % block_width != 0 {
0 commit comments