[Mesa-dev] [PATCH 2/2] st/glsl_to_tgsi: Add support for SYSTEM_VALUE_BASE_VERTEX_ID

Neil Roberts nroberts at igalia.com
Wed Nov 22 14:03:25 UTC 2017


SYSTEM_VALUE_BASE_VERTEX has changed to be the correct value for
gl_BaseVertex, which means it will be zero when used with a
non-indexed call. The new BASE_VERTEX_ID value can be used as before
as an offset to calculate a value for gl_VertexID. These values should
be different, but this patch just makes them same for now in order to
at least retain the previous behaviour and not break gl_BaseVertexID
and gl_VertexID entirely on radeonsi.

Note, this hasn’t been tested apart from to verify that it compiles.
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 0772b73..3dfed19 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5385,6 +5385,11 @@ _mesa_sysval_to_semantic(unsigned sysval)
    case SYSTEM_VALUE_VERTEX_ID_ZERO_BASE:
       return TGSI_SEMANTIC_VERTEXID_NOBASE;
    case SYSTEM_VALUE_BASE_VERTEX:
+   case SYSTEM_VALUE_BASE_VERTEX_ID:
+      /* FIXME: These two values are actually supposed to be different. The
+       * one used for gl_BaseVertex is supposed to be zero when a non-indexed
+       * draw call is used.
+       */
       return TGSI_SEMANTIC_BASEVERTEX;
    case SYSTEM_VALUE_BASE_INSTANCE:
       return TGSI_SEMANTIC_BASEINSTANCE;
-- 
2.9.5



More information about the mesa-dev mailing list