mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
If D3DCOMPILE_SKIP_OPTIMIZATION is set, prefer source-level debugging
This commit is contained in:
@@ -328,7 +328,26 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
|
||||
m_DisassemblyView->setText(disasm.c_str());
|
||||
m_DisassemblyView->setReadOnly(true);
|
||||
|
||||
bool preferSourceDebug = false;
|
||||
|
||||
for(const ShaderCompileFlag &flag : m_ShaderDetails->debugInfo.compileFlags.flags)
|
||||
{
|
||||
if(flag.name == "preferSourceDebug")
|
||||
{
|
||||
preferSourceDebug = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
updateDebugging();
|
||||
|
||||
// we do updateDebugging() again because the first call finds the scintilla for the current
|
||||
// source file, the second time jumps to it.
|
||||
if(preferSourceDebug)
|
||||
{
|
||||
gotoSourceDebugging();
|
||||
updateDebugging();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <algorithm>
|
||||
#include "api/app/renderdoc_app.h"
|
||||
#include "common/common.h"
|
||||
#include "driver/dx/official/d3dcompiler.h"
|
||||
#include "serialise/serialiser.h"
|
||||
#include "strings/string_utils.h"
|
||||
#include "dxbc_sdbg.h"
|
||||
@@ -1663,6 +1664,11 @@ ShaderCompileFlags EncodeFlags(const uint32_t flags)
|
||||
|
||||
ret.flags = {{"compileFlags", StringFormat::Fmt("%u", flags)}};
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user