Add python function to clear replay cache

This commit is contained in:
baldurk
2025-02-21 14:19:12 +00:00
parent e59c0494a5
commit 31d29fcea1
23 changed files with 110 additions and 11 deletions
+7
View File
@@ -2005,6 +2005,13 @@ void CaptureContext::LoadEdits(const QString &data)
}
}
void CaptureContext::ClearReplayCache()
{
m_CustomNameCachedID++;
Replay().AsyncInvoke([](IReplayController *r) { r->ClearReplayCache(); });
}
bool CaptureContext::OpenRGPProfile(const rdcstr &filename)
{
delete m_RGP;
+1
View File
@@ -163,6 +163,7 @@ public:
const ActionDescription *CurAction() override { return GetAction(CurEvent()); }
const ActionDescription *GetFirstAction() override { return m_FirstAction; };
const ActionDescription *GetLastAction() override { return m_LastAction; };
void ClearReplayCache() override;
bool OpenRGPProfile(const rdcstr &filename) override;
IRGPInterop *GetRGPInterop() override { return m_RGP; }
const rdcarray<ActionDescription> &CurRootActions() override { return *m_Actions; }
+5
View File
@@ -2264,6 +2264,11 @@ again, any previous connection will be closed.
)");
virtual bool OpenRGPProfile(const rdcstr &filename) = 0;
DOCUMENT(R"(Clear any cached data from previous replays and ensure subsequent replays fully
re-initialise any data, including e.g. bindless feedback, printf results or mesh output data.
)");
virtual void ClearReplayCache() = 0;
DOCUMENT(R"(Returns the current interop handle for RGP.
This may return ``None`` in several cases:
+1
View File
@@ -531,6 +531,7 @@ struct CaptureContextInvoker : ObjectForwarder<ICaptureContext>
{
return m_Obj.GetAction(eventId);
}
virtual void ClearReplayCache() override { return m_Obj.ClearReplayCache(); }
virtual bool OpenRGPProfile(const rdcstr &filename) override
{
return m_Obj.OpenRGPProfile(filename);
+19 -11
View File
@@ -621,7 +621,7 @@ void ShaderMessageViewer::OnCaptureClosed()
void ShaderMessageViewer::OnEventChanged(uint32_t eventId)
{
ResourceId shaders[NumShaderStages];
bool editsChanged = false;
bool needRefresh = false;
QString staleReason;
for(ShaderStage s : values<ShaderStage>())
@@ -632,13 +632,24 @@ void ShaderMessageViewer::OnEventChanged(uint32_t eventId)
// either an edit has been applied, updated, or removed if these don't match
if(shaders[idx] != m_ReplacedShaders[idx])
{
editsChanged = true;
staleReason += QFormatStr(", %1").arg(ToQStr(s, m_API));
needRefresh = true;
if(staleReason.isEmpty())
staleReason = tr("there are edits to shaders typed ");
else
staleReason += lit(", ");
staleReason += QFormatStr("%1").arg(ToQStr(s, m_API));
}
}
if(!needRefresh && m_ResourceCacheID != m_Ctx.ResourceNameCacheID())
{
staleReason = tr("The replay information is out of date");
m_ResourceCacheID = m_Ctx.ResourceNameCacheID();
needRefresh = true;
}
// if the edits haven't changed, just skip
if(!editsChanged)
if(!needRefresh)
return;
// if it's the current event we can update with the latest
@@ -656,15 +667,12 @@ void ShaderMessageViewer::OnEventChanged(uint32_t eventId)
}
else
{
staleReason.remove(0, 2);
// otherwise we can't - just update the stale status
ui->staleStatus->show();
ui->staleStatus->setText(
tr("Messages are stale because edits to %1 shaders have changed since they were fetched.\n"
"Select the event @%2 to refresh.")
.arg(staleReason)
.arg(m_EID));
ui->staleStatus->setText(tr("Messages are stale because %1 since the messages were fetched.\n"
"Select the event @%2 to refresh.")
.arg(staleReason)
.arg(m_EID));
ui->messages->beginUpdate();
+2
View File
@@ -71,6 +71,8 @@ private:
bool m_Multiview = false, m_Multisampled = false;
int m_ResourceCacheID = -1;
GraphicsAPI m_API;
uint32_t m_EID;
const ActionDescription *m_Action;