radv: Implement VK_EXT_depth_clip_enable.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 26 Jan 2019 01:28:08 +0000 (02:28 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 20 Feb 2019 23:24:31 +0000 (23:24 +0000)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_extensions.py
src/amd/vulkan/radv_pipeline.c

index 53f2c05fc42afe1770a8b4f9926c570f5c36a9c3..2aa8b3611e36bf94deab7e10cb18b6bb0a400c9c 100644 (file)
@@ -881,6 +881,12 @@ void radv_GetPhysicalDeviceFeatures2(
                        features->bufferDeviceAddressMultiDevice = false;
                        break;
                }
+               case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT: {
+                       VkPhysicalDeviceDepthClipEnableFeaturesEXT *features =
+                               (VkPhysicalDeviceDepthClipEnableFeaturesEXT *)ext;
+                       features->depthClipEnable = true;
+                       break;
+               }
                default:
                        break;
                }
index f218598f1237be405860f8ad4602262bf290384f..0440a2ec9d95638f8c6c356dd05a2730416d7158 100644 (file)
@@ -100,6 +100,7 @@ EXTENSIONS = [
     Extension('VK_EXT_display_surface_counter',           1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_EXT_display_control',                   1, 'VK_USE_PLATFORM_DISPLAY_KHR'),
     Extension('VK_EXT_debug_report',                      9, True),
+    Extension('VK_EXT_depth_clip_enable',                 1, True),
     Extension('VK_EXT_depth_range_unrestricted',          1, True),
     Extension('VK_EXT_descriptor_indexing',               2, True),
     Extension('VK_EXT_discard_rectangles',                1, True),
index 2d9c362404522752817f376fc0ac8d2de3454e64..810bbd98752615bc86fd8547bf5249157f0ba2ab 100644 (file)
@@ -2727,11 +2727,18 @@ radv_pipeline_generate_raster_state(struct radeon_cmdbuf *ctx_cs,
        const VkConservativeRasterizationModeEXT mode =
                radv_get_conservative_raster_mode(vkraster);
        uint32_t pa_sc_conservative_rast = S_028C4C_NULL_SQUAD_AA_MASK_ENABLE(1);
+       bool depth_clip_disable = vkraster->depthClampEnable;
+
+       const VkPipelineRasterizationDepthClipStateCreateInfoEXT *depth_clip_state =
+               vk_find_struct_const(vkraster->pNext, PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT);
+       if (depth_clip_state) {
+               depth_clip_disable = !depth_clip_state->depthClipEnable;
+       }
 
        radeon_set_context_reg(ctx_cs, R_028810_PA_CL_CLIP_CNTL,
                               S_028810_DX_CLIP_SPACE_DEF(1) | // vulkan uses DX conventions.
-                              S_028810_ZCLIP_NEAR_DISABLE(vkraster->depthClampEnable ? 1 : 0) |
-                              S_028810_ZCLIP_FAR_DISABLE(vkraster->depthClampEnable ? 1 : 0) |
+                              S_028810_ZCLIP_NEAR_DISABLE(depth_clip_disable ? 1 : 0) |
+                              S_028810_ZCLIP_FAR_DISABLE(depth_clip_disable ? 1 : 0) |
                               S_028810_DX_RASTERIZATION_KILL(vkraster->rasterizerDiscardEnable ? 1 : 0) |
                               S_028810_DX_LINEAR_ATTR_CLIP_ENA(1));