radeonsi: deduplicate si_compiler_ctx_state initialization
to remove it from si_update_shaders Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12343>
This commit is contained in:
parent
7a20110ad3
commit
a65f99b2d1
|
@ -574,12 +574,10 @@ void si_schedule_initial_compile(struct si_context *sctx, gl_shader_stage stage,
|
|||
util_queue_execute_func execute);
|
||||
void si_get_active_slot_masks(const struct si_shader_info *info, uint64_t *const_and_shader_buffers,
|
||||
uint64_t *samplers_and_images);
|
||||
int si_shader_select_with_key(struct si_screen *sscreen, struct si_shader_ctx_state *state,
|
||||
struct si_compiler_ctx_state *compiler_state,
|
||||
int si_shader_select_with_key(struct si_context *sctx, struct si_shader_ctx_state *state,
|
||||
const struct si_shader_key *key, int thread_index,
|
||||
bool optimized_or_none);
|
||||
int si_shader_select(struct pipe_context *ctx, struct si_shader_ctx_state *state,
|
||||
struct si_compiler_ctx_state *compiler_state);
|
||||
int si_shader_select(struct pipe_context *ctx, struct si_shader_ctx_state *state);
|
||||
void si_vs_key_update_inputs(struct si_context *sctx);
|
||||
void si_get_vs_key_inputs(struct si_context *sctx, struct si_shader_key *key,
|
||||
struct si_vs_prolog_bits *prolog_key);
|
||||
|
|
|
@ -51,7 +51,6 @@ template <chip_class GFX_VERSION, si_has_tess HAS_TESS, si_has_gs HAS_GS, si_has
|
|||
static bool si_update_shaders(struct si_context *sctx)
|
||||
{
|
||||
struct pipe_context *ctx = (struct pipe_context *)sctx;
|
||||
struct si_compiler_ctx_state compiler_state;
|
||||
struct si_shader *old_vs = si_get_vs_inline(sctx, HAS_TESS, HAS_GS)->current;
|
||||
unsigned old_kill_clip_distances = old_vs ? old_vs->key.opt.kill_clip_distances : 0;
|
||||
struct si_shader *old_ps = sctx->shader.ps.current;
|
||||
|
@ -59,13 +58,6 @@ static bool si_update_shaders(struct si_context *sctx)
|
|||
old_ps ? old_ps->key.part.ps.epilog.spi_shader_col_format : 0;
|
||||
int r;
|
||||
|
||||
if (!sctx->compiler.passes)
|
||||
si_init_compiler(sctx->screen, &sctx->compiler);
|
||||
|
||||
compiler_state.compiler = &sctx->compiler;
|
||||
compiler_state.debug = sctx->debug;
|
||||
compiler_state.is_debug_context = sctx->is_debug;
|
||||
|
||||
/* Update TCS and TES. */
|
||||
if (HAS_TESS) {
|
||||
if (!sctx->tess_rings) {
|
||||
|
@ -75,7 +67,7 @@ static bool si_update_shaders(struct si_context *sctx)
|
|||
}
|
||||
|
||||
if (sctx->shader.tcs.cso) {
|
||||
r = si_shader_select(ctx, &sctx->shader.tcs, &compiler_state);
|
||||
r = si_shader_select(ctx, &sctx->shader.tcs);
|
||||
if (r)
|
||||
return false;
|
||||
si_pm4_bind_state(sctx, hs, sctx->shader.tcs.current->pm4);
|
||||
|
@ -87,14 +79,14 @@ static bool si_update_shaders(struct si_context *sctx)
|
|||
return false;
|
||||
}
|
||||
|
||||
r = si_shader_select(ctx, &sctx->fixed_func_tcs_shader, &compiler_state);
|
||||
r = si_shader_select(ctx, &sctx->fixed_func_tcs_shader);
|
||||
if (r)
|
||||
return false;
|
||||
si_pm4_bind_state(sctx, hs, sctx->fixed_func_tcs_shader.current->pm4);
|
||||
}
|
||||
|
||||
if (!HAS_GS || GFX_VERSION <= GFX8) {
|
||||
r = si_shader_select(ctx, &sctx->shader.tes, &compiler_state);
|
||||
r = si_shader_select(ctx, &sctx->shader.tes);
|
||||
if (r)
|
||||
return false;
|
||||
|
||||
|
@ -119,7 +111,7 @@ static bool si_update_shaders(struct si_context *sctx)
|
|||
|
||||
/* Update GS. */
|
||||
if (HAS_GS) {
|
||||
r = si_shader_select(ctx, &sctx->shader.gs, &compiler_state);
|
||||
r = si_shader_select(ctx, &sctx->shader.gs);
|
||||
if (r)
|
||||
return false;
|
||||
si_pm4_bind_state(sctx, gs, sctx->shader.gs.current->pm4);
|
||||
|
@ -145,7 +137,7 @@ static bool si_update_shaders(struct si_context *sctx)
|
|||
|
||||
/* Update VS. */
|
||||
if ((!HAS_TESS && !HAS_GS) || GFX_VERSION <= GFX8) {
|
||||
r = si_shader_select(ctx, &sctx->shader.vs, &compiler_state);
|
||||
r = si_shader_select(ctx, &sctx->shader.vs);
|
||||
if (r)
|
||||
return false;
|
||||
|
||||
|
@ -189,7 +181,7 @@ static bool si_update_shaders(struct si_context *sctx)
|
|||
if (old_kill_clip_distances != si_get_vs_inline(sctx, HAS_TESS, HAS_GS)->current->key.opt.kill_clip_distances)
|
||||
si_mark_atom_dirty(sctx, &sctx->atoms.s.clip_regs);
|
||||
|
||||
r = si_shader_select(ctx, &sctx->shader.ps, &compiler_state);
|
||||
r = si_shader_select(ctx, &sctx->shader.ps);
|
||||
if (r)
|
||||
return false;
|
||||
si_pm4_bind_state(sctx, ps, sctx->shader.ps.current->pm4);
|
||||
|
|
|
@ -2309,11 +2309,11 @@ use_local_key_copy(const struct si_shader_key *key, struct si_shader_key *local_
|
|||
* the compilation isn't finished, don't select any
|
||||
* shader and return an error.
|
||||
*/
|
||||
int si_shader_select_with_key(struct si_screen *sscreen, struct si_shader_ctx_state *state,
|
||||
struct si_compiler_ctx_state *compiler_state,
|
||||
int si_shader_select_with_key(struct si_context *sctx, struct si_shader_ctx_state *state,
|
||||
const struct si_shader_key *key, int thread_index,
|
||||
bool optimized_or_none)
|
||||
{
|
||||
struct si_screen *sscreen = sctx->screen;
|
||||
struct si_shader_selector *sel = state->cso;
|
||||
struct si_shader_selector *previous_stage_sel = NULL;
|
||||
struct si_shader *current = state->current;
|
||||
|
@ -2428,9 +2428,14 @@ current_not_ready:
|
|||
|
||||
util_queue_fence_init(&shader->ready);
|
||||
|
||||
if (!sctx->compiler.passes)
|
||||
si_init_compiler(sctx->screen, &sctx->compiler);
|
||||
|
||||
shader->selector = sel;
|
||||
shader->key = *key;
|
||||
shader->compiler_ctx_state = *compiler_state;
|
||||
shader->compiler_ctx_state.compiler = &sctx->compiler;
|
||||
shader->compiler_ctx_state.debug = sctx->debug;
|
||||
shader->compiler_ctx_state.is_debug_context = sctx->is_debug;
|
||||
|
||||
/* If this is a merged shader, get the first shader's selector. */
|
||||
if (sscreen->info.chip_class >= GFX9) {
|
||||
|
@ -2476,12 +2481,13 @@ current_not_ready:
|
|||
}
|
||||
|
||||
simple_mtx_lock(&previous_stage_sel->mutex);
|
||||
ok = si_check_missing_main_part(sscreen, previous_stage_sel, compiler_state, &shader1_key);
|
||||
ok = si_check_missing_main_part(sscreen, previous_stage_sel, &shader->compiler_ctx_state,
|
||||
&shader1_key);
|
||||
simple_mtx_unlock(&previous_stage_sel->mutex);
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
ok = si_check_missing_main_part(sscreen, sel, compiler_state, key);
|
||||
ok = si_check_missing_main_part(sscreen, sel, &shader->compiler_ctx_state, key);
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
|
@ -2560,13 +2566,12 @@ current_not_ready:
|
|||
return shader->compilation_failed ? -1 : 0;
|
||||
}
|
||||
|
||||
int si_shader_select(struct pipe_context *ctx, struct si_shader_ctx_state *state,
|
||||
struct si_compiler_ctx_state *compiler_state)
|
||||
int si_shader_select(struct pipe_context *ctx, struct si_shader_ctx_state *state)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
|
||||
si_shader_selector_key(ctx, state->cso, &state->key);
|
||||
return si_shader_select_with_key(sctx->screen, state, compiler_state, &state->key, -1, false);
|
||||
return si_shader_select_with_key(sctx, state, &state->key, -1, false);
|
||||
}
|
||||
|
||||
static void si_parse_next_shader_property(const struct si_shader_info *info, bool streamout,
|
||||
|
|
Loading…
Reference in New Issue