mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 02:40:11 +01:00
glsl2: Free the shader compiler at dri screen destruction.
Hooray, we can valgrind again without adding suppressions. This also adds an interface for use by an implementation of glReleaseShaderCompiler().
This commit is contained in:
parent
3cd233eb57
commit
b83846475b
3 changed files with 35 additions and 0 deletions
|
|
@ -741,3 +741,33 @@ do_common_optimization(exec_list *ir, bool linked)
|
|||
|
||||
return progress;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
/**
|
||||
* To be called at GL teardown time, this frees compiler datastructures.
|
||||
*
|
||||
* After calling this, any previously compiled shaders and shader
|
||||
* programs would be invalid. So this should happen at approximately
|
||||
* program exit.
|
||||
*/
|
||||
void
|
||||
_mesa_destroy_shader_compiler(void)
|
||||
{
|
||||
_mesa_destroy_shader_compiler_caches();
|
||||
|
||||
_mesa_glsl_release_types();
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases compiler caches to trade off performance for memory.
|
||||
*
|
||||
* Intended to be used with glReleaseShaderCompiler().
|
||||
*/
|
||||
void
|
||||
_mesa_destroy_shader_compiler_caches(void)
|
||||
{
|
||||
_mesa_glsl_release_functions();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,6 +178,9 @@ extern void _mesa_glsl_warning(const YYLTYPE *locp,
|
|||
extern "C" {
|
||||
extern int preprocess(void *ctx, const char **shader, char **info_log,
|
||||
const struct gl_extensions *extensions);
|
||||
|
||||
extern void _mesa_destroy_shader_compiler();
|
||||
extern void _mesa_destroy_shader_compiler_caches();
|
||||
}
|
||||
|
||||
extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state,
|
||||
|
|
|
|||
|
|
@ -707,6 +707,8 @@ static void driDestroyScreen(__DRIscreen *psp)
|
|||
* stream open to the X-server anymore.
|
||||
*/
|
||||
|
||||
_mesa_destroy_shader_compiler();
|
||||
|
||||
if (psp->DriverAPI.DestroyScreen)
|
||||
(*psp->DriverAPI.DestroyScreen)(psp);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue