From: Marek Olšák Date: Sun, 13 Nov 2016 18:21:46 +0000 (+0100) Subject: radeonsi: simplify checking for monolithic compilation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fee71fec25efb9771a7c3fa15b120d4c816b59b5;p=mesa.git radeonsi: simplify checking for monolithic compilation Tested-by: Edmondo Tommasina Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index e53ffa4cc72..91f1b0a7420 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -126,6 +126,7 @@ static void *si_create_compute_state( p_atomic_inc(&sscreen->b.num_shaders_created); program->shader.selector = &sel; + program->shader.is_monolithic = true; if (si_shader_create(sscreen, sctx->tm, &program->shader, &sctx->b.debug)) { diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 6d3365ce252..5e57bb3b664 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -8139,14 +8139,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm, * Vertex shaders are compiled on demand when a vertex fetch * workaround must be applied. */ - if (!mainp || - shader->key.as_es != mainp->key.as_es || - shader->key.as_ls != mainp->key.as_ls || - (sel->type == PIPE_SHADER_VERTEX && - shader->key.mono.vs.fix_fetch) || - (sel->type == PIPE_SHADER_TESS_CTRL && - shader->key.mono.tcs.inputs_to_copy) || - sel->type == PIPE_SHADER_COMPUTE) { + if (shader->is_monolithic) { /* Monolithic shader (compiled as a whole, has many variants, * may take a long time to compile). */ diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index bed22c1cf00..2ed0cb783ff 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -484,6 +484,7 @@ struct si_shader { struct r600_resource *bo; struct r600_resource *scratch_bo; struct si_shader_key key; + bool is_monolithic; bool is_binary_shared; bool is_gs_copy_shader; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 3323d3c3a33..9df8f47e624 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1024,6 +1024,7 @@ static int si_shader_select_with_key(struct si_screen *sscreen, bool wait, bool is_debug_context) { + static const struct si_shader_key zeroed; struct si_shader_selector *sel = state->cso; struct si_shader *current = state->current; struct si_shader *iter, *shader = NULL; @@ -1064,6 +1065,11 @@ static int si_shader_select_with_key(struct si_screen *sscreen, } shader->selector = sel; shader->key = *key; + shader->is_monolithic = + !sel->main_shader_part || + sel->main_shader_part->key.as_ls != key->as_ls || + sel->main_shader_part->key.as_es != key->as_es || + memcmp(&key->mono, &zeroed.mono, sizeof(key->mono)) != 0; r = si_shader_create(sscreen, tm, shader, debug); if (unlikely(r)) {