mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-08 06:45:49 +00:00
Remove "preferSourceDebug" compile flag, use sourceDebugInformation
* This was previously only relevant for DXBC shaders that could have source debug information but didn't prefer source debug unless optimisation was disabled. This is inconsistent with how things are handled on SPIR-V and DXIL and in general it's considered now that the benefits of debugging in source outweigh the problems of debugging optimised code.
This commit is contained in:
@@ -676,7 +676,7 @@ void main() {
|
||||
{
|
||||
CHECK(refl.debugInfo.files[0].filename == "source0.glsl");
|
||||
|
||||
REQUIRE(refl.debugInfo.compileFlags.flags.size() == 3);
|
||||
REQUIRE(refl.debugInfo.compileFlags.flags.size() == 2);
|
||||
|
||||
CHECK(refl.debugInfo.compileFlags.flags[0].name == "@cmdline");
|
||||
|
||||
@@ -690,8 +690,7 @@ void main() {
|
||||
CHECK(refl.debugInfo.compileFlags.flags[1].name == "@spirver");
|
||||
CHECK(refl.debugInfo.compileFlags.flags[1].value == "spirv1.0");
|
||||
|
||||
CHECK(refl.debugInfo.compileFlags.flags[2].name == "preferSourceDebug");
|
||||
CHECK(refl.debugInfo.compileFlags.flags[2].value == "1");
|
||||
CHECK(refl.debugInfo.sourceDebugInformation);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -329,8 +329,6 @@ void WrappedOpenGL::ShaderData::ProcessCompilation(WrappedOpenGL &drv, ResourceI
|
||||
reflection->debugInfo.debugStatus = spvReflection.debugInfo.debugStatus;
|
||||
reflection->debugInfo.sourceDebugInformation =
|
||||
spvReflection.debugInfo.sourceDebugInformation;
|
||||
if(reflection->debugInfo.sourceDebugInformation)
|
||||
reflection->debugInfo.compileFlags.flags.push_back({"preferSourceDebug", "1"});
|
||||
|
||||
if(HasExt[ARB_shader_storage_buffer_object])
|
||||
{
|
||||
|
||||
@@ -508,6 +508,7 @@ public:
|
||||
virtual rdcstr GetEntryFunction() const = 0;
|
||||
virtual rdcstr GetShaderProfile() const = 0;
|
||||
|
||||
virtual bool HasSourceDebugInfo() const = 0;
|
||||
virtual ShaderCompileFlags GetShaderCompileFlags() const = 0;
|
||||
|
||||
rdcarray<ShaderSourceFile> Files;
|
||||
|
||||
@@ -2897,9 +2897,6 @@ void DXBCContainer::ProcessSourceInfo(const byte *chunkContents, uint32_t chunkS
|
||||
size_t cmdlineIdx = flags.flags.size();
|
||||
for(size_t i = 0; i < flags.flags.size(); i++)
|
||||
{
|
||||
if(flags.flags[i].name == "preferSourceDebug")
|
||||
continue;
|
||||
|
||||
if(flags.flags[i].name == "@cmdline")
|
||||
{
|
||||
cmdlineIdx = i;
|
||||
@@ -3144,11 +3141,6 @@ ShaderCompileFlags EncodeFlags(const uint32_t flags, const rdcstr &profile)
|
||||
|
||||
ret.flags = {{"@cmdline", cmdline.trimmed()}};
|
||||
|
||||
// If D3DCOMPILE_SKIP_OPTIMIZATION is set, then prefer source-level debugging as it should be
|
||||
// accurate enough to work with.
|
||||
if(flags & D3DCOMPILE_SKIP_OPTIMIZATION)
|
||||
ret.flags.push_back({"preferSourceDebug", "1"});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ void MakeShaderReflection(DXBC::DXBCContainer *dxbc, const ShaderEntryPoint &ent
|
||||
{
|
||||
refl->debugInfo.encoding = ShaderEncoding::HLSL;
|
||||
|
||||
refl->debugInfo.sourceDebugInformation = true;
|
||||
refl->debugInfo.sourceDebugInformation = dxbc->GetDebugInfo()->HasSourceDebugInfo();
|
||||
|
||||
refl->debugInfo.compileFlags = dxbc->GetDebugInfo()->GetShaderCompileFlags();
|
||||
|
||||
|
||||
@@ -245,6 +245,7 @@ public:
|
||||
rdcstr GetCompilerSig() const { return m_CompilerSig; }
|
||||
rdcstr GetEntryFunction() const { return m_Entry; }
|
||||
rdcstr GetShaderProfile() const { return m_Profile; }
|
||||
bool HasSourceDebugInfo() const { return true; }
|
||||
ShaderCompileFlags GetShaderCompileFlags() const { return EncodeFlags(m_ShaderFlags, m_Profile); }
|
||||
void GetLineInfo(size_t instruction, uintptr_t offset, LineColumnInfo &lineInfo) const;
|
||||
void GetCallstack(size_t instruction, uintptr_t offset, rdcarray<rdcstr> &callstack) const;
|
||||
|
||||
@@ -301,6 +301,7 @@ public:
|
||||
rdcstr GetCompilerSig() const { return m_CompilerSig; }
|
||||
rdcstr GetEntryFunction() const { return m_Entry; }
|
||||
rdcstr GetShaderProfile() const { return m_Profile; }
|
||||
bool HasSourceDebugInfo() const { return true; }
|
||||
ShaderCompileFlags GetShaderCompileFlags() const { return EncodeFlags(m_ShaderFlags, m_Profile); }
|
||||
void GetLineInfo(size_t instruction, uintptr_t offset, LineColumnInfo &lineInfo) const;
|
||||
void GetCallstack(size_t instruction, uintptr_t offset, rdcarray<rdcstr> &callstack) const;
|
||||
|
||||
@@ -1717,6 +1717,7 @@ public:
|
||||
rdcstr GetCompilerSig() const override { return m_CompilerSig; }
|
||||
rdcstr GetEntryFunction() const override { return m_EntryPoint; }
|
||||
rdcstr GetShaderProfile() const override { return m_Profile; }
|
||||
bool HasSourceDebugInfo() const override { return m_SourceInfo; }
|
||||
ShaderCompileFlags GetShaderCompileFlags() const override { return m_CompileFlags; }
|
||||
void GetLineInfo(size_t instruction, uintptr_t offset, LineColumnInfo &lineInfo) const override;
|
||||
void GetCallstack(size_t instruction, uintptr_t offset, rdcarray<rdcstr> &callstack) const override;
|
||||
@@ -1793,6 +1794,7 @@ protected:
|
||||
uint32_t m_DXILVersion;
|
||||
|
||||
rdcstr m_CompilerSig, m_EntryPoint, m_Profile;
|
||||
bool m_SourceInfo = false;
|
||||
ShaderCompileFlags m_CompileFlags;
|
||||
DXBC::ThreadScope m_Threadscope = DXBC::ThreadScope::Thread;
|
||||
|
||||
|
||||
@@ -1663,7 +1663,7 @@ DXBC::Reflection *Program::BuildReflection()
|
||||
}
|
||||
}
|
||||
if(!Files.empty())
|
||||
m_CompileFlags.flags.push_back({"preferSourceDebug", "1"});
|
||||
m_SourceInfo = true;
|
||||
}
|
||||
|
||||
if(dx.source.args && dx.source.args->children.size() == 1)
|
||||
|
||||
@@ -1085,7 +1085,6 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
|
||||
|
||||
if(knownExtSet[ExtSet_ShaderDbg] != Id() && !reflection.debugInfo.files.empty())
|
||||
{
|
||||
reflection.debugInfo.compileFlags.flags.push_back({"preferSourceDebug", "1"});
|
||||
reflection.debugInfo.sourceDebugInformation = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user