panfrost: Push sample positions sysval for Midgard
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 29 Jan 2021 01:43:53 +0000 (20:43 -0500)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 12 Feb 2021 21:44:28 +0000 (16:44 -0500)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>

src/gallium/drivers/panfrost/pan_cmdstream.c

index ccdaf7e..daaee4b 100644 (file)
@@ -900,6 +900,17 @@ panfrost_upload_work_dim_sysval(struct panfrost_batch *batch,
         uniform->u[0] = ctx->compute_grid->work_dim;
 }
 
+/* Sample positions are pushed in a Bifrost specific format on Bifrost. On
+ * Midgard, we emulate the Bifrost path with some extra arithmetic in the
+ * shader, to keep the code as unified as possible. */
+
+static void
+panfrost_upload_sample_positions_sysval(struct panfrost_batch *batch,
+                                struct sysval_uniform *uniform)
+{
+        uniform->du[0] = panfrost_emit_sample_locations(batch);
+}
+
 static void
 panfrost_upload_sysvals(struct panfrost_batch *batch, void *buf,
                         struct panfrost_shader_state *ss,
@@ -951,6 +962,11 @@ panfrost_upload_sysvals(struct panfrost_batch *batch, void *buf,
                                                           PAN_SYSVAL_ID(sysval),
                                                           &uniforms[i]);
                         break;
+                case PAN_SYSVAL_SAMPLE_POSITIONS:
+                        panfrost_upload_sample_positions_sysval(batch,
+                                                        &uniforms[i]);
+                        break;
+
                 default:
                         assert(0);
                 }