mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
DXIL Debugger support for arrays in Input signature
This commit is contained in:
@@ -524,19 +524,20 @@ InterpolationMode GetInterpolationModeForInputParam(const SigParameter &sig,
|
||||
}
|
||||
for(size_t j = 0; j < entryPoint->inputs.size(); ++j)
|
||||
{
|
||||
const EntryPointInterface::Signature &dxilSig = entryPoint->inputs[j];
|
||||
if(dxilSig.startRow == (int32_t)sig.regIndex)
|
||||
const EntryPointInterface::Signature &dxilParam = entryPoint->inputs[j];
|
||||
int row = sig.regIndex;
|
||||
if((dxilParam.startRow <= row) && (row < (int)(dxilParam.startRow + dxilParam.rows)))
|
||||
{
|
||||
const int firstElem = sig.regChannelMask & 0x1 ? 0
|
||||
: sig.regChannelMask & 0x2 ? 1
|
||||
: sig.regChannelMask & 0x4 ? 2
|
||||
: sig.regChannelMask & 0x8 ? 3
|
||||
: -1;
|
||||
if(dxilSig.startCol == firstElem)
|
||||
if(dxilParam.startCol == firstElem)
|
||||
{
|
||||
if(sig.semanticName == dxilSig.name)
|
||||
if(sig.semanticName == dxilParam.name)
|
||||
{
|
||||
return (InterpolationMode)dxilSig.interpolation;
|
||||
return (InterpolationMode)dxilParam.interpolation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3174,21 +3174,26 @@ struct PSInitialData
|
||||
if(packedRegister >= 0)
|
||||
{
|
||||
int dxilInputIdx = -1;
|
||||
int dxilArrayIdx = 0;
|
||||
int packedElement = inputElement.elem;
|
||||
int row = packedRegister;
|
||||
// Find the DXIL Input index and element from that matches the register and element
|
||||
for(int j = 0; j < dxilInputs.count(); ++j)
|
||||
{
|
||||
const DXIL::EntryPointInterface::Signature &dxilParam = dxilInputs[j];
|
||||
if((dxilParam.startRow == (int32_t)packedRegister) && (dxilParam.startCol == packedElement))
|
||||
if((dxilParam.startRow <= row) && (row < (int)(dxilParam.startRow + dxilParam.rows)) &&
|
||||
(dxilParam.startCol == packedElement))
|
||||
{
|
||||
dxilInputIdx = j;
|
||||
dxilArrayIdx = row - dxilParam.startRow;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RDCASSERT(dxilInputIdx >= 0);
|
||||
RDCASSERT(dxilArrayIdx >= 0);
|
||||
|
||||
psInputDatas.emplace_back(dxilInputIdx, inputElement.numwords, inputElement.sysattribute,
|
||||
inputElement.included, data);
|
||||
psInputDatas.emplace_back(dxilInputIdx, dxilArrayIdx, inputElement.numwords,
|
||||
inputElement.sysattribute, inputElement.included, data);
|
||||
}
|
||||
|
||||
if(inputElement.included)
|
||||
@@ -3228,7 +3233,11 @@ struct PSInitialData
|
||||
}
|
||||
else
|
||||
{
|
||||
rawout = &invar.value.s32v[outElement];
|
||||
if(invar.rows <= 1)
|
||||
rawout = &invar.value.s32v[outElement];
|
||||
else
|
||||
rawout = &invar.members[psInput.array].value.s32v[outElement];
|
||||
|
||||
memcpy(rawout, psInput.data, psInput.numwords * 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1755,10 +1755,12 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
|
||||
uint32_t rowIdx = arg.value.u32v[0];
|
||||
RDCASSERT(GetShaderVariable(inst.args[3], opCode, dxOpCode, arg));
|
||||
uint32_t colIdx = arg.value.u32v[0];
|
||||
const ShaderVariable &a = m_Input.members[inputIdx];
|
||||
RDCASSERT(rowIdx < a.rows, rowIdx, a.rows);
|
||||
RDCASSERT(colIdx < a.columns, colIdx, a.columns);
|
||||
const uint32_t c = a.ColMajor() ? rowIdx * a.columns + colIdx : colIdx * a.rows + rowIdx;
|
||||
const ShaderVariable &var = m_Input.members[inputIdx];
|
||||
RDCASSERT(rowIdx < var.rows, rowIdx, var.rows);
|
||||
RDCASSERT(colIdx < var.columns, colIdx, var.columns);
|
||||
ShaderVariable &a = (var.rows <= 1) ? m_Input.members[inputIdx]
|
||||
: m_Input.members[inputIdx].members[rowIdx];
|
||||
const uint32_t c = colIdx;
|
||||
|
||||
#undef _IMPL
|
||||
#define _IMPL(I, S, U) comp<I>(result, 0) = comp<I>(a, c)
|
||||
@@ -7642,6 +7644,21 @@ ShaderDebugTrace *Debugger::BeginDebug(uint32_t eventId, const DXBC::DXBCContain
|
||||
v.rows = (uint8_t)sig.rows;
|
||||
v.columns = (uint8_t)sig.cols;
|
||||
v.type = VarTypeForComponentType(sig.type);
|
||||
if(v.rows <= 1)
|
||||
{
|
||||
v.rows = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
v.members.resize(v.rows);
|
||||
for(uint32_t r = 0; r < v.rows; r++)
|
||||
{
|
||||
v.members[r].rows = 1;
|
||||
v.members[r].columns = (uint8_t)sig.cols;
|
||||
v.members[r].type = v.type;
|
||||
v.members[r].name = StringFormat::Fmt("[%u]", r);
|
||||
}
|
||||
}
|
||||
|
||||
SourceVariableMapping inputMapping;
|
||||
inputMapping.name = v.name;
|
||||
@@ -7649,13 +7666,24 @@ ShaderDebugTrace *Debugger::BeginDebug(uint32_t eventId, const DXBC::DXBCContain
|
||||
inputMapping.rows = sig.rows;
|
||||
inputMapping.columns = sig.cols;
|
||||
inputMapping.variables.reserve(sig.cols);
|
||||
inputMapping.signatureIndex = sig.startRow;
|
||||
for(uint32_t c = 0; c < sig.cols; ++c)
|
||||
inputMapping.signatureIndex = i;
|
||||
if(v.rows <= 1)
|
||||
{
|
||||
inputMapping.variables.reserve(sig.cols);
|
||||
for(uint32_t c = 0; c < sig.cols; ++c)
|
||||
{
|
||||
DebugVariableReference ref;
|
||||
ref.type = DebugVariableType::Input;
|
||||
ref.name = inStruct.name + "." + v.name;
|
||||
ref.component = c;
|
||||
inputMapping.variables.push_back(ref);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugVariableReference ref;
|
||||
ref.type = DebugVariableType::Input;
|
||||
ref.name = inStruct.name + "." + v.name;
|
||||
ref.component = c;
|
||||
inputMapping.variables.push_back(ref);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +66,11 @@ void GetInterpolationModeForInputParams(const rdcarray<SigParameter> &stageInput
|
||||
|
||||
struct PSInputData
|
||||
{
|
||||
PSInputData(int inputIndex, int numWords, ShaderBuiltin sysAttribute, bool inc, void *pData)
|
||||
PSInputData(int inputIndex, int arrayIndex, int numWords, ShaderBuiltin sysAttribute, bool inc,
|
||||
void *pData)
|
||||
{
|
||||
input = inputIndex;
|
||||
array = arrayIndex;
|
||||
numwords = numWords;
|
||||
sysattribute = sysAttribute;
|
||||
included = inc;
|
||||
@@ -78,6 +80,7 @@ struct PSInputData
|
||||
void *data;
|
||||
ShaderBuiltin sysattribute;
|
||||
int input;
|
||||
int array;
|
||||
int numwords;
|
||||
bool included;
|
||||
};
|
||||
|
||||
@@ -175,7 +175,8 @@ bool DXIL::FindSigParameter(const rdcarray<SigParameter> &inputSig,
|
||||
{
|
||||
for(const SigParameter ¶m : inputSig)
|
||||
{
|
||||
if(dxilParam.startRow == (int32_t)param.regIndex)
|
||||
int row = param.regIndex;
|
||||
if((dxilParam.startRow <= row) && (row < (int)(dxilParam.startRow + dxilParam.rows)))
|
||||
{
|
||||
const int firstElem = param.regChannelMask & 0x1 ? 0
|
||||
: param.regChannelMask & 0x2 ? 1
|
||||
|
||||
Reference in New Issue
Block a user