radv: set DB_SHADER_CONTROL.CONSERVATIVE_Z_EXPORT correctly
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 9 Jun 2020 15:59:00 +0000 (17:59 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 12 Jun 2020 08:22:47 +0000 (08:22 +0000)
Use the SPIR-V execution modes if set.

Cc: 20.1 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5404>

src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_shader.h
src/amd/vulkan/radv_shader_info.c

index 6d8e7f9555ff80fb92f8f05a6d57068a63a4260e..771442b4713a31ad398ee4d37ec56a3dc3f10281 100644 (file)
@@ -4492,12 +4492,18 @@ radv_compute_db_shader_control(const struct radv_device *device,
                               const struct radv_pipeline *pipeline,
                                const struct radv_shader_variant *ps)
 {
+       unsigned conservative_z_export = V_02880C_EXPORT_ANY_Z;
        unsigned z_order;
        if (ps->info.ps.early_fragment_test || !ps->info.ps.writes_memory)
                z_order = V_02880C_EARLY_Z_THEN_LATE_Z;
        else
                z_order = V_02880C_LATE_Z;
 
+       if (ps->info.ps.depth_layout == FRAG_DEPTH_LAYOUT_GREATER)
+               conservative_z_export = V_02880C_EXPORT_GREATER_THAN_Z;
+       else if (ps->info.ps.depth_layout == FRAG_DEPTH_LAYOUT_LESS)
+               conservative_z_export = V_02880C_EXPORT_LESS_THAN_Z;
+
        bool disable_rbplus = device->physical_device->rad_info.has_rbplus &&
                              !device->physical_device->rad_info.rbplus_allowed;
 
@@ -4511,6 +4517,7 @@ radv_compute_db_shader_control(const struct radv_device *device,
                S_02880C_STENCIL_TEST_VAL_EXPORT_ENABLE(ps->info.ps.writes_stencil) |
                S_02880C_KILL_ENABLE(!!ps->info.ps.can_discard) |
                S_02880C_MASK_EXPORT_ENABLE(mask_export_enable) |
+               S_02880C_CONSERVATIVE_Z_EXPORT(conservative_z_export) |
                S_02880C_Z_ORDER(z_order) |
                S_02880C_DEPTH_BEFORE_SHADER(ps->info.ps.early_fragment_test) |
                S_02880C_PRE_SHADER_DEPTH_COVERAGE_ENABLE(ps->info.ps.post_depth_coverage) |
index 9e0a67b1378c112dcb84c506bc6c6bb9a7b9cd75..18d7b0cf9bdfee3106e8cf733a86d0b9da15e3f5 100644 (file)
@@ -312,6 +312,7 @@ struct radv_shader_info {
                bool can_discard;
                bool early_fragment_test;
                bool post_depth_coverage;
+               uint8_t depth_layout;
        } ps;
        struct {
                bool uses_grid_size;
index c651f2162807a58762d4d0a0e0ba0d1aefd8a86c..c7e26ba176f49325ae46eb383c2ed077521b1ec3 100644 (file)
@@ -763,6 +763,7 @@ radv_nir_shader_info_pass(const struct nir_shader *nir,
                info->ps.can_discard = nir->info.fs.uses_discard;
                 info->ps.early_fragment_test = nir->info.fs.early_fragment_tests;
                 info->ps.post_depth_coverage = nir->info.fs.post_depth_coverage;
+                info->ps.depth_layout = nir->info.fs.depth_layout;
                 break;
         case MESA_SHADER_GEOMETRY:
                 info->gs.vertices_in = nir->info.gs.vertices_in;