diff --git a/src/gallium/drivers/zink/zink_draw.cpp b/src/gallium/drivers/zink/zink_draw.cpp index 8c795211cd0..dbed49f0f97 100644 --- a/src/gallium/drivers/zink/zink_draw.cpp +++ b/src/gallium/drivers/zink/zink_draw.cpp @@ -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); diff --git a/src/gallium/drivers/zink/zink_pipeline.h b/src/gallium/drivers/zink/zink_pipeline.h index c8292040c30..458e5c0a756 100644 --- a/src/gallium/drivers/zink/zink_pipeline.h +++ b/src/gallium/drivers/zink/zink_pipeline.h @@ -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; diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 20685eebfdb..af3af7504f9 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -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--; } }