From: Boris Brezillon Date: Thu, 5 Mar 2020 16:24:39 +0000 (+0100) Subject: panfrost: Assign primitive_size.pointer only if writes_point_size() returns true X-Git-Tag: upstream/20.1.8~2618 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0402f79601c69089cc3cefab51adab9c3331669;p=platform%2Fupstream%2Fmesa.git panfrost: Assign primitive_size.pointer only if writes_point_size() returns true Checking vs->writes_point_size is not enough, as we might have a vertex shader writing point size, but a primitive that's not MALI_POINT. That currently works because emit_varying_descriptor() is called before the primitive_size.constant field is update, but let's make the logic more robust, just in case things are re-ordered at some point. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index b72677b..cc95846 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -353,7 +353,7 @@ panfrost_default_shader_backend(struct panfrost_context *ctx) memcpy(&ctx->fragment_shader_core, &shader, sizeof(shader)); } -static bool +bool panfrost_writes_point_size(struct panfrost_context *ctx) { assert(ctx->shader[PIPE_SHADER_VERTEX]); diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index bbef582..1e3639d 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -278,6 +278,9 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags); void panfrost_invalidate_frame(struct panfrost_context *ctx); +bool +panfrost_writes_point_size(struct panfrost_context *ctx); + void panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data); diff --git a/src/gallium/drivers/panfrost/pan_varyings.c b/src/gallium/drivers/panfrost/pan_varyings.c index 0ec4d56..6342549 100644 --- a/src/gallium/drivers/panfrost/pan_varyings.c +++ b/src/gallium/drivers/panfrost/pan_varyings.c @@ -299,7 +299,7 @@ panfrost_emit_varying_descriptor( sizeof(float) * 4, vertex_count); - if (vs->writes_point_size) + if (panfrost_writes_point_size(ctx)) ctx->payloads[PIPE_SHADER_FRAGMENT].primitive_size.pointer = panfrost_emit_varyings(ctx, &varyings[gl_PointSize], 2, vertex_count);