summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp20
-rw-r--r--src/compiler/glsl/glsl_parser_extras.h2
-rw-r--r--src/compiler/glsl/standalone.cpp3
3 files changed, 22 insertions, 3 deletions
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index 0ffad2d25a0..b30c638cdc9 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -2325,6 +2325,24 @@ do_common_optimization(exec_list *ir, bool linked,
extern "C" {
/**
+ * To be called at GL context ctor.
+ */
+void
+_mesa_init_shader_compiler_types(void)
+{
+ glsl_type_singleton_init_or_ref();
+}
+
+/**
+ * To be called at GL context dtor.
+ */
+void
+_mesa_destroy_shader_compiler_types(void)
+{
+ glsl_type_singleton_decref();
+}
+
+/**
* To be called at GL teardown time, this frees compiler datastructures.
*
* After calling this, any previously compiled shaders and shader
@@ -2335,8 +2353,6 @@ void
_mesa_destroy_shader_compiler(void)
{
_mesa_destroy_shader_compiler_caches();
-
- _mesa_glsl_release_types();
}
/**
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index 8646ba6cadd..f92d2160aac 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -1010,6 +1010,8 @@ extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
struct _mesa_glsl_parse_state *state,
struct gl_context *gl_ctx);
+extern void _mesa_init_shader_compiler_types(void);
+extern void _mesa_destroy_shader_compiler_types(void);
extern void _mesa_destroy_shader_compiler(void);
extern void _mesa_destroy_shader_compiler_caches(void);
diff --git a/src/compiler/glsl/standalone.cpp b/src/compiler/glsl/standalone.cpp
index 942b9ee4986..7b3d358ca96 100644
--- a/src/compiler/glsl/standalone.cpp
+++ b/src/compiler/glsl/standalone.cpp
@@ -132,6 +132,7 @@ static void
initialize_context(struct gl_context *ctx, gl_api api)
{
initialize_context_to_defaults(ctx, api);
+ glsl_type_singleton_init_or_ref();
/* The standalone compiler needs to claim support for almost
* everything in order to compile the built-in functions.
@@ -617,6 +618,6 @@ standalone_compiler_cleanup(struct gl_shader_program *whole_program)
delete whole_program->FragDataIndexBindings;
ralloc_free(whole_program);
- _mesa_glsl_release_types();
+ glsl_type_singleton_decref();
_mesa_glsl_release_builtin_functions();
}