Add shader's ID and entry point to the shader reflection struct

* This allows better identification of a shader from its reflection
  bundle. The entry point was already 'optionally' in the debug info
  struct which is no longer a great location for it.
* For APIs where the entry point isn't contractual and it might not be
  listed, instead we just fall back to 'main'. This means that the UI
  or anyone fetching the info can be guaranteed that some sensible entry
  point will be listed.
* Also for the debug info, remove the 'entryFile' index and instead just
  guarantee that as much as possible the entry point will be in the
  first file in the list.
This commit is contained in:
baldurk
2017-07-05 16:27:17 +01:00
parent c2b0c2d7d8
commit bdf2a68c71
26 changed files with 298 additions and 256 deletions
+6 -15
View File
@@ -307,17 +307,16 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
&ShaderViewer::disasm_tooltipHide);
}
if(shader && shader->DebugInfo.entryFunc.count > 0 && shader->DebugInfo.files.count > 0)
if(shader && shader->DebugInfo.files.count > 0)
{
if(trace)
setWindowTitle(
QFormatStr("Debug %1() - %2").arg(ToQStr(shader->DebugInfo.entryFunc)).arg(debugContext));
setWindowTitle(QFormatStr("Debug %1() - %2").arg(ToQStr(shader->EntryPoint)).arg(debugContext));
else
setWindowTitle(ToQStr(shader->DebugInfo.entryFunc));
setWindowTitle(ToQStr(shader->EntryPoint));
int fileIdx = 0;
QWidget *sel = m_DisassemblyView;
QWidget *sel = NULL;
for(auto &f : shader->DebugInfo.files)
{
QString name = QFileInfo(ToQStr(f.first)).fileName();
@@ -325,21 +324,13 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
ScintillaEdit *scintilla = AddFileScintilla(name, text);
if(shader->DebugInfo.entryFile >= 0 &&
shader->DebugInfo.entryFile < shader->DebugInfo.files.count)
{
if(fileIdx == shader->DebugInfo.entryFile)
sel = scintilla;
}
else if(text.contains(ToQStr(shader->DebugInfo.entryFunc)))
{
if(sel == NULL)
sel = scintilla;
}
fileIdx++;
}
if(trace)
if(trace || sel == NULL)
sel = m_DisassemblyView;
if(shader->DebugInfo.files.count > 2)