summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorAndres Gomez <[email protected]>2016-10-22 17:04:33 +0300
committerAndres Gomez <[email protected]>2016-11-25 13:18:30 +0200
commit5132d0c7b695d838617bf586e730899c65361668 (patch)
treec2fcaed84a13ee914324a27c2217386935b5d386 /src/compiler/glsl
parent93f90d7795ba414c01ab6fe905f8b3f61eeaf7ef (diff)
glsl: simplified error checking for duplicated layout-qualifiers
The GLSL parser has been simplified to check for the needed GL_ARB_shading_language_420pack extension just when merging the qualifiers in the proper cases. Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Andres Gomez <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/ast_type.cpp6
-rw-r--r--src/compiler/glsl/glsl_parser.yy24
2 files changed, 6 insertions, 24 deletions
diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index bfe1d2faca6..788f734b662 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -268,6 +268,12 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
return false;
}
+ if (is_multiple_layouts_merge && !state->has_420pack_or_es31()) {
+ _mesa_glsl_error(loc, state,
+ "duplicate layout(...) qualifiers");
+ return false;
+ }
+
if (q.flags.q.prim_type) {
r &= validate_prim_type(loc, state, *this, q);
this->flags.q.prim_type = 1;
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 5529f1116c1..9136fddbd14 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -1887,9 +1887,6 @@ type_qualifier:
* precise qualifiers since these are useful in ARB_separate_shader_objects.
* There is no clear spec guidance on this either.
*/
- if (!state->has_420pack_or_es31() && $2.has_layout())
- _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers");
-
$$ = $1;
$$.merge_qualifier(& @1, state, $2, false, $2.has_layout());
}
@@ -2713,11 +2710,6 @@ interface_block:
{
ast_interface_block *block = (ast_interface_block *) $2;
- if (!state->has_420pack_or_es31() && block->layout.has_layout()) {
- _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers");
- YYERROR;
- }
-
if (!$1.merge_qualifier(& @1, state, block->layout, false,
block->layout.has_layout())) {
YYERROR;
@@ -2855,10 +2847,6 @@ layout_uniform_defaults:
layout_qualifier layout_uniform_defaults
{
$$ = $1;
- if (!state->has_420pack_or_es31()) {
- _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers");
- YYERROR;
- }
if (!$$.merge_qualifier(& @1, state, $2, false, true)) {
YYERROR;
}
@@ -2870,10 +2858,6 @@ layout_buffer_defaults:
layout_qualifier layout_buffer_defaults
{
$$ = $1;
- if (!state->has_420pack_or_es31()) {
- _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers");
- YYERROR;
- }
if (!$$.merge_qualifier(& @1, state, $2, false, true)) {
YYERROR;
}
@@ -2885,10 +2869,6 @@ layout_in_defaults:
layout_qualifier layout_in_defaults
{
$$ = $1;
- if (!state->has_420pack_or_es31()) {
- _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers");
- YYERROR;
- }
if (!$$.merge_qualifier(& @1, state, $2, false, true)) {
YYERROR;
}
@@ -2908,10 +2888,6 @@ layout_out_defaults:
layout_qualifier layout_out_defaults
{
$$ = $1;
- if (!state->has_420pack_or_es31()) {
- _mesa_glsl_error(&@1, state, "duplicate layout(...) qualifiers");
- YYERROR;
- }
if (!$$.merge_qualifier(& @1, state, $2, false, true)) {
YYERROR;
}