Allow SV_PrimitiveID in PS inputs mixed with non-SV inputs

* Sometimes fxc gives an error about this -
  error X4576: Non system-generated input signature parameter () cannot appear after a system generated value.
* There doesn't seem to be a documented way to know how/when this is important,
  but unfortunately in some cases SV values can take up registers and affect
  register packing so we can't always omit them. Here for primitive ID as long
  as it was previously declared mid-inputs, we allow it to be declared there as
  normal to preserve interface matching.
This commit is contained in:
baldurk
2023-02-03 13:16:40 +00:00
parent 2eddf80770
commit eab5314af8
+10 -2
View File
@@ -4952,8 +4952,7 @@ void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
bool included = true;
// handled specially to account for SV_ ordering
if(sig.systemValue == ShaderBuiltin::PrimitiveIndex ||
sig.systemValue == ShaderBuiltin::MSAACoverage ||
if(sig.systemValue == ShaderBuiltin::MSAACoverage ||
sig.systemValue == ShaderBuiltin::IsFrontFace ||
sig.systemValue == ShaderBuiltin::MSAASampleIndex)
{
@@ -4961,6 +4960,15 @@ void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
included = false;
}
// it seems sometimes primitive ID can be included within inputs and isn't subject to the SV_
// ordering restrictions - possibly to allow for geometry shaders to output the primitive ID as
// an interpolant. Only comment it out if it's the last input.
if(i + 1 == numInputs && sig.systemValue == ShaderBuiltin::PrimitiveIndex)
{
psInputDefinition += "//";
included = false;
}
int arrayIndex = -1;
for(size_t a = 0; a < arrays.size(); a++)