[Mesa-dev] [PATCH] builtin_variables: Only advertise gl_InstanceIDARB when GLSL handle integers.
Olivier Galibert
galibert at pobox.com
Mon Jun 25 00:36:00 PDT 2012
It can be argued it makes to sense to advertise an integer system
variable in GLSL levels where integers aren't handled.
Signed-off-by: Olivier Galibert <galibert at pobox.com>
---
I don't really know if that's a patch we want, but otoh having
gl_InstanceIDARB being a different type depending on the GLSL version
would be... weird.
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 03b64c9..f9a341f 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -888,12 +888,13 @@ generate_ARB_draw_instanced_variables(exec_list *instructions,
bool warn,
_mesa_glsl_parser_targets target)
{
- /* gl_InstanceIDARB is only available in the vertex shader.
+ /* gl_InstanceIDARB is only available in the vertex shader, and
+ * only if the glsl level can handle integers.
*/
if (target != vertex_shader)
return;
- if (state->ARB_draw_instanced_enable) {
+ if (state->ARB_draw_instanced_enable && state->language_version >= 130) {
ir_variable *inst =
add_variable(instructions, state->symbols,
"gl_InstanceIDARB", glsl_type::int_type,
More information about the mesa-dev
mailing list