zink: add pipeline state flag for determining if output type is points

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:52:00 -04:00 committed by Marge Bot
parent ad45e351a2
commit 0dc2de7b76
3 changed files with 15 additions and 4 deletions

View File

@ -454,6 +454,12 @@ zink_draw_vbo(struct pipe_context *pctx,
if (drawid_broken != ctx->drawid_broken)
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)
ctx->gfx_pipeline_state.has_points++;
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)
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_FRAGMENT);

View File

@ -74,6 +74,7 @@ struct zink_gfx_pipeline_state {
bool sample_locations_enabled;
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
struct zink_blend_state *blend_state;
struct zink_render_pass *render_pass;
VkPipeline pipeline;

View File

@ -146,8 +146,7 @@ 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 (((shaders[PIPE_SHADER_GEOMETRY] && shaders[PIPE_SHADER_GEOMETRY]->nir->info.gs.output_primitive == GL_POINTS) ||
ctx->gfx_prim_mode == PIPE_PRIM_POINTS) &&
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;
@ -968,17 +967,22 @@ zink_bind_gs_state(struct pipe_context *pctx,
void *cso)
{
struct zink_context *ctx = zink_context(pctx);
bool had_points = ctx->gfx_stages[PIPE_SHADER_GEOMETRY] ? ctx->gfx_stages[PIPE_SHADER_GEOMETRY]->nir->info.gs.output_primitive == GL_POINTS : false;
if (!!ctx->gfx_stages[PIPE_SHADER_GEOMETRY] != !!cso)
ctx->dirty_shader_stages |= BITFIELD_BIT(PIPE_SHADER_VERTEX) |
BITFIELD_BIT(PIPE_SHADER_TESS_EVAL);
bind_stage(ctx, PIPE_SHADER_GEOMETRY, cso);
if (cso)
if (cso) {
ctx->last_vertex_stage = cso;
else {
if (!had_points && ctx->last_vertex_stage->nir->info.gs.output_primitive == GL_POINTS)
ctx->gfx_pipeline_state.has_points++;
} else {
if (ctx->gfx_stages[PIPE_SHADER_TESS_EVAL])
ctx->last_vertex_stage = ctx->gfx_stages[PIPE_SHADER_TESS_EVAL];
else
ctx->last_vertex_stage = ctx->gfx_stages[PIPE_SHADER_VERTEX];
if (had_points)
ctx->gfx_pipeline_state.has_points--;
}
}