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

+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")]