Scroll shader viewer to entry point file & line using debug info

This commit is contained in:
baldurk
2022-07-22 16:10:59 +01:00
parent c053912608
commit fda5c4819a
12 changed files with 133 additions and 20 deletions
+15
View File
@@ -480,8 +480,11 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
m_FileScintillas.reserve(m_ShaderDetails->debugInfo.files.count());
QWidget *sel = NULL;
int32_t entryFile = m_ShaderDetails->debugInfo.entryLocation.fileIndex;
int32_t i = -1;
for(const ShaderSourceFile &f : m_ShaderDetails->debugInfo.files)
{
i++;
if(f.contents.isEmpty())
{
m_FileScintillas.push_back(NULL);
@@ -496,6 +499,18 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
if(sel == NULL)
sel = scintilla;
if(i == entryFile)
{
sel = scintilla;
if(m_ShaderDetails->debugInfo.entryLocation.lineStart > 0)
{
GUIInvoke::defer(scintilla, [scintilla, this]() {
ensureLineScrolled(scintilla, m_ShaderDetails->debugInfo.entryLocation.lineStart);
});
}
}
m_FileScintillas.push_back(scintilla);
}