Mesa (master): gallium/tgsi: Add support for PRIMITIVEID as a system value.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Sep 2 17:17:23 UTC 2020


Module: Mesa
Branch: master
Commit: 1ca9f22a8bd34e17f061378cf7568d40267e3c58
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ca9f22a8bd34e17f061378cf7568d40267e3c58

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jan 14 11:31:22 2020 -0800

gallium/tgsi: Add support for PRIMITIVEID as a system value.

NIR always represents this as a system value, so for NIR-to-TGSI we need
this support.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6567>

---

 src/gallium/auxiliary/draw/draw_gs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 2d11430b274..9f9983d8350 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -132,6 +132,12 @@ static void tgsi_fetch_gs_input(struct draw_geometry_shader *shader,
    unsigned input_vertex_stride = shader->input_vertex_stride;
    const float (*input_ptr)[4];
 
+   int primid_sv = machine->SysSemanticToIndex[TGSI_SEMANTIC_PRIMID];
+   if (primid_sv != -1) {
+      for (unsigned j = 0; j < TGSI_QUAD_SIZE; j++)
+         machine->SystemValue[primid_sv].xyzw[0].i[j] = shader->in_prim_idx;
+   }
+
    input_ptr = shader->input;
 
    for (i = 0; i < num_vertices; ++i) {



More information about the mesa-commit mailing list