zink: various cleanups for mesh+multiview

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37470>
This commit is contained in:
Mike Blumenkrantz
2025-09-18 07:22:25 -04:00
parent 52c902d8cc
commit ad3a445f96
3 changed files with 12 additions and 4 deletions
+2 -1
View File
@@ -221,7 +221,8 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_STENCIL_OP;
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE;
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_FRONT_FACE;
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY;
if (!is_mesh)
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY;
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_CULL_MODE;
if (state->sample_locations_enabled)
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT;
+6 -2
View File
@@ -933,10 +933,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;
bool is_mesh = !!pc_entry->prog->shaders[MESA_SHADER_MESH];
VkPrimitiveTopology vkmode = is_mesh ? VK_PRIMITIVE_TOPOLOGY_MAX_ENUM : zink_primitive_topology(pc_entry->state.gfx_prim_mode);
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, false);
else
pipeline = zink_create_gfx_pipeline(screen, pc_entry->prog, pc_entry->prog->objs, &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->objs, &pc_entry->state, pc_entry->state.element_state->binding_map, vkmode, true);
if (pipeline) {
pc_entry->gpl.unoptimized_pipeline = pc_entry->pipeline;
pc_entry->pipeline = pipeline;
@@ -948,13 +950,15 @@ optimized_shobj_compile_job(void *data, void *gdata, int thread_index)
{
struct zink_gfx_pipeline_cache_entry *pc_entry = data;
struct zink_screen *screen = gdata;
bool is_mesh = !!pc_entry->prog->shaders[MESA_SHADER_MESH];
VkPrimitiveTopology vkmode = is_mesh ? VK_PRIMITIVE_TOPOLOGY_MAX_ENUM : zink_primitive_topology(pc_entry->state.gfx_prim_mode);
struct zink_shader_object objs[MESA_SHADER_MESH_STAGES];
for (unsigned i = 0; i < MESA_SHADER_MESH_STAGES; i++) {
objs[i].mod = VK_NULL_HANDLE;
objs[i].spirv = pc_entry->shobjs[i].spirv;
}
pc_entry->pipeline = zink_create_gfx_pipeline(screen, pc_entry->prog, objs, &pc_entry->state, NULL, zink_primitive_topology(pc_entry->state.gfx_prim_mode), true);
pc_entry->pipeline = zink_create_gfx_pipeline(screen, pc_entry->prog, objs, &pc_entry->state, NULL, vkmode, true);
/* no unoptimized_pipeline dance */
}
+4 -1
View File
@@ -445,7 +445,8 @@ zink_can_use_pipeline_libs_mesh(const struct zink_context *ctx)
!ctx->gfx_stages[MESA_SHADER_FRAGMENT]->info.fs.uses_sample_shading &&
!zink_get_fs_base_key(ctx)->fbfetch_ms &&
!ctx->gfx_pipeline_state.force_persample_interp &&
!ctx->gfx_pipeline_state.min_samples;
!ctx->gfx_pipeline_state.min_samples &&
!ctx->fb_state.viewmask;
}
/* stricter requirements */
@@ -456,6 +457,8 @@ zink_can_use_shader_objects_mesh(const struct zink_context *ctx)
ZINK_SHADER_KEY_OPTIMAL_IS_DEFAULT_MESH(ctx->gfx_pipeline_state.optimal_key) &&
/* TODO: is sample shading even possible to handle with GPL? */
!ctx->gfx_stages[MESA_SHADER_FRAGMENT]->info.fs.uses_sample_shading &&
/* TODO: maybe someday shader objects + viewmask */
!ctx->gfx_stages[MESA_SHADER_MESH]->info.view_mask &&
!ctx->gfx_pipeline_state.force_persample_interp &&
!ctx->gfx_pipeline_state.min_samples;
}