panfrost: Only do point coord replacement for PIPE_PRIM_POINTS
authorIcecream95 <ixn@disroot.org>
Sat, 10 Apr 2021 03:28:15 +0000 (15:28 +1200)
committerIcecream95 <ixn@disroot.org>
Sat, 10 Apr 2021 04:56:39 +0000 (16:56 +1200)
Fixes rendering in Terraria on Midgard.

Thanks to macc24 for reporting this and to HdkR for pointing me to a
similar issue for virgl.

Cc: mesa-stable
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10154>

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

index 1e8462e..b2b8b98 100644 (file)
@@ -2107,7 +2107,8 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
                                  mali_ptr *buffers,
                                  unsigned *buffer_count,
                                  mali_ptr *position,
-                                 mali_ptr *psiz)
+                                 mali_ptr *psiz,
+                                 bool point_coord_replace)
 {
         /* Load the shaders */
         struct panfrost_context *ctx = batch->ctx;
@@ -2131,7 +2132,7 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
         uint16_t point_coord_mask = ctx->rasterizer->base.sprite_coord_enable;
 
         /* TODO: point sprites need lowering on Bifrost */
-        if (pan_is_bifrost(dev))
+        if (!point_coord_replace || pan_is_bifrost(dev))
                 point_coord_mask =  0;
 
         unsigned present = pan_varying_present(dev, vs, fs, point_coord_mask);
index cdca802..4a46976 100644 (file)
@@ -84,7 +84,8 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
                                  mali_ptr *buffers,
                                  unsigned *buffer_count,
                                  mali_ptr *position,
-                                 mali_ptr *psiz);
+                                 mali_ptr *psiz,
+                                 bool point_coord_replace);
 
 void
 panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
index 11e32c8..b3c0580 100644 (file)
@@ -557,11 +557,14 @@ panfrost_direct_draw(struct panfrost_context *ctx,
         /* Emit all sort of descriptors. */
         mali_ptr varyings = 0, vs_vary = 0, fs_vary = 0, pos = 0, psiz = 0;
 
+        bool point_coord_replace = (info->mode == PIPE_PRIM_POINTS);
+
         panfrost_emit_varying_descriptor(batch,
                                          ctx->padded_count *
                                          ctx->instance_count,
                                          &vs_vary, &fs_vary, &varyings,
-                                         NULL, &pos, &psiz);
+                                         NULL, &pos, &psiz,
+                                         point_coord_replace);
 
         mali_ptr attribs, attrib_bufs;
         attribs = panfrost_emit_vertex_data(batch, &attrib_bufs);
@@ -654,9 +657,12 @@ panfrost_indirect_draw(struct panfrost_context *ctx,
         ctx->instance_count = ctx->vertex_count = ctx->padded_count = 0;
         ctx->offset_start = 0;
 
+        bool point_coord_replace = (info->mode == PIPE_PRIM_POINTS);
+
         panfrost_emit_varying_descriptor(batch, 0,
                                          &vs_vary, &fs_vary, &varyings,
-                                         &varying_buf_count, &pos, &psiz);
+                                         &varying_buf_count, &pos, &psiz,
+                                         point_coord_replace);
 
         mali_ptr attribs, attrib_bufs;
         attribs = panfrost_emit_vertex_data(batch, &attrib_bufs);