If D3DCOMPILE_SKIP_OPTIMIZATION is set, prefer source-level debugging

This commit is contained in:
baldurk
2018-06-22 17:00:30 +01:00
parent 04f214c768
commit fc3e527181
2 changed files with 25 additions and 0 deletions
+19
View File
@@ -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;
}