summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_type.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2016-01-18 19:13:03 +1100
committerTimothy Arceri <timothy.arceri@collabora.com>2016-01-20 08:06:40 +1100
commita0a93470e3413d5a5890d988462bb898362bd68f (patch)
tree3f3ceaed0b0f5fae7cfedb6f41c9c3914cb101a6 /src/glsl/ast_type.cpp
parentfd612e4547175d1350eac2d8374d01390de58acb (diff)
downloadexternal_mesa3d-a0a93470e3413d5a5890d988462bb898362bd68f.zip
external_mesa3d-a0a93470e3413d5a5890d988462bb898362bd68f.tar.gz
external_mesa3d-a0a93470e3413d5a5890d988462bb898362bd68f.tar.bz2
glsl: move default layout qualifier rules out of the parser
Acked-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Diffstat (limited to 'src/glsl/ast_type.cpp')
-rw-r--r--src/glsl/ast_type.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
index 4e75016..e59d1b2 100644
--- a/src/glsl/ast_type.cpp
+++ b/src/glsl/ast_type.cpp
@@ -296,8 +296,28 @@ ast_type_qualifier::merge_out_qualifier(YYLTYPE *loc,
void *mem_ctx = state;
const bool r = this->merge_qualifier(loc, state, q);
- if (state->stage == MESA_SHADER_TESS_CTRL) {
+ if (state->stage == MESA_SHADER_GEOMETRY) {
+ if (q.flags.q.prim_type) {
+ /* Make sure this is a valid output primitive type. */
+ switch (q.prim_type) {
+ case GL_POINTS:
+ case GL_LINE_STRIP:
+ case GL_TRIANGLE_STRIP:
+ break;
+ default:
+ _mesa_glsl_error(loc, state, "invalid geometry shader output "
+ "primitive type");
+ break;
+ }
+ }
+
+ /* Allow future assigments of global out's stream id value */
+ this->flags.q.explicit_stream = 0;
+ } else if (state->stage == MESA_SHADER_TESS_CTRL) {
node = new(mem_ctx) ast_tcs_output_layout(*loc);
+ } else {
+ _mesa_glsl_error(loc, state, "out layout qualifiers only valid in "
+ "tessellation control or geometry shaders");
}
return r;