summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2010-06-28 13:17:18 -0700
committerIan Romanick <[email protected]>2010-06-29 11:15:40 -0700
commitefc15f862b08a9f035c06a79bc43848cca740372 (patch)
treef9a1b08c4292a41aad190b5de134743468c0c127 /src
parente1374d48ded09dba576f5a2b86c3d11984d1f7c4 (diff)
glsl_type: Add _mesa_glsl_release_types to release all type related storage
Diffstat (limited to 'src')
-rw-r--r--src/glsl/glsl_types.cpp20
-rw-r--r--src/glsl/glsl_types.h14
-rw-r--r--src/glsl/main.cpp1
3 files changed, 33 insertions, 2 deletions
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 0d807fbc3dc..806b71495de 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -195,6 +195,26 @@ const glsl_type *glsl_type::get_base_type() const
}
+void
+_mesa_glsl_release_types(void)
+{
+ if (glsl_type::array_types != NULL) {
+ hash_table_dtor(glsl_type::array_types);
+ glsl_type::array_types = NULL;
+ }
+
+ if (glsl_type::record_types != NULL) {
+ hash_table_dtor(glsl_type::record_types);
+ glsl_type::record_types = NULL;
+ }
+
+ if (glsl_type::ctx != NULL) {
+ talloc_free(glsl_type::ctx);
+ glsl_type::ctx = NULL;
+ }
+}
+
+
ir_function *
glsl_type::generate_constructor(glsl_symbol_table *symtab) const
{
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 1147d38ca64..e869071cab0 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -39,6 +39,9 @@ struct _mesa_glsl_parse_state;
extern "C" void
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state);
+extern "C" void
+_mesa_glsl_release_types(void);
+
#define GLSL_TYPE_UINT 0
#define GLSL_TYPE_INT 1
#define GLSL_TYPE_FLOAT 2
@@ -455,11 +458,18 @@ private:
bool);
static void generate_EXT_texture_array_types(class glsl_symbol_table *,
bool);
+ /*@}*/
+
/**
- * This function is a friend because it needs to call the various
- * generate_*_types functions and it has C linkage.
+ * \name Friend functions.
+ *
+ * These functions are friends because they must have C linkage and the
+ * need to call various private methods or access various private static
+ * data.
*/
+ /*@{*/
friend void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *);
+ friend void _mesa_glsl_release_types(void);
/*@}*/
};
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 16b2cf84c53..342cf988404 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -258,6 +258,7 @@ main(int argc, char **argv)
}
talloc_free(whole_program);
+ _mesa_glsl_release_types();
return status;
}