return NULL;
}
+/**
+ * This function merges both duplicate identifies within a single layout and
+ * multiple layout qualifiers on a single variable declaration. The
+ * is_single_layout_merge param is used differentiate between the two.
+ */
bool
ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
_mesa_glsl_parse_state *state,
- const ast_type_qualifier &q)
+ const ast_type_qualifier &q,
+ bool is_single_layout_merge)
{
ast_type_qualifier ubo_mat_mask;
ubo_mat_mask.flags.i = 0;
allowed_duplicates_mask.flags.i |=
stream_layout_mask.flags.i;
- if (!state->has_enhanced_layouts() &&
+ if (is_single_layout_merge && !state->has_enhanced_layouts() &&
(this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) {
_mesa_glsl_error(loc, state,
"duplicate layout qualifiers used");
ast_node* &node, bool create_node)
{
void *mem_ctx = state;
- const bool r = this->merge_qualifier(loc, state, q);
+ const bool r = this->merge_qualifier(loc, state, q, false);
if (state->stage == MESA_SHADER_GEOMETRY) {
if (q.flags.q.prim_type) {
"or precise");
$$ = $1;
- $$.merge_qualifier(&@1, state, $2);
+ $$.merge_qualifier(&@1, state, $2, false);
}
| precision_qualifier parameter_qualifier
{
| memory_qualifier parameter_qualifier
{
$$ = $1;
- $$.merge_qualifier(&@1, state, $2);
+ $$.merge_qualifier(&@1, state, $2, false);
}
parameter_direction_qualifier:
| layout_qualifier_id_list ',' layout_qualifier_id
{
$$ = $1;
- if (!$$.merge_qualifier(& @3, state, $3)) {
+ if (!$$.merge_qualifier(& @3, state, $3, true)) {
YYERROR;
}
}
}
$$ = $1;
- $$.merge_qualifier(&@1, state, $2);
+ $$.merge_qualifier(&@1, state, $2, false);
}
| layout_qualifier type_qualifier
{
_mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers");
$$ = $1;
- $$.merge_qualifier(&@1, state, $2);
+ $$.merge_qualifier(&@1, state, $2, false);
}
| subroutine_qualifier type_qualifier
{
$$ = $1;
- $$.merge_qualifier(&@1, state, $2);
+ $$.merge_qualifier(&@1, state, $2, false);
}
| auxiliary_storage_qualifier type_qualifier
{
"just before storage qualifiers");
}
$$ = $1;
- $$.merge_qualifier(&@1, state, $2);
+ $$.merge_qualifier(&@1, state, $2, false);
}
| storage_qualifier type_qualifier
{
}
$$ = $1;
- $$.merge_qualifier(&@1, state, $2);
+ $$.merge_qualifier(&@1, state, $2, false);
}
| precision_qualifier type_qualifier
{
| memory_qualifier type_qualifier
{
$$ = $1;
- $$.merge_qualifier(&@1, state, $2);
+ $$.merge_qualifier(&@1, state, $2, false);
}
;
YYERROR;
}
- if (!block->layout.merge_qualifier(& @1, state, $1)) {
+ if (!block->layout.merge_qualifier(& @1, state, $1, false)) {
YYERROR;
}
"memory qualifiers can only be used in the "
"declaration of shader storage blocks");
}
- if (!block->layout.merge_qualifier(& @1, state, $1)) {
+ if (!block->layout.merge_qualifier(& @1, state, $1, false)) {
YYERROR;
}
$$ = block;
YYERROR;
} else {
if (!state->default_uniform_qualifier->
- merge_qualifier(& @1, state, $1)) {
+ merge_qualifier(& @1, state, $1, false)) {
YYERROR;
}
}
}
| layout_qualifier UNIFORM ';'
{
- if (!state->default_uniform_qualifier->merge_qualifier(& @1, state, $1)) {
+ if (!state->default_uniform_qualifier->
+ merge_qualifier(& @1, state, $1, false)) {
YYERROR;
}
$$ = NULL;
YYERROR;
} else {
if (!state->default_shader_storage_qualifier->
- merge_qualifier(& @1, state, $1)) {
+ merge_qualifier(& @1, state, $1, false)) {
YYERROR;
}
}
}
| layout_qualifier BUFFER ';'
{
- if (!state->default_shader_storage_qualifier->merge_qualifier(& @1, state, $1)) {
+ if (!state->default_shader_storage_qualifier->
+ merge_qualifier(& @1, state, $1, false)) {
YYERROR;
}