radeonsi: handle NO_OPT_VARIANT in si_shader_select_with_key
authorMarek Olšák <marek.olsak@amd.com>
Tue, 10 Aug 2021 06:18:15 +0000 (02:18 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 14 Sep 2021 15:24:11 +0000 (15:24 +0000)
so as not to change the keys in si_context

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12343>

src/gallium/drivers/radeonsi/si_state_shaders.c

index 87300f8..efb689e 100644 (file)
@@ -2086,9 +2086,6 @@ static inline void si_shader_selector_key(struct pipe_context *ctx, struct si_sh
    default:
       assert(0);
    }
-
-   if (unlikely(sctx->screen->debug_flags & DBG(NO_OPT_VARIANT)))
-      memset(&key->opt, 0, sizeof(key->opt));
 }
 
 static void si_build_shader_variant(struct si_shader *shader, int thread_index, bool low_priority)
@@ -2209,6 +2206,12 @@ int si_shader_select_with_key(struct si_screen *sscreen, struct si_shader_ctx_st
     */
    struct si_shader_key local_key;
 
+   if (unlikely(sscreen->debug_flags & DBG(NO_OPT_VARIANT))) {
+      /* Disable shader variant optimizations. */
+      key = use_local_key_copy(key, &local_key);
+      memset(&local_key.opt, 0, sizeof(key->opt));
+   }
+
 again:
    /* Check if we don't need to change anything.
     * This path is also used for most shaders that don't need multiple