Mesa (main): zink: track mask of bound gfx shader stages

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 25 22:38:31 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Jun  9 19:14:26 2021 -0400

zink: track mask of bound gfx shader stages

Reviewed-by: Hoe Hao Cheng <haochengho12907 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12532>

---

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

diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 7667092e4bd..74cf6db2de3 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -213,6 +213,7 @@ struct zink_context {
    struct hash_table compute_program_cache;
    struct zink_compute_program *curr_compute;
 
+   unsigned shader_stages : ZINK_SHADER_COUNT; /* mask of bound gfx shader stages */
    unsigned dirty_shader_stages : 6; /* mask of changed shader stages */
    bool last_vertex_stage_dirty;
 
diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index 91db9cf0eea..b710f9c875b 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -892,9 +892,12 @@ bind_stage(struct zink_context *ctx, enum pipe_shader_type stage,
    } else {
       ctx->gfx_stages[stage] = shader;
       ctx->gfx_pipeline_state.combined_dirty = true;
-      if (!shader) {
+      if (shader)
+         ctx->shader_stages |= BITFIELD_BIT(stage);
+      else {
          ctx->gfx_pipeline_state.modules[stage] = VK_NULL_HANDLE;
          ctx->curr_program = NULL;
+         ctx->shader_stages &= ~BITFIELD_BIT(stage);
       }
       ctx->dirty_shader_stages |= 1 << stage;
    }



More information about the mesa-commit mailing list