diff options
author | Marek Olšák <[email protected]> | 2019-08-20 13:36:45 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-08-27 16:16:08 -0400 |
commit | a9bb56695588dfb69a31a282cde26edfcfa0fec1 (patch) | |
tree | 6a3a064d9c069879fa2341ae7ca9a7cbc79de094 /src/gallium/drivers/radeonsi/si_state_shaders.c | |
parent | 810846e157cb7fe37041fa009f3ec6a3234935a2 (diff) |
radeonsi: move some global shader cache flags to per-binary flags
Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_state_shaders.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 63014c9687c..c9800c00b25 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -45,7 +45,7 @@ * Return the IR binary in a buffer. For TGSI the first 4 bytes contain its * size as integer. */ -void *si_get_ir_binary(struct si_shader_selector *sel, bool as_ngg) +void *si_get_ir_binary(struct si_shader_selector *sel, bool ngg, bool es) { struct blob blob; unsigned ir_size; @@ -64,13 +64,27 @@ void *si_get_ir_binary(struct si_shader_selector *sel, bool as_ngg) ir_size = blob.size; } + /* These settings affect the compilation, but they are not derived + * from the input shader IR. + */ + unsigned shader_variant_flags = 0; + + if (ngg) + shader_variant_flags |= 1 << 0; + if (sel->nir) + shader_variant_flags |= 1 << 1; + if (si_get_wave_size(sel->screen, sel->type, ngg, es) == 32) + shader_variant_flags |= 1 << 2; + if (sel->force_correct_derivs_after_kill) + shader_variant_flags |= 1 << 3; + unsigned size = 4 + 4 + ir_size + sizeof(sel->so); char *result = (char*)MALLOC(size); if (!result) return NULL; ((uint32_t*)result)[0] = size; - ((uint32_t*)result)[1] = as_ngg; + ((uint32_t*)result)[1] = shader_variant_flags; memcpy(result + 8, ir_binary, ir_size); memcpy(result + 8 + ir_size, &sel->so, sizeof(sel->so)); @@ -2462,8 +2476,10 @@ static void si_init_shader_selector_async(void *job, int thread_index) sel->type == PIPE_SHADER_GEOMETRY)) shader->key.as_ngg = 1; - if (sel->tokens || sel->nir) - ir_binary = si_get_ir_binary(sel, shader->key.as_ngg); + if (sel->tokens || sel->nir) { + ir_binary = si_get_ir_binary(sel, shader->key.as_ngg, + shader->key.as_es); + } /* Try to load the shader from the shader cache. */ mtx_lock(&sscreen->shader_cache_mutex); |