zink: move point sprite rasterizer bits to unhashed pipeline state

avoid reading values that aren't part of the pipeline state

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12660>
This commit is contained in:
Mike Blumenkrantz 2021-06-24 14:59:01 -04:00 committed by Marge Bot
parent 0dc2de7b76
commit 58d08635b5
4 changed files with 16 additions and 10 deletions

View file

@ -455,13 +455,15 @@ zink_draw_vbo(struct pipe_context *pctx,
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_VERTEX);
ctx->gfx_pipeline_state.vertices_per_patch = vertices_per_patch;
if (mode_changed) {
if (mode == PIPE_PRIM_POINTS)
bool points_changed = false;
if (mode == PIPE_PRIM_POINTS) {
ctx->gfx_pipeline_state.has_points++;
else if (ctx->gfx_prim_mode == PIPE_PRIM_POINTS)
points_changed = true;
} else if (ctx->gfx_prim_mode == PIPE_PRIM_POINTS) {
ctx->gfx_pipeline_state.has_points--;
}
if (ctx->rast_state->base.point_quad_rasterization && mode_changed) {
if (ctx->gfx_prim_mode == PIPE_PRIM_POINTS || mode == PIPE_PRIM_POINTS)
points_changed = true;
}
if (points_changed && ctx->rast_state->base.point_quad_rasterization)
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_FRAGMENT);
}
ctx->gfx_prim_mode = mode;

View file

@ -75,6 +75,8 @@ struct zink_gfx_pipeline_state {
bool have_EXT_extended_dynamic_state;
bool have_EXT_extended_dynamic_state2;
uint8_t has_points; //either gs outputs points or prim type is points
uint8_t coord_replace_bits;
bool coord_replace_yinvert;
struct zink_blend_state *blend_state;
struct zink_render_pass *render_pass;
VkPipeline pipeline;

View file

@ -146,10 +146,9 @@ shader_key_fs_gen(struct zink_context *ctx, struct zink_shader *zs,
ctx->gfx_pipeline_state.blend_state &&
ctx->gfx_pipeline_state.blend_state->dual_src_blend &&
ctx->gfx_pipeline_state.blend_state->attachments[1].blendEnable;
if (ctx->gfx_pipeline_state.has_points &&
ctx->rast_state &&ctx->rast_state->base.point_quad_rasterization && ctx->rast_state->base.sprite_coord_enable) {
fs_key->coord_replace_bits = ctx->rast_state->base.sprite_coord_enable;
fs_key->coord_replace_yinvert = !!ctx->rast_state->base.sprite_coord_mode;
if (ctx->gfx_pipeline_state.has_points && ctx->gfx_pipeline_state.coord_replace_bits) {
fs_key->coord_replace_bits = ctx->gfx_pipeline_state.coord_replace_bits;
fs_key->coord_replace_yinvert = ctx->gfx_pipeline_state.coord_replace_yinvert;
}
}

View file

@ -603,8 +603,11 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
ctx->gfx_pipeline_state.dyn_state1.front_face = ctx->rast_state->front_face;
ctx->gfx_pipeline_state.dirty |= !zink_screen(pctx->screen)->info.have_EXT_extended_dynamic_state;
}
if (ctx->rast_state->base.point_quad_rasterization != point_quad_rasterization)
if (ctx->rast_state->base.point_quad_rasterization != point_quad_rasterization) {
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_FRAGMENT);
ctx->gfx_pipeline_state.coord_replace_bits = ctx->rast_state->base.sprite_coord_enable;
ctx->gfx_pipeline_state.coord_replace_yinvert = !!ctx->rast_state->base.sprite_coord_mode;
}
if (ctx->rast_state->base.scissor != scissor)
ctx->scissor_changed = true;
}