Skip to content

Commit e33fec1

Browse files
committed
Only consider "included" inputs when defining POSITION_VAR, PRIM_VAR
Fixes D3D12 debugging when a PS includes SV_PrimitiveID
1 parent f368fb4 commit e33fec1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

renderdoc/driver/shaders/dxbc/dx_debug.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,13 @@ void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
303303
fetcher.hlsl += " : " + name;
304304
// DXIL does not allow redeclaring SV_ variables, any that we might need which could already be
305305
// in PSInput must be obtained from there and not redeclared in our entry point
306-
if(sig.systemValue == ShaderBuiltin::Position)
307-
defines += "#define POSITION_VAR " + inputName + "\n";
308-
else if(sig.systemValue == ShaderBuiltin::PrimitiveIndex)
309-
defines += "#define PRIM_VAR " + inputName + "\n";
306+
if(included)
307+
{
308+
if(sig.systemValue == ShaderBuiltin::Position)
309+
defines += "#define POSITION_VAR " + inputName + "\n";
310+
else if(sig.systemValue == ShaderBuiltin::PrimitiveIndex)
311+
defines += "#define PRIM_VAR " + inputName + "\n";
312+
}
310313

311314
inputVarNames[i] = inputName;
312315
if(arrayLength > 0)
@@ -446,7 +449,7 @@ void ExtractInputsPS(PSInput IN,
446449
#if USEPRIM && !defined(PRIM_VAR)
447450
uint primitive : SV_PrimitiveID,
448451
#endif
449-
// sample, coverage and isFrontFace are deliberately omittted from the
452+
// sample, coverage and isFrontFace are deliberately omitted from the
450453
// IN struct for SV_ ordering reasons
451454
uint sample : SV_SampleIndex,
452455
uint coverage : SV_Coverage,

0 commit comments

Comments
 (0)