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);
97 this->Const
.GLSL_140
= (ctx
->API
== API_OPENGL
)
98 && (ctx
->Const
.GLSLVersion
>= 140);
100 const unsigned lowest_version
=
101 (ctx
->API
== API_OPENGLES2
) || ctx
->Extensions
.ARB_ES2_compatibility
103 const unsigned highest_version
=
104 (ctx
->API
== API_OPENGL
) ? ctx
->Const
.GLSLVersion
: 100;
105 char *supported
= ralloc_strdup(this, "");
107 for (unsigned ver
= lowest_version
; ver
<= highest_version
; ver
+= 10) {
108 const char *const prefix
= (ver
== lowest_version
)
110 : ((ver
== highest_version
) ? ", and " : ", ");
112 ralloc_asprintf_append(& supported
, "%s%d.%02d%s",
114 ver
/ 100, ver
% 100,
115 (ver
== 100) ? " ES" : "");
118 this->supported_version_string
= supported
;
120 if (ctx
->Const
.ForceGLSLExtensionsWarn
)
121 _mesa_glsl_process_extension("all", NULL
, "warn", NULL
, this);
125 _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target
)
128 case vertex_shader
: return "vertex";
129 case fragment_shader
: return "fragment";
130 case geometry_shader
: return "geometry";
133 assert(!"Should not get here.");
139 _mesa_glsl_error(YYLTYPE
*locp
, _mesa_glsl_parse_state
*state
,
140 const char *fmt
, ...)
146 assert(state
->info_log
!= NULL
);
147 ralloc_asprintf_append(&state
->info_log
, "%u:%u(%u): error: ",
152 ralloc_vasprintf_append(&state
->info_log
, fmt
, ap
);
154 ralloc_strcat(&state
->info_log
, "\n");
159 _mesa_glsl_warning(const YYLTYPE
*locp
, _mesa_glsl_parse_state
*state
,
160 const char *fmt
, ...)
164 assert(state
->info_log
!= NULL
);
165 ralloc_asprintf_append(&state
->info_log
, "%u:%u(%u): warning: ",
170 ralloc_vasprintf_append(&state
->info_log
, fmt
, ap
);
172 ralloc_strcat(&state
->info_log
, "\n");
177 * Enum representing the possible behaviors that can be specified in
178 * an #extension directive.
188 * Element type for _mesa_glsl_supported_extensions
190 struct _mesa_glsl_extension
{
192 * Name of the extension when referred to in a GLSL extension
197 /** True if this extension is available to vertex shaders */
200 /** True if this extension is available to geometry shaders */
203 /** True if this extension is available to fragment shaders */
206 /** True if this extension is available to desktop GL shaders */
209 /** True if this extension is available to GLES shaders */
213 * Flag in the gl_extensions struct indicating whether this
214 * extension is supported by the driver, or
215 * &gl_extensions::dummy_true if supported by all drivers.
217 * Note: the type (GLboolean gl_extensions::*) is a "pointer to
218 * member" type, the type-safe alternative to the "offsetof" macro.
221 * - foo bar::* p declares p to be an "offset" to a field of type
222 * foo that exists within struct bar
223 * - &bar::baz computes the "offset" of field baz within struct bar
224 * - x.*p accesses the field of x that exists at "offset" p
225 * - x->*p is equivalent to (*x).*p
227 const GLboolean
gl_extensions::* supported_flag
;
230 * Flag in the _mesa_glsl_parse_state struct that should be set
231 * when this extension is enabled.
233 * See note in _mesa_glsl_extension::supported_flag about "pointer
236 bool _mesa_glsl_parse_state::* enable_flag
;
239 * Flag in the _mesa_glsl_parse_state struct that should be set
240 * when the shader requests "warn" behavior for this extension.
242 * See note in _mesa_glsl_extension::supported_flag about "pointer
245 bool _mesa_glsl_parse_state::* warn_flag
;
248 bool compatible_with_state(const _mesa_glsl_parse_state
*state
) const;
249 void set_flags(_mesa_glsl_parse_state
*state
, ext_behavior behavior
) const;
252 #define EXT(NAME, VS, GS, FS, GL, ES, SUPPORTED_FLAG) \
253 { "GL_" #NAME, VS, GS, FS, GL, ES, &gl_extensions::SUPPORTED_FLAG, \
254 &_mesa_glsl_parse_state::NAME##_enable, \
255 &_mesa_glsl_parse_state::NAME##_warn }
258 * Table of extensions that can be enabled/disabled within a shader,
259 * and the conditions under which they are supported.
261 static const _mesa_glsl_extension _mesa_glsl_supported_extensions
[] = {
262 /* target availability API availability */
263 /* name VS GS FS GL ES supported flag */
264 EXT(ARB_conservative_depth
, false, false, true, true, false, ARB_conservative_depth
),
265 EXT(ARB_draw_buffers
, false, false, true, true, false, dummy_true
),
266 EXT(ARB_draw_instanced
, true, false, false, true, false, ARB_draw_instanced
),
267 EXT(ARB_explicit_attrib_location
, true, false, true, true, false, ARB_explicit_attrib_location
),
268 EXT(ARB_fragment_coord_conventions
, true, false, true, true, false, ARB_fragment_coord_conventions
),
269 EXT(ARB_texture_rectangle
, true, false, true, true, false, dummy_true
),
270 EXT(EXT_texture_array
, true, false, true, true, false, EXT_texture_array
),
271 EXT(ARB_shader_texture_lod
, true, false, true, true, false, ARB_shader_texture_lod
),
272 EXT(ARB_shader_stencil_export
, false, false, true, true, false, ARB_shader_stencil_export
),
273 EXT(AMD_conservative_depth
, false, false, true, true, false, ARB_conservative_depth
),
274 EXT(AMD_shader_stencil_export
, false, false, true, true, false, ARB_shader_stencil_export
),
275 EXT(OES_texture_3D
, true, false, true, false, true, EXT_texture3D
),
276 EXT(OES_EGL_image_external
, true, false, true, false, true, OES_EGL_image_external
),
283 * Determine whether a given extension is compatible with the target,
284 * API, and extension information in the current parser state.
286 bool _mesa_glsl_extension::compatible_with_state(const _mesa_glsl_parse_state
*
289 /* Check that this extension matches the type of shader we are
292 switch (state
->target
) {
294 if (!this->avail_in_VS
) {
298 case geometry_shader
:
299 if (!this->avail_in_GS
) {
303 case fragment_shader
:
304 if (!this->avail_in_FS
) {
309 assert (!"Unrecognized shader target");
313 /* Check that this extension matches whether we are compiling
314 * for desktop GL or GLES.
316 if (state
->es_shader
) {
317 if (!this->avail_in_ES
) return false;
319 if (!this->avail_in_GL
) return false;
322 /* Check that this extension is supported by the OpenGL
325 * Note: the ->* operator indexes into state->extensions by the
326 * offset this->supported_flag. See
327 * _mesa_glsl_extension::supported_flag for more info.
329 return state
->extensions
->*(this->supported_flag
);
333 * Set the appropriate flags in the parser state to establish the
334 * given behavior for this extension.
336 void _mesa_glsl_extension::set_flags(_mesa_glsl_parse_state
*state
,
337 ext_behavior behavior
) const
339 /* Note: the ->* operator indexes into state by the
340 * offsets this->enable_flag and this->warn_flag. See
341 * _mesa_glsl_extension::supported_flag for more info.
343 state
->*(this->enable_flag
) = (behavior
!= extension_disable
);
344 state
->*(this->warn_flag
) = (behavior
== extension_warn
);
348 * Find an extension by name in _mesa_glsl_supported_extensions. If
349 * the name is not found, return NULL.
351 static const _mesa_glsl_extension
*find_extension(const char *name
)
353 for (unsigned i
= 0; i
< Elements(_mesa_glsl_supported_extensions
); ++i
) {
354 if (strcmp(name
, _mesa_glsl_supported_extensions
[i
].name
) == 0) {
355 return &_mesa_glsl_supported_extensions
[i
];
363 _mesa_glsl_process_extension(const char *name
, YYLTYPE
*name_locp
,
364 const char *behavior_string
, YYLTYPE
*behavior_locp
,
365 _mesa_glsl_parse_state
*state
)
367 ext_behavior behavior
;
368 if (strcmp(behavior_string
, "warn") == 0) {
369 behavior
= extension_warn
;
370 } else if (strcmp(behavior_string
, "require") == 0) {
371 behavior
= extension_require
;
372 } else if (strcmp(behavior_string
, "enable") == 0) {
373 behavior
= extension_enable
;
374 } else if (strcmp(behavior_string
, "disable") == 0) {
375 behavior
= extension_disable
;
377 _mesa_glsl_error(behavior_locp
, state
,
378 "Unknown extension behavior `%s'",
383 if (strcmp(name
, "all") == 0) {
384 if ((behavior
== extension_enable
) || (behavior
== extension_require
)) {
385 _mesa_glsl_error(name_locp
, state
, "Cannot %s all extensions",
386 (behavior
== extension_enable
)
387 ? "enable" : "require");
391 i
< Elements(_mesa_glsl_supported_extensions
); ++i
) {
392 const _mesa_glsl_extension
*extension
393 = &_mesa_glsl_supported_extensions
[i
];
394 if (extension
->compatible_with_state(state
)) {
395 _mesa_glsl_supported_extensions
[i
].set_flags(state
, behavior
);
400 const _mesa_glsl_extension
*extension
= find_extension(name
);
401 if (extension
&& extension
->compatible_with_state(state
)) {
402 extension
->set_flags(state
, behavior
);
404 static const char *const fmt
= "extension `%s' unsupported in %s shader";
406 if (behavior
== extension_require
) {
407 _mesa_glsl_error(name_locp
, state
, fmt
,
408 name
, _mesa_glsl_shader_target_name(state
->target
));
411 _mesa_glsl_warning(name_locp
, state
, fmt
,
412 name
, _mesa_glsl_shader_target_name(state
->target
));
421 _mesa_ast_type_qualifier_print(const struct ast_type_qualifier
*q
)
423 if (q
->flags
.q
.constant
)
426 if (q
->flags
.q
.invariant
)
427 printf("invariant ");
429 if (q
->flags
.q
.attribute
)
430 printf("attribute ");
432 if (q
->flags
.q
.varying
)
435 if (q
->flags
.q
.in
&& q
->flags
.q
.out
)
445 if (q
->flags
.q
.centroid
)
447 if (q
->flags
.q
.uniform
)
449 if (q
->flags
.q
.smooth
)
453 if (q
->flags
.q
.noperspective
)
454 printf("noperspective ");
459 ast_node::print(void) const
461 printf("unhandled node ");
465 ast_node::ast_node(void)
467 this->location
.source
= 0;
468 this->location
.line
= 0;
469 this->location
.column
= 0;
474 ast_opt_array_size_print(bool is_array
, const ast_expression
*array_size
)
488 ast_compound_statement::print(void) const
492 foreach_list_const(n
, &this->statements
) {
493 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
501 ast_compound_statement::ast_compound_statement(int new_scope
,
502 ast_node
*statements
)
504 this->new_scope
= new_scope
;
506 if (statements
!= NULL
) {
507 this->statements
.push_degenerate_list_at_head(&statements
->link
);
513 ast_expression::print(void) const
527 subexpressions
[0]->print();
528 printf("%s ", operator_string(oper
));
529 subexpressions
[1]->print();
532 case ast_field_selection
:
533 subexpressions
[0]->print();
534 printf(". %s ", primary_expression
.identifier
);
543 printf("%s ", operator_string(oper
));
544 subexpressions
[0]->print();
549 subexpressions
[0]->print();
550 printf("%s ", operator_string(oper
));
553 case ast_conditional
:
554 subexpressions
[0]->print();
556 subexpressions
[1]->print();
558 subexpressions
[2]->print();
561 case ast_array_index
:
562 subexpressions
[0]->print();
564 subexpressions
[1]->print();
568 case ast_function_call
: {
569 subexpressions
[0]->print();
572 foreach_list_const (n
, &this->expressions
) {
573 if (n
!= this->expressions
.get_head())
576 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
585 printf("%s ", primary_expression
.identifier
);
588 case ast_int_constant
:
589 printf("%d ", primary_expression
.int_constant
);
592 case ast_uint_constant
:
593 printf("%u ", primary_expression
.uint_constant
);
596 case ast_float_constant
:
597 printf("%f ", primary_expression
.float_constant
);
600 case ast_bool_constant
:
602 primary_expression
.bool_constant
608 foreach_list_const(n
, & this->expressions
) {
609 if (n
!= this->expressions
.get_head())
612 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
625 ast_expression::ast_expression(int oper
,
630 this->oper
= ast_operators(oper
);
631 this->subexpressions
[0] = ex0
;
632 this->subexpressions
[1] = ex1
;
633 this->subexpressions
[2] = ex2
;
634 this->non_lvalue_description
= NULL
;
639 ast_expression_statement::print(void) const
648 ast_expression_statement::ast_expression_statement(ast_expression
*ex
) :
656 ast_function::print(void) const
658 return_type
->print();
659 printf(" %s (", identifier
);
661 foreach_list_const(n
, & this->parameters
) {
662 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
670 ast_function::ast_function(void)
671 : is_definition(false), signature(NULL
)
678 ast_fully_specified_type::print(void) const
680 _mesa_ast_type_qualifier_print(& qualifier
);
686 ast_parameter_declarator::print(void) const
690 printf("%s ", identifier
);
691 ast_opt_array_size_print(is_array
, array_size
);
696 ast_function_definition::print(void) const
704 ast_declaration::print(void) const
706 printf("%s ", identifier
);
707 ast_opt_array_size_print(is_array
, array_size
);
711 initializer
->print();
716 ast_declaration::ast_declaration(const char *identifier
, int is_array
,
717 ast_expression
*array_size
,
718 ast_expression
*initializer
)
720 this->identifier
= identifier
;
721 this->is_array
= is_array
;
722 this->array_size
= array_size
;
723 this->initializer
= initializer
;
728 ast_declarator_list::print(void) const
730 assert(type
|| invariant
);
735 printf("invariant ");
737 foreach_list_const (ptr
, & this->declarations
) {
738 if (ptr
!= this->declarations
.get_head())
741 ast_node
*ast
= exec_node_data(ast_node
, ptr
, link
);
749 ast_declarator_list::ast_declarator_list(ast_fully_specified_type
*type
)
752 this->invariant
= false;
756 ast_jump_statement::print(void) const
760 printf("continue; ");
767 if (opt_return_value
)
768 opt_return_value
->print();
779 ast_jump_statement::ast_jump_statement(int mode
, ast_expression
*return_value
)
781 this->mode
= ast_jump_modes(mode
);
783 if (mode
== ast_return
)
784 opt_return_value
= return_value
;
789 ast_selection_statement::print(void) const
795 then_statement
->print();
797 if (else_statement
) {
799 else_statement
->print();
805 ast_selection_statement::ast_selection_statement(ast_expression
*condition
,
806 ast_node
*then_statement
,
807 ast_node
*else_statement
)
809 this->condition
= condition
;
810 this->then_statement
= then_statement
;
811 this->else_statement
= else_statement
;
816 ast_switch_statement::print(void) const
819 test_expression
->print();
826 ast_switch_statement::ast_switch_statement(ast_expression
*test_expression
,
829 this->test_expression
= test_expression
;
835 ast_switch_body::print(void) const
845 ast_switch_body::ast_switch_body(ast_case_statement_list
*stmts
)
851 void ast_case_label::print(void) const
853 if (test_value
!= NULL
) {
863 ast_case_label::ast_case_label(ast_expression
*test_value
)
865 this->test_value
= test_value
;
869 void ast_case_label_list::print(void) const
871 foreach_list_const(n
, & this->labels
) {
872 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
879 ast_case_label_list::ast_case_label_list(void)
884 void ast_case_statement::print(void) const
887 foreach_list_const(n
, & this->stmts
) {
888 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
895 ast_case_statement::ast_case_statement(ast_case_label_list
*labels
)
897 this->labels
= labels
;
901 void ast_case_statement_list::print(void) const
903 foreach_list_const(n
, & this->cases
) {
904 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
910 ast_case_statement_list::ast_case_statement_list(void)
916 ast_iteration_statement::print(void) const
922 init_statement
->print();
930 rest_expression
->print();
956 ast_iteration_statement::ast_iteration_statement(int mode
,
959 ast_expression
*rest_expression
,
962 this->mode
= ast_iteration_modes(mode
);
963 this->init_statement
= init
;
964 this->condition
= condition
;
965 this->rest_expression
= rest_expression
;
971 ast_struct_specifier::print(void) const
973 printf("struct %s { ", name
);
974 foreach_list_const(n
, &this->declarations
) {
975 ast_node
*ast
= exec_node_data(ast_node
, n
, link
);
982 ast_struct_specifier::ast_struct_specifier(const char *identifier
,
983 ast_node
*declarator_list
)
985 if (identifier
== NULL
) {
986 static unsigned anon_count
= 1;
987 identifier
= ralloc_asprintf(this, "#anon_struct_%04x", anon_count
);
991 this->declarations
.push_degenerate_list_at_head(&declarator_list
->link
);
995 * Do the set of common optimizations passes
997 * \param ir List of instructions to be optimized
998 * \param linked Is the shader linked? This enables
999 * optimizations passes that remove code at
1000 * global scope and could cause linking to
1002 * \param uniform_locations_assigned Have locations already been assigned for
1003 * uniforms? This prevents the declarations
1004 * of unused uniforms from being removed.
1005 * The setting of this flag only matters if
1006 * \c linked is \c true.
1007 * \param max_unroll_iterations Maximum number of loop iterations to be
1008 * unrolled. Setting to 0 forces all loops
1012 do_common_optimization(exec_list
*ir
, bool linked
,
1013 bool uniform_locations_assigned
,
1014 unsigned max_unroll_iterations
)
1016 GLboolean progress
= GL_FALSE
;
1018 progress
= lower_instructions(ir
, SUB_TO_ADD_NEG
) || progress
;
1021 progress
= do_function_inlining(ir
) || progress
;
1022 progress
= do_dead_functions(ir
) || progress
;
1023 progress
= do_structure_splitting(ir
) || progress
;
1025 progress
= do_if_simplification(ir
) || progress
;
1026 progress
= do_discard_simplification(ir
) || progress
;
1027 progress
= do_copy_propagation(ir
) || progress
;
1028 progress
= do_copy_propagation_elements(ir
) || progress
;
1030 progress
= do_dead_code(ir
, uniform_locations_assigned
) || progress
;
1032 progress
= do_dead_code_unlinked(ir
) || progress
;
1033 progress
= do_dead_code_local(ir
) || progress
;
1034 progress
= do_tree_grafting(ir
) || progress
;
1035 progress
= do_constant_propagation(ir
) || progress
;
1037 progress
= do_constant_variable(ir
) || progress
;
1039 progress
= do_constant_variable_unlinked(ir
) || progress
;
1040 progress
= do_constant_folding(ir
) || progress
;
1041 progress
= do_algebraic(ir
) || progress
;
1042 progress
= do_lower_jumps(ir
) || progress
;
1043 progress
= do_vec_index_to_swizzle(ir
) || progress
;
1044 progress
= do_swizzle_swizzle(ir
) || progress
;
1045 progress
= do_noop_swizzle(ir
) || progress
;
1047 progress
= optimize_redundant_jumps(ir
) || progress
;
1049 loop_state
*ls
= analyze_loop_variables(ir
);
1050 if (ls
->loop_found
) {
1051 progress
= set_loop_controls(ir
, ls
) || progress
;
1052 progress
= unroll_loops(ir
, ls
, max_unroll_iterations
) || progress
;
1062 * To be called at GL teardown time, this frees compiler datastructures.
1064 * After calling this, any previously compiled shaders and shader
1065 * programs would be invalid. So this should happen at approximately
1069 _mesa_destroy_shader_compiler(void)
1071 _mesa_destroy_shader_compiler_caches();
1073 _mesa_glsl_release_types();
1077 * Releases compiler caches to trade off performance for memory.
1079 * Intended to be used with glReleaseShaderCompiler().
1082 _mesa_destroy_shader_compiler_caches(void)
1084 _mesa_glsl_release_functions();