Add functions to get FetchDrawcall by ID from core

This commit is contained in:
baldurk
2016-02-07 18:47:11 +01:00
parent 0120d5cba1
commit 1c5a5c9a4b
2 changed files with 48 additions and 0 deletions
+46
View File
@@ -1982,3 +1982,49 @@ FetchAPIEvent WrappedVulkan::GetEvent(uint32_t eventID)
return m_Events[0];
}
const FetchDrawcall *WrappedVulkan::GetDrawcall(const FetchDrawcall *draw, uint32_t eventID)
{
if(draw == NULL) return NULL;
if(draw->eventID == eventID) return draw;
int32_t count = draw->children.count;
for(int32_t i=0; i < count; i++)
{
const FetchDrawcall *cur = &draw->children.elems[i];
const FetchDrawcall *next = i+1 < count ? &draw->children.elems[i+1] : NULL;
if(next && next->eventID <= eventID)
continue;
cur = GetDrawcall(cur, eventID);
if(cur)
return cur;
}
return NULL;
}
const FetchDrawcall *WrappedVulkan::GetDrawcall(uint32_t frameID, uint32_t eventID)
{
if(frameID >= m_FrameRecord.size())
return NULL;
size_t count = m_FrameRecord[frameID].drawcallList.size();
for(size_t i=0; i < count; i++)
{
const FetchDrawcall *cur = &m_FrameRecord[frameID].drawcallList[i];
const FetchDrawcall *next = i+1 < count ? &m_FrameRecord[frameID].drawcallList[i+1] : NULL;
if(next && next->eventID <= eventID)
continue;
cur = GetDrawcall(cur, eventID);
if(cur)
return cur;
}
return NULL;
}
+2
View File
@@ -154,6 +154,7 @@ private:
double m_TotalTime, m_AvgFrametime, m_MinFrametime, m_MaxFrametime;
vector<FetchFrameRecord> m_FrameRecord;
const FetchDrawcall *GetDrawcall(const FetchDrawcall *draw, uint32_t eventID);
struct PhysicalDeviceData
{
@@ -530,6 +531,7 @@ public:
vector<FetchFrameRecord> &GetFrameRecord() { return m_FrameRecord; }
FetchAPIEvent GetEvent(uint32_t eventID);
const FetchDrawcall *GetDrawcall(uint32_t frameID, uint32_t eventID);
// Device initialization