radv: move forcing discard to demote to the graphics pipeline key
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 29 Sep 2021 09:01:31 +0000 (11:01 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 4 Oct 2021 10:05:18 +0000 (10:05 +0000)
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/13099>

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

index 89337d5..4330ea0 100644 (file)
@@ -229,8 +229,6 @@ radv_get_hash_flags(const struct radv_device *device, bool stats)
       hash_flags |= RADV_HASH_SHADER_GE_WAVE32;
    if (device->physical_device->use_llvm)
       hash_flags |= RADV_HASH_SHADER_LLVM;
-   if (device->instance->debug_flags & RADV_DEBUG_DISCARD_TO_DEMOTE)
-      hash_flags |= RADV_HASH_SHADER_DISCARD_TO_DEMOTE;
    if (device->instance->enable_mrt_output_nan_fixup)
       hash_flags |= RADV_HASH_SHADER_MRT_NAN_FIXUP;
    if (device->instance->debug_flags & RADV_DEBUG_INVARIANT_GEOM)
@@ -2727,6 +2725,10 @@ radv_generate_graphics_pipeline_key(const struct radv_pipeline *pipeline,
          key.vs.provoking_vtx_last = true;
       }
    }
+
+   if (pipeline->device->instance->debug_flags & RADV_DEBUG_DISCARD_TO_DEMOTE)
+      key.ps.lower_discard_to_demote = true;
+
    return key;
 }
 
index 7a86857..4d13567 100644 (file)
@@ -1659,7 +1659,6 @@ struct radv_event {
 #define RADV_HASH_SHADER_PS_WAVE32         (1 << 2)
 #define RADV_HASH_SHADER_GE_WAVE32         (1 << 3)
 #define RADV_HASH_SHADER_LLVM              (1 << 4)
-#define RADV_HASH_SHADER_DISCARD_TO_DEMOTE (1 << 5)
 #define RADV_HASH_SHADER_MRT_NAN_FIXUP     (1 << 6)
 #define RADV_HASH_SHADER_INVARIANT_GEOM    (1 << 7)
 #define RADV_HASH_SHADER_KEEP_STATISTICS   (1 << 8)
index fc1953e..52fc044 100644 (file)
@@ -596,8 +596,7 @@ radv_shader_compile_to_nir(struct radv_device *device, struct vk_shader_module *
 
       NIR_PASS_V(nir, nir_lower_clip_cull_distance_arrays);
 
-      NIR_PASS_V(nir, nir_lower_discard_or_demote,
-                 device->instance->debug_flags & RADV_DEBUG_DISCARD_TO_DEMOTE);
+      NIR_PASS_V(nir, nir_lower_discard_or_demote, key->ps.lower_discard_to_demote);
 
       nir_lower_doubles_options lower_doubles = nir->options->lower_doubles_options;
 
index ae810e6..9b063d3 100644 (file)
@@ -75,6 +75,8 @@ struct radv_pipeline_key {
       uint32_t is_int10;
       uint8_t log2_ps_iter_samples;
       uint8_t num_samples;
+
+      bool lower_discard_to_demote;
    } ps;
 
    struct {