2 * Copyright © 2008, 2009 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
29 #include "main/core.h" /* for struct gl_context */
34 #include "glsl_parser_extras.h"
35 #include "glsl_parser.h"
36 #include "ir_optimization.h"
37 #include "loop_analysis.h"
39 _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context
*ctx
,
40 GLenum target
, void *mem_ctx
)
43 case GL_VERTEX_SHADER
: this->target
= vertex_shader
; break;
44 case GL_FRAGMENT_SHADER
: this->target
= fragment_shader
; break;
45 case GL_GEOMETRY_SHADER
: this->target
= geometry_shader
; break;
49 this->translation_unit
.make_empty();
50 this->symbols
= new(mem_ctx
) glsl_symbol_table
;
51 this->info_log
= ralloc_strdup(mem_ctx
, "");
53 this->loop_nesting_ast
= NULL
;
54 this->switch_state
.switch_nesting_ast
= NULL
;
56 this->num_builtins_to_link
= 0;
58 /* Set default language version and extensions */
59 this->language_version
= 110;
60 this->es_shader
= false;
61 this->ARB_texture_rectangle_enable
= true;
63 /* OpenGL ES 2.0 has different defaults from desktop GL. */
64 if (ctx
->API
== API_OPENGLES2
) {
65 this->language_version
= 100;
66 this->es_shader
= true;
67 this->ARB_texture_rectangle_enable
= false;
70 this->extensions
= &ctx
->Extensions
;
72 this->Const
.MaxLights
= ctx
->Const
.MaxLights
;
73 this->Const
.MaxClipPlanes
= ctx
->Const
.MaxClipPlanes
;
74 this->Const
.MaxTextureUnits
= ctx
->Const
.MaxTextureUnits
;
75 this->Const
.MaxTextureCoords
= ctx
->Const
.MaxTextureCoordUnits
;
76 this->Const
.MaxVertexAttribs
= ctx
->Const
.VertexProgram
.MaxAttribs
;
77 this->Const
.MaxVertexUniformComponents
= ctx
->Const
.VertexProgram
.MaxUniformComponents
;
78 this->Const
.MaxVaryingFloats
= ctx
->Const
.MaxVarying
* 4;
79 this->Const
.MaxVertexTextureImageUnits
= ctx
->Const
.MaxVertexTextureImageUnits
;
80 this->Const
.MaxCombinedTextureImageUnits
= ctx
->Const
.MaxCombinedTextureImageUnits
;
81 this->Const
.MaxTextureImageUnits
= ctx
->Const
.MaxTextureImageUnits
;
82 this->Const
.MaxFragmentUniformComponents
= ctx
->Const
.FragmentProgram
.MaxUniformComponents
;
84 this->Const
.MaxDrawBuffers
= ctx
->Const
.MaxDrawBuffers
;
86 /* Note: Once the OpenGL 3.0 'forward compatible' context or the OpenGL 3.2
87 * Core context is supported, this logic will need change. Older versions of
88 * GLSL are no longer supported outside the compatibility contexts of 3.x.
90 this->Const
.GLSL_100ES
= (ctx
->API
== API_OPENGLES2
)
91 || ctx
->Extensions
.ARB_ES2_compatibility
;
92 this->Const
.GLSL_110
= (ctx
->API
== API_OPENGL
);
93 this->Const
.GLSL_120
= (ctx
->API
== API_OPENGL
)
94 && (ctx
->Const
.GLSLVersion
>= 120);
95 this->Const
.GLSL_130
= (ctx
->API
== API_OPENGL
)
96 && (ctx
->Const
.GLSLVersion
>= 130);
98 const unsigned lowest_version
=
99 (ctx
->API
== API_OPENGLES2
) || ctx
->Extensions
.ARB_ES2_compatibility
101 const unsigned highest_version
=
102 (ctx
->API
== API_OPENGL
) ? ctx
->Const
.GLSLVersion
: 100;
103 char *supported
= ralloc_strdup(this, "");
105 for (unsigned ver
= lowest_version
; ver
<= highest_version
; ver
+= 10) {
106 const char *const prefix
= (ver
== lowest_version
)
108 : ((ver
== highest_version
) ? ", and " : ", ");
110 ralloc_asprintf_append(& supported
, "%s%d.%02d%s",
112 ver
/ 100, ver
% 100,
113 (ver
== 100) ? " ES" : "");
116 this->supported_version_string
= supported
;
118 if (ctx
->Const
.ForceGLSLExtensionsWarn
)
119 _mesa_glsl_process_extension("all", NULL
, "warn", NULL
, this);
123 _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target
)
126 case vertex_shader
: return "vertex";
127 case fragment_shader
: return "fragment";
128 case geometry_shader
: return "geometry";
131 assert(!"Should not get here.");
137 _mesa_glsl_error(YYLTYPE
*locp
, _mesa_glsl_parse_state
*state
,
138 const char *fmt
, ...)
144 assert(state
->info_log
!= NULL
);
145 ralloc_asprintf_append(&state
->info_log
, "%u:%u(%u): error: ",
150 ralloc_vasprintf_append(&state
->info_log
, fmt
, ap
);
152 ralloc_strcat(&state
->info_log
, "\n");
157 _mesa_glsl_warning(const YYLTYPE
*locp
, _mesa_glsl_parse_state
*state
,
158 const char *fmt
, ...)
162 assert(state
->info_log
!= NULL
);
163 ralloc_asprintf_append(&state
->info_log
, "%u:%u(%u): warning: ",
168 ralloc_vasprintf_append(&state
->info_log
, fmt
, ap
);
170 ralloc_strcat(&state
->info_log
, "\n");
175 * Enum representing the possible behaviors that can be specified in
176 * an #extension directive.
186 * Element type for _mesa_glsl_supported_extensions
188 struct _mesa_glsl_extension
{
190 * Name of the extension when referred to in a GLSL extension
195 /** True if this extension is available to vertex shaders */
198 /** True if this extension is available to geometry shaders */
201 /** True if this extension is available to fragment shaders */
204 /** True if this extension is available to desktop GL shaders */
207 /** True if this extension is available to GLES shaders */
211 * Flag in the gl_extensions struct indicating whether this
212 * extension is supported by the driver, or
213 * &gl_extensions::dummy_true if supported by all drivers.
215 * Note: the type (GLboolean gl_extensions::*) is a "pointer to
216 * member" type, the type-safe alternative to the "offsetof" macro.
219 * - foo bar::* p declares p to be an "offset" to a field of type
220 * foo that exists within struct bar
221 * - &bar::baz computes the "offset" of field baz within struct bar
222 * - x.*p accesses the field of x that exists at "offset" p
223 * - x->*p is equivalent to (*x).*p
225 const GLboolean
gl_extensions::* supported_flag
;
228 * Flag in the _mesa_glsl_parse_state struct that should be set
229 * when this extension is enabled.
231 * See note in _mesa_glsl_extension::supported_flag about "pointer
234 bool _mesa_glsl_parse_state::* enable_flag
;
237 * Flag in the _mesa_glsl_parse_state struct that should be set
238 * when the shader requests "warn" behavior for this extension.
240 * See note in _mesa_glsl_extension::supported_flag about "pointer
243 bool _mesa_glsl_parse_state::* warn_flag
;
246 bool compatible_with_state(const _mesa_glsl_parse_state
*state
) const;
247 void set_flags(_mesa_glsl_parse_state
*state
, ext_behavior behavior
) const;
250 #define EXT(NAME, VS, GS, FS, GL, ES, SUPPORTED_FLAG) \
251 { "GL_" #NAME, VS, GS, FS, GL, ES, &gl_extensions::SUPPORTED_FLAG, \
252 &_mesa_glsl_parse_state::NAME##_enable, \
253 &_mesa_glsl_parse_state::NAME##_warn }
256 * Table of extensions that can be enabled/disabled within a shader,
257 * and the conditions under which they are supported.
259 static const _mesa_glsl_extension _mesa_glsl_supported_extensions
[] = {
260 /* target availability API availability */
261 /* name VS GS FS GL ES supported flag */
262 EXT(ARB_conservative_depth
, false, false, true, true, false, ARB_conservative_depth
),
263 EXT(ARB_draw_buffers
, false, false, true, true, false, dummy_true
),
264 EXT(ARB_draw_instanced
, true, false, false, true, false, ARB_draw_instanced
),
265 EXT(ARB_explicit_attrib_location
, true, false, true, true, false, ARB_explicit_attrib_location
),
266 EXT(ARB_fragment_coord_conventions
, true, false, true, true, false, ARB_fragment_coord_conventions
),
267 EXT(ARB_texture_rectangle
, true, false, true, true, false, dummy_true
),
268 EXT(EXT_texture_array
, true, false, true, true, false, EXT_texture_array
),
269 EXT(ARB_shader_texture_lod
, true, false, true, true, false, ARB_shader_texture_lod
),
270 EXT(ARB_shader_stencil_export
, false, false, true, true, false, ARB_shader_stencil_export
),
271 EXT(AMD_conservative_depth
, false, false, true, true, false, ARB_conservative_depth
),
272 EXT(AMD_shader_stencil_export
, false, false, true, true, false, ARB_shader_stencil_export
),
273 EXT(OES_texture_3D
, true, false, true, false, true, EXT_texture3D
),
274 EXT(OES_EGL_image_external
, true, false, true, false, true, OES_EGL_image_external
),
281 * Determine whether a given extension is compatible with the target,
282 * API, and extension information in the current parser state.
284 bool _mesa_glsl_extension::compatible_with_state(const _mesa_glsl_parse_state
*
287 /* Check that this extension matches the type of shader we are
290 switch (state
->target
) {
292 if (!this->avail_in_VS
) {
296 case geometry_shader
:
297 if (!this->avail_in_GS
) {
301 case fragment_shader
:
302 if (!this->avail_in_FS
) {
307 assert (!"Unrecognized shader target");
311 /* Check that this extension matches whether we are compiling
312 * for desktop GL or GLES.
314 if (state
->es_shader
) {
315 if (!this->avail_in_ES
) return false;
317 if (!this->avail_in_GL
) return false;
320 /* Check that this extension is supported by the OpenGL
323 * Note: the ->* operator indexes into state->extensions by the
324 * offset this->supported_flag. See
325 * _mesa_glsl_extension::supported_flag for more info.
327 return state
->extensions
->*(this->supported_flag
);
331 * Set the appropriate flags in the parser state to establish the
332 * given behavior for this extension.
334 void _mesa_glsl_extension::set_flags(_mesa_glsl_parse_state
*state
,
335 ext_behavior behavior
) const
337 /* Note: the ->* operator indexes into state by the
338 * offsets this->enable_flag and this->warn_flag. See
339 * _mesa_glsl_extension::supported_flag for more info.
341 state
->*(this->enable_flag
) = (behavior
!= extension_disable
);
342 state
->*(this->warn_flag
) = (behavior
== extension_warn
);
346 * Find an extension by name in _mesa_glsl_supported_extensions. If
347 * the name is not found, return NULL.
349 static const _mesa_glsl_extension
*find_extension(const char *name
)
351 for (unsigned i
= 0; i
< Elements(_mesa_glsl_supported_extensions
); ++i
) {
352 if (strcmp(name
, _mesa_glsl_supported_extensions
[i
].name
) == 0) {
353 return &_mesa_glsl_supported_extensions
[i
];
361 _mesa_glsl_process_extension(const char *name
, YYLTYPE
*name_locp
,
362 const char *behavior_string
, YYLTYPE
*behavior_locp
,
363 _mesa_glsl_parse_state
*state
)
365 ext_behavior behavior
;
366 if (strcmp(behavior_string
, "warn") == 0) {
367 behavior
= extension_warn
;
368 } else if (strcmp(behavior_string
, "require") == 0) {
369 behavior
= extension_require
;
370 } else if (strcmp(behavior_string
, "enable") == 0) {
371 behavior
= extension_enable
;
372 } else if (strcmp(behavior_string
, "disable") == 0) {
373 behavior
= extension_disable
;
375 _mesa_glsl_error(behavior_locp
, state
,
376 "Unknown extension behavior `%s'",
381 if (strcmp(name
, "all") == 0) {
382 if ((behavior
== extension_enable
) || (behavior
== extension_require
)) {
383 _mesa_glsl_error(name_locp
, state
, "Cannot %s all extensions",
384 (behavior
== extension_enable
)
385 ? "enable" : "require");
389 i
< Elements(_mesa_glsl_supported_extensions
); ++i
) {
390 const _mesa_glsl_extension
*extension
391 = &_mesa_glsl_supported_extensions
[i
];
392 if (extension
->compatible_with_state(state
)) {
393 _mesa_glsl_supported_extensions
[i
].set_flags(state
, behavior
);
398 const _mesa_glsl_extension
*extension
= find_extension(name
);
399 if (extension
&& extension
->compatible_with_state(state
)) {
400 extension
->set_flags(state
, behavior
);
402 static const char *const fmt
= "extension `%s' unsupported in %s shader";
404 if (behavior
== extension_require
) {
405 _mesa_glsl_error(name_locp
, state
, fmt
,
406 name
, _mesa_glsl_shader_target_name(state
->target
));
409 _mesa_glsl_warning(name_locp
, state
, fmt
,
410 name
, _mesa_glsl_shader_target_name(state
->target
));
419 _mesa_ast_type_qualifier_print(const struct ast_type_qualifier
*q
)
421 if (q
->flags
.q
.constant
)
424 if (q
->flags
.q
.invariant
)
425 printf("invariant ");
427 if (q
->flags
.q
.attribute
)
428 printf("attribute ");
430 if (q
->flags
.q
.varying
)
433 if (q
->flags
.q
.in
&& q
->flags
.q
.out
)
443 if (q
->flags
.q
.centroid
)
445 if (q
->flags
.q
.uniform
)
447 if (q
->flags
.q
.smooth
)
451 if (q
->flags
.q
.noperspective
)
452 printf("noperspective ");
457 ast_node::print(void) const
459 printf("unhandled node ");
463 ast_node::ast_node(void)
465 this->location
.source
= 0;
466 this->location
.line
= 0;
467 this->location
.column
= 0;
472 ast_opt_array_size_print(bool is_array
, const ast_expression
*array_size
)
486 ast_compound_statement::print(void) const
490 foreach_list_const(n
, &this->statements
) {
491 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
499 ast_compound_statement::ast_compound_statement(int new_scope
,
500 ast_node
*statements
)
502 this->new_scope
= new_scope
;
504 if (statements
!= NULL
) {
505 this->statements
.push_degenerate_list_at_head(&statements
->link
);
511 ast_expression::print(void) const
525 subexpressions
[0]->print();
526 printf("%s ", operator_string(oper
));
527 subexpressions
[1]->print();
530 case ast_field_selection
:
531 subexpressions
[0]->print();
532 printf(". %s ", primary_expression
.identifier
);
541 printf("%s ", operator_string(oper
));
542 subexpressions
[0]->print();
547 subexpressions
[0]->print();
548 printf("%s ", operator_string(oper
));
551 case ast_conditional
:
552 subexpressions
[0]->print();
554 subexpressions
[1]->print();
556 subexpressions
[2]->print();
559 case ast_array_index
:
560 subexpressions
[0]->print();
562 subexpressions
[1]->print();
566 case ast_function_call
: {
567 subexpressions
[0]->print();
570 foreach_list_const (n
, &this->expressions
) {
571 if (n
!= this->expressions
.get_head())
574 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
583 printf("%s ", primary_expression
.identifier
);
586 case ast_int_constant
:
587 printf("%d ", primary_expression
.int_constant
);
590 case ast_uint_constant
:
591 printf("%u ", primary_expression
.uint_constant
);
594 case ast_float_constant
:
595 printf("%f ", primary_expression
.float_constant
);
598 case ast_bool_constant
:
600 primary_expression
.bool_constant
606 foreach_list_const(n
, & this->expressions
) {
607 if (n
!= this->expressions
.get_head())
610 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
623 ast_expression::ast_expression(int oper
,
628 this->oper
= ast_operators(oper
);
629 this->subexpressions
[0] = ex0
;
630 this->subexpressions
[1] = ex1
;
631 this->subexpressions
[2] = ex2
;
632 this->non_lvalue_description
= NULL
;
637 ast_expression_statement::print(void) const
646 ast_expression_statement::ast_expression_statement(ast_expression
*ex
) :
654 ast_function::print(void) const
656 return_type
->print();
657 printf(" %s (", identifier
);
659 foreach_list_const(n
, & this->parameters
) {
660 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
668 ast_function::ast_function(void)
669 : is_definition(false), signature(NULL
)
676 ast_fully_specified_type::print(void) const
678 _mesa_ast_type_qualifier_print(& qualifier
);
684 ast_parameter_declarator::print(void) const
688 printf("%s ", identifier
);
689 ast_opt_array_size_print(is_array
, array_size
);
694 ast_function_definition::print(void) const
702 ast_declaration::print(void) const
704 printf("%s ", identifier
);
705 ast_opt_array_size_print(is_array
, array_size
);
709 initializer
->print();
714 ast_declaration::ast_declaration(char *identifier
, int is_array
,
715 ast_expression
*array_size
,
716 ast_expression
*initializer
)
718 this->identifier
= identifier
;
719 this->is_array
= is_array
;
720 this->array_size
= array_size
;
721 this->initializer
= initializer
;
726 ast_declarator_list::print(void) const
728 assert(type
|| invariant
);
733 printf("invariant ");
735 foreach_list_const (ptr
, & this->declarations
) {
736 if (ptr
!= this->declarations
.get_head())
739 ast_node
*ast
= exec_node_data(ast_node
, ptr
, link
);
747 ast_declarator_list::ast_declarator_list(ast_fully_specified_type
*type
)
750 this->invariant
= false;
754 ast_jump_statement::print(void) const
758 printf("continue; ");
765 if (opt_return_value
)
766 opt_return_value
->print();
777 ast_jump_statement::ast_jump_statement(int mode
, ast_expression
*return_value
)
779 this->mode
= ast_jump_modes(mode
);
781 if (mode
== ast_return
)
782 opt_return_value
= return_value
;
787 ast_selection_statement::print(void) const
793 then_statement
->print();
795 if (else_statement
) {
797 else_statement
->print();
803 ast_selection_statement::ast_selection_statement(ast_expression
*condition
,
804 ast_node
*then_statement
,
805 ast_node
*else_statement
)
807 this->condition
= condition
;
808 this->then_statement
= then_statement
;
809 this->else_statement
= else_statement
;
814 ast_switch_statement::print(void) const
817 test_expression
->print();
824 ast_switch_statement::ast_switch_statement(ast_expression
*test_expression
,
827 this->test_expression
= test_expression
;
833 ast_switch_body::print(void) const
843 ast_switch_body::ast_switch_body(ast_case_statement_list
*stmts
)
849 void ast_case_label::print(void) const
851 if (test_value
!= NULL
) {
861 ast_case_label::ast_case_label(ast_expression
*test_value
)
863 this->test_value
= test_value
;
867 void ast_case_label_list::print(void) const
869 foreach_list_const(n
, & this->labels
) {
870 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
877 ast_case_label_list::ast_case_label_list(void)
882 void ast_case_statement::print(void) const
885 foreach_list_const(n
, & this->stmts
) {
886 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
893 ast_case_statement::ast_case_statement(ast_case_label_list
*labels
)
895 this->labels
= labels
;
899 void ast_case_statement_list::print(void) const
901 foreach_list_const(n
, & this->cases
) {
902 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
908 ast_case_statement_list::ast_case_statement_list(void)
914 ast_iteration_statement::print(void) const
920 init_statement
->print();
928 rest_expression
->print();
954 ast_iteration_statement::ast_iteration_statement(int mode
,
957 ast_expression
*rest_expression
,
960 this->mode
= ast_iteration_modes(mode
);
961 this->init_statement
= init
;
962 this->condition
= condition
;
963 this->rest_expression
= rest_expression
;
969 ast_struct_specifier::print(void) const
971 printf("struct %s { ", name
);
972 foreach_list_const(n
, &this->declarations
) {
973 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
980 ast_struct_specifier::ast_struct_specifier(char *identifier
,
981 ast_node
*declarator_list
)
983 if (identifier
== NULL
) {
984 static unsigned anon_count
= 1;
985 identifier
= ralloc_asprintf(this, "#anon_struct_%04x", anon_count
);
989 this->declarations
.push_degenerate_list_at_head(&declarator_list
->link
);
993 * Do the set of common optimizations passes
995 * \param ir List of instructions to be optimized
996 * \param linked Is the shader linked? This enables
997 * optimizations passes that remove code at
998 * global scope and could cause linking to
1000 * \param uniform_locations_assigned Have locations already been assigned for
1001 * uniforms? This prevents the declarations
1002 * of unused uniforms from being removed.
1003 * The setting of this flag only matters if
1004 * \c linked is \c true.
1005 * \param max_unroll_iterations Maximum number of loop iterations to be
1006 * unrolled. Setting to 0 forces all loops
1010 do_common_optimization(exec_list
*ir
, bool linked
,
1011 bool uniform_locations_assigned
,
1012 unsigned max_unroll_iterations
)
1014 GLboolean progress
= GL_FALSE
;
1016 progress
= lower_instructions(ir
, SUB_TO_ADD_NEG
) || progress
;
1019 progress
= do_function_inlining(ir
) || progress
;
1020 progress
= do_dead_functions(ir
) || progress
;
1021 progress
= do_structure_splitting(ir
) || progress
;
1023 progress
= do_if_simplification(ir
) || progress
;
1024 progress
= do_discard_simplification(ir
) || progress
;
1025 progress
= do_copy_propagation(ir
) || progress
;
1026 progress
= do_copy_propagation_elements(ir
) || progress
;
1028 progress
= do_dead_code(ir
, uniform_locations_assigned
) || progress
;
1030 progress
= do_dead_code_unlinked(ir
) || progress
;
1031 progress
= do_dead_code_local(ir
) || progress
;
1032 progress
= do_tree_grafting(ir
) || progress
;
1033 progress
= do_constant_propagation(ir
) || progress
;
1035 progress
= do_constant_variable(ir
) || progress
;
1037 progress
= do_constant_variable_unlinked(ir
) || progress
;
1038 progress
= do_constant_folding(ir
) || progress
;
1039 progress
= do_algebraic(ir
) || progress
;
1040 progress
= do_lower_jumps(ir
) || progress
;
1041 progress
= do_vec_index_to_swizzle(ir
) || progress
;
1042 progress
= do_swizzle_swizzle(ir
) || progress
;
1043 progress
= do_noop_swizzle(ir
) || progress
;
1045 progress
= optimize_redundant_jumps(ir
) || progress
;
1047 loop_state
*ls
= analyze_loop_variables(ir
);
1048 if (ls
->loop_found
) {
1049 progress
= set_loop_controls(ir
, ls
) || progress
;
1050 progress
= unroll_loops(ir
, ls
, max_unroll_iterations
) || progress
;
1060 * To be called at GL teardown time, this frees compiler datastructures.
1062 * After calling this, any previously compiled shaders and shader
1063 * programs would be invalid. So this should happen at approximately
1067 _mesa_destroy_shader_compiler(void)
1069 _mesa_destroy_shader_compiler_caches();
1071 _mesa_glsl_release_types();
1075 * Releases compiler caches to trade off performance for memory.
1077 * Intended to be used with glReleaseShaderCompiler().
1080 _mesa_destroy_shader_compiler_caches(void)
1082 _mesa_glsl_release_functions();