panfrost: Assign primitive_size.pointer only if writes_point_size() returns true
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 5 Mar 2020 16:24:39 +0000 (17:24 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 10 Mar 2020 11:47:33 +0000 (12:47 +0100)
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 <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h
src/gallium/drivers/panfrost/pan_varyings.c

index b72677b10bb52d5464c342c25a284de6064b6e30..cc958469edaf30cb9e74d16b6fccbd663bb1432c 100644 (file)
@@ -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]);
index bbef58292c6345eaff290adca24c83c3ec6e8c13..1e3639d5016f1cc15da515760441e14ad5fc7775 100644 (file)
@@ -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);
 
index 0ec4d5633d2f36e558f32eccf5e5c7ba584dbddc..63425491ab0c369e86b8b706452f224c0a195398 100644 (file)
@@ -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);