summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.pick_status.json2
-rw-r--r--src/panfrost/util/pan_lower_xfb.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 751721b7afd..2821ed7e3f5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1471,7 +1471,7 @@
"description": "panfrost: Lower vertex_id for XFB",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "91ffd1035105c2c04f4cc2687fb4f9ff63fb69a5"
},
diff --git a/src/panfrost/util/pan_lower_xfb.c b/src/panfrost/util/pan_lower_xfb.c
index 3876e60d1d3..56ddd323562 100644
--- a/src/panfrost/util/pan_lower_xfb.c
+++ b/src/panfrost/util/pan_lower_xfb.c
@@ -65,6 +65,20 @@ lower_xfb(nir_builder *b, nir_instr *instr, UNUSED void *data)
return false;
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
+
+ /* In transform feedback programs, vertex ID becomes zero-based, so apply
+ * that lowering even on Valhall.
+ */
+ if (intr->intrinsic == nir_intrinsic_load_vertex_id) {
+ b->cursor = nir_instr_remove(instr);
+
+ nir_ssa_def *repl =
+ nir_iadd(b, nir_load_vertex_id_zero_base(b), nir_load_first_vertex(b));
+
+ nir_ssa_def_rewrite_uses(&intr->dest.ssa, repl);
+ return true;
+ }
+
if (intr->intrinsic != nir_intrinsic_store_output)
return false;