From 624b7bac76c3f70a3a110d114a3c1c327d3dad5f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 12 Jun 2013 14:03:49 -0700 Subject: glsl: Parse the GLSL 1.50 GS layout qualifiers. Limited semantic checking (compatibility between declarations, checking that they're in the right shader target, etc.) is done. v2: Remove stray debug printfs. v3 (Paul Berry ): Process input layout qualifiers at ast_to_hir time rather than at parse time, since certain error conditions depend on the relative ordering between input layout qualifiers, declarations, and calls to .length(). Reviewed-by: Ian Romanick Reviewed-by: Kenneth Graunke --- src/glsl/ast.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/glsl/ast.h') diff --git a/src/glsl/ast.h b/src/glsl/ast.h index d98f1a3..3ef9913 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -435,6 +435,12 @@ struct ast_type_qualifier { unsigned column_major:1; unsigned row_major:1; /** \} */ + + /** \name Layout qualifiers for GLSL 1.50 geometry shaders */ + /** \{ */ + unsigned prim_type:1; + unsigned max_vertices:1; + /** \} */ } /** \brief Set of flags, accessed by name. */ q; @@ -461,6 +467,12 @@ struct ast_type_qualifier { */ int index; + /** Maximum output vertices in GLSL 1.50 geometry shaders. */ + int max_vertices; + + /** Input or output primitive type in GLSL 1.50 geometry shaders */ + GLenum prim_type; + /** * Binding specified via GL_ARB_shading_language_420pack's "binding" keyword. * @@ -931,6 +943,28 @@ public: */ ast_expression *array_size; }; + + +/** + * AST node representing a declaration of the input layout for geometry + * shaders. + */ +class ast_gs_input_layout : public ast_node +{ +public: + ast_gs_input_layout(const struct YYLTYPE &locp, GLenum prim_type) + : prim_type(prim_type) + { + set_location(locp); + } + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +private: + const GLenum prim_type; +}; + /*@}*/ extern void -- cgit v1.1