Allow clicking 'next draw' from the frame start marker at EID 0

This commit is contained in:
baldurk
2017-07-17 12:36:04 +01:00
parent 8adde662fd
commit 41092e869f
6 changed files with 60 additions and 12 deletions
+17 -5
View File
@@ -139,11 +139,10 @@ void CaptureContext::LoadLogfile(const QString &logFile, const QString &origFile
QVector<ILogViewer *> logviewers(m_LogViewers);
// make sure we're on a consistent event before invoking log viewer forms
const DrawcallDescription *draw = &m_Drawcalls.back();
while(!draw->children.empty())
draw = &draw->children.back();
SetEventID(logviewers, draw->eventID, true);
if(m_LastDrawcall)
SetEventID(logviewers, m_LastDrawcall->eventID, true);
else if(!m_Drawcalls.empty())
SetEventID(logviewers, m_Drawcalls.back().eventID, true);
GUIInvoke::blockcall([&logviewers]() {
// notify all the registers log viewers that a log has been loaded
@@ -205,6 +204,8 @@ void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString &
m_EventID = 0;
m_FirstDrawcall = m_LastDrawcall = NULL;
// fetch initial data like drawcalls, textures and buffers
m_Renderer.BlockInvoke([this](IReplayController *r) {
m_FrameInfo = r->GetFrameInfo();
@@ -217,6 +218,14 @@ void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString &
AddFakeProfileMarkers();
m_FirstDrawcall = &m_Drawcalls[0];
while(!m_FirstDrawcall->children.empty())
m_FirstDrawcall = &m_FirstDrawcall->children[0];
m_LastDrawcall = &m_Drawcalls.back();
while(!m_LastDrawcall->children.empty())
m_LastDrawcall = &m_LastDrawcall->children.back();
m_PostloadProgress = 0.4f;
m_WinSystems = r->GetSupportedWindowSystems();
@@ -522,6 +531,9 @@ void CaptureContext::CloseLogfile()
m_Textures.clear();
m_TextureList.clear();
m_Drawcalls.clear();
m_FirstDrawcall = m_LastDrawcall = NULL;
m_CurD3D11PipelineState = D3D11Pipe::State();
m_CurD3D12PipelineState = D3D12Pipe::State();
m_CurGLPipelineState = GLPipe::State();
+4
View File
@@ -105,6 +105,8 @@ public:
return GetDrawcall(CurSelectedEvent());
}
const DrawcallDescription *CurDrawcall() override { return GetDrawcall(CurEvent()); }
const DrawcallDescription *GetFirstDrawcall() override { return m_FirstDrawcall; };
const DrawcallDescription *GetLastDrawcall() override { return m_LastDrawcall; };
const rdctype::array<DrawcallDescription> &CurDrawcalls() override { return m_Drawcalls; }
TextureDescription *GetTexture(ResourceId id) override { return m_Textures[id]; }
const rdctype::array<TextureDescription> &GetTextures() override { return m_TextureList; }
@@ -248,6 +250,8 @@ private:
APIProperties m_APIProps;
FrameDescription m_FrameInfo;
DrawcallDescription *m_FirstDrawcall = NULL;
DrawcallDescription *m_LastDrawcall = NULL;
QMap<ResourceId, TextureDescription *> m_Textures;
rdctype::array<TextureDescription> m_TextureList;
+15 -1
View File
@@ -960,11 +960,25 @@ more information for how this differs.
DOCUMENT(R"(Retrieve the current drawcall.
:return: The current drawcall.
:return: The current drawcall, or ``None`` if no drawcall is selected.
:rtype: ~renderdoc.DrawcallDescription
)");
virtual const DrawcallDescription *CurDrawcall() = 0;
DOCUMENT(R"(Retrieve the first drawcall in the capture.
:return: The first drawcall.
:rtype: ~renderdoc.DrawcallDescription
)");
virtual const DrawcallDescription *GetFirstDrawcall() = 0;
DOCUMENT(R"(Retrieve the last drawcall in the capture.
:return: The last drawcall.
:rtype: ~renderdoc.DrawcallDescription
)");
virtual const DrawcallDescription *GetLastDrawcall() = 0;
DOCUMENT(R"(Retrieve the root list of drawcalls in the current capture.
:return: The root drawcalls.
+17 -1
View File
@@ -175,7 +175,7 @@ void EventBrowser::OnLogfileLoaded()
RDTreeWidgetItem *framestart =
new RDTreeWidgetItem({tr("Frame Start"), lit("0"), lit("0"), QString()});
framestart->setTag(QVariant::fromValue(EventItemTag()));
framestart->setTag(QVariant::fromValue(EventItemTag(0, 0)));
frame->addChild(framestart);
@@ -403,6 +403,14 @@ void EventBrowser::on_events_currentItemChanged(RDTreeWidgetItem *current, RDTre
ui->stepPrev->setEnabled(draw && draw->previous);
ui->stepNext->setEnabled(draw && draw->next);
// special case for the first draw in the frame
if(tag.lastEID == 0)
ui->stepNext->setEnabled(true);
// special case for the first 'virtual' draw at EID 0
if(tag.lastEID == m_Ctx.GetFirstDrawcall()->eventID)
ui->stepPrev->setEnabled(true);
highlightBookmarks();
}
@@ -502,6 +510,10 @@ void EventBrowser::on_stepNext_clicked()
if(draw && draw->next > 0)
SelectEvent(draw->next);
// special case for the first 'virtual' draw at EID 0
if(m_Ctx.CurEvent() == 0)
SelectEvent(m_Ctx.GetFirstDrawcall()->eventID);
}
void EventBrowser::on_stepPrev_clicked()
@@ -513,6 +525,10 @@ void EventBrowser::on_stepPrev_clicked()
if(draw && draw->previous > 0)
SelectEvent(draw->previous);
// special case for the first 'virtual' draw at EID 0
if(m_Ctx.CurEvent() == m_Ctx.GetFirstDrawcall()->eventID)
SelectEvent(0);
}
void EventBrowser::on_exportDraws_clicked()
+5
View File
@@ -68,6 +68,11 @@ struct CaptureContextInvoker : ICaptureContext
return m_Ctx.CurSelectedDrawcall();
}
virtual const DrawcallDescription *CurDrawcall() override { return m_Ctx.CurDrawcall(); }
virtual const DrawcallDescription *GetFirstDrawcall() override
{
return m_Ctx.GetFirstDrawcall();
}
virtual const DrawcallDescription *GetLastDrawcall() override { return m_Ctx.GetLastDrawcall(); }
virtual const rdctype::array<DrawcallDescription> &CurDrawcalls() override
{
return m_Ctx.CurDrawcalls();
+2 -5
View File
@@ -686,17 +686,14 @@ void StatisticsViewer::GenerateReport()
{
const rdctype::array<DrawcallDescription> &curDraws = m_Ctx.CurDrawcalls();
const DrawcallDescription *lastDraw = &curDraws.back();
while(!lastDraw->children.empty())
lastDraw = &lastDraw->children.back();
uint32_t drawCount = 0;
uint32_t dispatchCount = 0;
uint32_t diagnosticCount = 0;
for(const DrawcallDescription &d : curDraws)
CountContributingEvents(d, drawCount, dispatchCount, diagnosticCount);
uint32_t numAPIcalls = lastDraw->eventID - (drawCount + dispatchCount + diagnosticCount);
uint32_t numAPIcalls =
m_Ctx.GetLastDrawcall()->eventID - (drawCount + dispatchCount + diagnosticCount);
int numTextures = m_Ctx.GetTextures().count;
int numBuffers = m_Ctx.GetBuffers().count;