[Mesa-dev] [PATCH 06/13] mesa: Add SYSTEM_VALUE_VERTEX_ID_ZERO_BASE

Ian Romanick idr at freedesktop.org
Fri Jun 20 18:00:56 PDT 2014


From: Ian Romanick <ian.d.romanick at intel.com>

There exists hardware, such as i965, that does not implement the OpenGL
semantic for gl_VertexID.  Instead, that hardware does not include the
value of basevertex in the gl_VertexID value.
SYSTEM_VALUE_VERTEX_ID_ZERO_BASE is the system value that represents
this semantic.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: "10.2" <mesa-stable at lists.freedesktop.org>
---
 src/mesa/main/mtypes.h                     | 12 ++++++++++++
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |  1 +
 2 files changed, 13 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 34e66c9..91f29a8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2058,6 +2058,8 @@ typedef enum
     *
     * gl_VertexID gets basevertex added in.  This differs from DirectX where
     * it's equivalent to gl_VertexID does \b not get basevertex added in.
+    *
+    * \sa SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
     */
    SYSTEM_VALUE_VERTEX_ID,
 
@@ -2089,6 +2091,16 @@ typedef enum
     * Note that baseinstance is \b not included in the value of instance.
     */
    SYSTEM_VALUE_INSTANCE_ID,
+
+   /**
+    * DirectX-style vertex ID.
+    *
+    * Unlike \c SYSTEM_VALUE_VERTEX_ID, this system value does \b not include
+    * the value of basevertex.
+    *
+    * \sa SYSTEM_VALUE_VERTEX_ID, SYSTEM_VALUE_BASE_VERTEX
+    */
+   SYSTEM_VALUE_VERTEX_ID_ZERO_BASE,
    /*@}*/
 
    /**
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index fa95493..5e4b497 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4240,6 +4240,7 @@ const unsigned _mesa_sysval_to_semantic[SYSTEM_VALUE_MAX] = {
     */
    TGSI_SEMANTIC_VERTEXID,
    TGSI_SEMANTIC_INSTANCEID,
+   0,
 
    /* Geometry shader
     */
-- 
1.8.1.4



More information about the mesa-dev mailing list