[Mesa-dev] [PATCH] glsl: Make gl_InstanceID available with GL_ARB_draw_instanced extension

Ian Romanick idr at freedesktop.org
Wed Feb 29 08:29:39 PST 2012


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

Originally ARB_draw_instanced only specified that ARB decorated name.
Since no vendor actually implemented that behavior and some apps use
the undecorated name, the extension now specifies that both names are
available.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Marek Olšák <maraeo at gmail.com>
---
The changes to the OpenGL registry just landed.

 src/glsl/builtin_variables.cpp |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index ed6b922..66b3abd 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -870,13 +870,25 @@ generate_ARB_draw_instanced_variables(exec_list *instructions,
    /* gl_InstanceIDARB is only available in the vertex shader.
     */
    if (target == vertex_shader) {
-      ir_variable *const inst =
+      ir_variable *inst =
          add_variable(instructions, state->symbols,
 		      "gl_InstanceIDARB", glsl_type::int_type,
 		      ir_var_system_value, SYSTEM_VALUE_INSTANCE_ID);
 
       if (warn)
          inst->warn_extension = "GL_ARB_draw_instanced";
+
+      /* Originally ARB_draw_instanced only specified that ARB decorated name.
+       * Since no vendor actually implemented that behavior and some apps use
+       * the undecorated name, the extension now specifies that both names are
+       * available.
+       */
+      inst = add_variable(instructions, state->symbols,
+			  "gl_InstanceID", glsl_type::int_type,
+			  ir_var_system_value, SYSTEM_VALUE_INSTANCE_ID);
+
+      if (warn)
+         inst->warn_extension = "GL_ARB_draw_instanced";
    }
 }
 
-- 
1.7.6.5



More information about the mesa-dev mailing list