mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
qrenderdoc: Show currently selected event in the API inspector
Currently, selecting an event with children (e.g. vkCmdExecuteCommands) in the event browser will cause the API inspector window to show the final child event, rather than the event itself. This behaviour makes sense everywhere else: selecting an event with children shows the state after all children have completed. However, for the API inspector, we want to be able see API calls for the parent event when it is selected rather than those of its last child, particularly in the case of vkCmdExecuteCommands which may have other API calls leading up to it. To allow this, distinguish between the "current event" and "selected event". For an event with children, the former refers to the last child, while the latter refers to the event itself. ILogViewerForm now has two separate event callbacks for when either one changes. The API inspector now makes use of the selected event, while everything else continues to use the current event.
This commit is contained in:
committed by
Baldur Karlsson
parent
ba30bc0a57
commit
6e2fc42cbd
@@ -366,8 +366,12 @@ void CaptureContext::CloseLogfile()
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureContext::SetEventID(ILogViewerForm *exclude, uint32_t eventID, bool force)
|
||||
void CaptureContext::SetEventID(ILogViewerForm *exclude, uint32_t selectedEventID, uint32_t eventID,
|
||||
bool force)
|
||||
{
|
||||
uint32_t prevSelectedEventID = m_SelectedEventID;
|
||||
m_SelectedEventID = selectedEventID;
|
||||
uint32_t prevEventID = m_EventID;
|
||||
m_EventID = eventID;
|
||||
|
||||
m_Renderer.BlockInvoke([this, eventID, force](IReplayRenderer *r) {
|
||||
@@ -385,7 +389,10 @@ void CaptureContext::SetEventID(ILogViewerForm *exclude, uint32_t eventID, bool
|
||||
if(logviewer == exclude)
|
||||
continue;
|
||||
|
||||
logviewer->OnEventSelected(eventID);
|
||||
if(force || prevSelectedEventID != selectedEventID)
|
||||
logviewer->OnSelectedEventChanged(selectedEventID);
|
||||
if(force || prevEventID != eventID)
|
||||
logviewer->OnEventChanged(eventID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,17 @@ struct ILogViewerForm
|
||||
{
|
||||
virtual void OnLogfileLoaded() = 0;
|
||||
virtual void OnLogfileClosed() = 0;
|
||||
virtual void OnEventSelected(uint32_t eventID) = 0;
|
||||
|
||||
// These 2 functions distinguish between the event which is actually
|
||||
// selected and the event which the displayed state should be taken from. In
|
||||
// the case of an event with children, OnSelectedEventChanged receives the
|
||||
// ID of the event itself, whereas OnEventChanged receives that of the last
|
||||
// child. This means that selecting an event with children displays the
|
||||
// state after all of its children have completed, the exception being that
|
||||
// the API inspector uses the selected event ID to display the API calls of
|
||||
// that event rather than of the last child.
|
||||
virtual void OnSelectedEventChanged(uint32_t eventID) = 0;
|
||||
virtual void OnEventChanged(uint32_t eventID) = 0;
|
||||
};
|
||||
|
||||
class MainWindow;
|
||||
@@ -73,8 +83,9 @@ public:
|
||||
void LoadLogfile(const QString &logFile, const QString &origFilename, bool temporary, bool local);
|
||||
void CloseLogfile();
|
||||
|
||||
void SetEventID(ILogViewerForm *exclude, uint32_t eventID, bool force = false);
|
||||
void RefreshStatus() { SetEventID(NULL, m_EventID, true); }
|
||||
void SetEventID(ILogViewerForm *exclude, uint32_t selectedEventID, uint32_t eventID,
|
||||
bool force = false);
|
||||
void RefreshStatus() { SetEventID(NULL, m_SelectedEventID, m_EventID, true); }
|
||||
void AddLogViewer(ILogViewerForm *f)
|
||||
{
|
||||
m_LogViewers.push_back(f);
|
||||
@@ -82,7 +93,7 @@ public:
|
||||
if(LogLoaded())
|
||||
{
|
||||
f->OnLogfileLoaded();
|
||||
f->OnEventSelected(CurEvent());
|
||||
f->OnEventChanged(CurEvent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +108,9 @@ public:
|
||||
QString LogFilename() { return m_LogFile; }
|
||||
const FetchFrameInfo &FrameInfo() { return m_FrameInfo; }
|
||||
const APIProperties &APIProps() { return m_APIProps; }
|
||||
uint32_t CurSelectedEvent() { return m_SelectedEventID; }
|
||||
uint32_t CurEvent() { return m_EventID; }
|
||||
const FetchDrawcall *CurSelectedDrawcall() { return GetDrawcall(CurSelectedEvent()); }
|
||||
const FetchDrawcall *CurDrawcall() { return GetDrawcall(CurEvent()); }
|
||||
const rdctype::array<FetchDrawcall> &CurDrawcalls() { return m_Drawcalls; }
|
||||
FetchTexture *GetTexture(ResourceId id) { return m_Textures[id]; }
|
||||
@@ -161,6 +174,7 @@ private:
|
||||
void LoadLogfileThreaded(const QString &logFile, const QString &origFilename, bool temporary,
|
||||
bool local);
|
||||
|
||||
uint32_t m_SelectedEventID;
|
||||
uint32_t m_EventID;
|
||||
|
||||
const FetchDrawcall *GetDrawcall(const rdctype::array<FetchDrawcall> &draws, uint32_t eventID)
|
||||
|
||||
@@ -59,7 +59,7 @@ void APIInspector::OnLogfileClosed()
|
||||
ui->callstack->clear();
|
||||
}
|
||||
|
||||
void APIInspector::OnEventSelected(uint32_t eventID)
|
||||
void APIInspector::OnSelectedEventChanged(uint32_t eventID)
|
||||
{
|
||||
ui->apiEvents->clearSelection();
|
||||
|
||||
@@ -116,7 +116,7 @@ void APIInspector::fillAPIView()
|
||||
QRegularExpression rgxopen("^\\s*{");
|
||||
QRegularExpression rgxclose("^\\s*}");
|
||||
|
||||
const FetchDrawcall *draw = m_Ctx->CurDrawcall();
|
||||
const FetchDrawcall *draw = m_Ctx->CurSelectedDrawcall();
|
||||
|
||||
if(draw != NULL && draw->events.count > 0)
|
||||
{
|
||||
|
||||
@@ -42,8 +42,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
|
||||
void OnSelectedEventChanged(uint32_t eventID);
|
||||
void OnEventChanged(uint32_t eventID) {}
|
||||
public slots:
|
||||
void on_apiEvents_itemSelectionChanged();
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ void BufferViewer::OnLogfileLoaded()
|
||||
|
||||
RT_UpdateAndDisplay(r);
|
||||
|
||||
GUIInvoke::call([this]() { OnEventSelected(m_Ctx->CurEvent()); });
|
||||
GUIInvoke::call([this]() { OnEventChanged(m_Ctx->CurEvent()); });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ void BufferViewer::OnLogfileClosed()
|
||||
Reset();
|
||||
}
|
||||
|
||||
void BufferViewer::OnEventSelected(uint32_t eventID)
|
||||
void BufferViewer::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
m_ModelVSIn->beginReset();
|
||||
m_ModelVSOut->beginReset();
|
||||
|
||||
@@ -44,7 +44,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
void OnSelectedEventChanged(uint32_t eventID) {}
|
||||
void OnEventChanged(uint32_t eventID);
|
||||
|
||||
private slots:
|
||||
// automatic slots
|
||||
|
||||
@@ -91,7 +91,7 @@ void ConstantBufferPreviewer::OnLogfileClosed()
|
||||
ui->saveCSV->setEnabled(false);
|
||||
}
|
||||
|
||||
void ConstantBufferPreviewer::OnEventSelected(uint32_t eventID)
|
||||
void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
uint64_t offs = 0;
|
||||
uint64_t size = 0;
|
||||
@@ -165,7 +165,7 @@ void ConstantBufferPreviewer::processFormat(const QString &format)
|
||||
ui->formatSpecifier->setErrors(errors);
|
||||
}
|
||||
|
||||
OnEventSelected(m_Ctx->CurEvent());
|
||||
OnEventChanged(m_Ctx->CurEvent());
|
||||
}
|
||||
|
||||
void ConstantBufferPreviewer::addVariables(QTreeWidgetItem *root,
|
||||
|
||||
@@ -47,7 +47,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
void OnSelectedEventChanged(uint32_t eventID) {}
|
||||
void OnEventChanged(uint32_t eventID);
|
||||
|
||||
private slots:
|
||||
// automatic slots
|
||||
|
||||
@@ -37,7 +37,7 @@ enum
|
||||
COL_CURRENT,
|
||||
COL_FIND,
|
||||
COL_BOOKMARK,
|
||||
COL_SELECT_EID,
|
||||
COL_LAST_EID,
|
||||
};
|
||||
|
||||
EventBrowser::EventBrowser(CaptureContext *ctx, QWidget *parent)
|
||||
@@ -103,17 +103,17 @@ void EventBrowser::OnLogfileLoaded()
|
||||
framestart->setData(COL_CURRENT, Qt::UserRole, QVariant(false));
|
||||
framestart->setData(COL_FIND, Qt::UserRole, QVariant(false));
|
||||
framestart->setData(COL_BOOKMARK, Qt::UserRole, QVariant(false));
|
||||
framestart->setData(COL_SELECT_EID, Qt::UserRole, QVariant(0));
|
||||
framestart->setData(COL_LAST_EID, Qt::UserRole, QVariant(0));
|
||||
|
||||
uint lastEID = AddDrawcalls(frame, m_Ctx->CurDrawcalls());
|
||||
frame->setData(COL_EID, Qt::UserRole, QVariant(lastEID));
|
||||
frame->setData(COL_SELECT_EID, Qt::UserRole, QVariant(lastEID));
|
||||
frame->setData(COL_EID, Qt::UserRole, QVariant(0));
|
||||
frame->setData(COL_LAST_EID, Qt::UserRole, QVariant(lastEID));
|
||||
|
||||
ui->events->insertTopLevelItem(0, frame);
|
||||
|
||||
ui->events->expandItem(frame);
|
||||
|
||||
m_Ctx->SetEventID(this, lastEID);
|
||||
m_Ctx->SetEventID(this, lastEID, lastEID);
|
||||
}
|
||||
|
||||
void EventBrowser::OnLogfileClosed()
|
||||
@@ -121,7 +121,7 @@ void EventBrowser::OnLogfileClosed()
|
||||
ui->events->clear();
|
||||
}
|
||||
|
||||
void EventBrowser::OnEventSelected(uint32_t eventID)
|
||||
void EventBrowser::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
SelectEvent(eventID);
|
||||
}
|
||||
@@ -145,11 +145,11 @@ uint EventBrowser::AddDrawcalls(QTreeWidgetItem *parent, const rdctype::array<Fe
|
||||
lastEID = draws[i + 1].eventID;
|
||||
}
|
||||
|
||||
child->setData(COL_EID, Qt::UserRole, QVariant(lastEID));
|
||||
child->setData(COL_EID, Qt::UserRole, QVariant(draws[i].eventID));
|
||||
child->setData(COL_CURRENT, Qt::UserRole, QVariant(false));
|
||||
child->setData(COL_FIND, Qt::UserRole, QVariant(false));
|
||||
child->setData(COL_BOOKMARK, Qt::UserRole, QVariant(false));
|
||||
child->setData(COL_SELECT_EID, Qt::UserRole, QVariant(lastEID));
|
||||
child->setData(COL_LAST_EID, Qt::UserRole, QVariant(lastEID));
|
||||
}
|
||||
|
||||
return lastEID;
|
||||
@@ -167,7 +167,7 @@ void EventBrowser::SetDrawcallTimes(QTreeWidgetItem *node,
|
||||
// look up leaf nodes in the dictionary
|
||||
if(node->childCount() == 0)
|
||||
{
|
||||
uint eid = node->data(COL_SELECT_EID, Qt::UserRole).toUInt();
|
||||
uint eid = node->data(COL_EID, Qt::UserRole).toUInt();
|
||||
|
||||
duration = -1.0;
|
||||
|
||||
@@ -248,9 +248,10 @@ void EventBrowser::on_events_currentItemChanged(QTreeWidgetItem *current, QTreeW
|
||||
current->setData(COL_CURRENT, Qt::UserRole, QVariant(true));
|
||||
RefreshIcon(current);
|
||||
|
||||
uint EID = current->data(COL_SELECT_EID, Qt::UserRole).toUInt();
|
||||
uint EID = current->data(COL_EID, Qt::UserRole).toUInt();
|
||||
uint lastEID = current->data(COL_LAST_EID, Qt::UserRole).toUInt();
|
||||
|
||||
m_Ctx->SetEventID(this, EID);
|
||||
m_Ctx->SetEventID(this, EID, lastEID);
|
||||
}
|
||||
|
||||
void EventBrowser::on_HideFindJump()
|
||||
@@ -345,8 +346,8 @@ bool EventBrowser::FindEventNode(QTreeWidgetItem *&found, QTreeWidgetItem *paren
|
||||
{
|
||||
QTreeWidgetItem *n = parent->child(i);
|
||||
|
||||
uint nEID = n->data(COL_SELECT_EID, Qt::UserRole).toUInt();
|
||||
uint fEID = found ? found->data(COL_SELECT_EID, Qt::UserRole).toUInt() : 0;
|
||||
uint nEID = n->data(COL_LAST_EID, Qt::UserRole).toUInt();
|
||||
uint fEID = found ? found->data(COL_LAST_EID, Qt::UserRole).toUInt() : 0;
|
||||
|
||||
if(nEID >= eventID && (found == NULL || nEID <= fEID))
|
||||
found = n;
|
||||
@@ -456,7 +457,7 @@ QTreeWidgetItem *EventBrowser::FindNode(QTreeWidgetItem *parent, QString filter,
|
||||
{
|
||||
QTreeWidgetItem *n = parent->child(i);
|
||||
|
||||
uint eid = n->data(COL_SELECT_EID, Qt::UserRole).toUInt();
|
||||
uint eid = n->data(COL_LAST_EID, Qt::UserRole).toUInt();
|
||||
|
||||
if(eid > after && n->text(COL_NAME).contains(filter, Qt::CaseInsensitive))
|
||||
return n;
|
||||
@@ -483,7 +484,7 @@ int EventBrowser::FindEvent(QTreeWidgetItem *parent, QString filter, uint32_t af
|
||||
{
|
||||
auto n = parent->child(i);
|
||||
|
||||
uint eid = n->data(COL_SELECT_EID, Qt::UserRole).toUInt();
|
||||
uint eid = n->data(COL_LAST_EID, Qt::UserRole).toUInt();
|
||||
|
||||
bool matchesAfter = (forward && eid > after) || (!forward && eid < after);
|
||||
|
||||
@@ -521,7 +522,7 @@ void EventBrowser::Find(bool forward)
|
||||
|
||||
uint32_t curEID = m_Ctx->CurEvent();
|
||||
if(!ui->events->selectedItems().isEmpty())
|
||||
curEID = ui->events->selectedItems()[0]->data(COL_SELECT_EID, Qt::UserRole).toUInt();
|
||||
curEID = ui->events->selectedItems()[0]->data(COL_LAST_EID, Qt::UserRole).toUInt();
|
||||
|
||||
int eid = FindEvent(ui->findEvent->text(), curEID, forward);
|
||||
if(eid >= 0)
|
||||
|
||||
@@ -48,7 +48,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
void OnSelectedEventChanged(uint32_t eventID) {}
|
||||
void OnEventChanged(uint32_t eventID);
|
||||
|
||||
private slots:
|
||||
// automatic slots
|
||||
|
||||
@@ -936,7 +936,7 @@ void MainWindow::OnLogfileClosed()
|
||||
*/
|
||||
}
|
||||
|
||||
void MainWindow::OnEventSelected(uint32_t eventID)
|
||||
void MainWindow::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded() override;
|
||||
void OnLogfileClosed() override;
|
||||
void OnEventSelected(uint32_t eventID) override;
|
||||
void OnSelectedEventChanged(uint32_t eventID) override {}
|
||||
void OnEventChanged(uint32_t eventID) override;
|
||||
|
||||
void setProgress(float val);
|
||||
void takeLogOwnership() { m_OwnTempLog = true; }
|
||||
|
||||
@@ -44,6 +44,6 @@ void D3D11PipelineStateViewer::OnLogfileClosed()
|
||||
{
|
||||
}
|
||||
|
||||
void D3D11PipelineStateViewer::OnEventSelected(uint32_t eventID)
|
||||
void D3D11PipelineStateViewer::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
void OnSelectedEventChanged(uint32_t eventID) {}
|
||||
void OnEventChanged(uint32_t eventID);
|
||||
|
||||
private:
|
||||
Ui::D3D11PipelineStateViewer *ui;
|
||||
|
||||
@@ -44,6 +44,6 @@ void D3D12PipelineStateViewer::OnLogfileClosed()
|
||||
{
|
||||
}
|
||||
|
||||
void D3D12PipelineStateViewer::OnEventSelected(uint32_t eventID)
|
||||
void D3D12PipelineStateViewer::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
void OnSelectedEventChanged(uint32_t eventID) {}
|
||||
void OnEventChanged(uint32_t eventID);
|
||||
|
||||
private:
|
||||
Ui::D3D12PipelineStateViewer *ui;
|
||||
|
||||
@@ -44,6 +44,6 @@ void GLPipelineStateViewer::OnLogfileClosed()
|
||||
{
|
||||
}
|
||||
|
||||
void GLPipelineStateViewer::OnEventSelected(uint32_t eventID)
|
||||
void GLPipelineStateViewer::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
void OnSelectedEventChanged(uint32_t eventID) {}
|
||||
void OnEventChanged(uint32_t eventID);
|
||||
|
||||
private:
|
||||
Ui::GLPipelineStateViewer *ui;
|
||||
|
||||
@@ -77,10 +77,10 @@ void PipelineStateViewer::OnLogfileClosed()
|
||||
m_Current->OnLogfileClosed();
|
||||
}
|
||||
|
||||
void PipelineStateViewer::OnEventSelected(uint32_t eventID)
|
||||
void PipelineStateViewer::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
if(m_Current)
|
||||
m_Current->OnEventSelected(eventID);
|
||||
m_Current->OnEventChanged(eventID);
|
||||
}
|
||||
|
||||
QVariant PipelineStateViewer::persistData()
|
||||
|
||||
@@ -49,7 +49,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
void OnSelectedEventChanged(uint32_t eventID) {}
|
||||
void OnEventChanged(uint32_t eventID);
|
||||
|
||||
QVariant persistData();
|
||||
void setPersistData(const QVariant &persistData);
|
||||
|
||||
@@ -288,7 +288,7 @@ VulkanPipelineStateViewer::~VulkanPipelineStateViewer()
|
||||
|
||||
void VulkanPipelineStateViewer::OnLogfileLoaded()
|
||||
{
|
||||
OnEventSelected(m_Ctx->CurEvent());
|
||||
OnEventChanged(m_Ctx->CurEvent());
|
||||
}
|
||||
|
||||
void VulkanPipelineStateViewer::OnLogfileClosed()
|
||||
@@ -296,7 +296,7 @@ void VulkanPipelineStateViewer::OnLogfileClosed()
|
||||
clearState();
|
||||
}
|
||||
|
||||
void VulkanPipelineStateViewer::OnEventSelected(uint32_t eventID)
|
||||
void VulkanPipelineStateViewer::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
setState();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
void OnSelectedEventChanged(uint32_t eventID) {}
|
||||
void OnEventChanged(uint32_t eventID);
|
||||
|
||||
private slots:
|
||||
// automatic slots
|
||||
|
||||
@@ -1715,7 +1715,7 @@ void TextureViewer::texContextItem_triggered()
|
||||
QVariant eid = act->property("eid");
|
||||
if(eid.isValid())
|
||||
{
|
||||
m_Ctx->SetEventID(NULL, eid.toUInt());
|
||||
m_Ctx->SetEventID(NULL, eid.toUInt(), eid.toUInt());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2479,7 +2479,7 @@ void TextureViewer::OnLogfileLoaded()
|
||||
|
||||
RT_UpdateAndDisplay(r);
|
||||
|
||||
GUIInvoke::call([this]() { OnEventSelected(m_Ctx->CurEvent()); });
|
||||
GUIInvoke::call([this]() { OnEventChanged(m_Ctx->CurEvent()); });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2540,7 +2540,7 @@ void TextureViewer::OnLogfileClosed()
|
||||
ui->viewTexBuffer->setEnabled(false);
|
||||
}
|
||||
|
||||
void TextureViewer::OnEventSelected(uint32_t eventID)
|
||||
void TextureViewer::OnEventChanged(uint32_t eventID)
|
||||
{
|
||||
UI_UpdateCachedTexture();
|
||||
|
||||
|
||||
@@ -126,7 +126,8 @@ public:
|
||||
|
||||
void OnLogfileLoaded();
|
||||
void OnLogfileClosed();
|
||||
void OnEventSelected(uint32_t eventID);
|
||||
void OnSelectedEventChanged(uint32_t eventID) {}
|
||||
void OnEventChanged(uint32_t eventID);
|
||||
|
||||
void GotoLocation(int x, int y);
|
||||
void ViewTexture(ResourceId ID, bool focus);
|
||||
|
||||
Reference in New Issue
Block a user