summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-06-22 13:36:35 -0700
committerEric Anholt <[email protected]>2012-07-31 12:06:20 -0700
commit551bdf25bc4e57bea51c54da7e31c44c507e6c9f (patch)
tree30fe843355b1f850c0ce0772b605b65f1e03dd46 /src/glsl/ast.h
parent7b77c64254109ff1d59a8937f8f15216c10c8cb7 (diff)
glsl: Add support for default layout qualifiers for uniforms.
I ended up having to add rallocing of the ast_type_qualifier in order to avoid pulling in ast.h for glsl_parser_extras.h, because I wanted to track an ast_type_qualifier in the state. Fixes piglit ARB_uniform_buffer_object/row-major. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/ast.h')
-rw-r--r--src/glsl/ast.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/glsl/ast.h b/src/glsl/ast.h
index de3f2dfeb0b..50747822d2a 100644
--- a/src/glsl/ast.h
+++ b/src/glsl/ast.h
@@ -338,6 +338,25 @@ enum {
};
struct ast_type_qualifier {
+ /* 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 = rzalloc_size(ctx, size);
+ assert(node != NULL);
+
+ return node;
+ }
+
+ /* If the user *does* call delete, that's OK, we will just
+ * ralloc_free in that case. */
+ static void operator delete(void *table)
+ {
+ ralloc_free(table);
+ }
+
union {
struct {
unsigned invariant:1;
@@ -424,6 +443,10 @@ struct ast_type_qualifier {
* returned string is undefined but not null.
*/
const char *interpolation_string() const;
+
+ bool merge_qualifier(YYLTYPE *loc,
+ _mesa_glsl_parse_state *state,
+ ast_type_qualifier q);
};
class ast_declarator_list;