unsigned origin_upper_left:1;
unsigned pixel_center_integer:1;
/*@}*/
+
+ /**
+ * Flag set if GL_ARB_explicit_attrib_location "location" layout
+ * qualifier is used.
+ */
+ unsigned explicit_location:1;
} q;
unsigned i;
} flags;
+
+ /**
+ * Location specified via GL_ARB_explicit_attrib_location layout
+ *
+ * \note
+ * This field is only valid if \c explicit_location is set.
+ */
+ unsigned location;
};
class ast_struct_specifier : public ast_node {
layout_qualifier_id
| layout_qualifier_id_list ',' layout_qualifier_id
{
- /* FINISHME: Should check for conflicting / duplicate flags here.
- */
- $$ = $1;
- $$.flags.i |= $3.flags.i;
+ if (($1.flags.i & $3.flags.i) != 0) {
+ _mesa_glsl_error(& @3, state,
+ "duplicate layout qualifiers used\n");
+ YYERROR;
+ }
+
+ $$.flags.i = $1.flags.i | $3.flags.i;
+
+ if ($1.flags.q.explicit_location)
+ $$.location = $1.location;
+
+ if ($3.flags.q.explicit_location)
+ $$.location = $3.location;
}
;
"identifier `%s' used\n", $1);
}
}
+ | IDENTIFIER '=' INTCONSTANT
+ {
+ bool got_one = false;
+
+ memset(& $$, 0, sizeof($$));
+
+ if (state->ARB_explicit_attrib_location_enable) {
+ /* FINISHME: Handle 'index' once GL_ARB_blend_func_exteneded and
+ * FINISHME: GLSL 1.30 (or later) are supported.
+ */
+ if (strcmp("location", $1) == 0) {
+ got_one = true;
+
+ $$.flags.q.explicit_location = 1;
+
+ if ($3 >= 0) {
+ $$.location = $3;
+ } else {
+ _mesa_glsl_error(& @3, state,
+ "invalid location %d specified\n", $3);
+ YYERROR;
+ }
+ }
+ }
+
+ /* If the identifier didn't match any known layout identifiers,
+ * emit an error.
+ */
+ if (!got_one) {
+ _mesa_glsl_error(& @1, state, "unrecognized layout identifier "
+ "`%s'\n", $1);
+ YYERROR;
+ } else if (state->ARB_explicit_attrib_location_warn) {
+ _mesa_glsl_warning(& @1, state,
+ "GL_ARB_explicit_attrib_location layout "
+ "identifier `%s' used\n", $1);
+ }
+ }
;
interpolation_qualifier:
state->ARB_draw_buffers_enable = (ext_mode != extension_disable);
state->ARB_draw_buffers_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);
+ state->ARB_explicit_attrib_location_warn =
+ (ext_mode == extension_warn);
+
+ unsupported = !state->extensions->ARB_explicit_attrib_location;
} else if (strcmp(name, "GL_ARB_fragment_coord_conventions") == 0) {
state->ARB_fragment_coord_conventions_enable =
(ext_mode != extension_disable);
/*@{*/
unsigned ARB_draw_buffers_enable:1;
unsigned ARB_draw_buffers_warn:1;
+ unsigned ARB_explicit_attrib_location_enable:1;
+ unsigned ARB_explicit_attrib_location_warn:1;
unsigned ARB_fragment_coord_conventions_enable:1;
unsigned ARB_fragment_coord_conventions_warn:1;
unsigned ARB_texture_rectangle_enable:1;