Module: Mesa Branch: main Commit: 8a397b764971927f655bd8e2971c0e320cf868a3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8a397b764971927f655bd8e2971c0e320cf868a3
Author: Mike Blumenkrantz <[email protected]> Date: Mon Apr 3 15:58:40 2023 -0400 zink: add a union to zink_gfx_pipeline_cache_entry for gpl just code motion for now Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22725> --- src/gallium/drivers/zink/zink_program.c | 8 ++++---- src/gallium/drivers/zink/zink_program_state.hpp | 6 +++--- src/gallium/drivers/zink/zink_types.h | 14 +++++++++----- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index ca7dad896e3..e515b54f04e 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -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); } } diff --git a/src/gallium/drivers/zink/zink_program_state.hpp b/src/gallium/drivers/zink/zink_program_state.hpp index 8cbb7ca449f..6066eb22d0b 100644 --- a/src/gallium/drivers/zink/zink_program_state.hpp +++ b/src/gallium/drivers/zink/zink_program_state.hpp @@ -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 { diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index d8b55383f04..a829199ba03 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -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 {
