diff --git a/wgpu-core/src/conv.rs b/wgpu-core/src/conv.rs index 0003c991d..303980567 100644 --- a/wgpu-core/src/conv.rs +++ b/wgpu-core/src/conv.rs @@ -199,6 +199,17 @@ pub fn map_texture_usage_from_hal(uses: wgt::TextureUses) -> wgt::TextureUsages u } +/// Check the requested texture size against the supported limits. +/// +/// This function implements the texture size and sample count checks in [vtd +/// dimension step]. The format checks are elsewhere in [`create_texture`]`. +/// +/// Note that while there is some basic checking of the sample count here, there +/// is an additional set of checks when `sample_count > 1` elsewhere in +/// [`create_texture`]`. +/// +/// [vtd dimension step]: https://www.w3.org/TR/2025/CRD-webgpu-20251120/#:~:text=or%204.-,If%20descriptor.dimension%20is +/// [`create_texture`]: crate::device::Device::create_texture pub fn check_texture_dimension_size( dimension: wgt::TextureDimension, wgt::Extent3d { diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index bf2952067..778f38411 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -1424,6 +1424,11 @@ impl Device { .map_err(|error| CreateTextureError::MissingFeatures(desc.format, error))?; if desc.sample_count > 1 { + // + // + // Note that there are also some checks related to the sample count + // in [`conv::check_texture_dimension_size`]. + if desc.mip_level_count != 1 { return Err(CreateTextureError::InvalidMipLevelCount { requested: desc.mip_level_count,