mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-27 08:56:44 +00:00
Add support for saving and loading structure definitions
This commit is contained in:
@@ -404,10 +404,11 @@ DECLARE_REFLECTION_STRUCT(BugReport);
|
||||
CONFIG_SETTING_VAL(public, int, int, LocalProxyAPI, -1) \
|
||||
\
|
||||
DOCUMENT( \
|
||||
"``True`` if the buffer formatter's help section should be shown.\n" \
|
||||
"\n:" \
|
||||
"Defaults to ``True``."); \
|
||||
CONFIG_SETTING_VAL(public, bool, bool, BufferFormatter_ShowHelp, true) \
|
||||
"A list of strings with saved formats for the buffer formatter. The first line is the " \
|
||||
"name and the rest of the contents are the formats.\n" \
|
||||
"\n" \
|
||||
":type: List[str]"); \
|
||||
CONFIG_SETTING(public, QVariantList, rdcarray<rdcstr>, BufferFormatter_SavedFormats) \
|
||||
\
|
||||
DOCUMENT( \
|
||||
"The :class:`TimeUnit` to use to display the duration column in the " \
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QKeyEvent>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMenu>
|
||||
#include <QMetaMethod>
|
||||
#include <QMouseEvent>
|
||||
@@ -1189,6 +1190,16 @@ QString RichResourceTextFormat(ICaptureContext &ctx, QVariant var)
|
||||
return var.toString();
|
||||
}
|
||||
|
||||
FullEditorDelegate::FullEditorDelegate(QWidget *parent) : QStyledItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *FullEditorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
return new QLineEdit(parent);
|
||||
}
|
||||
|
||||
RichTextViewDelegate::RichTextViewDelegate(QAbstractItemView *parent)
|
||||
: m_widget(parent), ForwardingDelegate(parent)
|
||||
{
|
||||
|
||||
@@ -698,6 +698,17 @@ private:
|
||||
QAbstractItemDelegate *m_delegate = NULL;
|
||||
};
|
||||
|
||||
class FullEditorDelegate : public QStyledItemDelegate
|
||||
{
|
||||
private:
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FullEditorDelegate(QWidget *parent);
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
};
|
||||
|
||||
// delegate that will handle painting, hovering and clicking on rich text items.
|
||||
// owning view needs to call linkHover, and adjust its cursor and repaint as necessary.
|
||||
class RichTextViewDelegate : public ForwardingDelegate
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
RESOURCE_DEF(flip_y, "flip_y.png") \
|
||||
RESOURCE_DEF(folder, "folder.png") \
|
||||
RESOURCE_DEF(folder_page_white, "folder_page_white.png") \
|
||||
RESOURCE_DEF(help, "help.png") \
|
||||
RESOURCE_DEF(hourglass, "hourglass.png") \
|
||||
RESOURCE_DEF(house, "house.png") \
|
||||
RESOURCE_DEF(information, "information.png") \
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 761 B |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -95,6 +95,8 @@
|
||||
<file>folder@2x.png</file>
|
||||
<file>folder_page_white.png</file>
|
||||
<file>folder_page_white@2x.png</file>
|
||||
<file>help.png</file>
|
||||
<file>help@2x.png</file>
|
||||
<file>hourglass.png</file>
|
||||
<file>hourglass@2x.png</file>
|
||||
<file>house.png</file>
|
||||
|
||||
@@ -24,32 +24,89 @@
|
||||
|
||||
#include "BufferFormatSpecifier.h"
|
||||
#include <QFontDatabase>
|
||||
#include <QKeyEvent>
|
||||
#include <QScrollBar>
|
||||
#include <QSignalBlocker>
|
||||
#include <QTextCursor>
|
||||
#include <QTextDocument>
|
||||
#include "Code/QRDUtils.h"
|
||||
#include "ui_BufferFormatSpecifier.h"
|
||||
|
||||
BufferFormatList *globalFormatList = NULL;
|
||||
|
||||
BufferFormatList::BufferFormatList(ICaptureContext &ctx, QObject *parent)
|
||||
: m_Ctx(ctx), QObject(parent)
|
||||
{
|
||||
rdcarray<rdcstr> saved = m_Ctx.Config().BufferFormatter_SavedFormats;
|
||||
|
||||
for(rdcstr f : saved)
|
||||
{
|
||||
int idx = f.indexOf('\n');
|
||||
|
||||
formats[QString(f.substr(0, idx))] = QString(f.substr(idx + 1)).trimmed();
|
||||
}
|
||||
}
|
||||
|
||||
void BufferFormatList::setFormat(QString name, QString format)
|
||||
{
|
||||
bool newFmt = !formats.contains(name);
|
||||
if(format.isEmpty())
|
||||
formats.remove(name);
|
||||
else
|
||||
formats[name] = format;
|
||||
if(newFmt || (!newFmt && format.isEmpty()))
|
||||
emit formatListUpdated();
|
||||
|
||||
QStringList keys = formats.keys();
|
||||
keys.sort(Qt::CaseInsensitive);
|
||||
rdcarray<rdcstr> saved;
|
||||
for(QString k : keys)
|
||||
saved.push_back(k + lit("\n") + formats[k]);
|
||||
m_Ctx.Config().BufferFormatter_SavedFormats = saved;
|
||||
}
|
||||
|
||||
BufferFormatSpecifier::BufferFormatSpecifier(QWidget *parent)
|
||||
: QWidget(parent), ui(new Ui::BufferFormatSpecifier)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QObject::connect(ui->toggleHelp, &QPushButton::clicked, this, &BufferFormatSpecifier::toggleHelp);
|
||||
|
||||
setErrors(QString());
|
||||
|
||||
on_showHelp_toggled(false);
|
||||
|
||||
ui->savedList->setItemDelegate(new FullEditorDelegate(ui->savedList));
|
||||
|
||||
ui->formatText->setFont(Formatter::FixedFont());
|
||||
ui->savedList->setFont(Formatter::PreferredFont());
|
||||
|
||||
ui->savedList->setColumns({tr("Saved formats")});
|
||||
}
|
||||
|
||||
BufferFormatSpecifier::~BufferFormatSpecifier()
|
||||
{
|
||||
if(m_Ctx)
|
||||
m_Ctx->Config().BufferFormatter_ShowHelp = ui->helpText->isVisible();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::setAutoFormat(QString autoFormat)
|
||||
{
|
||||
m_AutoFormat = autoFormat;
|
||||
|
||||
updateFormatList();
|
||||
|
||||
setFormat(autoFormat);
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::setContext(ICaptureContext *ctx)
|
||||
{
|
||||
m_Ctx = ctx;
|
||||
showHelp(m_Ctx->Config().BufferFormatter_ShowHelp);
|
||||
|
||||
if(!globalFormatList)
|
||||
globalFormatList = new BufferFormatList(*ctx, ctx->GetMainWindow()->Widget());
|
||||
|
||||
QObject::connect(globalFormatList, &BufferFormatList::formatListUpdated, this,
|
||||
&BufferFormatSpecifier::updateFormatList);
|
||||
|
||||
updateFormatList();
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::setTitle(QString title)
|
||||
@@ -57,16 +114,6 @@ void BufferFormatSpecifier::setTitle(QString title)
|
||||
ui->formatGroup->setTitle(title);
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::toggleHelp()
|
||||
{
|
||||
ui->helpText->setVisible(!ui->helpText->isVisible());
|
||||
|
||||
if(ui->helpText->isVisible())
|
||||
showHelp(true);
|
||||
else
|
||||
showHelp(false);
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::setFormat(const QString &format)
|
||||
{
|
||||
ui->formatText->setText(format);
|
||||
@@ -81,22 +128,224 @@ void BufferFormatSpecifier::setErrors(const QString &errors)
|
||||
ui->errors->setVisible(true);
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::showHelp(bool help)
|
||||
void BufferFormatSpecifier::updateFormatList()
|
||||
{
|
||||
ui->helpText->setVisible(help);
|
||||
QString sel;
|
||||
|
||||
RDTreeWidgetItem *item = ui->savedList->selectedItem();
|
||||
if(item)
|
||||
sel = item->text(0);
|
||||
|
||||
if(help)
|
||||
{
|
||||
ui->gridLayout->removeWidget(ui->formatGroup);
|
||||
ui->gridLayout->addWidget(ui->formatGroup, 1, 0, 1, 3);
|
||||
QSignalBlocker block(ui->savedList);
|
||||
int vs = ui->savedList->verticalScrollBar()->value();
|
||||
ui->savedList->beginUpdate();
|
||||
|
||||
ui->savedList->clear();
|
||||
|
||||
int selidx = -1;
|
||||
|
||||
if(!m_AutoFormat.isEmpty())
|
||||
{
|
||||
item = new RDTreeWidgetItem({tr("<Auto-generated>")});
|
||||
item->setItalic(true);
|
||||
ui->savedList->addTopLevelItem(item);
|
||||
|
||||
if(item->text(0) == sel)
|
||||
selidx = 0;
|
||||
}
|
||||
|
||||
QStringList formats = globalFormatList->getFormats();
|
||||
|
||||
for(QString f : formats)
|
||||
{
|
||||
if(f == sel)
|
||||
selidx = ui->savedList->topLevelItemCount();
|
||||
|
||||
ui->savedList->addTopLevelItem(new RDTreeWidgetItem({f}));
|
||||
}
|
||||
|
||||
{
|
||||
item = new RDTreeWidgetItem({tr("New...")});
|
||||
if(item->text(0) == sel)
|
||||
selidx = ui->savedList->topLevelItemCount();
|
||||
item->setEditable(0, true);
|
||||
ui->savedList->addTopLevelItem(item);
|
||||
}
|
||||
|
||||
if(selidx >= 0)
|
||||
ui->savedList->setSelectedItem(ui->savedList->topLevelItem(selidx));
|
||||
|
||||
ui->savedList->resizeColumnToContents(0);
|
||||
|
||||
ui->savedList->endUpdate();
|
||||
ui->savedList->verticalScrollBar()->setValue(vs);
|
||||
}
|
||||
|
||||
on_savedList_itemSelectionChanged();
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_savedList_keyPress(QKeyEvent *event)
|
||||
{
|
||||
if(event->key() == Qt::Key_Delete || event->key() == Qt::Key_Backspace)
|
||||
{
|
||||
on_delDef_clicked();
|
||||
}
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_savedList_itemChanged(RDTreeWidgetItem *item, int column)
|
||||
{
|
||||
// ignore updates for anything but the last one
|
||||
if(ui->savedList->indexOfTopLevelItem(item) != ui->savedList->topLevelItemCount() - 1)
|
||||
return;
|
||||
|
||||
QString name = item->text(0);
|
||||
|
||||
// prevent recursion
|
||||
{
|
||||
QSignalBlocker block(ui->savedList);
|
||||
|
||||
// if they didn't actually edit it, ignore
|
||||
if(name == tr("New..."))
|
||||
return;
|
||||
|
||||
if(globalFormatList->hasFormat(name))
|
||||
{
|
||||
RDDialog::critical(this, tr("Name already in use"),
|
||||
tr("The definition name '%1' is already in used.\n"
|
||||
"To update this definition, select it and click update."));
|
||||
item->setText(0, tr("New..."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
globalFormatList->setFormat(name, ui->formatText->toPlainText());
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_savedList_itemDoubleClicked(RDTreeWidgetItem *item, int column)
|
||||
{
|
||||
ui->savedList->setSelectedItem(item);
|
||||
|
||||
if(ui->loadDef->isEnabled())
|
||||
on_loadDef_clicked();
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_savedList_itemSelectionChanged()
|
||||
{
|
||||
RDTreeWidgetItem *item = ui->savedList->selectedItem();
|
||||
|
||||
ui->saveDef->setEnabled(item != NULL);
|
||||
ui->loadDef->setEnabled(item != NULL);
|
||||
ui->delDef->setEnabled(item != NULL);
|
||||
|
||||
// auto format is always the first, and can't be saved to or deleted
|
||||
if(!m_AutoFormat.isEmpty() && ui->savedList->indexOfTopLevelItem(item) == 0)
|
||||
{
|
||||
ui->saveDef->setEnabled(false);
|
||||
ui->delDef->setEnabled(false);
|
||||
}
|
||||
|
||||
// the 'new' format is always the last, and can't be loaded from or deleted
|
||||
if(ui->savedList->indexOfTopLevelItem(item) == ui->savedList->topLevelItemCount() - 1)
|
||||
{
|
||||
ui->loadDef->setEnabled(false);
|
||||
ui->delDef->setEnabled(false);
|
||||
|
||||
ui->saveDef->setToolTip(tr("Create new current structure definition"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->gridLayout->removeWidget(ui->formatGroup);
|
||||
ui->gridLayout->addWidget(ui->formatGroup, 0, 0, 2, 3);
|
||||
ui->saveDef->setToolTip(tr("Update selected with current structure definition"));
|
||||
}
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_showHelp_toggled(bool help)
|
||||
{
|
||||
ui->helpText->setVisible(help);
|
||||
ui->formatText->setVisible(!help);
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_loadDef_clicked()
|
||||
{
|
||||
RDTreeWidgetItem *item = ui->savedList->selectedItem();
|
||||
|
||||
if(!item)
|
||||
return;
|
||||
|
||||
QString name = item->text(0);
|
||||
|
||||
QString format;
|
||||
if(!m_AutoFormat.isEmpty() && ui->savedList->indexOfTopLevelItem(item) == 0)
|
||||
format = m_AutoFormat;
|
||||
else
|
||||
format = globalFormatList->getFormat(name);
|
||||
|
||||
{
|
||||
QSignalBlocker block(ui->formatText);
|
||||
|
||||
QTextDocument *doc = ui->formatText->document();
|
||||
QTextCursor cur(doc);
|
||||
cur.select(QTextCursor::Document);
|
||||
cur.insertText(format);
|
||||
}
|
||||
|
||||
emit processFormat(format);
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_saveDef_clicked()
|
||||
{
|
||||
RDTreeWidgetItem *item = ui->savedList->selectedItem();
|
||||
|
||||
if(!item)
|
||||
return;
|
||||
|
||||
// for the 'new...' just trigger an edit and let the user do it that way. This reduces
|
||||
// duplication, avoids need for a prompt for the name, and educates the user that they can edit
|
||||
// directly
|
||||
if(ui->savedList->indexOfTopLevelItem(item) == ui->savedList->topLevelItemCount() - 1)
|
||||
{
|
||||
ui->savedList->editItem(item);
|
||||
return;
|
||||
}
|
||||
|
||||
QString name = item->text(0);
|
||||
|
||||
QMessageBox::StandardButton res = RDDialog::question(
|
||||
this, tr("Updating definition"),
|
||||
tr("Are you sure you wish to overwrite definition '%1'?").arg(name), RDDialog::YesNoCancel);
|
||||
|
||||
if(res != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
globalFormatList->setFormat(name, ui->formatText->toPlainText());
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_delDef_clicked()
|
||||
{
|
||||
RDTreeWidgetItem *item = ui->savedList->selectedItem();
|
||||
|
||||
if(!item)
|
||||
return;
|
||||
|
||||
QString name = item->text(0);
|
||||
|
||||
QMessageBox::StandardButton res = RDDialog::question(
|
||||
this, tr("Deleting definition"),
|
||||
tr("Are you sure you wish to delete definition '%1'?").arg(name), RDDialog::YesNoCancel);
|
||||
|
||||
if(res != QMessageBox::Yes)
|
||||
return;
|
||||
|
||||
ui->savedList->clearSelection();
|
||||
|
||||
globalFormatList->setFormat(name, QString());
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_formatText_textChanged()
|
||||
{
|
||||
ui->savedList->clearSelection();
|
||||
}
|
||||
|
||||
void BufferFormatSpecifier::on_apply_clicked()
|
||||
{
|
||||
setErrors(QString());
|
||||
|
||||
@@ -24,15 +24,38 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMap>
|
||||
#include <QWidget>
|
||||
|
||||
struct ICaptureContext;
|
||||
|
||||
class RDTreeWidgetItem;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class BufferFormatSpecifier;
|
||||
}
|
||||
|
||||
class BufferFormatList : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
ICaptureContext &m_Ctx;
|
||||
QMap<QString, QString> formats;
|
||||
|
||||
public:
|
||||
explicit BufferFormatList(ICaptureContext &ctx, QObject *parent = 0);
|
||||
QStringList getFormats() { return formats.keys(); }
|
||||
QString getFormat(QString name) { return formats[name]; }
|
||||
bool hasFormat(QString name) { return formats.contains(name); }
|
||||
void setFormat(QString name, QString format);
|
||||
|
||||
signals:
|
||||
void formatListUpdated();
|
||||
};
|
||||
|
||||
extern BufferFormatList *globalFormatList;
|
||||
|
||||
class BufferFormatSpecifier : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -41,6 +64,8 @@ public:
|
||||
explicit BufferFormatSpecifier(QWidget *parent = 0);
|
||||
~BufferFormatSpecifier();
|
||||
|
||||
void setAutoFormat(QString autoFormat);
|
||||
|
||||
void setContext(ICaptureContext *ctx);
|
||||
void setTitle(QString title);
|
||||
|
||||
@@ -48,10 +73,21 @@ signals:
|
||||
void processFormat(const QString &format);
|
||||
|
||||
public slots:
|
||||
void toggleHelp();
|
||||
// automatic slots
|
||||
void on_showHelp_toggled(bool help);
|
||||
void on_loadDef_clicked();
|
||||
void on_saveDef_clicked();
|
||||
void on_delDef_clicked();
|
||||
void on_formatText_textChanged();
|
||||
void on_savedList_keyPress(QKeyEvent *event);
|
||||
void on_savedList_itemChanged(RDTreeWidgetItem *item, int column);
|
||||
void on_savedList_itemDoubleClicked(RDTreeWidgetItem *item, int column);
|
||||
void on_savedList_itemSelectionChanged();
|
||||
|
||||
// manual slots
|
||||
void setFormat(const QString &format);
|
||||
void setErrors(const QString &errors);
|
||||
void showHelp(bool help);
|
||||
void updateFormatList();
|
||||
|
||||
private slots:
|
||||
void on_apply_clicked();
|
||||
@@ -59,4 +95,6 @@ private slots:
|
||||
private:
|
||||
Ui::BufferFormatSpecifier *ui;
|
||||
ICaptureContext *m_Ctx;
|
||||
|
||||
QString m_AutoFormat;
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>713</width>
|
||||
<height>633</height>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -30,30 +30,6 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="helpText">
|
||||
<property name="text">
|
||||
<string>Type in a buffer format declaration. C and C++ comments are skipped, semantics are ignored.
|
||||
|
||||
Structs can be defined and nested, and if no variables are 'loose' the last struct specified will be used.
|
||||
|
||||
Declare each element as an hlsl/glsl variable, e.g: "float4 first; float2 second; uint2 third;" or vec4/vec2.
|
||||
|
||||
Basic types accepted: bool, byte, short, int, half, float, double.
|
||||
Unsigned integer types: ubyte, ushort, uint
|
||||
Hex-formatted integer types: xbyte, xshort, xint
|
||||
|
||||
Additionally special formats: unorm[hb] (half, byte) and snorm[hb], uintten/unormten (10:10:10:2 packing), floateleven (11:11:10F packing)
|
||||
|
||||
You can prepend 'rgb' onto an element to colour backgrounds with the RGB values, e.g. 'rgb xbyte4 pixels[256]'.
|
||||
|
||||
Vectors (e.g. float4), matrices ([row_major] half3x4) and single-dimension arrays (float[16]) are supported.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="formatGroup">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
@@ -64,7 +40,10 @@ Vectors (e.g. float4), matrices ([row_major] half3x4) and single-dimension array
|
||||
<property name="title">
|
||||
<string>Format</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
@@ -80,10 +59,188 @@ Vectors (e.g. float4), matrices ([row_major] half3x4) and single-dimension array
|
||||
<item>
|
||||
<widget class="QTextEdit" name="formatText"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="helpText">
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Exhaustive documentation can be found in the </span><a href="https://renderdoc.org/docs/how/how_buffer_format.html"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">online docs</span></a><span style=" font-size:8pt;">.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Buffer format declarations are similar to HLSL or GLSL struct definitions with normal vector, matrix and base types (e.g. <code>float</code>, <code>float4</code> or <code>vec4</code>, etc). In many cases these can be copied and pasted from shader source.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">You can define and use structs. The buffer format is defined by all global variables. If there are no globals defined, the last struct defined will be used.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Most types that can be declared in shaders can be used, including half, short, as well as the usual int, float. All of these can be matrices or arrays.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Packing/padding rules can be specified with <code>#pack(rules)</code>. Supported D3D rules: <code>cbuffer</code>, <code>uav</code>. Supported GL/VK rules: <code>std140</code>, <code>std430</code>, <code>scalar</code>.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Bitfields are supported using C syntax, enums can be defined but all enum values must have explicit decimal or hexadecimal numerical values.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Annotations are supported for explicit layout, bitpacked types like R10G10B10A2, or alternate displays of values including RGB/hexadecimal/octal display. For a complete list see </span><a href="https://renderdoc.org/docs/how/how_buffer_format.html"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">the documentation linked above</span></a><span style=" font-size:8pt;">.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="savedContainer" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="RDTreeWidget" name="savedList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="showHelp">
|
||||
<property name="toolTip">
|
||||
<string>Show buffer definition help</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Resources/resources.qrc">
|
||||
<normaloff>:/help.png</normaloff>:/help.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="delDef">
|
||||
<property name="toolTip">
|
||||
<string>Delete selected structure definition</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Resources/resources.qrc">
|
||||
<normaloff>:/del.png</normaloff>:/del.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="saveDef">
|
||||
<property name="toolTip">
|
||||
<string>Update selected with current structure definition</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Resources/resources.qrc">
|
||||
<normaloff>:/save.png</normaloff>:/save.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="loadDef">
|
||||
<property name="toolTip">
|
||||
<string>Load selected structure definition</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../Resources/resources.qrc">
|
||||
<normaloff>:/action_hover.png</normaloff>:/action_hover.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="errors">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@@ -133,9 +290,12 @@ Vectors (e.g. float4), matrices ([row_major] half3x4) and single-dimension array
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
@@ -150,19 +310,6 @@ Vectors (e.g. float4), matrices ([row_major] half3x4) and single-dimension array
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toggleHelp">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Toggle Help</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="apply">
|
||||
<property name="sizePolicy">
|
||||
@@ -180,6 +327,15 @@ Vectors (e.g. float4), matrices ([row_major] half3x4) and single-dimension array
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RDTreeWidget</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>Widgets/Extended/RDTreeWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../Resources/resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -774,9 +774,14 @@ void RDTreeWidget::collapseAllItems(RDTreeWidgetItem *item)
|
||||
collapseAll(m_model->indexForItem(item, 0));
|
||||
}
|
||||
|
||||
void RDTreeWidget::scrollToItem(RDTreeWidgetItem *node)
|
||||
void RDTreeWidget::scrollToItem(RDTreeWidgetItem *item)
|
||||
{
|
||||
scrollTo(m_model->indexForItem(node, 0));
|
||||
scrollTo(m_model->indexForItem(item, 0));
|
||||
}
|
||||
|
||||
void RDTreeWidget::editItem(RDTreeWidgetItem *item)
|
||||
{
|
||||
edit(m_model->indexForItem(item, 0));
|
||||
}
|
||||
|
||||
void RDTreeWidget::clear()
|
||||
|
||||
@@ -269,7 +269,8 @@ public:
|
||||
void expandAllItems(RDTreeWidgetItem *item);
|
||||
void collapseItem(RDTreeWidgetItem *item);
|
||||
void collapseAllItems(RDTreeWidgetItem *item);
|
||||
void scrollToItem(RDTreeWidgetItem *node);
|
||||
void scrollToItem(RDTreeWidgetItem *item);
|
||||
void editItem(RDTreeWidgetItem *item);
|
||||
|
||||
void clear();
|
||||
|
||||
|
||||
@@ -4166,7 +4166,7 @@ void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId
|
||||
|
||||
m_PagingByteOffset = 0;
|
||||
|
||||
ui->formatSpecifier->setFormat(format);
|
||||
ui->formatSpecifier->setAutoFormat(format);
|
||||
|
||||
processFormat(format);
|
||||
}
|
||||
|
||||
@@ -65,16 +65,6 @@ struct AccessedResourceTag
|
||||
Q_DECLARE_METATYPE(VariableTag);
|
||||
Q_DECLARE_METATYPE(AccessedResourceTag);
|
||||
|
||||
FullEditorDelegate::FullEditorDelegate(QWidget *parent) : QStyledItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *FullEditorDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
return new QLineEdit(parent);
|
||||
}
|
||||
|
||||
ShaderViewer::ShaderViewer(ICaptureContext &ctx, QWidget *parent)
|
||||
: QFrame(parent), ui(new Ui::ShaderViewer), m_Ctx(ctx)
|
||||
{
|
||||
|
||||
@@ -70,17 +70,6 @@ struct AccessedResourceData
|
||||
rdcarray<size_t> steps;
|
||||
};
|
||||
|
||||
class FullEditorDelegate : public QStyledItemDelegate
|
||||
{
|
||||
private:
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FullEditorDelegate(QWidget *parent);
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
};
|
||||
|
||||
enum class WatchVarState : int
|
||||
{
|
||||
Invalid = 0,
|
||||
|
||||
@@ -1992,6 +1992,8 @@
|
||||
<Image Include="Resources\folder.png" />
|
||||
<Image Include="Resources\folder_page_white%402x.png" />
|
||||
<Image Include="Resources\folder_page_white.png" />
|
||||
<Image Include="Resources\help%402x.png" />
|
||||
<Image Include="Resources\help.png" />
|
||||
<Image Include="Resources\hourglass%402x.png" />
|
||||
<Image Include="Resources\hourglass.png" />
|
||||
<Image Include="Resources\house%402x.png" />
|
||||
|
||||
@@ -1963,6 +1963,12 @@
|
||||
<Image Include="Resources\align%402x.png">
|
||||
<Filter>Resources\Files</Filter>
|
||||
</Image>
|
||||
<Image Include="Resources\help.png">
|
||||
<Filter>Resources\Files</Filter>
|
||||
</Image>
|
||||
<Image Include="Resources\help%402x.png">
|
||||
<Filter>Resources\Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include="python36.natvis" />
|
||||
|
||||
Reference in New Issue
Block a user