tu: Enable VK_EXT_depth_clip_enable
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 23 Jul 2020 09:44:40 +0000 (11:44 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Jul 2020 18:55:56 +0000 (18:55 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6047>

src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_extensions.py
src/freedreno/vulkan/tu_pipeline.c

index 7f0ac1fe499e6fe5e76059f617fc58fca37c541e..5ba6b01be9e9d60251d6b69cd8d07635f55ec3cd 100644 (file)
@@ -768,6 +768,12 @@ tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
          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;
       }
index 7a3fd7b637db567b487d0842d71d96c278877e35..be078daf7ce82999f64221daebda0f636fd1e5db 100644 (file)
@@ -87,6 +87,7 @@ EXTENSIONS = [
     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)
index 062102c02fb267f7c8f8b7ff831484933bf641f0..541d834bb9c514fbd28b3060ae2ea9e8dac0fbb5 100644 (file)
@@ -2216,13 +2216,21 @@ tu_pipeline_builder_parse_rasterization(struct tu_pipeline_builder *builder,
 
    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));