Mesa (main): zink: add a tcs shader key

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Feb 11 01:41:37 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Feb  9 15:46:54 2022 -0500

zink: add a tcs shader key

only applies for generated tcs

no functional changes

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

---

 src/gallium/drivers/zink/zink_context.c     |  1 +
 src/gallium/drivers/zink/zink_program.h     |  7 +++++++
 src/gallium/drivers/zink/zink_shader_keys.h | 12 ++++++++++++
 3 files changed, 20 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 8ba6fcbdea4..e3502e8de72 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -4151,6 +4151,7 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
    ctx->last_vertex_stage_dirty = true;
    ctx->gfx_pipeline_state.shader_keys.key[PIPE_SHADER_VERTEX].size = sizeof(struct zink_vs_key_base);
    ctx->gfx_pipeline_state.shader_keys.key[PIPE_SHADER_TESS_EVAL].size = sizeof(struct zink_vs_key_base);
+   ctx->gfx_pipeline_state.shader_keys.key[PIPE_SHADER_TESS_CTRL].size = sizeof(struct zink_tcs_key);
    ctx->gfx_pipeline_state.shader_keys.key[PIPE_SHADER_GEOMETRY].size = sizeof(struct zink_vs_key_base);
    ctx->gfx_pipeline_state.shader_keys.key[PIPE_SHADER_FRAGMENT].size = sizeof(struct zink_fs_key);
    _mesa_hash_table_init(&ctx->compute_program_cache, ctx, _mesa_hash_pointer, _mesa_key_pointer_equal);
diff --git a/src/gallium/drivers/zink/zink_program.h b/src/gallium/drivers/zink/zink_program.h
index 78ac5f048ea..0d7a049bd38 100644
--- a/src/gallium/drivers/zink/zink_program.h
+++ b/src/gallium/drivers/zink/zink_program.h
@@ -303,6 +303,13 @@ zink_get_fs_key(struct zink_context *ctx)
    return (const struct zink_fs_key *)&ctx->gfx_pipeline_state.shader_keys.key[PIPE_SHADER_FRAGMENT];
 }
 
+
+static inline const struct zink_tcs_key *
+zink_get_tcs_key(struct zink_context *ctx)
+{
+   return (const struct zink_tcs_key *)&ctx->gfx_pipeline_state.shader_keys.key[PIPE_SHADER_TESS_CTRL];
+}
+
 void
 zink_update_fs_key_samples(struct zink_context *ctx);
 
diff --git a/src/gallium/drivers/zink/zink_shader_keys.h b/src/gallium/drivers/zink/zink_shader_keys.h
index 98e671d7434..0857d63b734 100644
--- a/src/gallium/drivers/zink/zink_shader_keys.h
+++ b/src/gallium/drivers/zink/zink_shader_keys.h
@@ -63,6 +63,10 @@ struct zink_fs_key {
    bool force_persample_interp;
 };
 
+struct zink_tcs_key {
+   uint8_t patch_vertices;
+};
+
 struct zink_shader_key_base {
    uint32_t inlined_uniform_values[MAX_INLINABLE_UNIFORMS];
 };
@@ -77,6 +81,7 @@ struct zink_shader_key {
       /* reuse vs key for now with tes/gs since we only use clip_halfz */
       struct zink_vs_key vs;
       struct zink_vs_key_base vs_base;
+      struct zink_tcs_key tcs;
       struct zink_fs_key fs;
    } key;
    struct zink_shader_key_base base;
@@ -104,6 +109,13 @@ zink_vs_key(const struct zink_shader_key *key)
    return &key->key.vs;
 }
 
+static inline const struct zink_tcs_key *
+zink_tcs_key(const struct zink_shader_key *key)
+{
+   assert(key);
+   return &key->key.tcs;
+}
+
 
 
 #endif



More information about the mesa-commit mailing list