mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-03 20:48:22 +00:00
Spirv Debugger mark pointer stores and memory copies as live
Added helper method SetLive() used by SetDst() and WritePointerValue()
This commit is contained in:
1 parent
f5e63aa838
commit
21a699e339
2 files changed
+21
-10
No files matched your search
@@ -387,6 +387,10 @@ DeviceOpResult ThreadState::WritePointerValue(Id pointer, const ShaderVariable &
|
||||
if(opResult == DeviceOpResult::NeedsDevice)
|
||||
return DeviceOpResult::NeedsDevice;
|
||||
|
||||
// Mark the pointer as being live
|
||||
bool wasLive = SetLive(pointer);
|
||||
bool baseWasLive = (pointer == ptrid) ? wasLive : true;
|
||||
|
||||
rdcarray<ShaderVariableChange> changes;
|
||||
rdcarray<Id> &pointers = pointersForId[ptrid];
|
||||
|
||||
@@ -451,8 +455,8 @@ DeviceOpResult ThreadState::WritePointerValue(Id pointer, const ShaderVariable &
|
||||
SPIRV_DEBUG_RDCASSERTEQUAL(opResult, DeviceOpResult::Succeeded);
|
||||
|
||||
// if this is the first local write, mark this variable as becoming alive here, instead of at
|
||||
// its declaration
|
||||
if(firstLocalWrite)
|
||||
// its declaration or if the variable wasn't live
|
||||
if(firstLocalWrite || !baseWasLive)
|
||||
basechange.before = {};
|
||||
|
||||
pendingDebugState.changes.push_back(basechange);
|
||||
@@ -489,6 +493,19 @@ void ThreadState::DebugBreak()
|
||||
pendingDebugState.flags |= ShaderEvents::DebugBreak;
|
||||
}
|
||||
|
||||
bool ThreadState::SetLive(Id id)
|
||||
{
|
||||
bool wasLive = false;
|
||||
if(hasDebugState)
|
||||
{
|
||||
auto it = std::lower_bound(live.begin(), live.end(), id);
|
||||
wasLive = (it != live.end() && *it == id);
|
||||
if(!wasLive)
|
||||
live.insert(it - live.begin(), id);
|
||||
}
|
||||
return wasLive;
|
||||
}
|
||||
|
||||
void ThreadState::SetDst(Id id, const ShaderVariable &val)
|
||||
{
|
||||
// Waiting for result i.e. from the GPU or replay thread
|
||||
@@ -525,14 +542,7 @@ void ThreadState::SetDst(Id id, const ShaderVariable &val)
|
||||
|
||||
lastWrite[id] = hasDebugState ? stepIndex : nextInstruction;
|
||||
|
||||
bool wasLive = false;
|
||||
if(hasDebugState)
|
||||
{
|
||||
auto it = std::lower_bound(live.begin(), live.end(), id);
|
||||
wasLive = (it != live.end() && *it == id);
|
||||
if(!wasLive)
|
||||
live.insert(it - live.begin(), id);
|
||||
}
|
||||
bool wasLive = SetLive(id);
|
||||
|
||||
if(val.type == VarType::GPUPointer && !debugger.IsPhysicalPointer(val))
|
||||
{
|
||||
|
||||
@@ -433,6 +433,7 @@ struct ThreadState
|
||||
private:
|
||||
void EnterFunction(const rdcarray<Id> &arguments);
|
||||
void SetDst(Id id, const ShaderVariable &val);
|
||||
bool SetLive(Id id);
|
||||
void ProcessScopeChange(const rdcarray<Id> &oldLive, const rdcarray<Id> &newLive);
|
||||
void JumpToLabel(Id target);
|
||||
bool ReferencePointer(Id id);
|
||||
|
||||
Reference in new issue
Block a user