mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-28 21:01:04 +00:00
RD DXIL Disassembly refactoring
Renamed: DXIL::EntryPoint -> DXIL::EntryPointInterface DXIL::Program::FetchEntryPoints() -> DXIL::Program::FetchEntryPointInterfaces() Deleted EntryPointsInfo helper struct
This commit is contained in:
@@ -1144,9 +1144,9 @@ private:
|
||||
void assignTypeId(const Constant *c);
|
||||
};
|
||||
|
||||
struct EntryPoint
|
||||
struct EntryPointInterface
|
||||
{
|
||||
EntryPoint(const Metadata *entryPoint);
|
||||
EntryPointInterface(const Metadata *entryPoint);
|
||||
|
||||
struct Signature
|
||||
{
|
||||
@@ -1276,7 +1276,7 @@ protected:
|
||||
uint32_t GetMetaSlot(const DebugLocation *l) const;
|
||||
void AssignMetaSlot(rdcarray<Metadata *> &metaSlots, uint32_t &nextMetaSlot, DebugLocation &l);
|
||||
|
||||
void FetchEntryPoints(rdcarray<EntryPoint> &entryPoints);
|
||||
void FetchEntryPointInterfaces(rdcarray<EntryPointInterface> &entryPointInterfaces);
|
||||
const Metadata *FindMetadata(uint32_t slot) const;
|
||||
rdcstr ArgToString(const Value *v, bool withTypes, const rdcstr &attrString = "") const;
|
||||
rdcstr DisassembleComDats(int &instructionLine) const;
|
||||
|
||||
@@ -2193,11 +2193,11 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
m_Disassembly += DisassembleGlobalVars(m_DisassemblyInstructionLine);
|
||||
|
||||
// Decode entry points
|
||||
rdcarray<EntryPoint> entryPoints;
|
||||
FetchEntryPoints(entryPoints);
|
||||
rdcarray<EntryPointInterface> entryPoints;
|
||||
FetchEntryPointInterfaces(entryPoints);
|
||||
for(size_t e = 0; e < entryPoints.size(); ++e)
|
||||
{
|
||||
EntryPoint &entryPoint = entryPoints[e];
|
||||
EntryPointInterface &entryPoint = entryPoints[e];
|
||||
m_Disassembly += entryPoint.name + "()";
|
||||
DisassemblyAddNewLine();
|
||||
m_Disassembly += "{";
|
||||
@@ -2205,7 +2205,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
|
||||
for(size_t i = 0; i < entryPoint.inputs.size(); ++i)
|
||||
{
|
||||
EntryPoint::Signature &sig = entryPoint.inputs[i];
|
||||
EntryPointInterface::Signature &sig = entryPoint.inputs[i];
|
||||
VarType varType = VarTypeForComponentType(sig.type);
|
||||
m_Disassembly += " Input[" + ToStr(i) + "] " + ToStr(varType).c_str();
|
||||
|
||||
@@ -2222,7 +2222,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
|
||||
for(size_t i = 0; i < entryPoint.outputs.size(); ++i)
|
||||
{
|
||||
EntryPoint::Signature &sig = entryPoint.outputs[i];
|
||||
EntryPointInterface::Signature &sig = entryPoint.outputs[i];
|
||||
VarType varType = VarTypeForComponentType(sig.type);
|
||||
m_Disassembly += " Output[" + ToStr(i) + "] " + ToStr(varType).c_str();
|
||||
|
||||
@@ -2240,7 +2240,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
|
||||
for(size_t i = 0; i < entryPoint.srvs.size(); ++i)
|
||||
{
|
||||
EntryPoint::SRV &srv = entryPoint.srvs[i];
|
||||
EntryPointInterface::SRV &srv = entryPoint.srvs[i];
|
||||
if(srv.name.empty() && reflection)
|
||||
{
|
||||
for(DXBC::ShaderInputBind bind : reflection->SRVs)
|
||||
@@ -2267,7 +2267,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
|
||||
for(size_t i = 0; i < entryPoint.uavs.size(); ++i)
|
||||
{
|
||||
EntryPoint::UAV &uav = entryPoint.uavs[i];
|
||||
EntryPointInterface::UAV &uav = entryPoint.uavs[i];
|
||||
if(uav.name.empty() && reflection)
|
||||
{
|
||||
for(DXBC::ShaderInputBind bind : reflection->UAVs)
|
||||
@@ -2293,7 +2293,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
|
||||
for(size_t i = 0; i < entryPoint.cbuffers.size(); ++i)
|
||||
{
|
||||
EntryPoint::CBuffer &cbuffer = entryPoint.cbuffers[i];
|
||||
EntryPointInterface::CBuffer &cbuffer = entryPoint.cbuffers[i];
|
||||
const DXBC::CBuffer *cbufferRefl = NULL;
|
||||
if(reflection)
|
||||
{
|
||||
@@ -2344,7 +2344,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
|
||||
for(size_t i = 0; i < entryPoint.samplers.size(); ++i)
|
||||
{
|
||||
EntryPoint::Sampler &sampler = entryPoint.samplers[i];
|
||||
EntryPointInterface::Sampler &sampler = entryPoint.samplers[i];
|
||||
if(sampler.name.empty() && reflection)
|
||||
{
|
||||
for(DXBC::ShaderInputBind s : reflection->Samplers)
|
||||
@@ -2371,7 +2371,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
|
||||
DisassemblyAddNewLine();
|
||||
|
||||
EntryPoint &entryPoint = entryPoints[0];
|
||||
EntryPointInterface &entryPoint = entryPoints[0];
|
||||
for(size_t i = 0; i < m_Functions.size(); i++)
|
||||
{
|
||||
const Function &func = *m_Functions[i];
|
||||
@@ -2381,7 +2381,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
if(func.external)
|
||||
continue;
|
||||
|
||||
for(EntryPoint &ep : entryPoints)
|
||||
for(EntryPointInterface &ep : entryPoints)
|
||||
{
|
||||
if(func.name == ep.name)
|
||||
{
|
||||
|
||||
@@ -268,7 +268,7 @@ struct TypeInfo
|
||||
}
|
||||
};
|
||||
|
||||
EntryPoint::Signature::Signature(const Metadata *signature)
|
||||
EntryPointInterface::Signature::Signature(const Metadata *signature)
|
||||
{
|
||||
/*
|
||||
// Extended properties
|
||||
@@ -287,7 +287,7 @@ EntryPoint::Signature::Signature(const Metadata *signature)
|
||||
startCol = getival<int8_t>(signature->children[SignatureElement::StartCol]);
|
||||
}
|
||||
|
||||
EntryPoint ::ResourceBase::ResourceBase(const Metadata *resourceBase)
|
||||
EntryPointInterface::ResourceBase::ResourceBase(const Metadata *resourceBase)
|
||||
{
|
||||
id = getival<uint32_t>(resourceBase->children[(size_t)ResField::ID]);
|
||||
type = resourceBase->children[(size_t)ResField::VarDecl]->type;
|
||||
@@ -297,7 +297,7 @@ EntryPoint ::ResourceBase::ResourceBase(const Metadata *resourceBase)
|
||||
regCount = getival<uint32_t>(resourceBase->children[(size_t)ResField::RegCount]);
|
||||
}
|
||||
|
||||
EntryPoint::SRV::SRV(const Metadata *srv) : ResourceBase(srv)
|
||||
EntryPointInterface::SRV::SRV(const Metadata *srv) : ResourceBase(srv)
|
||||
{
|
||||
shape = getival<ResourceKind>(srv->children[(size_t)ResField::SRVShape]);
|
||||
sampleCount = getival<uint32_t>(srv->children[(size_t)ResField::SRVSampleCount]);
|
||||
@@ -319,7 +319,7 @@ EntryPoint::SRV::SRV(const Metadata *srv) : ResourceBase(srv)
|
||||
}
|
||||
}
|
||||
|
||||
EntryPoint::UAV::UAV(const Metadata *uav) : ResourceBase(uav)
|
||||
EntryPointInterface::UAV::UAV(const Metadata *uav) : ResourceBase(uav)
|
||||
{
|
||||
shape = getival<ResourceKind>(uav->children[(size_t)ResField::UAVShape]);
|
||||
globallCoherent = (getival<uint32_t>(uav->children[(size_t)ResField::UAVGloballyCoherent]) == 1);
|
||||
@@ -349,7 +349,7 @@ EntryPoint::UAV::UAV(const Metadata *uav) : ResourceBase(uav)
|
||||
}
|
||||
}
|
||||
|
||||
EntryPoint::CBuffer::CBuffer(const Metadata *cbuffer) : ResourceBase(cbuffer)
|
||||
EntryPointInterface::CBuffer::CBuffer(const Metadata *cbuffer) : ResourceBase(cbuffer)
|
||||
{
|
||||
sizeInBytes = getival<uint32_t>(cbuffer->children[(size_t)ResField::CBufferByteSize]);
|
||||
const Metadata *tags = cbuffer->children[(size_t)ResField::CBufferTags];
|
||||
@@ -362,12 +362,12 @@ EntryPoint::CBuffer::CBuffer(const Metadata *cbuffer) : ResourceBase(cbuffer)
|
||||
}
|
||||
}
|
||||
|
||||
EntryPoint::Sampler::Sampler(const Metadata *sampler) : ResourceBase(sampler)
|
||||
EntryPointInterface::Sampler::Sampler(const Metadata *sampler) : ResourceBase(sampler)
|
||||
{
|
||||
samplerType = getival<SamplerKind>(sampler->children[(size_t)ResField::SamplerType]);
|
||||
}
|
||||
|
||||
EntryPoint::EntryPoint(const Metadata *entryPoint)
|
||||
EntryPointInterface::EntryPointInterface(const Metadata *entryPoint)
|
||||
{
|
||||
function = entryPoint->children[0]->type;
|
||||
name = entryPoint->children[1]->str;
|
||||
@@ -457,20 +457,6 @@ EntryPoint::EntryPoint(const Metadata *entryPoint)
|
||||
}
|
||||
}
|
||||
|
||||
struct EntryPointsInfo
|
||||
{
|
||||
EntryPointsInfo(const Metadata *entryPoints)
|
||||
{
|
||||
if(!entryPoints)
|
||||
return;
|
||||
|
||||
for(size_t c = 0; c < entryPoints->children.size(); ++c)
|
||||
entryPointsData.emplace_back(entryPoints->children[c]);
|
||||
}
|
||||
|
||||
rdcarray<EntryPoint> entryPointsData;
|
||||
};
|
||||
|
||||
static DXBC::CBufferVariableType MakePayloadType(const TypeInfo &typeInfo, const Type *t)
|
||||
{
|
||||
using namespace DXBC;
|
||||
@@ -557,12 +543,16 @@ static DXBC::CBufferVariableType MakePayloadType(const TypeInfo &typeInfo, const
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Program::FetchEntryPoints(rdcarray<EntryPoint> &entryPoints)
|
||||
void Program::FetchEntryPointInterfaces(rdcarray<EntryPointInterface> &entryPointInterfaces)
|
||||
{
|
||||
DXMeta dx(m_NamedMeta);
|
||||
|
||||
EntryPointsInfo entryPointsInfo(dx.entryPoints);
|
||||
entryPoints = entryPointsInfo.entryPointsData;
|
||||
entryPointInterfaces.clear();
|
||||
if(!dx.entryPoints)
|
||||
return;
|
||||
|
||||
for(size_t c = 0; c < dx.entryPoints->children.size(); ++c)
|
||||
entryPointInterfaces.emplace_back(dx.entryPoints->children[c]);
|
||||
}
|
||||
|
||||
void Program::FetchComputeProperties(DXBC::Reflection *reflection)
|
||||
|
||||
Reference in New Issue
Block a user