Mesa (main): pan/bi: Make psiz variants

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 14:35:00 UTC 2022


Module: Mesa
Branch: main
Commit: f487c0904594c2b9cc8bed7545c22ac1d0b30c4f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f487c0904594c2b9cc8bed7545c22ac1d0b30c4f

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Sun Mar 13 11:29:23 2022 -0400

pan/bi: Make psiz variants

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15793>

---

 src/panfrost/bifrost/bifrost_compile.c | 21 +++++++++++++++++++++
 src/panfrost/util/pan_ir.h             | 10 ++++++++++
 2 files changed, 31 insertions(+)

diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 32a3691882e..a8beaccd92e 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -4705,6 +4705,27 @@ bi_compile_variant(nir_shader *nir,
                 info->work_reg_count = ctx->info.work_reg_count;
         }
 
+        if (idvs == BI_IDVS_POSITION &&
+            nir->info.outputs_written & BITFIELD_BIT(VARYING_SLOT_PSIZ)) {
+                /* Find the psiz write */
+                bi_instr *write = NULL;
+
+                bi_foreach_instr_global(ctx, I) {
+                        if (I->op == BI_OPCODE_STORE_I16 && I->seg == BI_SEG_POS) {
+                                write = I;
+                                break;
+                        }
+                }
+
+                assert(write != NULL);
+
+                /* Remove it, TODO: DCE */
+                bi_remove_instruction(write);
+
+                info->vs.no_psiz_offset = binary->size;
+                bi_pack_valhall(ctx, binary);
+        }
+
         ralloc_free(ctx);
 }
 
diff --git a/src/panfrost/util/pan_ir.h b/src/panfrost/util/pan_ir.h
index ffd1d855b0a..5b5a0019c94 100644
--- a/src/panfrost/util/pan_ir.h
+++ b/src/panfrost/util/pan_ir.h
@@ -278,6 +278,16 @@ struct pan_shader_info {
                 struct {
                         bool writes_point_size;
 
+                        /* If the primary shader writes point size, the Valhall
+                         * driver may need a variant that does not write point
+                         * size. Offset to such a shader in the program binary.
+                         *
+                         * Zero if no such variant is required.
+                         *
+                         * Only used with IDVS on Valhall.
+                         */
+                        unsigned no_psiz_offset;
+
                         /* Set if Index-Driven Vertex Shading is in use */
                         bool idvs;
 



More information about the mesa-commit mailing list