v3dv: expose depthClamp in V3D 7.x
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 31 May 2023 08:38:59 +0000 (10:38 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 13 Oct 2023 22:37:44 +0000 (22:37 +0000)
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>

src/broadcom/vulkan/v3dv_device.c
src/broadcom/vulkan/v3dvx_pipeline.c

index 39fd769..c4307f8 100644 (file)
@@ -232,7 +232,7 @@ get_features(const struct v3dv_physical_device *physical_device,
       .logicOp = true,
       .multiDrawIndirect = false,
       .drawIndirectFirstInstance = true,
-      .depthClamp = false, /* Only available since V3D 4.5.1.1 */
+      .depthClamp = physical_device->devinfo.ver >= 71,
       .depthBiasClamp = true,
       .fillModeNonSolid = true,
       .depthBounds = physical_device->devinfo.ver >= 71,
index c9b537f..ad22add 100644 (file)
@@ -243,6 +243,7 @@ pack_cfg_bits(struct v3dv_pipeline *pipeline,
        * supported in the driver yet, so in practice we are always enabling Z
        * clipping for now.
        */
+      bool z_clamp_enable = rs_info && rs_info->depthClampEnable;
       bool z_clip_enable = false;
       const VkPipelineRasterizationDepthClipStateCreateInfoEXT *clip_info =
          ds_info ? vk_find_struct_const(ds_info->pNext,
@@ -250,7 +251,7 @@ pack_cfg_bits(struct v3dv_pipeline *pipeline,
                    NULL;
       if (clip_info)
          z_clip_enable = clip_info->depthClipEnable;
-      else if (!(rs_info && rs_info->depthClampEnable))
+      else if (!z_clamp_enable)
          z_clip_enable = true;
 
       if (z_clip_enable) {
@@ -260,6 +261,8 @@ pack_cfg_bits(struct v3dv_pipeline *pipeline,
          config.z_clipping_mode = V3D_Z_CLIP_MODE_NONE;
       }
 
+      config.z_clamp_mode = z_clamp_enable;
+
       config.depth_bounds_test_enable =
               ds_info && ds_info->depthBoundsTestEnable && has_ds_attachment;
 #endif