Add D3D11 driver side call to fetch drawcall by event ID

This commit is contained in:
baldurk
2014-07-13 18:57:38 +01:00
parent 53afb34e71
commit 4ff1355a10
2 changed files with 49 additions and 0 deletions
+46
View File
@@ -3160,3 +3160,49 @@ WrappedID3D11DeviceContext *WrappedID3D11Device::GetDeferredContext( size_t idx
return *it;
}
const FetchDrawcall *WrappedID3D11Device::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 *WrappedID3D11Device::GetDrawcall(uint32_t frameID, uint32_t eventID)
{
if(frameID >= m_FrameRecord.size())
return NULL;
int32_t count = m_FrameRecord[frameID].drawcallList.count;
for(int32_t i=0; i < count; i++)
{
const FetchDrawcall *cur = &m_FrameRecord[frameID].drawcallList.elems[i];
const FetchDrawcall *next = i+1 < count ? &m_FrameRecord[frameID].drawcallList.elems[i+1] : NULL;
if(next && next->eventID <= eventID)
continue;
cur = GetDrawcall(cur, eventID);
if(cur)
return cur;
}
return NULL;
}
+3
View File
@@ -198,6 +198,7 @@ private:
double m_TotalTime, m_AvgFrametime, m_MinFrametime, m_MaxFrametime;
vector<FetchFrameRecord> m_FrameRecord;
const FetchDrawcall *GetDrawcall(const FetchDrawcall *draw, uint32_t eventID);
public:
static const int AllocPoolCount = 4;
ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D11Device, AllocPoolCount);
@@ -228,6 +229,8 @@ public:
vector<FetchFrameRecord> &GetFrameRecord() { return m_FrameRecord; }
const FetchDrawcall *GetDrawcall(uint32_t frameID, uint32_t eventID);
vector<DebugMessage> GetDebugMessages();
const vector<D3D11_INPUT_ELEMENT_DESC> &GetLayoutDesc(ID3D11InputLayout *layout) { return m_LayoutDescs[layout]; }
ShaderReflection *GetLayoutDXBC(ID3D11InputLayout *layout) { return m_LayoutDXBC[layout]; }