Check GPUDepthStencilState.format even when neither is enabled (#8766)

Fixes #8736
This commit is contained in:
Andy Leiserson authored and GitHub committed 2025-12-22 18:33:59 -08:00
1 parent 592736efa0
commit df4ae64df6
4 files changed
+17

No files matched your search

+6
View File
@@ -45,6 +45,12 @@ Bottom level categories:
- Added support for cooperative load/store operations in shaders. Currently only WGSL on the input and SPIR-V, METAL, and WGSL on the output are supported. By @kvark in [#8251](https://github.com/gfx-rs/wgpu/issues/8251).
### Bug Fixes
#### General
- Fixed validation of the texture format in GPUDepthStencilState when neither depth nor stencil is actually enabled. By @andyleiserson in [#8766](https://github.com/gfx-rs/wgpu/pull/8766).
### Documentation
#### General
+1
View File
@@ -135,6 +135,7 @@ webgpu:api,validation,render_pass,render_pass_descriptor:attachments,*
webgpu:api,validation,render_pass,render_pass_descriptor:color_attachments,*
webgpu:api,validation,render_pass,render_pass_descriptor:resolveTarget,*
webgpu:api,validation,render_pass,resolve:resolve_attachment:*
webgpu:api,validation,render_pipeline,depth_stencil_state:format:*
webgpu:api,validation,render_pipeline,depth_stencil_state:stencil_write:*
webgpu:api,validation,resource_usages,buffer,in_pass_encoder:*
// FAIL: 2 other cases in resource_usages,texture,in_pass_encoder. https://github.com/gfx-rs/wgpu/issues/3126
+8
View File
@@ -4141,6 +4141,14 @@ impl Device {
if let Some(ds) = depth_stencil_state {
target_specified = true;
let error = 'error: {
if !ds.format.is_depth_stencil_format() {
// This error case is not redundant with the aspect check below when
// neither depth nor stencil is enabled at all.
break 'error Some(pipeline::DepthStencilStateError::FormatNotDepthOrStencil(
ds.format,
));
}
let format_features = self.describe_format_features(ds.format)?;
if !format_features
.allowed_usages
+2
View File
@@ -617,6 +617,8 @@ pub enum ColorStateError {
pub enum DepthStencilStateError {
#[error("Format {0:?} is not renderable")]
FormatNotRenderable(wgt::TextureFormat),
#[error("Format {0:?} is not a depth/stencil format")]
FormatNotDepthOrStencil(wgt::TextureFormat),
#[error("Format {0:?} does not have a depth aspect, but depth test/write is enabled")]
FormatNotDepth(wgt::TextureFormat),
#[error("Format {0:?} does not have a stencil aspect, but stencil test/write is enabled")]