Expose Vulkan depth clip range in the UI

This change exposes the
VkPipelineViewportDepthClipControlCreateInfoEXT::negativeOneToOne
pipeline state in the UI.  While not a per-viewport state, this state is
output alongside viewport information.

If the extension is not used, or if this flag is false, [0, 1] is shown
as the depth clip range.  If the flag is true, [-1, 1] is shown.
This commit is contained in:
Shahbaz Youssefi
2022-08-24 10:02:49 -04:00
committed by Baldur Karlsson
parent 390e610687
commit 75c1d37a45
4 changed files with 23 additions and 9 deletions
@@ -332,9 +332,9 @@ VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx,
RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this);
ui->viewports->setHeader(header);
ui->viewports->setColumns(
{tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"), tr("MinDepth"), tr("MaxDepth")});
header->setColumnStretchHints({-1, -1, -1, -1, -1, -1, 1});
ui->viewports->setColumns({tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"),
tr("MinDepth"), tr("MaxDepth"), tr("NDCDepthRange")});
header->setColumnStretchHints({-1, -1, -1, -1, -1, -1, -1, 1});
header->setMinimumSectionSize(40);
ui->viewports->setClearSelectionOnFocusLoss(true);
@@ -2430,11 +2430,14 @@ void VulkanPipelineStateViewer::setState()
}
{
const QString ndcDepthRange =
state.viewportScissor.depthNegativeOneToOne ? lit("[-1, 1]") : lit("[0, 1]");
int i = 0;
for(const VKPipe::ViewportScissor &v : state.viewportScissor.viewportScissors)
{
RDTreeWidgetItem *node = new RDTreeWidgetItem(
{i, v.vp.x, v.vp.y, v.vp.width, v.vp.height, v.vp.minDepth, v.vp.maxDepth});
RDTreeWidgetItem *node = new RDTreeWidgetItem({i, v.vp.x, v.vp.y, v.vp.width, v.vp.height,
v.vp.minDepth, v.vp.maxDepth, ndcDepthRange});
ui->viewports->addTopLevelItem(node);
if(v.vp.width == 0 || v.vp.height == 0)
@@ -3880,6 +3883,8 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe::
xml.writeCharacters(tr("Viewports"));
xml.writeEndElement();
const QString ndcDepthRange = vp.depthNegativeOneToOne ? lit("[-1, 1]") : lit("[0, 1]");
QList<QVariantList> rows;
int i = 0;
@@ -3887,14 +3892,14 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe::
{
const Viewport &v = vs.vp;
rows.push_back({i, v.x, v.y, v.width, v.height, v.minDepth, v.maxDepth});
rows.push_back({i, v.x, v.y, v.width, v.height, v.minDepth, v.maxDepth, ndcDepthRange});
i++;
}
m_Common.exportHTMLTable(xml, {tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"),
tr("Min Depth"), tr("Max Depth")},
rows);
QStringList header = {tr("Slot"), tr("X"), tr("Y"), tr("Width"),
tr("Height"), tr("Min Depth"), tr("Max Depth"), tr("NDC Depth Range")};
m_Common.exportHTMLTable(xml, header, rows);
}
{
+3
View File
@@ -781,6 +781,9 @@ and a fragment in none of them is discarded.
disabled, since with no rectangles no fragment can be inside one.
)");
bool discardRectanglesExclusive = true;
DOCUMENT(R"(Whether depth clip range is set to [-1, 1] through VK_EXT_depth_clip_control.)");
bool depthNegativeOneToOne = false;
};
DOCUMENT("Describes the rasterizer state in the pipeline.");
+5
View File
@@ -1362,6 +1362,10 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
(p.discardMode == VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT);
}
{
ret.viewportScissor.depthNegativeOneToOne = p.negativeOneToOne;
}
// Rasterizer
ret.rasterizer.depthClampEnable = p.depthClampEnable;
ret.rasterizer.depthClipEnable = p.depthClipEnable;
@@ -1565,6 +1569,7 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
ret.viewportScissor.viewportScissors.clear();
ret.viewportScissor.discardRectangles.clear();
ret.viewportScissor.discardRectanglesExclusive = true;
ret.viewportScissor.depthNegativeOneToOne = false;
ret.colorBlend.blends.clear();
}
+1
View File
@@ -2130,6 +2130,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::ViewState &el)
SERIALISE_MEMBER(viewportScissors);
SERIALISE_MEMBER(discardRectangles);
SERIALISE_MEMBER(discardRectanglesExclusive);
SERIALISE_MEMBER(depthNegativeOneToOne);
SIZE_CHECK(56);
}