summaryrefslogtreecommitdiff
path: root/src/glsl/glsl_parser_extras.h
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-07-18 15:59:43 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-07-20 17:48:24 -0700
commit2462a536ea5c98867296905e3da127eba7c7bdff (patch)
tree661139c92c86bda4966b6365cd95820650fc52ef /src/glsl/glsl_parser_extras.h
parent7e2aa91507a5883e33473e0a94215ee3985baad1 (diff)
glsl2: Add a constructor for _mesa_glsl_parse_state
Coming changes to the handling of built-in functions necessitate this.
Diffstat (limited to 'src/glsl/glsl_parser_extras.h')
-rw-r--r--src/glsl/glsl_parser_extras.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index fed6e8c823..e2efbd9ac9 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -35,7 +35,29 @@ enum _mesa_glsl_parser_targets {
ir_shader
};
+struct __GLcontextRec;
+
struct _mesa_glsl_parse_state {
+ _mesa_glsl_parse_state(struct __GLcontextRec *ctx, GLenum target,
+ void *mem_ctx);
+
+ /* Callers of this talloc-based new need not call delete. It's
+ * easier to just talloc_free 'ctx' (or any of its ancestors). */
+ static void* operator new(size_t size, void *ctx)
+ {
+ void *mem = talloc_zero_size(ctx, size);
+ assert(mem != NULL);
+
+ return mem;
+ }
+
+ /* If the user *does* call delete, that's OK, we will just
+ * talloc_free in that case. */
+ static void operator delete(void *mem)
+ {
+ talloc_free(mem);
+ }
+
void *scanner;
exec_list translation_unit;
glsl_symbol_table *symbols;