Set up pipeline viewers to re-draw the mesh icon in an appropriate color

This commit is contained in:
baldurk
2017-05-30 17:14:37 +01:00
parent 26862d92b2
commit fbf03ecd77
10 changed files with 131 additions and 56 deletions
@@ -371,6 +371,8 @@ D3D11PipelineStateViewer::D3D11PipelineStateViewer(ICaptureContext &ctx,
ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true});
m_Common.setMeshViewPixmap(ui->meshView);
ui->iaLayouts->setFont(Formatter::PreferredFont());
ui->iaBuffers->setFont(Formatter::PreferredFont());
@@ -406,24 +406,29 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QToolButton" name="meshView">
<widget class="RDLabel" name="meshView">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>75</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>View the mesh input data</string>
</property>
<property name="text">
<string/>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/wireframe_mesh.png</pixmap>
</property>
<property name="icon">
<iconset resource="../../Resources/resources.qrc">
<normaloff>:/wireframe_mesh.png</normaloff>:/wireframe_mesh.png</iconset>
</property>
<property name="iconSize">
<size>
<width>158</width>
<height>191</height>
</size>
</property>
<property name="autoRaise">
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
@@ -410,6 +410,8 @@ D3D12PipelineStateViewer::D3D12PipelineStateViewer(ICaptureContext &ctx,
ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true});
m_Common.setMeshViewPixmap(ui->meshView);
ui->iaLayouts->setFont(Formatter::PreferredFont());
ui->iaBuffers->setFont(Formatter::PreferredFont());
ui->gsStreamOut->setFont(Formatter::PreferredFont());
@@ -421,24 +421,29 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QToolButton" name="meshView">
<widget class="RDLabel" name="meshView">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>75</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>View the mesh input data</string>
</property>
<property name="text">
<string/>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/wireframe_mesh.png</pixmap>
</property>
<property name="icon">
<iconset resource="../../Resources/resources.qrc">
<normaloff>:/wireframe_mesh.png</normaloff>:/wireframe_mesh.png</iconset>
</property>
<property name="iconSize">
<size>
<width>158</width>
<height>191</height>
</size>
</property>
<property name="autoRaise">
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
@@ -379,6 +379,8 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState
ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true});
m_Common.setMeshViewPixmap(ui->meshView);
ui->viAttrs->setFont(Formatter::PreferredFont());
ui->viBuffers->setFont(Formatter::PreferredFont());
ui->gsFeedback->setFont(Formatter::PreferredFont());
@@ -351,24 +351,29 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QToolButton" name="meshView">
<widget class="RDLabel" name="meshView">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>75</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>View the mesh input data</string>
</property>
<property name="text">
<string/>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/wireframe_mesh.png</pixmap>
</property>
<property name="icon">
<iconset resource="../../Resources/resources.qrc">
<normaloff>:/wireframe_mesh.png</normaloff>:/wireframe_mesh.png</iconset>
</property>
<property name="iconSize">
<size>
<width>158</width>
<height>191</height>
</size>
</property>
<property name="autoRaise">
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
@@ -23,8 +23,11 @@
******************************************************************************/
#include "PipelineStateViewer.h"
#include <QMouseEvent>
#include <QXmlStreamWriter>
#include "3rdparty/toolwindowmanager/ToolWindowManager.h"
#include "Code/Resources.h"
#include "Widgets/Extended/RDLabel.h"
#include "D3D11PipelineStateViewer.h"
#include "D3D12PipelineStateViewer.h"
#include "GLPipelineStateViewer.h"
@@ -420,6 +423,45 @@ void PipelineStateViewer::endHTMLExport(QXmlStreamWriter *xml)
delete xml;
}
void PipelineStateViewer::setMeshViewPixmap(RDLabel *meshView)
{
QImage meshIcon = Pixmaps::wireframe_mesh().toImage();
QImage colSwapped(meshIcon.size(), QImage::Format_ARGB32);
colSwapped.fill(palette().color(QPalette::WindowText));
for(int y = 0; y < meshIcon.height(); y++)
{
const QRgb *in = (const QRgb *)meshIcon.constScanLine(y);
QRgb *out = (QRgb *)colSwapped.scanLine(y);
for(int x = 0; x < meshIcon.width(); x++)
{
*out = qRgba(qRed(*out), qGreen(*out), qBlue(*out), qAlpha(*in));
in++;
out++;
}
}
meshView->setPixmap(QPixmap::fromImage(colSwapped));
meshView->setPreserveAspectRatio(true);
QPalette pal = meshView->palette();
pal.setColor(QPalette::Shadow, pal.color(QPalette::Window).darker(120));
meshView->setPalette(pal);
meshView->setBackgroundRole(QPalette::Window);
meshView->setMouseTracking(true);
QObject::connect(meshView, &RDLabel::mouseMoved, [meshView](QMouseEvent *) {
meshView->setBackgroundRole(QPalette::Shadow);
meshView->setAutoFillBackground(true);
});
QObject::connect(meshView, &RDLabel::leave, [meshView]() {
meshView->setBackgroundRole(QPalette::Window);
meshView->setAutoFillBackground(false);
});
}
bool PipelineStateViewer::PrepareShaderEditing(const ShaderReflection *shaderDetails,
QString &entryFunc, QStringMap &files,
QString &mainfile)
@@ -34,6 +34,8 @@ class PipelineStateViewer;
class QXmlStreamWriter;
class RDLabel;
class D3D11PipelineStateViewer;
class D3D12PipelineStateViewer;
class GLPipelineStateViewer;
@@ -67,6 +69,9 @@ public:
QStringMap &files, QString &mainfile);
void EditShader(ShaderStage shaderType, ResourceId id, const ShaderReflection *shaderDetails,
const QString &entryFunc, const QStringMap &files, const QString &mainfile);
void setMeshViewPixmap(RDLabel *meshView);
QXmlStreamWriter *beginHTMLExport();
void exportHTMLTable(QXmlStreamWriter &xml, const QStringList &cols,
const QList<QVariantList> &rows);
@@ -336,6 +336,8 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx,
ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true});
m_Common.setMeshViewPixmap(ui->meshView);
ui->viAttrs->setFont(Formatter::PreferredFont());
ui->viBuffers->setFont(Formatter::PreferredFont());
ui->vsShader->setFont(Formatter::PreferredFont());
@@ -351,24 +351,29 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QToolButton" name="meshView">
<widget class="RDLabel" name="meshView">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>75</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>View the mesh input data</string>
</property>
<property name="text">
<string/>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/wireframe_mesh.png</pixmap>
</property>
<property name="icon">
<iconset resource="../../Resources/resources.qrc">
<normaloff>:/wireframe_mesh.png</normaloff>:/wireframe_mesh.png</iconset>
</property>
<property name="iconSize">
<size>
<width>158</width>
<height>191</height>
</size>
</property>
<property name="autoRaise">
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>