Explicitly mark depth states as 'disabled'. Closes #2296

* On all APIs when depth is disabled the writes are skipped as well. Explicitly
  set the function and write state to say that they are disabled.
* This also papers over a weirdness on D3D11 which has confused a couple of
  people, where the retrieved desc with GetDesc() on a state object can be
  different to the one it was created with when you set ignored parameters -
  like the depth function with depth disabled.
This commit is contained in:
baldurk
2021-06-22 10:37:49 +01:00
parent 0bc42d8cd1
commit 44431cd536
8 changed files with 93 additions and 24 deletions
@@ -1900,9 +1900,20 @@ void D3D11PipelineStateViewer::setState()
ui->depthState->setText(ToQStr(state.outputMerger.depthStencilState.resourceId));
ui->depthEnabled->setPixmap(state.outputMerger.depthStencilState.depthEnable ? tick : cross);
ui->depthFunc->setText(ToQStr(state.outputMerger.depthStencilState.depthFunction));
ui->depthWrite->setPixmap(state.outputMerger.depthStencilState.depthWrites ? tick : cross);
if(state.outputMerger.depthStencilState.depthEnable)
{
ui->depthEnabled->setPixmap(tick);
ui->depthFunc->setText(ToQStr(state.outputMerger.depthStencilState.depthFunction));
ui->depthWrite->setPixmap(state.outputMerger.depthStencilState.depthWrites ? tick : cross);
ui->depthWrite->setText(QString());
}
else
{
ui->depthEnabled->setPixmap(cross);
ui->depthFunc->setText(tr("Disabled"));
ui->depthWrite->setPixmap(QPixmap());
ui->depthWrite->setText(tr("Disabled"));
}
ui->stencilEnabled->setPixmap(state.outputMerger.depthStencilState.stencilEnable ? tick : cross);
m_Common.SetStencilLabelValue(
@@ -3585,6 +3585,11 @@
<property name="text">
<string/>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/cross.png</pixmap>
</property>
@@ -1950,9 +1950,20 @@ void D3D12PipelineStateViewer::setState()
.arg(state.outputMerger.blendState.blendFactor[2], 0, 'f', 2)
.arg(state.outputMerger.blendState.blendFactor[3], 0, 'f', 2));
ui->depthEnabled->setPixmap(state.outputMerger.depthStencilState.depthEnable ? tick : cross);
ui->depthFunc->setText(ToQStr(state.outputMerger.depthStencilState.depthFunction));
ui->depthWrite->setPixmap(state.outputMerger.depthStencilState.depthWrites ? tick : cross);
if(state.outputMerger.depthStencilState.depthEnable)
{
ui->depthEnabled->setPixmap(tick);
ui->depthFunc->setText(ToQStr(state.outputMerger.depthStencilState.depthFunction));
ui->depthWrite->setPixmap(state.outputMerger.depthStencilState.depthWrites ? tick : cross);
ui->depthWrite->setText(QString());
}
else
{
ui->depthEnabled->setPixmap(cross);
ui->depthFunc->setText(tr("Disabled"));
ui->depthWrite->setPixmap(QPixmap());
ui->depthWrite->setText(tr("Disabled"));
}
if(state.outputMerger.depthStencilState.depthBoundsEnable)
{
@@ -3475,7 +3475,7 @@
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="depthBoundsLabel">
<property name="text">
<string>Bounds:</string>
@@ -3485,7 +3485,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<widget class="QLabel" name="depthBounds">
<property name="font">
<font>
@@ -3516,7 +3516,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="1" column="0">
<widget class="QLabel" name="depthFuncLabel">
<property name="text">
<string>Func:</string>
@@ -3557,6 +3557,11 @@
<property name="text">
<string/>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/cross.png</pixmap>
</property>
@@ -3568,7 +3573,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="1" column="1">
<widget class="QLabel" name="depthFunc">
<property name="font">
<font>
@@ -2158,9 +2158,20 @@ void GLPipelineStateViewer::setState()
.arg(state.framebuffer.blendState.blendFactor[2], 0, 'f', 2)
.arg(state.framebuffer.blendState.blendFactor[3], 0, 'f', 2));
ui->depthEnabled->setPixmap(state.depthState.depthEnable ? tick : cross);
ui->depthFunc->setText(ToQStr(state.depthState.depthFunction));
ui->depthWrite->setPixmap(state.depthState.depthWrites ? tick : cross);
if(state.depthState.depthEnable)
{
ui->depthEnabled->setPixmap(tick);
ui->depthFunc->setText(ToQStr(state.depthState.depthFunction));
ui->depthWrite->setPixmap(state.depthState.depthWrites ? tick : cross);
ui->depthWrite->setText(QString());
}
else
{
ui->depthEnabled->setPixmap(cross);
ui->depthFunc->setText(tr("Disabled"));
ui->depthWrite->setPixmap(QPixmap());
ui->depthWrite->setText(tr("Disabled"));
}
if(state.depthState.depthBounds)
{
@@ -4114,7 +4114,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="depthBoundsLabel">
<property name="text">
<string>Bounds:</string>
@@ -4124,11 +4124,16 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<widget class="QLabel" name="depthBounds">
<property name="text">
<string/>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/cross.png</pixmap>
</property>
@@ -4155,6 +4160,11 @@
<property name="text">
<string/>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/cross.png</pixmap>
</property>
@@ -4166,7 +4176,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="1" column="0">
<widget class="QLabel" name="depthFuncLabel">
<property name="text">
<string>Func:</string>
@@ -4176,7 +4186,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="1" column="1">
<widget class="QLabel" name="depthFunc">
<property name="font">
<font>
@@ -2700,9 +2700,20 @@ void VulkanPipelineStateViewer::setState()
else
ui->logicOp->setText(lit("-"));
ui->depthEnabled->setPixmap(state.depthStencil.depthTestEnable ? tick : cross);
ui->depthFunc->setText(ToQStr(state.depthStencil.depthFunction));
ui->depthWrite->setPixmap(state.depthStencil.depthWriteEnable ? tick : cross);
if(state.depthStencil.depthTestEnable)
{
ui->depthEnabled->setPixmap(tick);
ui->depthFunc->setText(ToQStr(state.depthStencil.depthFunction));
ui->depthWrite->setPixmap(state.depthStencil.depthWriteEnable ? tick : cross);
ui->depthWrite->setText(QString());
}
else
{
ui->depthEnabled->setPixmap(cross);
ui->depthFunc->setText(tr("Disabled"));
ui->depthWrite->setPixmap(QPixmap());
ui->depthWrite->setText(tr("Disabled"));
}
if(state.depthStencil.depthBoundsEnable)
{
@@ -3455,7 +3455,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="depthBoundsLabel">
<property name="text">
<string>Bounds:</string>
@@ -3465,7 +3465,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<widget class="QLabel" name="depthBounds">
<property name="font">
<font>
@@ -3501,6 +3501,11 @@
<property name="text">
<string/>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="pixmap">
<pixmap resource="../../Resources/resources.qrc">:/cross.png</pixmap>
</property>
@@ -3512,7 +3517,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="1" column="0">
<widget class="QLabel" name="depthFuncLabel">
<property name="text">
<string>Func:</string>
@@ -3522,7 +3527,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="1" column="1">
<widget class="QLabel" name="depthFunc">
<property name="font">
<font>