diff options
Diffstat (limited to 'src/glsl/ast.h')
-rw-r--r-- | src/glsl/ast.h | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 1420f234b6..878f48b207 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -49,23 +49,23 @@ struct YYLTYPE; */ class ast_node { public: - /* Callers of this talloc-based new need not call delete. It's - * easier to just talloc_free 'ctx' (or any of its ancestors). */ + /* Callers of this ralloc-based new need not call delete. It's + * easier to just ralloc_free 'ctx' (or any of its ancestors). */ static void* operator new(size_t size, void *ctx) { void *node; - node = talloc_zero_size(ctx, size); + node = rzalloc_size(ctx, size); assert(node != NULL); return node; } /* If the user *does* call delete, that's OK, we will just - * talloc_free in that case. */ + * ralloc_free in that case. */ static void operator delete(void *table) { - talloc_free(table); + ralloc_free(table); } /** @@ -129,7 +129,6 @@ protected: * be created. */ ast_node(void); - virtual ~ast_node() {} }; @@ -319,7 +318,8 @@ public: enum { - ast_precision_high = 0, /**< Default precision. */ + ast_precision_none = 0, /**< Absence of precision qualifier. */ + ast_precision_high, ast_precision_medium, ast_precision_low }; @@ -350,7 +350,19 @@ struct ast_type_qualifier { * qualifier is used. */ unsigned explicit_location:1; - } q; + + /** \name Layout qualifiers for GL_AMD_conservative_depth */ + /** \{ */ + unsigned depth_any:1; + unsigned depth_greater:1; + unsigned depth_less:1; + unsigned depth_unchanged:1; + /** \} */ + } + /** \brief Set of flags, accessed by name. */ + q; + + /** \brief Set of flags, accessed as a bitmask. */ unsigned i; } flags; @@ -361,6 +373,23 @@ struct ast_type_qualifier { * This field is only valid if \c explicit_location is set. */ unsigned location; + + /** + * Return true if and only if an interpolation qualifier is present. + */ + bool has_interpolation() const; + + /** + * \brief Return string representation of interpolation qualifier. + * + * If an interpolation qualifier is present, then return that qualifier's + * string representation. Otherwise, return null. For example, if the + * noperspective bit is set, then this returns "noperspective". + * + * If multiple interpolation qualifiers are somehow present, then the + * returned string is undefined but not null. + */ + const char *interpolation_string() const; }; class ast_struct_specifier : public ast_node { @@ -441,7 +470,8 @@ public: /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) : type_specifier(ast_type_name), type_name(name), structure(NULL), - is_array(false), array_size(NULL), precision(ast_precision_high) + is_array(false), array_size(NULL), precision(ast_precision_none), + is_precision_statement(false) { /* empty */ } @@ -449,7 +479,8 @@ public: /** Construct a type specifier from a structure definition */ ast_type_specifier(ast_struct_specifier *s) : type_specifier(ast_struct), type_name(s->name), structure(s), - is_array(false), array_size(NULL), precision(ast_precision_high) + is_array(false), array_size(NULL), precision(ast_precision_none), + is_precision_statement(false) { /* empty */ } @@ -471,6 +502,8 @@ public: ast_expression *array_size; unsigned precision:2; + + bool is_precision_statement; }; @@ -581,25 +614,6 @@ private: }; -class ast_declaration_statement : public ast_node { -public: - ast_declaration_statement(void); - - enum { - ast_function, - ast_declaration, - ast_precision - } mode; - - union { - class ast_function *function; - ast_declarator_list *declarator; - ast_type_specifier *type; - ast_node *node; - } declaration; -}; - - class ast_expression_statement : public ast_node { public: ast_expression_statement(ast_expression *); |