On 01/17/2011 03:38 PM, Ian Romanick wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/15/2011 09:25 AM, Brian Paul wrote:
diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp
index 6b9b294..4d10540 100644
--- a/src/glsl/ir_variable.cpp
+++ b/src/glsl/ir_variable.cpp
@@ -30,6 +30,11 @@ static void generate_ARB_draw_buffers_variables(exec_list *,
struct _mesa_glsl_parse_state *,
bool,
_mesa_glsl_parser_targets);
+static void
+generate_ARB_draw_instanced_variables(exec_list *,
+ struct _mesa_glsl_parse_state *,
+ bool, _mesa_glsl_parser_targets);
+
static ir_variable *
add_variable(const char *name, enum ir_variable_mode mode, int slot,
const glsl_type *type, exec_list *instructions,
@@ -41,6 +46,7 @@ add_variable(const char *name, enum ir_variable_mode mode,
int slot,
case ir_var_auto:
case ir_var_in:
case ir_var_uniform:
+ case ir_var_system_value:
var->read_only = true;
break;
case ir_var_inout:
@@ -324,8 +330,13 @@ initialize_vs_variables(exec_list *instructions,
generate_130_vs_variables(instructions, state);
break;
}
+
+ if (state->ARB_draw_instanced_enable)
+ generate_ARB_draw_instanced_variables(instructions, state, false,
+ vertex_shader);
Have you verified this against other implementations? The
GL_ARB_draw_instanced spec say:
"If EXT_gpu_shader4 or OpenGL 3.0 is not supported, all references to
gl_InstanceIDARB are deleted. Note that if EXT_gpu_shader4 is
available, the gl_InstanceIDARB and gl_InstanceID values are the
same."
Hmmm, I missed that.
Is gl_InstanceIDARB available in 1.10 or 1.20 vertex shaders on other
implementations?
With NVIDIA I found that gl_InstanceID is available (but not
gl_InstanceIDARB) if I declare "#extension GL_ARB_draw_instanced:
enable". And that's without #version 130. I was thinking that the
lack of gl_InstanceIDARB was a bug on their part.
This bit of weirdness in the spec is part of the reason I hadn't already
implemented this extension. It's not 100% clear to me why this
dependency exists. My only guess is that GLSL 1.20 and earlier allow
integer variables to be stored in floats, and that's kind of weird for
the instance ID.
That's probably it.
Unless there's strong objection I'd like to keep the code in there.
Maybe just add a state->language_version >= 130 check?
-Brian
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev