diff options
author | marha <marha@users.sourceforge.net> | 2013-07-12 08:25:37 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-07-12 08:25:37 +0200 |
commit | 66b46719d55e60d53b42858770d6ac40d079ab13 (patch) | |
tree | aad06d011ed8b820685f72ada34e56ee0f2580c6 /mesalib/src/glsl/ast.h | |
parent | f8f0209a691e0d0838d1ef9d602ebacafee2a233 (diff) | |
parent | ffce4319c2fb6f4f663cc5a9660e1d5837fcde87 (diff) | |
download | vcxsrv-66b46719d55e60d53b42858770d6ac40d079ab13.tar.gz vcxsrv-66b46719d55e60d53b42858770d6ac40d079ab13.tar.bz2 vcxsrv-66b46719d55e60d53b42858770d6ac40d079ab13.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
libxtrans fontconfig mesa xserver git update 12 Jul 2013
Diffstat (limited to 'mesalib/src/glsl/ast.h')
-rw-r--r-- | mesalib/src/glsl/ast.h | 70 |
1 files changed, 65 insertions, 5 deletions
diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h index f73265bf3..ff4bb0d6a 100644 --- a/mesalib/src/glsl/ast.h +++ b/mesalib/src/glsl/ast.h @@ -193,7 +193,8 @@ enum ast_operators { ast_float_constant, ast_bool_constant, - ast_sequence + ast_sequence, + ast_aggregate }; /** @@ -296,6 +297,29 @@ private: bool cons; }; +/** + * C-style aggregate initialization class + * + * Represents C-style initializers of vectors, matrices, arrays, and + * structures. E.g., vec3 pos = {1.0, 0.0, -1.0} is equivalent to + * vec3 pos = vec3(1.0, 0.0, -1.0). + * + * Specified in GLSL 4.20 and GL_ARB_shading_language_420pack. + * + * \sa _mesa_ast_set_aggregate_type + */ +class ast_aggregate_initializer : public ast_expression { +public: + ast_aggregate_initializer() + : ast_expression(ast_aggregate, NULL, NULL, NULL) + { + /* empty */ + } + + ast_type_specifier *constructor_type; + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); +}; /** * Number of possible operators for an ast_expression @@ -321,13 +345,13 @@ public: class ast_declaration : public ast_node { public: - ast_declaration(const char *identifier, int is_array, ast_expression *array_size, + ast_declaration(const char *identifier, bool is_array, ast_expression *array_size, ast_expression *initializer); virtual void print(void) const; const char *identifier; - int is_array; + bool is_array; ast_expression *array_size; ast_expression *initializer; @@ -457,6 +481,19 @@ class ast_declarator_list; class ast_struct_specifier : public ast_node { public: + /** + * \brief Make a shallow copy of an ast_struct_specifier. + * + * Use only if the objects are allocated from the same context and will not + * be modified. Zeros the inherited ast_node's fields. + */ + ast_struct_specifier(const ast_struct_specifier& that): + ast_node(), name(that.name), declarations(that.declarations), + is_declaration(that.is_declaration) + { + /* empty */ + } + ast_struct_specifier(const char *identifier, ast_declarator_list *declarator_list); virtual void print(void) const; @@ -467,12 +504,29 @@ public: const char *name; /* List of ast_declarator_list * */ exec_list declarations; + bool is_declaration; }; class ast_type_specifier : public ast_node { public: + /** + * \brief Make a shallow copy of an ast_type_specifier, specifying array + * fields. + * + * Use only if the objects are allocated from the same context and will not + * be modified. Zeros the inherited ast_node's fields. + */ + ast_type_specifier(const ast_type_specifier *that, bool is_array, + ast_expression *array_size) + : ast_node(), type_name(that->type_name), structure(that->structure), + is_array(is_array), array_size(array_size), precision(that->precision), + is_precision_statement(that->is_precision_statement) + { + /* empty */ + } + /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) : type_name(name), structure(NULL), @@ -502,7 +556,7 @@ public: const char *type_name; ast_struct_specifier *structure; - int is_array; + bool is_array; ast_expression *array_size; unsigned precision:2; @@ -530,6 +584,7 @@ public: struct _mesa_glsl_parse_state *state); ast_fully_specified_type *type; + /** List of 'ast_declaration *' */ exec_list declarations; /** @@ -569,7 +624,7 @@ public: ast_fully_specified_type *type; const char *identifier; - int is_array; + bool is_array; ast_expression *array_size; static void parameters_to_hir(exec_list *ast_parameters, @@ -864,6 +919,11 @@ _mesa_ast_array_index_to_hir(void *mem_ctx, ir_rvalue *array, ir_rvalue *idx, YYLTYPE &loc, YYLTYPE &idx_loc); +extern void +_mesa_ast_set_aggregate_type(const ast_type_specifier *type, + ast_expression *expr, + _mesa_glsl_parse_state *state); + void emit_function(_mesa_glsl_parse_state *state, ir_function *f); |