diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index ff51f2d59..8dd22a768 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -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 &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) diff --git a/qrenderdoc/Code/CaptureContext.h b/qrenderdoc/Code/CaptureContext.h index e6d702e34..d7032fddc 100644 --- a/qrenderdoc/Code/CaptureContext.h +++ b/qrenderdoc/Code/CaptureContext.h @@ -112,6 +112,10 @@ public: const rdcarray &CurDrawcalls() override { return m_Drawcalls; } ResourceDescription *GetResource(ResourceId id) override { return m_Resources[id]; } const rdcarray &GetResources() override { return m_ResourceList; } + QString GetResourceName(ResourceId id) override; + bool IsAutogeneratedName(ResourceId id) override; + bool HasResourceCustomName(ResourceId id) override; + void SetResourceCustomName(ResourceId id, const QString &name) override; TextureDescription *GetTexture(ResourceId id) override { return m_Textures[id]; } const rdcarray &GetTextures() override { return m_TextureList; } BufferDescription *GetBuffer(ResourceId id) override { return m_Buffers[id]; } @@ -274,6 +278,8 @@ private: QMap m_Resources; rdcarray m_ResourceList; + QMap m_CustomNames; + const SDFile *m_StructuredFile; SDFile m_DummySDFile; diff --git a/qrenderdoc/Code/Interface/CommonPipelineState.cpp b/qrenderdoc/Code/Interface/CommonPipelineState.cpp index bd890cfd1..fb705d452 100644 --- a/qrenderdoc/Code/Interface/CommonPipelineState.cpp +++ b/qrenderdoc/Code/Interface/CommonPipelineState.cpp @@ -469,12 +469,12 @@ QString CommonPipelineState::GetShaderName(ShaderStage stage) { switch(stage) { - case ShaderStage::Vertex: return m_D3D11->m_VS.name; - case ShaderStage::Domain: return m_D3D11->m_DS.name; - case ShaderStage::Hull: return m_D3D11->m_HS.name; - case ShaderStage::Geometry: return m_D3D11->m_GS.name; - case ShaderStage::Pixel: return m_D3D11->m_PS.name; - case ShaderStage::Compute: return m_D3D11->m_CS.name; + case ShaderStage::Vertex: return m_Ctx.GetResourceName(m_D3D11->m_VS.Object); + case ShaderStage::Domain: return m_Ctx.GetResourceName(m_D3D11->m_DS.Object); + case ShaderStage::Hull: return m_Ctx.GetResourceName(m_D3D11->m_HS.Object); + case ShaderStage::Geometry: return m_Ctx.GetResourceName(m_D3D11->m_GS.Object); + case ShaderStage::Pixel: return m_Ctx.GetResourceName(m_D3D11->m_PS.Object); + case ShaderStage::Compute: return m_Ctx.GetResourceName(m_D3D11->m_CS.Object); default: break; } } @@ -482,12 +482,12 @@ QString CommonPipelineState::GetShaderName(ShaderStage stage) { switch(stage) { - case ShaderStage::Vertex: return m_D3D12->name + lit(" VS"); - case ShaderStage::Domain: return m_D3D12->name + lit(" DS"); - case ShaderStage::Hull: return m_D3D12->name + lit(" HS"); - case ShaderStage::Geometry: return m_D3D12->name + lit(" GS"); - case ShaderStage::Pixel: return m_D3D12->name + lit(" PS"); - case ShaderStage::Compute: return m_D3D12->name + lit(" CS"); + case ShaderStage::Vertex: return m_Ctx.GetResourceName(m_D3D12->pipeline) + lit(" VS"); + case ShaderStage::Domain: return m_Ctx.GetResourceName(m_D3D12->pipeline) + lit(" DS"); + case ShaderStage::Hull: return m_Ctx.GetResourceName(m_D3D12->pipeline) + lit(" HS"); + case ShaderStage::Geometry: return m_Ctx.GetResourceName(m_D3D12->pipeline) + lit(" GS"); + case ShaderStage::Pixel: return m_Ctx.GetResourceName(m_D3D12->pipeline) + lit(" PS"); + case ShaderStage::Compute: return m_Ctx.GetResourceName(m_D3D12->pipeline) + lit(" CS"); default: break; } } @@ -495,12 +495,12 @@ QString CommonPipelineState::GetShaderName(ShaderStage stage) { switch(stage) { - case ShaderStage::Vertex: return m_GL->m_VS.ShaderName; - case ShaderStage::Tess_Control: return m_GL->m_TCS.ShaderName; - case ShaderStage::Tess_Eval: return m_GL->m_TES.ShaderName; - case ShaderStage::Geometry: return m_GL->m_GS.ShaderName; - case ShaderStage::Fragment: return m_GL->m_FS.ShaderName; - case ShaderStage::Compute: return m_GL->m_CS.ShaderName; + case ShaderStage::Vertex: return m_Ctx.GetResourceName(m_GL->m_VS.Object); + case ShaderStage::Tess_Control: return m_Ctx.GetResourceName(m_GL->m_TCS.Object); + case ShaderStage::Tess_Eval: return m_Ctx.GetResourceName(m_GL->m_TES.Object); + case ShaderStage::Geometry: return m_Ctx.GetResourceName(m_GL->m_GS.Object); + case ShaderStage::Fragment: return m_Ctx.GetResourceName(m_GL->m_FS.Object); + case ShaderStage::Compute: return m_Ctx.GetResourceName(m_GL->m_CS.Object); default: break; } } @@ -508,12 +508,12 @@ QString CommonPipelineState::GetShaderName(ShaderStage stage) { switch(stage) { - case ShaderStage::Vertex: return m_Vulkan->m_VS.name; - case ShaderStage::Domain: return m_Vulkan->m_TCS.name; - case ShaderStage::Hull: return m_Vulkan->m_TES.name; - case ShaderStage::Geometry: return m_Vulkan->m_GS.name; - case ShaderStage::Pixel: return m_Vulkan->m_FS.name; - case ShaderStage::Compute: return m_Vulkan->m_CS.name; + case ShaderStage::Vertex: return m_Ctx.GetResourceName(m_Vulkan->m_VS.Object); + case ShaderStage::Domain: return m_Ctx.GetResourceName(m_Vulkan->m_TCS.Object); + case ShaderStage::Hull: return m_Ctx.GetResourceName(m_Vulkan->m_TES.Object); + case ShaderStage::Geometry: return m_Ctx.GetResourceName(m_Vulkan->m_GS.Object); + case ShaderStage::Pixel: return m_Ctx.GetResourceName(m_Vulkan->m_FS.Object); + case ShaderStage::Compute: return m_Ctx.GetResourceName(m_Vulkan->m_CS.Object); default: break; } } diff --git a/qrenderdoc/Code/Interface/CommonPipelineState.h b/qrenderdoc/Code/Interface/CommonPipelineState.h index 29be5ed27..c755e299e 100644 --- a/qrenderdoc/Code/Interface/CommonPipelineState.h +++ b/qrenderdoc/Code/Interface/CommonPipelineState.h @@ -27,6 +27,8 @@ // do not include any headers here, they must all be in QRDInterface.h #include "QRDInterface.h" +struct ICaptureContext; + DOCUMENT("Information about a single resource bound to a slot in an API-specific way."); struct BoundResource { @@ -138,7 +140,7 @@ for the capture that's open. class CommonPipelineState { public: - CommonPipelineState() {} + CommonPipelineState(ICaptureContext &ctx) : m_Ctx(ctx) {} DOCUMENT(R"(Set the source API-specific states to read data from. :param ~renderdoc.APIProperties props: The properties of the current capture. @@ -444,6 +446,8 @@ private: const VKPipe::State *m_Vulkan = NULL; APIProperties m_APIProps; + ICaptureContext &m_Ctx; + const D3D11Pipe::Shader &GetD3D11Stage(ShaderStage stage); const D3D12Pipe::Shader &GetD3D12Stage(ShaderStage stage); const GLPipe::Shader &GetGLStage(ShaderStage stage); diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index daff1282c..067f78ede 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -1058,6 +1058,55 @@ more information for how this differs. )"); virtual const rdcarray &GetResources() = 0; + DOCUMENT(R"(Retrieve the human-readable name for the resource to display. + +This will first check to see if a custom name has been set for the resource, and if so use that. See +:meth:`SetResourceCustomName`. If no custom name has been set, it will use the resource name found +in the capture, either a name set via API-specific debug methods, or an auto-generated name based on +the resource type. + +:return: The current name of the resource. +:rtype: str +)"); + virtual QString GetResourceName(ResourceId id) = 0; + + DOCUMENT(R"(Determines whether the name for the given resource has been customised at all, either +during capture time or with :meth:`SetResourceCustomName`. + +If not, the name is just auto-generated based on the ID and resource type, so depending on +circumstance it may be preferable to omit the name. + +:return: Whether the name for the resource has just been auto-generated. +:rtype: bool +)"); + virtual bool IsAutogeneratedName(ResourceId id) = 0; + + DOCUMENT(R"(Checks whether a runtime custom name has been set with :meth:`SetResourceCustomName`. + +In general, :meth:`IsAutogeneratedName` should be preferred to check if the resource name is default +generated just from the ID, or if it has been set to some human readable name. This function will +only check if a name has been set in the UI itself, a resource could still have a custom name that +was set programmatically during capture time. + +:return: Whether the name for the resource has been customised with :meth:`SetResourceCustomName`. +:rtype: bool +)"); + virtual bool HasResourceCustomName(ResourceId id) = 0; + + DOCUMENT(R"(Set a custom name for a resource. + +This allows an override to the name returned by :meth:`GetResourceName`, most useful when there are +no pre-existing debug names specified in the capture. + +To remove a custom name that has been set previously, specify the empty string as the name. Then the +custom name will be removed, and instead :meth:`GetResourceName` will fall back to returning any +name fetched from the capture. + +:param ~renderdoc.ResourceId id: The ID of the resource to name. +:param str name: The name to provide, or an empty string to remove any previous custom name. +)"); + virtual void SetResourceCustomName(ResourceId id, const QString &name) = 0; + DOCUMENT(R"(Retrieve the information about a particular texture. :param ~renderdoc.ResourceId id: The ID of the texture to query about. diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index cb0c955c4..b33f1276f 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -359,8 +359,8 @@ void CombineUsageEvents(ICaptureContext &ctx, const rdcarray &usage, callback(start, end, us); } -void addStructuredObjects(RDTreeWidgetItem *parent, const StructuredObjectList &objs, - bool parentIsArray) +void addStructuredObjects(ICaptureContext &ctx, RDTreeWidgetItem *parent, + const StructuredObjectList &objs, bool parentIsArray) { for(const SDObject *obj : objs) { @@ -388,8 +388,7 @@ void addStructuredObjects(RDTreeWidgetItem *parent, const StructuredObjectList & static_assert(sizeof(id) == sizeof(obj->data.basic.u), "ResourceId is no longer uint64_t!"); memcpy(&id, &obj->data.basic.u, sizeof(id)); - // TODO Get global name - param = ToQStr(id); + param = ctx.GetResourceName(id); } else if(obj->type.flags & SDTypeFlags::NullString) { @@ -406,11 +405,11 @@ void addStructuredObjects(RDTreeWidgetItem *parent, const StructuredObjectList & case SDBasic::Chunk: case SDBasic::Struct: param = QFormatStr("%1()").arg(obj->type.name); - addStructuredObjects(item, obj->data.children, false); + addStructuredObjects(ctx, item, obj->data.children, false); break; case SDBasic::Array: param = QFormatStr("%1[]").arg(obj->type.name); - addStructuredObjects(item, obj->data.children, true); + addStructuredObjects(ctx, item, obj->data.children, true); break; case SDBasic::Null: param = lit("NULL"); break; case SDBasic::Buffer: param = lit("(%1 bytes)").arg(obj->type.byteSize); break; diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index 899431b81..0fd45502b 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -104,8 +104,8 @@ void CombineUsageEvents( class RDTreeWidgetItem; -void addStructuredObjects(RDTreeWidgetItem *parent, const StructuredObjectList &objs, - bool parentIsArray); +void addStructuredObjects(ICaptureContext &ctx, RDTreeWidgetItem *parent, + const StructuredObjectList &objs, bool parentIsArray); struct Formatter { diff --git a/qrenderdoc/Windows/APIInspector.cpp b/qrenderdoc/Windows/APIInspector.cpp index d9aa7cf9f..cac46b923 100644 --- a/qrenderdoc/Windows/APIInspector.cpp +++ b/qrenderdoc/Windows/APIInspector.cpp @@ -146,7 +146,7 @@ void APIInspector::fillAPIView() root->setText(1, chunk->name); - addStructuredObjects(root, chunk->data.children, false); + addStructuredObjects(m_Ctx, root, chunk->data.children, false); } else { diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index f68ff18ce..91ee277df 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -2600,7 +2600,7 @@ void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId BufferDescription *buf = m_Ctx.GetBuffer(id); if(buf) { - setWindowTitle(buf->name + lit(" - Contents")); + setWindowTitle(m_Ctx.GetResourceName(id) + lit(" - Contents")); m_ObjectByteSize = buf->length; } @@ -2620,7 +2620,7 @@ void BufferViewer::ViewTexture(uint32_t arrayIdx, uint32_t mip, ResourceId id, c TextureDescription *tex = m_Ctx.GetTexture(id); if(tex) { - setWindowTitle(tex->name + lit(" - Contents")); + setWindowTitle(m_Ctx.GetResourceName(id) + lit(" - Contents")); m_ObjectByteSize = tex->byteSize; } diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp index f68bc896e..cee4048d1 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp @@ -327,23 +327,13 @@ void ConstantBufferPreviewer::setVariables(const rdcarray &vars) void ConstantBufferPreviewer::updateLabels() { - QString bufName; - - bool needName = true; - - BufferDescription *buf = m_Ctx.GetBuffer(m_cbuffer); - if(buf) - { - bufName = buf->name; - if(buf->customName) - needName = false; - } + QString bufName = m_Ctx.GetResourceName(m_cbuffer); const ShaderReflection *reflection = m_Ctx.CurPipelineState().GetShaderReflection(m_stage); if(reflection != NULL) { - if(needName && m_slot < reflection->ConstantBlocks.size() && + if(m_Ctx.IsAutogeneratedName(m_cbuffer) && m_slot < reflection->ConstantBlocks.size() && !reflection->ConstantBlocks[m_slot].name.isEmpty()) bufName = QFormatStr("<%1>").arg(reflection->ConstantBlocks[m_slot].name); } diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index 8b5311d9c..172fcd5d0 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -1615,7 +1615,7 @@ void MainWindow::on_action_Start_Replay_Loop_triggered() id = displayTex->ID; popup.resize((int)displayTex->width, (int)displayTex->height); popup.setWindowTitle( - tr("Looping replay of %1 Displaying %2").arg(m_Ctx.LogFilename()).arg(displayTex->name)); + tr("Looping replay of %1 Displaying %2").arg(m_Ctx.LogFilename()).arg(m_Ctx.GetResourceName(id))); } else { diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp index 2dd31885a..e8ded1145 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp @@ -607,7 +607,7 @@ void D3D11PipelineStateViewer::addResourceRow(const D3D11ViewTag &view, uint32_t w = 1, h = 1, d = 1; uint32_t a = 1; QString format = tr("Unknown"); - QString name = tr("Shader Resource %1").arg(ToQStr(r.Resource)); + QString name = m_Ctx.GetResourceName(r.Resource); QString typeName = tr("Unknown"); if(!filledSlot) @@ -627,7 +627,6 @@ void D3D11PipelineStateViewer::addResourceRow(const D3D11ViewTag &view, d = tex->depth; a = tex->arraysize; format = tex->format.Name(); - name = tex->name; typeName = ToQStr(tex->resType); if(tex->resType == TextureDim::Texture2DMS || tex->resType == TextureDim::Texture2DMSArray) @@ -651,7 +650,6 @@ void D3D11PipelineStateViewer::addResourceRow(const D3D11ViewTag &view, d = 0; a = 0; format = QString(); - name = buf->name; typeName = lit("Buffer"); if(r.Flags & D3DBufferViewFlags::Raw) @@ -850,7 +848,7 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, QL if(stage.Object == ResourceId()) shader->setText(tr("Unbound Shader")); else - shader->setText(stage.name); + shader->setText(m_Ctx.GetResourceName(stage.Object)); if(shaderDetails && !shaderDetails->DebugInfo.files.empty()) { @@ -927,8 +925,8 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, QL if(shaderInput && !shaderInput->name.empty()) slotname += lit(": ") + shaderInput->name; - if(s.customName) - slotname += QFormatStr("(%1)").arg(s.name); + if(!m_Ctx.IsAutogeneratedName(s.Samp)) + slotname += QFormatStr(" = %1").arg(m_Ctx.GetResourceName(s.Samp)); QString borderColor = QFormatStr("%1, %2, %3, %4") .arg(s.BorderColor[0]) @@ -1029,7 +1027,7 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, QL if(showNode(usedSlot, filledSlot)) { - QString name = tr("Constant Buffer %1").arg(ToQStr(b.Buffer)); + QString name = m_Ctx.GetResourceName(b.Buffer); ulong length = 1; int numvars = shaderCBuf ? shaderCBuf->variables.count() : 0; uint32_t bytesize = shaderCBuf ? shaderCBuf->byteSize : 0; @@ -1043,10 +1041,7 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, QL BufferDescription *buf = m_Ctx.GetBuffer(b.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } QString slotname = QString::number(i); @@ -1120,7 +1115,7 @@ void D3D11PipelineStateViewer::setState() if(state.m_IA.Bytecode) { - QString layout = state.m_IA.name; + QString layout = m_Ctx.GetResourceName(state.m_IA.layout); if(state.m_IA.Bytecode && !state.m_IA.Bytecode->DebugInfo.files.empty()) layout += QFormatStr(" (%1)").arg(state.m_IA.Bytecode->EntryPoint); @@ -1300,7 +1295,7 @@ void D3D11PipelineStateViewer::setState() { if(ibufferUsed || ui->showDisabled->isChecked()) { - QString name = tr("Buffer ") + ToQStr(state.m_IA.ibuffer.Buffer); + QString name = m_Ctx.GetResourceName(state.m_IA.ibuffer.Buffer); uint64_t length = 1; if(!ibufferUsed) @@ -1309,10 +1304,7 @@ void D3D11PipelineStateViewer::setState() BufferDescription *buf = m_Ctx.GetBuffer(state.m_IA.ibuffer.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } RDTreeWidgetItem *node = new RDTreeWidgetItem({tr("Index"), name, draw ? draw->indexByteWidth : 0, @@ -1360,7 +1352,7 @@ void D3D11PipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QString name = tr("Buffer ") + ToQStr(v.Buffer); + QString name = m_Ctx.GetResourceName(v.Buffer); qulonglong length = 1; if(!filledSlot) @@ -1371,10 +1363,7 @@ void D3D11PipelineStateViewer::setState() BufferDescription *buf = m_Ctx.GetBuffer(v.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } RDTreeWidgetItem *node = NULL; @@ -1460,7 +1449,7 @@ void D3D11PipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QString name = tr("Buffer ") + ToQStr(s.Buffer); + QString name = m_Ctx.GetResourceName(s.Buffer); qulonglong length = 0; if(!filledSlot) @@ -1470,12 +1459,8 @@ void D3D11PipelineStateViewer::setState() BufferDescription *buf = m_Ctx.GetBuffer(s.Buffer); - if(buf) - { - name = buf->name; - if(length == 0) - length = buf->length; - } + if(buf && length == 0) + length = buf->length; RDTreeWidgetItem *node = new RDTreeWidgetItem({i, name, length, s.Offset, QString()}); @@ -2336,7 +2321,7 @@ QVariantList D3D11PipelineStateViewer::exportViewHTML(const D3D11Pipe::View &vie } } - QString name = tr("Empty"); + QString name = view.Resource == ResourceId() ? tr("Empty") : m_Ctx.GetResourceName(view.Resource); QString typeName = tr("Unknown"); QString format = tr("Unknown"); uint64_t w = 1; @@ -2358,7 +2343,6 @@ QVariantList D3D11PipelineStateViewer::exportViewHTML(const D3D11Pipe::View &vie d = tex->depth; a = tex->arraysize; format = tex->format.Name(); - name = tex->name; typeName = ToQStr(tex->resType); if(tex->mips > 1) @@ -2381,7 +2365,6 @@ QVariantList D3D11PipelineStateViewer::exportViewHTML(const D3D11Pipe::View &vie d = 0; a = 0; format = view.Format.Name(); - name = buf->name; typeName = lit("Buffer"); if(view.Flags & D3DBufferViewFlags::Raw) @@ -2465,7 +2448,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe int i = 0; for(const D3D11Pipe::VB &vb : ia.vbuffers) { - QString name = tr("Buffer %1").arg(ToQStr(vb.Buffer)); + QString name = m_Ctx.GetResourceName(vb.Buffer); uint64_t length = 0; if(vb.Buffer == ResourceId()) @@ -2476,10 +2459,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe { BufferDescription *buf = m_Ctx.GetBuffer(vb.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } } rows.push_back({i, name, vb.Stride, vb.Offset, (qulonglong)length}); @@ -2496,7 +2476,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe xml.writeCharacters(tr("Index Buffer")); xml.writeEndElement(); - QString name = tr("Buffer %1").arg(ToQStr(ia.ibuffer.Buffer)); + QString name = m_Ctx.GetResourceName(ia.ibuffer.Buffer); uint64_t length = 0; if(ia.ibuffer.Buffer == ResourceId()) @@ -2507,10 +2487,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe { BufferDescription *buf = m_Ctx.GetBuffer(ia.ibuffer.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } } QString ifmt = lit("UNKNOWN"); @@ -2543,7 +2520,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe if(sh.Object == ResourceId()) shadername = tr("Unbound"); else - shadername = sh.name; + shadername = m_Ctx.GetResourceName(sh.Object); if(shaderDetails && !shaderDetails->DebugInfo.files.isEmpty()) { @@ -2689,7 +2666,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe !shaderDetails->ConstantBlocks[i].name.isEmpty()) shaderCBuf = &shaderDetails->ConstantBlocks[i]; - QString name = tr("Constant Buffer %1").arg(ToQStr(sh.ConstantBuffers[i].Buffer)); + QString name = m_Ctx.GetResourceName(sh.ConstantBuffers[i].Buffer); uint64_t length = 1; int numvars = shaderCBuf ? shaderCBuf->variables.count() : 0; uint32_t byteSize = shaderCBuf ? shaderCBuf->byteSize : 0; @@ -2702,10 +2679,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe BufferDescription *buf = m_Ctx.GetBuffer(sh.ConstantBuffers[i].Buffer); if(buf) - { - name = buf->name; length = buf->length; - } rows.push_back({i, name, sh.ConstantBuffers[i].VecOffset, sh.ConstantBuffers[i].VecCount, numvars, byteSize, (qulonglong)length}); @@ -2755,7 +2729,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe int i = 0; for(const D3D11Pipe::SOBind &o : so.Outputs) { - QString name = tr("Buffer %1").arg(ToQStr(o.Buffer)); + QString name = m_Ctx.GetResourceName(o.Buffer); uint64_t length = 0; if(o.Buffer == ResourceId()) @@ -2766,10 +2740,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe { BufferDescription *buf = m_Ctx.GetBuffer(o.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } } rows.push_back({i, name, o.Offset, (qulonglong)length}); diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp index 69b3ef06b..7f1b3f77b 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp @@ -685,7 +685,7 @@ void D3D12PipelineStateViewer::addResourceRow(const D3D12ViewTag &view, uint32_t w = 1, h = 1, d = 1; uint32_t a = 1; QString format = tr("Unknown"); - QString name = tr("Shader Resource %1").arg(ToQStr(r.Resource)); + QString name = m_Ctx.GetResourceName(r.Resource); QString typeName = tr("Unknown"); if(!filledSlot) @@ -705,7 +705,6 @@ void D3D12PipelineStateViewer::addResourceRow(const D3D12ViewTag &view, d = tex->depth; a = tex->arraysize; format = tex->format.Name(); - name = tex->name; typeName = ToQStr(tex->resType); if(tex->resType == TextureDim::Texture2DMS || tex->resType == TextureDim::Texture2DMSArray) @@ -729,7 +728,6 @@ void D3D12PipelineStateViewer::addResourceRow(const D3D12ViewTag &view, d = 0; a = 0; format = QString(); - name = buf->name; typeName = lit("Buffer"); if(r.BufferFlags & D3DBufferViewFlags::Raw) @@ -916,11 +914,10 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12Pipe::Shader &stage, QL if(stage.Object == ResourceId()) shader->setText(tr("Unbound Shader")); - else if(state.customName) - shader->setText( - QFormatStr("%1 - %2").arg(state.name).arg(m_Ctx.CurPipelineState().Abbrev(stage.stage))); else - shader->setText(tr("%1 - %2 Shader").arg(state.name).arg(ToQStr(stage.stage, GraphicsAPI::D3D12))); + shader->setText(tr("%1 - %2 Shader") + .arg(m_Ctx.GetResourceName(state.pipeline)) + .arg(ToQStr(stage.stage, GraphicsAPI::D3D12))); if(shaderDetails && !shaderDetails->DebugInfo.files.empty()) { @@ -1145,7 +1142,7 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12Pipe::Shader &stage, QL if(showNode(usedSlot, filledSlot)) { - QString name = tr("Constant Buffer %1").arg(ToQStr(b.Buffer)); + QString name = m_Ctx.GetResourceName(b.Buffer); ulong length = b.ByteSize; uint64_t offset = b.Offset; int numvars = shaderCBuf ? shaderCBuf->variables.count() : 0; @@ -1157,11 +1154,6 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12Pipe::Shader &stage, QL if(!filledSlot) name = tr("Empty"); - BufferDescription *buf = m_Ctx.GetBuffer(b.Buffer); - - if(buf) - name = buf->name; - QString regname = QString::number(reg); if(shaderCBuf && !shaderCBuf->name.empty()) @@ -1302,7 +1294,7 @@ void D3D12PipelineStateViewer::setState() { if(ibufferUsed || ui->showDisabled->isChecked()) { - QString name = tr("Buffer ") + ToQStr(state.m_IA.ibuffer.Buffer); + QString name = m_Ctx.GetResourceName(state.m_IA.ibuffer.Buffer); uint64_t length = 1; if(!ibufferUsed) @@ -1311,10 +1303,7 @@ void D3D12PipelineStateViewer::setState() BufferDescription *buf = m_Ctx.GetBuffer(state.m_IA.ibuffer.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } RDTreeWidgetItem *node = new RDTreeWidgetItem( {tr("Index"), name, draw ? draw->indexByteWidth : 0, @@ -1362,7 +1351,7 @@ void D3D12PipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QString name = tr("Buffer ") + ToQStr(v.Buffer); + QString name = m_Ctx.GetResourceName(v.Buffer); qulonglong length = 1; if(!filledSlot) @@ -1373,10 +1362,7 @@ void D3D12PipelineStateViewer::setState() BufferDescription *buf = m_Ctx.GetBuffer(v.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } RDTreeWidgetItem *node = NULL; @@ -1429,7 +1415,7 @@ void D3D12PipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QString name = tr("Buffer ") + ToQStr(s.Buffer); + QString name = m_Ctx.GetResourceName(s.Buffer); qulonglong length = 0; if(!filledSlot) @@ -1439,12 +1425,8 @@ void D3D12PipelineStateViewer::setState() BufferDescription *buf = m_Ctx.GetBuffer(s.Buffer); - if(buf) - { - name = buf->name; - if(length == 0) - length = buf->length; - } + if(buf && length == 0) + length = buf->length; RDTreeWidgetItem *node = new RDTreeWidgetItem({i, name, length, (qulonglong)s.Offset, QString()}); @@ -2130,7 +2112,7 @@ QVariantList D3D12PipelineStateViewer::exportViewHTML(const D3D12Pipe::View &vie const ShaderResource *shaderInput, const QString &extraParams) { - QString name = tr("Empty"); + QString name = view.Resource == ResourceId() ? tr("Empty") : m_Ctx.GetResourceName(view.Resource); QString typeName = tr("Unknown"); QString format = tr("Unknown"); uint64_t w = 1; @@ -2152,7 +2134,6 @@ QVariantList D3D12PipelineStateViewer::exportViewHTML(const D3D12Pipe::View &vie d = tex->depth; a = tex->arraysize; format = tex->format.Name(); - name = tex->name; typeName = ToQStr(tex->resType); if(view.swizzle[0] != TextureSwizzle::Red || view.swizzle[1] != TextureSwizzle::Green || @@ -2192,7 +2173,6 @@ QVariantList D3D12PipelineStateViewer::exportViewHTML(const D3D12Pipe::View &vie d = 0; a = 0; format = view.Format.Name(); - name = buf->name; typeName = lit("Buffer"); if(view.BufferFlags & D3DBufferViewFlags::Raw) @@ -2234,11 +2214,9 @@ QVariantList D3D12PipelineStateViewer::exportViewHTML(const D3D12Pipe::View &vie if(view.CounterResource != ResourceId()) { - QString counterName = tr("Buffer %1").arg(ToQStr(view.CounterResource)); - BufferDescription *counterBuf = m_Ctx.GetBuffer(view.CounterResource); - if(counterBuf) - counterName = counterBuf->name; - viewParams += tr(", Counter in %1 at %2 bytes").arg(counterName).arg(view.CounterByteOffset); + viewParams += tr(", Counter in %1 at %2 bytes") + .arg(m_Ctx.GetResourceName(view.CounterResource)) + .arg(view.CounterByteOffset); } } @@ -2285,7 +2263,7 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe int i = 0; for(const D3D12Pipe::VB &vb : ia.vbuffers) { - QString name = tr("Buffer %1").arg(ToQStr(vb.Buffer)); + QString name = m_Ctx.GetResourceName(vb.Buffer); uint64_t length = 0; if(vb.Buffer == ResourceId()) @@ -2296,10 +2274,7 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe { BufferDescription *buf = m_Ctx.GetBuffer(vb.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } } length = qMin(length, (uint64_t)vb.Size); @@ -2318,7 +2293,7 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe xml.writeCharacters(tr("Index Buffer")); xml.writeEndElement(); - QString name = tr("Buffer %1").arg(ToQStr(ia.ibuffer.Buffer)); + QString name = m_Ctx.GetResourceName(ia.ibuffer.Buffer); uint64_t length = 0; if(ia.ibuffer.Buffer == ResourceId()) @@ -2329,10 +2304,7 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe { BufferDescription *buf = m_Ctx.GetBuffer(ia.ibuffer.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } } length = qMin(length, (uint64_t)ia.ibuffer.Size); @@ -2368,11 +2340,10 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe if(sh.Object == ResourceId()) shadername = tr("Unbound"); - else if(state.customName) - shadername = - QFormatStr("%1 - %2").arg(state.name).arg(m_Ctx.CurPipelineState().Abbrev(sh.stage)); else - shadername = tr("%1 - %2 Shader").arg(state.name).arg(ToQStr(sh.stage, GraphicsAPI::D3D12)); + shadername = tr("%1 - %2 Shader") + .arg(m_Ctx.GetResourceName(state.pipeline)) + .arg(ToQStr(sh.stage, GraphicsAPI::D3D12)); if(shaderDetails && !shaderDetails->DebugInfo.files.empty()) { @@ -2686,10 +2657,8 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe if(b.Immediate && !b.RootValues.empty()) bytesize = uint32_t(b.RootValues.count() * 4); - BufferDescription *buf = m_Ctx.GetBuffer(b.Buffer); - - if(buf) - name = buf->name; + if(b.Buffer != ResourceId()) + name = m_Ctx.GetResourceName(b.Buffer); else name = tr("Empty"); @@ -2725,9 +2694,9 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe int i = 0; for(const D3D12Pipe::SOBind &o : so.Outputs) { - QString name = tr("Buffer %1").arg(ToQStr(o.Buffer)); + QString name = m_Ctx.GetResourceName(o.Buffer); uint64_t length = 0; - QString counterName = tr("Buffer %1").arg(ToQStr(o.WrittenCountBuffer)); + QString counterName = m_Ctx.GetResourceName(o.WrittenCountBuffer); uint64_t counterLength = 0; if(o.Buffer == ResourceId()) @@ -2738,10 +2707,7 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe { BufferDescription *buf = m_Ctx.GetBuffer(o.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } } if(o.WrittenCountBuffer == ResourceId()) @@ -2752,10 +2718,7 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe { BufferDescription *buf = m_Ctx.GetBuffer(o.WrittenCountBuffer); if(buf) - { - counterName = buf->name; counterLength = buf->length; - } } length = qMin(length, o.Size); diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index a841edf75..85e491019 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -588,20 +588,21 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * { QString shaderName = ToQStr(stage.stage, GraphicsAPI::OpenGL) + lit(" Shader"); - if(!stage.customShaderName && !stage.customProgramName && !stage.customPipelineName) + if(m_Ctx.IsAutogeneratedName(stage.Object) && m_Ctx.IsAutogeneratedName(stage.Program) && + m_Ctx.IsAutogeneratedName(state.Pipeline)) { - shader->setText(shaderName + lit(" ") + ToQStr(stage.Object)); + shader->setText(shaderName + lit(" ") + m_Ctx.GetResourceName(stage.Object)); } else { - if(stage.customShaderName) - shaderName = stage.ShaderName; + if(!m_Ctx.IsAutogeneratedName(stage.Object)) + shaderName = m_Ctx.GetResourceName(stage.Object); - if(stage.customProgramName) - shaderName = stage.ProgramName + lit(" - ") + shaderName; + if(!m_Ctx.IsAutogeneratedName(stage.Program)) + shaderName = m_Ctx.GetResourceName(stage.Program) + lit(" - ") + shaderName; - if(stage.customPipelineName && stage.PipelineActive) - shaderName = stage.PipelineName + lit(" - ") + shaderName; + if(!m_Ctx.IsAutogeneratedName(state.Pipeline)) + shaderName = m_Ctx.GetResourceName(state.Pipeline) + lit(" - ") + shaderName; shader->setText(shaderName); } @@ -653,7 +654,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * uint32_t w = 1, h = 1, d = 1; uint32_t a = 1; QString format = lit("Unknown"); - QString name = tr("Shader Resource %1").arg(ToQStr(r.Resource)); + QString name = m_Ctx.GetResourceName(r.Resource); QString typeName = lit("Unknown"); if(!filledSlot) @@ -673,7 +674,6 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * d = tex->depth; a = tex->arraysize; format = tex->format.Name(); - name = tex->name; typeName = ToQStr(tex->resType); if(tex->format.type == ResourceFormatType::D16S8 || @@ -831,14 +831,13 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * if(b) { slotname = QFormatStr("%1: %2").arg(bindPoint).arg(shaderCBuf.name); - name = lit("UBO ") + ToQStr(b->Resource); + name = m_Ctx.GetResourceName(b->Resource); offset = b->Offset; length = b->Size; BufferDescription *buf = m_Ctx.GetBuffer(b->Resource); if(buf) { - name = buf->name; if(length == 0) length = buf->length; } @@ -930,7 +929,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * : readWriteType == GLReadWriteType::SSBO ? tr("SSBO") : tr("Unknown"); QString slotname = QFormatStr("%1: %2").arg(bindPoint).arg(res.name); - QString name; + QString name = m_Ctx.GetResourceName(id); QString dimensions; QString format = lit("-"); QString access = tr("Read/Write"); @@ -968,8 +967,6 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * dimensions = QFormatStr("%1x%2x%3").arg(tex->width).arg(tex->height).arg(tex->depth); } - name = tex->name; - tag = QVariant::fromValue(id); } @@ -990,8 +987,6 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * else dimensions = tr("%1 bytes").arg(length); - name = buf->name; - tag = QVariant::fromValue(GLReadWriteTag(i, id, offset, length)); } @@ -1199,7 +1194,7 @@ void GLPipelineStateViewer::setState() { if(ibufferUsed || showDisabled) { - QString name = tr("Buffer ") + ToQStr(state.m_VtxIn.ibuffer); + QString name = m_Ctx.GetResourceName(state.m_VtxIn.ibuffer); uint64_t length = 1; if(!ibufferUsed) @@ -1209,7 +1204,6 @@ void GLPipelineStateViewer::setState() if(buf) { - name = buf->name; length = buf->length; } @@ -1259,7 +1253,7 @@ void GLPipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QString name = tr("Buffer ") + ToQStr(v.Buffer); + QString name = m_Ctx.GetResourceName(v.Buffer); uint64_t length = 1; uint64_t offset = v.Offset; @@ -1271,10 +1265,7 @@ void GLPipelineStateViewer::setState() BufferDescription *buf = m_Ctx.GetBuffer(v.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } RDTreeWidgetItem *node = new RDTreeWidgetItem( {i, name, v.Stride, (qulonglong)offset, v.Divisor, (qulonglong)length, QString()}); @@ -1322,22 +1313,16 @@ void GLPipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QString name = tr("Buffer ") + ToQStr(state.m_Feedback.BufferBinding[i]); + QString name = m_Ctx.GetResourceName(state.m_Feedback.BufferBinding[i]); qulonglong length = state.m_Feedback.Size[i]; if(!filledSlot) - { name = tr("Empty"); - } BufferDescription *buf = m_Ctx.GetBuffer(state.m_Feedback.BufferBinding[i]); - if(buf) - { - name = buf->name; - if(length == 0) - length = buf->length; - } + if(buf && length == 0) + length = buf->length; RDTreeWidgetItem *node = new RDTreeWidgetItem( {i, name, length, (qulonglong)state.m_Feedback.Offset[i], QString()}); @@ -1633,7 +1618,7 @@ void GLPipelineStateViewer::setState() uint32_t w = 1, h = 1, d = 1; uint32_t a = 1; QString format = tr("Unknown"); - QString name = tr("Texture ") + ToQStr(p); + QString name = m_Ctx.GetResourceName(p); QString typeName = tr("Unknown"); if(p == ResourceId()) @@ -1652,13 +1637,9 @@ void GLPipelineStateViewer::setState() d = tex->depth; a = tex->arraysize; format = tex->format.Name(); - name = tex->name; typeName = ToQStr(tex->resType); - if(tex->format.srgbCorrected && !state.m_FB.FramebufferSRGB) - name += lit(" (GL_FRAMEBUFFER_SRGB = 0)"); - - if(!tex->customName && state.m_FS.ShaderDetails) + if(m_Ctx.IsAutogeneratedName(p) && state.m_FS.ShaderDetails) { for(int s = 0; s < state.m_FS.ShaderDetails->OutputSig.count(); s++) { @@ -1670,6 +1651,9 @@ void GLPipelineStateViewer::setState() } } } + + if(tex->format.srgbCorrected && !state.m_FB.FramebufferSRGB) + name += lit(" (GL_FRAMEBUFFER_SRGB = 0)"); } if(r && (r->Swizzle[0] != TextureSwizzle::Red || r->Swizzle[1] != TextureSwizzle::Green || @@ -1718,7 +1702,7 @@ void GLPipelineStateViewer::setState() uint32_t w = 1, h = 1, d = 1; uint32_t a = 1; QString format = tr("Unknown"); - QString name = tr("Texture ") + ToQStr(ds); + QString name = m_Ctx.GetResourceName(ds); QString typeName = tr("Unknown"); if(ds == ResourceId()) @@ -1737,7 +1721,6 @@ void GLPipelineStateViewer::setState() d = tex->depth; a = tex->arraysize; format = tex->format.Name(); - name = tex->name; typeName = ToQStr(tex->resType); } @@ -2301,7 +2284,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Vert int i = 0; for(const GLPipe::VB &vb : vtx.vbuffers) { - QString name = tr("Buffer %1").arg(ToQStr(vb.Buffer)); + QString name = m_Ctx.GetResourceName(vb.Buffer); uint64_t length = 0; if(vb.Buffer == ResourceId()) @@ -2312,10 +2295,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Vert { BufferDescription *buf = m_Ctx.GetBuffer(vb.Buffer); if(buf) - { - name = buf->name; length = buf->length; - } } rows.push_back({i, name, vb.Stride, vb.Offset, vb.Divisor, (qulonglong)length}); @@ -2333,7 +2313,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Vert xml.writeCharacters(tr("Index Buffer")); xml.writeEndElement(); - QString name = tr("Buffer %1").arg(ToQStr(vtx.ibuffer)); + QString name = m_Ctx.GetResourceName(vtx.ibuffer); uint64_t length = 0; if(vtx.ibuffer == ResourceId()) @@ -2344,10 +2324,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Vert { BufferDescription *buf = m_Ctx.GetBuffer(vtx.ibuffer); if(buf) - { - name = buf->name; length = buf->length; - } } QString ifmt = lit("UNKNOWN"); @@ -2436,7 +2413,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad if(sh.Object == ResourceId()) shadername = tr("Unbound"); else - shadername = sh.ShaderName; + shadername = m_Ctx.GetResourceName(sh.Object); if(sh.Object == ResourceId()) { @@ -2446,20 +2423,21 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad { QString shname = tr("%1 Shader").arg(ToQStr(sh.stage, GraphicsAPI::OpenGL)); - if(!sh.customShaderName && !sh.customProgramName && !sh.customPipelineName) + if(m_Ctx.IsAutogeneratedName(sh.Object) && m_Ctx.IsAutogeneratedName(sh.Program) && + m_Ctx.IsAutogeneratedName(pipe.Pipeline)) { shadername = QFormatStr("%1 %2").arg(shname).arg(ToQStr(sh.Object)); } else { - if(sh.customShaderName) - shname = sh.ShaderName; + if(!m_Ctx.IsAutogeneratedName(sh.Object)) + shname = m_Ctx.GetResourceName(sh.Object); - if(sh.customProgramName) - shname = QFormatStr("%1 - %2").arg(sh.ProgramName).arg(shname); + if(!m_Ctx.IsAutogeneratedName(sh.Program)) + shname = QFormatStr("%1 - %2").arg(m_Ctx.GetResourceName(sh.Program)).arg(shname); - if(sh.customPipelineName && sh.PipelineActive) - shname = QFormatStr("%1 - %2").arg(sh.PipelineName).arg(shname); + if(!m_Ctx.IsAutogeneratedName(pipe.Pipeline)) + shname = QFormatStr("%1 - %2").arg(m_Ctx.GetResourceName(pipe.Pipeline)).arg(shname); shadername = shname; } @@ -2514,7 +2492,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad uint32_t w = 1, h = 1, d = 1; uint32_t a = 1; QString format = tr("Unknown"); - QString name = tr("Shader Resource %1").arg(ToQStr(r.Resource)); + QString name = m_Ctx.GetResourceName(r.Resource); QString typeName = tr("Unknown"); if(!filledSlot) @@ -2533,7 +2511,6 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad d = tex->depth; a = tex->arraysize; format = tex->format.Name(); - name = tex->name; typeName = ToQStr(tex->resType); if(tex->format.type == ResourceFormatType::D16S8 || @@ -2651,7 +2628,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad uint64_t byteSize = shaderCBuf.byteSize; QString slotname = tr("Uniforms"); - QString name; + QString name = m_Ctx.GetResourceName(b->Resource); QString sizestr = tr("%1 Variables").arg(numvars); QString byterange; @@ -2664,17 +2641,12 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad if(b) { slotname = QFormatStr("%1: %2").arg(bindPoint).arg(shaderCBuf.name); - name = tr("UBO %1").arg(ToQStr(b->Resource)); offset = b->Offset; length = b->Size; BufferDescription *buf = m_Ctx.GetBuffer(b->Resource); - if(buf) - { - name = buf->name; - if(length == 0) - length = buf->length; - } + if(buf && length == 0) + length = buf->length; if(length == byteSize) sizestr = tr("%1 Variables, %2 bytes").arg(numvars).arg(length); @@ -2747,7 +2719,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad : readWriteType == GLReadWriteType::SSBO ? tr("SSBO") : tr("Unknown"); QString slotname = QFormatStr("%1: %2").arg(bindPoint).arg(res.name); - QString name; + QString name = m_Ctx.GetResourceName(id); QString dimensions; QString format = lit("-"); QString access = tr("Read/Write"); @@ -2783,8 +2755,6 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad { dimensions = QFormatStr("%1x%2x%3").arg(tex->width).arg(tex->height).arg(tex->depth); } - - name = tex->name; } // if not a texture, it must be a buffer @@ -2803,8 +2773,6 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shad dimensions = tr("%1 bytes at offset %2 bytes").arg(length).arg(offset); else dimensions = tr("%1 bytes").arg(length); - - name = buf->name; } if(!filledSlot) @@ -2893,7 +2861,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Feed for(size_t i = 0; i < ARRAY_COUNT(xfb.BufferBinding); i++) { - QString name = tr("Buffer %1").arg(ToQStr(xfb.BufferBinding[i])); + QString name = m_Ctx.GetResourceName(xfb.BufferBinding[i]); uint64_t length = 0; if(xfb.BufferBinding[i] == ResourceId()) @@ -2904,10 +2872,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Feed { BufferDescription *buf = m_Ctx.GetBuffer(xfb.BufferBinding[i]); if(buf) - { - name = buf->name; length = buf->length; - } } rows.push_back( @@ -3163,10 +3128,8 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Fram TextureDescription *tex = m_Ctx.GetTexture(a.Obj); - QString name = tr("Image %1").arg(ToQStr(a.Obj)); + QString name = m_Ctx.GetResourceName(a.Obj); - if(tex) - name = tex->name; if(a.Obj == ResourceId()) name = tr("Empty"); @@ -3223,10 +3186,8 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Fram TextureDescription *tex = m_Ctx.GetTexture(a.Obj); - QString name = tr("Image %1").arg(ToQStr(a.Obj)); + QString name = m_Ctx.GetResourceName(a.Obj); - if(tex) - name = tex->name; if(a.Obj == ResourceId()) name = tr("Empty"); diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index a23ae66de..8274bda20 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -654,7 +654,7 @@ QVariantList VulkanPipelineStateViewer::makeSampler(const QString &bindset, cons bindset, slotname, descriptor.immutableSampler ? tr("Immutable Sampler") : tr("Sampler"), - descriptor.name, + m_Ctx.GetResourceName(descriptor.res), addressing, filter + lit(", ") + lod}; } @@ -858,7 +858,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, uint32_t samples = 1; uint64_t len = 0; QString format = tr("Unknown"); - QString name = tr("Empty"); + QString name = m_Ctx.GetResourceName(descriptorBind->res); TextureDim restype = TextureDim::Unknown; QVariant tag; @@ -869,8 +869,6 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, if(filledSlot && descriptorBind != NULL) { - name = tr("Object %1").arg(ToQStr(descriptorBind->res)); - format = descriptorBind->viewfmt.Name(); // check to see if it's a texture @@ -881,7 +879,6 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, h = tex->height; d = tex->depth; a = tex->arraysize; - name = tex->name; restype = tex->resType; samples = tex->msSamp; @@ -897,7 +894,6 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, h = 0; d = 0; a = 0; - name = buf->name; restype = TextureDim::Buffer; if(descriptorLen == UINT64_MAX) @@ -1190,7 +1186,7 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta slotname = QFormatStr("%1[%2]").arg(bind).arg(idx); } - QString name = tr("Empty"); + QString name = m_Ctx.GetResourceName(descriptorBind->res); uint64_t length = 0; int numvars = cblock != NULL ? cblock->variables.count() : 0; uint64_t byteSize = cblock != NULL ? cblock->byteSize : 0; @@ -1199,19 +1195,11 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta if(filledSlot && descriptorBind != NULL) { - name = QString(); length = descriptorBind->size; BufferDescription *buf = m_Ctx.GetBuffer(descriptorBind->res); - if(buf) - { - name = buf->name; - if(length == UINT64_MAX) - length = buf->length - descriptorBind->offset; - } - - if(name == QString()) - name = lit("UBO ") + ToQStr(descriptorBind->res); + if(buf && length == UINT64_MAX) + length = buf->length - descriptorBind->offset; vecrange = QFormatStr("%1 - %2").arg(descriptorBind->offset).arg(descriptorBind->offset + length); @@ -1268,7 +1256,7 @@ void VulkanPipelineStateViewer::setShaderState(const VKPipe::Shader &stage, if(stage.Object == ResourceId()) shader->setText(tr("Unbound Shader")); else - shader->setText(stage.name); + shader->setText(m_Ctx.GetResourceName(stage.Object)); if(shaderDetails != NULL) { @@ -1544,7 +1532,7 @@ void VulkanPipelineStateViewer::setState() { if(ibufferUsed || showDisabled) { - QString name = tr("Buffer ") + ToQStr(state.IA.ibuffer.buf); + QString name = m_Ctx.GetResourceName(state.IA.ibuffer.buf); uint64_t length = 1; if(!ibufferUsed) @@ -1553,10 +1541,7 @@ void VulkanPipelineStateViewer::setState() BufferDescription *buf = m_Ctx.GetBuffer(state.IA.ibuffer.buf); if(buf) - { - name = buf->name; length = buf->length; - } RDTreeWidgetItem *node = new RDTreeWidgetItem( {tr("Index"), name, tr("Index"), (qulonglong)state.IA.ibuffer.offs, @@ -1621,15 +1606,12 @@ void VulkanPipelineStateViewer::setState() if(vbuff != NULL) { - name = tr("Buffer ") + ToQStr(vbuff->buffer); + name = m_Ctx.GetResourceName(vbuff->buffer); offset = vbuff->offset; BufferDescription *buf = m_Ctx.GetBuffer(vbuff->buffer); if(buf) - { - name = buf->name; length = buf->length; - } } if(bind != NULL) @@ -1802,7 +1784,7 @@ void VulkanPipelineStateViewer::setState() uint32_t w = 1, h = 1, d = 1; uint32_t a = 1; QString format = p.viewfmt.Name(); - QString name = tr("Texture ") + ToQStr(p.img); + QString name = m_Ctx.GetResourceName(p.img); QString typeName = tr("Unknown"); if(p.img == ResourceId()) @@ -1820,10 +1802,9 @@ void VulkanPipelineStateViewer::setState() h = tex->height; d = tex->depth; a = tex->arraysize; - name = tex->name; typeName = ToQStr(tex->resType); - if(!tex->customName && state.m_FS.ShaderDetails != NULL) + if(m_Ctx.IsAutogeneratedName(p.img) && state.m_FS.ShaderDetails != NULL) { for(int s = 0; s < state.m_FS.ShaderDetails->OutputSig.count(); s++) { @@ -2506,7 +2487,7 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: int i = 0; for(const VKPipe::VB &vb : vi.vbuffers) { - QString name = tr("Buffer %1").arg(ToQStr(vb.buffer)); + QString name = m_Ctx.GetResourceName(vb.buffer); uint64_t length = 0; if(vb.buffer == ResourceId()) @@ -2517,10 +2498,7 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: { BufferDescription *buf = m_Ctx.GetBuffer(vb.buffer); if(buf) - { - name = buf->name; length = buf->length; - } } rows.push_back({i, name, (qulonglong)vb.offset, (qulonglong)length}); @@ -2547,7 +2525,7 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: if(ib) { - name = ib->name; + name = m_Ctx.GetResourceName(ia.ibuffer.buf); length = ib->length; } @@ -2585,7 +2563,7 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: if(sh.Object == ResourceId()) shadername = tr("Unbound"); else - shadername = sh.name; + shadername = m_Ctx.GetResourceName(sh.Object); if(shaderDetails) { @@ -2655,7 +2633,7 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: if(bindMap.arraySize > 1) slotname = QFormatStr("%1: %2[%3]").arg(bindMap.bind).arg(b.name).arg(a); - QString name; + QString name = m_Ctx.GetResourceName(descriptorBind.res); uint64_t byteOffset = descriptorBind.offset; uint64_t length = descriptorBind.size; int numvars = b.variables.count(); @@ -2669,15 +2647,10 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: BufferDescription *buf = m_Ctx.GetBuffer(id); if(buf) { - name = buf->name; - if(length == UINT64_MAX) length = buf->length - byteOffset; } - if(name.isEmpty()) - name = tr("UBO %1").arg(ToQStr(descriptorBind.res)); - rows.push_back({setname, slotname, name, (qulonglong)byteOffset, (qulonglong)length, numvars, b.byteSize}); } @@ -2722,21 +2695,13 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: if(bindMap.arraySize > 1) slotname = QFormatStr("%1: %2[%3]").arg(bindMap.bind).arg(b.name).arg(a); - QString name; + QString name = m_Ctx.GetResourceName(id); if(descriptorBind.res == ResourceId()) name = tr("Empty"); BufferDescription *buf = m_Ctx.GetBuffer(id); - if(buf) - name = buf->name; - TextureDescription *tex = m_Ctx.GetTexture(id); - if(tex) - name = tex->name; - - if(name.isEmpty()) - name = tr("Resource %1").arg(ToQStr(descriptorBind.res)); uint64_t w = 1; uint32_t h = 1, d = 1; @@ -2751,7 +2716,6 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: d = tex->depth; arr = tex->arraysize; format = tex->format.Name(); - name = tex->name; if(tex->mips > 1) { @@ -2777,7 +2741,6 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: d = 0; a = 0; format = lit("-"); - name = buf->name; uint64_t length = descriptorBind.size; @@ -2794,8 +2757,6 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: if(bind.type == BindType::ImageSampler || bind.type == BindType::Sampler) { - name = tr("Sampler %1").arg(ToQStr(descriptorBind.sampler)); - if(bind.type == BindType::ImageSampler) setname = slotname = QString(); @@ -2846,21 +2807,15 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: if(bindMap.arraySize > 1) slotname = QFormatStr("%1: %2[%3]").arg(bindMap.bind).arg(b.name).arg(a); - QString name; + QString name = m_Ctx.GetResourceName(descriptorBind.res); + ; if(descriptorBind.res == ResourceId()) name = tr("Empty"); BufferDescription *buf = m_Ctx.GetBuffer(id); - if(buf) - name = buf->name; TextureDescription *tex = m_Ctx.GetTexture(id); - if(tex) - name = tex->name; - - if(name.isEmpty()) - name = tr("Resource %1").arg(ToQStr(descriptorBind.res)); uint64_t w = 1; uint32_t h = 1, d = 1; @@ -2875,7 +2830,6 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: d = tex->depth; arr = tex->arraysize; format = tex->format.Name(); - name = tex->name; if(tex->mips > 1) { @@ -2901,7 +2855,6 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: d = 0; a = 0; format = lit("-"); - name = buf->name; uint64_t length = descriptorBind.size; @@ -3135,10 +3088,7 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: { TextureDescription *tex = m_Ctx.GetTexture(a.img); - QString name = tr("Image %1").arg(ToQStr(a.img)); - - if(tex) - name = tex->name; + QString name = m_Ctx.GetResourceName(a.img); rows.push_back({i, name, a.baseMip, a.numMip, a.baseLayer, a.numLayer}); diff --git a/qrenderdoc/Windows/PixelHistoryView.cpp b/qrenderdoc/Windows/PixelHistoryView.cpp index aa31c4fbb..287445722 100644 --- a/qrenderdoc/Windows/PixelHistoryView.cpp +++ b/qrenderdoc/Windows/PixelHistoryView.cpp @@ -565,7 +565,8 @@ PixelHistoryView::PixelHistoryView(ICaptureContext &ctx, ResourceId id, QPoint p TextureDescription *tex = m_Ctx.GetTexture(id); - QString title = tr("Pixel History on %1 for (%2, %3)").arg(tex->name).arg(point.x()).arg(point.y()); + QString title = + tr("Pixel History on %1 for (%2, %3)").arg(m_Ctx.GetResourceName(id)).arg(point.x()).arg(point.y()); if(tex->msSamp > 1) title += tr(" @ Sample %1").arg(display.sampleIdx); setWindowTitle(title); diff --git a/qrenderdoc/Windows/PythonShell.cpp b/qrenderdoc/Windows/PythonShell.cpp index f52792c36..d31a463e6 100644 --- a/qrenderdoc/Windows/PythonShell.cpp +++ b/qrenderdoc/Windows/PythonShell.cpp @@ -82,6 +82,12 @@ struct CaptureContextInvoker : ICaptureContext { return m_Ctx.GetResources(); } + virtual QString GetResourceName(ResourceId id) override { return m_Ctx.GetResourceName(id); } + virtual bool IsAutogeneratedName(ResourceId id) override { return m_Ctx.IsAutogeneratedName(id); } + virtual bool HasResourceCustomName(ResourceId id) override + { + return m_Ctx.HasResourceCustomName(id); + } virtual TextureDescription *GetTexture(ResourceId id) override { return m_Ctx.GetTexture(id); } virtual const rdcarray &GetTextures() override { return m_Ctx.GetTextures(); } virtual BufferDescription *GetBuffer(ResourceId id) override { return m_Ctx.GetBuffer(id); } @@ -170,6 +176,10 @@ struct CaptureContextInvoker : ICaptureContext { InvokeVoidFunction(&ICaptureContext::AddMessages, msgs); } + virtual void SetResourceCustomName(ResourceId id, const QString &name) override + { + InvokeVoidFunction(&ICaptureContext::SetResourceCustomName, id, name); + } virtual IMainWindow *GetMainWindow() override { return InvokeRetFunction(&ICaptureContext::GetMainWindow); diff --git a/qrenderdoc/Windows/ResourceInspector.cpp b/qrenderdoc/Windows/ResourceInspector.cpp index 99b8cbeac..f2e183793 100644 --- a/qrenderdoc/Windows/ResourceInspector.cpp +++ b/qrenderdoc/Windows/ResourceInspector.cpp @@ -79,13 +79,13 @@ public: const ResourceDescription &desc = resources[index.row()]; if(role == Qt::DisplayRole) - return desc.name; + return m_Ctx.GetResourceName(desc.ID); if(role == ResourceIdRole) return QVariant::fromValue(desc.ID); if(role == FilterRole) - return ToQStr(desc.type) + lit(" ") + desc.name; + return ToQStr(desc.type) + lit(" ") + m_Ctx.GetResourceName(desc.ID); } } @@ -168,6 +168,11 @@ void ResourceInspector::Inspect(ResourceId id) m_ResourceModel->reset(); m_FilterModel->sort(0); + if(m_Ctx.HasResourceCustomName(id)) + ui->resetName->show(); + else + ui->resetName->hide(); + ui->initChunks->setUpdatesEnabled(false); ui->initChunks->clear(); ui->relatedResources->clear(); @@ -200,13 +205,11 @@ void ResourceInspector::Inspect(ResourceId id) if(desc) { - // TODO fetch global name - ui->resourceName->setText(desc->name); + ui->resourceName->setText(m_Ctx.GetResourceName(id)); for(ResourceId parent : desc->parentResources) { - // TODO fetch global name - RDTreeWidgetItem *item = new RDTreeWidgetItem({tr("Parent"), ToQStr(parent)}); + RDTreeWidgetItem *item = new RDTreeWidgetItem({tr("Parent"), m_Ctx.GetResourceName(parent)}); item->setData(0, ResourceIdRole, QVariant::fromValue(parent)); item->setData(1, ResourceIdRole, QVariant::fromValue(parent)); ui->relatedResources->addTopLevelItem(item); @@ -214,8 +217,7 @@ void ResourceInspector::Inspect(ResourceId id) for(ResourceId derived : desc->derivedResources) { - // TODO fetch global name - RDTreeWidgetItem *item = new RDTreeWidgetItem({tr("Derived"), ToQStr(derived)}); + RDTreeWidgetItem *item = new RDTreeWidgetItem({tr("Derived"), m_Ctx.GetResourceName(derived)}); item->setData(0, ResourceIdRole, QVariant::fromValue(derived)); item->setData(1, ResourceIdRole, QVariant::fromValue(derived)); ui->relatedResources->addTopLevelItem(item); @@ -231,7 +233,7 @@ void ResourceInspector::Inspect(ResourceId id) root->setText(0, chunkObj->name); - addStructuredObjects(root, chunkObj->data.children, false); + addStructuredObjects(m_Ctx, root, chunkObj->data.children, false); } else { @@ -296,8 +298,7 @@ void ResourceInspector::on_renameResource_clicked() ui->resetName->show(); - // TODO - set custom name globally - // m_Ctx.SetResourceCustomName(m_Resource, ui->resourceName->text()); + m_Ctx.SetResourceCustomName(m_Resource, ui->resourceName->text()); } } @@ -318,14 +319,11 @@ void ResourceInspector::on_resourceNameEdit_keyPress(QKeyEvent *event) void ResourceInspector::on_resetName_clicked() { - const ResourceDescription *desc = m_Ctx.GetResource(m_Resource); - // TODO fetch global name - ui->resourceName->setText(desc->name); + ui->resourceName->setText(m_Ctx.GetResourceName(m_Resource)); ui->resetName->hide(); - // TODO - unset custom name globally - // m_Ctx.RemoveCustomName(m_Resource); + m_Ctx.SetResourceCustomName(m_Resource, QString()); } void ResourceInspector::on_cancelResourceListFilter_clicked() diff --git a/qrenderdoc/Windows/ShaderViewer.cpp b/qrenderdoc/Windows/ShaderViewer.cpp index 478e0724c..18a8fa896 100644 --- a/qrenderdoc/Windows/ShaderViewer.cpp +++ b/qrenderdoc/Windows/ShaderViewer.cpp @@ -1058,19 +1058,19 @@ RDTreeWidgetItem *ShaderViewer::makeResourceRegister(const BindpointMap &bind, u .arg(tex->depth > 1 ? tex->depth : tex->arraysize) .arg(tex->mips) .arg(tex->format.Name()) - .arg(tex->name); + .arg(m_Ctx.GetResourceName(bound.Id)); return new RDTreeWidgetItem({regname + name, lit("Texture"), type}); } else if(buf) { - QString type = QFormatStr("%1 - %2").arg(buf->length).arg(buf->name); + QString type = QFormatStr("%1 - %2").arg(buf->length).arg(m_Ctx.GetResourceName(bound.Id)); return new RDTreeWidgetItem({regname + name, lit("Buffer"), type}); } else { - return new RDTreeWidgetItem({regname + name, lit("Resource"), lit("unknown")}); + return new RDTreeWidgetItem({regname + name, lit("Resource"), m_Ctx.GetResourceName(bound.Id)}); } } diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index fecae4a8d..8fb216473 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -331,14 +331,15 @@ public: String }; - TextureListItemModel(QWidget *parent) : QAbstractItemModel(parent) + TextureListItemModel(ICaptureContext &ctx, QWidget *parent) + : QAbstractItemModel(parent), m_Ctx(ctx) { goArrow.addPixmap(Pixmaps::action(parent), QIcon::Normal, QIcon::Off); goArrow.addPixmap(Pixmaps::action_hover(parent), QIcon::Normal, QIcon::Off); } - void reset(FilterType type, const QString &filter, ICaptureContext &ctx) + void reset(FilterType type, const QString &filter) { - const rdcarray src = ctx.GetTextures(); + const rdcarray src = m_Ctx.GetTextures(); texs.clear(); texs.reserve(src.count()); @@ -363,7 +364,7 @@ public: { if(filter.isEmpty()) texs.push_back(t); - else if(QString(t.name).contains(filter, Qt::CaseInsensitive)) + else if(m_Ctx.GetResourceName(t.ID).contains(filter, Qt::CaseInsensitive)) texs.push_back(t); } } @@ -397,7 +398,7 @@ public: if(role == Qt::DisplayRole) { if(index.row() >= 0 && index.row() < texs.count()) - return texs[index.row()].name; + return m_Ctx.GetResourceName(texs[index.row()].ID); } if(role == Qt::UserRole) @@ -415,6 +416,7 @@ public: } private: + ICaptureContext &m_Ctx; QVector texs; QIcon goArrow; }; @@ -638,7 +640,7 @@ TextureViewer::TextureViewer(ICaptureContext &ctx, QWidget *parent) ui->textureListFilter->addItems({QString(), tr("Textures"), tr("Render Targets")}); - ui->textureList->setModel(new TextureListItemModel(this)); + ui->textureList->setModel(new TextureListItemModel(m_Ctx, this)); ui->textureList->setItemDelegate(new TextureListItemDelegate(ui->textureList)); ui->textureList->viewport()->setAttribute(Qt::WA_Hover); @@ -974,12 +976,7 @@ void TextureViewer::UI_UpdateTextureDetails() } else if(followtex || followbuf) { - QString name; - - if(followtex) - name = followtex->name; - else - name = followbuf->name; + QString name = m_Ctx.GetResourceName(followID); switch(m_Following.Type) { @@ -1015,7 +1012,7 @@ void TextureViewer::UI_UpdateTextureDetails() ui->renderContainer->setWindowTitle(title); } - status = current.name + lit(" - "); + status = m_Ctx.GetResourceName(followID) + lit(" - "); if(current.dimension >= 1) status += QString::number(current.width); @@ -1710,7 +1707,7 @@ void TextureViewer::ViewTexture(ResourceId ID, bool focus) if(tex) { QWidget *lockedContainer = new QWidget(this); - lockedContainer->setWindowTitle(tex->name); + lockedContainer->setWindowTitle(m_Ctx.GetResourceName(ID)); lockedContainer->setProperty("id", QVariant::fromValue(ID)); ToolWindowManagerArea *textureTabs = ui->dockarea->areaOf(ui->renderContainer); @@ -1864,51 +1861,29 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, Co { if(id != ResourceId() || force) { - TextureDescription *texptr = m_Ctx.GetTexture(id); - BufferDescription *bufptr = m_Ctx.GetBuffer(id); - - if(texptr != NULL) + QString fullname = bindName; + if(!m_Ctx.IsAutogeneratedName(id)) { - QString fullname = bindName; - if(texptr->customName) - { - if(!fullname.isEmpty()) - fullname += lit(" = "); - fullname += texptr->name; - } - if(fullname.isEmpty()) - fullname = texptr->name; + if(!fullname.isEmpty()) + fullname += lit(" = "); + fullname += m_Ctx.GetResourceName(id); + } + if(fullname.isEmpty()) + fullname = m_Ctx.GetResourceName(id); - prev->setResourceName(fullname); - WId handle = prev->thumbWinId(); + prev->setResourceName(fullname); + + WId handle = prev->thumbWinId(); + + if(m_Ctx.GetTexture(id)) + { m_Ctx.Replay().AsyncInvoke([this, handle, id, typeHint](IReplayController *) { m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle), id, typeHint); }); } - else if(bufptr != NULL) - { - QString fullname = bindName; - if(bufptr->customName) - { - if(!fullname.isEmpty()) - fullname += lit(" = "); - fullname += bufptr->name; - } - if(fullname.isEmpty()) - fullname = bufptr->name; - - prev->setResourceName(fullname); - WId handle = prev->thumbWinId(); - m_Ctx.Replay().AsyncInvoke([this, handle](IReplayController *) { - m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle), - ResourceId(), CompType::Typeless); - }); - } else { - prev->setResourceName(QString()); - WId handle = prev->thumbWinId(); m_Ctx.Replay().AsyncInvoke([this, handle](IReplayController *) { m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle), ResourceId(), CompType::Typeless); @@ -2465,7 +2440,7 @@ void TextureViewer::OnLogfileLoaded() TextureListItemModel *model = (TextureListItemModel *)ui->textureList->model(); - model->reset(TextureListItemModel::String, QString(), m_Ctx); + model->reset(TextureListItemModel::String, QString()); m_TexDisplay.backgroundColor = backCol.isValid() ? FloatVector(backCol.redF(), backCol.greenF(), backCol.blueF(), 1.0f) @@ -3471,7 +3446,7 @@ void TextureViewer::on_textureListFilter_editTextChanged(const QString &text) if(model == NULL) return; - model->reset(TextureListItemModel::String, text, m_Ctx); + model->reset(TextureListItemModel::String, text); } void TextureViewer::on_textureListFilter_currentIndexChanged(int index) @@ -3482,11 +3457,11 @@ void TextureViewer::on_textureListFilter_currentIndexChanged(int index) return; if(ui->textureListFilter->currentIndex() == 1) - model->reset(TextureListItemModel::Textures, QString(), m_Ctx); + model->reset(TextureListItemModel::Textures, QString()); else if(ui->textureListFilter->currentIndex() == 2) - model->reset(TextureListItemModel::RenderTargets, QString(), m_Ctx); + model->reset(TextureListItemModel::RenderTargets, QString()); else - model->reset(TextureListItemModel::String, ui->textureListFilter->currentText(), m_Ctx); + model->reset(TextureListItemModel::String, ui->textureListFilter->currentText()); } void TextureViewer::on_textureList_clicked(const QModelIndex &index) diff --git a/qrenderdoc/Windows/TimelineBar.cpp b/qrenderdoc/Windows/TimelineBar.cpp index 6f01e0846..591d354c3 100644 --- a/qrenderdoc/Windows/TimelineBar.cpp +++ b/qrenderdoc/Windows/TimelineBar.cpp @@ -74,16 +74,7 @@ TimelineBar::~TimelineBar() void TimelineBar::HighlightResourceUsage(ResourceId id) { m_UsageEvents.clear(); - - TextureDescription *tex = m_Ctx.GetTexture(id); - - if(tex) - m_UsageTarget = tex->name; - - BufferDescription *buf = m_Ctx.GetBuffer(id); - - if(buf) - m_UsageTarget = buf->name; + m_UsageTarget = m_Ctx.GetResourceName(id); m_Ctx.Replay().AsyncInvoke([this, id](IReplayController *r) { rdcarray usage = r->GetUsage(id); @@ -105,15 +96,7 @@ void TimelineBar::HighlightHistory(ResourceId id, const QList if(id != ResourceId()) { - TextureDescription *tex = m_Ctx.GetTexture(id); - - if(tex) - m_HistoryTarget = tex->name; - - BufferDescription *buf = m_Ctx.GetBuffer(id); - - if(buf) - m_HistoryTarget = buf->name; + m_HistoryTarget = m_Ctx.GetResourceName(id); for(const PixelModification &mod : history) m_HistoryEvents << mod; diff --git a/renderdoc/api/replay/d3d11_pipestate.h b/renderdoc/api/replay/d3d11_pipestate.h index 1d2ef4781..3cd8ba92b 100644 --- a/renderdoc/api/replay/d3d11_pipestate.h +++ b/renderdoc/api/replay/d3d11_pipestate.h @@ -107,14 +107,6 @@ struct IA DOCUMENT("A :class:`ShaderReflection` describing the bytecode used to create the input layout."); ShaderReflection *Bytecode = NULL; - DOCUMENT(R"(``True`` if :data:`name` was assigned by the application, otherwise it's autogenerated -based on the ID. -)"); - bool customName = false; - - DOCUMENT("The name of the input layout object."); - rdcstr name; - DOCUMENT("A list of :class:`D3D11_VB` with the vertex buffers that are bound."); rdcarray vbuffers; @@ -172,12 +164,6 @@ struct Sampler { DOCUMENT("The :class:`ResourceId` of the sampler state object."); ResourceId Samp; - DOCUMENT("The name of the sampler state object."); - rdcstr name; - DOCUMENT(R"(``True`` if :data:`name` was assigned by the application, otherwise it's autogenerated -based on the ID. -)"); - bool customName = false; DOCUMENT("The :class:`AddressMode` in the U direction."); AddressMode AddressU = AddressMode::Wrap; DOCUMENT("The :class:`AddressMode` in the V direction."); @@ -236,14 +222,6 @@ struct Shader DOCUMENT("The :class:`ResourceId` of the shader object itself."); ResourceId Object; - DOCUMENT("The name of the shader object."); - rdcstr name; - - DOCUMENT(R"(``True`` if :data:`name` was assigned by the application, otherwise it's autogenerated -based on the ID. -)"); - bool customName = false; - DOCUMENT("A :class:`ShaderReflection` describing the reflection data for this shader."); ShaderReflection *ShaderDetails = NULL; DOCUMENT(R"(A :class:`ShaderBindpointMapping` to match :data:`ShaderDetails` with the bindpoint diff --git a/renderdoc/api/replay/d3d12_pipestate.h b/renderdoc/api/replay/d3d12_pipestate.h index 4d156dbcb..bb3630a85 100644 --- a/renderdoc/api/replay/d3d12_pipestate.h +++ b/renderdoc/api/replay/d3d12_pipestate.h @@ -520,14 +520,6 @@ struct State DOCUMENT("The :class:`ResourceId` of the pipeline state object."); ResourceId pipeline; - DOCUMENT(R"(``True`` if :data:`name` was assigned by the application, otherwise it's autogenerated -based on the ID. -)"); - bool customName = false; - - DOCUMENT("The name of the pipeline state object."); - rdcstr name; - DOCUMENT("The :class:`ResourceId` of the root signature object."); ResourceId rootSig; diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index a4ece8b5f..a9eb60a23 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -204,14 +204,6 @@ struct BufferDescription DOCUMENT("The unique :class:`ResourceId` that identifies this buffer."); ResourceId ID; - DOCUMENT("The name given to this buffer."); - rdcstr name; - - DOCUMENT(R"(``True`` if the name was assigned by the application, otherwise it's autogenerated -based on the ID. -)"); - bool customName; - DOCUMENT("The way this buffer will be used in the pipeline."); BufferCategory creationFlags; @@ -224,14 +216,6 @@ DECLARE_REFLECTION_STRUCT(BufferDescription); DOCUMENT("A description of a texture resource."); struct TextureDescription { - DOCUMENT("The name given to this buffer."); - rdcstr name; - - DOCUMENT(R"(``True`` if the name was assigned by the application, otherwise it's autogenerated -based on the ID. -)"); - bool customName; - DOCUMENT("The :class:`ResourceFormat` that describes the format of each pixel in the texture."); ResourceFormat format; diff --git a/renderdoc/api/replay/gl_pipestate.h b/renderdoc/api/replay/gl_pipestate.h index d2685f2ab..46fa1381b 100644 --- a/renderdoc/api/replay/gl_pipestate.h +++ b/renderdoc/api/replay/gl_pipestate.h @@ -101,28 +101,8 @@ struct Shader DOCUMENT("The :class:`ResourceId` of the shader object itself."); ResourceId Object; - DOCUMENT("The name of the shader object."); - rdcstr ShaderName; - DOCUMENT(R"(``True`` if :data:`ShaderName` was assigned by the application, otherwise it's -autogenerated based on the ID. -)"); - bool customShaderName = false; - - DOCUMENT("The name of the program object."); - rdcstr ProgramName; - DOCUMENT(R"(``True`` if :data:`ProgramName` was assigned by the application, otherwise it's -autogenerated based on the ID. -)"); - bool customProgramName = false; - - DOCUMENT("``True`` if a program pipeline object is in use."); - bool PipelineActive = false; - DOCUMENT("The name of the pipeline object."); - rdcstr PipelineName; - DOCUMENT(R"(``True`` if :data:`PipelineName` was assigned by the application, otherwise it's -autogenerated based on the ID. -)"); - bool customPipelineName = false; + DOCUMENT("The :class:`ResourceId` of the program bound to this stage."); + ResourceId Program; DOCUMENT("A :class:`ShaderReflection` describing the reflection data for this shader."); ShaderReflection *ShaderDetails = NULL; @@ -557,6 +537,9 @@ struct State DOCUMENT("A :class:`GL_Shader` describing the compute shader stage."); Shader m_CS; + DOCUMENT("The :class:`ResourceId` of the program pipeline (if active)."); + ResourceId Pipeline; + DOCUMENT( "A :class:`GL_FixedVertexProcessing` describing the fixed-function vertex processing stage."); FixedVertexProcessing m_VtxProcess; diff --git a/renderdoc/api/replay/vk_pipestate.h b/renderdoc/api/replay/vk_pipestate.h index 1566a0fb2..6c04b8469 100644 --- a/renderdoc/api/replay/vk_pipestate.h +++ b/renderdoc/api/replay/vk_pipestate.h @@ -38,14 +38,6 @@ struct BindingElement DOCUMENT("``True`` if this is an immutable sampler binding."); bool immutableSampler = false; - DOCUMENT("The name of the current sampler object, if one is bound. Empty for other bindings."); - rdcstr name; - - DOCUMENT(R"(``True`` if :data:`name` was assigned by the application, otherwise it's autogenerated -based on the ID. -)"); - bool customName = false; - DOCUMENT("The :class:`ResourceFormat` that the view uses."); ResourceFormat viewfmt; DOCUMENT("Four :class:`TextureSwizzle` elements indicating the swizzle applied to this texture."); @@ -227,13 +219,6 @@ struct Shader DOCUMENT("The name of the entry point in the shader module that is used."); rdcstr entryPoint; - DOCUMENT("The name of the shader module."); - rdcstr name; - DOCUMENT(R"(``True`` if :data:`name` was assigned by the application, otherwise it's autogenerated -based on the ID. -)"); - bool customName = false; - DOCUMENT("A :class:`ShaderReflection` describing the reflection data for this shader."); ShaderReflection *ShaderDetails = NULL; DOCUMENT(R"(A :class:`ShaderBindpointMapping` to match :data:`ShaderDetails` with the bindpoint diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index f4cc6abee..608101a4c 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -442,8 +442,6 @@ void ImageViewer::RefreshFile() texDetails.creationFlags = TextureCategory::SwapBuffer | TextureCategory::ColorTarget; texDetails.cubemap = false; - texDetails.customName = true; - texDetails.name = m_Filename; texDetails.ID = m_TextureID; texDetails.byteSize = 0; texDetails.msQual = 0; diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index 0a5f62f61..778697b95 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -98,27 +98,6 @@ TextureDescription D3D11Replay::GetTexture(ResourceId id) tex.msQual = 0; tex.msSamp = 1; - tex.customName = true; - - if(str == "") - { - const char *suffix = ""; - - if(tex.creationFlags & TextureCategory::ColorTarget) - suffix = " RTV"; - if(tex.creationFlags & TextureCategory::DepthTarget) - suffix = " DSV"; - - tex.customName = false; - - if(tex.arraysize > 1) - str = StringFormat::Fmt("Texture1DArray%s %llu", suffix, tex.ID); - else - str = StringFormat::Fmt("Texture1D%s %llu", suffix, tex.ID); - } - - tex.name = str; - tex.byteSize = 0; for(uint32_t s = 0; s < tex.mips * tex.arraysize; s++) tex.byteSize += GetByteSize(d3dtex, s); @@ -178,41 +157,6 @@ TextureDescription D3D11Replay::GetTexture(ResourceId id) if(tex.msSamp > 1) tex.resType = tex.arraysize > 1 ? TextureDim::Texture2DMSArray : TextureDim::Texture2DMS; - tex.customName = true; - - if(str == "") - { - const char *suffix = ""; - const char *ms = ""; - - if(tex.msSamp > 1) - ms = "MS"; - - if(tex.creationFlags & TextureCategory::ColorTarget) - suffix = " RTV"; - if(tex.creationFlags & TextureCategory::DepthTarget) - suffix = " DSV"; - - tex.customName = false; - - if(tex.cubemap) - { - if(tex.arraysize > 6) - str = StringFormat::Fmt("TextureCube%sArray%s %llu", ms, suffix, tex.ID); - else - str = StringFormat::Fmt("TextureCube%s%s %llu", ms, suffix, tex.ID); - } - else - { - if(tex.arraysize > 1) - str = StringFormat::Fmt("Texture2D%sArray%s %llu", ms, suffix, tex.ID); - else - str = StringFormat::Fmt("Texture2D%s%s %llu", ms, suffix, tex.ID); - } - } - - tex.name = str; - tex.byteSize = 0; for(uint32_t s = 0; s < tex.arraysize * tex.mips; s++) tex.byteSize += GetByteSize(d3dtex, s); @@ -260,24 +204,6 @@ TextureDescription D3D11Replay::GetTexture(ResourceId id) tex.arraysize = 1; - tex.customName = true; - - if(str == "") - { - const char *suffix = ""; - - if(tex.creationFlags & TextureCategory::ColorTarget) - suffix = " RTV"; - if(tex.creationFlags & TextureCategory::DepthTarget) - suffix = " DSV"; - - tex.customName = false; - - str = StringFormat::Fmt("Texture3D%s %llu", suffix, tex.ID); - } - - tex.name = str; - tex.byteSize = 0; for(uint32_t s = 0; s < tex.arraysize * tex.mips; s++) tex.byteSize += GetByteSize(d3dtex, s); @@ -287,8 +213,6 @@ TextureDescription D3D11Replay::GetTexture(ResourceId id) RDCERR("Unrecognised/unknown texture %llu", id); - tex.name = "Unrecognised/unknown texture"; - tex.customName = true; tex.byteSize = 0; tex.dimension = 2; tex.resType = TextureDim::Texture2D; @@ -444,18 +368,10 @@ BufferDescription D3D11Replay::GetBuffer(ResourceId id) string str = GetDebugName(d3dbuf); ret.ID = m_pDevice->GetResourceManager()->GetOriginalID(it->first); - ret.customName = true; - - if(str == "") - { - ret.customName = false; - str = StringFormat::Fmt("Buffer %llu", ret.ID); - } D3D11_BUFFER_DESC desc; it->second.m_Buffer->GetDesc(&desc); - ret.name = str; ret.length = desc.ByteWidth; ret.creationFlags = BufferCategory::NoFlags; @@ -535,17 +451,6 @@ void D3D11Replay::SavePipelineState() ret.m_IA.layout = rm->GetOriginalID(layoutId); ret.m_IA.Bytecode = GetShader(layoutId, ""); - string str = GetDebugName(rs->IA.Layout); - ret.m_IA.customName = true; - - if(str == "" && ret.m_IA.layout != ResourceId()) - { - ret.m_IA.customName = false; - str = StringFormat::Fmt("Input Layout %llu", ret.m_IA.layout); - } - - ret.m_IA.name = str; - ret.m_IA.layouts.resize(vec.size()); for(size_t i = 0; i < vec.size(); i++) { @@ -608,17 +513,6 @@ void D3D11Replay::SavePipelineState() dst.Object = rm->GetOriginalID(id); dst.ShaderDetails = refl; - string str = GetDebugName(src.Object); - dst.customName = true; - - if(str == "" && dst.Object != ResourceId()) - { - dst.customName = false; - str = StringFormat::Fmt("%s Shader %llu", stageNames[stage], dst.Object); - } - - dst.name = str; - dst.ConstantBuffers.resize(D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT); for(size_t s = 0; s < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; s++) { @@ -636,15 +530,6 @@ void D3D11Replay::SavePipelineState() if(samp.Samp != ResourceId()) { - samp.name = GetDebugName(src.Samplers[s]); - samp.customName = true; - - if(samp.name.empty()) - { - samp.customName = false; - samp.name = StringFormat::Fmt("Sampler %llu", samp.Samp); - } - D3D11_SAMPLER_DESC desc; src.Samplers[s]->GetDesc(&desc); @@ -1731,9 +1616,6 @@ ResourceId D3D11Replay::CreateProxyTexture(const TextureDescription &templateTex RDCERR("Invalid texture dimension: %d", templateTex.dimension); } - if(resource != NULL && templateTex.customName) - SetDebugName(resource, templateTex.name.c_str()); - m_ProxyResources.push_back(resource); return ret; @@ -1894,9 +1776,6 @@ ResourceId D3D11Replay::CreateProxyBuffer(const BufferDescription &templateBuf) ret = ((WrappedID3D11Buffer *)throwaway)->GetResourceID(); } - if(resource != NULL && templateBuf.customName) - SetDebugName(resource, templateBuf.name.c_str()); - m_ProxyResources.push_back(resource); return ret; diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index 38baaef2d..4a9562d10 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -144,17 +144,6 @@ BufferDescription D3D12Replay::GetBuffer(ResourceId id) D3D12_RESOURCE_DESC desc = it->second->GetDesc(); - ret.customName = true; - string str = m_pDevice->GetResourceName(ret.ID); - - if(str == "") - { - ret.customName = false; - str = StringFormat::Fmt("Buffer %llu", ret.ID); - } - - ret.name = str; - ret.length = desc.Width; ret.creationFlags = BufferCategory::NoFlags; @@ -242,32 +231,6 @@ TextureDescription D3D12Replay::GetTexture(ResourceId id) ret.creationFlags |= TextureCategory::SwapBuffer; } - ret.customName = true; - string str = m_pDevice->GetResourceName(ret.ID); - - if(str == "") - { - const char *suffix = ""; - const char *ms = ""; - - if(ret.msSamp > 1) - ms = "MS"; - - if(ret.creationFlags & TextureCategory::ColorTarget) - suffix = " RTV"; - if(ret.creationFlags & TextureCategory::DepthTarget) - suffix = " DSV"; - - ret.customName = false; - - if(ret.arraysize > 1) - str = StringFormat::Fmt("Texture%uD%sArray%s %llu", ret.dimension, ms, suffix, ret.ID); - else - str = StringFormat::Fmt("Texture%uD%s%s %llu", ret.dimension, ms, suffix, ret.ID); - } - - ret.name = str; - return ret; } @@ -912,27 +875,11 @@ void D3D12Replay::SavePipelineState() state.pipeline = rm->GetOriginalID(rs.pipe); - state.customName = true; - string str = m_pDevice->GetResourceName(rs.pipe); - WrappedID3D12PipelineState *pipe = NULL; if(rs.pipe != ResourceId()) pipe = rm->GetCurrentAs(rs.pipe); - if(str == "") - { - state.customName = false; - - if(pipe) - str = StringFormat::Fmt(pipe->IsGraphics() ? "Graphics Pipe %llu" : "Compute Pipe %llu", - state.pipeline); - else - str = "Unbound"; - } - - state.name = str; - if(pipe && pipe->IsGraphics()) { const D3D12_INPUT_ELEMENT_DESC *inputEl = pipe->graphics->InputLayout.pInputElementDescs; diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index 208bd9d2b..8fe369672 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -480,8 +480,6 @@ void GLReplay::CacheTexture(ResourceId id) if(res.resource.Namespace == eResUnknown) RDCERR("Details for invalid texture id %llu requested", id); - tex.name = ""; - tex.customName = true; tex.format = ResourceFormat(); tex.dimension = 1; tex.resType = TextureDim::Unknown; @@ -519,29 +517,6 @@ void GLReplay::CacheTexture(ResourceId id) tex.byteSize = (tex.width * tex.height) * (tex.format.compByteWidth * tex.format.compCount); - string str = m_pDriver->GetResourceManager()->GetName(tex.ID); - tex.customName = true; - - if(str == "") - { - const char *suffix = ""; - const char *ms = ""; - - if(tex.msSamp > 1) - ms = "MS"; - - if(tex.creationFlags & TextureCategory::ColorTarget) - suffix = " RTV"; - if(tex.creationFlags & TextureCategory::DepthTarget) - suffix = " DSV"; - - tex.customName = false; - - str = StringFormat::Fmt("Renderbuffer%s%s %llu", ms, suffix, tex.ID); - } - - tex.name = str; - m_CachedTextures[id] = tex; return; } @@ -669,42 +644,6 @@ void GLReplay::CacheTexture(ResourceId id) if(tex.format.compType == CompType::Depth) tex.creationFlags |= TextureCategory::DepthTarget; - string str = m_pDriver->GetResourceManager()->GetName(tex.ID); - tex.customName = true; - - if(str == "") - { - const char *suffix = ""; - const char *ms = ""; - - if(tex.msSamp > 1) - ms = "MS"; - - if(tex.creationFlags & TextureCategory::ColorTarget) - suffix = " RTV"; - if(tex.creationFlags & TextureCategory::DepthTarget) - suffix = " DSV"; - - tex.customName = false; - - if(tex.cubemap) - { - if(tex.arraysize > 6) - str = StringFormat::Fmt("TextureCube%sArray%s %llu", ms, suffix, tex.ID); - else - str = StringFormat::Fmt("TextureCube%s%s %llu", ms, suffix, tex.ID); - } - else - { - if(tex.arraysize > 1) - str = StringFormat::Fmt("Texture%dD%sArray%s %llu", tex.dimension, ms, suffix, tex.ID); - else - str = StringFormat::Fmt("Texture%dD%s%s %llu", tex.dimension, ms, suffix, tex.ID); - } - } - - tex.name = str; - if(target == eGL_TEXTURE_BUFFER) { tex.dimension = 1; @@ -807,17 +746,6 @@ BufferDescription GLReplay::GetBuffer(ResourceId id) res.size = ret.length; } - string str = m_pDriver->GetResourceManager()->GetName(ret.ID); - ret.customName = true; - - if(str == "") - { - ret.customName = false; - str = StringFormat::Fmt("Buffer %llu", ret.ID); - } - - ret.name = str; - if(res.curType != eGL_NONE) gl.glBindBuffer(res.curType, prevBind); @@ -1101,14 +1029,10 @@ void GLReplay::SavePipelineState() ResourceId id = rm->GetID(ProgramPipeRes(ctx, curProg)); auto &pipeDetails = m_pDriver->m_Pipelines[id]; - string pipelineName = rm->GetName(rm->GetOriginalID(id)); + pipe.Pipeline = rm->GetOriginalID(id); for(size_t i = 0; i < ARRAY_COUNT(pipeDetails.stageShaders); i++) { - stages[i]->PipelineActive = true; - stages[i]->PipelineName = pipelineName; - stages[i]->customPipelineName = (pipelineName != ""); - if(pipeDetails.stageShaders[i] != ResourceId()) { curProg = rm->GetCurrentResource(pipeDetails.stagePrograms[i]).name; @@ -1118,15 +1042,12 @@ void GLReplay::SavePipelineState() stages[i]->BindpointMapping); mappings[i] = &stages[i]->BindpointMapping; - stages[i]->ProgramName = rm->GetName(rm->GetOriginalID(pipeDetails.stagePrograms[i])); - stages[i]->customProgramName = !stages[i]->ProgramName.empty(); - - stages[i]->ShaderName = rm->GetName(rm->GetOriginalID(pipeDetails.stageShaders[i])); - stages[i]->customShaderName = !stages[i]->ShaderName.empty(); + stages[i]->Program = rm->GetOriginalID(pipeDetails.stagePrograms[i]); + stages[i]->Object = rm->GetOriginalID(pipeDetails.stageShaders[i]); } else { - stages[i]->Object = ResourceId(); + stages[i]->Program = stages[i]->Object = ResourceId(); } } } @@ -1136,22 +1057,24 @@ void GLReplay::SavePipelineState() ResourceId id = rm->GetID(ProgramRes(ctx, curProg)); auto &progDetails = m_pDriver->m_Programs[id]; - string programName = rm->GetName(rm->GetOriginalID(id)); + pipe.Pipeline = ResourceId(); for(size_t i = 0; i < ARRAY_COUNT(progDetails.stageShaders); i++) { if(progDetails.stageShaders[i] != ResourceId()) { - stages[i]->ProgramName = programName; - stages[i]->customProgramName = (programName != ""); + stages[i]->Program = rm->GetOriginalID(id); stages[i]->Object = rm->GetOriginalID(progDetails.stageShaders[i]); stages[i]->ShaderDetails = refls[i] = GetShader(progDetails.stageShaders[i], ""); GetBindpointMapping(gl.GetHookset(), curProg, (int)i, refls[i], stages[i]->BindpointMapping); mappings[i] = &stages[i]->BindpointMapping; - stages[i]->ShaderName = rm->GetName(rm->GetOriginalID(progDetails.stageShaders[i])); - stages[i]->customShaderName = !stages[i]->ShaderName.empty(); + stages[i]->Object = rm->GetOriginalID(progDetails.stageShaders[i]); + } + else + { + stages[i]->Program = stages[i]->Object = ResourceId(); } } } @@ -3077,9 +3000,6 @@ ResourceId GLReplay::CreateProxyTexture(const TextureDescription &templateTex) ResourceId id = m_pDriver->GetResourceManager()->GetID(TextureRes(m_pDriver->GetCtx(), tex)); - if(templateTex.customName) - m_pDriver->GetResourceManager()->SetName(id, templateTex.name.c_str()); - return id; } @@ -3254,9 +3174,6 @@ ResourceId GLReplay::CreateProxyBuffer(const BufferDescription &templateBuf) ResourceId id = m_pDriver->GetResourceManager()->GetID(BufferRes(m_pDriver->GetCtx(), buf)); - if(templateBuf.customName) - m_pDriver->GetResourceManager()->SetName(id, templateBuf.name.c_str()); - return id; } diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index 74a261ae8..2510602a2 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -848,39 +848,6 @@ TextureDescription VulkanReplay::GetTexture(ResourceId id) default: RDCERR("Unexpected image type"); break; } - ret.customName = true; - ret.name = m_pDriver->m_CreationInfo.m_Names[id]; - if(ret.name.empty()) - { - ret.customName = false; - - const char *suffix = ""; - const char *ms = ""; - - if(ret.msSamp > 1) - ms = "MS"; - - if(ret.creationFlags & TextureCategory::ColorTarget) - suffix = " RTV"; - if(ret.creationFlags & TextureCategory::DepthTarget) - suffix = " DSV"; - - if(ret.cubemap) - { - if(ret.arraysize > 6) - ret.name = StringFormat::Fmt("TextureCube%sArray%s %llu", ms, suffix, ret.ID); - else - ret.name = StringFormat::Fmt("TextureCube%s%s %llu", ms, suffix, ret.ID); - } - else - { - if(ret.arraysize > 1) - ret.name = StringFormat::Fmt("Texture%dD%sArray%s %llu", ret.dimension, ms, suffix, ret.ID); - else - ret.name = StringFormat::Fmt("Texture%dD%s%s %llu", ret.dimension, ms, suffix, ret.ID); - } - } - return ret; } @@ -905,14 +872,6 @@ BufferDescription VulkanReplay::GetBuffer(ResourceId id) if(bufinfo.usage & (VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)) ret.creationFlags |= BufferCategory::Vertex; - ret.customName = true; - ret.name = m_pDriver->m_CreationInfo.m_Names[id]; - if(ret.name.empty()) - { - ret.customName = false; - ret.name = StringFormat::Fmt("Buffer %llu", ret.ID); - } - return ret; } @@ -2911,14 +2870,6 @@ void VulkanReplay::SavePipelineState() stage.Object = rm->GetOriginalID(p.shaders[i].module); stage.entryPoint = p.shaders[i].entryPoint; - stage.customName = true; - stage.name = m_pDriver->m_CreationInfo.m_Names[p.shaders[i].module]; - if(stage.name.empty()) - { - stage.customName = false; - stage.name = StringFormat::Fmt("Shader %llu", stage.Object); - } - stage.stage = ShaderStage::Compute; if(p.shaders[i].mapping) stage.BindpointMapping = *p.shaders[i].mapping; @@ -2982,14 +2933,6 @@ void VulkanReplay::SavePipelineState() stages[i]->Object = rm->GetOriginalID(p.shaders[i].module); stages[i]->entryPoint = p.shaders[i].entryPoint; - stages[i]->customName = true; - stages[i]->name = m_pDriver->m_CreationInfo.m_Names[p.shaders[i].module]; - if(stages[i]->name.empty()) - { - stages[i]->customName = false; - stages[i]->name = StringFormat::Fmt("Shader %llu", stages[i]->Object); - } - stages[i]->stage = StageFromIndex(i); if(p.shaders[i].mapping) stages[i]->BindpointMapping = *p.shaders[i].mapping; @@ -3315,14 +3258,6 @@ void VulkanReplay::SavePipelineState() el.sampler = rm->GetOriginalID(el.sampler); - el.customName = true; - el.name = m_pDriver->m_CreationInfo.m_Names[liveId]; - if(el.name.empty()) - { - el.customName = false; - el.name = StringFormat::Fmt("Sampler %llu", el.sampler); - } - // sampler info el.Filter = MakeFilter(sampl.minFilter, sampl.magFilter, sampl.mipmapMode, sampl.maxAnisotropy > 1.0f, sampl.compareEnable); diff --git a/renderdoc/replay/renderdoc_serialise.inl b/renderdoc/replay/renderdoc_serialise.inl index 9db78f13c..b0c972bd7 100644 --- a/renderdoc/replay/renderdoc_serialise.inl +++ b/renderdoc/replay/renderdoc_serialise.inl @@ -340,8 +340,6 @@ void DoSerialise(SerialiserType &ser, ResourceDescription &el) template void DoSerialise(SerialiserType &ser, TextureDescription &el) { - SERIALISE_MEMBER(name); - SERIALISE_MEMBER(customName); SERIALISE_MEMBER(format); SERIALISE_MEMBER(dimension); SERIALISE_MEMBER(resType); @@ -357,19 +355,17 @@ void DoSerialise(SerialiserType &ser, TextureDescription &el) SERIALISE_MEMBER(msSamp); SERIALISE_MEMBER(byteSize); - SIZE_CHECK(88); + SIZE_CHECK(72); } template void DoSerialise(SerialiserType &ser, BufferDescription &el) { SERIALISE_MEMBER(ID); - SERIALISE_MEMBER(name); - SERIALISE_MEMBER(customName); SERIALISE_MEMBER(creationFlags); SERIALISE_MEMBER(length); - SIZE_CHECK(40); + SIZE_CHECK(24); } template @@ -814,17 +810,13 @@ void DoSerialise(SerialiserType &ser, D3D11Pipe::IA &el) { SERIALISE_MEMBER(layouts); SERIALISE_MEMBER(layout); - - SERIALISE_MEMBER(customName); - SERIALISE_MEMBER(name); - SERIALISE_MEMBER(vbuffers); SERIALISE_MEMBER(ibuffer); if(ser.IsReading()) el.Bytecode = NULL; - SIZE_CHECK(88); + SIZE_CHECK(64); } template @@ -853,8 +845,6 @@ template void DoSerialise(SerialiserType &ser, D3D11Pipe::Sampler &el) { SERIALISE_MEMBER(Samp); - SERIALISE_MEMBER(name); - SERIALISE_MEMBER(customName); SERIALISE_MEMBER(AddressU); SERIALISE_MEMBER(AddressV); SERIALISE_MEMBER(AddressW); @@ -866,7 +856,7 @@ void DoSerialise(SerialiserType &ser, D3D11Pipe::Sampler &el) SERIALISE_MEMBER(MinLOD); SERIALISE_MEMBER(MipLODBias); - SIZE_CHECK(96); + SIZE_CHECK(72); } template @@ -883,8 +873,6 @@ template void DoSerialise(SerialiserType &ser, D3D11Pipe::Shader &el) { SERIALISE_MEMBER(Object); - SERIALISE_MEMBER(name); - SERIALISE_MEMBER(customName); SERIALISE_MEMBER(stage); SERIALISE_MEMBER(SRVs); SERIALISE_MEMBER(UAVs); @@ -896,7 +884,7 @@ void DoSerialise(SerialiserType &ser, D3D11Pipe::Shader &el) el.ShaderDetails = NULL; SERIALISE_MEMBER(BindpointMapping); - SIZE_CHECK(208); + SIZE_CHECK(184); } template @@ -1071,7 +1059,7 @@ void DoSerialise(SerialiserType &ser, D3D11Pipe::State &el) SERIALISE_MEMBER(m_RS); SERIALISE_MEMBER(m_OM); - SIZE_CHECK(1656); + SIZE_CHECK(1488); } #pragma endregion D3D11 pipeline state @@ -1388,9 +1376,6 @@ template void DoSerialise(SerialiserType &ser, D3D12Pipe::State &el) { SERIALISE_MEMBER(pipeline); - SERIALISE_MEMBER(customName); - SERIALISE_MEMBER(name); - SERIALISE_MEMBER(rootSig); SERIALISE_MEMBER(m_IA); @@ -1410,7 +1395,7 @@ void DoSerialise(SerialiserType &ser, D3D12Pipe::State &el) SERIALISE_MEMBER(Resources); - SIZE_CHECK(1176); + SIZE_CHECK(1152); } #pragma endregion D3D12 pipeline state @@ -1457,16 +1442,7 @@ template void DoSerialise(SerialiserType &ser, GLPipe::Shader &el) { SERIALISE_MEMBER(Object); - - SERIALISE_MEMBER(ShaderName); - SERIALISE_MEMBER(customShaderName); - - SERIALISE_MEMBER(ProgramName); - SERIALISE_MEMBER(customProgramName); - - SERIALISE_MEMBER(PipelineActive); - SERIALISE_MEMBER(PipelineName); - SERIALISE_MEMBER(customPipelineName); + SERIALISE_MEMBER(Program); SERIALISE_MEMBER(stage); SERIALISE_MEMBER(Subroutines); @@ -1475,7 +1451,7 @@ void DoSerialise(SerialiserType &ser, GLPipe::Shader &el) el.ShaderDetails = NULL; SERIALISE_MEMBER(BindpointMapping); - SIZE_CHECK(192); + SIZE_CHECK(128); } template @@ -1756,6 +1732,8 @@ void DoSerialise(SerialiserType &ser, GLPipe::State &el) SERIALISE_MEMBER(m_FS); SERIALISE_MEMBER(m_CS); + SERIALISE_MEMBER(Pipeline); + SERIALISE_MEMBER(m_VtxProcess); SERIALISE_MEMBER(Textures); @@ -1775,7 +1753,7 @@ void DoSerialise(SerialiserType &ser, GLPipe::State &el) SERIALISE_MEMBER(m_Hints); - SIZE_CHECK(1928); + SIZE_CHECK(1552); } #pragma endregion OpenGL pipeline state @@ -1789,10 +1767,6 @@ void DoSerialise(SerialiserType &ser, VKPipe::BindingElement &el) SERIALISE_MEMBER(res); SERIALISE_MEMBER(sampler); SERIALISE_MEMBER(immutableSampler); - - SERIALISE_MEMBER(name); - SERIALISE_MEMBER(customName); - SERIALISE_MEMBER(viewfmt); SERIALISE_MEMBER(swizzle); SERIALISE_MEMBER(baseMip); @@ -1815,7 +1789,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::BindingElement &el) SERIALISE_MEMBER(BorderColor); SERIALISE_MEMBER(unnormalized); - SIZE_CHECK(176); + SIZE_CHECK(152); }; template @@ -1925,8 +1899,6 @@ void DoSerialise(SerialiserType &ser, VKPipe::Shader &el) SERIALISE_MEMBER(Object); SERIALISE_MEMBER(entryPoint); - SERIALISE_MEMBER(name); - SERIALISE_MEMBER(customName); SERIALISE_MEMBER(stage); SERIALISE_MEMBER(specialization); @@ -1934,7 +1906,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::Shader &el) el.ShaderDetails = NULL; SERIALISE_MEMBER(BindpointMapping); - SIZE_CHECK(160); + SIZE_CHECK(136); } template @@ -2193,7 +2165,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::State &el) SERIALISE_MEMBER(images); - SIZE_CHECK(1424); + SIZE_CHECK(1280); } #pragma endregion Vulkan pipeline state