From a3cbfb5bd9d9b2cbbd1a8a68d2577183e0b4f190 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 17 Jan 2024 09:55:21 +0000 Subject: [PATCH] panfrost: clean up active_prim update How we're updating active_prim is currently a bit convoluted, because we update it from two different places: First, we update it right before updating the shader-variant in the case of point-sprite changes, and then later on we update it unconditionally. But we're about to need to change this logic, because we also need to deal with line-smooth lowering. So let's clean this up a tad first, by moving both updates to the same function, and renaming it a bit. This let's us cleanly update it in one place, and then react to the change. While we're at it, let's replace the bitwise xor with a logical not-equals, which makes this all logical operations. Reviewed-by: Boris Brezillon Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 920efee4983..aef7743d35f 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -2766,14 +2766,15 @@ panfrost_increase_vertex_count(struct panfrost_batch *batch, uint32_t increment) * because all dirty flags are set there. */ static void -panfrost_update_point_sprite_shader(struct panfrost_context *ctx, - const struct pipe_draw_info *info) +panfrost_update_active_prim(struct panfrost_context *ctx, + const struct pipe_draw_info *info) { - if ((ctx->dirty & PAN_DIRTY_RASTERIZER) || - ((ctx->active_prim == MESA_PRIM_POINTS) ^ - (info->mode == MESA_PRIM_POINTS))) { + const enum mesa_prim prev_prim = ctx->active_prim; + ctx->active_prim = info->mode; - ctx->active_prim = info->mode; + if ((ctx->dirty & PAN_DIRTY_RASTERIZER) || + ((prev_prim == MESA_PRIM_POINTS) != + (info->mode == MESA_PRIM_POINTS))) { panfrost_update_shader_variant(ctx, PIPE_SHADER_FRAGMENT); } } @@ -2836,7 +2837,7 @@ panfrost_direct_draw(struct panfrost_batch *batch, struct panfrost_context *ctx = batch->ctx; - panfrost_update_point_sprite_shader(ctx, info); + panfrost_update_active_prim(ctx, info); /* Take into account a negative bias */ ctx->vertex_count = @@ -2844,7 +2845,6 @@ panfrost_direct_draw(struct panfrost_batch *batch, ctx->instance_count = info->instance_count; ctx->base_vertex = info->index_size ? draw->index_bias : 0; ctx->base_instance = info->start_instance; - ctx->active_prim = info->mode; ctx->drawid = drawid_offset; struct panfrost_compiled_shader *vs = ctx->prog[PIPE_SHADER_VERTEX];