summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-11-13 19:21:46 +0100
committerMarek Olšák <[email protected]>2016-11-21 21:44:35 +0100
commitfee71fec25efb9771a7c3fa15b120d4c816b59b5 (patch)
tree7a67b2407ae883a026701f30abb3b4e8dce607b5
parente6aee45db410eb1dbbaf6590ef5fbb53a54a7d46 (diff)
radeonsi: simplify checking for monolithic compilation
Tested-by: Edmondo Tommasina <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/si_compute.c1
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c9
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c6
4 files changed, 9 insertions, 8 deletions
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)) {