mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Markers don't increment drawcall ID, use eventID for prev/next/parent
This commit is contained in:
@@ -913,7 +913,12 @@ void WrappedID3D11DeviceContext::RefreshDrawcallIDs(DrawcallTreeNode &node)
|
||||
// assign new drawcall IDs
|
||||
for(size_t i=0; i < node.children.size(); i++)
|
||||
{
|
||||
node.children[i].draw.drawcallID = m_CurDrawcallID++;
|
||||
node.children[i].draw.drawcallID = m_CurDrawcallID;
|
||||
|
||||
// markers don't increment drawcall ID
|
||||
if((node.children[i].draw.flags & (eDraw_SetMarker|eDraw_PushMarker)) == 0)
|
||||
m_CurDrawcallID++;
|
||||
|
||||
RefreshDrawcallIDs(node.children[i]);
|
||||
}
|
||||
}
|
||||
@@ -951,7 +956,10 @@ void WrappedID3D11DeviceContext::AddDrawcall(FetchDrawcall d, bool hasEvents)
|
||||
draw.depthOut = ((WrappedID3D11DepthStencilView *)m_CurrentPipelineState->OM.DepthView)->GetResourceResID();
|
||||
}
|
||||
|
||||
m_CurDrawcallID++;
|
||||
// markers don't increment drawcall ID
|
||||
if((draw.flags & (eDraw_SetMarker|eDraw_PushMarker)) == 0)
|
||||
m_CurDrawcallID++;
|
||||
|
||||
if(hasEvents)
|
||||
{
|
||||
vector<FetchAPIEvent> evs;
|
||||
|
||||
@@ -1583,8 +1583,11 @@ void WrappedOpenGL::AddDrawcall(FetchDrawcall d, bool hasEvents)
|
||||
m_Real.glGetFramebufferAttachmentParameteriv(eGL_DRAW_FRAMEBUFFER, eGL_DEPTH_ATTACHMENT, eGL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, (GLint*)&curDepth);
|
||||
draw.depthOut = GetResourceManager()->GetID(TextureRes(GetCtx(), curDepth));
|
||||
}
|
||||
|
||||
// markers don't increment drawcall ID
|
||||
if((draw.flags & (eDraw_SetMarker|eDraw_PushMarker)) == 0)
|
||||
m_CurDrawcallID++;
|
||||
|
||||
m_CurDrawcallID++;
|
||||
if(hasEvents)
|
||||
{
|
||||
vector<FetchAPIEvent> evs;
|
||||
|
||||
@@ -128,9 +128,9 @@ void ReplayOutput::RefreshOverlay()
|
||||
passEvents.clear();
|
||||
|
||||
FetchDrawcall *start = draw;
|
||||
while(start && start->previous != 0 && (m_pRenderer->GetDrawcallByDrawID((uint32_t)start->previous)->flags & eDraw_Clear) == 0)
|
||||
while(start && start->previous != 0 && (m_pRenderer->GetDrawcallByEID((uint32_t)start->previous, 0)->flags & eDraw_Clear) == 0)
|
||||
{
|
||||
FetchDrawcall *prev = m_pRenderer->GetDrawcallByDrawID((uint32_t)start->previous);;
|
||||
FetchDrawcall *prev = m_pRenderer->GetDrawcallByEID((uint32_t)start->previous, 0);
|
||||
|
||||
if(memcmp(start->outputs, prev->outputs, sizeof(start->outputs)) || start->depthOut != prev->depthOut)
|
||||
break;
|
||||
@@ -148,7 +148,7 @@ void ReplayOutput::RefreshOverlay()
|
||||
if(start == draw)
|
||||
break;
|
||||
|
||||
start = m_pRenderer->GetDrawcallByDrawID((uint32_t)start->next);
|
||||
start = m_pRenderer->GetDrawcallByEID((uint32_t)start->next, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,36 +144,14 @@ bool ReplayRenderer::GetFrameInfo(rdctype::array<FetchFrameInfo> *arr)
|
||||
return true;
|
||||
}
|
||||
|
||||
struct drawcall_eventID : public std::unary_function<std::string, bool>
|
||||
{
|
||||
drawcall_eventID(const uint32_t e) : evID(e) {}
|
||||
bool operator() (const FetchDrawcall *arg) { return arg ? arg->eventID == evID : false; }
|
||||
uint32_t evID;
|
||||
};
|
||||
|
||||
FetchDrawcall *ReplayRenderer::GetDrawcallByDrawID(uint32_t drawID)
|
||||
{
|
||||
if(drawID < m_Drawcalls.size())
|
||||
return m_Drawcalls[drawID];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FetchDrawcall *ReplayRenderer::GetDrawcallByEID(uint32_t eventID, uint32_t defEventID)
|
||||
{
|
||||
FetchDrawcall *ret = NULL;
|
||||
uint32_t ev = defEventID > 0 ? defEventID : eventID;
|
||||
|
||||
FetchDrawcall ev;
|
||||
ev.eventID = defEventID > 0 ? defEventID : eventID;
|
||||
if(ev >= m_Drawcalls.size())
|
||||
return NULL;
|
||||
|
||||
// can't guarantee ordering for std::upper_bound, since deferred contexts can
|
||||
// break ordering
|
||||
auto it = std::find_if(m_Drawcalls.begin(), m_Drawcalls.end(), drawcall_eventID(ev.eventID));
|
||||
|
||||
if(it != m_Drawcalls.end())
|
||||
ret = *it;
|
||||
|
||||
return ret;
|
||||
return m_Drawcalls[ev];
|
||||
}
|
||||
|
||||
bool ReplayRenderer::GetDrawcalls(uint32_t frameID, bool includeTimes, rdctype::array<FetchDrawcall> *draws)
|
||||
@@ -643,7 +621,7 @@ FetchDrawcall *ReplayRenderer::SetupDrawcallPointers(FetchFrameInfo frame, rdcty
|
||||
{
|
||||
FetchDrawcall *draw = &draws[i];
|
||||
|
||||
draw->parent = parent ? parent->drawcallID : 0;
|
||||
draw->parent = parent ? parent->eventID : 0;
|
||||
|
||||
if(draw->children.count > 0)
|
||||
{
|
||||
@@ -656,12 +634,12 @@ FetchDrawcall *ReplayRenderer::SetupDrawcallPointers(FetchFrameInfo frame, rdcty
|
||||
else
|
||||
{
|
||||
if(previous != NULL)
|
||||
previous->next = draw->drawcallID;
|
||||
draw->previous = previous ? previous->drawcallID : 0;
|
||||
previous->next = draw->eventID;
|
||||
draw->previous = previous ? previous->eventID : 0;
|
||||
|
||||
RDCASSERT(m_Drawcalls.empty() || draw->eventID > m_Drawcalls.back()->eventID || draw->context != frame.immContextId);
|
||||
m_Drawcalls.resize(RDCMAX(m_Drawcalls.size(), size_t(draw->drawcallID+1)));
|
||||
m_Drawcalls[draw->drawcallID] = draw;
|
||||
m_Drawcalls.resize(RDCMAX(m_Drawcalls.size(), size_t(draw->eventID+1)));
|
||||
m_Drawcalls[draw->eventID] = draw;
|
||||
|
||||
ret = previous = draw;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,6 @@ struct ReplayRenderer
|
||||
ReplayCreateStatus PostCreateInit(IReplayDriver *device);
|
||||
|
||||
FetchDrawcall *GetDrawcallByEID(uint32_t eventID, uint32_t defEventID);
|
||||
FetchDrawcall *GetDrawcallByDrawID(uint32_t drawID);
|
||||
FetchDrawcall *SetupDrawcallPointers(FetchFrameInfo frame, rdctype::array<FetchDrawcall> &draws, FetchDrawcall *parent, FetchDrawcall *previous);
|
||||
|
||||
IReplayDriver *GetDevice() { return m_pDevice; }
|
||||
|
||||
@@ -386,7 +386,7 @@ namespace renderdoc
|
||||
|
||||
foreach (var d in draws)
|
||||
{
|
||||
map.Add((Int64)d.drawcallID, d);
|
||||
map.Add((Int64)d.eventID, d);
|
||||
PopulateDraws(ref map, d.children);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user