zink: move pipeline tcs patch_vertices value to tcs shader key

making this available for shader update use

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:51:53 -05:00 committed by Marge Bot
parent 63236f9ea9
commit e1ef00aed7
4 changed files with 13 additions and 6 deletions

View file

@ -1816,7 +1816,10 @@ static void
zink_set_patch_vertices(struct pipe_context *pctx, uint8_t patch_vertices)
{
struct zink_context *ctx = zink_context(pctx);
ctx->gfx_pipeline_state.patch_vertices = patch_vertices;
if (zink_set_tcs_key_patches(ctx, patch_vertices)) {
ctx->gfx_pipeline_state.vertices_per_patch = patch_vertices ? patch_vertices - 1 : 0;
ctx->gfx_pipeline_state.dirty = true;
}
}
void

View file

@ -568,9 +568,6 @@ zink_draw(struct pipe_context *pctx,
zink_batch_rp(ctx);
/* these must be after renderpass start to avoid issues with recursion */
uint8_t vertices_per_patch = ctx->gfx_pipeline_state.patch_vertices ? ctx->gfx_pipeline_state.patch_vertices - 1 : 0;
if (ctx->gfx_pipeline_state.vertices_per_patch != vertices_per_patch)
ctx->gfx_pipeline_state.dirty = true;
bool drawid_broken = false;
if (reads_drawid && (!dindirect || !dindirect->buffer))
drawid_broken = (drawid_offset != 0 ||
@ -578,7 +575,6 @@ zink_draw(struct pipe_context *pctx,
(HAS_MULTIDRAW && num_draws > 1 && !dinfo->increment_draw_id));
if (drawid_broken != zink_get_last_vertex_key(ctx)->push_drawid)
zink_set_last_vertex_key(ctx)->push_drawid = drawid_broken;
ctx->gfx_pipeline_state.vertices_per_patch = vertices_per_patch;
if (mode_changed) {
bool points_changed = false;
if (mode == PIPE_PRIM_POINTS) {

View file

@ -83,7 +83,6 @@ struct zink_gfx_pipeline_state {
struct zink_blend_state *blend_state;
struct zink_render_pass *render_pass;
VkPipeline pipeline;
uint8_t patch_vertices;
unsigned idx : 8;
enum pipe_prim_type gfx_prim_mode; //pending mode
};

View file

@ -303,6 +303,15 @@ 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 bool
zink_set_tcs_key_patches(struct zink_context *ctx, uint8_t patch_vertices)
{
struct zink_tcs_key *tcs = (struct zink_tcs_key*)&ctx->gfx_pipeline_state.shader_keys.key[PIPE_SHADER_TESS_CTRL];
if (tcs->patch_vertices == patch_vertices)
return false;
tcs->patch_vertices = patch_vertices;
return true;
}
static inline const struct zink_tcs_key *
zink_get_tcs_key(struct zink_context *ctx)