nir: Add more system values for lowering XFB
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 18 Mar 2023 02:57:25 +0000 (22:57 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 13 Apr 2023 18:04:25 +0000 (18:04 +0000)
Add more system values for XFB. This should be good enough for lowering GL3.1 +
transform_feedback2 + transform_feedback3. More will probably be needed for
geom/tess but that will be easier to work with when I'm actually bringing up
geom/tess. At any rate, we're splitting out XFB from the rasterization pipeline
and since XFB happens only in the last shader pre-rasterization stage, VS+XFB is
an orthogonal problem from e.g. VS+GS+XFB. Yeah, the combinatorics suck.

These will be used by Asahi, and hopefully eventually Panfrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22123>

src/compiler/nir/nir_intrinsics.py

index 7474afb..3c194ad 100644 (file)
@@ -864,8 +864,15 @@ system_value("scratch_base_ptr", 0, bit_sizes=[32,64], indices=[BASE])
 system_value("constant_base_ptr", 0, bit_sizes=[32,64])
 system_value("shared_base_ptr", 0, bit_sizes=[32,64])
 system_value("global_base_ptr", 0, bit_sizes=[32,64])
-# Address of a transform feedback buffer, indexed by BASE
+# Address and size of a transform feedback buffer, indexed by BASE
 system_value("xfb_address", 1, bit_sizes=[32,64], indices=[BASE])
+system_value("xfb_size", 1, bit_sizes=[32], indices=[BASE])
+
+# Address of the associated index buffer in a transform feedback program for an
+# indexed draw. This will be used so transform feedback can pull the gl_VertexID
+# from the index buffer.
+system_value("xfb_index_buffer", 1, bit_sizes=[32,64])
+
 system_value("frag_size", 2)
 system_value("frag_invocation_count", 1)