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>
This commit is contained in:
Mike Blumenkrantz 2022-02-09 15:46:54 -05:00 committed by Marge Bot
parent a9d2b86c2c
commit 63236f9ea9
3 changed files with 20 additions and 0 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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