Respect interpolation modes on PS inputs when gathering debug data

This commit is contained in:
baldurk
2020-02-06 17:02:39 +00:00
parent 511f82d897
commit 1b29d0d69c
5 changed files with 40 additions and 14 deletions
+3 -3
View File
@@ -2150,9 +2150,9 @@ ShaderDebugTrace *D3D11Replay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t
rdcstr extractHlsl;
int structureStride = 0;
DXBCDebug::GatherPSInputDataForInitialValues(*dxbc->GetReflection(), *prevdxbc->GetReflection(),
initialValues, floatInputs, inputVarNames,
extractHlsl, structureStride);
DXBCDebug::GatherPSInputDataForInitialValues(dxbc, *prevdxbc->GetReflection(), initialValues,
floatInputs, inputVarNames, extractHlsl,
structureStride);
uint32_t overdrawLevels = 100; // maximum number of overdraw levels
+3 -3
View File
@@ -1214,9 +1214,9 @@ ShaderDebugTrace *D3D12Replay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t
rdcstr extractHlsl;
int structureStride = 0;
DXBCDebug::GatherPSInputDataForInitialValues(*dxbc->GetReflection(), *prevDxbc->GetReflection(),
initialValues, floatInputs, inputVarNames,
extractHlsl, structureStride);
DXBCDebug::GatherPSInputDataForInitialValues(dxbc, *prevDxbc->GetReflection(), initialValues,
floatInputs, inputVarNames, extractHlsl,
structureStride);
uint32_t overdrawLevels = 100; // maximum number of overdraw levels
+24 -1
View File
@@ -4431,12 +4431,15 @@ void LookupSRVFormatFromShaderReflection(const DXBC::Reflection &reflection,
}
}
void GatherPSInputDataForInitialValues(const DXBC::Reflection &psDxbc,
void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
const DXBC::Reflection &prevStageDxbc,
rdcarray<PSInputElement> &initialValues,
rdcarray<rdcstr> &floatInputs, rdcarray<rdcstr> &inputVarNames,
rdcstr &psInputDefinition, int &structureStride)
{
const DXBC::Reflection &psDxbc = *dxbc->GetReflection();
const DXBCBytecode::Program *program = dxbc->GetDXBCByteCode();
// When debugging a pixel shader, we need to get the initial values of each pixel shader
// input for the pixel that we are debugging, from whichever the previous shader stage was
// configured in the pipeline. This function returns the input element definitions, other
@@ -4568,8 +4571,28 @@ void GatherPSInputDataForInitialValues(const DXBC::Reflection &psDxbc,
}
}
DXBCBytecode::InterpolationMode interpolation = DXBCBytecode::INTERPOLATION_UNDEFINED;
if(program)
{
for(size_t d = 0; d < program->GetNumDeclarations(); d++)
{
const DXBCBytecode::Declaration &decl = program->GetDeclaration(d);
if(decl.declaration == DXBCBytecode::OPCODE_DCL_INPUT_PS &&
decl.operand.indices[0].absolute && decl.operand.indices[0].index == sig.regIndex)
{
interpolation = decl.interpolation;
break;
}
}
}
if(nointerp)
psInputDefinition += "nointerpolation ";
else if(interpolation != DXBCBytecode::INTERPOLATION_UNDEFINED &&
interpolation != DXBCBytecode::INTERPOLATION_CONSTANT)
psInputDefinition += ToStr(interpolation) + " ";
psInputDefinition += "float";
}
+1 -1
View File
@@ -207,7 +207,7 @@ void FillViewFmt(DXGI_FORMAT format, GlobalState::ViewFmt &viewFmt);
void LookupSRVFormatFromShaderReflection(const DXBC::Reflection &reflection,
const BindingSlot &slot, GlobalState::ViewFmt &viewFmt);
void GatherPSInputDataForInitialValues(const DXBC::Reflection &psDxbc,
void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
const DXBC::Reflection &prevStageDxbc,
rdcarray<PSInputElement> &initialValues,
rdcarray<rdcstr> &floatInputs, rdcarray<rdcstr> &inputVarNames,
@@ -2803,14 +2803,17 @@ rdcstr DoStringise(const DXBCBytecode::InterpolationMode &el)
BEGIN_ENUM_STRINGISE(DXBCBytecode::InterpolationMode)
{
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_UNDEFINED, "undefined");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_CONSTANT, "constant");
// differs slightly from fxc but it's very convenient to use the hlsl terms, which are used in
// all other cases
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_CONSTANT, "nointerpolation");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR, "linear");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR_CENTROID, "linearCentroid");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR_NOPERSPECTIVE, "linearNopersp");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR_CENTROID, "linear centroid");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR_NOPERSPECTIVE, "linear noperspective");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID,
"linearNoperspCentroid");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR_SAMPLE, "linearSample");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE, "linaerNoperspSample");
"linear noperspective centroid");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR_SAMPLE, "linear sample");
STRINGISE_ENUM_CLASS_NAMED(INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE,
"linear noperspective sample");
}
END_ENUM_STRINGISE();
}