Add a testing option to step to DebugValue instructions

This commit is contained in:
baldurk
2022-06-02 18:18:58 +01:00
parent 2a97762b87
commit c4b4c528a3
3 changed files with 23 additions and 2 deletions
+17 -2
View File
@@ -26,11 +26,15 @@
#include <math.h>
#include <time.h>
#include "common/formatting.h"
#include "core/settings.h"
#include "maths/half_convert.h"
#include "os/os_specific.h"
#include "spirv_op_helpers.h"
#include "var_dispatch_helpers.h"
RDOC_CONFIG(bool, Vulkan_Debug_StepToDebugValue, false,
"Treat DebugValue as a steppable executable instruction.");
static bool ContainsNaNInf(const ShaderVariable &var)
{
bool ret = false;
@@ -581,8 +585,19 @@ void ThreadState::SkipIgnoredInstructions()
{
if(debugger.IsDebugExtInstSet(Id::fromWord(it.word(3))))
{
nextInstruction++;
continue;
if(Vulkan_Debug_StepToDebugValue())
{
if(ShaderDbg(it.word(4)) != ShaderDbg::Value || !debugger.InDebugScope(nextInstruction))
{
nextInstruction++;
continue;
}
}
else
{
nextInstruction++;
continue;
}
}
}
@@ -350,6 +350,7 @@ public:
const Decorations &GetDecorations(Id typeId);
bool IsDebugExtInstSet(Id id) const;
bool HasDebugInfo() const { return m_DebugInfo.valid; }
bool InDebugScope(uint32_t inst) const;
rdcstr GetRawName(Id id) const;
rdcstr GetHumanName(Id id);
void AddSourceVars(rdcarray<SourceVariableMapping> &sourceVars, const ShaderVariable &var, Id id);
@@ -2725,6 +2725,11 @@ bool Debugger::IsDebugExtInstSet(Id id) const
return knownExtSet[ExtSet_ShaderDbg] == id;
}
bool Debugger::InDebugScope(uint32_t inst) const
{
return m_DebugInfo.lineScope.find(instructionOffsets[inst]) != m_DebugInfo.lineScope.end();
}
const ScopeData *Debugger::GetScope(size_t offset) const
{
auto it = m_DebugInfo.lineScope.find(offset);