aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ir_variable.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-16 16:08:57 +0000
committermarha <marha@users.sourceforge.net>2011-01-16 16:08:57 +0000
commit367c91bebcdc1f5ba4278b68eb8715218d9640ad (patch)
tree7ddef803c402f1b84e293793c5fd3d0e95d3de0a /mesalib/src/glsl/ir_variable.cpp
parent6feea7e6cdde235d7e3727c4155ca9f8d90df3ca (diff)
downloadvcxsrv-367c91bebcdc1f5ba4278b68eb8715218d9640ad.tar.gz
vcxsrv-367c91bebcdc1f5ba4278b68eb8715218d9640ad.tar.bz2
vcxsrv-367c91bebcdc1f5ba4278b68eb8715218d9640ad.zip
mesalib git update 16/1/2011
Diffstat (limited to 'mesalib/src/glsl/ir_variable.cpp')
-rw-r--r--mesalib/src/glsl/ir_variable.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/mesalib/src/glsl/ir_variable.cpp b/mesalib/src/glsl/ir_variable.cpp
index f99632b48..1cf450e20 100644
--- a/mesalib/src/glsl/ir_variable.cpp
+++ b/mesalib/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);
}
+
/* This function should only be called for ES, not desktop GL. */
static void
generate_100ES_fs_variables(exec_list *instructions,
@@ -422,6 +433,27 @@ generate_ARB_draw_buffers_variables(exec_list *instructions,
}
}
+
+static void
+generate_ARB_draw_instanced_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool warn,
+ _mesa_glsl_parser_targets target)
+{
+ /* gl_InstanceIDARB is only available in the vertex shader.
+ */
+ if (target == vertex_shader) {
+ ir_variable *const inst =
+ add_variable("gl_InstanceIDARB", ir_var_system_value,
+ SYSTEM_VALUE_INSTANCE_ID,
+ glsl_type::int_type, instructions, state->symbols);
+
+ if (warn)
+ inst->warn_extension = "GL_ARB_draw_instanced";
+ }
+}
+
+
static void
generate_ARB_shader_stencil_export_variables(exec_list *instructions,
struct _mesa_glsl_parse_state *state,