stride
stride copied to clipboard
[Shaders] SV_SampleIndex causes shader error
Describe the bug
The SV_SampleIndex
semantic is only allowed as input to the pixel shader stage. If used, it gets created as vertex shader input and output which leads to an error of the HLSL compiler.
shader MyShader : VS_PS_Base
{
stage stream uint SampleIndex : SV_SampleIndex;
override stage void VSMain()
{
streams.ShadingPosition = mul(streams.Position, WorldViewProjection);
}
override stage void PSMain()
{
streams.ColorTarget = streams.SampleIndex * 0.25;
}
};
To Reproduce Steps to reproduce the behavior:
- Use the SV_SampleIndex semantic as a stream variable in the pixel shader.
Expected behavior The variable will only be added to the pixel shader input struct and the pixel shader stream struct.
Screenshots
Additional context Needed to deal with MSAA in #1403
I've noticed the same happens when using the SV_VertexID
semantic, when it gets added as a semantic to the geometry shader input, the shader has an error. So to fix these issues, the streams compiler needs to understand what semantics are allowed in what shader stage.