From f65f5ea9da18384d4b44eb02883d8e0b1fe59e33 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 20 Apr 2017 17:04:46 +0100 Subject: [PATCH] Use new RDTreeWidget everywhere in favour of QTreeWidget * Since we're promoting everything, we reset the behaviour of RDTreeWidget so that it's not doing anything different by default. * RDTreeWidget's interface is a bit different, exposing some useful things like a single selected item and so on. * We also can't set columns in the Qt Creator UI anymore, so we set them from code. --- qrenderdoc/Code/QRDUtils.cpp | 33 - qrenderdoc/Code/QRDUtils.h | 6 - qrenderdoc/Windows/APIInspector.cpp | 31 +- qrenderdoc/Windows/APIInspector.ui | 20 +- .../Windows/ConstantBufferPreviewer.cpp | 8 +- qrenderdoc/Windows/ConstantBufferPreviewer.h | 3 +- qrenderdoc/Windows/ConstantBufferPreviewer.ui | 22 +- .../Windows/Dialogs/EnvironmentEditor.cpp | 27 +- .../Windows/Dialogs/EnvironmentEditor.h | 4 +- .../Windows/Dialogs/EnvironmentEditor.ui | 17 +- .../Windows/Dialogs/OrderedListEditor.h | 2 +- qrenderdoc/Windows/Dialogs/RemoteManager.cpp | 93 +- qrenderdoc/Windows/Dialogs/RemoteManager.h | 16 +- qrenderdoc/Windows/Dialogs/RemoteManager.ui | 12 +- qrenderdoc/Windows/EventBrowser.cpp | 74 +- qrenderdoc/Windows/EventBrowser.h | 24 +- qrenderdoc/Windows/EventBrowser.ui | 23 +- .../D3D11PipelineStateViewer.cpp | 334 ++-- .../PipelineState/D3D11PipelineStateViewer.h | 20 +- .../PipelineState/D3D11PipelineStateViewer.ui | 1009 +----------- .../D3D12PipelineStateViewer.cpp | 341 ++-- .../PipelineState/D3D12PipelineStateViewer.h | 20 +- .../PipelineState/D3D12PipelineStateViewer.ui | 1382 +---------------- .../PipelineState/GLPipelineStateViewer.cpp | 349 ++--- .../PipelineState/GLPipelineStateViewer.h | 16 +- .../PipelineState/GLPipelineStateViewer.ui | 1172 +------------- .../VulkanPipelineStateViewer.cpp | 403 ++--- .../PipelineState/VulkanPipelineStateViewer.h | 32 +- .../VulkanPipelineStateViewer.ui | 722 +-------- qrenderdoc/Windows/ShaderViewer.cpp | 63 +- qrenderdoc/Windows/ShaderViewer.h | 5 +- qrenderdoc/Windows/ShaderViewer.ui | 112 +- 32 files changed, 882 insertions(+), 5513 deletions(-) diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index 574c9a88e..f8a91bd05 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include QString ToQStr(const ResourceUsage usage, const GraphicsAPI apitype) @@ -537,38 +536,6 @@ void addGridLines(QGridLayout *grid) } } -QTreeWidgetItem *makeTreeNode(const std::initializer_list &values) -{ - QTreeWidgetItem *ret = new QTreeWidgetItem(); - - int i = 0; - for(const QVariant &v : values) - ret->setData(i++, Qt::DisplayRole, v); - - return ret; -} - -QTreeWidgetItem *makeTreeNode(const QVariantList &values) -{ - QTreeWidgetItem *ret = new QTreeWidgetItem(); - - int i = 0; - for(const QVariant &v : values) - ret->setData(i++, Qt::DisplayRole, v); - - return ret; -} - -void deleteChildren(QTreeWidgetItem *item) -{ - while(item->childCount() > 0) - { - QTreeWidgetItem *child = item->takeChild(0); - deleteChildren(child); - delete child; - } -} - int Formatter::m_minFigures = 2, Formatter::m_maxFigures = 5, Formatter::m_expNegCutoff = 5, Formatter::m_expPosCutoff = 7; double Formatter::m_expNegValue = 0.00001; // 10^(-5) diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index b9174a7ac..2831b311a 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -842,12 +842,6 @@ class QGridLayout; void addGridLines(QGridLayout *grid); -class QTreeWidgetItem; - -QTreeWidgetItem *makeTreeNode(const std::initializer_list &values); -QTreeWidgetItem *makeTreeNode(const QVariantList &values); -void deleteChildren(QTreeWidgetItem *item); - class QProgressDialog; typedef std::function ProgressUpdateMethod; diff --git a/qrenderdoc/Windows/APIInspector.cpp b/qrenderdoc/Windows/APIInspector.cpp index 16c707893..a9dbfe172 100644 --- a/qrenderdoc/Windows/APIInspector.cpp +++ b/qrenderdoc/Windows/APIInspector.cpp @@ -33,8 +33,7 @@ APIInspector::APIInspector(ICaptureContext &ctx, QWidget *parent) { ui->setupUi(this); - ui->apiEvents->headerItem()->setText(0, "EID"); - ui->apiEvents->headerItem()->setText(1, "Event"); + ui->apiEvents->setColumns({"EID", tr("Event")}); ui->splitter->setCollapsible(1, true); ui->splitter->setSizes({1, 0}); @@ -90,7 +89,9 @@ void APIInspector::addCallstack(rdctype::array calls) void APIInspector::on_apiEvents_itemSelectionChanged() { - if(ui->apiEvents->selectedItems().count() == 0) + RDTreeWidgetItem *node = ui->apiEvents->selectedItem(); + + if(!node) return; APIEvent ev = ui->apiEvents->selectedItems()[0]->data(0, Qt::UserRole).value(); @@ -124,20 +125,18 @@ void APIInspector::fillAPIView() if(draw != NULL && draw->events.count > 0) { - int e = 0; for(const APIEvent &ev : draw->events) { QStringList lines = ToQStr(ev.eventDesc).split("\n", QString::SkipEmptyParts); - QTreeWidgetItem *root = - new QTreeWidgetItem(ui->apiEvents, QStringList{QString::number(ev.eventID), lines[0]}); + RDTreeWidgetItem *root = new RDTreeWidgetItem({QString::number(ev.eventID), lines[0]}); int i = 1; if(i < lines.count() && lines[i].trimmed() == "{") i++; - QList nodestack; + QList nodestack; nodestack.push_back(root); for(; i < lines.count(); i++) @@ -147,27 +146,17 @@ void APIInspector::fillAPIView() else if(rgxclose.match(lines[i]).hasMatch()) nodestack.pop_back(); else if(!nodestack.empty()) - new QTreeWidgetItem(nodestack.back(), QStringList{"", lines[i].trimmed()}); + nodestack.back()->addChild(new RDTreeWidgetItem({"", lines[i].trimmed()})); } if(ev.eventID == draw->eventID) - { - QFont font = root->font(0); - font.setBold(true); - root->setFont(0, font); - - font = root->font(1); - font.setBold(true); - root->setFont(1, font); - } + root->setBold(true); root->setData(0, Qt::UserRole, QVariant::fromValue(ev)); - ui->apiEvents->insertTopLevelItem(e, root); - e++; + ui->apiEvents->addTopLevelItem(root); - ui->apiEvents->clearSelection(); - ui->apiEvents->setItemSelected(root, true); + ui->apiEvents->setSelectedItem(root); } } ui->apiEvents->setUpdatesEnabled(true); diff --git a/qrenderdoc/Windows/APIInspector.ui b/qrenderdoc/Windows/APIInspector.ui index 4b1c74da2..728b5a7af 100644 --- a/qrenderdoc/Windows/APIInspector.ui +++ b/qrenderdoc/Windows/APIInspector.ui @@ -37,7 +37,7 @@ 27 - + QAbstractItemView::NoEditTriggers @@ -59,19 +59,6 @@ true - - 2 - - - - 1 - - - - - 2 - - @@ -86,6 +73,11 @@ + + RDTreeWidget + QTreeView +
Widgets/Extended/RDTreeWidget.h
+
RDSplitter QSplitter diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp index 3d9dc7a98..6e9176466 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp @@ -48,7 +48,7 @@ ConstantBufferPreviewer::ConstantBufferPreviewer(ICaptureContext &ctx, const Sha ui->splitter->handle(1)->setEnabled(false); { - // Name | Value | Type + ui->variables->setColumns({tr("Name"), tr("Value"), tr("Type")}); ui->variables->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ui->variables->header()->setSectionResizeMode(1, QHeaderView::Stretch); ui->variables->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); @@ -166,19 +166,19 @@ void ConstantBufferPreviewer::processFormat(const QString &format) OnEventChanged(m_Ctx.CurEvent()); } -void ConstantBufferPreviewer::addVariables(QTreeWidgetItem *root, +void ConstantBufferPreviewer::addVariables(RDTreeWidgetItem *root, const rdctype::array &vars) { for(const ShaderVariable &v : vars) { - QTreeWidgetItem *n = makeTreeNode({ToQStr(v.name), VarString(v), TypeString(v)}); + RDTreeWidgetItem *n = new RDTreeWidgetItem({ToQStr(v.name), VarString(v), TypeString(v)}); root->addChild(n); if(v.rows > 1) { for(uint32_t i = 0; i < v.rows; i++) - n->addChild(makeTreeNode( + n->addChild(new RDTreeWidgetItem( {QString("%1.row%2").arg(ToQStr(v.name)).arg(i), RowString(v, i), RowTypeString(v)})); } diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.h b/qrenderdoc/Windows/ConstantBufferPreviewer.h index 19e44d086..328639092 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.h +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.h @@ -32,6 +32,7 @@ namespace Ui class ConstantBufferPreviewer; } +class RDTreeWidgetItem; struct FormatElement; class ConstantBufferPreviewer : public QFrame, public IConstantBufferPreviewer, public ILogViewer @@ -73,7 +74,7 @@ private: rdctype::array applyFormatOverride(const rdctype::array &data); - void addVariables(QTreeWidgetItem *root, const rdctype::array &vars); + void addVariables(RDTreeWidgetItem *root, const rdctype::array &vars); void setVariables(const rdctype::array &vars); void updateLabels(); diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.ui b/qrenderdoc/Windows/ConstantBufferPreviewer.ui index 0cdca33d1..13c4e42a6 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.ui +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.ui @@ -178,7 +178,7 @@
- + QFrame::Panel @@ -203,21 +203,6 @@ false - - - Name - - - - - Value - - - - - Type - - @@ -228,6 +213,11 @@ + + RDTreeWidget + QTreeView +
Widgets/Extended/RDTreeWidget.h
+
BufferFormatSpecifier QWidget diff --git a/qrenderdoc/Windows/Dialogs/EnvironmentEditor.cpp b/qrenderdoc/Windows/Dialogs/EnvironmentEditor.cpp index 96355acc6..c8efc847e 100644 --- a/qrenderdoc/Windows/Dialogs/EnvironmentEditor.cpp +++ b/qrenderdoc/Windows/Dialogs/EnvironmentEditor.cpp @@ -78,10 +78,11 @@ EnvironmentEditor::EnvironmentEditor(QWidget *parent) ui->name->setCompleter(m_Completer); + ui->variables->setColumns({tr("Name"), tr("Modification"), tr("Value")}); + ui->variables->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->variables->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); - ui->variables->setClearSelectionOnFocusLoss(false); ui->variables->sortByColumn(0, Qt::DescendingOrder); ui->variables->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); @@ -101,8 +102,7 @@ void EnvironmentEditor::on_name_textChanged(const QString &text) ui->addUpdate->setText(tr("Update")); ui->deleteButton->setEnabled(true); - ui->variables->clearSelection(); - ui->variables->topLevelItem(idx)->setSelected(true); + ui->variables->setSelectedItem(ui->variables->topLevelItem(idx)); } else { @@ -119,12 +119,12 @@ void EnvironmentEditor::on_variables_keyPress(QKeyEvent *event) on_deleteButton_clicked(); } -void EnvironmentEditor::on_variables_currentItemChanged(QTreeWidgetItem *current, - QTreeWidgetItem *previous) +void EnvironmentEditor::on_variables_currentItemChanged(RDTreeWidgetItem *current, + RDTreeWidgetItem *previous) { - QList sel = ui->variables->selectedItems(); + RDTreeWidgetItem *sel = ui->variables->selectedItem(); - if(sel.isEmpty()) + if(!sel) return; EnvironmentModification mod = sel[0]->data(0, Qt::UserRole).value(); @@ -165,12 +165,12 @@ void EnvironmentEditor::on_addUpdate_clicked() void EnvironmentEditor::on_deleteButton_clicked() { - QList sel = ui->variables->selectedItems(); + RDTreeWidgetItem *sel = ui->variables->selectedItem(); - if(sel.isEmpty()) + if(!sel) return; - delete ui->variables->takeTopLevelItem(ui->variables->indexOfTopLevelItem(sel[0])); + delete ui->variables->takeTopLevelItem(ui->variables->indexOfTopLevelItem(sel)); on_name_textChanged(ui->name->text()); } @@ -197,13 +197,13 @@ void EnvironmentEditor::addModification(EnvironmentModification mod, bool silent return; } - QTreeWidgetItem *node = NULL; + RDTreeWidgetItem *node = NULL; int idx = existingIndex(); if(idx < 0) { - node = makeTreeNode({ToQStr(mod.name), GetTypeString(mod), ToQStr(mod.value)}); + node = new RDTreeWidgetItem({ToQStr(mod.name), GetTypeString(mod), ToQStr(mod.value)}); ui->variables->addTopLevelItem(node); } else @@ -216,8 +216,7 @@ void EnvironmentEditor::addModification(EnvironmentModification mod, bool silent node->setData(0, Qt::UserRole, QVariant::fromValue(mod)); - ui->variables->clearSelection(); - node->setSelected(true); + ui->variables->setSelectedItem(node); delete m_Completer; diff --git a/qrenderdoc/Windows/Dialogs/EnvironmentEditor.h b/qrenderdoc/Windows/Dialogs/EnvironmentEditor.h index 9830de96c..dc6eb7de3 100644 --- a/qrenderdoc/Windows/Dialogs/EnvironmentEditor.h +++ b/qrenderdoc/Windows/Dialogs/EnvironmentEditor.h @@ -32,7 +32,7 @@ namespace Ui class EnvironmentEditor; } -class QTreeWidgetItem; +class RDTreeWidgetItem; class QCompleter; class EnvironmentEditor : public QDialog @@ -52,7 +52,7 @@ public slots: void on_addUpdate_clicked(); void on_deleteButton_clicked(); void on_variables_keyPress(QKeyEvent *event); - void on_variables_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); + void on_variables_currentItemChanged(RDTreeWidgetItem *current, RDTreeWidgetItem *previous); void on_buttonBox_accepted(); private: diff --git a/qrenderdoc/Windows/Dialogs/EnvironmentEditor.ui b/qrenderdoc/Windows/Dialogs/EnvironmentEditor.ui index 5b770a805..765497ac2 100644 --- a/qrenderdoc/Windows/Dialogs/EnvironmentEditor.ui +++ b/qrenderdoc/Windows/Dialogs/EnvironmentEditor.ui @@ -58,21 +58,6 @@ true - - - Name - - - - - Modification - - - - - Value - - @@ -211,7 +196,7 @@ RDTreeWidget - QTreeWidget + QTreeView
Widgets/Extended/RDTreeWidget.h
diff --git a/qrenderdoc/Windows/Dialogs/OrderedListEditor.h b/qrenderdoc/Windows/Dialogs/OrderedListEditor.h index 6a961b494..1436be67c 100644 --- a/qrenderdoc/Windows/Dialogs/OrderedListEditor.h +++ b/qrenderdoc/Windows/Dialogs/OrderedListEditor.h @@ -29,7 +29,7 @@ namespace Ui class OrderedListEditor; } -class QTreeWidgetItem; +class RDTreeWidgetItem; class QToolButton; enum class BrowseMode diff --git a/qrenderdoc/Windows/Dialogs/RemoteManager.cpp b/qrenderdoc/Windows/Dialogs/RemoteManager.cpp index eae2eaeff..8378c4fae 100644 --- a/qrenderdoc/Windows/Dialogs/RemoteManager.cpp +++ b/qrenderdoc/Windows/Dialogs/RemoteManager.cpp @@ -41,7 +41,7 @@ struct RemoteConnect Q_DECLARE_METATYPE(RemoteConnect); -static void setRemoteConnect(QTreeWidgetItem *item, const RemoteConnect &connect) +static void setRemoteConnect(RDTreeWidgetItem *item, const RemoteConnect &connect) { if(!item) return; @@ -49,7 +49,7 @@ static void setRemoteConnect(QTreeWidgetItem *item, const RemoteConnect &connect item->setData(0, Qt::UserRole, QVariant::fromValue(connect)); } -static RemoteConnect getRemoteConnect(QTreeWidgetItem *item) +static RemoteConnect getRemoteConnect(RDTreeWidgetItem *item) { if(!item) return RemoteConnect(); @@ -57,7 +57,7 @@ static RemoteConnect getRemoteConnect(QTreeWidgetItem *item) return item->data(0, Qt::UserRole).value(); } -static void setRemoteHost(QTreeWidgetItem *item, RemoteHost *host) +static void setRemoteHost(RDTreeWidgetItem *item, RemoteHost *host) { if(!item) return; @@ -65,7 +65,7 @@ static void setRemoteHost(QTreeWidgetItem *item, RemoteHost *host) item->setData(0, Qt::UserRole + 1, QVariant::fromValue((uintptr_t)host)); } -static RemoteHost *getRemoteHost(QTreeWidgetItem *item) +static RemoteHost *getRemoteHost(RDTreeWidgetItem *item) { if(!item) return NULL; @@ -73,14 +73,6 @@ static RemoteHost *getRemoteHost(QTreeWidgetItem *item) return (RemoteHost *)item->data(0, Qt::UserRole + 1).value(); } -static void setItalic(QTreeWidgetItem *node, bool italic) -{ - QFont f = node->font(0); - f.setItalic(italic); - node->setFont(0, f); - node->setFont(1, f); -} - RemoteManager::RemoteManager(ICaptureContext &ctx, MainWindow *main) : QDialog(NULL), ui(new Ui::RemoteManager), m_Ctx(ctx), m_Main(main) { @@ -88,7 +80,7 @@ RemoteManager::RemoteManager(ICaptureContext &ctx, MainWindow *main) m_ExternalRef.release(1); - ui->hosts->setClearSelectionOnFocusLoss(false); + ui->hosts->setColumns({tr("Hostname"), tr("Running")}); ui->hosts->header()->setSectionResizeMode(0, QHeaderView::Stretch); ui->hosts->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -130,7 +122,7 @@ void RemoteManager::closeWhenFinished() updateStatus(); } -void RemoteManager::setRemoteServerLive(QTreeWidgetItem *node, bool live, bool busy) +void RemoteManager::setRemoteServerLive(RDTreeWidgetItem *node, bool live, bool busy) { RemoteHost *host = getRemoteHost(node); @@ -163,7 +155,7 @@ void RemoteManager::setRemoteServerLive(QTreeWidgetItem *node, bool live, bool b } } -bool RemoteManager::isRemoteServerLive(QTreeWidgetItem *node) +bool RemoteManager::isRemoteServerLive(RDTreeWidgetItem *node) { RemoteHost *host = getRemoteHost(node); return host && host->ServerRunning; @@ -171,15 +163,14 @@ bool RemoteManager::isRemoteServerLive(QTreeWidgetItem *node) void RemoteManager::addHost(RemoteHost *host) { - QTreeWidgetItem *node = makeTreeNode({host->Hostname, "..."}); + RDTreeWidgetItem *node = new RDTreeWidgetItem({host->Hostname, "..."}); - setItalic(node, true); + node->setItalic(true); node->setIcon(0, Icons::hourglass()); setRemoteHost(node, host); ui->hosts->addTopLevelItem(node); - ui->hosts->clearSelection(); - node->setSelected(true); + ui->hosts->setSelectedItem(node); ui->refreshOne->setEnabled(false); ui->refreshAll->setEnabled(false); @@ -197,7 +188,7 @@ void RemoteManager::updateLookupsStatus() ui->progressCount->setText(tr("%1 lookups remaining").arg(m_Lookups.available())); } -void RemoteManager::runRemoteServer(QTreeWidgetItem *node) +void RemoteManager::runRemoteServer(RDTreeWidgetItem *node) { RemoteHost *host = getRemoteHost(node); @@ -210,7 +201,7 @@ void RemoteManager::runRemoteServer(QTreeWidgetItem *node) refreshHost(node); } -void RemoteManager::refreshHost(QTreeWidgetItem *node) +void RemoteManager::refreshHost(RDTreeWidgetItem *node) { RemoteHost *host = getRemoteHost(node); @@ -262,7 +253,7 @@ void RemoteManager::refreshHost(QTreeWidgetItem *node) RemoteConnect tag(hostname, nextIdent); GUIInvoke::call([this, node, target, running, tag]() { - QTreeWidgetItem *child = makeTreeNode({target, running}); + RDTreeWidgetItem *child = new RDTreeWidgetItem({target, running}); setRemoteConnect(child, tag); node->addChild(child); ui->hosts->expandItem(node); @@ -272,7 +263,7 @@ void RemoteManager::refreshHost(QTreeWidgetItem *node) } } - GUIInvoke::call([node]() { setItalic(node, false); }); + GUIInvoke::call([node]() { node->setItalic(false); }); m_Lookups.acquire(); @@ -303,7 +294,7 @@ void RemoteManager::updateStatus() updateLookupsStatus(); } -void RemoteManager::connectToApp(QTreeWidgetItem *node) +void RemoteManager::connectToApp(RDTreeWidgetItem *node) { if(node) { @@ -320,10 +311,10 @@ void RemoteManager::connectToApp(QTreeWidgetItem *node) void RemoteManager::updateConnectButton() { - if(!ui->hosts->selectedItems().isEmpty()) - { - QTreeWidgetItem *item = ui->hosts->selectedItems()[0]; + RDTreeWidgetItem *item = ui->hosts->selectedItem(); + if(item) + { ui->connect->setEnabled(true); ui->connect->setText(tr("Connect to App")); @@ -391,10 +382,12 @@ void RemoteManager::addNewHost() void RemoteManager::setRunCommand() { - if(ui->hosts->selectedItems().isEmpty()) + RDTreeWidgetItem *item = ui->hosts->selectedItem(); + + if(!item) return; - RemoteHost *h = getRemoteHost(ui->hosts->selectedItems()[0]); + RemoteHost *h = getRemoteHost(item); if(h) { @@ -403,14 +396,14 @@ void RemoteManager::setRunCommand() } } -void RemoteManager::on_hosts_itemActivated(QTreeWidgetItem *item, int column) +void RemoteManager::on_hosts_itemActivated(RDTreeWidgetItem *item, int column) { RemoteConnect connect = getRemoteConnect(item); if(connect.ident > 0) connectToApp(item); } -void RemoteManager::on_hosts_itemClicked(QTreeWidgetItem *item, int column) +void RemoteManager::on_hosts_itemClicked(RDTreeWidgetItem *item, int column) { ui->addUpdateHost->setText(tr("Add")); ui->addUpdateHost->setEnabled(true); @@ -458,11 +451,11 @@ void RemoteManager::on_hostname_textEdited(const QString &text) ui->addUpdateHost->setEnabled(true); ui->runCommand->setEnabled(true); - QTreeWidgetItem *node = NULL; + RDTreeWidgetItem *node = NULL; for(int i = 0; i < ui->hosts->topLevelItemCount(); i++) { - QTreeWidgetItem *n = ui->hosts->topLevelItem(i); + RDTreeWidgetItem *n = ui->hosts->topLevelItem(i); RemoteHost *host = getRemoteHost(n); @@ -492,7 +485,7 @@ void RemoteManager::on_hostname_textEdited(const QString &text) ui->hosts->clearSelection(); if(node) - node->setSelected(true); + ui->hosts->setSelectedItem(node); updateConnectButton(); } @@ -529,7 +522,8 @@ void RemoteManager::on_runCommand_keyPress(QKeyEvent *event) void RemoteManager::on_addUpdateHost_clicked() { - if(!ui->hosts->selectedItems().isEmpty() && getRemoteHost(ui->hosts->selectedItems()[0])) + RDTreeWidgetItem *item = ui->hosts->selectedItem(); + if(item && getRemoteHost(item)) setRunCommand(); else addNewHost(); @@ -545,10 +539,10 @@ void RemoteManager::on_refreshAll_clicked() for(int i = 0; i < ui->hosts->topLevelItemCount(); i++) { - QTreeWidgetItem *n = ui->hosts->topLevelItem(i); + RDTreeWidgetItem *n = ui->hosts->topLevelItem(i); - deleteChildren(n); - setItalic(n, true); + n->clear(); + n->setItalic(true); n->setIcon(0, Icons::hourglass()); refreshHost(n); @@ -559,16 +553,17 @@ void RemoteManager::on_refreshAll_clicked() void RemoteManager::on_refreshOne_clicked() { - if(m_Lookups.available() || ui->hosts->selectedItems().isEmpty()) + RDTreeWidgetItem *n = ui->hosts->selectedItem(); + + if(m_Lookups.available() || !n) return; ui->refreshOne->setEnabled(false); ui->refreshAll->setEnabled(false); - QTreeWidgetItem *n = ui->hosts->selectedItems()[0]; { - deleteChildren(n); - setItalic(n, true); + n->clear(); + n->setItalic(true); n->setIcon(0, Icons::hourglass()); refreshHost(n); @@ -579,10 +574,10 @@ void RemoteManager::on_refreshOne_clicked() void RemoteManager::on_connect_clicked() { - if(ui->hosts->selectedItems().isEmpty()) - return; + RDTreeWidgetItem *node = ui->hosts->selectedItem(); - QTreeWidgetItem *node = ui->hosts->selectedItems()[0]; + if(!node) + return; RemoteConnect connect = getRemoteConnect(node); RemoteHost *host = getRemoteHost(node); @@ -644,10 +639,10 @@ void RemoteManager::on_connect_clicked() void RemoteManager::on_deleteHost_clicked() { - if(ui->hosts->selectedItems().isEmpty()) - return; + RDTreeWidgetItem *item = ui->hosts->selectedItem(); - QTreeWidgetItem *item = ui->hosts->selectedItems()[0]; + if(!item) + return; RemoteHost *host = getRemoteHost(item); @@ -673,7 +668,7 @@ void RemoteManager::on_deleteHost_clicked() delete m_Ctx.Config().RemoteHosts.takeAt(idx); m_Ctx.Config().Save(); - deleteChildren(item); + item->clear(); delete ui->hosts->takeTopLevelItem(ui->hosts->indexOfTopLevelItem(item)); diff --git a/qrenderdoc/Windows/Dialogs/RemoteManager.h b/qrenderdoc/Windows/Dialogs/RemoteManager.h index 75a8bdd39..30144a3b4 100644 --- a/qrenderdoc/Windows/Dialogs/RemoteManager.h +++ b/qrenderdoc/Windows/Dialogs/RemoteManager.h @@ -32,7 +32,7 @@ namespace Ui class RemoteManager; } -class QTreeWidgetItem; +class RDTreeWidgetItem; struct ICaptureContext; class MainWindow; class RemoteHost; @@ -49,8 +49,8 @@ public: private slots: // automatic slots - void on_hosts_itemClicked(QTreeWidgetItem *item, int column); - void on_hosts_itemActivated(QTreeWidgetItem *item, int column); + void on_hosts_itemClicked(RDTreeWidgetItem *item, int column); + void on_hosts_itemActivated(RDTreeWidgetItem *item, int column); void on_hostname_textEdited(const QString &text); void on_hosts_keyPress(QKeyEvent *event); void on_hostname_keyPress(QKeyEvent *event); @@ -74,16 +74,16 @@ private: // delete ourselves once all lookups complete QSemaphore m_ExternalRef; - bool isRemoteServerLive(QTreeWidgetItem *node); - void setRemoteServerLive(QTreeWidgetItem *node, bool live, bool busy); + bool isRemoteServerLive(RDTreeWidgetItem *node); + void setRemoteServerLive(RDTreeWidgetItem *node, bool live, bool busy); void addHost(RemoteHost *host); void updateLookupsStatus(); - void runRemoteServer(QTreeWidgetItem *node); + void runRemoteServer(RDTreeWidgetItem *node); - void refreshHost(QTreeWidgetItem *node); + void refreshHost(RDTreeWidgetItem *node); void updateStatus(); - void connectToApp(QTreeWidgetItem *node); + void connectToApp(RDTreeWidgetItem *node); void updateConnectButton(); void addNewHost(); diff --git a/qrenderdoc/Windows/Dialogs/RemoteManager.ui b/qrenderdoc/Windows/Dialogs/RemoteManager.ui index e1334a364..5c3c842f4 100644 --- a/qrenderdoc/Windows/Dialogs/RemoteManager.ui +++ b/qrenderdoc/Windows/Dialogs/RemoteManager.ui @@ -34,16 +34,6 @@ false - - - Hostname - - - - - Running - - @@ -185,7 +175,7 @@ RDTreeWidget - QTreeWidget + QTreeView
Widgets/Extended/RDTreeWidget.h
diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index bd4c8d1d7..221aec03f 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -52,7 +52,7 @@ EventBrowser::EventBrowser(ICaptureContext &ctx, QWidget *parent) clearBookmarks(); - ui->events->setClearSelectionOnFocusLoss(false); + ui->events->setColumns({tr("Name"), "EID", "Duration - replaced in UpdateDurationColumn"}); ui->events->header()->resizeSection(COL_EID, 80); @@ -129,24 +129,25 @@ EventBrowser::~EventBrowser() void EventBrowser::OnLogfileLoaded() { - QTreeWidgetItem *frame = new QTreeWidgetItem( - (QTreeWidget *)NULL, - QStringList{QString("Frame #%1").arg(m_Ctx.FrameInfo().frameNumber), "", ""}); + RDTreeWidgetItem *frame = + new RDTreeWidgetItem({QString("Frame #%1").arg(m_Ctx.FrameInfo().frameNumber), "", ""}); clearBookmarks(); - QTreeWidgetItem *framestart = new QTreeWidgetItem(frame, QStringList{"Frame Start", "0", ""}); + RDTreeWidgetItem *framestart = new RDTreeWidgetItem({"Frame Start", "0", ""}); framestart->setData(COL_EID, Qt::UserRole, QVariant(0)); framestart->setData(COL_CURRENT, Qt::UserRole, QVariant(false)); framestart->setData(COL_FIND, Qt::UserRole, QVariant(false)); framestart->setData(COL_BOOKMARK, Qt::UserRole, QVariant(false)); framestart->setData(COL_LAST_EID, Qt::UserRole, QVariant(0)); + frame->addChild(framestart); + uint lastEID = AddDrawcalls(frame, m_Ctx.CurDrawcalls()); frame->setData(COL_EID, Qt::UserRole, QVariant(0)); frame->setData(COL_LAST_EID, Qt::UserRole, QVariant(lastEID)); - ui->events->insertTopLevelItem(0, frame); + ui->events->addTopLevelItem(frame); ui->events->expandItem(frame); @@ -182,15 +183,15 @@ void EventBrowser::OnEventChanged(uint32_t eventID) highlightBookmarks(); } -uint EventBrowser::AddDrawcalls(QTreeWidgetItem *parent, +uint EventBrowser::AddDrawcalls(RDTreeWidgetItem *parent, const rdctype::array &draws) { uint lastEID = 0; for(int32_t i = 0; i < draws.count; i++) { - QTreeWidgetItem *child = new QTreeWidgetItem( - parent, QStringList{QString(draws[i].name), QString("%1").arg(draws[i].eventID), "0.0"}); + RDTreeWidgetItem *child = + new RDTreeWidgetItem({QString(draws[i].name), QString("%1").arg(draws[i].eventID), "0.0"}); lastEID = AddDrawcalls(child, draws[i].children); @@ -210,12 +211,14 @@ uint EventBrowser::AddDrawcalls(QTreeWidgetItem *parent, child->setData(COL_FIND, Qt::UserRole, QVariant(false)); child->setData(COL_BOOKMARK, Qt::UserRole, QVariant(false)); child->setData(COL_LAST_EID, Qt::UserRole, QVariant(lastEID)); + + parent->addChild(child); } return lastEID; } -void EventBrowser::SetDrawcallTimes(QTreeWidgetItem *node, +void EventBrowser::SetDrawcallTimes(RDTreeWidgetItem *node, const rdctype::array &results) { if(node == NULL) @@ -291,7 +294,7 @@ void EventBrowser::on_gotoEID_clicked() void EventBrowser::on_bookmark_clicked() { - QTreeWidgetItem *n = ui->events->currentItem(); + RDTreeWidgetItem *n = ui->events->currentItem(); if(n) toggleBookmark(n->data(COL_LAST_EID, Qt::UserRole).toUInt()); @@ -307,7 +310,7 @@ void EventBrowser::on_timeDraws_clicked() }); } -void EventBrowser::on_events_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) +void EventBrowser::on_events_currentItemChanged(RDTreeWidgetItem *current, RDTreeWidgetItem *previous) { if(previous) { @@ -464,7 +467,7 @@ void EventBrowser::on_exportDraws_clicked() if(!m_Times.empty()) { - line += QString(" | %1").arg(ui->events->headerItem()->text(COL_DURATION)); + line += QString(" | %1").arg(ui->events->headerText(COL_DURATION)); } stream << line << "\n"; @@ -651,7 +654,7 @@ void EventBrowser::toggleBookmark(uint32_t EID) { int index = m_Bookmarks.indexOf(EID); - QTreeWidgetItem *found = NULL; + RDTreeWidgetItem *found = NULL; FindEventNode(found, ui->events->topLevelItem(0), EID); if(index >= 0) @@ -718,7 +721,7 @@ void EventBrowser::highlightBookmarks() } } -bool EventBrowser::hasBookmark(QTreeWidgetItem *node) +bool EventBrowser::hasBookmark(RDTreeWidgetItem *node) { if(node) return hasBookmark(node->data(COL_EID, Qt::UserRole).toUInt()); @@ -731,7 +734,7 @@ bool EventBrowser::hasBookmark(uint32_t EID) return m_Bookmarks.contains(EID); } -void EventBrowser::RefreshIcon(QTreeWidgetItem *item) +void EventBrowser::RefreshIcon(RDTreeWidgetItem *item) { if(item->data(COL_CURRENT, Qt::UserRole).toBool()) item->setIcon(COL_NAME, m_CurrentIcon); @@ -743,13 +746,13 @@ void EventBrowser::RefreshIcon(QTreeWidgetItem *item) item->setIcon(COL_NAME, QIcon()); } -bool EventBrowser::FindEventNode(QTreeWidgetItem *&found, QTreeWidgetItem *parent, uint32_t eventID) +bool EventBrowser::FindEventNode(RDTreeWidgetItem *&found, RDTreeWidgetItem *parent, uint32_t eventID) { // do a reverse search to find the last match (in case of 'set' markers that // inherit the event of the next real draw). for(int i = parent->childCount() - 1; i >= 0; i--) { - QTreeWidgetItem *n = parent->child(i); + RDTreeWidgetItem *n = parent->child(i); uint nEID = n->data(COL_LAST_EID, Qt::UserRole).toUInt(); uint fEID = found ? found->data(COL_LAST_EID, Qt::UserRole).toUInt() : 0; @@ -771,12 +774,12 @@ bool EventBrowser::FindEventNode(QTreeWidgetItem *&found, QTreeWidgetItem *paren return false; } -void EventBrowser::ExpandNode(QTreeWidgetItem *node) +void EventBrowser::ExpandNode(RDTreeWidgetItem *node) { - QTreeWidgetItem *n = node; + RDTreeWidgetItem *n = node; while(node != NULL) { - node->setExpanded(true); + ui->events->expandItem(node); node = node->parent(); } @@ -789,13 +792,12 @@ bool EventBrowser::SelectEvent(uint32_t eventID) if(!m_Ctx.LogLoaded()) return false; - QTreeWidgetItem *found = NULL; + RDTreeWidgetItem *found = NULL; FindEventNode(found, ui->events->topLevelItem(0), eventID); if(found != NULL) { - ui->events->clearSelection(); - ui->events->setItemSelected(found, true); ui->events->setCurrentItem(found); + ui->events->setSelectedItem(found); ExpandNode(found); return true; @@ -804,11 +806,11 @@ bool EventBrowser::SelectEvent(uint32_t eventID) return false; } -void EventBrowser::ClearFindIcons(QTreeWidgetItem *parent) +void EventBrowser::ClearFindIcons(RDTreeWidgetItem *parent) { for(int i = 0; i < parent->childCount(); i++) { - QTreeWidgetItem *n = parent->child(i); + RDTreeWidgetItem *n = parent->child(i); n->setData(COL_FIND, Qt::UserRole, QVariant(false)); RefreshIcon(n); @@ -824,13 +826,13 @@ void EventBrowser::ClearFindIcons() ClearFindIcons(ui->events->topLevelItem(0)); } -int EventBrowser::SetFindIcons(QTreeWidgetItem *parent, QString filter) +int EventBrowser::SetFindIcons(RDTreeWidgetItem *parent, QString filter) { int results = 0; for(int i = 0; i < parent->childCount(); i++) { - QTreeWidgetItem *n = parent->child(i); + RDTreeWidgetItem *n = parent->child(i); if(n->text(COL_NAME).contains(filter, Qt::CaseInsensitive)) { @@ -856,11 +858,11 @@ int EventBrowser::SetFindIcons(QString filter) return SetFindIcons(ui->events->topLevelItem(0), filter); } -QTreeWidgetItem *EventBrowser::FindNode(QTreeWidgetItem *parent, QString filter, uint32_t after) +RDTreeWidgetItem *EventBrowser::FindNode(RDTreeWidgetItem *parent, QString filter, uint32_t after) { for(int i = 0; i < parent->childCount(); i++) { - QTreeWidgetItem *n = parent->child(i); + RDTreeWidgetItem *n = parent->child(i); uint eid = n->data(COL_LAST_EID, Qt::UserRole).toUInt(); @@ -869,7 +871,7 @@ QTreeWidgetItem *EventBrowser::FindNode(QTreeWidgetItem *parent, QString filter, if(n->childCount() > 0) { - QTreeWidgetItem *found = FindNode(n, filter, after); + RDTreeWidgetItem *found = FindNode(n, filter, after); if(found != NULL) return found; @@ -879,7 +881,7 @@ QTreeWidgetItem *EventBrowser::FindNode(QTreeWidgetItem *parent, QString filter, return NULL; } -int EventBrowser::FindEvent(QTreeWidgetItem *parent, QString filter, uint32_t after, bool forward) +int EventBrowser::FindEvent(RDTreeWidgetItem *parent, QString filter, uint32_t after, bool forward) { if(parent == NULL) return -1; @@ -926,8 +928,10 @@ void EventBrowser::Find(bool forward) return; uint32_t curEID = m_Ctx.CurEvent(); - if(!ui->events->selectedItems().isEmpty()) - curEID = ui->events->selectedItems()[0]->data(COL_LAST_EID, Qt::UserRole).toUInt(); + + RDTreeWidgetItem *node = ui->events->selectedItem(); + if(node) + curEID = node->data(COL_LAST_EID, Qt::UserRole).toUInt(); int eid = FindEvent(ui->findEvent->text(), curEID, forward); if(eid >= 0) @@ -957,7 +961,7 @@ void EventBrowser::UpdateDurationColumn() m_TimeUnit = m_Ctx.Config().EventBrowser_TimeUnit; - ui->events->headerItem()->setText(COL_DURATION, tr("Duration (%1)").arg(UnitSuffix(m_TimeUnit))); + ui->events->setHeaderText(COL_DURATION, tr("Duration (%1)").arg(UnitSuffix(m_TimeUnit))); if(!m_Times.empty()) SetDrawcallTimes(ui->events->topLevelItem(0), m_Times); diff --git a/qrenderdoc/Windows/EventBrowser.h b/qrenderdoc/Windows/EventBrowser.h index 2ce587fcb..0c8cea250 100644 --- a/qrenderdoc/Windows/EventBrowser.h +++ b/qrenderdoc/Windows/EventBrowser.h @@ -35,7 +35,7 @@ class EventBrowser; class QSpacerItem; class QToolButton; -class QTreeWidgetItem; +class RDTreeWidgetItem; class QTimer; class QTextStream; class FlowLayout; @@ -70,7 +70,7 @@ private slots: void on_findEvent_returnPressed(); void on_findEvent_keyPress(QKeyEvent *event); void on_findEvent_textEdited(const QString &arg1); - void on_events_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); + void on_events_currentItemChanged(RDTreeWidgetItem *current, RDTreeWidgetItem *previous); void on_findNext_clicked(); void on_findPrev_clicked(); void on_stepNext_clicked(); @@ -88,25 +88,25 @@ public slots: void jumpToBookmark(int idx); private: - uint AddDrawcalls(QTreeWidgetItem *parent, const rdctype::array &draws); - void SetDrawcallTimes(QTreeWidgetItem *node, const rdctype::array &results); + uint AddDrawcalls(RDTreeWidgetItem *parent, const rdctype::array &draws); + void SetDrawcallTimes(RDTreeWidgetItem *node, const rdctype::array &results); - void ExpandNode(QTreeWidgetItem *node); + void ExpandNode(RDTreeWidgetItem *node); - bool FindEventNode(QTreeWidgetItem *&found, QTreeWidgetItem *parent, uint32_t eventID); + bool FindEventNode(RDTreeWidgetItem *&found, RDTreeWidgetItem *parent, uint32_t eventID); bool SelectEvent(uint32_t eventID); - void ClearFindIcons(QTreeWidgetItem *parent); + void ClearFindIcons(RDTreeWidgetItem *parent); void ClearFindIcons(); - int SetFindIcons(QTreeWidgetItem *parent, QString filter); + int SetFindIcons(RDTreeWidgetItem *parent, QString filter); int SetFindIcons(QString filter); void highlightBookmarks(); - bool hasBookmark(QTreeWidgetItem *node); + bool hasBookmark(RDTreeWidgetItem *node); - QTreeWidgetItem *FindNode(QTreeWidgetItem *parent, QString filter, uint32_t after); - int FindEvent(QTreeWidgetItem *parent, QString filter, uint32_t after, bool forward); + RDTreeWidgetItem *FindNode(RDTreeWidgetItem *parent, QString filter, uint32_t after); + int FindEvent(RDTreeWidgetItem *parent, QString filter, uint32_t after, bool forward); int FindEvent(QString filter, uint32_t after, bool forward); void Find(bool forward); @@ -133,7 +133,7 @@ private: QList m_Bookmarks; QList m_BookmarkButtons; - void RefreshIcon(QTreeWidgetItem *item); + void RefreshIcon(RDTreeWidgetItem *item); Ui::EventBrowser *ui; ICaptureContext &m_Ctx; diff --git a/qrenderdoc/Windows/EventBrowser.ui b/qrenderdoc/Windows/EventBrowser.ui index b6e687ba7..89fbfa569 100644 --- a/qrenderdoc/Windows/EventBrowser.ui +++ b/qrenderdoc/Windows/EventBrowser.ui @@ -572,27 +572,6 @@ false - - - Name - - - - - EID - - - - - - - - - - - Duration (µs) - -
@@ -605,7 +584,7 @@ RDTreeWidget - QTreeWidget + QTreeView
Widgets/Extended/RDTreeWidget.h
diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp index f877606b7..77c42e020 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp @@ -73,6 +73,9 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, { ui->setupUi(this); + const QIcon &action = Icons::action(); + const QIcon &action_hover = Icons::action_hover(); + RDLabel *shaderLabels[] = { ui->vsShader, ui->hsShader, ui->dsShader, ui->gsShader, ui->psShader, ui->csShader, ui->iaBytecode, @@ -147,9 +150,10 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, addGridLines(ui->blendStateGridLayout); addGridLines(ui->depthStateGridLayout); - // no way to set this up in the UI :( { - // Slot | Semantic | Index | Format | Input Slot | Offset | Class | Step Rate | Go + ui->iaLayouts->setColumns({tr("Slot"), tr("Semantic"), tr("Index"), tr("Format"), + tr("Input Slot"), tr("Offset"), tr("Class"), tr("Step Rate"), + tr("Go")}); ui->iaLayouts->header()->resizeSection(0, 75); ui->iaLayouts->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->iaLayouts->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -161,11 +165,13 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, ui->iaLayouts->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->iaLayouts->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); - ui->iaLayouts->setHoverIconColumn(8); + ui->iaLayouts->setClearSelectionOnFocusLoss(true); + ui->iaLayouts->setHoverIconColumn(8, action, action_hover); } { - // Slot | Buffer | Stride | Offset | Byte Length | Go + ui->iaBuffers->setColumns( + {tr("Slot"), tr("Buffer"), tr("Stride"), tr("Offset"), tr("Byte Length"), tr("Go")}); ui->iaBuffers->header()->resizeSection(0, 75); ui->iaBuffers->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->iaBuffers->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -174,12 +180,14 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, ui->iaBuffers->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); ui->iaBuffers->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); - ui->iaBuffers->setHoverIconColumn(5); + ui->iaBuffers->setClearSelectionOnFocusLoss(true); + ui->iaBuffers->setHoverIconColumn(5, action, action_hover); } for(RDTreeWidget *tex : resources) { - // Slot | Resource | Type | Width | Height | Depth | Array Size | Format | Go + tex->setColumns({tr("Slot"), tr("Resource"), tr("Type"), tr("Width"), tr("Height"), tr("Depth"), + tr("Array Size"), tr("Format"), tr("Go")}); tex->header()->resizeSection(0, 120); tex->header()->setSectionResizeMode(0, QHeaderView::Interactive); tex->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -191,24 +199,26 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, tex->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); tex->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); - tex->setHoverIconColumn(8); - tex->setDefaultHoverColor(ui->targetOutputs->palette().color(QPalette::Window)); + tex->setHoverIconColumn(8, action, action_hover); + tex->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *samp : samplers) { - // Slot | Addressing | Filter | LOD Clamp | LOD Bias + samp->setColumns({tr("Slot"), tr("Addressing"), tr("Filter"), tr("LOD Clamp"), tr("LOD Bias")}); samp->header()->resizeSection(0, 120); samp->header()->setSectionResizeMode(0, QHeaderView::Interactive); samp->header()->setSectionResizeMode(1, QHeaderView::Stretch); samp->header()->setSectionResizeMode(2, QHeaderView::Stretch); samp->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); samp->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); + + samp->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *cbuffer : cbuffers) { - // Slot | Buffer | Byte Range | Size | Go + cbuffer->setColumns({tr("Slot"), tr("Buffer"), tr("Byte Range"), tr("Size"), tr("Go")}); cbuffer->header()->resizeSection(0, 120); cbuffer->header()->setSectionResizeMode(0, QHeaderView::Interactive); cbuffer->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -216,21 +226,24 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, cbuffer->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); cbuffer->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); - cbuffer->setHoverIconColumn(4); - cbuffer->setDefaultHoverColor(ui->targetOutputs->palette().color(QPalette::Window)); + cbuffer->setHoverIconColumn(4, action, action_hover); + cbuffer->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *cl : classes) { - // Slot | Interface | Instance + cl->setColumns({tr("Slot"), tr("Interface"), tr("Instance")}); cl->header()->resizeSection(0, 120); cl->header()->setSectionResizeMode(0, QHeaderView::Interactive); cl->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); cl->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); + + cl->setClearSelectionOnFocusLoss(true); } { - // Slot | X | Y | Width | Height | MinDepth | MaxDepth + ui->viewports->setColumns( + {tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"), tr("MinDepth"), tr("MaxDepth")}); ui->viewports->header()->resizeSection(0, 75); ui->viewports->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->viewports->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -239,20 +252,26 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, ui->viewports->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); ui->viewports->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ui->viewports->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); + + ui->viewports->setClearSelectionOnFocusLoss(true); } { - // Slot | X | Y | Width | Height + ui->scissors->setColumns({tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height")}); ui->scissors->header()->resizeSection(0, 100); ui->scissors->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->scissors->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(4, QHeaderView::Stretch); + + ui->scissors->setClearSelectionOnFocusLoss(true); } { - // Slot | Resource | Type | Width | Height | Depth | Array Size | Format | Go + ui->targetOutputs->setColumns({tr("Slot"), tr("Resource"), tr("Type"), tr("Width"), + tr("Height"), tr("Depth"), tr("Array Size"), tr("Format"), + tr("Go")}); ui->targetOutputs->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ui->targetOutputs->header()->setSectionResizeMode(1, QHeaderView::Stretch); ui->targetOutputs->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); @@ -263,12 +282,13 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, ui->targetOutputs->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->targetOutputs->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); - ui->targetOutputs->setHoverIconColumn(8); - ui->targetOutputs->setDefaultHoverColor(ui->targetOutputs->palette().color(QPalette::Window)); + ui->targetOutputs->setHoverIconColumn(8, action, action_hover); + ui->targetOutputs->setClearSelectionOnFocusLoss(true); } { - // Slot | Enabled | Col Src | Col Dst | Col Op | Alpha Src | Alpha Dst | Alpha Op | Write Mask + ui->blends->setColumns({tr("Slot"), tr("Enabled"), tr("Col Src"), tr("Col Dst"), tr("Col Op"), + tr("Alpha Src"), tr("Alpha Dst"), tr("Alpha Op"), tr("Write Mask")}); ui->blends->header()->resizeSection(0, 75); ui->blends->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->blends->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -279,20 +299,26 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, ui->blends->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); ui->blends->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->blends->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); + + ui->blends->setClearSelectionOnFocusLoss(true); } { - // Face | Func | Fail Op | Depth Fail Op | Pass Op + ui->stencils->setColumns( + {tr("Face"), tr("Func"), tr("Fail Op"), tr("Depth Fail Op"), tr("Pass Op")}); ui->stencils->header()->resizeSection(0, 50); ui->stencils->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->stencils->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(4, QHeaderView::Stretch); + + ui->stencils->setClearSelectionOnFocusLoss(true); } { - // Slot | Resource | Type | Width | Height | Depth | Array Size | Format | Go + ui->csUAVs->setColumns({tr("Slot"), tr("Resource"), tr("Type"), tr("Width"), tr("Height"), + tr("Depth"), tr("Array Size"), tr("Format"), tr("Go")}); ui->csUAVs->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ui->csUAVs->header()->setSectionResizeMode(1, QHeaderView::Stretch); ui->csUAVs->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); @@ -303,8 +329,8 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx, ui->csUAVs->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->csUAVs->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); - ui->csUAVs->setHoverIconColumn(8); - ui->csUAVs->setDefaultHoverColor(ui->targetOutputs->palette().color(QPalette::Window)); + ui->csUAVs->setHoverIconColumn(8, action, action_hover); + ui->csUAVs->setClearSelectionOnFocusLoss(true); } // this is often changed just because we're changing some tab in the designer. @@ -361,20 +387,15 @@ void D3D11PipelineStateViewer::on_showEmpty_toggled(bool checked) setState(); } -void D3D11PipelineStateViewer::setInactiveRow(QTreeWidgetItem *node) +void D3D11PipelineStateViewer::setInactiveRow(RDTreeWidgetItem *node) { - for(int i = 0; i < node->columnCount(); i++) - { - QFont f = node->font(i); - f.setItalic(true); - node->setFont(i, f); - } + node->setItalic(true); } -void D3D11PipelineStateViewer::setEmptyRow(QTreeWidgetItem *node) +void D3D11PipelineStateViewer::setEmptyRow(RDTreeWidgetItem *node) { - for(int i = 0; i < node->columnCount(); i++) - node->setBackgroundColor(i, QColor(255, 70, 70)); + node->setBackgroundColor(QColor(255, 70, 70)); + node->setForegroundColor(QColor(0, 0, 0)); } bool D3D11PipelineStateViewer::HasImportantViewParams(const D3D11Pipe::View &view, @@ -407,7 +428,7 @@ bool D3D11PipelineStateViewer::HasImportantViewParams(const D3D11Pipe::View &vie return false; } -void D3D11PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewTag &view, +void D3D11PipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, const ViewTag &view, TextureDescription *tex) { if(tex == NULL) @@ -467,19 +488,16 @@ void D3D11PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT text = text.trimmed(); - for(int i = 0; i < node->columnCount(); i++) - { - node->setToolTip(i, text); + node->setToolTip(text); - if(viewdetails) - { - node->setBackgroundColor(i, QColor(127, 255, 212)); - node->setForeground(i, QBrush(QColor(0, 0, 0))); - } + if(viewdetails) + { + node->setBackgroundColor(QColor(127, 255, 212)); + node->setForegroundColor(QColor(0, 0, 0)); } } -void D3D11PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewTag &view, +void D3D11PipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, const ViewTag &view, BufferDescription *buf) { if(buf == NULL) @@ -504,20 +522,14 @@ void D3D11PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT return; } - for(int i = 0; i < node->columnCount(); i++) - { - node->setToolTip(i, text); - node->setBackgroundColor(i, QColor(127, 255, 212)); - node->setForeground(i, QBrush(QColor(0, 0, 0))); - } + node->setToolTip(text); + node->setBackgroundColor(QColor(127, 255, 212)); + node->setForegroundColor(QColor(0, 0, 0)); } void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderResource *shaderInput, RDTreeWidget *resources) { - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - const D3D11Pipe::View &r = view.res; bool viewDetails = false; @@ -627,12 +639,11 @@ void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderR viewDetails = true; } - QTreeWidgetItem *node = makeTreeNode({slotname, name, typeName, w, h, d, a, format, ""}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({slotname, name, typeName, w, h, d, a, format, ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(view)); - resources->setHoverIcons(node, action, action_hover); - if(viewDetails) { if(tex) @@ -907,11 +918,11 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, QL else if(s.Filter.func != FilterFunc::Normal) filter = QString(" (%1)").arg(ToQStr(s.Filter.func)); - QTreeWidgetItem *node = - makeTreeNode({slotname, addressing, filter, - (s.MinLOD == -FLT_MAX ? "0" : QString::number(s.MinLOD)) + " - " + - (s.MaxLOD == FLT_MAX ? "FLT_MAX" : QString::number(s.MaxLOD)), - s.MipLODBias}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({slotname, addressing, filter, + (s.MinLOD == -FLT_MAX ? "0" : QString::number(s.MinLOD)) + " - " + + (s.MaxLOD == FLT_MAX ? "FLT_MAX" : QString::number(s.MaxLOD)), + s.MipLODBias}); if(!filledSlot) setEmptyRow(node); @@ -989,7 +1000,7 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, QL QString vecrange = QString("%1 - %2").arg(b.VecOffset).arg(b.VecOffset + b.VecCount); - QTreeWidgetItem *node = makeTreeNode({slotname, name, vecrange, sizestr, ""}); + RDTreeWidgetItem *node = new RDTreeWidgetItem({slotname, name, vecrange, sizestr, ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(i)); @@ -1016,7 +1027,8 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, QL if(shaderDetails && i < shaderDetails->Interfaces.count) interfaceName = ToQStr(shaderDetails->Interfaces[i]); - classes->addTopLevelItem(makeTreeNode({i, interfaceName, ToQStr(stage.ClassInstances[i])})); + classes->addTopLevelItem( + new RDTreeWidgetItem({i, interfaceName, ToQStr(stage.ClassInstances[i])})); } classes->clearSelection(); classes->setUpdatesEnabled(true); @@ -1039,9 +1051,6 @@ void D3D11PipelineStateViewer::setState() const QPixmap &tick = Pixmaps::tick(); const QPixmap &cross = Pixmaps::cross(); - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - //////////////////////////////////////////////// // Vertex Input @@ -1182,15 +1191,13 @@ void D3D11PipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QTreeWidgetItem *node = makeTreeNode( + RDTreeWidgetItem *node = new RDTreeWidgetItem( {i, ToQStr(l.SemanticName), l.SemanticIndex, ToQStr(l.Format.strname), l.InputSlot, byteOffs, l.PerInstance ? "PER_INSTANCE" : "PER_VERTEX", l.InstanceDataStepRate, ""}); if(usedSlot) usedVBuffers[l.InputSlot] = true; - ui->iaLayouts->setHoverIcons(node, action, action_hover); - if(!usedSlot) setInactiveRow(node); @@ -1262,10 +1269,9 @@ void D3D11PipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = makeTreeNode({"Index", name, draw ? draw->indexByteWidth : 0, - state.m_IA.ibuffer.Offset, (qulonglong)length, ""}); - - ui->iaBuffers->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({"Index", name, draw ? draw->indexByteWidth : 0, + state.m_IA.ibuffer.Offset, (qulonglong)length, ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(state.m_IA.ibuffer.Buffer, draw ? draw->indexOffset : 0))); @@ -1283,9 +1289,8 @@ void D3D11PipelineStateViewer::setState() { if(ibufferUsed || ui->showEmpty->isChecked()) { - QTreeWidgetItem *node = makeTreeNode({"Index", tr("No Buffer Set"), "-", "-", "-", ""}); - - ui->iaBuffers->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({"Index", tr("No Buffer Set"), "-", "-", "-", ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(state.m_IA.ibuffer.Buffer, draw ? draw->indexOffset : 0))); @@ -1326,14 +1331,12 @@ void D3D11PipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = NULL; + RDTreeWidgetItem *node = NULL; if(filledSlot) - node = makeTreeNode({i, name, v.Stride, v.Offset, length, ""}); + node = new RDTreeWidgetItem({i, name, v.Stride, v.Offset, length, ""}); else - node = makeTreeNode({i, "No Buffer Set", "-", "-", "-", ""}); - - ui->iaBuffers->setHoverIcons(node, action, action_hover); + node = new RDTreeWidgetItem({i, "No Buffer Set", "-", "-", "-", ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(v.Buffer, v.Offset))); @@ -1420,9 +1423,7 @@ void D3D11PipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = makeTreeNode({i, name, length, s.Offset, ""}); - - ui->gsStreamOut->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = new RDTreeWidgetItem({i, name, length, s.Offset, ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(s.Buffer)); @@ -1454,7 +1455,8 @@ void D3D11PipelineStateViewer::setState() if(v.Enabled || ui->showEmpty->isChecked()) { - QTreeWidgetItem *node = makeTreeNode({i, v.X, v.Y, v.Width, v.Height, v.MinDepth, v.MaxDepth}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({i, v.X, v.Y, v.Width, v.Height, v.MinDepth, v.MaxDepth}); if(v.Width == 0 || v.Height == 0 || v.MinDepth == v.MaxDepth) setEmptyRow(node); @@ -1478,7 +1480,8 @@ void D3D11PipelineStateViewer::setState() if(s.Enabled || ui->showEmpty->isChecked()) { - QTreeWidgetItem *node = makeTreeNode({i, s.left, s.top, s.right - s.left, s.bottom - s.top}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({i, s.left, s.top, s.right - s.left, s.bottom - s.top}); if(s.right == s.left || s.bottom == s.top) setEmptyRow(node); @@ -1572,25 +1575,25 @@ void D3D11PipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QTreeWidgetItem *node = NULL; + RDTreeWidgetItem *node = NULL; - node = - makeTreeNode({i, blend.Enabled ? tr("True") : tr("False"), - blend.LogicEnabled ? tr("True") : tr("False"), + node = new RDTreeWidgetItem({i, blend.Enabled ? tr("True") : tr("False"), + blend.LogicEnabled ? tr("True") : tr("False"), - ToQStr(blend.m_Blend.Source), ToQStr(blend.m_Blend.Destination), - ToQStr(blend.m_Blend.Operation), + ToQStr(blend.m_Blend.Source), ToQStr(blend.m_Blend.Destination), + ToQStr(blend.m_Blend.Operation), - ToQStr(blend.m_AlphaBlend.Source), ToQStr(blend.m_AlphaBlend.Destination), - ToQStr(blend.m_AlphaBlend.Operation), + ToQStr(blend.m_AlphaBlend.Source), + ToQStr(blend.m_AlphaBlend.Destination), + ToQStr(blend.m_AlphaBlend.Operation), - ToQStr(blend.Logic), + ToQStr(blend.Logic), - QString("%1%2%3%4") - .arg((blend.WriteMask & 0x1) == 0 ? "_" : "R") - .arg((blend.WriteMask & 0x2) == 0 ? "_" : "G") - .arg((blend.WriteMask & 0x4) == 0 ? "_" : "B") - .arg((blend.WriteMask & 0x8) == 0 ? "_" : "A")}); + QString("%1%2%3%4") + .arg((blend.WriteMask & 0x1) == 0 ? "_" : "R") + .arg((blend.WriteMask & 0x2) == 0 ? "_" : "G") + .arg((blend.WriteMask & 0x4) == 0 ? "_" : "B") + .arg((blend.WriteMask & 0x8) == 0 ? "_" : "A")}); if(!filledSlot) setEmptyRow(node); @@ -1633,14 +1636,15 @@ void D3D11PipelineStateViewer::setState() ui->stencils->setUpdatesEnabled(false); ui->stencils->clear(); - ui->stencils->addTopLevelItems({makeTreeNode({"Front", ToQStr(state.m_OM.m_State.m_FrontFace.Func), - ToQStr(state.m_OM.m_State.m_FrontFace.FailOp), - ToQStr(state.m_OM.m_State.m_FrontFace.DepthFailOp), - ToQStr(state.m_OM.m_State.m_FrontFace.PassOp)}), - makeTreeNode({"Back", ToQStr(state.m_OM.m_State.m_BackFace.Func), - ToQStr(state.m_OM.m_State.m_BackFace.FailOp), - ToQStr(state.m_OM.m_State.m_BackFace.DepthFailOp), - ToQStr(state.m_OM.m_State.m_BackFace.PassOp)})}); + ui->stencils->addTopLevelItem( + new RDTreeWidgetItem({"Front", ToQStr(state.m_OM.m_State.m_FrontFace.Func), + ToQStr(state.m_OM.m_State.m_FrontFace.FailOp), + ToQStr(state.m_OM.m_State.m_FrontFace.DepthFailOp), + ToQStr(state.m_OM.m_State.m_FrontFace.PassOp)})); + ui->stencils->addTopLevelItem(new RDTreeWidgetItem( + {"Back", ToQStr(state.m_OM.m_State.m_BackFace.Func), + ToQStr(state.m_OM.m_State.m_BackFace.FailOp), ToQStr(state.m_OM.m_State.m_BackFace.DepthFailOp), + ToQStr(state.m_OM.m_State.m_BackFace.PassOp)})); ui->stencils->clearSelection(); ui->stencils->setUpdatesEnabled(true); @@ -1696,7 +1700,7 @@ QString D3D11PipelineStateViewer::formatMembers(int indent, const QString &namep return ret; } -void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int column) +void D3D11PipelineStateViewer::resource_itemActivated(RDTreeWidgetItem *item, int column) { const D3D11Pipe::Shader *stage = stageForSender(item->treeWidget()); @@ -1934,7 +1938,7 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int } } -void D3D11PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int column) +void D3D11PipelineStateViewer::cbuffer_itemActivated(RDTreeWidgetItem *item, int column) { const D3D11Pipe::Shader *stage = stageForSender(item->treeWidget()); @@ -1953,12 +1957,12 @@ void D3D11PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int m_Ctx.AddDockWindow(prev->Widget(), DockReference::RightOf, this, 0.3f); } -void D3D11PipelineStateViewer::on_iaLayouts_itemActivated(QTreeWidgetItem *item, int column) +void D3D11PipelineStateViewer::on_iaLayouts_itemActivated(RDTreeWidgetItem *item, int column) { on_meshView_clicked(); } -void D3D11PipelineStateViewer::on_iaBuffers_itemActivated(QTreeWidgetItem *item, int column) +void D3D11PipelineStateViewer::on_iaBuffers_itemActivated(RDTreeWidgetItem *item, int column) { QVariant tag = item->data(0, Qt::UserRole); @@ -1983,48 +1987,35 @@ void D3D11PipelineStateViewer::highlightIABind(int slot) QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, 0.95f); - ui->iaLayouts->model()->blockSignals(true); - ui->iaBuffers->model()->blockSignals(true); + ui->iaLayouts->beginUpdate(); + ui->iaBuffers->beginUpdate(); + if(slot < m_VBNodes.count()) { - QTreeWidgetItem *item = m_VBNodes[(int)slot]; + RDTreeWidgetItem *item = m_VBNodes[(int)slot]; - for(int c = 0; c < item->columnCount(); c++) - { - item->setBackground(c, QBrush(col)); - item->setForeground(c, QBrush(QColor(0, 0, 0))); - } + item->setBackgroundColor(col); + item->setForegroundColor(QColor(0, 0, 0)); } for(int i = 0; i < ui->iaLayouts->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->iaLayouts->topLevelItem(i); - - QBrush itemBrush = QBrush(col); + RDTreeWidgetItem *item = ui->iaLayouts->topLevelItem(i); if((int)IA.layouts[i].InputSlot != slot) - itemBrush = QBrush(); - - for(int c = 0; c < item->columnCount(); c++) { - item->setBackground(c, itemBrush); - item->setForeground(c, QBrush(QColor(0, 0, 0))); + item->setBackground(QBrush()); + item->setForeground(QBrush()); + } + else + { + item->setBackgroundColor(col); + item->setForegroundColor(QColor(0, 0, 0)); } } - ui->iaLayouts->model()->blockSignals(false); - ui->iaBuffers->model()->blockSignals(false); - if(ui->iaLayouts->topLevelItemCount() > 0) - { - ui->iaLayouts->topLevelItem(0)->setDisabled(true); - ui->iaLayouts->topLevelItem(0)->setDisabled(false); - } - - if(ui->iaBuffers->topLevelItemCount() > 0) - { - ui->iaBuffers->topLevelItem(0)->setDisabled(true); - ui->iaBuffers->topLevelItem(0)->setDisabled(false); - } + ui->iaLayouts->endUpdate(); + ui->iaBuffers->endUpdate(); } void D3D11PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) @@ -2054,12 +2045,10 @@ void D3D11PipelineStateViewer::on_iaBuffers_mouseMove(QMouseEvent *e) if(!m_Ctx.LogLoaded()) return; - QTreeWidgetItem *item = ui->iaBuffers->itemAt(e->pos()); + RDTreeWidgetItem *item = ui->iaBuffers->itemAt(e->pos()); vertex_leave(NULL); - ui->iaLayouts->model()->blockSignals(true); - ui->iaBuffers->model()->blockSignals(true); if(item) { int idx = m_VBNodes.indexOf(item); @@ -2069,27 +2058,10 @@ void D3D11PipelineStateViewer::on_iaBuffers_mouseMove(QMouseEvent *e) } else { - for(int c = 0; c < item->columnCount(); c++) - { - item->setBackground(c, QBrush(ui->iaBuffers->palette().color(QPalette::Window))); - item->setForeground(c, QBrush()); - } + item->setBackground(ui->iaBuffers->palette().brush(QPalette::Window)); + item->setForeground(QBrush()); } } - ui->iaLayouts->model()->blockSignals(false); - ui->iaBuffers->model()->blockSignals(false); - - if(ui->iaLayouts->topLevelItemCount() > 0) - { - ui->iaLayouts->topLevelItem(0)->setDisabled(true); - ui->iaLayouts->topLevelItem(0)->setDisabled(false); - } - - if(ui->iaBuffers->topLevelItemCount() > 0) - { - ui->iaBuffers->topLevelItem(0)->setDisabled(true); - ui->iaBuffers->topLevelItem(0)->setDisabled(false); - } } void D3D11PipelineStateViewer::on_pipeFlow_stageSelected(int index) @@ -2099,41 +2071,27 @@ void D3D11PipelineStateViewer::on_pipeFlow_stageSelected(int index) void D3D11PipelineStateViewer::vertex_leave(QEvent *e) { - ui->iaLayouts->model()->blockSignals(true); - ui->iaBuffers->model()->blockSignals(true); + ui->iaLayouts->beginUpdate(); + ui->iaBuffers->beginUpdate(); + for(int i = 0; i < ui->iaLayouts->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->iaLayouts->topLevelItem(i); - for(int c = 0; c < item->columnCount(); c++) - { - item->setBackground(c, QBrush()); - item->setForeground(c, QBrush()); - } + RDTreeWidgetItem *item = ui->iaLayouts->topLevelItem(i); + + item->setBackground(QBrush()); + item->setForeground(QBrush()); } for(int i = 0; i < ui->iaBuffers->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->iaBuffers->topLevelItem(i); - for(int c = 0; c < item->columnCount(); c++) - { - item->setBackground(c, QBrush()); - item->setForeground(c, QBrush()); - } - } - ui->iaLayouts->model()->blockSignals(false); - ui->iaBuffers->model()->blockSignals(false); + RDTreeWidgetItem *item = ui->iaBuffers->topLevelItem(i); - if(ui->iaLayouts->topLevelItemCount() > 0) - { - ui->iaLayouts->topLevelItem(0)->setDisabled(true); - ui->iaLayouts->topLevelItem(0)->setDisabled(false); + item->setBackground(QBrush()); + item->setForeground(QBrush()); } - if(ui->iaBuffers->topLevelItemCount() > 0) - { - ui->iaBuffers->topLevelItem(0)->setDisabled(true); - ui->iaBuffers->topLevelItem(0)->setDisabled(false); - } + ui->iaLayouts->endUpdate(); + ui->iaBuffers->endUpdate(); } void D3D11PipelineStateViewer::shaderView_clicked() diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h index d36fb090c..91b091a25 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h @@ -33,7 +33,7 @@ class D3D11PipelineStateViewer; } class RDTreeWidget; -class QTreeWidgetItem; +class RDTreeWidgetItem; struct ViewTag; class PipelineStateViewer; @@ -58,8 +58,8 @@ private slots: void on_showEmpty_toggled(bool checked); void on_exportHTML_clicked(); void on_meshView_clicked(); - void on_iaLayouts_itemActivated(QTreeWidgetItem *item, int column); - void on_iaBuffers_itemActivated(QTreeWidgetItem *item, int column); + void on_iaLayouts_itemActivated(RDTreeWidgetItem *item, int column); + void on_iaBuffers_itemActivated(RDTreeWidgetItem *item, int column); void on_iaLayouts_mouseMove(QMouseEvent *event); void on_iaBuffers_mouseMove(QMouseEvent *event); void on_pipeFlow_stageSelected(int index); @@ -69,8 +69,8 @@ private slots: void shaderEdit_clicked(); void shaderSave_clicked(); - void resource_itemActivated(QTreeWidgetItem *item, int column); - void cbuffer_itemActivated(QTreeWidgetItem *item, int column); + void resource_itemActivated(RDTreeWidgetItem *item, int column); + void cbuffer_itemActivated(RDTreeWidgetItem *item, int column); void vertex_leave(QEvent *e); private: @@ -89,8 +89,8 @@ private: void setState(); void clearState(); - void setInactiveRow(QTreeWidgetItem *node); - void setEmptyRow(QTreeWidgetItem *node); + void setInactiveRow(RDTreeWidgetItem *node); + void setEmptyRow(RDTreeWidgetItem *node); void highlightIABind(int slot); QString formatMembers(int indent, const QString &nameprefix, @@ -100,11 +100,11 @@ private: bool HasImportantViewParams(const D3D11Pipe::View &view, TextureDescription *tex); bool HasImportantViewParams(const D3D11Pipe::View &view, BufferDescription *buf); - void setViewDetails(QTreeWidgetItem *node, const ViewTag &view, TextureDescription *tex); - void setViewDetails(QTreeWidgetItem *node, const ViewTag &view, BufferDescription *buf); + void setViewDetails(RDTreeWidgetItem *node, const ViewTag &view, TextureDescription *tex); + void setViewDetails(RDTreeWidgetItem *node, const ViewTag &view, BufferDescription *buf); bool showNode(bool usedSlot, bool filledSlot); // keep track of the VB nodes (we want to be able to highlight them easily on hover) - QList m_VBNodes; + QList m_VBNodes; }; diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.ui b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.ui index 1e8164ba7..95df3e554 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.ui +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.ui @@ -1,4 +1,4 @@ - + D3D11PipelineStateViewer @@ -269,36 +269,6 @@ false - - - Slot - - - - - Buffer - - - - - Offset - - - - - Stride - - - - - Byte Length - - - - - Go - - @@ -363,51 +333,6 @@ false - - - Slot - - - - - Semantic - - - - - Index - - - - - Format - - - - - Input Slot - - - - - Offset - - - - - Class - - - - - Step Rate - - - - - Go - - @@ -797,51 +722,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -897,31 +777,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -977,31 +832,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Vec4 Range - - - - - Size - - - - - Go - - @@ -1057,21 +887,6 @@ padding: 0px; false - - - Slot - - - - - Interface - - - - - Instance - - @@ -1270,51 +1085,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -1370,31 +1140,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -1450,31 +1195,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Vec4 Range - - - - - Size - - - - - Go - - @@ -1530,21 +1250,6 @@ padding: 0px; false - - - Slot - - - - - Interface - - - - - Instance - - @@ -1743,51 +1448,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -1843,31 +1503,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -1923,31 +1558,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Vec4 Range - - - - - Size - - - - - Go - - @@ -2003,21 +1613,6 @@ padding: 0px; false - - - Slot - - - - - Interface - - - - - Instance - - @@ -2216,51 +1811,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -2316,31 +1866,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -2398,31 +1923,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Vec4 Range - - - - - Size - - - - - Go - - @@ -2478,31 +1978,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Length - - - - - Offset - - - - - Go - - @@ -2560,21 +2035,6 @@ padding: 0px; false - - - Slot - - - - - Interface - - - - - Instance - - @@ -2624,7 +2084,7 @@ padding: 0px; 2 - + QFrame::Box @@ -2652,36 +2112,6 @@ padding: 0px; 50 - - - Slot - - - - - X - - - - - Y - - - - - Width - - - - - Height - - - - - Enabled - - @@ -3092,7 +2522,7 @@ padding: 0px; 2 - + QFrame::Box @@ -3120,41 +2550,6 @@ padding: 0px; 50 - - - Slot - - - - - X - - - - - Y - - - - - Width - - - - - Height - - - - - MinDepth - - - - - MaxDepth - - @@ -3353,51 +2748,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -3453,31 +2803,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -3533,31 +2858,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Vec4 Range - - - - - Size - - - - - Go - - @@ -3613,21 +2913,6 @@ padding: 0px; false - - - Slot - - - - - Interface - - - - - Instance - - @@ -3821,51 +3106,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -4040,7 +3280,7 @@ padding: 0px; 2 - + QFrame::Box @@ -4074,61 +3314,6 @@ padding: 0px; false - - - Slot - - - - - Enabled - - - - - Logic - - - - - Colour Src - - - - - Colour Dst - - - - - Colour Op - - - - - Alpha Src - - - - - Alpha Dst - - - - - Alpha Op - - - - - Logic Op - - - - - Write Mask - - @@ -4292,7 +3477,7 @@ padding: 0px; - + 0 @@ -4344,31 +3529,6 @@ padding: 0px; false - - - Face - - - - - Func - - - - - Fail Op - - - - - Depth Fail Op - - - - - Pass Op - - @@ -4619,51 +3779,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -4719,51 +3834,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -4819,31 +3889,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -4899,31 +3944,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Vec4 Range - - - - - Size - - - - - Go - - @@ -4979,21 +3999,6 @@ padding: 0px; false - - - Slot - - - - - Interface - - - - - Instance - - @@ -5008,7 +4013,7 @@ padding: 0px; RDTreeWidget - QTreeWidget + QTreeView
Widgets/Extended/RDTreeWidget.h
@@ -5027,4 +4032,4 @@ padding: 0px; -
+ \ No newline at end of file diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp index 83bbb2cef..484db2117 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp @@ -100,6 +100,9 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, { ui->setupUi(this); + const QIcon &action = Icons::action(); + const QIcon &action_hover = Icons::action_hover(); + RDLabel *shaderLabels[] = { ui->vsShader, ui->hsShader, ui->dsShader, ui->gsShader, ui->psShader, ui->csShader, }; @@ -175,9 +178,10 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, addGridLines(ui->blendStateGridLayout); addGridLines(ui->depthStateGridLayout); - // no way to set this up in the UI :( { - // Slot | Semantic | Index | Format | Input Slot | Offset | Class | Step Rate | Go + ui->iaLayouts->setColumns({tr("Slot"), tr("Semantic"), tr("Index"), tr("Format"), + tr("Input Slot"), tr("Offset"), tr("Class"), tr("Step Rate"), + tr("Go")}); ui->iaLayouts->header()->resizeSection(0, 75); ui->iaLayouts->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->iaLayouts->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -189,11 +193,13 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, ui->iaLayouts->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->iaLayouts->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); - ui->iaLayouts->setHoverIconColumn(8); + ui->iaLayouts->setClearSelectionOnFocusLoss(true); + ui->iaLayouts->setHoverIconColumn(8, action, action_hover); } { - // Slot | Buffer | Stride | Offset | Byte Length | Go + ui->iaBuffers->setColumns( + {tr("Slot"), tr("Buffer"), tr("Stride"), tr("Offset"), tr("Byte Length"), tr("Go")}); ui->iaBuffers->header()->resizeSection(0, 75); ui->iaBuffers->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->iaBuffers->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -202,13 +208,15 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, ui->iaBuffers->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); ui->iaBuffers->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); - ui->iaBuffers->setHoverIconColumn(5); + ui->iaBuffers->setClearSelectionOnFocusLoss(true); + ui->iaBuffers->setHoverIconColumn(5, action, action_hover); } for(RDTreeWidget *res : resources) { - // Root Sig El | Space | Register | Resource | Type | Width | Height | Depth | Array Size | - // Format | Go + res->setColumns({tr("Root Sig El"), tr("Space"), tr("Register"), tr("Resource"), tr("Type"), + tr("Width"), tr("Height"), tr("Depth"), tr("Array Size"), tr("Format"), + tr("Go")}); res->header()->resizeSection(0, 100); res->header()->resizeSection(1, 40); res->header()->resizeSection(2, 120); @@ -224,14 +232,15 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, res->header()->setSectionResizeMode(9, QHeaderView::ResizeToContents); res->header()->setSectionResizeMode(10, QHeaderView::ResizeToContents); - res->setHoverIconColumn(10); - res->setDefaultHoverColor(ui->targetOutputs->palette().color(QPalette::Window)); + res->setHoverIconColumn(10, action, action_hover); + res->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *uav : uavs) { - // Root Sig El | Space | Register | Resource | Type | Width | Height | Depth | Array Size | - // Format | Go + uav->setColumns({tr("Root Sig El"), tr("Space"), tr("Register"), tr("Resource"), tr("Type"), + tr("Width"), tr("Height"), tr("Depth"), tr("Array Size"), tr("Format"), + tr("Go")}); uav->header()->resizeSection(0, 100); uav->header()->resizeSection(1, 40); uav->header()->resizeSection(2, 120); @@ -247,13 +256,14 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, uav->header()->setSectionResizeMode(9, QHeaderView::ResizeToContents); uav->header()->setSectionResizeMode(10, QHeaderView::ResizeToContents); - uav->setHoverIconColumn(10); - uav->setDefaultHoverColor(ui->targetOutputs->palette().color(QPalette::Window)); + uav->setHoverIconColumn(10, action, action_hover); + uav->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *samp : samplers) { - // Root Sig El | Space | Register | Addressing | Filter | LOD Clamp | LOD Bias + samp->setColumns({tr("Root Sig El"), tr("Space"), tr("Register"), tr("Addressing"), + tr("Filter"), tr("LOD Clamp"), tr("LOD Bias")}); samp->header()->resizeSection(0, 100); samp->header()->resizeSection(1, 40); samp->header()->resizeSection(2, 120); @@ -264,11 +274,14 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, samp->header()->setSectionResizeMode(4, QHeaderView::Stretch); samp->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); samp->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); + + samp->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *cbuffer : cbuffers) { - // Root Sig El | Space | Register | Buffer | Byte Range | Size | Go + cbuffer->setColumns({tr("Root Sig El"), tr("Space"), tr("Register"), tr("Buffer"), + tr("Byte Range"), tr("Size"), tr("Go")}); cbuffer->header()->resizeSection(0, 100); cbuffer->header()->resizeSection(1, 40); cbuffer->header()->resizeSection(2, 120); @@ -280,12 +293,13 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, cbuffer->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); cbuffer->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); - cbuffer->setHoverIconColumn(6); - cbuffer->setDefaultHoverColor(ui->targetOutputs->palette().color(QPalette::Window)); + cbuffer->setHoverIconColumn(6, action, action_hover); + cbuffer->setClearSelectionOnFocusLoss(true); } { - // Slot | X | Y | Width | Height | MinDepth | MaxDepth + ui->viewports->setColumns( + {tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"), tr("MinDepth"), tr("MaxDepth")}); ui->viewports->header()->resizeSection(0, 75); ui->viewports->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->viewports->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -294,20 +308,26 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, ui->viewports->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); ui->viewports->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ui->viewports->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); + + ui->viewports->setClearSelectionOnFocusLoss(true); } { - // Slot | X | Y | Width | Height + ui->scissors->setColumns({tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height")}); ui->scissors->header()->resizeSection(0, 100); ui->scissors->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->scissors->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(4, QHeaderView::Stretch); + + ui->scissors->setClearSelectionOnFocusLoss(true); } { - // Slot | Resource | Type | Width | Height | Depth | Array Size | Format | Go + ui->targetOutputs->setColumns({tr("Slot"), tr("Resource"), tr("Type"), tr("Width"), + tr("Height"), tr("Depth"), tr("Array Size"), tr("Format"), + tr("Go")}); ui->targetOutputs->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ui->targetOutputs->header()->setSectionResizeMode(1, QHeaderView::Stretch); ui->targetOutputs->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); @@ -318,12 +338,13 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, ui->targetOutputs->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->targetOutputs->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); - ui->targetOutputs->setHoverIconColumn(8); - ui->targetOutputs->setDefaultHoverColor(ui->targetOutputs->palette().color(QPalette::Window)); + ui->targetOutputs->setHoverIconColumn(8, action, action_hover); + ui->targetOutputs->setClearSelectionOnFocusLoss(true); } { - // Slot | Enabled | Col Src | Col Dst | Col Op | Alpha Src | Alpha Dst | Alpha Op | Write Mask + ui->blends->setColumns({tr("Slot"), tr("Enabled"), tr("Col Src"), tr("Col Dst"), tr("Col Op"), + tr("Alpha Src"), tr("Alpha Dst"), tr("Alpha Op"), tr("Write Mask")}); ui->blends->header()->resizeSection(0, 75); ui->blends->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->blends->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -334,16 +355,21 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx, ui->blends->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); ui->blends->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->blends->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); + + ui->blends->setClearSelectionOnFocusLoss(true); } { - // Face | Func | Fail Op | Depth Fail Op | Pass Op + ui->stencils->setColumns( + {tr("Face"), tr("Func"), tr("Fail Op"), tr("Depth Fail Op"), tr("Pass Op")}); ui->stencils->header()->resizeSection(0, 50); ui->stencils->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->stencils->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(4, QHeaderView::Stretch); + + ui->stencils->setClearSelectionOnFocusLoss(true); } // this is often changed just because we're changing some tab in the designer. @@ -399,21 +425,14 @@ void D3D12PipelineStateViewer::on_showEmpty_toggled(bool checked) { setState(); } - -void D3D12PipelineStateViewer::setInactiveRow(QTreeWidgetItem *node) +void D3D12PipelineStateViewer::setInactiveRow(RDTreeWidgetItem *node) { - for(int i = 0; i < node->columnCount(); i++) - { - QFont f = node->font(i); - f.setItalic(true); - node->setFont(i, f); - } + node->setItalic(true); } - -void D3D12PipelineStateViewer::setEmptyRow(QTreeWidgetItem *node) +void D3D12PipelineStateViewer::setEmptyRow(RDTreeWidgetItem *node) { - for(int i = 0; i < node->columnCount(); i++) - node->setBackgroundColor(i, QColor(255, 70, 70)); + node->setBackgroundColor(QColor(255, 70, 70)); + node->setForegroundColor(QColor(0, 0, 0)); } bool D3D12PipelineStateViewer::HasImportantViewParams(const D3D12Pipe::View &view, @@ -446,7 +465,7 @@ bool D3D12PipelineStateViewer::HasImportantViewParams(const D3D12Pipe::View &vie return false; } -void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewTag &view, +void D3D12PipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, const ViewTag &view, TextureDescription *tex) { if(tex == NULL) @@ -515,19 +534,16 @@ void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT text = text.trimmed(); - for(int i = 0; i < node->columnCount(); i++) - { - node->setToolTip(i, text); + node->setToolTip(text); - if(viewdetails) - { - node->setBackgroundColor(i, QColor(127, 255, 212)); - node->setForeground(i, QBrush(QColor(0, 0, 0))); - } + if(viewdetails) + { + node->setBackgroundColor(QColor(127, 255, 212)); + node->setForegroundColor(QColor(0, 0, 0)); } } -void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewTag &view, +void D3D12PipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, const ViewTag &view, BufferDescription *buf) { if(buf == NULL) @@ -563,24 +579,18 @@ void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT text = text.trimmed(); - for(int i = 0; i < node->columnCount(); i++) - { - node->setToolTip(i, text); + node->setToolTip(text); - if(viewdetails) - { - node->setBackgroundColor(i, QColor(127, 255, 212)); - node->setForeground(i, QBrush(QColor(0, 0, 0))); - } + if(viewdetails) + { + node->setBackgroundColor(QColor(127, 255, 212)); + node->setForegroundColor(QColor(0, 0, 0)); } } void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, const D3D12Pipe::Shader *stage, RDTreeWidget *resources) { - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - const D3D12Pipe::View &r = view.res; bool uav = view.type == ViewTag::UAV; @@ -724,12 +734,10 @@ void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, const D3D12Pi viewDetails = true; } - QTreeWidgetItem *node = - makeTreeNode({rootel, view.space, regname, name, typeName, w, h, d, a, format, ""}); - node->setData(0, Qt::UserRole, QVariant::fromValue(view)); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({rootel, view.space, regname, name, typeName, w, h, d, a, format, ""}); - resources->setHoverIcons(node, action, action_hover); if(viewDetails) { @@ -1028,11 +1036,11 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12Pipe::Shader &stage, QL else if(s.Filter.func != FilterFunc::Normal) filter += QString(" (%1)").arg(ToQStr(s.Filter.func)); - QTreeWidgetItem *node = - makeTreeNode({rootel, space, regname, addressing, filter, - (s.MinLOD == -FLT_MAX ? "0" : QString::number(s.MinLOD)) + " - " + - (s.MaxLOD == FLT_MAX ? "FLT_MAX" : QString::number(s.MaxLOD)), - s.MipLODBias}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({rootel, space, regname, addressing, filter, + (s.MinLOD == -FLT_MAX ? "0" : QString::number(s.MinLOD)) + " - " + + (s.MaxLOD == FLT_MAX ? "FLT_MAX" : QString::number(s.MaxLOD)), + s.MipLODBias}); if(!filledSlot) setEmptyRow(node); @@ -1143,7 +1151,7 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12Pipe::Shader &stage, QL if(length < bytesize) filledSlot = false; - QTreeWidgetItem *node = makeTreeNode( + RDTreeWidgetItem *node = new RDTreeWidgetItem( {rootel, (qulonglong)space, regname, name, (qulonglong)offset, sizestr, ""}); node->setData(0, Qt::UserRole, tag); @@ -1177,9 +1185,6 @@ void D3D12PipelineStateViewer::setState() const QPixmap &tick = Pixmaps::tick(); const QPixmap &cross = Pixmaps::cross(); - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - //////////////////////////////////////////////// // Vertex Input @@ -1225,15 +1230,13 @@ void D3D12PipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QTreeWidgetItem *node = makeTreeNode( + RDTreeWidgetItem *node = new RDTreeWidgetItem( {i, ToQStr(l.SemanticName), l.SemanticIndex, ToQStr(l.Format.strname), l.InputSlot, byteOffs, l.PerInstance ? "PER_INSTANCE" : "PER_VERTEX", l.InstanceDataStepRate, ""}); if(usedSlot) usedVBuffers[l.InputSlot] = true; - ui->iaLayouts->setHoverIcons(node, action, action_hover); - if(!usedSlot) setInactiveRow(node); @@ -1305,11 +1308,9 @@ void D3D12PipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = - makeTreeNode({"Index", name, draw ? draw->indexByteWidth : 0, - (qulonglong)state.m_IA.ibuffer.Offset, (qulonglong)length, ""}); - - ui->iaBuffers->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({"Index", name, draw ? draw->indexByteWidth : 0, + (qulonglong)state.m_IA.ibuffer.Offset, (qulonglong)length, ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(state.m_IA.ibuffer.Buffer, draw ? draw->indexOffset : 0))); @@ -1327,9 +1328,8 @@ void D3D12PipelineStateViewer::setState() { if(ibufferUsed || ui->showEmpty->isChecked()) { - QTreeWidgetItem *node = makeTreeNode({"Index", tr("No Buffer Set"), "-", "-", "-", ""}); - - ui->iaBuffers->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({"Index", tr("No Buffer Set"), "-", "-", "-", ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(state.m_IA.ibuffer.Buffer, draw ? draw->indexOffset : 0))); @@ -1370,14 +1370,12 @@ void D3D12PipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = NULL; + RDTreeWidgetItem *node = NULL; if(filledSlot) - node = makeTreeNode({i, name, v.Stride, (qulonglong)v.Offset, length, ""}); + node = new RDTreeWidgetItem({i, name, v.Stride, (qulonglong)v.Offset, length, ""}); else - node = makeTreeNode({i, "No Buffer Set", "-", "-", "-", ""}); - - ui->iaBuffers->setHoverIcons(node, action, action_hover); + node = new RDTreeWidgetItem({i, "No Buffer Set", "-", "-", "-", ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(v.Buffer, v.Offset))); @@ -1439,9 +1437,7 @@ void D3D12PipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = makeTreeNode({i, name, length, (qulonglong)s.Offset, ""}); - - ui->gsStreamOut->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = new RDTreeWidgetItem({i, name, length, (qulonglong)s.Offset, ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(s.Buffer)); @@ -1471,7 +1467,8 @@ void D3D12PipelineStateViewer::setState() { const D3D12Pipe::Viewport &v = state.m_RS.Viewports[i]; - QTreeWidgetItem *node = makeTreeNode({i, v.X, v.Y, v.Width, v.Height, v.MinDepth, v.MaxDepth}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({i, v.X, v.Y, v.Width, v.Height, v.MinDepth, v.MaxDepth}); if(v.Width == 0 || v.Height == 0 || v.MinDepth == v.MaxDepth) setEmptyRow(node); @@ -1489,7 +1486,8 @@ void D3D12PipelineStateViewer::setState() { const D3D12Pipe::Scissor &s = state.m_RS.Scissors[i]; - QTreeWidgetItem *node = makeTreeNode({i, s.left, s.top, s.right - s.left, s.bottom - s.top}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({i, s.left, s.top, s.right - s.left, s.bottom - s.top}); if(s.right == s.left || s.bottom == s.top) setEmptyRow(node); @@ -1550,25 +1548,25 @@ void D3D12PipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QTreeWidgetItem *node = NULL; + RDTreeWidgetItem *node = NULL; - node = - makeTreeNode({i, blend.Enabled ? tr("True") : tr("False"), - blend.LogicEnabled ? tr("True") : tr("False"), + node = new RDTreeWidgetItem({i, blend.Enabled ? tr("True") : tr("False"), + blend.LogicEnabled ? tr("True") : tr("False"), - ToQStr(blend.m_Blend.Source), ToQStr(blend.m_Blend.Destination), - ToQStr(blend.m_Blend.Operation), + ToQStr(blend.m_Blend.Source), ToQStr(blend.m_Blend.Destination), + ToQStr(blend.m_Blend.Operation), - ToQStr(blend.m_AlphaBlend.Source), ToQStr(blend.m_AlphaBlend.Destination), - ToQStr(blend.m_AlphaBlend.Operation), + ToQStr(blend.m_AlphaBlend.Source), + ToQStr(blend.m_AlphaBlend.Destination), + ToQStr(blend.m_AlphaBlend.Operation), - ToQStr(blend.Logic), + ToQStr(blend.Logic), - QString("%1%2%3%4") - .arg((blend.WriteMask & 0x1) == 0 ? "_" : "R") - .arg((blend.WriteMask & 0x2) == 0 ? "_" : "G") - .arg((blend.WriteMask & 0x4) == 0 ? "_" : "B") - .arg((blend.WriteMask & 0x8) == 0 ? "_" : "A")}); + QString("%1%2%3%4") + .arg((blend.WriteMask & 0x1) == 0 ? "_" : "R") + .arg((blend.WriteMask & 0x2) == 0 ? "_" : "G") + .arg((blend.WriteMask & 0x4) == 0 ? "_" : "B") + .arg((blend.WriteMask & 0x8) == 0 ? "_" : "A")}); if(!filledSlot) setEmptyRow(node); @@ -1609,14 +1607,15 @@ void D3D12PipelineStateViewer::setState() ui->stencils->setUpdatesEnabled(false); ui->stencils->clear(); - ui->stencils->addTopLevelItems({makeTreeNode({"Front", ToQStr(state.m_OM.m_State.m_FrontFace.Func), - ToQStr(state.m_OM.m_State.m_FrontFace.FailOp), - ToQStr(state.m_OM.m_State.m_FrontFace.DepthFailOp), - ToQStr(state.m_OM.m_State.m_FrontFace.PassOp)}), - makeTreeNode({"Back", ToQStr(state.m_OM.m_State.m_BackFace.Func), - ToQStr(state.m_OM.m_State.m_BackFace.FailOp), - ToQStr(state.m_OM.m_State.m_BackFace.DepthFailOp), - ToQStr(state.m_OM.m_State.m_BackFace.PassOp)})}); + ui->stencils->addTopLevelItem( + new RDTreeWidgetItem({"Front", ToQStr(state.m_OM.m_State.m_FrontFace.Func), + ToQStr(state.m_OM.m_State.m_FrontFace.FailOp), + ToQStr(state.m_OM.m_State.m_FrontFace.DepthFailOp), + ToQStr(state.m_OM.m_State.m_FrontFace.PassOp)})); + ui->stencils->addTopLevelItem(new RDTreeWidgetItem( + {"Back", ToQStr(state.m_OM.m_State.m_BackFace.Func), + ToQStr(state.m_OM.m_State.m_BackFace.FailOp), ToQStr(state.m_OM.m_State.m_BackFace.DepthFailOp), + ToQStr(state.m_OM.m_State.m_BackFace.PassOp)})); ui->stencils->clearSelection(); ui->stencils->setUpdatesEnabled(true); @@ -1672,7 +1671,7 @@ QString D3D12PipelineStateViewer::formatMembers(int indent, const QString &namep return ret; } -void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int column) +void D3D12PipelineStateViewer::resource_itemActivated(RDTreeWidgetItem *item, int column) { const D3D12Pipe::Shader *stage = stageForSender(item->treeWidget()); @@ -1882,7 +1881,7 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int } } -void D3D12PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int column) +void D3D12PipelineStateViewer::cbuffer_itemActivated(RDTreeWidgetItem *item, int column) { const D3D12Pipe::Shader *stage = stageForSender(item->treeWidget()); @@ -1913,12 +1912,12 @@ void D3D12PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int m_Ctx.AddDockWindow(prev->Widget(), DockReference::RightOf, this, 0.3f); } -void D3D12PipelineStateViewer::on_iaLayouts_itemActivated(QTreeWidgetItem *item, int column) +void D3D12PipelineStateViewer::on_iaLayouts_itemActivated(RDTreeWidgetItem *item, int column) { on_meshView_clicked(); } -void D3D12PipelineStateViewer::on_iaBuffers_itemActivated(QTreeWidgetItem *item, int column) +void D3D12PipelineStateViewer::on_iaBuffers_itemActivated(RDTreeWidgetItem *item, int column) { QVariant tag = item->data(0, Qt::UserRole); @@ -1943,48 +1942,33 @@ void D3D12PipelineStateViewer::highlightIABind(int slot) QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, 0.95f); - ui->iaLayouts->model()->blockSignals(true); - ui->iaBuffers->model()->blockSignals(true); + ui->iaLayouts->beginUpdate(); + ui->iaBuffers->beginUpdate(); + if(slot < m_VBNodes.count()) { - QTreeWidgetItem *item = m_VBNodes[(int)slot]; - - for(int c = 0; c < item->columnCount(); c++) - { - item->setBackground(c, QBrush(col)); - item->setForeground(c, QBrush(QColor(0, 0, 0))); - } + m_VBNodes[slot]->setBackgroundColor(col); + m_VBNodes[slot]->setForegroundColor(QColor(0, 0, 0)); } for(int i = 0; i < ui->iaLayouts->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->iaLayouts->topLevelItem(i); - - QBrush itemBrush = QBrush(col); + RDTreeWidgetItem *item = ui->iaLayouts->topLevelItem(i); if((int)IA.layouts[i].InputSlot != slot) - itemBrush = QBrush(); - - for(int c = 0; c < item->columnCount(); c++) { - item->setBackground(c, itemBrush); - item->setForeground(c, QBrush(QColor(0, 0, 0))); + item->setBackground(QBrush()); + item->setForeground(QBrush()); + } + else + { + item->setBackgroundColor(col); + item->setForegroundColor(QColor(0, 0, 0)); } } - ui->iaLayouts->model()->blockSignals(false); - ui->iaBuffers->model()->blockSignals(false); - if(ui->iaLayouts->topLevelItemCount() > 0) - { - ui->iaLayouts->topLevelItem(0)->setDisabled(true); - ui->iaLayouts->topLevelItem(0)->setDisabled(false); - } - - if(ui->iaBuffers->topLevelItemCount() > 0) - { - ui->iaBuffers->topLevelItem(0)->setDisabled(true); - ui->iaBuffers->topLevelItem(0)->setDisabled(false); - } + ui->iaLayouts->endUpdate(); + ui->iaBuffers->endUpdate(); } void D3D12PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) @@ -2014,12 +1998,10 @@ void D3D12PipelineStateViewer::on_iaBuffers_mouseMove(QMouseEvent *e) if(!m_Ctx.LogLoaded()) return; - QTreeWidgetItem *item = ui->iaBuffers->itemAt(e->pos()); + RDTreeWidgetItem *item = ui->iaBuffers->itemAt(e->pos()); vertex_leave(NULL); - ui->iaLayouts->model()->blockSignals(true); - ui->iaBuffers->model()->blockSignals(true); if(item) { int idx = m_VBNodes.indexOf(item); @@ -2029,66 +2011,35 @@ void D3D12PipelineStateViewer::on_iaBuffers_mouseMove(QMouseEvent *e) } else { - for(int c = 0; c < item->columnCount(); c++) - { - item->setBackground(c, QBrush(ui->iaBuffers->palette().color(QPalette::Window))); - item->setForeground(c, QBrush()); - } + item->setBackground(ui->iaBuffers->palette().brush(QPalette::Window)); + item->setForeground(ui->iaBuffers->palette().brush(QPalette::WindowText)); } } - ui->iaLayouts->model()->blockSignals(false); - ui->iaBuffers->model()->blockSignals(false); - - if(ui->iaLayouts->topLevelItemCount() > 0) - { - ui->iaLayouts->topLevelItem(0)->setDisabled(true); - ui->iaLayouts->topLevelItem(0)->setDisabled(false); - } - - if(ui->iaBuffers->topLevelItemCount() > 0) - { - ui->iaBuffers->topLevelItem(0)->setDisabled(true); - ui->iaBuffers->topLevelItem(0)->setDisabled(false); - } } void D3D12PipelineStateViewer::vertex_leave(QEvent *e) { - ui->iaLayouts->model()->blockSignals(true); - ui->iaBuffers->model()->blockSignals(true); + ui->iaLayouts->beginUpdate(); + ui->iaBuffers->beginUpdate(); + for(int i = 0; i < ui->iaLayouts->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->iaLayouts->topLevelItem(i); - for(int c = 0; c < item->columnCount(); c++) - { - item->setBackground(c, QBrush()); - item->setForeground(c, QBrush()); - } + RDTreeWidgetItem *item = ui->iaLayouts->topLevelItem(i); + + item->setBackground(QBrush()); + item->setForeground(QBrush()); } for(int i = 0; i < ui->iaBuffers->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->iaBuffers->topLevelItem(i); - for(int c = 0; c < item->columnCount(); c++) - { - item->setBackground(c, QBrush()); - item->setForeground(c, QBrush()); - } - } - ui->iaLayouts->model()->blockSignals(false); - ui->iaBuffers->model()->blockSignals(false); + RDTreeWidgetItem *item = ui->iaBuffers->topLevelItem(i); - if(ui->iaLayouts->topLevelItemCount() > 0) - { - ui->iaLayouts->topLevelItem(0)->setDisabled(true); - ui->iaLayouts->topLevelItem(0)->setDisabled(false); + item->setBackground(QBrush()); + item->setForeground(QBrush()); } - if(ui->iaBuffers->topLevelItemCount() > 0) - { - ui->iaBuffers->topLevelItem(0)->setDisabled(true); - ui->iaBuffers->topLevelItem(0)->setDisabled(false); - } + ui->iaLayouts->endUpdate(); + ui->iaBuffers->endUpdate(); } void D3D12PipelineStateViewer::on_pipeFlow_stageSelected(int index) diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h index 2ef07a152..65917ca99 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h @@ -33,7 +33,7 @@ class D3D12PipelineStateViewer; } class RDTreeWidget; -class QTreeWidgetItem; +class RDTreeWidgetItem; struct ViewTag; class PipelineStateViewer; @@ -58,8 +58,8 @@ private slots: void on_showEmpty_toggled(bool checked); void on_exportHTML_clicked(); void on_meshView_clicked(); - void on_iaLayouts_itemActivated(QTreeWidgetItem *item, int column); - void on_iaBuffers_itemActivated(QTreeWidgetItem *item, int column); + void on_iaLayouts_itemActivated(RDTreeWidgetItem *item, int column); + void on_iaBuffers_itemActivated(RDTreeWidgetItem *item, int column); void on_iaLayouts_mouseMove(QMouseEvent *event); void on_iaBuffers_mouseMove(QMouseEvent *event); void on_pipeFlow_stageSelected(int index); @@ -68,8 +68,8 @@ private slots: void shaderView_clicked(); void shaderEdit_clicked(); void shaderSave_clicked(); - void resource_itemActivated(QTreeWidgetItem *item, int column); - void cbuffer_itemActivated(QTreeWidgetItem *item, int column); + void resource_itemActivated(RDTreeWidgetItem *item, int column); + void cbuffer_itemActivated(RDTreeWidgetItem *item, int column); void vertex_leave(QEvent *e); private: @@ -87,8 +87,8 @@ private: void setState(); void clearState(); - void setInactiveRow(QTreeWidgetItem *node); - void setEmptyRow(QTreeWidgetItem *node); + void setInactiveRow(RDTreeWidgetItem *node); + void setEmptyRow(RDTreeWidgetItem *node); void highlightIABind(int slot); QString formatMembers(int indent, const QString &nameprefix, @@ -98,11 +98,11 @@ private: bool HasImportantViewParams(const D3D12Pipe::View &view, TextureDescription *tex); bool HasImportantViewParams(const D3D12Pipe::View &view, BufferDescription *buf); - void setViewDetails(QTreeWidgetItem *node, const ViewTag &view, TextureDescription *tex); - void setViewDetails(QTreeWidgetItem *node, const ViewTag &view, BufferDescription *buf); + void setViewDetails(RDTreeWidgetItem *node, const ViewTag &view, TextureDescription *tex); + void setViewDetails(RDTreeWidgetItem *node, const ViewTag &view, BufferDescription *buf); bool showNode(bool usedSlot, bool filledSlot); // keep track of the VB nodes (we want to be able to highlight them easily on hover) - QList m_VBNodes; + QList m_VBNodes; }; diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.ui b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.ui index e83090094..40e216a32 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.ui +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.ui @@ -1,4 +1,4 @@ - + D3D12PipelineStateViewer @@ -269,36 +269,6 @@ false - - - Slot - - - - - Buffer - - - - - Offset - - - - - Stride - - - - - Byte Length - - - - - Go - - @@ -363,51 +333,6 @@ false - - - Slot - - - - - Semantic - - - - - Index - - - - - Format - - - - - Input Slot - - - - - Offset - - - - - Class - - - - - Step Rate - - - - - Go - - @@ -714,61 +639,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -824,61 +694,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -934,41 +749,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -1024,41 +804,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Buffer - - - - - Byte Offset - - - - - Size - - - - - Go - - @@ -1257,61 +1002,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -1367,61 +1057,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -1477,41 +1112,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -1567,41 +1167,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Buffer - - - - - Byte Offset - - - - - Size - - - - - Go - - @@ -1800,61 +1365,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -1910,61 +1420,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -2020,41 +1475,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -2110,41 +1530,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Buffer - - - - - Byte Offset - - - - - Size - - - - - Go - - @@ -2343,61 +1728,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -2453,61 +1783,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -2563,41 +1838,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -2655,41 +1895,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Buffer - - - - - Byte Offset - - - - - Size - - - - - Go - - @@ -2745,31 +1950,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Length - - - - - Offset - - - - - Go - - @@ -2821,7 +2001,7 @@ padding: 0px; 2 - + QFrame::Box @@ -2849,36 +2029,6 @@ padding: 0px; 50 - - - Slot - - - - - X - - - - - Y - - - - - Width - - - - - Height - - - - - Enabled - - @@ -3291,7 +2441,7 @@ padding: 0px; 2 - + QFrame::Box @@ -3319,41 +2469,6 @@ padding: 0px; 50 - - - Slot - - - - - X - - - - - Y - - - - - Width - - - - - Height - - - - - MinDepth - - - - - MaxDepth - - @@ -3552,61 +2667,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -3662,61 +2722,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -3772,41 +2777,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -3862,41 +2832,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Buffer - - - - - Byte Offset - - - - - Size - - - - - Go - - @@ -4090,51 +3025,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -4281,7 +3171,7 @@ padding: 0px; 2 - + QFrame::Box @@ -4315,61 +3205,6 @@ padding: 0px; false - - - Slot - - - - - Enabled - - - - - Logic - - - - - Colour Src - - - - - Colour Dst - - - - - Colour Op - - - - - Alpha Src - - - - - Alpha Dst - - - - - Alpha Op - - - - - Logic Op - - - - - Write Mask - - @@ -4533,7 +3368,7 @@ padding: 0px; - + 0 @@ -4585,31 +3420,6 @@ padding: 0px; false - - - Face - - - - - Func - - - - - Fail Op - - - - - Depth Fail Op - - - - - Pass Op - - @@ -4860,61 +3670,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -4970,61 +3725,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -5080,41 +3780,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - Mip Bias - - @@ -5170,41 +3835,6 @@ padding: 0px; false - - - Root Sig Idx - - - - - Space - - - - - Register - - - - - Buffer - - - - - Byte Offset - - - - - Size - - - - - Go - - @@ -5219,7 +3849,7 @@ padding: 0px; RDTreeWidget - QTreeWidget + QTreeView
Widgets/Extended/RDTreeWidget.h
diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index 0472367c0..8e5bbb19f 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -76,6 +76,9 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState { ui->setupUi(this); + const QIcon &action = Icons::action(); + const QIcon &action_hover = Icons::action_hover(); + RDLabel *shaderLabels[] = { ui->vsShader, ui->tcsShader, ui->tesShader, ui->gsShader, ui->fsShader, ui->csShader, }; @@ -154,9 +157,9 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState addGridLines(ui->blendStateGridLayout); addGridLines(ui->depthStateGridLayout); - // no way to set this up in the UI :( { - // Index | Enabled | Name | Format/Generic Value | Buffer Slot | Relative Offset | Go + ui->viAttrs->setColumns({tr("Index"), tr("Enabled"), tr("Name"), tr("Format/Generic Value"), + tr("Buffer Slot"), tr("Relative Offset"), tr("Go")}); ui->viAttrs->header()->resizeSection(0, 75); ui->viAttrs->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->viAttrs->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -166,11 +169,13 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState ui->viAttrs->header()->setSectionResizeMode(5, QHeaderView::Stretch); ui->viAttrs->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); - ui->viAttrs->setHoverIconColumn(6); + ui->viAttrs->setClearSelectionOnFocusLoss(true); + ui->viAttrs->setHoverIconColumn(6, action, action_hover); } { - // Slot | Buffer | Divisor | Offset | Stride | Byte Length | Go + ui->viBuffers->setColumns({tr("Slot"), tr("Buffer"), tr("Divisor"), tr("Offset"), tr("Stride"), + tr("Byte Length"), tr("Go")}); ui->viBuffers->header()->resizeSection(0, 75); ui->viBuffers->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->viBuffers->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -180,12 +185,14 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState ui->viBuffers->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ui->viBuffers->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); - ui->viBuffers->setHoverIconColumn(6); + ui->viBuffers->setClearSelectionOnFocusLoss(true); + ui->viBuffers->setHoverIconColumn(6, action, action_hover); } for(RDTreeWidget *tex : textures) { - // Slot | Resource | Type | Width | Height | Depth | Array Size | Format | Go + tex->setColumns({tr("Slot"), tr("Resource"), tr("Type"), tr("Width"), tr("Height"), tr("Depth"), + tr("Array Size"), tr("Format"), tr("Go")}); tex->header()->resizeSection(0, 120); tex->header()->setSectionResizeMode(0, QHeaderView::Interactive); tex->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -197,24 +204,26 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState tex->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); tex->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); - tex->setHoverIconColumn(8); - tex->setDefaultHoverColor(ui->framebuffer->palette().color(QPalette::Window)); + tex->setHoverIconColumn(8, action, action_hover); + tex->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *samp : samplers) { - // Slot | Addressing | Filter | LOD Clamp | LOD Bias + samp->setColumns({tr("Slot"), tr("Addressing"), tr("Filter"), tr("LOD Clamp"), tr("LOD Bias")}); samp->header()->resizeSection(0, 120); samp->header()->setSectionResizeMode(0, QHeaderView::Interactive); samp->header()->setSectionResizeMode(1, QHeaderView::Stretch); samp->header()->setSectionResizeMode(2, QHeaderView::Stretch); samp->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); samp->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); + + samp->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *ubo : ubos) { - // Slot | Buffer | Byte Range | Size | Go + ubo->setColumns({tr("Slot"), tr("Buffer"), tr("Byte Range"), tr("Size"), tr("Go")}); ubo->header()->resizeSection(0, 120); ubo->header()->setSectionResizeMode(0, QHeaderView::Interactive); ubo->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -222,21 +231,24 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState ubo->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); ubo->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); - ubo->setHoverIconColumn(4); - ubo->setDefaultHoverColor(ui->framebuffer->palette().color(QPalette::Window)); + ubo->setHoverIconColumn(4, action, action_hover); + ubo->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *sub : subroutines) { - // Uniform | Value + sub->setColumns({tr("Uniform"), tr("Value")}); sub->header()->resizeSection(0, 120); sub->header()->setSectionResizeMode(0, QHeaderView::Interactive); sub->header()->setSectionResizeMode(1, QHeaderView::Stretch); + + sub->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *ubo : readwrites) { - // Binding | Slot | Resource | Dimensions | Format | Access | Go + ubo->setColumns({tr("Binding"), tr("Slot"), tr("Resource"), tr("Dimensions"), tr("Format"), + tr("Access"), tr("Go")}); ubo->header()->resizeSection(1, 120); ubo->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ubo->header()->setSectionResizeMode(1, QHeaderView::Interactive); @@ -246,12 +258,13 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState ubo->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ubo->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); - ubo->setHoverIconColumn(6); - ubo->setDefaultHoverColor(ui->framebuffer->palette().color(QPalette::Window)); + ubo->setHoverIconColumn(6, action, action_hover); + ubo->setClearSelectionOnFocusLoss(true); } { - // Slot | X | Y | Width | Height | MinDepth | MaxDepth + ui->viewports->setColumns( + {tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"), tr("MinDepth"), tr("MaxDepth")}); ui->viewports->header()->resizeSection(0, 75); ui->viewports->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->viewports->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -260,10 +273,13 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState ui->viewports->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); ui->viewports->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ui->viewports->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); + + ui->viewports->setClearSelectionOnFocusLoss(true); } { - // Slot | X | Y | Width | Height | Enabled + ui->scissors->setColumns( + {tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"), tr("Enabled")}); ui->scissors->header()->resizeSection(0, 100); ui->scissors->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->scissors->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -271,10 +287,13 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState ui->scissors->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(4, QHeaderView::Stretch); ui->scissors->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); + + ui->scissors->setClearSelectionOnFocusLoss(true); } { - // Slot | Resource | Type | Width | Height | Depth | Array Size | Format | Go + ui->framebuffer->setColumns({tr("Slot"), tr("Resource"), tr("Type"), tr("Width"), tr("Height"), + tr("Depth"), tr("Array Size"), tr("Format"), tr("Go")}); ui->framebuffer->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ui->framebuffer->header()->setSectionResizeMode(1, QHeaderView::Stretch); ui->framebuffer->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); @@ -285,12 +304,13 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState ui->framebuffer->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->framebuffer->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); - ui->framebuffer->setHoverIconColumn(8); - ui->framebuffer->setDefaultHoverColor(ui->framebuffer->palette().color(QPalette::Window)); + ui->framebuffer->setHoverIconColumn(8, action, action_hover); + ui->framebuffer->setClearSelectionOnFocusLoss(true); } { - // Slot | Enabled | Col Src | Col Dst | Col Op | Alpha Src | Alpha Dst | Alpha Op | Write Mask + ui->blends->setColumns({tr("Slot"), tr("Enabled"), tr("Col Src"), tr("Col Dst"), tr("Col Op"), + tr("Alpha Src"), tr("Alpha Dst"), tr("Alpha Op"), tr("Write Mask")}); ui->blends->header()->resizeSection(0, 75); ui->blends->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->blends->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -301,10 +321,13 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState ui->blends->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); ui->blends->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->blends->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); + + ui->blends->setClearSelectionOnFocusLoss(true); } { - // Face | Func | Fail Op | Depth Fail Op | Pass Op | Write Mask | Comp Mask | Ref + ui->stencils->setColumns({tr("Face"), tr("Func"), tr("Fail Op"), tr("Depth Fail Op"), + tr("Pass Op"), tr("Write Mask"), tr("Comp Mask"), tr("Ref")}); ui->stencils->header()->resizeSection(0, 50); ui->stencils->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->stencils->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -314,6 +337,8 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState ui->stencils->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(7, QHeaderView::Stretch); + + ui->stencils->setClearSelectionOnFocusLoss(true); } // this is often changed just because we're changing some tab in the designer. @@ -371,20 +396,15 @@ void GLPipelineStateViewer::on_showEmpty_toggled(bool checked) setState(); } -void GLPipelineStateViewer::setInactiveRow(QTreeWidgetItem *node) +void GLPipelineStateViewer::setInactiveRow(RDTreeWidgetItem *node) { - for(int i = 0; i < node->columnCount(); i++) - { - QFont f = node->font(i); - f.setItalic(true); - node->setFont(i, f); - } + node->setItalic(true); } -void GLPipelineStateViewer::setEmptyRow(QTreeWidgetItem *node) +void GLPipelineStateViewer::setEmptyRow(RDTreeWidgetItem *node) { - for(int i = 0; i < node->columnCount(); i++) - node->setBackgroundColor(i, QColor(255, 70, 70)); + node->setBackgroundColor(QColor(255, 70, 70)); + node->setForegroundColor(QColor(0, 0, 0)); } bool GLPipelineStateViewer::showNode(bool usedSlot, bool filledSlot) @@ -536,9 +556,6 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * const ShaderBindpointMapping &mapping = stage.BindpointMapping; const GLPipe::State &state = m_Ctx.CurGLPipelineState(); - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - if(stage.Object == ResourceId()) { shader->setText(tr("Unbound Shader")); @@ -655,9 +672,8 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * } } - QTreeWidgetItem *node = makeTreeNode({slotname, name, typeName, w, h, d, a, format, ""}); - - textures->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({slotname, name, typeName, w, h, d, a, format, ""}); if(!filledSlot) setEmptyRow(node); @@ -725,11 +741,11 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * else if(s.Filter.func != FilterFunc::Normal) filter += QString(" (%1)").arg(ToQStr(s.Filter.func)); - QTreeWidgetItem *node = - makeTreeNode({slotname, addressing, filter, - (s.MinLOD == -FLT_MAX ? "0" : QString::number(s.MinLOD)) + " - " + - (s.MaxLOD == FLT_MAX ? "FLT_MAX" : QString::number(s.MaxLOD)), - s.MipLODBias}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({slotname, addressing, filter, + (s.MinLOD == -FLT_MAX ? "0" : QString::number(s.MinLOD)) + " - " + + (s.MaxLOD == FLT_MAX ? "FLT_MAX" : QString::number(s.MaxLOD)), + s.MipLODBias}); if(!filledSlot) setEmptyRow(node); @@ -810,7 +826,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * byterange = QString("%1 - %2").arg(offset).arg(offset + length); } - QTreeWidgetItem *node = makeTreeNode({slotname, name, byterange, sizestr, ""}); + RDTreeWidgetItem *node = new RDTreeWidgetItem({slotname, name, byterange, sizestr, ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(i)); @@ -831,7 +847,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * subs->setUpdatesEnabled(false); subs->clear(); for(int i = 0; i < stage.Subroutines.count; i++) - subs->addTopLevelItem(makeTreeNode({i, stage.Subroutines[i]})); + subs->addTopLevelItem(new RDTreeWidgetItem({i, stage.Subroutines[i]})); subs->clearSelection(); subs->setUpdatesEnabled(true); subs->verticalScrollBar()->setValue(vs); @@ -956,8 +972,8 @@ void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, QLabel * access = "-"; } - QTreeWidgetItem *node = - makeTreeNode({binding, slotname, name, dimensions, format, access, ""}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({binding, slotname, name, dimensions, format, access, ""}); node->setData(0, Qt::UserRole, tag); @@ -1054,9 +1070,6 @@ void GLPipelineStateViewer::setState() const QPixmap &tick = Pixmaps::tick(); const QPixmap &cross = Pixmaps::cross(); - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - bool usedBindings[128] = {}; //////////////////////////////////////////////// @@ -1098,15 +1111,13 @@ void GLPipelineStateViewer::setState() { QString genericVal = "Generic=" + MakeGenericValueString(compCount, compType, a); - QTreeWidgetItem *node = makeTreeNode({i, a.Enabled ? tr("Enabled") : tr("Disabled"), name, - a.Enabled ? ToQStr(a.Format.strname) : genericVal, - a.BufferSlot, a.RelativeOffset}); + RDTreeWidgetItem *node = new RDTreeWidgetItem( + {i, a.Enabled ? tr("Enabled") : tr("Disabled"), name, + a.Enabled ? ToQStr(a.Format.strname) : genericVal, a.BufferSlot, a.RelativeOffset}); if(a.Enabled) usedBindings[a.BufferSlot] = true; - ui->viAttrs->setHoverIcons(node, action, action_hover); - if(!usedSlot) setInactiveRow(node); @@ -1192,11 +1203,9 @@ void GLPipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = makeTreeNode( + RDTreeWidgetItem *node = new RDTreeWidgetItem( {"Element", name, 0, 0, draw ? draw->indexByteWidth : 0, (qulonglong)length, ""}); - ui->viBuffers->setHoverIcons(node, action, action_hover); - node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(state.m_VtxIn.ibuffer, draw ? draw->indexOffset : 0))); @@ -1213,9 +1222,8 @@ void GLPipelineStateViewer::setState() { if(ibufferUsed || showEmpty) { - QTreeWidgetItem *node = makeTreeNode({"Element", tr("No Buffer Set"), "-", "-", "-", "-", ""}); - - ui->viBuffers->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({"Element", tr("No Buffer Set"), "-", "-", "-", "-", ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(state.m_VtxIn.ibuffer, draw ? draw->indexOffset : 0))); @@ -1257,10 +1265,8 @@ void GLPipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = - makeTreeNode({i, name, v.Stride, (qulonglong)offset, v.Divisor, (qulonglong)length, ""}); - - ui->viBuffers->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = new RDTreeWidgetItem( + {i, name, v.Stride, (qulonglong)offset, v.Divisor, (qulonglong)length, ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(v.Buffer, v.Offset))); @@ -1322,10 +1328,8 @@ void GLPipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = - makeTreeNode({i, name, length, (qulonglong)state.m_Feedback.Offset[i], ""}); - - ui->gsFeedback->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({i, name, length, (qulonglong)state.m_Feedback.Offset[i], ""}); node->setData(0, Qt::UserRole, QVariant::fromValue(state.m_Feedback.BufferBinding[i])); @@ -1373,7 +1377,7 @@ void GLPipelineStateViewer::setState() else indexstring = QString::number(prev); - QTreeWidgetItem *node = makeTreeNode( + RDTreeWidgetItem *node = new RDTreeWidgetItem( {indexstring, v1.Left, v1.Bottom, v1.Width, v1.Height, v1.MinDepth, v1.MaxDepth}); if(v1.Width == 0 || v1.Height == 0 || v1.MinDepth == v1.MaxDepth) @@ -1404,7 +1408,7 @@ void GLPipelineStateViewer::setState() else indexstring = QString::number(prev); - QTreeWidgetItem *node = makeTreeNode( + RDTreeWidgetItem *node = new RDTreeWidgetItem( {indexstring, v1.Left, v1.Bottom, v1.Width, v1.Height, v1.MinDepth, v1.MaxDepth}); if(v1.Width == 0 || v1.Height == 0 || v1.MinDepth == v1.MaxDepth) @@ -1442,8 +1446,9 @@ void GLPipelineStateViewer::setState() else indexstring = QString::number(prev); - QTreeWidgetItem *node = makeTreeNode({indexstring, s1.Left, s1.Bottom, s1.Width, - s1.Height, s1.Enabled ? tr("True") : tr("False")}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({indexstring, s1.Left, s1.Bottom, s1.Width, s1.Height, + s1.Enabled ? tr("True") : tr("False")}); if(s1.Width == 0 || s1.Height == 0) setEmptyRow(node); @@ -1473,8 +1478,9 @@ void GLPipelineStateViewer::setState() else indexstring = QString::number(prev); - QTreeWidgetItem *node = makeTreeNode({indexstring, s1.Left, s1.Bottom, s1.Width, s1.Height, - s1.Enabled ? tr("True") : tr("False")}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({indexstring, s1.Left, s1.Bottom, s1.Width, s1.Height, + s1.Enabled ? tr("True") : tr("False")}); if(s1.Width == 0 || s1.Height == 0) setEmptyRow(node); @@ -1666,9 +1672,7 @@ void GLPipelineStateViewer::setState() .arg(ToQStr(r->Swizzle[3])); } - QTreeWidgetItem *node = makeTreeNode({i, name, typeName, w, h, d, a, format, ""}); - - ui->framebuffer->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = new RDTreeWidgetItem({i, name, typeName, w, h, d, a, format, ""}); if(tex) node->setData(0, Qt::UserRole, QVariant::fromValue(p)); @@ -1739,9 +1743,8 @@ void GLPipelineStateViewer::setState() slot = "Depthstencil"; } - QTreeWidgetItem *node = makeTreeNode({slot, name, typeName, w, h, d, a, format, ""}); - - ui->framebuffer->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({slot, name, typeName, w, h, d, a, format, ""}); if(tex) node->setData(0, Qt::UserRole, QVariant::fromValue(ds)); @@ -1780,38 +1783,38 @@ void GLPipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QTreeWidgetItem *node = NULL; + RDTreeWidgetItem *node = NULL; if(i == 0 && logic) { - node = makeTreeNode({i, tr("True"), + node = new RDTreeWidgetItem({i, tr("True"), - "-", "-", ToQStr(blend.Logic), + "-", "-", ToQStr(blend.Logic), - "-", "-", "-", + "-", "-", "-", - QString("%1%2%3%4") - .arg((blend.WriteMask & 0x1) == 0 ? "_" : "R") - .arg((blend.WriteMask & 0x2) == 0 ? "_" : "G") - .arg((blend.WriteMask & 0x4) == 0 ? "_" : "B") - .arg((blend.WriteMask & 0x8) == 0 ? "_" : "A")}); + QString("%1%2%3%4") + .arg((blend.WriteMask & 0x1) == 0 ? "_" : "R") + .arg((blend.WriteMask & 0x2) == 0 ? "_" : "G") + .arg((blend.WriteMask & 0x4) == 0 ? "_" : "B") + .arg((blend.WriteMask & 0x8) == 0 ? "_" : "A")}); } else { - node = makeTreeNode({i, blend.Enabled ? tr("True") : tr("False"), + node = new RDTreeWidgetItem( + {i, blend.Enabled ? tr("True") : tr("False"), - ToQStr(blend.m_Blend.Source), ToQStr(blend.m_Blend.Destination), - ToQStr(blend.m_Blend.Operation), + ToQStr(blend.m_Blend.Source), ToQStr(blend.m_Blend.Destination), + ToQStr(blend.m_Blend.Operation), - ToQStr(blend.m_AlphaBlend.Source), - ToQStr(blend.m_AlphaBlend.Destination), - ToQStr(blend.m_AlphaBlend.Operation), + ToQStr(blend.m_AlphaBlend.Source), ToQStr(blend.m_AlphaBlend.Destination), + ToQStr(blend.m_AlphaBlend.Operation), - QString("%1%2%3%4") - .arg((blend.WriteMask & 0x1) == 0 ? "_" : "R") - .arg((blend.WriteMask & 0x2) == 0 ? "_" : "G") - .arg((blend.WriteMask & 0x4) == 0 ? "_" : "B") - .arg((blend.WriteMask & 0x8) == 0 ? "_" : "A")}); + QString("%1%2%3%4") + .arg((blend.WriteMask & 0x1) == 0 ? "_" : "R") + .arg((blend.WriteMask & 0x2) == 0 ? "_" : "G") + .arg((blend.WriteMask & 0x4) == 0 ? "_" : "B") + .arg((blend.WriteMask & 0x8) == 0 ? "_" : "A")}); } if(!filledSlot) @@ -1856,28 +1859,29 @@ void GLPipelineStateViewer::setState() ui->stencils->clear(); if(state.m_StencilState.StencilEnable) { - ui->stencils->addTopLevelItems( - {makeTreeNode( - {"Front", ToQStr(state.m_StencilState.m_FrontFace.Func), - ToQStr(state.m_StencilState.m_FrontFace.FailOp), - ToQStr(state.m_StencilState.m_FrontFace.DepthFailOp), - ToQStr(state.m_StencilState.m_FrontFace.PassOp), - QString("%1").arg(state.m_StencilState.m_FrontFace.WriteMask, 2, 16, QChar('0')).toUpper(), - QString("%1").arg(state.m_StencilState.m_FrontFace.ValueMask, 2, 16, QChar('0')).toUpper(), - QString("%1").arg(state.m_StencilState.m_FrontFace.Ref, 2, 16, QChar('0')).toUpper()}), - makeTreeNode( - {"Back", ToQStr(state.m_StencilState.m_BackFace.Func), - ToQStr(state.m_StencilState.m_BackFace.FailOp), - ToQStr(state.m_StencilState.m_BackFace.DepthFailOp), - ToQStr(state.m_StencilState.m_BackFace.PassOp), - QString("%1").arg(state.m_StencilState.m_BackFace.WriteMask, 2, 16, QChar('0')).toUpper(), - QString("%1").arg(state.m_StencilState.m_BackFace.ValueMask, 2, 16, QChar('0')).toUpper(), - QString("%1").arg(state.m_StencilState.m_BackFace.Ref, 2, 16, QChar('0')).toUpper()})}); + ui->stencils->addTopLevelItem(new RDTreeWidgetItem( + {"Front", ToQStr(state.m_StencilState.m_FrontFace.Func), + ToQStr(state.m_StencilState.m_FrontFace.FailOp), + ToQStr(state.m_StencilState.m_FrontFace.DepthFailOp), + ToQStr(state.m_StencilState.m_FrontFace.PassOp), + QString("%1").arg(state.m_StencilState.m_FrontFace.WriteMask, 2, 16, QChar('0')).toUpper(), + QString("%1").arg(state.m_StencilState.m_FrontFace.ValueMask, 2, 16, QChar('0')).toUpper(), + QString("%1").arg(state.m_StencilState.m_FrontFace.Ref, 2, 16, QChar('0')).toUpper()})); + + ui->stencils->addTopLevelItem(new RDTreeWidgetItem( + {"Back", ToQStr(state.m_StencilState.m_BackFace.Func), + ToQStr(state.m_StencilState.m_BackFace.FailOp), + ToQStr(state.m_StencilState.m_BackFace.DepthFailOp), + ToQStr(state.m_StencilState.m_BackFace.PassOp), + QString("%1").arg(state.m_StencilState.m_BackFace.WriteMask, 2, 16, QChar('0')).toUpper(), + QString("%1").arg(state.m_StencilState.m_BackFace.ValueMask, 2, 16, QChar('0')).toUpper(), + QString("%1").arg(state.m_StencilState.m_BackFace.Ref, 2, 16, QChar('0')).toUpper()})); } else { - ui->stencils->addTopLevelItems({makeTreeNode({"Front", "-", "-", "-", "-", "-", "-", "-"}), - makeTreeNode({"Back", "-", "-", "-", "-", "-", "-", "-"})}); + ui->stencils->addTopLevelItem( + new RDTreeWidgetItem({"Front", "-", "-", "-", "-", "-", "-", "-"})); + ui->stencils->addTopLevelItem(new RDTreeWidgetItem({"Back", "-", "-", "-", "-", "-", "-", "-"})); } ui->stencils->clearSelection(); ui->stencils->setUpdatesEnabled(true); @@ -1934,7 +1938,7 @@ QString GLPipelineStateViewer::formatMembers(int indent, const QString &namepref return ret; } -void GLPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int column) +void GLPipelineStateViewer::resource_itemActivated(RDTreeWidgetItem *item, int column) { const GLPipe::Shader *stage = stageForSender(item->treeWidget()); @@ -2018,7 +2022,7 @@ void GLPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int co } } -void GLPipelineStateViewer::ubo_itemActivated(QTreeWidgetItem *item, int column) +void GLPipelineStateViewer::ubo_itemActivated(RDTreeWidgetItem *item, int column) { const GLPipe::Shader *stage = stageForSender(item->treeWidget()); @@ -2037,12 +2041,12 @@ void GLPipelineStateViewer::ubo_itemActivated(QTreeWidgetItem *item, int column) m_Ctx.AddDockWindow(prev->Widget(), DockReference::RightOf, this, 0.3f); } -void GLPipelineStateViewer::on_viAttrs_itemActivated(QTreeWidgetItem *item, int column) +void GLPipelineStateViewer::on_viAttrs_itemActivated(RDTreeWidgetItem *item, int column) { on_meshView_clicked(); } -void GLPipelineStateViewer::on_viBuffers_itemActivated(QTreeWidgetItem *item, int column) +void GLPipelineStateViewer::on_viBuffers_itemActivated(RDTreeWidgetItem *item, int column) { QVariant tag = item->data(0, Qt::UserRole); @@ -2067,42 +2071,33 @@ void GLPipelineStateViewer::highlightIABind(int slot) QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, 0.95f); - ui->viAttrs->model()->blockSignals(true); - ui->viBuffers->model()->blockSignals(true); + ui->viAttrs->beginUpdate(); + ui->viBuffers->beginUpdate(); + if(slot < m_VBNodes.count()) { - QTreeWidgetItem *item = m_VBNodes[(int)slot]; - - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, QBrush(col)); + m_VBNodes[slot]->setBackgroundColor(col); + m_VBNodes[slot]->setForegroundColor(QColor(0, 0, 0)); } for(int i = 0; i < ui->viAttrs->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->viAttrs->topLevelItem(i); - - QBrush itemBrush = QBrush(col); + RDTreeWidgetItem *item = ui->viAttrs->topLevelItem(i); if((int)VI.attributes[i].BufferSlot != slot) - itemBrush = QBrush(); - - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, itemBrush); - } - ui->viAttrs->model()->blockSignals(false); - ui->viBuffers->model()->blockSignals(false); - - if(ui->viAttrs->topLevelItemCount() > 0) - { - ui->viAttrs->topLevelItem(0)->setDisabled(true); - ui->viAttrs->topLevelItem(0)->setDisabled(false); + { + item->setBackground(QBrush()); + item->setForeground(QBrush()); + } + else + { + item->setBackgroundColor(col); + item->setForegroundColor(QColor(0, 0, 0)); + } } - if(ui->viBuffers->topLevelItemCount() > 0) - { - ui->viBuffers->topLevelItem(0)->setDisabled(true); - ui->viBuffers->topLevelItem(0)->setDisabled(false); - } + ui->viAttrs->endUpdate(); + ui->viBuffers->endUpdate(); } void GLPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) @@ -2132,12 +2127,10 @@ void GLPipelineStateViewer::on_viBuffers_mouseMove(QMouseEvent *e) if(!m_Ctx.LogLoaded()) return; - QTreeWidgetItem *item = ui->viBuffers->itemAt(e->pos()); + RDTreeWidgetItem *item = ui->viBuffers->itemAt(e->pos()); vertex_leave(NULL); - ui->viAttrs->model()->blockSignals(true); - ui->viBuffers->model()->blockSignals(true); if(item) { int idx = m_VBNodes.indexOf(item); @@ -2147,57 +2140,31 @@ void GLPipelineStateViewer::on_viBuffers_mouseMove(QMouseEvent *e) } else { - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, QBrush(ui->viBuffers->palette().color(QPalette::Window))); + item->setBackground(ui->viBuffers->palette().brush(QPalette::Window)); + item->setForeground(ui->viBuffers->palette().brush(QPalette::WindowText)); } } - ui->viAttrs->model()->blockSignals(false); - ui->viBuffers->model()->blockSignals(false); - - if(ui->viAttrs->topLevelItemCount() > 0) - { - ui->viAttrs->topLevelItem(0)->setDisabled(true); - ui->viAttrs->topLevelItem(0)->setDisabled(false); - } - - if(ui->viBuffers->topLevelItemCount() > 0) - { - ui->viBuffers->topLevelItem(0)->setDisabled(true); - ui->viBuffers->topLevelItem(0)->setDisabled(false); - } } void GLPipelineStateViewer::vertex_leave(QEvent *e) { - ui->viAttrs->model()->blockSignals(true); - ui->viBuffers->model()->blockSignals(true); + ui->viAttrs->beginUpdate(); + ui->viBuffers->beginUpdate(); + for(int i = 0; i < ui->viAttrs->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->viAttrs->topLevelItem(i); - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, QBrush()); + ui->viAttrs->topLevelItem(i)->setBackground(QBrush()); + ui->viAttrs->topLevelItem(i)->setForeground(QBrush()); } for(int i = 0; i < ui->viBuffers->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->viBuffers->topLevelItem(i); - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, QBrush()); - } - ui->viAttrs->model()->blockSignals(false); - ui->viBuffers->model()->blockSignals(false); - - if(ui->viAttrs->topLevelItemCount() > 0) - { - ui->viAttrs->topLevelItem(0)->setDisabled(true); - ui->viAttrs->topLevelItem(0)->setDisabled(false); + ui->viBuffers->topLevelItem(i)->setBackground(QBrush()); + ui->viBuffers->topLevelItem(i)->setForeground(QBrush()); } - if(ui->viBuffers->topLevelItemCount() > 0) - { - ui->viBuffers->topLevelItem(0)->setDisabled(true); - ui->viBuffers->topLevelItem(0)->setDisabled(false); - } + ui->viAttrs->endUpdate(); + ui->viBuffers->endUpdate(); } void GLPipelineStateViewer::on_pipeFlow_stageSelected(int index) diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h index 5f1487ae0..d68ec5ca2 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h @@ -33,7 +33,7 @@ class GLPipelineStateViewer; } class RDTreeWidget; -class QTreeWidgetItem; +class RDTreeWidgetItem; class PipelineStateViewer; class GLPipelineStateViewer : public QFrame, public ILogViewer @@ -57,8 +57,8 @@ private slots: void on_showEmpty_toggled(bool checked); void on_exportHTML_clicked(); void on_meshView_clicked(); - void on_viAttrs_itemActivated(QTreeWidgetItem *item, int column); - void on_viBuffers_itemActivated(QTreeWidgetItem *item, int column); + void on_viAttrs_itemActivated(RDTreeWidgetItem *item, int column); + void on_viBuffers_itemActivated(RDTreeWidgetItem *item, int column); void on_viAttrs_mouseMove(QMouseEvent *event); void on_viBuffers_mouseMove(QMouseEvent *event); void on_pipeFlow_stageSelected(int index); @@ -67,8 +67,8 @@ private slots: void shaderView_clicked(); void shaderEdit_clicked(); void shaderSave_clicked(); - void resource_itemActivated(QTreeWidgetItem *item, int column); - void ubo_itemActivated(QTreeWidgetItem *item, int column); + void resource_itemActivated(RDTreeWidgetItem *item, int column); + void ubo_itemActivated(RDTreeWidgetItem *item, int column); void vertex_leave(QEvent *e); private: @@ -94,8 +94,8 @@ private: void setState(); void clearState(); - void setInactiveRow(QTreeWidgetItem *node); - void setEmptyRow(QTreeWidgetItem *node); + void setInactiveRow(RDTreeWidgetItem *node); + void setEmptyRow(RDTreeWidgetItem *node); void highlightIABind(int slot); QString formatMembers(int indent, const QString &nameprefix, @@ -105,5 +105,5 @@ private: bool showNode(bool usedSlot, bool filledSlot); // keep track of the VB nodes (we want to be able to highlight them easily on hover) - QList m_VBNodes; + QList m_VBNodes; }; diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.ui b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.ui index 9d53b786f..0e514363b 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.ui +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.ui @@ -1,4 +1,4 @@ - + GLPipelineStateViewer @@ -266,41 +266,6 @@ false - - - Index - - - - - Enabled - - - - - Name - - - - - Format/Generic Value - - - - - Buffer Slot - - - - - Relative Offset - - - - - Go - - @@ -368,41 +333,6 @@ false - - - Slot - - - - - Buffer - - - - - Divisor - - - - - Offset - - - - - Stride - - - - - Byte Length - - - - - Go - - @@ -709,51 +639,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -809,31 +694,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - LOD Bias - - @@ -889,31 +749,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -969,41 +804,6 @@ padding: 0px; false - - - Binding - - - - - Slot - - - - - Resource - - - - - Dimensions - - - - - Format - - - - - Access - - - - - Go - - @@ -1059,21 +859,6 @@ padding: 0px; false - - - Uniform - - - - - Value - - - - - Go - - @@ -1272,51 +1057,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -1372,31 +1112,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - LOD Bias - - @@ -1452,31 +1167,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -1532,41 +1222,6 @@ padding: 0px; false - - - Binding - - - - - Slot - - - - - Resource - - - - - Dimensions - - - - - Format - - - - - Access - - - - - Go - - @@ -1622,21 +1277,6 @@ padding: 0px; false - - - Uniform - - - - - Value - - - - - Go - - @@ -1835,51 +1475,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -1935,31 +1530,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - LOD Bias - - @@ -2015,31 +1585,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -2095,41 +1640,6 @@ padding: 0px; false - - - Binding - - - - - Slot - - - - - Resource - - - - - Dimensions - - - - - Format - - - - - Access - - - - - Go - - @@ -2185,21 +1695,6 @@ padding: 0px; false - - - Uniform - - - - - Value - - - - - Go - - @@ -2398,51 +1893,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -2498,31 +1948,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - LOD Bias - - @@ -2580,31 +2005,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -2703,31 +2103,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Length - - - - - Offset - - - - - Go - - @@ -2785,41 +2160,6 @@ padding: 0px; false - - - Binding - - - - - Slot - - - - - Resource - - - - - Dimensions - - - - - Format - - - - - Access - - - - - Go - - @@ -2875,21 +2215,6 @@ padding: 0px; false - - - Uniform - - - - - Value - - - - - Go - - @@ -2939,7 +2264,7 @@ padding: 0px; 2 - + QFrame::Box @@ -2967,36 +2292,6 @@ padding: 0px; 50 - - - Slot - - - - - X - - - - - Y - - - - - Width - - - - - Height - - - - - Enabled - - @@ -3467,7 +2762,7 @@ padding: 0px; 2 - + QFrame::Box @@ -3495,41 +2790,6 @@ padding: 0px; 50 - - - Slot - - - - - X - - - - - Y - - - - - Width - - - - - Height - - - - - MinDepth - - - - - MaxDepth - - @@ -3972,51 +3232,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -4072,31 +3287,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - LOD Bias - - @@ -4152,31 +3342,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -4232,41 +3397,6 @@ padding: 0px; false - - - Binding - - - - - Slot - - - - - Resource - - - - - Dimensions - - - - - Format - - - - - Access - - - - - Go - - @@ -4322,21 +3452,6 @@ padding: 0px; false - - - Uniform - - - - - Value - - - - - Go - - @@ -4420,51 +3535,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -4495,7 +3565,7 @@ padding: 0px; 2 - + QFrame::Box @@ -4529,51 +3599,6 @@ padding: 0px; false - - - Slot - - - - - Enabled - - - - - Colour Src - - - - - Colour Dst - - - - - Colour Op - - - - - Alpha Src - - - - - Alpha Dst - - - - - Alpha Op - - - - - Write Mask - - @@ -4820,7 +3845,7 @@ padding: 0px; 2 - + 0 @@ -4872,46 +3897,6 @@ padding: 0px; false - - - Face - - - - - Func - - - - - Fail Op - - - - - Depth Fail Op - - - - - Pass Op - - - - - Write Mask - - - - - Val Mask - - - - - Ref - - @@ -5110,51 +4095,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -5210,31 +4150,6 @@ padding: 0px; false - - - Slot - - - - - Addressing - - - - - Filter - - - - - LOD Clamp - - - - - LOD Bias - - @@ -5290,31 +4205,6 @@ padding: 0px; false - - - Slot - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -5370,41 +4260,6 @@ padding: 0px; false - - - Binding - - - - - Slot - - - - - Resource - - - - - Dimensions - - - - - Format - - - - - Access - - - - - Go - - @@ -5460,21 +4315,6 @@ padding: 0px; false - - - Uniform - - - - - Value - - - - - Go - - @@ -5489,7 +4329,7 @@ padding: 0px; RDTreeWidget - QTreeWidget + QTreeView
Widgets/Extended/RDTreeWidget.h
diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index 3f25254f6..a99567503 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -94,6 +94,9 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, { ui->setupUi(this); + const QIcon &action = Icons::action(); + const QIcon &action_hover = Icons::action_hover(); + RDLabel *shaderLabels[] = { ui->vsShader, ui->tcsShader, ui->tesShader, ui->gsShader, ui->fsShader, ui->csShader, }; @@ -154,9 +157,9 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, addGridLines(ui->blendStateGridLayout); addGridLines(ui->depthStateGridLayout); - // no way to set this up in the UI :( { - // Index | Name | Location | Binding | Format | Offset | Go + ui->viAttrs->setColumns({tr("Index"), tr("Name"), tr("Location"), tr("Binding"), tr("Format"), + tr("Offset"), tr("Go")}); ui->viAttrs->header()->resizeSection(0, 75); ui->viAttrs->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->viAttrs->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -166,11 +169,13 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, ui->viAttrs->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ui->viAttrs->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); - ui->viAttrs->setHoverIconColumn(6); + ui->viAttrs->setHoverIconColumn(6, action, action_hover); + ui->viAttrs->setClearSelectionOnFocusLoss(true); } { - // Slot | Buffer | Rate | Offset | Stride | Byte Length | Go + ui->viBuffers->setColumns({tr("Slot"), tr("Buffer"), tr("Rate"), tr("Offset"), tr("Stride"), + tr("Byte Length"), tr("Go")}); ui->viBuffers->header()->resizeSection(0, 75); ui->viBuffers->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->viBuffers->header()->setSectionResizeMode(1, QHeaderView::Stretch); @@ -180,12 +185,14 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, ui->viBuffers->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ui->viBuffers->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); - ui->viBuffers->setHoverIconColumn(6); + ui->viBuffers->setHoverIconColumn(6, action, action_hover); + ui->viBuffers->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *res : resources) { - // | Set | Binding | Type | Resource | Contents | cont.d | Go + res->setColumns({"", tr("Set"), tr("Binding"), tr("Type"), tr("Resource"), tr("Contents"), + tr("cont.d"), tr("Go")}); res->header()->resizeSection(0, 30); res->header()->setSectionResizeMode(0, QHeaderView::Fixed); res->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -196,13 +203,14 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, res->header()->setSectionResizeMode(6, QHeaderView::Stretch); res->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); - res->setHoverIconColumn(7); - res->setDefaultHoverColor(ui->framebuffer->palette().color(QPalette::Window)); + res->setHoverIconColumn(7, action, action_hover); + res->setClearSelectionOnFocusLoss(true); } for(RDTreeWidget *ubo : ubos) { - // | Set | Binding | Buffer | Byte Range | Size | Go + ubo->setColumns( + {"", tr("Set"), tr("Binding"), tr("Buffer"), tr("Byte Range"), tr("Size"), tr("Go")}); ubo->header()->resizeSection(0, 30); ubo->header()->setSectionResizeMode(0, QHeaderView::Fixed); ubo->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -212,12 +220,13 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, ubo->header()->setSectionResizeMode(5, QHeaderView::Stretch); ubo->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); - ubo->setHoverIconColumn(6); - ubo->setDefaultHoverColor(ui->framebuffer->palette().color(QPalette::Window)); + ubo->setHoverIconColumn(6, action, action_hover); + ubo->setClearSelectionOnFocusLoss(true); } { - // Slot | X | Y | Width | Height | MinDepth | MaxDepth + ui->viewports->setColumns( + {tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"), tr("MinDepth"), tr("MaxDepth")}); ui->viewports->header()->resizeSection(0, 75); ui->viewports->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->viewports->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -226,20 +235,25 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, ui->viewports->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); ui->viewports->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ui->viewports->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); + + ui->viewports->setClearSelectionOnFocusLoss(true); } { - // Slot | X | Y | Width | Height + ui->scissors->setColumns({tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height")}); ui->scissors->header()->resizeSection(0, 100); ui->scissors->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->scissors->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); ui->scissors->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); + + ui->scissors->setClearSelectionOnFocusLoss(true); } { - // Slot | Resource | Type | Width | Height | Depth | Array Size | Format | Go + ui->framebuffer->setColumns({tr("Slot"), tr("Resource"), tr("Type"), tr("Width"), tr("Height"), + tr("Depth"), tr("Array Size"), tr("Format"), tr("Go")}); ui->framebuffer->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ui->framebuffer->header()->setSectionResizeMode(1, QHeaderView::Stretch); ui->framebuffer->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); @@ -250,12 +264,13 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, ui->framebuffer->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->framebuffer->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); - ui->framebuffer->setHoverIconColumn(8); - ui->framebuffer->setDefaultHoverColor(ui->framebuffer->palette().color(QPalette::Window)); + ui->framebuffer->setHoverIconColumn(8, action, action_hover); + ui->framebuffer->setClearSelectionOnFocusLoss(true); } { - // Slot | Enabled | Col Src | Col Dst | Col Op | Alpha Src | Alpha Dst | Alpha Op | Write Mask + ui->blends->setColumns({tr("Slot"), tr("Enabled"), tr("Col Src"), tr("Col Dst"), tr("Col Op"), + tr("Alpha Src"), tr("Alpha Dst"), tr("Alpha Op"), tr("Write Mask")}); ui->blends->header()->resizeSection(0, 75); ui->blends->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->blends->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -266,10 +281,13 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, ui->blends->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); ui->blends->header()->setSectionResizeMode(7, QHeaderView::ResizeToContents); ui->blends->header()->setSectionResizeMode(8, QHeaderView::ResizeToContents); + + ui->blends->setClearSelectionOnFocusLoss(true); } { - // Face | Func | Fail Op | Depth Fail Op | Pass Op | Write Mask | Comp Mask | Ref + ui->stencils->setColumns({tr("Face"), tr("Func"), tr("Fail Op"), tr("Depth Fail Op"), + tr("Pass Op"), tr("Write Mask"), tr("Comp Mask"), tr("Ref")}); ui->stencils->header()->resizeSection(0, 50); ui->stencils->header()->setSectionResizeMode(0, QHeaderView::Interactive); ui->stencils->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); @@ -279,6 +297,8 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, ui->stencils->header()->setSectionResizeMode(5, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(6, QHeaderView::ResizeToContents); ui->stencils->header()->setSectionResizeMode(7, QHeaderView::Stretch); + + ui->stencils->setClearSelectionOnFocusLoss(true); } // this is often changed just because we're changing some tab in the designer. @@ -336,24 +356,19 @@ void VulkanPipelineStateViewer::on_showEmpty_toggled(bool checked) setState(); } -void VulkanPipelineStateViewer::setInactiveRow(QTreeWidgetItem *node) +void VulkanPipelineStateViewer::setInactiveRow(RDTreeWidgetItem *node) { - for(int i = 0; i < node->columnCount(); i++) - { - QFont f = node->font(i); - f.setItalic(true); - node->setFont(i, f); - } + node->setItalic(true); } -void VulkanPipelineStateViewer::setEmptyRow(QTreeWidgetItem *node) +void VulkanPipelineStateViewer::setEmptyRow(RDTreeWidgetItem *node) { - for(int i = 0; i < node->columnCount(); i++) - node->setBackgroundColor(i, QColor(255, 70, 70)); + node->setBackgroundColor(QColor(255, 70, 70)); + node->setForegroundColor(QColor(0, 0, 0)); } template -void VulkanPipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const bindType &view, +void VulkanPipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, const bindType &view, TextureDescription *tex) { if(tex == NULL) @@ -414,20 +429,17 @@ void VulkanPipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const bind text = text.trimmed(); - for(int i = 0; i < node->columnCount(); i++) - { - node->setToolTip(i, text); + node->setToolTip(text); - if(viewdetails) - { - node->setBackgroundColor(i, QColor(127, 255, 212)); - node->setForeground(i, QBrush(QColor(0, 0, 0))); - } + if(viewdetails) + { + node->setBackgroundColor(QColor(127, 255, 212)); + node->setForegroundColor(QColor(0, 0, 0)); } } template -void VulkanPipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const bindType &view, +void VulkanPipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, const bindType &view, BufferDescription *buf) { if(buf == NULL) @@ -447,12 +459,9 @@ void VulkanPipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const bind return; } - for(int i = 0; i < node->columnCount(); i++) - { - node->setToolTip(i, text); - node->setBackgroundColor(i, QColor(127, 255, 212)); - node->setForeground(i, QBrush(QColor(0, 0, 0))); - } + node->setToolTip(text); + node->setBackgroundColor(QColor(127, 255, 212)); + node->setForegroundColor(QColor(0, 0, 0)); } bool VulkanPipelineStateViewer::showNode(bool usedSlot, bool filledSlot) @@ -574,8 +583,9 @@ void VulkanPipelineStateViewer::clearState() ui->stencils->clear(); } -QVariantList VulkanPipelineStateViewer::makeSampler(const QString &bindset, const QString &slotname, - const VKPipe::BindingElement &descriptor) +RDTreeWidgetItem *VulkanPipelineStateViewer::makeSampler(const QString &bindset, + const QString &slotname, + const VKPipe::BindingElement &descriptor) { QString addressing = ""; QString addPrefix = ""; @@ -633,13 +643,9 @@ QVariantList VulkanPipelineStateViewer::makeSampler(const QString &bindset, cons if(descriptor.mipBias != 0.0f) lod += QString(" Bias %1").arg(descriptor.mipBias); - return {"", - bindset, - slotname, - descriptor.immutableSampler ? "Immutable Sampler" : "Sampler", - ToQStr(descriptor.name), - addressing, - filter + ", " + lod}; + return new RDTreeWidgetItem({"", bindset, slotname, + descriptor.immutableSampler ? "Immutable Sampler" : "Sampler", + ToQStr(descriptor.name), addressing, filter + ", " + lod}); } void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, @@ -650,9 +656,6 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, const ShaderResource *shaderRes = NULL; const BindpointMap *bindMap = NULL; - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - bool isrw = false; uint bindPoint = 0; @@ -735,7 +738,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, if(showNode(usedSlot, filledSlot)) { - QTreeWidgetItem *parentNode = resources->invisibleRootItem(); + RDTreeWidgetItem *parentNode = resources->invisibleRootItem(); QString setname = QString::number(bindset); @@ -752,8 +755,8 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, // for arrays, add a parent element that we add the real cbuffers below if(arrayLength > 1) { - QTreeWidgetItem *node = - makeTreeNode({"", setname, slotname, tr("Array[%1]").arg(arrayLength), "", "", "", ""}); + RDTreeWidgetItem *node = new RDTreeWidgetItem( + {"", setname, slotname, tr("Array[%1]").arg(arrayLength), "", "", "", ""}); if(!filledSlot) setEmptyRow(node); @@ -846,15 +849,15 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, w = h = d = a = 0; } - QTreeWidgetItem *node = NULL; - QTreeWidgetItem *samplerNode = NULL; + RDTreeWidgetItem *node = NULL; + RDTreeWidgetItem *samplerNode = NULL; if(bindType == BindType::ReadWriteBuffer || bindType == BindType::ReadOnlyTBuffer || bindType == BindType::ReadWriteTBuffer) { if(!isbuf) { - node = makeTreeNode({ + node = new RDTreeWidgetItem({ "", bindset, slotname, ToQStr(bindType), "-", "-", "", }); @@ -866,13 +869,11 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, if(descriptorBind != NULL) range = QString("%1 - %2").arg(descriptorBind->offset).arg(descriptorBind->size); - node = makeTreeNode({ + node = new RDTreeWidgetItem({ "", bindset, slotname, ToQStr(bindType), name, QString("%1 bytes").arg(len), range, }); - resources->setHoverIcons(node, action, action_hover); - - node->setData(0, Qt::UserRole, tag); + node->setTag(tag); if(!filledSlot) setEmptyRow(node); @@ -885,7 +886,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, { if(descriptorBind == NULL || descriptorBind->sampler == ResourceId()) { - node = makeTreeNode({ + node = new RDTreeWidgetItem({ "", bindset, slotname, ToQStr(bindType), "-", "-", "", }); @@ -893,7 +894,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, } else { - node = makeTreeNode(makeSampler(QString::number(bindset), slotname, *descriptorBind)); + node = makeSampler(QString::number(bindset), slotname, *descriptorBind); if(!filledSlot) setEmptyRow(node); @@ -903,7 +904,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, SamplerData sampData; sampData.node = node; - node->setData(0, Qt::UserRole, QVariant::fromValue(sampData)); + node->setTag(QVariant::fromValue(sampData)); if(!samplers.contains(descriptorBind->sampler)) samplers.insert(descriptorBind->sampler, sampData); @@ -913,7 +914,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, { if(descriptorBind == NULL || descriptorBind->res == ResourceId()) { - node = makeTreeNode({ + node = new RDTreeWidgetItem({ "", bindset, slotname, ToQStr(bindType), "-", "-", "", }); @@ -953,13 +954,11 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, if(restype == TextureDim::Texture2DMS || restype == TextureDim::Texture2DMSArray) dim += QString(", %1x MSAA").arg(samples); - node = makeTreeNode({ + node = new RDTreeWidgetItem({ "", bindset, slotname, typeName, name, dim, format, }); - resources->setHoverIcons(node, action, action_hover); - - node->setData(0, Qt::UserRole, tag); + node->setTag(tag); if(!filledSlot) setEmptyRow(node); @@ -972,7 +971,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, { if(descriptorBind == NULL || descriptorBind->sampler == ResourceId()) { - samplerNode = makeTreeNode({ + samplerNode = new RDTreeWidgetItem({ "", bindset, slotname, ToQStr(bindType), "-", "-", "", }); @@ -982,7 +981,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, { if(!samplers.contains(descriptorBind->sampler)) { - samplerNode = makeTreeNode(makeSampler("", "", *descriptorBind)); + samplerNode = makeSampler("", "", *descriptorBind); if(!filledSlot) setEmptyRow(samplerNode); @@ -992,7 +991,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, SamplerData sampData; sampData.node = samplerNode; - samplerNode->setData(0, Qt::UserRole, QVariant::fromValue(sampData)); + samplerNode->setTag(QVariant::fromValue(sampData)); samplers.insert(descriptorBind->sampler, sampData); } @@ -1027,9 +1026,6 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta const ConstantBlock *cblock = NULL; const BindpointMap *bindMap = NULL; - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - uint32_t slot = ~0U; if(shaderDetails != NULL) { @@ -1081,7 +1077,7 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta if(showNode(usedSlot, filledSlot)) { - QTreeWidgetItem *parentNode = ubos->invisibleRootItem(); + RDTreeWidgetItem *parentNode = ubos->invisibleRootItem(); QString setname = QString::number(bindset); @@ -1098,8 +1094,8 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta // for arrays, add a parent element that we add the real cbuffers below if(arrayLength > 1) { - QTreeWidgetItem *node = - makeTreeNode({"", setname, slotname, tr("Array[%1]").arg(arrayLength), "", ""}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({"", setname, slotname, tr("Array[%1]").arg(arrayLength), "", ""}); if(!filledSlot) setEmptyRow(node); @@ -1179,11 +1175,9 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta filledSlot = false; } - QTreeWidgetItem *node = makeTreeNode({"", setname, slotname, name, vecrange, sizestr}); + RDTreeWidgetItem *node = new RDTreeWidgetItem({"", setname, slotname, name, vecrange, sizestr}); - ubos->setHoverIcons(node, action, action_hover); - - node->setData(0, Qt::UserRole, QVariant::fromValue(CBufferTag(slot, (uint)idx))); + node->setTag(QVariant::fromValue(CBufferTag(slot, (uint)idx))); if(!filledSlot) setEmptyRow(node); @@ -1202,9 +1196,6 @@ void VulkanPipelineStateViewer::setShaderState(const VKPipe::Shader &stage, { ShaderReflection *shaderDetails = stage.ShaderDetails; - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - if(stage.Object == ResourceId()) shader->setText(tr("Unbound Shader")); else @@ -1379,11 +1370,11 @@ void VulkanPipelineStateViewer::setShaderState(const VKPipe::Shader &stage, // could maybe get range from ShaderVariable.reg if it's filled out // from SPIR-V side. - QTreeWidgetItem *node = makeTreeNode({"", "", ToQStr(cblock.name), "Push constants", "", - tr("%1 Variable(s)", "", cblock.variables.count)}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({"", "", ToQStr(cblock.name), "Push constants", "", + tr("%1 Variable(s)", "", cblock.variables.count)}); - ubos->setHoverIcons(node, action, action_hover); - node->setData(0, Qt::UserRole, QVariant::fromValue(CBufferTag(cb, 0))); + node->setTag(QVariant::fromValue(CBufferTag(cb, 0))); ubos->addTopLevelItem(node); } @@ -1413,9 +1404,6 @@ void VulkanPipelineStateViewer::setState() const QPixmap &tick = Pixmaps::tick(); const QPixmap &cross = Pixmaps::cross(); - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - bool usedBindings[128] = {}; //////////////////////////////////////////////// @@ -1450,13 +1438,11 @@ void VulkanPipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QTreeWidgetItem *node = - makeTreeNode({i, name, a.location, a.binding, ToQStr(a.format.strname), a.byteoffset}); + RDTreeWidgetItem *node = new RDTreeWidgetItem( + {i, name, a.location, a.binding, ToQStr(a.format.strname), a.byteoffset}); usedBindings[a.binding] = true; - ui->viAttrs->setHoverIcons(node, action, action_hover); - if(!usedSlot) setInactiveRow(node); @@ -1532,14 +1518,11 @@ void VulkanPipelineStateViewer::setState() length = buf->length; } - QTreeWidgetItem *node = - makeTreeNode({"Index", name, "Index", (qulonglong)state.IA.ibuffer.offs, - draw != NULL ? draw->indexByteWidth : 0, (qulonglong)length, ""}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({"Index", name, "Index", (qulonglong)state.IA.ibuffer.offs, + draw != NULL ? draw->indexByteWidth : 0, (qulonglong)length, ""}); - ui->viBuffers->setHoverIcons(node, action, action_hover); - - node->setData( - 0, Qt::UserRole, + node->setTag( QVariant::fromValue(VBIBTag(state.IA.ibuffer.buf, draw != NULL ? draw->indexOffset : 0))); if(!ibufferUsed) @@ -1555,13 +1538,10 @@ void VulkanPipelineStateViewer::setState() { if(ibufferUsed || showEmpty) { - QTreeWidgetItem *node = - makeTreeNode({"Index", tr("No Buffer Set"), "Index", "-", "-", "-", ""}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({"Index", tr("No Buffer Set"), "Index", "-", "-", "-", ""}); - ui->viBuffers->setHoverIcons(node, action, action_hover); - - node->setData( - 0, Qt::UserRole, + node->setTag( QVariant::fromValue(VBIBTag(state.IA.ibuffer.buf, draw != NULL ? draw->indexOffset : 0))); setEmptyRow(node); @@ -1622,18 +1602,16 @@ void VulkanPipelineStateViewer::setState() name += ", No Binding"; } - QTreeWidgetItem *node = NULL; + RDTreeWidgetItem *node = NULL; if(filledSlot) - node = makeTreeNode({i, name, rate, (qulonglong)offset, stride, (qulonglong)length, ""}); + node = new RDTreeWidgetItem( + {i, name, rate, (qulonglong)offset, stride, (qulonglong)length, ""}); else - node = makeTreeNode({i, tr("No Binding"), "-", "-", "-", "-", ""}); + node = new RDTreeWidgetItem({i, tr("No Binding"), "-", "-", "-", "-", ""}); - ui->viBuffers->setHoverIcons(node, action, action_hover); - - node->setData(0, Qt::UserRole, - QVariant::fromValue(VBIBTag(vbuff != NULL ? vbuff->buffer : ResourceId(), - vbuff != NULL ? vbuff->offset : 0))); + node->setTag(QVariant::fromValue(VBIBTag(vbuff != NULL ? vbuff->buffer : ResourceId(), + vbuff != NULL ? vbuff->offset : 0))); if(!filledSlot || bind == NULL || vbuff == NULL) setEmptyRow(node); @@ -1651,11 +1629,9 @@ void VulkanPipelineStateViewer::setState() { if(usedBindings[i]) { - QTreeWidgetItem *node = makeTreeNode({i, tr("No Binding"), "-", "-", "-", "-", ""}); + RDTreeWidgetItem *node = new RDTreeWidgetItem({i, tr("No Binding"), "-", "-", "-", "-", ""}); - ui->viBuffers->setHoverIcons(node, action, action_hover); - - node->setData(0, Qt::UserRole, QVariant::fromValue(VBIBTag(ResourceId(), 0))); + node->setTag(QVariant::fromValue(VBIBTag(ResourceId(), 0))); setEmptyRow(node); @@ -1692,22 +1668,22 @@ void VulkanPipelineStateViewer::setState() if(state.Pass.renderpass.obj != ResourceId()) { ui->scissors->addTopLevelItem( - makeTreeNode({"Render Area", state.Pass.renderArea.x, state.Pass.renderArea.y, - state.Pass.renderArea.width, state.Pass.renderArea.height})); + new RDTreeWidgetItem({"Render Area", state.Pass.renderArea.x, state.Pass.renderArea.y, + state.Pass.renderArea.width, state.Pass.renderArea.height})); } { int i = 0; for(const VKPipe::ViewportScissor &v : state.VP.viewportScissors) { - QTreeWidgetItem *node = - makeTreeNode({i, v.vp.x, v.vp.y, v.vp.width, v.vp.height, v.vp.minDepth, v.vp.maxDepth}); + RDTreeWidgetItem *node = new RDTreeWidgetItem( + {i, v.vp.x, v.vp.y, v.vp.width, v.vp.height, v.vp.minDepth, v.vp.maxDepth}); ui->viewports->addTopLevelItem(node); if(v.vp.width == 0 || v.vp.height == 0) setEmptyRow(node); - node = makeTreeNode({i, v.scissor.x, v.scissor.y, v.scissor.width, v.scissor.height}); + node = new RDTreeWidgetItem({i, v.scissor.x, v.scissor.y, v.scissor.width, v.scissor.height}); ui->scissors->addTopLevelItem(node); if(v.scissor.width == 0 || v.scissor.height == 0) @@ -1817,12 +1793,10 @@ void VulkanPipelineStateViewer::setState() .arg(ToQStr(p.swizzle[3])); } - QTreeWidgetItem *node = makeTreeNode({i, name, typeName, w, h, d, a, format, ""}); - - ui->framebuffer->setHoverIcons(node, action, action_hover); + RDTreeWidgetItem *node = new RDTreeWidgetItem({i, name, typeName, w, h, d, a, format, ""}); if(tex) - node->setData(0, Qt::UserRole, QVariant::fromValue(p.img)); + node->setTag(QVariant::fromValue(p.img)); if(p.img == ResourceId()) { @@ -1862,20 +1836,20 @@ void VulkanPipelineStateViewer::setState() if(showNode(usedSlot, filledSlot)) { - QTreeWidgetItem *node = - makeTreeNode({i, blend.blendEnable ? tr("True") : tr("False"), + RDTreeWidgetItem *node = new RDTreeWidgetItem( + {i, blend.blendEnable ? tr("True") : tr("False"), - ToQStr(blend.blend.Source), ToQStr(blend.blend.Destination), - ToQStr(blend.blend.Operation), + ToQStr(blend.blend.Source), ToQStr(blend.blend.Destination), + ToQStr(blend.blend.Operation), - ToQStr(blend.alphaBlend.Source), ToQStr(blend.alphaBlend.Destination), - ToQStr(blend.alphaBlend.Operation), + ToQStr(blend.alphaBlend.Source), ToQStr(blend.alphaBlend.Destination), + ToQStr(blend.alphaBlend.Operation), - QString("%1%2%3%4") - .arg((blend.writeMask & 0x1) == 0 ? "_" : "R") - .arg((blend.writeMask & 0x2) == 0 ? "_" : "G") - .arg((blend.writeMask & 0x4) == 0 ? "_" : "B") - .arg((blend.writeMask & 0x8) == 0 ? "_" : "A")}); + QString("%1%2%3%4") + .arg((blend.writeMask & 0x1) == 0 ? "_" : "R") + .arg((blend.writeMask & 0x2) == 0 ? "_" : "G") + .arg((blend.writeMask & 0x4) == 0 ? "_" : "B") + .arg((blend.writeMask & 0x8) == 0 ? "_" : "A")}); if(!filledSlot) setEmptyRow(node); @@ -1921,22 +1895,24 @@ void VulkanPipelineStateViewer::setState() ui->stencils->clear(); if(state.DS.stencilTestEnable) { - ui->stencils->addTopLevelItems( - {makeTreeNode({"Front", ToQStr(state.DS.front.Func), ToQStr(state.DS.front.FailOp), - ToQStr(state.DS.front.DepthFailOp), ToQStr(state.DS.front.PassOp), - QString("%1").arg(state.DS.front.writeMask, 2, 16, QChar('0')).toUpper(), - QString("%1").arg(state.DS.front.compareMask, 2, 16, QChar('0')).toUpper(), - QString("%1").arg(state.DS.front.ref, 2, 16, QChar('0')).toUpper()}), - makeTreeNode({"Back", ToQStr(state.DS.back.Func), ToQStr(state.DS.back.FailOp), - ToQStr(state.DS.back.DepthFailOp), ToQStr(state.DS.back.PassOp), - QString("%1").arg(state.DS.back.writeMask, 2, 16, QChar('0')).toUpper(), - QString("%1").arg(state.DS.back.compareMask, 2, 16, QChar('0')).toUpper(), - QString("%1").arg(state.DS.back.ref, 2, 16, QChar('0')).toUpper()})}); + ui->stencils->addTopLevelItem(new RDTreeWidgetItem( + {"Front", ToQStr(state.DS.front.Func), ToQStr(state.DS.front.FailOp), + ToQStr(state.DS.front.DepthFailOp), ToQStr(state.DS.front.PassOp), + QString("%1").arg(state.DS.front.writeMask, 2, 16, QChar('0')).toUpper(), + QString("%1").arg(state.DS.front.compareMask, 2, 16, QChar('0')).toUpper(), + QString("%1").arg(state.DS.front.ref, 2, 16, QChar('0')).toUpper()})); + ui->stencils->addTopLevelItem(new RDTreeWidgetItem( + {"Back", ToQStr(state.DS.back.Func), ToQStr(state.DS.back.FailOp), + ToQStr(state.DS.back.DepthFailOp), ToQStr(state.DS.back.PassOp), + QString("%1").arg(state.DS.back.writeMask, 2, 16, QChar('0')).toUpper(), + QString("%1").arg(state.DS.back.compareMask, 2, 16, QChar('0')).toUpper(), + QString("%1").arg(state.DS.back.ref, 2, 16, QChar('0')).toUpper()})); } else { - ui->stencils->addTopLevelItems({makeTreeNode({"Front", "-", "-", "-", "-", "-", "-", "-"}), - makeTreeNode({"Back", "-", "-", "-", "-", "-", "-", "-"})}); + ui->stencils->addTopLevelItem( + new RDTreeWidgetItem({"Front", "-", "-", "-", "-", "-", "-", "-"})); + ui->stencils->addTopLevelItem(new RDTreeWidgetItem({"Back", "-", "-", "-", "-", "-", "-", "-"})); } ui->stencils->clearSelection(); ui->stencils->setUpdatesEnabled(true); @@ -1993,7 +1969,7 @@ QString VulkanPipelineStateViewer::formatMembers(int indent, const QString &name return ret; } -void VulkanPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int column) +void VulkanPipelineStateViewer::resource_itemActivated(RDTreeWidgetItem *item, int column) { const VKPipe::Shader *stage = stageForSender(item->treeWidget()); @@ -2079,7 +2055,7 @@ void VulkanPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, in } } -void VulkanPipelineStateViewer::ubo_itemActivated(QTreeWidgetItem *item, int column) +void VulkanPipelineStateViewer::ubo_itemActivated(RDTreeWidgetItem *item, int column) { const VKPipe::Shader *stage = stageForSender(item->treeWidget()); @@ -2098,12 +2074,12 @@ void VulkanPipelineStateViewer::ubo_itemActivated(QTreeWidgetItem *item, int col m_Ctx.AddDockWindow(prev->Widget(), DockReference::RightOf, this, 0.3f); } -void VulkanPipelineStateViewer::on_viAttrs_itemActivated(QTreeWidgetItem *item, int column) +void VulkanPipelineStateViewer::on_viAttrs_itemActivated(RDTreeWidgetItem *item, int column) { on_meshView_clicked(); } -void VulkanPipelineStateViewer::on_viBuffers_itemActivated(QTreeWidgetItem *item, int column) +void VulkanPipelineStateViewer::on_viBuffers_itemActivated(RDTreeWidgetItem *item, int column) { QVariant tag = item->data(0, Qt::UserRole); @@ -2128,50 +2104,39 @@ void VulkanPipelineStateViewer::highlightIABind(int slot) QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, 0.95f); - ui->viAttrs->model()->blockSignals(true); - ui->viBuffers->model()->blockSignals(true); + ui->viAttrs->beginUpdate(); + ui->viBuffers->beginUpdate(); + if(slot < m_VBNodes.count()) { - QTreeWidgetItem *item = m_VBNodes[(int)slot]; - - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, QBrush(col)); + m_VBNodes[slot]->setBackgroundColor(col); + m_VBNodes[slot]->setForegroundColor(QColor(0, 0, 0)); } if(slot < m_BindNodes.count()) { - QTreeWidgetItem *item = m_BindNodes[(int)slot]; - - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, QBrush(col)); + m_BindNodes[slot]->setBackgroundColor(col); + m_BindNodes[slot]->setForegroundColor(QColor(0, 0, 0)); } for(int i = 0; i < ui->viAttrs->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->viAttrs->topLevelItem(i); - - QBrush itemBrush = QBrush(col); + RDTreeWidgetItem *item = ui->viAttrs->topLevelItem(i); if((int)VI.attrs[i].binding != slot) - itemBrush = QBrush(); - - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, itemBrush); - } - ui->viAttrs->model()->blockSignals(false); - ui->viBuffers->model()->blockSignals(false); - - if(ui->viAttrs->topLevelItemCount() > 0) - { - ui->viAttrs->topLevelItem(0)->setDisabled(true); - ui->viAttrs->topLevelItem(0)->setDisabled(false); + { + item->setBackground(QBrush()); + item->setForeground(QBrush()); + } + else + { + item->setBackgroundColor(col); + item->setForegroundColor(QColor(0, 0, 0)); + } } - if(ui->viBuffers->topLevelItemCount() > 0) - { - ui->viBuffers->topLevelItem(0)->setDisabled(true); - ui->viBuffers->topLevelItem(0)->setDisabled(false); - } + ui->viAttrs->endUpdate(); + ui->viBuffers->endUpdate(); } void VulkanPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) @@ -2201,12 +2166,10 @@ void VulkanPipelineStateViewer::on_viBuffers_mouseMove(QMouseEvent *e) if(!m_Ctx.LogLoaded()) return; - QTreeWidgetItem *item = ui->viBuffers->itemAt(e->pos()); + RDTreeWidgetItem *item = ui->viBuffers->itemAt(e->pos()); vertex_leave(NULL); - ui->viAttrs->model()->blockSignals(true); - ui->viBuffers->model()->blockSignals(true); if(item) { int idx = m_VBNodes.indexOf(item); @@ -2216,57 +2179,31 @@ void VulkanPipelineStateViewer::on_viBuffers_mouseMove(QMouseEvent *e) } else { - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, QBrush(ui->viBuffers->palette().color(QPalette::Window))); + item->setBackground(ui->viBuffers->palette().brush(QPalette::Window)); + item->setForeground(ui->viBuffers->palette().brush(QPalette::WindowText)); } } - ui->viAttrs->model()->blockSignals(false); - ui->viBuffers->model()->blockSignals(false); - - if(ui->viAttrs->topLevelItemCount() > 0) - { - ui->viAttrs->topLevelItem(0)->setDisabled(true); - ui->viAttrs->topLevelItem(0)->setDisabled(false); - } - - if(ui->viBuffers->topLevelItemCount() > 0) - { - ui->viBuffers->topLevelItem(0)->setDisabled(true); - ui->viBuffers->topLevelItem(0)->setDisabled(false); - } } void VulkanPipelineStateViewer::vertex_leave(QEvent *e) { - ui->viAttrs->model()->blockSignals(true); - ui->viBuffers->model()->blockSignals(true); + ui->viAttrs->beginUpdate(); + ui->viBuffers->beginUpdate(); + for(int i = 0; i < ui->viAttrs->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->viAttrs->topLevelItem(i); - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, QBrush()); + ui->viAttrs->topLevelItem(i)->setBackground(QBrush()); + ui->viAttrs->topLevelItem(i)->setForeground(QBrush()); } for(int i = 0; i < ui->viBuffers->topLevelItemCount(); i++) { - QTreeWidgetItem *item = ui->viBuffers->topLevelItem(i); - for(int c = 0; c < item->columnCount(); c++) - item->setBackground(c, QBrush()); - } - ui->viAttrs->model()->blockSignals(false); - ui->viBuffers->model()->blockSignals(false); - - if(ui->viAttrs->topLevelItemCount() > 0) - { - ui->viAttrs->topLevelItem(0)->setDisabled(true); - ui->viAttrs->topLevelItem(0)->setDisabled(false); + ui->viBuffers->topLevelItem(i)->setBackground(QBrush()); + ui->viBuffers->topLevelItem(i)->setForeground(QBrush()); } - if(ui->viBuffers->topLevelItemCount() > 0) - { - ui->viBuffers->topLevelItem(0)->setDisabled(true); - ui->viBuffers->topLevelItem(0)->setDisabled(false); - } + ui->viAttrs->endUpdate(); + ui->viBuffers->endUpdate(); } void VulkanPipelineStateViewer::on_pipeFlow_stageSelected(int index) diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h index 77129f7a0..675d2d23d 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h @@ -33,14 +33,14 @@ class VulkanPipelineStateViewer; } class RDTreeWidget; -class QTreeWidgetItem; +class RDTreeWidgetItem; class PipelineStateViewer; struct SamplerData { SamplerData() : node(NULL) {} - QList images; - QTreeWidgetItem *node; + QList images; + RDTreeWidgetItem *node; }; class VulkanPipelineStateViewer : public QFrame, public ILogViewer @@ -63,8 +63,8 @@ private slots: void on_showEmpty_toggled(bool checked); void on_exportHTML_clicked(); void on_meshView_clicked(); - void on_viAttrs_itemActivated(QTreeWidgetItem *item, int column); - void on_viBuffers_itemActivated(QTreeWidgetItem *item, int column); + void on_viAttrs_itemActivated(RDTreeWidgetItem *item, int column); + void on_viBuffers_itemActivated(RDTreeWidgetItem *item, int column); void on_viAttrs_mouseMove(QMouseEvent *event); void on_viBuffers_mouseMove(QMouseEvent *event); void on_pipeFlow_stageSelected(int index); @@ -74,8 +74,8 @@ private slots: void shaderEdit_clicked(); void shaderSave_clicked(); - void resource_itemActivated(QTreeWidgetItem *item, int column); - void ubo_itemActivated(QTreeWidgetItem *item, int column); + void resource_itemActivated(RDTreeWidgetItem *item, int column); + void ubo_itemActivated(RDTreeWidgetItem *item, int column); void vertex_leave(QEvent *e); private: @@ -83,8 +83,8 @@ private: ICaptureContext &m_Ctx; PipelineStateViewer &m_Common; - QVariantList makeSampler(const QString &bindset, const QString &slotname, - const VKPipe::BindingElement &descriptor); + RDTreeWidgetItem *makeSampler(const QString &bindset, const QString &slotname, + const VKPipe::BindingElement &descriptor); void addResourceRow(ShaderReflection *shaderDetails, const VKPipe::Shader &stage, int bindset, int bind, const VKPipe::Pipeline &pipe, RDTreeWidget *resources, QMap &samplers); @@ -97,8 +97,8 @@ private: void setState(); void clearState(); - void setInactiveRow(QTreeWidgetItem *node); - void setEmptyRow(QTreeWidgetItem *node); + void setInactiveRow(RDTreeWidgetItem *node); + void setEmptyRow(RDTreeWidgetItem *node); void highlightIABind(int slot); QString formatMembers(int indent, const QString &nameprefix, @@ -108,17 +108,17 @@ private: QString disassembleSPIRV(const ShaderReflection *shaderDetails); template - void setViewDetails(QTreeWidgetItem *node, const viewType &view, TextureDescription *tex); + void setViewDetails(RDTreeWidgetItem *node, const viewType &view, TextureDescription *tex); template - void setViewDetails(QTreeWidgetItem *node, const viewType &view, BufferDescription *buf); + void setViewDetails(RDTreeWidgetItem *node, const viewType &view, BufferDescription *buf); bool showNode(bool usedSlot, bool filledSlot); // keep track of the VB nodes (we want to be able to highlight them easily on hover) - QList m_VBNodes; - QList m_BindNodes; + QList m_VBNodes; + QList m_BindNodes; // from an combined image to its sampler (since we de-duplicate) - QMap m_CombinedImageSamplers; + QMap m_CombinedImageSamplers; }; diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.ui b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.ui index 26199c737..2f7f1a33d 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.ui +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.ui @@ -1,4 +1,4 @@ - + VulkanPipelineStateViewer @@ -266,41 +266,6 @@ false - - - Index - - - - - Name - - - - - Location - - - - - Binding - - - - - Format - - - - - Offset - - - - - Go - - @@ -368,41 +333,6 @@ false - - - Slot - - - - - Buffer - - - - - Rate - - - - - Offset - - - - - Stride - - - - - Byte Length - - - - - Go - - @@ -709,46 +639,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Type - - - - - Resource - - - - - Contents - - - - - - - - - - Go - - @@ -804,41 +694,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -1037,46 +892,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Type - - - - - Resource - - - - - Contents - - - - - - - - - - Go - - @@ -1132,41 +947,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -1365,46 +1145,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Type - - - - - Resource - - - - - Contents - - - - - - - - - - Go - - @@ -1460,41 +1200,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -1693,46 +1398,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Type - - - - - Resource - - - - - Contents - - - - - - - - - - Go - - @@ -1788,41 +1453,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -2174,7 +1804,7 @@ padding: 0px; 2 - + QFrame::Box @@ -2202,31 +1832,6 @@ padding: 0px; 50 - - - Slot - - - - - X - - - - - Y - - - - - Width - - - - - Height - - @@ -2257,7 +1862,7 @@ padding: 0px; 2 - + QFrame::Box @@ -2285,41 +1890,6 @@ padding: 0px; 50 - - - Slot - - - - - X - - - - - Y - - - - - Width - - - - - Height - - - - - MinDepth - - - - - MaxDepth - - @@ -2684,46 +2254,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Type - - - - - Resource - - - - - Contents - - - - - - - - - - Go - - @@ -2779,41 +2309,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -2897,51 +2392,6 @@ padding: 0px; false - - - Slot - - - - - Resource - - - - - Type - - - - - Width - - - - - Height - - - - - Depth - - - - - Array Size - - - - - Format - - - - - Go - - @@ -2972,7 +2422,7 @@ padding: 0px; 2 - + QFrame::Box @@ -3006,51 +2456,6 @@ padding: 0px; false - - - Slot - - - - - Enabled - - - - - Colour Src - - - - - Colour Dst - - - - - Colour Op - - - - - Alpha Src - - - - - Alpha Dst - - - - - Alpha Op - - - - - Write Mask - - @@ -3335,7 +2740,7 @@ padding: 0px; 2 - + 0 @@ -3387,46 +2792,6 @@ padding: 0px; false - - - Face - - - - - Func - - - - - Fail Op - - - - - Depth Fail Op - - - - - Pass Op - - - - - Write - - - - - Comp - - - - - Ref - - @@ -3625,46 +2990,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Type - - - - - Resource - - - - - Contents - - - - - - - - - - Go - - @@ -3720,41 +3045,6 @@ padding: 0px; false - - - - - - - - Set - - - - - Binding - - - - - Buffer - - - - - Byte Range - - - - - Size - - - - - Go - - @@ -3769,7 +3059,7 @@ padding: 0px; RDTreeWidget - QTreeWidget + QTreeView
Widgets/Extended/RDTreeWidget.h
diff --git a/qrenderdoc/Windows/ShaderViewer.cpp b/qrenderdoc/Windows/ShaderViewer.cpp index 35269c97d..eea141386 100644 --- a/qrenderdoc/Windows/ShaderViewer.cpp +++ b/qrenderdoc/Windows/ShaderViewer.cpp @@ -331,10 +331,12 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR ui->inputSig->hide(); ui->outputSig->hide(); + ui->variables->setColumns({tr("Name"), tr("Type"), tr("Value")}); ui->variables->header()->setSectionResizeMode(0, QHeaderView::Stretch); ui->variables->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->variables->header()->setSectionResizeMode(2, QHeaderView::Stretch); + ui->constants->setColumns({tr("Name"), tr("Type"), tr("Value")}); ui->constants->header()->setSectionResizeMode(0, QHeaderView::Stretch); ui->constants->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->constants->header()->setSectionResizeMode(2, QHeaderView::Stretch); @@ -408,9 +410,13 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR ui->floatView->hide(); // show input and output signatures + ui->inputSig->setColumns( + {tr("Name"), tr("Index"), tr("Reg"), tr("Type"), tr("SysValue"), tr("Mask"), tr("Used")}); for(int i = 0; i < ui->inputSig->header()->count(); i++) ui->inputSig->header()->setSectionResizeMode(i, QHeaderView::ResizeToContents); + ui->outputSig->setColumns( + {tr("Name"), tr("Index"), tr("Reg"), tr("Type"), tr("SysValue"), tr("Mask"), tr("Used")}); for(int i = 0; i < ui->outputSig->header()->count(); i++) ui->outputSig->header()->setSectionResizeMode(i, QHeaderView::ResizeToContents); @@ -426,7 +432,7 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR QString semIdx = s.needSemanticIndex ? QString::number(s.semanticIndex) : ""; - ui->inputSig->addTopLevelItem(makeTreeNode( + ui->inputSig->addTopLevelItem(new RDTreeWidgetItem( {name, semIdx, s.regIndex, TypeString(s), ToQStr(s.systemValue), GetComponentString(s.regChannelMask), GetComponentString(s.channelUsedMask)})); } @@ -454,7 +460,7 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR QString semIdx = s.needSemanticIndex ? QString::number(s.semanticIndex) : ""; - ui->outputSig->addTopLevelItem(makeTreeNode( + ui->outputSig->addTopLevelItem(new RDTreeWidgetItem( {name, semIdx, s.regIndex, TypeString(s), ToQStr(s.systemValue), GetComponentString(s.regChannelMask), GetComponentString(s.channelUsedMask)})); } @@ -726,9 +732,9 @@ QString ShaderViewer::stringRep(const ShaderVariable &var, bool useType) return RowString(var, 0, VarType::Float); } -QTreeWidgetItem *ShaderViewer::makeResourceRegister(const BindpointMap &bind, uint32_t idx, - const BoundResource &bound, - const ShaderResource &res) +RDTreeWidgetItem *ShaderViewer::makeResourceRegister(const BindpointMap &bind, uint32_t idx, + const BoundResource &bound, + const ShaderResource &res) { QString name = QString(" (%1)").arg(ToQStr(res.name)); @@ -765,17 +771,17 @@ QTreeWidgetItem *ShaderViewer::makeResourceRegister(const BindpointMap &bind, ui .arg(ToQStr(tex->format.strname)) .arg(ToQStr(tex->name)); - return makeTreeNode({regname + name, "Texture", type}); + return new RDTreeWidgetItem({regname + name, "Texture", type}); } else if(buf) { QString type = QString("%1 - %2").arg(buf->length).arg(ToQStr(buf->name)); - return makeTreeNode({regname + name, "Buffer", type}); + return new RDTreeWidgetItem({regname + name, "Buffer", type}); } else { - return makeTreeNode({regname + name, "Resource", "unknown"}); + return new RDTreeWidgetItem({regname + name, "Resource", "unknown"}); } } @@ -847,9 +853,10 @@ void ShaderViewer::updateDebugging() { if(m_Trace->cbuffers[i][j].rows > 0 || m_Trace->cbuffers[i][j].columns > 0) { - QTreeWidgetItem *node = makeTreeNode({ToQStr(m_Trace->cbuffers[i][j].name), "cbuffer", - stringRep(m_Trace->cbuffers[i][j], false)}); node->setData(0, Qt::UserRole, QVariant::fromValue(CBufferTag(i, j))); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({ToQStr(m_Trace->cbuffers[i][j].name), "cbuffer", + stringRep(m_Trace->cbuffers[i][j], false)}); ui->constants->addTopLevelItem(node); } @@ -862,9 +869,9 @@ void ShaderViewer::updateDebugging() if(input.rows > 0 || input.columns > 0) { - QTreeWidgetItem *node = - makeTreeNode({ToQStr(input.name), ToQStr(input.type) + " input", stringRep(input, true)}); node->setData(0, Qt::UserRole, QVariant::fromValue(ResourceTag(i))); + RDTreeWidgetItem *node = new RDTreeWidgetItem( + {ToQStr(input.name), ToQStr(input.type) + " input", stringRep(input, true)}); ui->constants->addTopLevelItem(node); } @@ -887,15 +894,16 @@ void ShaderViewer::updateDebugging() if(bind.arraySize == 1) { - QTreeWidgetItem *node = + RDTreeWidgetItem *node = makeResourceRegister(bind, 0, rw[bind][0], m_ShaderDetails->ReadWriteResources[i]); if(node) ui->constants->addTopLevelItem(node); } else { - QTreeWidgetItem *node = makeTreeNode({ToQStr(m_ShaderDetails->ReadWriteResources[i].name), - QString("[%1]").arg(bind.arraySize), ""}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({ToQStr(m_ShaderDetails->ReadWriteResources[i].name), + QString("[%1]").arg(bind.arraySize), ""}); for(uint32_t a = 0; a < bind.arraySize; a++) node->addChild( @@ -917,15 +925,16 @@ void ShaderViewer::updateDebugging() if(bind.arraySize == 1) { - QTreeWidgetItem *node = + RDTreeWidgetItem *node = makeResourceRegister(bind, 0, ro[bind][0], m_ShaderDetails->ReadOnlyResources[i]); if(node) ui->constants->addTopLevelItem(node); } else { - QTreeWidgetItem *node = makeTreeNode({ToQStr(m_ShaderDetails->ReadOnlyResources[i].name), - QString("[%1]").arg(bind.arraySize), ""}); + RDTreeWidgetItem *node = + new RDTreeWidgetItem({ToQStr(m_ShaderDetails->ReadOnlyResources[i].name), + QString("[%1]").arg(bind.arraySize), ""}); for(uint32_t a = 0; a < bind.arraySize; a++) node->addChild( @@ -948,18 +957,20 @@ void ShaderViewer::updateDebugging() { for(int i = 0; i < state.registers.count; i++) ui->variables->addTopLevelItem( - makeTreeNode({ToQStr(state.registers[i].name), "temporary", ""})); + new RDTreeWidgetItem({ToQStr(state.registers[i].name), "temporary", ""})); for(int i = 0; i < state.indexableTemps.count; i++) { - QTreeWidgetItem *node = makeTreeNode({QString("x%1").arg(i), "indexable", ""}); + RDTreeWidgetItem *node = new RDTreeWidgetItem({QString("x%1").arg(i), "indexable", ""}); for(int t = 0; t < state.indexableTemps[i].count; t++) - node->addChild(makeTreeNode({ToQStr(state.indexableTemps[i][t].name), "indexable", ""})); + node->addChild( + new RDTreeWidgetItem({ToQStr(state.indexableTemps[i][t].name), "indexable", ""})); ui->variables->addTopLevelItem(node); } for(int i = 0; i < state.outputs.count; i++) - ui->variables->addTopLevelItem(makeTreeNode({ToQStr(state.outputs[i].name), "output", ""})); + ui->variables->addTopLevelItem( + new RDTreeWidgetItem({ToQStr(state.outputs[i].name), "output", ""})); } ui->variables->setUpdatesEnabled(false); @@ -968,7 +979,7 @@ void ShaderViewer::updateDebugging() for(int i = 0; i < state.registers.count; i++) { - QTreeWidgetItem *node = ui->variables->topLevelItem(v++); + RDTreeWidgetItem *node = ui->variables->topLevelItem(v++); node->setText(2, stringRep(state.registers[i], false)); node->setData(0, Qt::UserRole, QVariant::fromValue(state.registers[i])); @@ -976,11 +987,11 @@ void ShaderViewer::updateDebugging() for(int i = 0; i < state.indexableTemps.count; i++) { - QTreeWidgetItem *node = ui->variables->topLevelItem(v++); + RDTreeWidgetItem *node = ui->variables->topLevelItem(v++); for(int t = 0; t < state.indexableTemps[i].count; t++) { - QTreeWidgetItem *child = node->child(t); + RDTreeWidgetItem *child = node->child(t); child->setText(2, stringRep(state.indexableTemps[i][t], false)); child->setData(0, Qt::UserRole, QVariant::fromValue(state.indexableTemps[i][t])); @@ -989,7 +1000,7 @@ void ShaderViewer::updateDebugging() for(int i = 0; i < state.outputs.count; i++) { - QTreeWidgetItem *node = ui->variables->topLevelItem(v++); + RDTreeWidgetItem *node = ui->variables->topLevelItem(v++); node->setText(2, stringRep(state.outputs[i], false)); node->setData(0, Qt::UserRole, QVariant::fromValue(state.outputs[i])); diff --git a/qrenderdoc/Windows/ShaderViewer.h b/qrenderdoc/Windows/ShaderViewer.h index 093fdff8e..d09046a60 100644 --- a/qrenderdoc/Windows/ShaderViewer.h +++ b/qrenderdoc/Windows/ShaderViewer.h @@ -33,6 +33,7 @@ namespace Ui class ShaderViewer; } +class RDTreeWidgetItem; struct ShaderDebugTrace; struct ShaderReflection; class ScintillaEdit; @@ -193,6 +194,6 @@ private: void runTo(int runToInstruction, bool forward, ShaderEvents condition = ShaderEvents::NoEvent); QString stringRep(const ShaderVariable &var, bool useType); - QTreeWidgetItem *makeResourceRegister(const BindpointMap &bind, uint32_t idx, - const BoundResource &ro, const ShaderResource &resources); + RDTreeWidgetItem *makeResourceRegister(const BindpointMap &bind, uint32_t idx, + const BoundResource &ro, const ShaderResource &resources); }; diff --git a/qrenderdoc/Windows/ShaderViewer.ui b/qrenderdoc/Windows/ShaderViewer.ui index acfb7c79b..5f7ab2629 100644 --- a/qrenderdoc/Windows/ShaderViewer.ui +++ b/qrenderdoc/Windows/ShaderViewer.ui @@ -23,7 +23,7 @@ - + 570 @@ -62,49 +62,11 @@ true - - 7 - false - - - Name - - - - - Index - - - - - Reg - - - - - Type - - - - - SysValue - - - - - Mask - - - - - Used - - - + 590 @@ -143,47 +105,9 @@ true - - 7 - false - - - Name - - - - - Index - - - - - Reg - - - - - Type - - - - - SysValue - - - - - Mask - - - - - Used - - @@ -212,21 +136,6 @@ true - - - Name - - - - - Type - - - - - Value - - @@ -252,21 +161,6 @@ true - - - Name - - - - - Type - - - - - Value - - @@ -562,7 +456,7 @@ RDTreeWidget - QTreeWidget + QTreeView
Widgets/Extended/RDTreeWidget.h