mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-16 23:10:54 +00:00
Compute and return usedInputs from GatherPSInputDataForInitialValues
Ignored for DXBC. For DXIL this is used instead of searching the generated HLSL shader source
This commit is contained in:
@@ -1884,9 +1884,10 @@ ShaderDebugTrace *D3D11Replay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t
|
||||
const rdcarray<SigParameter> &inputSig = dxbc->GetReflection()->InputSig;
|
||||
DXBCDebug::GetInterpolationModeForInputParams(inputSig, dxbc->GetDXBCByteCode(), interpModes);
|
||||
|
||||
std::map<ShaderBuiltin, rdcstr> usedInputs; // not used for D3D11
|
||||
DXDebug::GatherPSInputDataForInitialValues(inputSig, prevdxbc->GetReflection()->OutputSig,
|
||||
interpModes, initialValues, floatInputs, inputVarNames,
|
||||
extractHlsl, structureStride);
|
||||
extractHlsl, structureStride, usedInputs);
|
||||
|
||||
uint32_t overdrawLevels = 100; // maximum number of overdraw levels
|
||||
|
||||
|
||||
@@ -2298,9 +2298,10 @@ ShaderDebugTrace *D3D12Replay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t
|
||||
else
|
||||
DXILDebug::GetInterpolationModeForInputParams(inputSig, dxbc->GetDXILByteCode(), interpModes);
|
||||
|
||||
std::map<ShaderBuiltin, rdcstr> usedInputs; // only used for DXIL
|
||||
DXDebug::GatherPSInputDataForInitialValues(inputSig, prevDxbc->GetReflection()->OutputSig,
|
||||
interpModes, initialValues, floatInputs, inputVarNames,
|
||||
extractHlsl, structureStride);
|
||||
extractHlsl, structureStride, usedInputs);
|
||||
|
||||
uint32_t overdrawLevels = 100; // maximum number of overdraw levels
|
||||
|
||||
@@ -2467,17 +2468,17 @@ struct PSInitialData
|
||||
// The semantics that RenderDoc requires in the shader
|
||||
bool inputHas_SV_Position = false;
|
||||
bool inputHas_SV_PrimitiveID = false;
|
||||
bool inputHas_SV_SampleIndex = false;
|
||||
bool inputHas_SV_Coverage = false;
|
||||
bool inputHas_SV_IsFrontFace = false;
|
||||
// SV_Coverage, SV_IsFrontFace, SV_SampleIndex : are not in the input structure, see
|
||||
// GatherPSInputDataForInitialValues
|
||||
bool inputHas_SV_Coverage = false;
|
||||
bool inputHas_SV_IsFrontFace = false;
|
||||
bool inputHas_SV_SampleIndex = false;
|
||||
|
||||
// DXC compiler errors if a semantic input is declared in multiple places
|
||||
if(dxbc->GetDXILByteCode())
|
||||
{
|
||||
inputHas_SV_Position = extractHlsl.contains(": SV_Position");
|
||||
inputHas_SV_PrimitiveID = extractHlsl.contains(": SV_PrimitiveID");
|
||||
inputHas_SV_Position = usedInputs.count(ShaderBuiltin::Position) > 0;
|
||||
inputHas_SV_PrimitiveID = usedInputs.count(ShaderBuiltin::PrimitiveIndex) > 0;
|
||||
}
|
||||
|
||||
extractHlsl += "void ExtractInputsPS(PSInput IN";
|
||||
@@ -2496,9 +2497,9 @@ struct PSInitialData
|
||||
|
||||
// Only used for DXIL shaders: copy any SV inputs we need from the input structure
|
||||
if(inputHas_SV_Position)
|
||||
extractHlsl += " float4 debug_pixelPos = IN.input_SV_Position;\n";
|
||||
extractHlsl += " float4 debug_pixelPos = IN." + usedInputs[ShaderBuiltin::Position] + ";\n";
|
||||
if(usePrimitiveID && inputHas_SV_PrimitiveID)
|
||||
extractHlsl += " uint prim = IN.input_SV_PrimitiveID;\n";
|
||||
extractHlsl += " uint prim = IN." + usedInputs[ShaderBuiltin::PrimitiveIndex] + ";\n";
|
||||
|
||||
extractHlsl += " uint idx = " + ToStr(overdrawLevels) + ";\n";
|
||||
extractHlsl += StringFormat::Fmt(
|
||||
|
||||
@@ -33,7 +33,8 @@ void GatherPSInputDataForInitialValues(const rdcarray<SigParameter> &stageInputS
|
||||
const rdcarray<DXBC::InterpolationMode> &interpModes,
|
||||
rdcarray<PSInputElement> &initialValues,
|
||||
rdcarray<rdcstr> &floatInputs, rdcarray<rdcstr> &inputVarNames,
|
||||
rdcstr &psInputDefinition, int &structureStride)
|
||||
rdcstr &psInputDefinition, int &structureStride,
|
||||
std::map<ShaderBuiltin, rdcstr> &usedInputs)
|
||||
{
|
||||
// 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
|
||||
@@ -54,6 +55,7 @@ void GatherPSInputDataForInitialValues(const rdcarray<SigParameter> &stageInputS
|
||||
if(stageInputSig.empty())
|
||||
{
|
||||
psInputDefinition += "float4 input_dummy : SV_Position;\n";
|
||||
usedInputs[ShaderBuiltin::Position] = "input_dummy";
|
||||
|
||||
initialValues.push_back(PSInputElement(-1, 0, 4, ShaderBuiltin::Undefined, true));
|
||||
|
||||
@@ -276,12 +278,15 @@ void GatherPSInputDataForInitialValues(const rdcarray<SigParameter> &stageInputS
|
||||
}
|
||||
}
|
||||
|
||||
psInputDefinition += ToStr((uint32_t)numCols) + " input_" + name;
|
||||
rdcstr inputName = "input_" + name;
|
||||
psInputDefinition += ToStr((uint32_t)numCols) + " " + inputName;
|
||||
if(arrayLength > 0)
|
||||
psInputDefinition += "[" + ToStr(arrayLength) + "]";
|
||||
psInputDefinition += " : " + name;
|
||||
if(sig.systemValue != ShaderBuiltin::Undefined)
|
||||
usedInputs[sig.systemValue] = inputName;
|
||||
|
||||
inputVarNames[i] = "input_" + name;
|
||||
inputVarNames[i] = inputName;
|
||||
if(arrayLength > 0)
|
||||
inputVarNames[i] += StringFormat::Fmt("[%d]", RDCMAX(0, arrayIndex));
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace DXBC
|
||||
{
|
||||
enum ResourceRetType;
|
||||
@@ -67,7 +69,8 @@ void GatherPSInputDataForInitialValues(const rdcarray<SigParameter> &stageInputS
|
||||
const rdcarray<DXBC::InterpolationMode> &interpModes,
|
||||
rdcarray<PSInputElement> &initialValues,
|
||||
rdcarray<rdcstr> &floatInputs, rdcarray<rdcstr> &inputVarNames,
|
||||
rdcstr &psInputDefinition, int &structureStride);
|
||||
rdcstr &psInputDefinition, int &structureStride,
|
||||
std::map<ShaderBuiltin, rdcstr> &usedInputs);
|
||||
|
||||
enum class GatherChannel : uint8_t
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user