panfrost: Rename panfrost_stage_attributes()
[mesa.git] / src / gallium / drivers / panfrost / pan_cmdstream.c
index 467884cdd0bb93c5847c73d140af8e4666bb9710..c9aa4b8399d07b090ba3899a15cf323e45058b10 100644 (file)
@@ -1045,3 +1045,53 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch,
 
         vtp->postfix.sampler_descriptor = transfer.gpu;
 }
+
+void
+panfrost_emit_vertex_attr_meta(struct panfrost_batch *batch,
+                               struct midgard_payload_vertex_tiler *vp)
+{
+        struct panfrost_context *ctx = batch->ctx;
+
+        if (!ctx->vertex)
+                return;
+
+        struct panfrost_vertex_state *so = ctx->vertex;
+
+        panfrost_vertex_state_upd_attr_offs(ctx, vp);
+        vp->postfix.attribute_meta = panfrost_upload_transient(batch, so->hw,
+                                                               sizeof(*so->hw) *
+                                                               PAN_MAX_ATTRIBUTE);
+}
+
+void
+panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
+                                struct midgard_payload_vertex_tiler *vp,
+                                struct midgard_payload_vertex_tiler *tp)
+{
+        struct panfrost_context *ctx = batch->ctx;
+        bool wallpapering = ctx->wallpaper_batch && batch->tiler_dep;
+
+        if (wallpapering) {
+                /* Inject in reverse order, with "predicted" job indices.
+                 * THIS IS A HACK XXX */
+                panfrost_new_job(batch, JOB_TYPE_TILER, false,
+                                 batch->job_index + 2, tp, sizeof(*tp), true);
+                panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0,
+                                 vp, sizeof(*vp), true);
+                return;
+        }
+
+        /* If rasterizer discard is enable, only submit the vertex */
+
+        bool rasterizer_discard = ctx->rasterizer &&
+                                  ctx->rasterizer->base.rasterizer_discard;
+
+        unsigned vertex = panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0,
+                                           vp, sizeof(*vp), false);
+
+        if (rasterizer_discard)
+                return;
+
+        panfrost_new_job(batch, JOB_TYPE_TILER, false, vertex, tp, sizeof(*tp),
+                         false);
+}