mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-19 04:56:32 +00:00
RD DXIL Disassembly : don't show "unknown" cbuffer member data
Fallback to show the cbuffer load i.e. _dx.types.CBufRet.i32 _50 = cbuffer1.Load(byte_offset = 80);
This commit is contained in:
@@ -366,6 +366,7 @@ struct CBuffer
|
||||
} descriptor;
|
||||
|
||||
rdcarray<CBufferVariable> variables;
|
||||
bool hasReflectionData;
|
||||
};
|
||||
|
||||
struct Reflection
|
||||
|
||||
@@ -2836,8 +2836,6 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
{
|
||||
for(size_t j = 0; j < entryPoint->cbuffers.size(); ++j)
|
||||
{
|
||||
if(needBlankLine)
|
||||
DisassemblyAddNewLine();
|
||||
EntryPointInterface::CBuffer &cbuffer = entryPoint->cbuffers[j];
|
||||
if(reflection)
|
||||
{
|
||||
@@ -2852,6 +2850,8 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(needBlankLine)
|
||||
DisassemblyAddNewLine();
|
||||
m_Disassembly += "cbuffer " + cbuffer.name;
|
||||
if(cbuffer.regCount > 1)
|
||||
{
|
||||
@@ -2862,7 +2862,8 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
}
|
||||
m_Disassembly +=
|
||||
" : register(b" + ToStr(cbuffer.regBase) + ", space" + ToStr(cbuffer.space) + ")";
|
||||
if(cbuffer.cbufferRefl)
|
||||
// Ignore cbuffer's which don't have reflection data
|
||||
if(cbuffer.cbufferRefl && cbuffer.cbufferRefl->hasReflectionData)
|
||||
{
|
||||
if(!cbuffer.cbufferRefl->variables.empty())
|
||||
{
|
||||
@@ -2883,10 +2884,15 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
}
|
||||
m_Disassembly += "};";
|
||||
DisassemblyAddNewLine();
|
||||
needBlankLine = true;
|
||||
}
|
||||
}
|
||||
needBlankLine = true;
|
||||
else
|
||||
{
|
||||
DisassemblyAddNewLine();
|
||||
}
|
||||
}
|
||||
needBlankLine = true;
|
||||
}
|
||||
|
||||
if(!entryPoint->samplers.empty())
|
||||
@@ -3312,17 +3318,30 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
regIndex = regIndex / 16;
|
||||
// uint32_t alignment = getival<uint32_t>(inst.args[3]);
|
||||
}
|
||||
const Type *retType = inst.type;
|
||||
uint32_t bytesPerElement = 4;
|
||||
if(retType)
|
||||
const EntryPointInterface::CBuffer &cbuffer =
|
||||
entryPoint->cbuffers[resRef->resourceIndex];
|
||||
if(cbuffer.cbufferRefl && cbuffer.cbufferRefl->hasReflectionData)
|
||||
{
|
||||
RDCASSERT(retType->type == Type::TypeKind::Struct);
|
||||
const Type *baseType = retType->members[0];
|
||||
RDCASSERT(baseType->type == Type::TypeKind::Scalar);
|
||||
bytesPerElement = baseType->bitWidth / 8;
|
||||
const Type *retType = inst.type;
|
||||
uint32_t bytesPerElement = 4;
|
||||
if(retType)
|
||||
{
|
||||
RDCASSERT(retType->type == Type::TypeKind::Struct);
|
||||
const Type *baseType = retType->members[0];
|
||||
RDCASSERT(baseType->type == Type::TypeKind::Scalar);
|
||||
bytesPerElement = baseType->bitWidth / 8;
|
||||
}
|
||||
lineStr += MakeCBufferRegisterStr(regIndex, bytesPerElement, cbuffer);
|
||||
commentStr += " cbuffer = " + cbuffer.name;
|
||||
commentStr += ", byte_offset = " + ToStr(regIndex * 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineStr += cbuffer.name;
|
||||
lineStr += ".Load4(";
|
||||
lineStr += "byte_offset = " + ToStr(regIndex * 16);
|
||||
lineStr += ")";
|
||||
}
|
||||
lineStr += MakeCBufferRegisterStr(regIndex, bytesPerElement,
|
||||
entryPoint->cbuffers[resRef->resourceIndex]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3886,7 +3905,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
}
|
||||
switch(inst.op)
|
||||
{
|
||||
case Operation::Trunc: commentStr = "truncate ";
|
||||
case Operation::Trunc: commentStr += "truncate ";
|
||||
case Operation::ZExt: commentStr += "zero extend "; break;
|
||||
case Operation::SExt: commentStr += "signed extend "; break;
|
||||
case Operation::UToF: commentStr += "unsigned "; break;
|
||||
@@ -4263,7 +4282,7 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
case Operation::SGreater:
|
||||
case Operation::SGreaterEqual:
|
||||
case Operation::SLess:
|
||||
case Operation::SLessEqual: commentStr = "signed ";
|
||||
case Operation::SLessEqual: commentStr += "signed ";
|
||||
default: break;
|
||||
}
|
||||
lineStr += "(";
|
||||
|
||||
@@ -1627,9 +1627,13 @@ DXBC::Reflection *Program::GetReflection()
|
||||
|
||||
bind.descriptor.type = CBuffer::Descriptor::TYPE_CBUFFER;
|
||||
bind.descriptor.byteSize = getival<uint32_t>(r->children[(size_t)ResField::CBufferByteSize]);
|
||||
bind.hasReflectionData = true;
|
||||
|
||||
if(bind.name.empty())
|
||||
{
|
||||
bind.hasReflectionData = false;
|
||||
bind.name = StringFormat::Fmt("cbuffer%u", bind.identifier);
|
||||
}
|
||||
|
||||
const Type *cbufType = r->children[(size_t)ResField::VarDecl]->type;
|
||||
|
||||
@@ -1645,6 +1649,8 @@ DXBC::Reflection *Program::GetReflection()
|
||||
}
|
||||
else
|
||||
{
|
||||
bind.hasReflectionData = false;
|
||||
|
||||
CBufferVariable var;
|
||||
|
||||
var.name = "unknown";
|
||||
|
||||
Reference in New Issue
Block a user