Add option to make y-flipping a per-texture state instead of global

This commit is contained in:
baldurk
2019-02-04 14:42:56 +00:00
parent 2853029847
commit f20e871510
7 changed files with 77 additions and 1 deletions
+6
View File
@@ -182,6 +182,12 @@ When changing texture from one to another, when this option is enabled the range
Settings including which channels are displayed (red, green, blue, alpha or depth/stencil), the mip or slice/cubemap face to display, or the visible min/max range values are remembered with the texture you were looking at. In other words if you display a render target with only the alpha channel visible, then switching to view another texture will default back to RGB - and switching back to that render target will view alpha again.
---------------
| :guilabel:`Y-flipping state saved per-texture` Default: ``Disabled``
If the above setting is enabled, then also store the y-flip per texture. By default this is treated as a global toggle for all textures. With this setting enabled the flip will default to off for all textures, and then be saved per-texture.
Shader Viewer options
---------------------
@@ -284,6 +284,8 @@ DECLARE_REFLECTION_STRUCT(BugReport);
\
CONFIG_SETTING_VAL(public, bool, bool, TextureViewer_PerTexSettings, true) \
\
CONFIG_SETTING_VAL(public, bool, bool, TextureViewer_PerTexYFlip, false) \
\
CONFIG_SETTING_VAL(public, bool, bool, ShaderViewer_FriendlyNaming, true) \
\
CONFIG_SETTING_VAL(public, bool, bool, AlwaysReplayLocally, false) \
@@ -480,6 +482,15 @@ For more information about some of these settings that are user-facing see
Defaults to ``True``.
.. data:: TextureViewer_PerTexYFlip
``True`` if the :class:`TextureViewer` should treat y-flipping as a per-texture state rather than
a global toggle.
Does nothing if per-texture settings are disabled in general.
Defaults to ``False``.
.. data:: ShaderViewer_FriendlyNaming
``True`` if the :class:`ShaderViewer` should replace register names with the high-level language
@@ -108,10 +108,13 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
ui->TextureViewer_ResetRange->setChecked(m_Ctx.Config().TextureViewer_ResetRange);
ui->TextureViewer_PerTexSettings->setChecked(m_Ctx.Config().TextureViewer_PerTexSettings);
ui->TextureViewer_PerTexYFlip->setChecked(m_Ctx.Config().TextureViewer_PerTexYFlip);
ui->ShaderViewer_FriendlyNaming->setChecked(m_Ctx.Config().ShaderViewer_FriendlyNaming);
ui->CheckUpdate_AllowChecks->setChecked(m_Ctx.Config().CheckUpdate_AllowChecks);
ui->Font_PreferMonospaced->setChecked(m_Ctx.Config().Font_PreferMonospaced);
ui->TextureViewer_PerTexYFlip->setEnabled(ui->TextureViewer_PerTexSettings->isChecked());
ui->AlwaysReplayLocally->setChecked(m_Ctx.Config().AlwaysReplayLocally);
#if RENDERDOC_ANALYTICS_ENABLE
@@ -422,6 +425,15 @@ void SettingsDialog::on_TextureViewer_PerTexSettings_toggled(bool checked)
{
m_Ctx.Config().TextureViewer_PerTexSettings = ui->TextureViewer_PerTexSettings->isChecked();
ui->TextureViewer_PerTexYFlip->setEnabled(ui->TextureViewer_PerTexSettings->isChecked());
m_Ctx.Config().Save();
}
void SettingsDialog::on_TextureViewer_PerTexYFlip_toggled(bool checked)
{
m_Ctx.Config().TextureViewer_PerTexYFlip = ui->TextureViewer_PerTexYFlip->isChecked();
m_Ctx.Config().Save();
}
@@ -76,6 +76,7 @@ private slots:
// texture viewer
void on_TextureViewer_PerTexSettings_toggled(bool checked);
void on_TextureViewer_ResetRange_toggled(bool checked);
void on_TextureViewer_PerTexYFlip_toggled(bool checked);
// shader viewer
void on_ShaderViewer_FriendlyNaming_toggled(bool checked);
+33 -1
View File
@@ -631,14 +631,46 @@ After interop is enabled you will need to reload any capture.</string>
</size>
</property>
<property name="toolTip">
<string>The visible channels (RGBA) and selected mip/slice are remembered and restored per-texture.</string>
<string>Settings such as visible channels (RGBA) and selected mip/slice are remembered and restored per-texture.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Y-flipping state is remembered and restored per-texture, rather than treated as a global toggle.</string>
</property>
<property name="text">
<string>Y-flipping state saved per-texture</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="TextureViewer_PerTexYFlip">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Y-flipping state is remembered and restored per-texture, rather than treated as a global toggle.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
+12
View File
@@ -1109,6 +1109,9 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
m_TextureSettings[m_TexDisplay.resourceId].b = ui->channelBlue->isChecked();
m_TextureSettings[m_TexDisplay.resourceId].a = ui->channelAlpha->isChecked();
// save state regardless, we just don't apply it without the setting
m_TextureSettings[m_TexDisplay.resourceId].flip_y = ui->flip_y->isChecked();
m_TextureSettings[m_TexDisplay.resourceId].displayType = qMax(0, ui->channels->currentIndex());
m_TextureSettings[m_TexDisplay.resourceId].customShader = ui->customShader->currentText();
@@ -1317,6 +1320,9 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
if(useslicesettings)
ui->sliceFace->setCurrentIndex(m_TextureSettings[tex.resourceId].slice);
if(m_Ctx.Config().TextureViewer_PerTexYFlip)
ui->flip_y->setChecked(m_TextureSettings[tex.resourceId].flip_y);
}
// handling for if we've switched to a new texture
@@ -1337,6 +1343,9 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
ui->depthDisplay->setChecked(m_TextureSettings[tex.resourceId].depth);
ui->stencilDisplay->setChecked(m_TextureSettings[tex.resourceId].stencil);
if(m_Ctx.Config().TextureViewer_PerTexYFlip)
ui->flip_y->setChecked(m_TextureSettings[tex.resourceId].flip_y);
m_NoRangePaint = true;
ui->rangeHistogram->setRange(m_TextureSettings[m_TexDisplay.resourceId].minrange,
m_TextureSettings[m_TexDisplay.resourceId].maxrange);
@@ -1357,6 +1366,9 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw)
ui->depthDisplay->setChecked(true);
ui->stencilDisplay->setChecked(false);
if(m_Ctx.Config().TextureViewer_PerTexYFlip)
ui->flip_y->setChecked(false);
m_NoRangePaint = true;
UI_SetHistogramRange(texptr, m_TexDisplay.typeHint);
m_NoRangePaint = false;
+2
View File
@@ -97,6 +97,7 @@ struct TexSettings
displayType = 0;
r = g = b = true;
a = false;
flip_y = false;
depth = true;
stencil = false;
mip = 0;
@@ -109,6 +110,7 @@ struct TexSettings
int displayType; // RGBA, RGBM, YUV Decode, Custom
QString customShader;
bool r, g, b, a;
bool flip_y;
bool depth, stencil;
int mip, slice;
float minrange, maxrange;