summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-01-12 12:41:32 +1100
committerTimothy Arceri <[email protected]>2016-03-05 19:39:01 +1100
commit5a27fefffec30a88a0e0779583f45ca01aae54a4 (patch)
tree67d2db3c0833dcf17eaef964816be8d44610aa68 /src/compiler/glsl
parent22b0082b9d32229e735a4ed7e9d9298b2ea14115 (diff)
glsl: parse align layout qualifier
Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/ast.h11
-rw-r--r--src/compiler/glsl/ast_type.cpp4
-rw-r--r--src/compiler/glsl/glsl_parser.yy11
3 files changed, 26 insertions, 0 deletions
diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 4dc9674e424..727aa432631 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -479,6 +479,12 @@ struct ast_type_qualifier {
unsigned pixel_center_integer:1;
/*@}*/
+ /**
+ * Flag set if GL_ARB_enhanced_layouts "align" layout qualifier is
+ * used.
+ */
+ unsigned explicit_align:1;
+
/**
* Flag set if GL_ARB_explicit_attrib_location "location" layout
* qualifier is used.
@@ -577,6 +583,11 @@ struct ast_type_qualifier {
/** Precision of the type (highp/medium/lowp). */
unsigned precision:2;
+ /**
+ * Alignment specified via GL_ARB_enhanced_layouts "align" layout qualifier
+ */
+ ast_expression *align;
+
/** Geometry shader invocations for GL_ARB_gpu_shader5. */
ast_layout_expression *invocations;
diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index 6b446a1d272..07ed4f2356c 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -73,6 +73,7 @@ ast_type_qualifier::has_layout() const
|| this->flags.q.column_major
|| this->flags.q.row_major
|| this->flags.q.packed
+ || this->flags.q.explicit_align
|| this->flags.q.explicit_location
|| this->flags.q.explicit_image_format
|| this->flags.q.explicit_index
@@ -287,6 +288,9 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
return false;
}
+ if (q.flags.q.explicit_align)
+ this->align = q.align;
+
if (q.flags.q.explicit_location)
this->location = q.location;
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 2fb0da1f8c0..3c4f0c728dc 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -1468,6 +1468,17 @@ layout_qualifier_id:
"GLSL 4.40 or ARB_enhanced_layouts");
}
+ if (match_layout_qualifier("align", $1, state) == 0) {
+ if (!state->has_enhanced_layouts()) {
+ _mesa_glsl_error(& @1, state,
+ "align qualifier requires "
+ "GLSL 4.40 or ARB_enhanced_layouts");
+ } else {
+ $$.flags.q.explicit_align = 1;
+ $$.align = $3;
+ }
+ }
+
if (match_layout_qualifier("location", $1, state) == 0) {
$$.flags.q.explicit_location = 1;