mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 15:06:32 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user