Mesa (main): zink: store the default variant hash for a program

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 7 03:30:53 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri May 14 18:30:58 2021 -0400

zink: store the default variant hash for a program

the first created pipeline with a program is the default variants, and
this is likely to be the most common, so we can store the hash to avoid
needing to recalc it later

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11740>

---

 src/gallium/drivers/zink/zink_program.c | 1 +
 src/gallium/drivers/zink/zink_program.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index 52d85f987d6..e5e736c72df 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -447,6 +447,7 @@ zink_create_gfx_program(struct zink_context *ctx,
    assign_io(prog, prog->shaders);
 
    update_shader_modules(ctx, prog->shaders, prog, false);
+   prog->default_variant_hash = ctx->gfx_pipeline_state.module_hash;
 
    for (int i = 0; i < ARRAY_SIZE(prog->pipelines); ++i) {
       prog->pipelines[i] = _mesa_hash_table_create(NULL,
diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h
index a406002288b..be4cd6cb68f 100644
--- a/src/gallium/drivers/zink/zink_program.h
+++ b/src/gallium/drivers/zink/zink_program.h
@@ -101,6 +101,7 @@ struct zink_gfx_program {
 
    struct zink_shader *shaders[ZINK_SHADER_COUNT];
    struct hash_table *pipelines[11]; // number of draw modes we support
+   uint32_t default_variant_hash;
 };
 
 struct zink_compute_program {



More information about the mesa-commit mailing list