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 <stereotype441@gmail.com>): 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 <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Eric Anholt
2013-06-12 14:03:49 -07:00
committed by Paul Berry
parent f2e14238a7
commit 624b7bac76
6 changed files with 177 additions and 1 deletions

View File

@@ -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