zink: add a union to zink_gfx_pipeline_cache_entry for gpl
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 3 Apr 2023 19:58:40 +0000 (15:58 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 27 Apr 2023 01:33:17 +0000 (01:33 +0000)
just code motion for now

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

src/gallium/drivers/zink/zink_program.c
src/gallium/drivers/zink/zink_program_state.hpp
src/gallium/drivers/zink/zink_types.h

index ca7dad8..e515b54 100644 (file)
@@ -778,12 +778,12 @@ optimized_compile_job(void *data, void *gdata, int thread_index)
    struct zink_gfx_pipeline_cache_entry *pc_entry = data;
    struct zink_screen *screen = gdata;
    VkPipeline pipeline;
-   if (pc_entry->gkey)
-      pipeline = zink_create_gfx_pipeline_combined(screen, pc_entry->prog, pc_entry->ikey->pipeline, &pc_entry->gkey->pipeline, 1, pc_entry->okey->pipeline, true);
+   if (pc_entry->gpl.gkey)
+      pipeline = zink_create_gfx_pipeline_combined(screen, pc_entry->prog, pc_entry->gpl.ikey->pipeline, &pc_entry->gpl.gkey->pipeline, 1, pc_entry->gpl.okey->pipeline, true);
    else
       pipeline = zink_create_gfx_pipeline(screen, pc_entry->prog, pc_entry->prog->modules, &pc_entry->state, pc_entry->state.element_state->binding_map, zink_primitive_topology(pc_entry->state.gfx_prim_mode), true);
    if (pipeline) {
-      pc_entry->unoptimized_pipeline = pc_entry->pipeline;
+      pc_entry->gpl.unoptimized_pipeline = pc_entry->pipeline;
       pc_entry->pipeline = pipeline;
    }
 }
@@ -1488,7 +1488,7 @@ zink_destroy_gfx_program(struct zink_screen *screen,
 
             util_queue_fence_wait(&pc_entry->fence);
             VKSCR(DestroyPipeline)(screen->dev, pc_entry->pipeline, NULL);
-            VKSCR(DestroyPipeline)(screen->dev, pc_entry->unoptimized_pipeline, NULL);
+            VKSCR(DestroyPipeline)(screen->dev, pc_entry->gpl.unoptimized_pipeline, NULL);
             free(pc_entry);
          }
       }
index 8cbb7ca..6066eb2 100644 (file)
@@ -205,9 +205,9 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
                                              zink_find_or_create_output_ds3(ctx) :
                                              zink_find_or_create_output(ctx);
          /* partial pipelines are stored to the cache entry for async optimized pipeline compiles */
-         pc_entry->ikey = ikey;
-         pc_entry->gkey = gkey;
-         pc_entry->okey = okey;
+         pc_entry->gpl.ikey = ikey;
+         pc_entry->gpl.gkey = gkey;
+         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);
       } else {
index d8b5538..a829199 100644 (file)
@@ -1018,13 +1018,17 @@ struct zink_gfx_output_key {
 struct zink_gfx_pipeline_cache_entry {
    struct zink_gfx_pipeline_state state;
    VkPipeline pipeline;
+   struct zink_gfx_program *prog;
    /* GPL only */
    struct util_queue_fence fence;
-   struct zink_gfx_input_key *ikey;
-   struct zink_gfx_library_key *gkey;
-   struct zink_gfx_output_key *okey;
-   struct zink_gfx_program *prog;
-   VkPipeline unoptimized_pipeline;
+   union {
+      struct {
+         struct zink_gfx_input_key *ikey;
+         struct zink_gfx_library_key *gkey;
+         struct zink_gfx_output_key *okey;
+         VkPipeline unoptimized_pipeline;
+      } gpl;
+   };
 };
 
 struct zink_gfx_lib_cache {