From d206a012f36e1f4afed946bc29e6831db4f0931a Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 16 Nov 2017 17:42:46 +0000 Subject: [PATCH] Fix incorrect data-to-column count when adding data to treewidget * We also add an error in case it happens again. --- qrenderdoc/Widgets/Extended/RDTreeWidget.cpp | 3 +++ .../PipelineState/GLPipelineStateViewer.cpp | 2 +- .../VulkanPipelineStateViewer.cpp | 19 ++++++++++--------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/qrenderdoc/Widgets/Extended/RDTreeWidget.cpp b/qrenderdoc/Widgets/Extended/RDTreeWidget.cpp index 9b42f913b..718ed5e1e 100644 --- a/qrenderdoc/Widgets/Extended/RDTreeWidget.cpp +++ b/qrenderdoc/Widgets/Extended/RDTreeWidget.cpp @@ -548,6 +548,9 @@ void RDTreeWidgetItem::addChild(RDTreeWidgetItem *item) { int colCount = item->m_text.count(); + if(m_widget && colCount < m_widget->m_headers.count()) + qCritical() << "Item added with insufficient column data"; + // remove it from any previous parent if(item->m_parent) item->m_parent->removeChild(this); diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index 6a83715f4..b4a15a803 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -1132,7 +1132,7 @@ void GLPipelineStateViewer::setState() RDTreeWidgetItem *node = new RDTreeWidgetItem( {i, a.Enabled ? tr("Enabled") : tr("Disabled"), name, - a.Enabled ? a.Format.Name() : genericVal, a.BufferSlot, a.RelativeOffset}); + a.Enabled ? a.Format.Name() : genericVal, a.BufferSlot, a.RelativeOffset, QString()}); if(a.Enabled) usedBindings[a.BufferSlot] = true; diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index a1fc40a0a..e66f0e981 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -655,7 +655,8 @@ QVariantList VulkanPipelineStateViewer::makeSampler(const QString &bindset, cons descriptor.immutableSampler ? tr("Immutable Sampler") : tr("Sampler"), descriptor.res, addressing, - filter + lit(", ") + lod}; + filter + lit(", ") + lod, + QString()}; } void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, @@ -918,7 +919,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, if(!isbuf) { node = new RDTreeWidgetItem({ - QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), + QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), QString(), }); setEmptyRow(node); @@ -931,7 +932,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, node = new RDTreeWidgetItem({ QString(), bindset, slotname, ToQStr(bindType), descriptorBind->res, - tr("%1 bytes").arg(len), range, + tr("%1 bytes").arg(len), range, QString(), }); node->setTag(tag); @@ -948,7 +949,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, if(descriptorBind == NULL || descriptorBind->sampler == ResourceId()) { node = new RDTreeWidgetItem({ - QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), + QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), QString(), }); setEmptyRow(node); @@ -977,7 +978,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, if(descriptorBind == NULL || descriptorBind->res == ResourceId()) { node = new RDTreeWidgetItem({ - QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), + QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), QString(), }); setEmptyRow(node); @@ -1017,7 +1018,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, dim += QFormatStr(", %1x MSAA").arg(samples); node = new RDTreeWidgetItem({ - QString(), bindset, slotname, typeName, descriptorBind->res, dim, format, + QString(), bindset, slotname, typeName, descriptorBind->res, dim, format, QString(), }); node->setTag(tag); @@ -1231,7 +1232,7 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta } RDTreeWidgetItem *node = - new RDTreeWidgetItem({QString(), setname, slotname, name, vecrange, sizestr}); + new RDTreeWidgetItem({QString(), setname, slotname, name, vecrange, sizestr, QString()}); node->setTag(QVariant::fromValue(VulkanCBufferTag(slot, (uint)idx))); @@ -1418,8 +1419,8 @@ void VulkanPipelineStateViewer::setShaderState(const VKPipe::Shader &stage, // from SPIR-V side. RDTreeWidgetItem *node = - new RDTreeWidgetItem({QString(), QString(), cblock.name, tr("Push constants"), - QString(), tr("%1 Variables").arg(cblock.variables.count())}); + new RDTreeWidgetItem({QString(), QString(), cblock.name, tr("Push constants"), QString(), + tr("%1 Variables").arg(cblock.variables.count()), QString()}); node->setTag(QVariant::fromValue(VulkanCBufferTag(cb, 0)));