@@ -371,7 +371,14 @@ pub(crate) fn validate_linear_texture_data(
371
371
/// * The copy must be from/to a single aspect of the texture.
372
372
/// * If `aligned` is true, the buffer offset must be aligned appropriately.
373
373
///
374
- /// Other checks in this algorithm are enforced elsewhere.
374
+ /// The following steps in the algorithm are implemented elsewhere:
375
+ /// * Invocation of other validation algorithms.
376
+ /// * The texture usage (COPY_DST / COPY_SRC) check.
377
+ /// * The check for non-copyable depth/stencil formats. The caller must perform
378
+ /// this check using `is_valid_copy_src_format` / `is_valid_copy_dst_format`
379
+ /// before calling this function. This function will panic if
380
+ /// [`wgt::TextureFormat::block_copy_size`] returns `None` due to a
381
+ /// non-copyable format.
375
382
///
376
383
/// [vtbc]: https://gpuweb.github.io/gpuweb/#abstract-opdef-validating-texture-buffer-copy
377
384
pub ( crate ) fn validate_texture_buffer_copy < T > (
@@ -394,9 +401,13 @@ pub(crate) fn validate_texture_buffer_copy<T>(
394
401
let mut offset_alignment = if desc. format . is_depth_stencil_format ( ) {
395
402
4
396
403
} else {
404
+ // The case where `block_copy_size` returns `None` is currently
405
+ // unreachable both for the reason in the expect message, and also
406
+ // because the currently-defined non-copyable formats are depth/stencil
407
+ // formats so would take the `if` branch.
397
408
desc. format
398
409
. block_copy_size ( Some ( texture_copy_view. aspect ) )
399
- . unwrap_or ( 1 )
410
+ . expect ( "non-copyable formats should have been rejected previously" )
400
411
} ;
401
412
402
413
// TODO(https://github.com/gfx-rs/wgpu/issues/7947): This does not match the spec.
0 commit comments