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:
1 parent
d2a4bae1f4
commit
c2f60d6bdd
2 files changed
+70
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user