Centralise resource naming with capture context to allow customisation

* We remove the now unneeded name fields in buffer/texture descriptions
  and some of the pipeline state structs.
* A single function will give the human-readable name for a resource id.
  This will look up a custom set of renames, on top of the names from
  the resource descriptions.
This commit is contained in:
baldurk
2017-11-17 16:30:53 +00:00
parent d009ed3b30
commit 7c8628b237
32 changed files with 342 additions and 860 deletions
+53 -1
View File
@@ -53,7 +53,7 @@
CaptureContext::CaptureContext(QString paramFilename, QString remoteHost, uint32_t remoteIdent,
bool temp, PersistantConfig &cfg)
: m_Config(cfg)
: m_Config(cfg), m_CurPipelineState(*this)
{
m_LogLoaded = false;
m_LoadInProgress = false;
@@ -545,6 +545,8 @@ void CaptureContext::CloseLogfile()
m_Resources.clear();
m_ResourceList.clear();
m_CustomNames.clear();
m_Drawcalls.clear();
m_FirstDrawcall = m_LastDrawcall = NULL;
@@ -612,6 +614,56 @@ void CaptureContext::AddMessages(const rdcarray<DebugMessage> &msgs)
}
}
QString CaptureContext::GetResourceName(ResourceId id)
{
if(id == ResourceId())
return tr("{No Resource}");
if(m_CustomNames.contains(id))
return m_CustomNames[id];
ResourceDescription *desc = GetResource(id);
if(desc)
return desc->name;
return tr("Unknown %1").arg(ToQStr(id));
}
bool CaptureContext::IsAutogeneratedName(ResourceId id)
{
if(id == ResourceId())
return true;
if(m_CustomNames.contains(id))
return false;
ResourceDescription *desc = GetResource(id);
if(desc)
return desc->autogeneratedName;
return true;
}
bool CaptureContext::HasResourceCustomName(ResourceId id)
{
return m_CustomNames.contains(id);
}
void CaptureContext::SetResourceCustomName(ResourceId id, const QString &name)
{
if(name.isEmpty())
{
if(m_CustomNames.contains(id))
m_CustomNames.remove(id);
}
else
{
m_CustomNames[id] = name;
}
}
void *CaptureContext::FillWindowingData(uintptr_t widget)
{
#if defined(WIN32)