From 9159401b149c2cbf50db32f81129d6d71a54024b Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 19 Feb 2019 14:22:36 +0100 Subject: [PATCH] [dxvk] Use depthClipEnable during graphics pipeline creation Fall back to previous behaviour if the feature is not available. --- src/dxvk/dxvk_graphics.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index 35493510..5215c223 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -315,11 +315,17 @@ namespace dxvk { xfbStreamInfo.flags = 0; xfbStreamInfo.rasterizationStream = uint32_t(rasterizedStream); + VkPipelineRasterizationDepthClipStateCreateInfoEXT rsDepthClipInfo; + rsDepthClipInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT; + rsDepthClipInfo.pNext = nullptr; + rsDepthClipInfo.flags = 0; + rsDepthClipInfo.depthClipEnable = state.rsDepthClipEnable; + VkPipelineRasterizationStateCreateInfo rsInfo; rsInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; - rsInfo.pNext = nullptr; + rsInfo.pNext = &rsDepthClipInfo; rsInfo.flags = 0; - rsInfo.depthClampEnable = !state.rsDepthClipEnable; + rsInfo.depthClampEnable = VK_TRUE; rsInfo.rasterizerDiscardEnable = rasterizedStream < 0; rsInfo.polygonMode = state.rsPolygonMode; rsInfo.cullMode = state.rsCullMode; @@ -331,7 +337,12 @@ namespace dxvk { rsInfo.lineWidth = 1.0f; if (rasterizedStream > 0) - rsInfo.pNext = &xfbStreamInfo; + rsDepthClipInfo.pNext = &xfbStreamInfo; + + if (!m_pipeMgr->m_device->features().extDepthClipEnable.depthClipEnable) { + rsInfo.pNext = rsDepthClipInfo.pNext; + rsInfo.depthClampEnable = !state.rsDepthClipEnable; + } VkPipelineMultisampleStateCreateInfo msInfo; msInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;