Shader Debug HLSL split debugSampleLodCompare into two variables

This commit is contained in:
Jake Turner
2024-10-24 12:21:19 +01:00
parent 86a81507b5
commit a5b63f2f26
9 changed files with 30 additions and 23 deletions
+2 -1
View File
@@ -381,7 +381,8 @@ cbuffer DebugSampleOperation REG(b0)
int debugSampleGatherChannel;
int debugSampleSampleIndex;
int debugSampleOperation;
float debugSampleLodCompare;
float debugSampleLod;
float debugSampleCompare;
};
#define DEBUG_SAMPLE_MATH_DXBC_RCP 1000
+4 -4
View File
@@ -130,8 +130,8 @@ float4 DoFloatOpcode(float4 uv)
float4 ddx_ = debugSampleDDX;
float4 ddy_ = debugSampleDDY;
int4 offsets = debugSampleOffsets;
float lod = debugSampleLodCompare;
float compare = debugSampleLodCompare;
float lod = debugSampleLod;
float compare = debugSampleCompare;
if(opcode == DEBUG_SAMPLE_TEX_SAMPLE || opcode == DEBUG_SAMPLE_TEX_SAMPLE_BIAS ||
opcode == DEBUG_SAMPLE_TEX_SAMPLE_GRAD)
@@ -673,7 +673,7 @@ int4 DoIntOpcode(float4 uv)
float4 ddx_ = debugSampleDDX;
float4 ddy_ = debugSampleDDY;
int4 offsets = debugSampleOffsets;
float lod = debugSampleLodCompare;
float lod = debugSampleLod;
if(opcode == DEBUG_SAMPLE_TEX_LOAD || opcode == DEBUG_SAMPLE_TEX_LOAD_MS)
{
@@ -738,7 +738,7 @@ uint4 DoUIntOpcode(float4 uv)
float4 ddx_ = debugSampleDDX;
float4 ddy_ = debugSampleDDY;
int4 offsets = debugSampleOffsets;
float lod = debugSampleLodCompare;
float lod = debugSampleLod;
if(opcode == DEBUG_SAMPLE_TEX_LOAD || opcode == DEBUG_SAMPLE_TEX_LOAD_MS)
{
+2 -1
View File
@@ -1175,7 +1175,8 @@ bool D3D11DebugAPIWrapper::CalculateSampleGather(
cbufferData.debugSampleGatherChannel = (int)gatherChannel;
cbufferData.debugSampleSampleIndex = multisampleIndex;
cbufferData.debugSampleOperation = sampleOp;
cbufferData.debugSampleLodCompare = lodOrCompareValue;
cbufferData.debugSampleLod = lodOrCompareValue;
cbufferData.debugSampleCompare = lodOrCompareValue;
D3D11RenderStateTracker tracker(m_pDevice->GetImmediateContext());
+2 -2
View File
@@ -1110,7 +1110,7 @@ bool D3D12APIWrapper::CalculateMathIntrinsic(DXIL::DXOp dxOp, const ShaderVariab
bool D3D12APIWrapper::CalculateSampleGather(
DXIL::DXOp dxOp, SampleGatherResourceData resourceData, SampleGatherSamplerData samplerData,
const ShaderVariable &uv, const ShaderVariable &ddxCalc, const ShaderVariable &ddyCalc,
const int8_t texelOffsets[3], int multisampleIndex, float lodOrCompareValue,
const int8_t texelOffsets[3], int multisampleIndex, float lodValue, float compareValue,
const uint8_t swizzle[4], GatherChannel gatherChannel, DXBC::ShaderType shaderType,
uint32_t instructionIdx, const char *opString, ShaderVariable &output)
{
@@ -1144,7 +1144,7 @@ bool D3D12APIWrapper::CalculateSampleGather(
return D3D12ShaderDebug::CalculateSampleGather(
true, m_Device, sampleOp, resourceData, samplerData, uv, ddxCalc, ddyCalc, texelOffsets,
multisampleIndex, lodOrCompareValue, swizzle, gatherChannel, shaderType, instructionIdx,
multisampleIndex, lodValue, compareValue, swizzle, gatherChannel, shaderType, instructionIdx,
opString, output);
}
+2 -2
View File
@@ -51,8 +51,8 @@ public:
bool CalculateSampleGather(DXIL::DXOp dxOp, SampleGatherResourceData resourceData,
SampleGatherSamplerData samplerData, const ShaderVariable &uv,
const ShaderVariable &ddxCalc, const ShaderVariable &ddyCalc,
const int8_t texelOffsets[3], int multisampleIndex,
float lodOrCompareValue, const uint8_t swizzle[4],
const int8_t texelOffsets[3], int multisampleIndex, float lodValue,
float compareValue, const uint8_t swizzle[4],
GatherChannel gatherChannel, DXBC::ShaderType shaderType,
uint32_t instructionIdx, const char *opString, ShaderVariable &output);
ShaderVariable GetResourceInfo(DXIL::ResourceClass resClass, const DXDebug::BindingSlot &slot,
+5 -4
View File
@@ -165,7 +165,7 @@ bool D3D12ShaderDebug::CalculateSampleGather(
bool dxil, WrappedID3D12Device *device, int sampleOp, SampleGatherResourceData resourceData,
SampleGatherSamplerData samplerData, const ShaderVariable &uvIn,
const ShaderVariable &ddxCalcIn, const ShaderVariable &ddyCalcIn, const int8_t texelOffsets[3],
int multisampleIndex, float lodOrCompareValue, const uint8_t swizzle[4],
int multisampleIndex, float lodValue, float compareValue, const uint8_t swizzle[4],
GatherChannel gatherChannel, const DXBC::ShaderType shaderType, uint32_t instruction,
const char *opString, ShaderVariable &output)
{
@@ -280,7 +280,8 @@ bool D3D12ShaderDebug::CalculateSampleGather(
cbufferData.debugSampleGatherChannel = (int)gatherChannel;
cbufferData.debugSampleSampleIndex = multisampleIndex;
cbufferData.debugSampleOperation = sampleOp;
cbufferData.debugSampleLodCompare = lodOrCompareValue;
cbufferData.debugSampleLod = lodValue;
cbufferData.debugSampleCompare = compareValue;
D3D12RenderState &rs = device->GetQueue()->GetCommandData()->m_RenderState;
D3D12RenderState prevState = rs;
@@ -1459,8 +1460,8 @@ bool D3D12DebugAPIWrapper::CalculateSampleGather(
return D3D12ShaderDebug::CalculateSampleGather(
false, m_pDevice, sampleOp, resourceData, samplerData, uv, ddxCalc, ddyCalc, texelOffsets,
multisampleIndex, lodOrCompareValue, swizzle, gatherChannel, GetShaderType(), m_instruction,
opString, output);
multisampleIndex, lodOrCompareValue, lodOrCompareValue, swizzle, gatherChannel,
GetShaderType(), m_instruction, opString, output);
}
void GatherConstantBuffers(WrappedID3D12Device *pDevice, const DXBCBytecode::Program &program,
+5 -4
View File
@@ -44,10 +44,11 @@ bool CalculateMathIntrinsic(bool dxil, WrappedID3D12Device *device, int mathOp,
ShaderVariable &output2);
bool CalculateSampleGather(bool dxil, WrappedID3D12Device *device, int sampleOp,
SampleGatherResourceData resourceData, SampleGatherSamplerData samplerData,
const ShaderVariable &uv, const ShaderVariable &ddxCalc,
const ShaderVariable &ddyCalc, const int8_t texelOffsets[3],
int multisampleIndex, float lodOrCompareValue, const uint8_t swizzle[4],
SampleGatherResourceData resourceData,
SampleGatherSamplerData samplerData, const ShaderVariable &uv,
const ShaderVariable &ddxCalc, const ShaderVariable &ddyCalc,
const int8_t texelOffsets[3], int multisampleIndex, float lodValue,
float compareValue, const uint8_t swizzle[4],
GatherChannel gatherChannel, const DXBC::ShaderType shaderType,
uint32_t instruction, const char *opString, ShaderVariable &output);
+7 -4
View File
@@ -3848,7 +3848,8 @@ void ThreadState::PerformGPUResourceOp(const rdcarray<ThreadState> &workgroups,
ShaderVariable uv;
int8_t texelOffsets[3] = {0, 0, 0};
int msIndex = 0;
float lodOrCompareValue = 0.0f;
float lodValue = 0.0f;
float compareValue = 0.0f;
SampleGatherSamplerData samplerData = {};
samplerData.mode = SamplerMode::NUM_SAMPLERS;
@@ -3902,7 +3903,8 @@ void ThreadState::PerformGPUResourceOp(const rdcarray<ThreadState> &workgroups,
if(GetShaderVariable(inst.args[10], opCode, dxOpCode, arg))
{
RDCASSERTEQUAL(arg.type, VarType::Float);
lodOrCompareValue = arg.value.f32v[0];
lodValue = arg.value.f32v[0];
compareValue = arg.value.f32v[0];
}
}
}
@@ -3913,7 +3915,8 @@ void ThreadState::PerformGPUResourceOp(const rdcarray<ThreadState> &workgroups,
if(GetShaderVariable(inst.args[2], opCode, dxOpCode, arg))
{
msIndex = arg.value.u32v[0];
lodOrCompareValue = arg.value.f32v[0];
lodValue = arg.value.f32v[0];
compareValue = arg.value.f32v[0];
}
// UV is int data in args 3,4,5
@@ -3975,7 +3978,7 @@ void ThreadState::PerformGPUResourceOp(const rdcarray<ThreadState> &workgroups,
ShaderVariable data;
apiWrapper->CalculateSampleGather(dxOpCode, resourceData, samplerData, uv, ddx, ddy, texelOffsets,
msIndex, lodOrCompareValue, swizzle, gatherChannel,
msIndex, lodValue, compareValue, swizzle, gatherChannel,
m_ShaderType, instructionIdx, opString, data);
result.value = data.value;
+1 -1
View File
@@ -113,7 +113,7 @@ public:
SampleGatherSamplerData samplerData, const ShaderVariable &uv,
const ShaderVariable &ddxCalc, const ShaderVariable &ddyCalc,
const int8_t texelOffsets[3], int multisampleIndex,
float lodOrCompareValue, const uint8_t swizzle[4],
float lodValue, float compareValue, const uint8_t swizzle[4],
GatherChannel gatherChannel, DXBC::ShaderType shaderType,
uint32_t instructionIdx, const char *opString,
ShaderVariable &output) = 0;