summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/etnaviv/etnaviv_shader.c
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2020-08-08 17:44:15 +0200
committerMarge Bot <eric+marge@anholt.net>2020-09-18 07:45:11 +0000
commit77af1ca690f4f49e305c095d97b9af798bfea307 (patch)
tree28960c279b397815dabde68b878b60dfe227f47a /src/gallium/drivers/etnaviv/etnaviv_shader.c
parent6a0d7f6316c60b480f4439ecef50de422a9175a6 (diff)
etnaviv: add disk cache
Adds a shader disk-cache for shader variants. Note that builds with `-Dshader-cache=false` have no-op stubs with `disk_cache_create()` that returns NULL. This shader disk-cache gets used when using NIR only. Helps to save about 1-2 minutes for a deqp run on gc2000. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6669>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_shader.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_shader.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c
index b44354483ae..47becee5eb5 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_shader.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c
@@ -29,6 +29,7 @@
#include "etnaviv_compiler.h"
#include "etnaviv_context.h"
#include "etnaviv_debug.h"
+#include "etnaviv_disk_cache.h"
#include "etnaviv_screen.h"
#include "etnaviv_util.h"
@@ -353,6 +354,10 @@ create_variant(struct etna_shader *shader, struct etna_shader_key key)
v->shader = shader;
v->key = key;
+ v->id = ++shader->variant_count;
+
+ if (etna_disk_cache_retrieve(shader->compiler, v))
+ return v;
ret = etna_compile_shader(v);
if (!ret) {
@@ -360,7 +365,7 @@ create_variant(struct etna_shader *shader, struct etna_shader_key key)
goto fail;
}
- v->id = ++shader->variant_count;
+ etna_disk_cache_store(shader->compiler, v);
return v;
@@ -412,7 +417,7 @@ etna_create_shader_state(struct pipe_context *pctx,
else
shader->tokens = tgsi_dup_tokens(pss->tokens);
-
+ etna_disk_cache_init_shader_key(compiler, shader);
if (etna_mesa_debug & ETNA_DBG_SHADERDB) {
/* if shader-db run, create a standard variant immediately