Select the next highest event when replaying from an event

* Searching down from the end for the next lowest event causes us to
  sometimes replay backwards when a marker is selected (and has no
  event in the array to replay directly). This can crash on vulkan, and
  is unintuitive/wrong on other APIs. Instead we follow the behaviour
  that we have elsewhere so that when a marker is selected we move
  _forward_ in the frame to select the next event after it.
* Checking the history there doesn't seem to be any strong reason for
  this direction of search.
This commit is contained in:
baldurk
2017-08-15 15:21:09 +01:00
parent 8d7b4d2f81
commit d6c03f58bc
8 changed files with 20 additions and 20 deletions
+4 -4
View File
@@ -1030,12 +1030,12 @@ void WrappedID3D11DeviceContext::AddEvent(string description)
m_Events.push_back(apievent);
}
APIEvent WrappedID3D11DeviceContext::GetEvent(uint32_t eventID)
const APIEvent &WrappedID3D11DeviceContext::GetEvent(uint32_t eventID)
{
for(size_t i = m_Events.size() - 1; i > 0; i--)
for(const APIEvent &e : m_Events)
{
if(m_Events[i].eventID <= eventID)
return m_Events[i];
if(e.eventID >= eventID)
return e;
}
return m_Events[0];
+1 -1
View File
@@ -316,7 +316,7 @@ public:
void ClearMaps();
uint32_t GetEventID() { return m_CurEventID; }
APIEvent GetEvent(uint32_t eventID);
const APIEvent &GetEvent(uint32_t eventID);
const DrawcallTreeNode &GetRootDraw() { return m_ParentDrawcall; }
void ThreadSafe_SetMarker(uint32_t col, const wchar_t *name);
+1 -1
View File
@@ -118,7 +118,7 @@ public:
WrappedID3D12Device *GetWrappedDevice() { return m_pDevice; }
const vector<D3D12ResourceRecord *> &GetCmdLists() { return m_CmdListRecords; }
D3D12DrawcallTreeNode &GetParentDrawcall() { return m_Cmd.m_ParentDrawcall; }
APIEvent GetEvent(uint32_t eventID);
const APIEvent &GetEvent(uint32_t eventID);
uint32_t GetMaxEID() { return m_Cmd.m_Events.back().eventID; }
ResourceId GetBackbufferResourceID() { return m_BackbufferID; }
void ClearAfterCapture();
+4 -4
View File
@@ -254,12 +254,12 @@ void WrappedID3D12CommandQueue::ClearAfterCapture()
m_QueueRecord->DeleteChunks();
}
APIEvent WrappedID3D12CommandQueue::GetEvent(uint32_t eventID)
const APIEvent &WrappedID3D12CommandQueue::GetEvent(uint32_t eventID)
{
for(size_t i = m_Cmd.m_Events.size() - 1; i > 0; i--)
for(const APIEvent &e : m_Cmd.m_Events)
{
if(m_Cmd.m_Events[i].eventID <= eventID)
return m_Cmd.m_Events[i];
if(e.eventID >= eventID)
return e;
}
return m_Cmd.m_Events[0];
+4 -4
View File
@@ -4462,12 +4462,12 @@ void WrappedOpenGL::AddEvent(string description)
m_Events.push_back(apievent);
}
APIEvent WrappedOpenGL::GetEvent(uint32_t eventID)
const APIEvent &WrappedOpenGL::GetEvent(uint32_t eventID)
{
for(size_t i = m_Events.size() - 1; i > 0; i--)
for(const APIEvent &e : m_Events)
{
if(m_Events[i].eventID <= eventID)
return m_Events[i];
if(e.eventID >= eventID)
return e;
}
return m_Events[0];
+1 -1
View File
@@ -574,7 +574,7 @@ public:
GLuint GetFakeBBFBO() { return m_FakeBB_FBO; }
GLuint GetFakeVAO() { return m_FakeVAO; }
FrameRecord &GetFrameRecord() { return m_FrameRecord; }
APIEvent GetEvent(uint32_t eventID);
const APIEvent &GetEvent(uint32_t eventID);
const DrawcallTreeNode &GetRootDraw() { return m_ParentDrawcall; }
const DrawcallDescription *GetDrawcall(uint32_t eventID);
+4 -4
View File
@@ -3108,12 +3108,12 @@ void WrappedVulkan::AddEvent(string description)
m_EventMessages.clear();
}
APIEvent WrappedVulkan::GetEvent(uint32_t eventID)
const APIEvent &WrappedVulkan::GetEvent(uint32_t eventID)
{
for(size_t i = m_Events.size() - 1; i > 0; i--)
for(const APIEvent &e : m_Events)
{
if(m_Events[i].eventID <= eventID)
return m_Events[i];
if(e.eventID >= eventID)
return e;
}
return m_Events[0];
+1 -1
View File
@@ -724,7 +724,7 @@ public:
void ReadLogInitialisation();
FrameRecord &GetFrameRecord() { return m_FrameRecord; }
APIEvent GetEvent(uint32_t eventID);
const APIEvent &GetEvent(uint32_t eventID);
uint32_t GetMaxEID() { return m_Events.back().eventID; }
const DrawcallDescription *GetDrawcall(uint32_t eventID);