Module: Mesa
Branch: main
Commit: 96f344e5a623d43f194cac570dd8625048cfcab7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=96f344e5a623d43f194cac570dd8625048cfcab7

Author: Felix DeGrood <[email protected]>
Date:   Wed Jun 28 23:40:46 2023 +0000

iris: save shader source sha1 in ish

Save lowest dword of shader source sha1 in pipeline object for use
later as hash for uniquely identifying shader in debug outputs.

Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23942>

---

 src/gallium/drivers/iris/iris_context.h | 3 +++
 src/gallium/drivers/iris/iris_program.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/gallium/drivers/iris/iris_context.h 
b/src/gallium/drivers/iris/iris_context.h
index 8bcfa8e3f4e..e3e7c1f0c67 100644
--- a/src/gallium/drivers/iris/iris_context.h
+++ b/src/gallium/drivers/iris/iris_context.h
@@ -434,6 +434,9 @@ struct iris_uncompiled_shader {
    /* A SHA1 of the serialized NIR for the disk cache. */
    unsigned char nir_sha1[20];
 
+   /* Hash value based on shader source program */
+   unsigned source_hash;
+
    unsigned program_id;
 
    /** Bitfield of (1 << IRIS_NOS_*) flags. */
diff --git a/src/gallium/drivers/iris/iris_program.c 
b/src/gallium/drivers/iris/iris_program.c
index 98a04d8af4b..465526479ba 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -2429,6 +2429,9 @@ iris_create_uncompiled_shader(struct iris_screen *screen,
       update_so_info(&ish->stream_output, nir->info.outputs_written);
    }
 
+   /* Use lowest dword of source shader sha1 for shader hash. */
+   ish->source_hash = *(uint32_t*)nir->info.source_sha1;
+
    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)

Reply via email to