summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2022-02-09 15:46:54 -0500
committerMarge Bot <emma+marge@anholt.net>2022-02-11 01:29:39 +0000
commit63236f9ea9e3d952fb059ca0d077d7723bfa5f8a (patch)
tree246a5fc5f3072592d9ca253a647d32e457d240de
parenta9d2b86c2c80b94281b6f0cfc1f73adde8e0e294 (diff)
zink: add a tcs shader key
only applies for generated tcs no functional changes Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14976>
-rw-r--r--src/gallium/drivers/zink/zink_context.c1
-rw-r--r--src/gallium/drivers/zink/zink_program.h7
-rw-r--r--src/gallium/drivers/zink/zink_shader_keys.h12
3 files changed, 20 insertions, 0 deletions
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