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