tu: Enable VK_EXT_depth_clip_enable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6047>
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 7f0ac1f..5ba6b01 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -768,6 +768,12 @@
features->privateData = true;
break;
}
+ case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT: {
+ VkPhysicalDeviceDepthClipEnableFeaturesEXT *features =
+ (VkPhysicalDeviceDepthClipEnableFeaturesEXT *)ext;
+ features->depthClipEnable = true;
+ break;
+ }
default:
break;
}
diff --git a/src/freedreno/vulkan/tu_extensions.py b/src/freedreno/vulkan/tu_extensions.py
index 7a3fd7b..be078da 100644
--- a/src/freedreno/vulkan/tu_extensions.py
+++ b/src/freedreno/vulkan/tu_extensions.py
@@ -87,6 +87,7 @@
Extension('VK_KHR_variable_pointers', 1, True),
Extension('VK_EXT_private_data', 1, True),
Extension('VK_EXT_shader_stencil_export', 1, True),
+ Extension('VK_EXT_depth_clip_enable', 1, True),
]
MAX_API_VERSION = VkVersion(MAX_API_VERSION)
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c
index 062102c..541d834 100644
--- a/src/freedreno/vulkan/tu_pipeline.c
+++ b/src/freedreno/vulkan/tu_pipeline.c
@@ -2216,13 +2216,21 @@
enum a6xx_polygon_mode mode = tu6_polygon_mode(rast_info->polygonMode);
+ bool depth_clip_disable = rast_info->depthClampEnable;
+
+ const VkPipelineRasterizationDepthClipStateCreateInfoEXT *depth_clip_state =
+ vk_find_struct_const(rast_info, PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT);
+ if (depth_clip_state)
+ depth_clip_disable = !depth_clip_state->depthClipEnable;
+
struct tu_cs cs;
pipeline->rast_state = tu_cs_draw_state(&pipeline->cs, &cs, 9);
tu_cs_emit_regs(&cs,
A6XX_GRAS_CL_CNTL(
- .znear_clip_disable = rast_info->depthClampEnable,
- .zfar_clip_disable = rast_info->depthClampEnable,
+ .znear_clip_disable = depth_clip_disable,
+ .zfar_clip_disable = depth_clip_disable,
+ /* TODO should this be depth_clip_disable instead? */
.unk5 = rast_info->depthClampEnable,
.zero_gb_scale_z = 1,
.vp_clip_code_ignore = 1));