diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h index 1c59431d57f..a154b9e08b4 100644 --- a/src/gallium/drivers/zink/zink_program.h +++ b/src/gallium/drivers/zink/zink_program.h @@ -382,6 +382,21 @@ zink_set_shader_key_base(struct zink_context *ctx, gl_shader_stage pstage) return &ctx->gfx_pipeline_state.shader_keys.key[pstage].base; } +ALWAYS_INLINE static bool +zink_can_use_pipeline_libs(const struct zink_context *ctx) +{ + return + /* TODO: if there's ever a dynamic render extension with input attachments */ + !ctx->gfx_pipeline_state.render_pass && + /* this is just terrible */ + !zink_get_fs_base_key(ctx)->shadow_needs_shader_swizzle && + /* TODO: is sample shading even possible to handle with GPL? */ + !ctx->gfx_stages[MESA_SHADER_FRAGMENT]->nir->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; +} + bool zink_set_rasterizer_discard(struct zink_context *ctx, bool disable); void diff --git a/src/gallium/drivers/zink/zink_program_state.hpp b/src/gallium/drivers/zink/zink_program_state.hpp index 0e78e9ea9c1..70514ae93bf 100644 --- a/src/gallium/drivers/zink/zink_program_state.hpp +++ b/src/gallium/drivers/zink/zink_program_state.hpp @@ -251,16 +251,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx, /* init the optimized background compile fence */ util_queue_fence_init(&pc_entry->fence); entry = _mesa_hash_table_insert_pre_hashed(&prog->pipelines[rp_idx][idx], state->final_hash, pc_entry, pc_entry); - if (HAVE_LIB && - /* TODO: if there's ever a dynamic render extension with input attachments */ - !ctx->gfx_pipeline_state.render_pass && - /* this is just terrible */ - !zink_get_fs_base_key(ctx)->shadow_needs_shader_swizzle && - /* TODO: is sample shading even possible to handle with GPL? */ - !ctx->gfx_stages[MESA_SHADER_FRAGMENT]->nir->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) { + if (HAVE_LIB && zink_can_use_pipeline_libs(ctx)) { /* this is the graphics pipeline library path: find/construct all partial pipelines */ struct set_entry *he = _mesa_set_search(&prog->libs, &ctx->gfx_pipeline_state.optimal_key); struct zink_gfx_library_key *gkey;