aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/glsl')
-rwxr-xr-xmesalib/src/glsl/ast.h12
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp19
-rwxr-xr-xmesalib/src/glsl/glsl_parser_extras.h2
-rw-r--r--mesalib/src/glsl/ralloc.h26
4 files changed, 39 insertions, 20 deletions
diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h
index 242ee4883..2307a7878 100755
--- a/mesalib/src/glsl/ast.h
+++ b/mesalib/src/glsl/ast.h
@@ -49,7 +49,7 @@ struct YYLTYPE;
*/
class ast_node {
public:
- DECLARE_RZALLOC_CXX_OPERATORS(ast_node);
+ DECLARE_RALLOC_CXX_OPERATORS(ast_node);
static void operator delete(void *table, void *ctx)
{
ralloc_free(table);
@@ -350,7 +350,7 @@ enum {
};
struct ast_type_qualifier {
- DECLARE_RZALLOC_CXX_OPERATORS(ast_type_qualifier);
+ DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier);
union {
struct {
@@ -580,6 +580,10 @@ public:
virtual void print(void) const;
bool has_qualifiers() const;
+ ast_fully_specified_type() : qualifier(), specifier(NULL)
+ {
+ }
+
const struct glsl_type *glsl_type(const char **name,
struct _mesa_glsl_parse_state *state)
const;
@@ -863,6 +867,10 @@ public:
class ast_function_definition : public ast_node {
public:
+ ast_function_definition() : prototype(NULL), body(NULL)
+ {
+ }
+
virtual void print(void) const;
virtual ir_rvalue *hir(exec_list *instructions,
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index e9922fc14..4f2f2893a 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -55,7 +55,7 @@ static unsigned known_desktop_glsl_versions[] =
_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
GLenum target, void *mem_ctx)
- : ctx(_ctx)
+ : ctx(_ctx), switch_state()
{
switch (target) {
case GL_VERTEX_SHADER: this->target = vertex_shader; break;
@@ -66,10 +66,14 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->scanner = NULL;
this->translation_unit.make_empty();
this->symbols = new(mem_ctx) glsl_symbol_table;
+
+ this->num_uniform_blocks = 0;
+ this->uniform_block_array_size = 0;
+ this->uniform_blocks = NULL;
+
this->info_log = ralloc_strdup(mem_ctx, "");
this->error = false;
this->loop_nesting_ast = NULL;
- this->switch_state.switch_nesting_ast = NULL;
this->struct_specifier_depth = 0;
this->num_builtins_to_link = 0;
@@ -105,6 +109,13 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
+ this->current_function = NULL;
+ this->toplevel_ir = NULL;
+ this->found_return = false;
+ this->all_invariant = false;
+ this->user_structures = NULL;
+ this->num_user_structures = 0;
+
/* Populate the list of supported GLSL versions */
/* FINISHME: Once the OpenGL 3.0 'forward compatible' context or
* the OpenGL 3.2 Core context is supported, this logic will need
@@ -163,6 +174,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->gs_input_prim_type_specified = false;
this->gs_input_prim_type = GL_POINTS;
+ this->gs_input_size = 0;
this->out_qualifier = new(this) ast_type_qualifier();
}
@@ -1038,7 +1050,8 @@ ast_expression::print(void) const
ast_expression::ast_expression(int oper,
ast_expression *ex0,
ast_expression *ex1,
- ast_expression *ex2)
+ ast_expression *ex2) :
+ primary_expression()
{
this->oper = ast_operators(oper);
this->subexpressions[0] = ex0;
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index 3a228fde7..4833436a3 100755
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -73,7 +73,7 @@ struct _mesa_glsl_parse_state {
_mesa_glsl_parse_state(struct gl_context *_ctx, GLenum target,
void *mem_ctx);
- DECLARE_RZALLOC_CXX_OPERATORS(_mesa_glsl_parse_state);
+ DECLARE_RALLOC_CXX_OPERATORS(_mesa_glsl_parse_state);
static void operator delete(void *mem, void *ctx)
{
ralloc_free(mem);
diff --git a/mesalib/src/glsl/ralloc.h b/mesalib/src/glsl/ralloc.h
index 799d3a9b8..31682d515 100644
--- a/mesalib/src/glsl/ralloc.h
+++ b/mesalib/src/glsl/ralloc.h
@@ -404,10 +404,20 @@ bool ralloc_vasprintf_append(char **str, const char *fmt, va_list args);
} /* end of extern "C" */
#endif
-#define _RALLOC_OPS(ALLOC, TYPE) \
+/**
+ * Declare C++ new and delete operators which use ralloc.
+ *
+ * Placing this macro in the body of a class makes it possible to do:
+ *
+ * TYPE *var = new(mem_ctx) TYPE(...);
+ * delete var;
+ *
+ * which is more idiomatic in C++ than calling ralloc.
+ */
+#define DECLARE_RALLOC_CXX_OPERATORS(TYPE) \
static void* operator new(size_t size, void *mem_ctx) \
{ \
- void *p = ALLOC(mem_ctx, size); \
+ void *p = ralloc_size(mem_ctx, size); \
assert(p != NULL); \
return p; \
} \
@@ -417,17 +427,5 @@ bool ralloc_vasprintf_append(char **str, const char *fmt, va_list args);
ralloc_free(p); \
}
-/**
- * Declare C++ new and delete operators which use ralloc.
- *
- * Placing one of these macros in the body of a class makes it possible to do:
- *
- * TYPE *var = new(mem_ctx) TYPE(...);
- * delete var;
- *
- * which is more idiomatic in C++ than calling ralloc or rzalloc.
- */
-#define DECLARE_RALLOC_CXX_OPERATORS(TYPE) _RALLOC_OPS(ralloc_size, TYPE)
-#define DECLARE_RZALLOC_CXX_OPERATORS(TYPE) _RALLOC_OPS(rzalloc_size, TYPE)
#endif