Skip to content

Commit 9b6f1a5

Browse files
committed
Try to generate reasonable reflection from PDB info
* On FXC if the user strips reflection info and uses a separate PDB, that PDB does not contain reflection information. Try to re-generate what we can from the PDB debug info, which is not perfect but
1 parent 7171eea commit 9b6f1a5

File tree

4 files changed

+583
-13
lines changed

4 files changed

+583
-13
lines changed

renderdoc/driver/shaders/dxbc/dxbc_common.h

+2
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ class IDebugInfo
518518
virtual bool HasSourceMapping() const = 0;
519519
virtual void GetLocals(const DXBC::DXBCContainer *dxbc, size_t instruction, uintptr_t offset,
520520
rdcarray<SourceVariableMapping> &locals) const = 0;
521+
522+
virtual void FillReflection(DXBC::Reflection &refl) {}
521523
};
522524

523525
rdcstr BasicDemangle(const rdcstr &possiblyMangledName);

renderdoc/driver/shaders/dxbc/dxbc_container.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -2065,6 +2065,7 @@ DXBCContainer::DXBCContainer(const bytebuf &ByteCode, const rdcstr &debugInfoPat
20652065

20662066
// if reflection information was stripped (or never emitted with DXIL), attempt to reverse
20672067
// engineer basic info from declarations or read it from the DXIL
2068+
bool guessedReflection = false;
20682069
if(m_Reflection == NULL)
20692070
{
20702071
// need to disassemble now to guess resources
@@ -2074,6 +2075,7 @@ DXBCContainer::DXBCContainer(const bytebuf &ByteCode, const rdcstr &debugInfoPat
20742075
m_Reflection = dxilReflectProgram->BuildReflection();
20752076
else
20762077
m_Reflection = new Reflection;
2078+
guessedReflection = true;
20772079
}
20782080

20792081
if(dxilReflectProgram)
@@ -2353,7 +2355,11 @@ DXBCContainer::DXBCContainer(const bytebuf &ByteCode, const rdcstr &debugInfoPat
23532355
}
23542356

23552357
if(m_DXBCByteCode && m_DebugInfo == NULL && !m_DebugShaderBlob.empty())
2358+
{
23562359
m_DebugInfo = ProcessPDB(m_DebugShaderBlob.data(), (uint32_t)m_DebugShaderBlob.size());
2360+
if(m_DebugInfo && guessedReflection)
2361+
m_DebugInfo->FillReflection(*m_Reflection);
2362+
}
23572363

23582364
if(m_DXILByteCode)
23592365
m_DebugInfo = m_DXILByteCode;

0 commit comments

Comments
 (0)