state->ARB_draw_buffers_enable = (ext_mode != extension_disable);
state->ARB_draw_buffers_warn = (ext_mode == extension_warn);
}
+ } else if (strcmp(name, "GL_ARB_draw_instanced") == 0) {
+ /* This extension is only supported in vertex shaders.
+ */
+ if (state->target != vertex_shader) {
+ unsupported = true;
+ } else {
+ state->ARB_draw_instanced_enable = (ext_mode != extension_disable);
+ state->ARB_draw_instanced_warn = (ext_mode == extension_warn);
+ }
} else if (strcmp(name, "GL_ARB_explicit_attrib_location") == 0) {
state->ARB_explicit_attrib_location_enable =
(ext_mode != extension_disable);
/*@{*/
unsigned ARB_draw_buffers_enable:1;
unsigned ARB_draw_buffers_warn:1;
+ unsigned ARB_draw_instanced_enable:1;
+ unsigned ARB_draw_instanced_warn:1;
unsigned ARB_explicit_attrib_location_enable:1;
unsigned ARB_explicit_attrib_location_warn:1;
unsigned ARB_fragment_coord_conventions_enable:1;
ir_var_in,
ir_var_out,
ir_var_inout,
+ ir_var_system_value, /**< Ex: front-face, instance-id, etc. */
ir_var_temporary /**< Temporary variable generated during compilation. */
};
index *= element_size;
for (int i = 0; i < element_size; i++) {
- if (var->mode == ir_var_in)
+ if (var->mode == ir_var_system_value) {
+ prog->SystemValuesRead |= (1 << (var->location + index + i));
+ }
+ else if (var->mode == ir_var_in)
prog->InputsRead |= BITFIELD64_BIT(var->location + index + i);
else
prog->OutputsWritten |= BITFIELD64_BIT(var->location + index + i);
ir_set_program_inouts_visitor::visit(ir_variable *ir)
{
if (ir->mode == ir_var_in ||
- ir->mode == ir_var_out) {
+ ir->mode == ir_var_out ||
+ ir->mode == ir_var_system_value) {
hash_table_insert(this->ht, ir, ir);
}
prog->InputsRead = 0;
prog->OutputsWritten = 0;
+ prog->SystemValuesRead = 0;
visit_list_elements(&v, instructions);
}
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,
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:
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,
}
}
+
+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,
ctx->API = api;
ctx->Extensions.ARB_draw_buffers = GL_TRUE;
+ ctx->Extensions.ARB_draw_instanced = GL_TRUE;
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
ctx->Extensions.EXT_texture_array = GL_TRUE;
ctx->Extensions.NV_texture_rectangle = GL_TRUE;