summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/lima
diff options
context:
space:
mode:
authorVasily Khoruzhick <anarsoul@gmail.com>2021-03-25 11:16:23 -0700
committerMarge Bot <eric+marge@anholt.net>2021-03-25 21:58:57 +0000
commitbff7fa3fe3748f124763b6dcad09d0ce39722fbb (patch)
tree44604c595fc1b60aa1c9899bcc138a4ccde68854 /src/gallium/drivers/lima
parent8b586d9ed6d78af1f689194271703b37c4367644 (diff)
lima: compute nir_sha1 for shader key even if disk cache is disabled
We're using it for in-memory cache as well, so it needs to be computed unconditionally. Fixes: bf09ba538595 ("lima: implement shader disk cache") Reviewed-by: Erico Nunes <nunes.erico@gmail.com> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9838>
Diffstat (limited to 'src/gallium/drivers/lima')
-rw-r--r--src/gallium/drivers/lima/lima_program.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/gallium/drivers/lima/lima_program.c b/src/gallium/drivers/lima/lima_program.c
index 727a4485b41..19ad375c7ec 100644
--- a/src/gallium/drivers/lima/lima_program.c
+++ b/src/gallium/drivers/lima/lima_program.c
@@ -381,7 +381,6 @@ lima_create_fs_state(struct pipe_context *pctx,
{
struct lima_context *ctx = lima_context(pctx);
struct lima_fs_uncompiled_shader *so = rzalloc(NULL, struct lima_fs_uncompiled_shader);
- struct lima_screen *screen = lima_screen(pctx->screen);
if (!so)
return NULL;
@@ -400,18 +399,16 @@ lima_create_fs_state(struct pipe_context *pctx,
so->base.type = PIPE_SHADER_IR_NIR;
so->base.ir.nir = nir;
- if (screen->disk_cache) {
- /* Serialize the NIR to a binary blob that we can hash for the disk
- * cache. Drop unnecessary information (like variable names)
- * so the serialized NIR is smaller, and also to let us detect more
- * isomorphic shaders when hashing, increasing cache hits.
- */
- struct blob blob;
- blob_init(&blob);
- nir_serialize(&blob, nir, true);
- _mesa_sha1_compute(blob.data, blob.size, so->nir_sha1);
- blob_finish(&blob);
- }
+ /* Serialize the NIR to a binary blob that we can hash for the disk
+ * cache. Drop unnecessary information (like variable names)
+ * so the serialized NIR is smaller, and also to let us detect more
+ * isomorphic shaders when hashing, increasing cache hits.
+ */
+ struct blob blob;
+ blob_init(&blob);
+ nir_serialize(&blob, nir, true);
+ _mesa_sha1_compute(blob.data, blob.size, so->nir_sha1);
+ blob_finish(&blob);
if (lima_debug & LIMA_DEBUG_PRECOMPILE) {
/* Trigger initial compilation with default settings */
@@ -626,7 +623,6 @@ lima_create_vs_state(struct pipe_context *pctx,
const struct pipe_shader_state *cso)
{
struct lima_context *ctx = lima_context(pctx);
- struct lima_screen *screen = lima_screen(pctx->screen);
struct lima_vs_uncompiled_shader *so = rzalloc(NULL, struct lima_vs_uncompiled_shader);
if (!so)
@@ -646,18 +642,16 @@ lima_create_vs_state(struct pipe_context *pctx,
so->base.type = PIPE_SHADER_IR_NIR;
so->base.ir.nir = nir;
- if (screen->disk_cache) {
- /* Serialize the NIR to a binary blob that we can hash for the disk
- * cache. Drop unnecessary information (like variable names)
- * so the serialized NIR is smaller, and also to let us detect more
- * isomorphic shaders when hashing, increasing cache hits.
- */
- struct blob blob;
- blob_init(&blob);
- nir_serialize(&blob, nir, true);
- _mesa_sha1_compute(blob.data, blob.size, so->nir_sha1);
- blob_finish(&blob);
- }
+ /* Serialize the NIR to a binary blob that we can hash for the disk
+ * cache. Drop unnecessary information (like variable names)
+ * so the serialized NIR is smaller, and also to let us detect more
+ * isomorphic shaders when hashing, increasing cache hits.
+ */
+ struct blob blob;
+ blob_init(&blob);
+ nir_serialize(&blob, nir, true);
+ _mesa_sha1_compute(blob.data, blob.size, so->nir_sha1);
+ blob_finish(&blob);
if (lima_debug & LIMA_DEBUG_PRECOMPILE) {
/* Trigger initial compilation with default settings */