zink: slightly refactor pipeline compile selection
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Wed, 6 Sep 2023 14:28:08 +0000 (10:28 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 13 Sep 2023 02:36:40 +0000 (02:36 +0000)
no functional changes

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25087>

src/gallium/drivers/zink/zink_program_state.hpp

index bdf3a87..f9111fa 100644 (file)
@@ -216,21 +216,25 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
          pc_entry->gpl.okey = okey;
          /* create the non-optimized pipeline first using fast-linking to avoid stuttering */
          pipeline = zink_create_gfx_pipeline_combined(screen, prog, ikey->pipeline, &gkey->pipeline, 1, okey->pipeline, false);
+         pc_entry->pipeline = pipeline;
+         if (!prog->is_separable)
+            /* trigger async optimized pipeline compile if this was the fast-linked unoptimized pipeline */
+            zink_gfx_program_compile_queue(ctx, pc_entry);
       } else {
          /* optimize by default only when expecting precompiles in order to reduce stuttering */
          if (DYNAMIC_STATE != ZINK_DYNAMIC_VERTEX_INPUT2 && DYNAMIC_STATE != ZINK_DYNAMIC_VERTEX_INPUT)
             pipeline = zink_create_gfx_pipeline(screen, prog, prog->objs, state, state->element_state->binding_map, vkmode, !HAVE_LIB, NULL);
          else
             pipeline = zink_create_gfx_pipeline(screen, prog, prog->objs, state, NULL, vkmode, !HAVE_LIB, NULL);
+         pc_entry->pipeline = pipeline;
+         if (HAVE_LIB && !prog->is_separable)
+            /* trigger async optimized pipeline compile if this was an unoptimized pipeline */
+            zink_gfx_program_compile_queue(ctx, pc_entry);
       }
       if (pipeline == VK_NULL_HANDLE)
          return VK_NULL_HANDLE;
 
       zink_screen_update_pipeline_cache(screen, &prog->base, false);
-      pc_entry->pipeline = pipeline;
-      if (HAVE_LIB && !prog->is_separable)
-         /* trigger async optimized pipeline compile if this was the fast-linked unoptimized pipeline */
-         zink_gfx_program_compile_queue(ctx, pc_entry);
    }
 
    struct zink_gfx_pipeline_cache_entry *cache_entry = (struct zink_gfx_pipeline_cache_entry *)entry->data;