diff --git a/renderdoc/driver/shaders/dxbc/dxbc_container.cpp b/renderdoc/driver/shaders/dxbc/dxbc_container.cpp index 53b325a7e..bbc1371d0 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_container.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_container.cpp @@ -638,6 +638,19 @@ const rdcstr &DXBCContainer::GetDisassembly(bool dxcStyle) void DXBCContainer::FillTraceLineInfo(ShaderDebugTrace &trace) const { + // we add some number of lines for the header we added with shader hash, debug name, etc on + // top of what the bytecode disassembler did + + // 2 minimum for the shader hash we always print + uint32_t extraLines = 2; + if(!m_DebugFileName.empty()) + extraLines++; + if(m_ShaderExt.second != ~0U) + extraLines++; + + if(m_GlobalFlags != GlobalShaderFlags::None) + extraLines += (uint32_t)Bits::CountOnes((uint32_t)m_GlobalFlags) + 2; + if(m_DXBCByteCode) { trace.instInfo.resize(m_DXBCByteCode->GetNumInstructions()); @@ -650,19 +663,6 @@ void DXBCContainer::FillTraceLineInfo(ShaderDebugTrace &trace) const if(m_DebugInfo) m_DebugInfo->GetLineInfo(i, op.offset, trace.instInfo[i].lineInfo); - // we add some number of lines for the header we added with shader hash, debug name, etc on - // top of what the bytecode disassembler did - - // 2 minimum for the shader hash we always print - uint32_t extraLines = 2; - if(!m_DebugFileName.empty()) - extraLines++; - if(m_ShaderExt.second != ~0U) - extraLines++; - - if(m_GlobalFlags != GlobalShaderFlags::None) - extraLines += (uint32_t)Bits::CountOnes((uint32_t)m_GlobalFlags) + 2; - if(op.line > 0) trace.instInfo[i].lineInfo.disassemblyLine = extraLines + op.line; @@ -672,7 +672,25 @@ void DXBCContainer::FillTraceLineInfo(ShaderDebugTrace &trace) const } else if(m_DXILByteCode) { - RDCERR("DXIL FillTraceLineInfo not implemented"); +#if ENABLED(DXC_COMPATIBLE_DISASM) + extraLines = 0; +#endif + size_t instrCount = m_DXILByteCode->GetInstructionCount(); + trace.instInfo.resize(instrCount); + for(size_t i = 0; i < instrCount; i++) + { + trace.instInfo[i].instruction = (uint32_t)i; + + if(m_DebugInfo) + m_DebugInfo->GetLineInfo(i, 0, trace.instInfo[i].lineInfo); + else + m_DXILByteCode->GetLineInfo(i, 0, trace.instInfo[i].lineInfo); + + trace.instInfo[i].lineInfo.disassemblyLine += extraLines; + + if(m_DebugInfo) + m_DebugInfo->GetLocals(this, i, 0, trace.instInfo[i].sourceVars); + } } } diff --git a/renderdoc/driver/shaders/dxil/dxil_bytecode.h b/renderdoc/driver/shaders/dxil/dxil_bytecode.h index 30975a09c..2e004d3da 100644 --- a/renderdoc/driver/shaders/dxil/dxil_bytecode.h +++ b/renderdoc/driver/shaders/dxil/dxil_bytecode.h @@ -1513,8 +1513,6 @@ public: void FillEntryPointInterfaces(); size_t GetInstructionCount() const; rdcstr GetResourceReferenceName(ResourceClass resClass, const BindingSlot &slot) const; - // false means stop processing - void ProcessFunctions(std::function callback) const; void FillRayPayloads( Program *executable, rdcflatmap> diff --git a/renderdoc/driver/shaders/dxil/dxil_disassemble.cpp b/renderdoc/driver/shaders/dxil/dxil_disassemble.cpp index 0a0c13a3a..0f73ee9c5 100644 --- a/renderdoc/driver/shaders/dxil/dxil_disassemble.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_disassemble.cpp @@ -2644,7 +2644,7 @@ rdcstr ProcessNormCompType(ComponentType &compType) void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection) { m_Disassembly.clear(); - m_DisassemblyInstructionLine = 4; + m_DisassemblyInstructionLine = 1; m_Disassembly += StringFormat::Fmt("; %s Shader, compiled under SM%u.%u", shaderNames[int(m_Type)], m_Major, m_Minor); diff --git a/renderdoc/driver/shaders/dxil/dxil_reflect.cpp b/renderdoc/driver/shaders/dxil/dxil_reflect.cpp index a8c7083a6..7afd912bb 100644 --- a/renderdoc/driver/shaders/dxil/dxil_reflect.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_reflect.cpp @@ -1785,16 +1785,6 @@ const ResourceReference *Program::GetResourceReference(const rdcstr &handleStr) return NULL; } -void Program::ProcessFunctions(std::function callback) const -{ - for(const DXIL::Function *f : m_Functions) - { - // false means stop processing - if(!callback(f)) - break; - } -} - size_t Program::GetInstructionCount() const { size_t ret = 0;