Mesa (master): iris/disk_cache: Stop assuming stage == cache_id

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 12 10:29:16 UTC 2020


Module: Mesa
Branch: master
Commit: 43429efc61e836b3a1eda5b2290153c20ec099b2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=43429efc61e836b3a1eda5b2290153c20ec099b2

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Tue Aug 11 16:12:55 2020 -0500

iris/disk_cache: Stop assuming stage == cache_id

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6280>

---

 src/gallium/drivers/iris/iris_disk_cache.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/iris/iris_disk_cache.c b/src/gallium/drivers/iris/iris_disk_cache.c
index 5554b5c2f17..4913f309d0c 100644
--- a/src/gallium/drivers/iris/iris_disk_cache.c
+++ b/src/gallium/drivers/iris/iris_disk_cache.c
@@ -124,6 +124,15 @@ iris_disk_cache_store(struct disk_cache *cache,
 #endif
 }
 
+static const enum iris_program_cache_id cache_id_for_stage[] = {
+   [MESA_SHADER_VERTEX]    = IRIS_CACHE_VS,
+   [MESA_SHADER_TESS_CTRL] = IRIS_CACHE_TCS,
+   [MESA_SHADER_TESS_EVAL] = IRIS_CACHE_TES,
+   [MESA_SHADER_GEOMETRY]  = IRIS_CACHE_GS,
+   [MESA_SHADER_FRAGMENT]  = IRIS_CACHE_FS,
+   [MESA_SHADER_COMPUTE]   = IRIS_CACHE_CS,
+};
+
 /**
  * Search for a compiled shader in the disk cache.  If found, upload it
  * to the in-memory program cache so we can use it.
@@ -216,11 +225,14 @@ iris_disk_cache_retrieve(struct iris_context *ice,
    if (num_system_values)
       num_cbufs++;
 
+   assert(stage < ARRAY_SIZE(cache_id_for_stage));
+   enum iris_program_cache_id cache_id = cache_id_for_stage[stage];
+
    /* Upload our newly read shader to the in-memory program cache and
     * return it to the caller.
     */
    struct iris_compiled_shader *shader =
-      iris_upload_shader(ice, stage, key_size, prog_key, assembly,
+      iris_upload_shader(ice, cache_id, key_size, prog_key, assembly,
                          prog_data, so_decls, system_values,
                          num_system_values, kernel_input_size, num_cbufs, &bt);
 



More information about the mesa-commit mailing list