zink: don't try to replace separate shader prog in noopt mode
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 10 Aug 2023 09:51:41 +0000 (05:51 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 10 Aug 2023 12:32:58 +0000 (12:32 +0000)
this crashes

Fixes: ca2e2f4bd0c ("zink: apply ZINK_DEBUG=noopt to linked separate shaders")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24606>

src/gallium/drivers/zink/zink_program.c

index 47c71fd..58e9be2 100644 (file)
@@ -724,7 +724,7 @@ zink_gfx_program_update_optimal(struct zink_context *ctx)
          ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash;
       if (entry) {
          prog = (struct zink_gfx_program*)entry->data;
-         if (prog->is_separable) {
+         if (prog->is_separable && !(zink_debug & ZINK_DEBUG_NOOPT)) {
             /* shader variants can't be handled by separable programs: sync and compile */
             if (!ZINK_SHADER_KEY_OPTIMAL_IS_DEFAULT(ctx->gfx_pipeline_state.optimal_key))
                util_queue_fence_wait(&prog->base.cache_fence);
@@ -754,7 +754,7 @@ zink_gfx_program_update_optimal(struct zink_context *ctx)
       /* remove old hash */
       ctx->gfx_pipeline_state.optimal_key = ctx->gfx_pipeline_state.shader_keys_optimal.key.val;
       ctx->gfx_pipeline_state.final_hash ^= ctx->curr_program->last_variant_hash;
-      if (ctx->curr_program->is_separable) {
+      if (ctx->curr_program->is_separable && !(zink_debug & ZINK_DEBUG_NOOPT)) {
          struct zink_gfx_program *prog = ctx->curr_program;
          if (!ZINK_SHADER_KEY_OPTIMAL_IS_DEFAULT(ctx->gfx_pipeline_state.optimal_key)) {
             util_queue_fence_wait(&prog->base.cache_fence);