zink: avoid accessing zink_gfx_program::modules during pipeline compile
this allows a different array of modules to be passed in Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22725>
This commit is contained in:
committed by
Marge Bot
parent
76fbc85220
commit
a0df43f3ee
@@ -38,6 +38,7 @@
|
||||
VkPipeline
|
||||
zink_create_gfx_pipeline(struct zink_screen *screen,
|
||||
struct zink_gfx_program *prog,
|
||||
VkShaderModule *modules,
|
||||
struct zink_gfx_pipeline_state *state,
|
||||
const uint8_t *binding_map,
|
||||
VkPrimitiveTopology primitive_topology,
|
||||
@@ -364,7 +365,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
|
||||
|
||||
VkPipelineTessellationStateCreateInfo tci = {0};
|
||||
VkPipelineTessellationDomainOriginStateCreateInfo tdci = {0};
|
||||
if (prog->modules[MESA_SHADER_TESS_CTRL] && prog->modules[MESA_SHADER_TESS_EVAL]) {
|
||||
if (prog->shaders[MESA_SHADER_TESS_CTRL] && prog->shaders[MESA_SHADER_TESS_EVAL]) {
|
||||
tci.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
||||
tci.patchControlPoints = state->dyn_state2.vertices_per_patch;
|
||||
pci.pTessellationState = &tci;
|
||||
@@ -376,13 +377,13 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
|
||||
VkPipelineShaderStageCreateInfo shader_stages[ZINK_GFX_SHADER_COUNT];
|
||||
uint32_t num_stages = 0;
|
||||
for (int i = 0; i < ZINK_GFX_SHADER_COUNT; ++i) {
|
||||
if (!prog->modules[i])
|
||||
if (!prog->shaders[i])
|
||||
continue;
|
||||
|
||||
VkPipelineShaderStageCreateInfo stage = {0};
|
||||
stage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
stage.stage = mesa_to_vk_shader_stage(i);
|
||||
stage.module = prog->modules[i];
|
||||
stage.module = modules[i];
|
||||
stage.pName = "main";
|
||||
shader_stages[num_stages++] = stage;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ zink_find_or_create_input_dynamic(struct zink_context *ctx, VkPrimitiveTopology
|
||||
VkPipeline
|
||||
zink_create_gfx_pipeline(struct zink_screen *screen,
|
||||
struct zink_gfx_program *prog,
|
||||
VkShaderModule *modules,
|
||||
struct zink_gfx_pipeline_state *state,
|
||||
const uint8_t *binding_map,
|
||||
VkPrimitiveTopology primitive_topology,
|
||||
|
||||
@@ -781,7 +781,7 @@ optimized_compile_job(void *data, void *gdata, int thread_index)
|
||||
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);
|
||||
else
|
||||
pipeline = zink_create_gfx_pipeline(screen, pc_entry->prog, &pc_entry->state, pc_entry->state.element_state->binding_map, zink_primitive_topology(pc_entry->state.gfx_prim_mode), true);
|
||||
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->pipeline = pipeline;
|
||||
@@ -2099,7 +2099,9 @@ zink_link_gfx_shader(struct pipe_context *pctx, void **shaders)
|
||||
generate_gfx_program_modules_optimal(ctx, screen, prog, &ctx->gfx_pipeline_state);
|
||||
else
|
||||
generate_gfx_program_modules(ctx, screen, prog, &ctx->gfx_pipeline_state);
|
||||
VkPipeline pipeline = zink_create_gfx_pipeline(screen, prog, &ctx->gfx_pipeline_state, ctx->gfx_pipeline_state.element_state->binding_map, shaders[MESA_SHADER_TESS_EVAL] ? VK_PRIMITIVE_TOPOLOGY_PATCH_LIST : VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, true);
|
||||
VkPipeline pipeline = zink_create_gfx_pipeline(screen, prog, prog->modules, &ctx->gfx_pipeline_state,
|
||||
ctx->gfx_pipeline_state.element_state->binding_map,
|
||||
shaders[MESA_SHADER_TESS_EVAL] ? VK_PRIMITIVE_TOPOLOGY_PATCH_LIST : VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, true);
|
||||
print_pipeline_stats(screen, pipeline);
|
||||
} else {
|
||||
util_queue_add_job(&zink_screen(pctx->screen)->cache_get_thread, prog, &prog->base.cache_fence, precompile_job, NULL, 0);
|
||||
|
||||
@@ -213,9 +213,9 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
|
||||
} 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, state, state->element_state->binding_map, vkmode, !HAVE_LIB);
|
||||
pipeline = zink_create_gfx_pipeline(screen, prog, prog->modules, state, state->element_state->binding_map, vkmode, !HAVE_LIB);
|
||||
else
|
||||
pipeline = zink_create_gfx_pipeline(screen, prog, state, NULL, vkmode, !HAVE_LIB);
|
||||
pipeline = zink_create_gfx_pipeline(screen, prog, prog->modules, state, NULL, vkmode, !HAVE_LIB);
|
||||
}
|
||||
if (pipeline == VK_NULL_HANDLE)
|
||||
return VK_NULL_HANDLE;
|
||||
|
||||
Reference in New Issue
Block a user