Shaders: a pixel shader writing SV_StencilRef declares StencilRef

exp mrtz's channel y is lowered to an SV_StencilRef output, but the
module's shader flags never had StencilRef (bit 11) and SFI0 never had
D3D_SHADER_FEATURE_STENCIL_REF (0x200). DXC sets both for a pixel
shader whose output signature has the stencil reference, and the
validator checks the flags against the module.

Both are now set when a pixel shader outputs SV_StencilRef.
This commit is contained in:
Duff committed 2026-11-24 03:46:04 +01:00
1 parent 35e8407c9c
commit 3984e64bad
2 files changed
+70

No files matched your search

+8
View File
@@ -16,6 +16,7 @@ pub const ROOT_CBV_SPACE: u32 = 1;
/// `ShaderFlags` bits (metadata) and their `SFI0` feature bits.
pub(crate) mod flags {
pub const RAW_BUFFERS: u64 = 1 << 4;
pub const STENCIL_REF: u64 = 1 << 11;
pub const TYPED_UAV_LOADS: u64 = 1 << 13;
pub const WAVE_OPS: u64 = 1 << 19;
pub const INT64: u64 = 1 << 20;
@@ -471,6 +472,10 @@ impl Shader {
} else {
None
};
// A pixel shader with an SV_StencilRef output (as DXC collects it).
if self.pixel && self.outputs.iter().any(|o| o.kind == 20) {
self.flags |= flags::STENCIL_REF;
}
// Entry properties: shader flags (tag 0), thread-group size (4),
// wave size (11).
let mut props = Vec::new();
@@ -549,6 +554,9 @@ impl Shader {
dxil.extend(&bitcode);
let mut features = 0u64;
if self.flags & flags::STENCIL_REF != 0 {
features |= 0x200;
}
if self.flags & flags::TYPED_UAV_LOADS != 0 {
features |= 0x800;
}