mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-17 03:56:43 +00:00
Fix DXIL Debugger support for structs in the input structure
i.e. matrices Fixed incorrect asserts in LoadInput Fixed source variable mapping Fixed input data copying from fetcher results
This commit is contained in:
@@ -642,17 +642,20 @@ D3D12APIWrapper::D3D12APIWrapper(WrappedID3D12Device *device, const DXIL::Progra
|
||||
v.members[r].type = v.type;
|
||||
v.members[r].name = StringFormat::Fmt("[%u]", r);
|
||||
}
|
||||
v.rows = 0;
|
||||
v.columns = 0;
|
||||
v.type = VarType::Struct;
|
||||
}
|
||||
|
||||
SourceVariableMapping inputMapping;
|
||||
inputMapping.name = v.name;
|
||||
inputMapping.type = v.type;
|
||||
inputMapping.rows = sig.rows;
|
||||
inputMapping.columns = sig.cols;
|
||||
inputMapping.variables.reserve(sig.cols);
|
||||
inputMapping.signatureIndex = i;
|
||||
if(v.rows <= 1)
|
||||
if(v.rows == 1)
|
||||
{
|
||||
SourceVariableMapping inputMapping;
|
||||
inputMapping.name = v.name;
|
||||
inputMapping.type = v.type;
|
||||
inputMapping.rows = sig.rows;
|
||||
inputMapping.columns = sig.cols;
|
||||
inputMapping.variables.reserve(sig.cols);
|
||||
inputMapping.signatureIndex = i;
|
||||
inputMapping.variables.reserve(sig.cols);
|
||||
for(uint32_t c = 0; c < sig.cols; ++c)
|
||||
{
|
||||
@@ -662,15 +665,30 @@ D3D12APIWrapper::D3D12APIWrapper(WrappedID3D12Device *device, const DXIL::Progra
|
||||
ref.component = c;
|
||||
inputMapping.variables.push_back(ref);
|
||||
}
|
||||
m_SourceVars.push_back(inputMapping);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugVariableReference ref;
|
||||
ref.type = DebugVariableType::Input;
|
||||
ref.name = inStruct.name + "." + v.name;
|
||||
inputMapping.variables.push_back(ref);
|
||||
// Make a mapping per element
|
||||
for(const ShaderVariable &member : v.members)
|
||||
{
|
||||
SourceVariableMapping inputMapping;
|
||||
inputMapping.name = v.name + member.name;
|
||||
inputMapping.type = member.type;
|
||||
inputMapping.rows = 1;
|
||||
inputMapping.columns = member.columns;
|
||||
inputMapping.signatureIndex = -1;
|
||||
for(uint32_t c = 0; c < member.columns; ++c)
|
||||
{
|
||||
DebugVariableReference ref;
|
||||
ref.type = DebugVariableType::Input;
|
||||
ref.name = inStruct.name + "." + v.name + member.name;
|
||||
ref.component = c;
|
||||
inputMapping.variables.push_back(ref);
|
||||
}
|
||||
m_SourceVars.push_back(inputMapping);
|
||||
}
|
||||
}
|
||||
m_SourceVars.push_back(inputMapping);
|
||||
}
|
||||
|
||||
// Make a single source variable mapping for the whole input struct
|
||||
|
||||
@@ -3370,10 +3370,15 @@ ShaderDebugTrace *D3D12Replay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t
|
||||
}
|
||||
else
|
||||
{
|
||||
if(invar.rows <= 1)
|
||||
rawout = &invar.value.s32v[outElement];
|
||||
else
|
||||
if(invar.rows == 0)
|
||||
{
|
||||
RDCASSERT(input.array < invar.members.count(), input.array, invar.members.count());
|
||||
rawout = &invar.members[input.array].value.s32v[outElement];
|
||||
}
|
||||
else
|
||||
{
|
||||
rawout = &invar.value.s32v[outElement];
|
||||
}
|
||||
|
||||
memcpy(rawout, input.data, input.numwords * 4);
|
||||
}
|
||||
|
||||
@@ -1838,11 +1838,13 @@ bool ThreadState::ExecuteInstruction(const rdcarray<ThreadState> &workgroup)
|
||||
uint32_t rowIdx = arg.value.u32v[0];
|
||||
RDCASSERT(GetShaderVariable(inst.args[3], opCode, dxOpCode, arg));
|
||||
uint32_t colIdx = arg.value.u32v[0];
|
||||
|
||||
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];
|
||||
if(var.rows == 0)
|
||||
RDCASSERT(rowIdx < var.members.size(), rowIdx, var.members.size());
|
||||
|
||||
const ShaderVariable &a = (var.rows != 0) ? var : var.members[rowIdx];
|
||||
RDCASSERT(colIdx < a.columns, colIdx, a.columns);
|
||||
const uint32_t c = colIdx;
|
||||
|
||||
#undef _IMPL
|
||||
|
||||
Reference in New Issue
Block a user