Skip to content

Commit f514815

Browse files
committed
Update buffer formatter help text, save its visibility in config
1 parent e400946 commit f514815

File tree

6 files changed

+28
-2
lines changed

6 files changed

+28
-2
lines changed

qrenderdoc/Code/Interface/PersistantConfig.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ DECLARE_REFLECTION_STRUCT(BugReport);
308308
\
309309
CONFIG_SETTING_VAL(public, int, int, LocalProxyAPI, -1) \
310310
\
311+
CONFIG_SETTING_VAL(public, bool, bool, BufferFormatter_ShowHelp, true) \
312+
\
311313
CONFIG_SETTING_VAL(public, int, TimeUnit, EventBrowser_TimeUnit, TimeUnit::Microseconds) \
312314
\
313315
CONFIG_SETTING_VAL(public, bool, bool, EventBrowser_AddFake, true) \
@@ -551,6 +553,12 @@ For more information about some of these settings that are user-facing see
551553
552554
Defaults to ``-1``.
553555
556+
.. data:: BufferFormatter_ShowHelp
557+
558+
``True`` if the buffer formatter's help section should be shown.
559+
560+
Defaults to ``True``.
561+
554562
.. data:: EventBrowser_TimeUnit
555563
556564
The :class:`TimeUnit` to use to display the duration column in the :class:`EventBrowser`.

qrenderdoc/Widgets/BufferFormatSpecifier.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,17 @@ BufferFormatSpecifier::BufferFormatSpecifier(QWidget *parent)
4141

4242
BufferFormatSpecifier::~BufferFormatSpecifier()
4343
{
44+
if(m_Ctx)
45+
m_Ctx->Config().BufferFormatter_ShowHelp = ui->helpText->isVisible();
4446
delete ui;
4547
}
4648

49+
void BufferFormatSpecifier::setContext(ICaptureContext *ctx)
50+
{
51+
m_Ctx = ctx;
52+
showHelp(m_Ctx->Config().BufferFormatter_ShowHelp);
53+
}
54+
4755
void BufferFormatSpecifier::toggleHelp()
4856
{
4957
ui->helpText->setVisible(!ui->helpText->isVisible());

qrenderdoc/Widgets/BufferFormatSpecifier.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
#include <QWidget>
2828

29+
struct ICaptureContext;
30+
2931
namespace Ui
3032
{
3133
class BufferFormatSpecifier;
@@ -39,6 +41,8 @@ class BufferFormatSpecifier : public QWidget
3941
explicit BufferFormatSpecifier(QWidget *parent = 0);
4042
~BufferFormatSpecifier();
4143

44+
void setContext(ICaptureContext *ctx);
45+
4246
signals:
4347
void processFormat(const QString &format);
4448

@@ -53,4 +57,5 @@ private slots:
5357

5458
private:
5559
Ui::BufferFormatSpecifier *ui;
60+
ICaptureContext *m_Ctx;
5661
};

qrenderdoc/Widgets/BufferFormatSpecifier.ui

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@
7575
<item row="0" column="0" colspan="2">
7676
<widget class="QLabel" name="helpText">
7777
<property name="text">
78-
<string>Type in a buffer format declaration, including struct definitions. Comments and {} braces are skipped, : semantics are ignored.
78+
<string>Type in a buffer format declaration. C and C++ comments are skipped, semantics are ignored.
79+
80+
Structs can be defined and nested, and if no variables are 'loose' the last struct specified will be used.
81+
7982
Declare each element as an hlsl/glsl variable, e.g: &quot;float4 first; float2 second; uint2 third;&quot; or vec4/vec2.
8083

8184
Basic types accepted: bool, byte, short, int, half, float, double.

qrenderdoc/Windows/BufferViewer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,8 @@ BufferViewer::BufferViewer(ICaptureContext &ctx, bool meshview, QWidget *parent)
17301730

17311731
m_MeshView = meshview;
17321732

1733+
ui->formatSpecifier->setContext(&m_Ctx);
1734+
17331735
m_Flycam = new FlycamWrapper();
17341736
m_Arcball = new ArcballWrapper();
17351737
m_CurrentCamera = m_Arcball;

qrenderdoc/Windows/ConstantBufferPreviewer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ConstantBufferPreviewer::ConstantBufferPreviewer(ICaptureContext &ctx, const Sha
4343
QObject::connect(ui->formatSpecifier, &BufferFormatSpecifier::processFormat, this,
4444
&ConstantBufferPreviewer::processFormat);
4545

46-
ui->formatSpecifier->showHelp(false);
46+
ui->formatSpecifier->setContext(&m_Ctx);
4747

4848
ui->splitter->setCollapsible(1, true);
4949
ui->splitter->setSizes({1, 0});

0 commit comments

Comments
 (0)