Pass signature index in source variable mapping, not builtin

* The builtin is more directly useful but the signature index allows us to match
  up inputs and outputs that don't have a builtin meaning (pure interpolators).
This commit is contained in:
baldurk
2020-02-25 18:19:52 +00:00
parent 12e378f04b
commit 914dc88cd0
14 changed files with 167 additions and 81 deletions
+15 -9
View File
@@ -386,7 +386,7 @@ struct SourceVariableMapping
bool operator==(const SourceVariableMapping &o) const
{
return name == o.name && type == o.type && rows == o.rows && columns == o.columns &&
offset == o.offset && builtin == o.builtin && variables == o.variables;
offset == o.offset && signatureIndex == o.signatureIndex && variables == o.variables;
}
bool operator<(const SourceVariableMapping &o) const
{
@@ -400,8 +400,8 @@ struct SourceVariableMapping
return columns < o.columns;
if(!(offset == o.offset))
return offset < o.offset;
if(!(builtin == o.builtin))
return builtin < o.builtin;
if(!(signatureIndex == o.signatureIndex))
return signatureIndex < o.signatureIndex;
if(!(variables == o.variables))
return variables < o.variables;
return false;
@@ -419,14 +419,17 @@ struct SourceVariableMapping
DOCUMENT("The number of columns in this variable.");
uint32_t columns = 0;
DOCUMENT(R"(The offset in the parent source variable, for struct members. Useful for sorting.
For builtin variables this can also indicate the index of the builtin (e.g. multiple color outputs).
)");
DOCUMENT("The offset in the parent source variable, for struct members. Useful for sorting.");
uint32_t offset;
DOCUMENT("The :class:`ShaderBuiltin` that this variable corresponds to.");
ShaderBuiltin builtin = ShaderBuiltin::Undefined;
DOCUMENT(R"(The index in the input or output signature of the shader that this variable represents.
The type of signature can be disambiguated by the debug variables referenced - inputs are stored
separately.
This will be set to -1 if the variable is not part of either signature.
)");
int32_t signatureIndex = -1;
DOCUMENT(R"(The debug variables that the components of this high level variable map to. Multiple
ranges could refer to the same variable if a contiguous range is mapped to - the mapping is
@@ -634,6 +637,9 @@ struct ShaderDebugTrace
ShaderDebugTrace(const ShaderDebugTrace &) = default;
ShaderDebugTrace &operator=(const ShaderDebugTrace &) = default;
DOCUMENT("The shader stage being debugged in this trace");
ShaderStage stage;
DOCUMENT("The input variables for this shader as a list of :class:`ShaderVariable`.");
rdcarray<ShaderVariable> inputs;
+12 -10
View File
@@ -4809,6 +4809,7 @@ ShaderDebugTrace *InterpretDebugger::BeginDebug(const DXBC::DXBCContainer *dxbcC
{
ShaderDebugTrace *ret = new ShaderDebugTrace;
ret->debugger = this;
ret->stage = refl.stage;
this->dxbc = dxbcContainer;
this->activeLaneIndex = activeIndex;
@@ -4835,8 +4836,10 @@ ShaderDebugTrace *InterpretDebugger::BeginDebug(const DXBC::DXBCContainer *dxbcC
if(maxReg >= 0 || inputCoverage)
{
state.inputs.resize(maxReg + 1 + (inputCoverage ? 1 : 0));
for(const SigParameter &sig : dxbc->GetReflection()->InputSig)
for(int32_t sigIdx = 0; sigIdx < dxbc->GetReflection()->InputSig.size(); sigIdx++)
{
const SigParameter &sig = dxbc->GetReflection()->InputSig[sigIdx];
ShaderVariable v;
v.name = dxbc->GetDXBCByteCode()->GetRegisterName(DXBCBytecode::TYPE_INPUT, sig.regIndex);
@@ -4874,9 +4877,7 @@ ShaderDebugTrace *InterpretDebugger::BeginDebug(const DXBC::DXBCContainer *dxbcC
sourcemap.rows = 1;
sourcemap.columns = sig.compCount;
sourcemap.variables.reserve(sig.compCount);
sourcemap.builtin = sig.systemValue;
if(sig.systemValue != ShaderBuiltin::Undefined)
sourcemap.offset = sig.regIndex;
sourcemap.signatureIndex = sigIdx;
for(uint16_t c = 0; c < 4; c++)
{
@@ -4908,7 +4909,8 @@ ShaderDebugTrace *InterpretDebugger::BeginDebug(const DXBC::DXBCContainer *dxbcC
sourcemap.type = VarType::UInt;
sourcemap.rows = 1;
sourcemap.columns = 1;
sourcemap.builtin = ShaderBuiltin::MSAACoverage;
// no corresponding signature element for this - maybe we should generate one?
sourcemap.signatureIndex = -1;
DebugVariableReference ref;
ref.type = DebugVariableType::Input;
ref.name = state.inputs.back().name;
@@ -4920,8 +4922,10 @@ ShaderDebugTrace *InterpretDebugger::BeginDebug(const DXBC::DXBCContainer *dxbcC
}
// Set up outputs in the shader state
for(const SigParameter &sig : dxbc->GetReflection()->OutputSig)
for(int32_t sigIdx = 0; sigIdx < dxbc->GetReflection()->OutputSig.size(); sigIdx++)
{
const SigParameter &sig = dxbc->GetReflection()->OutputSig[sigIdx];
DXBCBytecode::OperandType type = DXBCBytecode::TYPE_OUTPUT;
if(sig.systemValue == ShaderBuiltin::DepthOutput)
@@ -4983,9 +4987,7 @@ ShaderDebugTrace *InterpretDebugger::BeginDebug(const DXBC::DXBCContainer *dxbcC
sourcemap.type = v.type;
sourcemap.rows = 1;
sourcemap.columns = sig.compCount;
sourcemap.builtin = sig.systemValue;
if(sig.systemValue != ShaderBuiltin::Undefined)
sourcemap.offset = sig.regIndex;
sourcemap.signatureIndex = sigIdx;
sourcemap.variables.reserve(sig.compCount);
for(uint16_t c = 0; c < 4; c++)
@@ -5035,7 +5037,7 @@ ShaderDebugTrace *InterpretDebugger::BeginDebug(const DXBC::DXBCContainer *dxbcC
// all these variables are 1 scalar component
sourcemap.rows = 1;
sourcemap.columns = 1;
sourcemap.builtin = sig.systemValue;
sourcemap.signatureIndex = sigIdx;
DebugVariableReference ref;
ref.type = DebugVariableType::Variable;
ref.name = v.name;
+5 -1
View File
@@ -28,6 +28,9 @@
#include "spirv_common.h"
#include "spirv_processor.h"
struct SPIRVInterfaceAccess;
struct SPIRVPatchData;
namespace rdcspv
{
class DebugAPIWrapper
@@ -134,7 +137,7 @@ public:
ShaderDebugTrace *BeginDebug(DebugAPIWrapper *apiWrapper, const ShaderStage stage,
const rdcstr &entryPoint, const rdcarray<SpecConstant> &specInfo,
const std::map<size_t, uint32_t> &instructionLines,
uint32_t activeIndex);
const SPIRVPatchData &patchData, uint32_t activeIndex);
rdcarray<ShaderDebugState> ContinueDebug();
@@ -171,6 +174,7 @@ private:
const DataType &inType, ShaderVariable &outVar);
void AddSourceVars(rdcarray<SourceVariableMapping> &sourceVars, const DataType &inType,
const rdcstr &sourceName, const rdcstr &varName, uint32_t &offset);
void MakeSignatureNames(const rdcarray<SPIRVInterfaceAccess> &sigList, rdcarray<rdcstr> &sigNames);
/////////////////////////////////////////////////////////
// debug data
@@ -25,6 +25,7 @@
#include "spirv_debug.h"
#include "common/formatting.h"
#include "spirv_op_helpers.h"
#include "spirv_reflect.h"
static uint32_t VarByteSize(const ShaderVariable &var)
{
@@ -85,11 +86,46 @@ const rdcspv::DataType &Debugger::GetType(Id typeId)
return dataTypes[typeId];
}
void Debugger::MakeSignatureNames(const rdcarray<SPIRVInterfaceAccess> &sigList,
rdcarray<rdcstr> &sigNames)
{
for(const SPIRVInterfaceAccess &sig : sigList)
{
rdcstr name = GetRawName(sig.ID);
const DataType *type = &dataTypes[idTypes[sig.ID]];
RDCASSERT(type->type == DataType::PointerType);
type = &dataTypes[type->InnerType()];
for(uint32_t chain : sig.accessChain)
{
if(type->type == DataType::ArrayType)
{
name += StringFormat::Fmt("[%u]", chain);
type = &dataTypes[type->InnerType()];
}
else if(type->type == DataType::StructType)
{
name += StringFormat::Fmt("._child%u", chain);
type = &dataTypes[type->children[chain].type];
}
else
{
RDCERR("Got access chain with non-aggregate type in interface.");
break;
}
}
sigNames.push_back(name);
}
}
ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *apiWrapper, const ShaderStage stage,
const rdcstr &entryPoint,
const rdcarray<SpecConstant> &specInfo,
const std::map<size_t, uint32_t> &instructionLines,
uint32_t activeIndex)
const SPIRVPatchData &patchData, uint32_t activeIndex)
{
Id entryId = entryLookup[entryPoint];
@@ -179,6 +215,7 @@ ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *apiWrapper, const Shader
ShaderDebugTrace *ret = new ShaderDebugTrace;
ret->debugger = this;
ret->stage = stage;
this->activeLaneIndex = activeIndex;
this->stage = stage;
this->apiWrapper = apiWrapper;
@@ -197,6 +234,11 @@ ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *apiWrapper, const Shader
for(auto it = constants.begin(); it != constants.end(); it++)
active.ids[it->first] = EvaluateConstant(it->first, specInfo);
rdcarray<rdcstr> inputSigNames, outputSigNames;
MakeSignatureNames(patchData.inputs, inputSigNames);
MakeSignatureNames(patchData.outputs, outputSigNames);
rdcarray<Id> inputIDs, outputIDs, cbufferIDs;
// allocate storage for globals with opaque storage classes, and prepare to set up pointers to
@@ -226,8 +268,13 @@ ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *apiWrapper, const Shader
// I/O variable structs don't have offsets, so give them fake offsets to ensure they sort as
// we want. Since FillVariable is depth-first the source vars are already in order.
// We also add the signature index
for(size_t i = oldSize; i < globalSourceVars.size(); i++)
{
globalSourceVars[i].offset = uint32_t(i - oldSize);
globalSourceVars[i].signatureIndex =
(isInput ? inputSigNames : outputSigNames).indexOf(globalSourceVars[i].variables[0].name);
}
if(isInput)
{
@@ -904,15 +951,16 @@ void Debugger::AllocateVariable(const Decorations &varDecorations, const Decorat
for(uint32_t x = 0; x < uint32_t(outVar.rows) * outVar.columns; x++)
sourceVar.variables.push_back(DebugVariableReference(sourceVarType, outVar.name, x));
ShaderBuiltin builtin = ShaderBuiltin::Undefined;
if(curDecorations.flags & Decorations::HasBuiltIn)
sourceVar.builtin = MakeShaderBuiltin(stage, curDecorations.builtIn);
builtin = MakeShaderBuiltin(stage, curDecorations.builtIn);
globalSourceVars.push_back(sourceVar);
if(sourceVarType == DebugVariableType::Input)
{
apiWrapper->FillInputValue(
outVar, sourceVar.builtin,
outVar, builtin,
(curDecorations.flags & Decorations::HasLocation) ? curDecorations.location : 0,
(curDecorations.flags & Decorations::HasOffset) ? curDecorations.offset : 0);
}
@@ -62,7 +62,7 @@ void AddXFBAnnotations(const ShaderReflection &refl, const SPIRVPatchData &patch
editor.Prepare();
rdcarray<SigParameter> outsig = refl.outputSignature;
rdcarray<SPIRVPatchData::InterfaceAccess> outpatch = patchData.outputs;
rdcarray<SPIRVInterfaceAccess> outpatch = patchData.outputs;
rdcspv::Id entryid;
for(const rdcspv::EntryPoint &entry : editor.GetEntries())
@@ -815,7 +815,7 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
else
childname += StringFormat::Fmt(".child%zu", i);
SPIRVPatchData::InterfaceAccess patch;
SPIRVInterfaceAccess patch;
patch.accessChain = {i};
uint32_t dummy = 0;
@@ -1180,7 +1180,7 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
for(size_t i = 0; i < inputs.size(); i++)
reflection.inputSignature.push_back(inputs[indices[i]]);
rdcarray<SPIRVPatchData::InterfaceAccess> inPatch = patchData.inputs;
rdcarray<SPIRVInterfaceAccess> inPatch = patchData.inputs;
for(size_t i = 0; i < inputs.size(); i++)
patchData.inputs[i] = inPatch[indices[i]];
}
@@ -1196,7 +1196,7 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
for(size_t i = 0; i < outputs.size(); i++)
reflection.outputSignature.push_back(outputs[indices[i]]);
rdcarray<SPIRVPatchData::InterfaceAccess> outPatch = patchData.outputs;
rdcarray<SPIRVInterfaceAccess> outPatch = patchData.outputs;
for(size_t i = 0; i < outputs.size(); i++)
patchData.outputs[i] = outPatch[indices[i]];
}
@@ -1452,9 +1452,8 @@ void Reflector::MakeConstantBlockVariable(ShaderConstant &outConst,
void Reflector::AddSignatureParameter(const bool isInput, const ShaderStage stage,
const Id globalID, const Id parentStructID, uint32_t &regIndex,
const SPIRVPatchData::InterfaceAccess &parentPatch,
const rdcstr &varName, const DataType &type,
const Decorations &varDecorations,
const SPIRVInterfaceAccess &parentPatch, const rdcstr &varName,
const DataType &type, const Decorations &varDecorations,
rdcarray<SigParameter> &sigarray, SPIRVPatchData &patchData,
const rdcarray<SpecConstant> &specInfo) const
{
@@ -1462,7 +1461,7 @@ void Reflector::AddSignatureParameter(const bool isInput, const ShaderStage stag
sig.needSemanticIndex = false;
SPIRVPatchData::InterfaceAccess patch;
SPIRVInterfaceAccess patch;
patch.accessChain = parentPatch.accessChain;
patch.ID = globalID;
patch.structID = parentStructID;
+26 -26
View File
@@ -34,34 +34,34 @@ enum class ShaderBuiltin : uint32_t;
struct ShaderReflection;
struct ShaderBindpointMapping;
struct SPIRVInterfaceAccess
{
// ID of the base variable
rdcspv::Id ID;
// ID of the struct parent of this variable
rdcspv::Id structID;
// member in the parent struct of this variable (for MemberDecorate)
uint32_t structMemberIndex = 0;
// the access chain of indices
rdcarray<uint32_t> accessChain;
// this is an element of an array that's been exploded after [0].
// i.e. this is false for non-arrays, and false for element [0] in an array, then true for
// elements [1], [2], [3], etc..
bool isArraySubsequentElement = false;
};
// extra information that goes along with a ShaderReflection that has extra information for SPIR-V
// patching
struct SPIRVPatchData
{
struct InterfaceAccess
{
// ID of the base variable
rdcspv::Id ID;
// ID of the struct parent of this variable
rdcspv::Id structID;
// member in the parent struct of this variable (for MemberDecorate)
uint32_t structMemberIndex = 0;
// the access chain of indices
rdcarray<uint32_t> accessChain;
// this is an element of an array that's been exploded after [0].
// i.e. this is false for non-arrays, and false for element [0] in an array, then true for
// elements [1], [2], [3], etc..
bool isArraySubsequentElement = false;
};
// matches the input/output signature array, with details of where to fetch the output from in the
// SPIR-V.
rdcarray<InterfaceAccess> inputs;
rdcarray<InterfaceAccess> outputs;
rdcarray<SPIRVInterfaceAccess> inputs;
rdcarray<SPIRVInterfaceAccess> outputs;
// the output topology for tessellation and geometry shaders
Topology outTopo = Topology::Unknown;
@@ -109,10 +109,10 @@ private:
const rdcarray<SpecConstant> &specInfo) const;
void AddSignatureParameter(const bool isInput, const ShaderStage stage, const Id id,
const Id structID, uint32_t &regIndex,
const SPIRVPatchData::InterfaceAccess &parentPatch,
const rdcstr &varName, const DataType &type,
const Decorations &decorations, rdcarray<SigParameter> &sigarray,
SPIRVPatchData &patchData, const rdcarray<SpecConstant> &specInfo) const;
const SPIRVInterfaceAccess &parentPatch, const rdcstr &varName,
const DataType &type, const Decorations &decorations,
rdcarray<SigParameter> &sigarray, SPIRVPatchData &patchData,
const rdcarray<SpecConstant> &specInfo) const;
rdcstr cmdline;
DenseIdMap<rdcstr> strings;
+1 -1
View File
@@ -255,7 +255,7 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u
rdcspv::Debugger *debugger = new rdcspv::Debugger;
debugger->Parse(shader.spirv.GetSPIRV());
ShaderDebugTrace *ret = debugger->BeginDebug(apiWrapper, ShaderStage::Vertex, entryPoint, spec,
shadRefl.instructionLines, 0);
shadRefl.instructionLines, shadRefl.patchData, 0);
return ret;
}
+3 -2
View File
@@ -357,7 +357,7 @@ void DoSerialise(SerialiserType &ser, SourceVariableMapping &el)
SERIALISE_MEMBER(rows);
SERIALISE_MEMBER(columns);
SERIALISE_MEMBER(offset);
SERIALISE_MEMBER(builtin);
SERIALISE_MEMBER(signatureIndex);
SERIALISE_MEMBER(variables);
SIZE_CHECK(72);
@@ -401,6 +401,7 @@ void DoSerialise(SerialiserType &ser, ShaderDebugState &el)
template <typename SerialiserType>
void DoSerialise(SerialiserType &ser, ShaderDebugTrace &el)
{
SERIALISE_MEMBER(stage);
SERIALISE_MEMBER(inputs);
SERIALISE_MEMBER(constantBlocks);
SERIALISE_MEMBER(readOnlyResources);
@@ -416,7 +417,7 @@ void DoSerialise(SerialiserType &ser, ShaderDebugTrace &el)
if(ser.IsReading())
el.debugger = (ShaderDebugger *)debugger;
SIZE_CHECK(152);
SIZE_CHECK(160);
}
template <typename SerialiserType>
+34
View File
@@ -458,6 +458,40 @@ class TestCase:
return cycles, variables
def get_sig_index(self, signature, builtin: rd.ShaderBuiltin, reg_index: int = -1):
search = (builtin, reg_index)
signature_mapped = [(sig.systemValue, sig.regIndex) for sig in signature]
if reg_index == -1:
search = builtin
signature_mapped = [x[0] for x in signature_mapped]
if search in signature_mapped:
return signature_mapped.index(search)
return -1
def find_source_var(self, sourceVars, signatureIndex, varType):
vars = [x for x in sourceVars if x.signatureIndex == signatureIndex and x.variables[0].type == varType]
if len(vars) == 0:
return None
return vars[0]
def find_input_source_var(self, trace: rd.ShaderDebugTrace, builtin: rd.ShaderBuiltin, reg_index: int = -1):
refl: rd.ShaderReflection = self.controller.GetPipelineState().GetShaderReflection(trace.stage)
sig_index = self.get_sig_index(refl.inputSignature, builtin, reg_index)
return self.find_source_var(trace.sourceVars, sig_index, rd.DebugVariableType.Input)
def find_output_source_var(self, trace: rd.ShaderDebugTrace, builtin: rd.ShaderBuiltin, reg_index: int = -1):
refl: rd.ShaderReflection = self.controller.GetPipelineState().GetShaderReflection(trace.stage)
sig_index = self.get_sig_index(refl.outputSignature, builtin, reg_index)
return self.find_source_var(trace.sourceVars, sig_index, rd.DebugVariableType.Variable)
def evalute_source_var(self, sourceVar: rd.SourceVariableMapping, debugVars):
debugged = rd.ShaderVariable()
debugged.name = sourceVar.name
+4 -4
View File
@@ -16,8 +16,8 @@ class D3D11_PrimitiveID(rdtest.TestCase):
cycles, variables = self.process_trace(trace)
# Find the SV_PrimitiveID variable
primInput = [var for var in sourceVars if var.builtin == rd.ShaderBuiltin.PrimitiveIndex]
if primInput == []:
primInput = self.find_input_source_var(trace, rd.ShaderBuiltin.PrimitiveIndex)
if primInput is None:
# If we didn't find it, then we should be expecting a 0
if len(expected_prim) > 1 or expected_prim[0] is not 0:
rdtest.log.error("Expected prim {} at {},{} did not match actual prim {}.".format(
@@ -26,7 +26,7 @@ class D3D11_PrimitiveID(rdtest.TestCase):
else:
# Look up the matching register in the inputs, and see if the expected value matches
inputs: List[rd.ShaderVariable] = list(trace.inputs)
primValue = [var for var in inputs if var.name == primInput[0].variables[0].name][0]
primValue = [var for var in inputs if var.name == primInput.variables[0].name][0]
if primValue.value.uv[0] not in expected_prim:
rdtest.log.error("Expected prim {} at {},{} did not match actual prim {}.".format(
str(expected_prim), x, y, primValue.value.uv[0]))
@@ -35,7 +35,7 @@ class D3D11_PrimitiveID(rdtest.TestCase):
# Compare shader debug output against an expected value instead of the RT's output,
# since we're testing overlapping primitives in a single draw
if expected_output is not None:
output = [var for var in sourceVars if var.builtin == rd.ShaderBuiltin.ColorOutput and var.offset == 0][0]
output = self.find_output_source_var(trace, rd.ShaderBuiltin.ColorOutput, 0)
debugged = self.evalute_source_var(output, variables)
if debugged.value.fv[0:4] != expected_output:
rdtest.log.error("Expected value {} at {},{} did not match actual {}.".format(
@@ -22,11 +22,9 @@ class D3D11_Shader_Debug_Zoo(rdtest.TestCase):
trace: rd.ShaderDebugTrace = self.controller.DebugPixel(4 * test, 0, rd.ReplayController.NoPreference,
rd.ReplayController.NoPreference)
sourceVars: List[rd.SourceVariableMapping] = list(trace.sourceVars)
cycles, variables = self.process_trace(trace)
output = [x for x in sourceVars if x.builtin == rd.ShaderBuiltin.ColorOutput and x.offset == 0][0]
output = self.find_output_source_var(trace, rd.ShaderBuiltin.ColorOutput, 0)
debugged = self.evalute_source_var(output, variables)
+4 -5
View File
@@ -15,12 +15,11 @@ class D3D12_PrimitiveID(rdtest.TestCase):
trace: rd.ShaderDebugTrace = self.controller.DebugPixel(x, y, rd.ReplayController.NoPreference, prim)
sourceVars: List[rd.SourceVariableMapping] = list(trace.sourceVars)
cycles, variables = self.process_trace(trace)
# Find the SV_PrimitiveID variable
primInput = [var for var in sourceVars if var.builtin == rd.ShaderBuiltin.PrimitiveIndex]
if primInput == []:
primInput = self.find_input_source_var(trace, rd.ShaderBuiltin.PrimitiveIndex)
if primInput is None:
# If we didn't find it, then we should be expecting a 0
if len(expected_prim) > 1 or expected_prim[0] is not 0:
rdtest.log.error("Expected prim {} at {},{} did not match actual prim {}.".format(
@@ -29,7 +28,7 @@ class D3D12_PrimitiveID(rdtest.TestCase):
else:
# Look up the matching register in the inputs, and see if the expected value matches
inputs: List[rd.ShaderVariable] = list(trace.inputs)
primValue = [var for var in inputs if var.name == primInput[0].variables[0].name][0]
primValue = [var for var in inputs if var.name == primInput.variables[0].name][0]
if primValue.value.uv[0] not in expected_prim:
rdtest.log.error("Expected prim {} at {},{} did not match actual prim {}.".format(
str(expected_prim), x, y, primValue.value.uv[0]))
@@ -38,7 +37,7 @@ class D3D12_PrimitiveID(rdtest.TestCase):
# Compare shader debug output against an expected value instead of the RT's output,
# since we're testing overlapping primitives in a single draw
if expected_output is not None:
output = [var for var in sourceVars if var.builtin == rd.ShaderBuiltin.ColorOutput and var.offset == 0][0]
output = self.find_output_source_var(trace, rd.ShaderBuiltin.ColorOutput, 0)
debugged = self.evalute_source_var(output, variables)
if debugged.value.fv[0:4] != expected_output:
rdtest.log.error("Expected value {} at {},{} did not match actual {}.".format(
@@ -31,11 +31,9 @@ class D3D12_Shader_Debug_Zoo(rdtest.TestCase):
trace: rd.ShaderDebugTrace = self.controller.DebugPixel(4 * test, 0, rd.ReplayController.NoPreference,
rd.ReplayController.NoPreference)
sourceVars: List[rd.SourceVariableMapping] = list(trace.sourceVars)
cycles, variables = self.process_trace(trace)
output = [x for x in sourceVars if x.builtin == rd.ShaderBuiltin.ColorOutput and x.offset == 0][0]
output = self.find_output_source_var(trace, rd.ShaderBuiltin.ColorOutput, 0)
debugged = self.evalute_source_var(output, variables)
+3 -6
View File
@@ -196,8 +196,6 @@ class Iter_Test(rdtest.TestCase):
rdtest.log.print("No debug result")
return
sourceVars: List[rd.SourceVariableMapping] = list(trace.sourceVars)
cycles, variables = self.process_trace(trace)
output_index = [o.resourceId for o in pipe.GetOutputTargets()].index(target)
@@ -214,11 +212,10 @@ class Iter_Test(rdtest.TestCase):
else:
rdtest.log.print("At event {} the target is index {}".format(lastmod.eventId, output_index))
output_list = \
[x for x in sourceVars if x.builtin == rd.ShaderBuiltin.ColorOutput and x.offset == output_index]
output_sourcevar = self.find_output_source_var(trace, rd.ShaderBuiltin.ColorOutput, output_index)
if len(output_list) > 0:
debugged = self.evalute_source_var(output_list[0], variables)
if output_sourcevar is not None:
debugged = self.evalute_source_var(output_sourcevar, variables)
self.controller.FreeTrace(trace)