glsl: Make GL_ARB_shader_stencil_export enable block be similar to other blocks
[mesa.git] / src / glsl / glsl_parser_extras.cpp
1 /*
2 * Copyright © 2008, 2009 Intel Corporation
3 *
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:
10 *
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
13 * Software.
14 *
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.
22 */
23 #include <stdio.h>
24 #include <stdarg.h>
25 #include <string.h>
26 #include <assert.h>
27
28 extern "C" {
29 #include "main/core.h" /* for struct gl_context */
30 }
31
32 #include "ralloc.h"
33 #include "ast.h"
34 #include "glsl_parser_extras.h"
35 #include "glsl_parser.h"
36 #include "ir_optimization.h"
37 #include "loop_analysis.h"
38
39 _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
40 GLenum target, void *mem_ctx)
41 {
42 switch (target) {
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;
46 }
47
48 this->scanner = NULL;
49 this->translation_unit.make_empty();
50 this->symbols = new(mem_ctx) glsl_symbol_table;
51 this->info_log = ralloc_strdup(mem_ctx, "");
52 this->error = false;
53 this->loop_or_switch_nesting = NULL;
54
55 /* Set default language version and extensions */
56 this->language_version = 110;
57 this->es_shader = false;
58 this->ARB_texture_rectangle_enable = true;
59
60 /* OpenGL ES 2.0 has different defaults from desktop GL. */
61 if (ctx->API == API_OPENGLES2) {
62 this->language_version = 100;
63 this->es_shader = true;
64 this->ARB_texture_rectangle_enable = false;
65 }
66
67 this->extensions = &ctx->Extensions;
68
69 this->Const.MaxLights = ctx->Const.MaxLights;
70 this->Const.MaxClipPlanes = ctx->Const.MaxClipPlanes;
71 this->Const.MaxTextureUnits = ctx->Const.MaxTextureUnits;
72 this->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits;
73 this->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs;
74 this->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents;
75 this->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4;
76 this->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits;
77 this->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits;
78 this->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
79 this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents;
80
81 this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
82
83 /* Note: Once the OpenGL 3.0 'forward compatible' context or the OpenGL 3.2
84 * Core context is supported, this logic will need change. Older versions of
85 * GLSL are no longer supported outside the compatibility contexts of 3.x.
86 */
87 this->Const.GLSL_100ES = (ctx->API == API_OPENGLES2)
88 || ctx->Extensions.ARB_ES2_compatibility;
89 this->Const.GLSL_110 = (ctx->API == API_OPENGL);
90 this->Const.GLSL_120 = (ctx->API == API_OPENGL)
91 && (ctx->Const.GLSLVersion >= 120);
92 this->Const.GLSL_130 = (ctx->API == API_OPENGL)
93 && (ctx->Const.GLSLVersion >= 130);
94
95 const unsigned lowest_version =
96 (ctx->API == API_OPENGLES2) || ctx->Extensions.ARB_ES2_compatibility
97 ? 100 : 110;
98 const unsigned highest_version =
99 (ctx->API == API_OPENGL) ? ctx->Const.GLSLVersion : 100;
100 char *supported = ralloc_strdup(this, "");
101
102 for (unsigned ver = lowest_version; ver <= highest_version; ver += 10) {
103 const char *const prefix = (ver == lowest_version)
104 ? ""
105 : ((ver == highest_version) ? ", and " : ", ");
106
107 ralloc_asprintf_append(& supported, "%s%d.%02d%s",
108 prefix,
109 ver / 100, ver % 100,
110 (ver == 100) ? " ES" : "");
111 }
112
113 this->supported_version_string = supported;
114 }
115
116 const char *
117 _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target)
118 {
119 switch (target) {
120 case vertex_shader: return "vertex";
121 case fragment_shader: return "fragment";
122 case geometry_shader: return "geometry";
123 }
124
125 assert(!"Should not get here.");
126 return "unknown";
127 }
128
129
130 void
131 _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
132 const char *fmt, ...)
133 {
134 va_list ap;
135
136 state->error = true;
137
138 assert(state->info_log != NULL);
139 ralloc_asprintf_append(&state->info_log, "%u:%u(%u): error: ",
140 locp->source,
141 locp->first_line,
142 locp->first_column);
143 va_start(ap, fmt);
144 ralloc_vasprintf_append(&state->info_log, fmt, ap);
145 va_end(ap);
146 ralloc_strcat(&state->info_log, "\n");
147 }
148
149
150 void
151 _mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
152 const char *fmt, ...)
153 {
154 va_list ap;
155
156 assert(state->info_log != NULL);
157 ralloc_asprintf_append(&state->info_log, "%u:%u(%u): warning: ",
158 locp->source,
159 locp->first_line,
160 locp->first_column);
161 va_start(ap, fmt);
162 ralloc_vasprintf_append(&state->info_log, fmt, ap);
163 va_end(ap);
164 ralloc_strcat(&state->info_log, "\n");
165 }
166
167
168 bool
169 _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
170 const char *behavior, YYLTYPE *behavior_locp,
171 _mesa_glsl_parse_state *state)
172 {
173 enum {
174 extension_disable,
175 extension_enable,
176 extension_require,
177 extension_warn
178 } ext_mode;
179
180 if (strcmp(behavior, "warn") == 0) {
181 ext_mode = extension_warn;
182 } else if (strcmp(behavior, "require") == 0) {
183 ext_mode = extension_require;
184 } else if (strcmp(behavior, "enable") == 0) {
185 ext_mode = extension_enable;
186 } else if (strcmp(behavior, "disable") == 0) {
187 ext_mode = extension_disable;
188 } else {
189 _mesa_glsl_error(behavior_locp, state,
190 "Unknown extension behavior `%s'",
191 behavior);
192 return false;
193 }
194
195 bool unsupported = false;
196
197 if (strcmp(name, "all") == 0) {
198 if ((ext_mode == extension_enable) || (ext_mode == extension_require)) {
199 _mesa_glsl_error(name_locp, state, "Cannot %s all extensions",
200 (ext_mode == extension_enable)
201 ? "enable" : "require");
202 return false;
203 }
204 } else if (strcmp(name, "GL_ARB_draw_buffers") == 0) {
205 /* This extension is only supported in fragment shaders.
206 */
207 if (state->target != fragment_shader) {
208 unsupported = true;
209 } else {
210 state->ARB_draw_buffers_enable = (ext_mode != extension_disable);
211 state->ARB_draw_buffers_warn = (ext_mode == extension_warn);
212 }
213 } else if (strcmp(name, "GL_ARB_draw_instanced") == 0) {
214 state->ARB_draw_instanced_enable = (ext_mode != extension_disable);
215 state->ARB_draw_instanced_warn = (ext_mode == extension_warn);
216
217 /* This extension is only supported in vertex shaders.
218 */
219 unsupported = (state->target != vertex_shader)
220 || !state->extensions->ARB_draw_instanced;
221 } else if (strcmp(name, "GL_ARB_explicit_attrib_location") == 0) {
222 state->ARB_explicit_attrib_location_enable =
223 (ext_mode != extension_disable);
224 state->ARB_explicit_attrib_location_warn =
225 (ext_mode == extension_warn);
226
227 unsupported = !state->extensions->ARB_explicit_attrib_location;
228 } else if (strcmp(name, "GL_ARB_fragment_coord_conventions") == 0) {
229 state->ARB_fragment_coord_conventions_enable =
230 (ext_mode != extension_disable);
231 state->ARB_fragment_coord_conventions_warn =
232 (ext_mode == extension_warn);
233
234 unsupported = !state->extensions->ARB_fragment_coord_conventions;
235 } else if (strcmp(name, "GL_ARB_texture_rectangle") == 0) {
236 state->ARB_texture_rectangle_enable = (ext_mode != extension_disable);
237 state->ARB_texture_rectangle_warn = (ext_mode == extension_warn);
238 } else if (strcmp(name, "GL_EXT_texture_array") == 0) {
239 state->EXT_texture_array_enable = (ext_mode != extension_disable);
240 state->EXT_texture_array_warn = (ext_mode == extension_warn);
241
242 unsupported = !state->extensions->EXT_texture_array;
243 } else if (strcmp(name, "GL_ARB_shader_stencil_export") == 0) {
244 state->ARB_shader_stencil_export_enable = (ext_mode != extension_disable);
245 state->ARB_shader_stencil_export_warn = (ext_mode == extension_warn);
246
247 /* This extension is only supported in fragment shaders.
248 */
249 unsupported = (state->target != fragment_shader)
250 || !state->extensions->ARB_shader_stencil_export;
251 } else if (strcmp(name, "GL_AMD_conservative_depth") == 0) {
252 /* The AMD_conservative spec does not forbid requiring the extension in
253 * the vertex shader.
254 */
255 state->AMD_conservative_depth_enable = (ext_mode != extension_disable);
256 state->AMD_conservative_depth_warn = (ext_mode == extension_warn);
257 unsupported = !state->extensions->AMD_conservative_depth;
258 } else if (strcmp(name, "GL_OES_texture_3D") == 0 && state->es_shader) {
259 state->OES_texture_3D_enable = (ext_mode != extension_disable);
260 state->OES_texture_3D_warn = (ext_mode == extension_warn);
261
262 unsupported = !state->extensions->EXT_texture3D;
263 } else {
264 unsupported = true;
265 }
266
267 if (unsupported) {
268 static const char *const fmt = "extension `%s' unsupported in %s shader";
269
270 if (ext_mode == extension_require) {
271 _mesa_glsl_error(name_locp, state, fmt,
272 name, _mesa_glsl_shader_target_name(state->target));
273 return false;
274 } else {
275 _mesa_glsl_warning(name_locp, state, fmt,
276 name, _mesa_glsl_shader_target_name(state->target));
277 }
278 }
279
280 return true;
281 }
282
283 void
284 _mesa_ast_type_qualifier_print(const struct ast_type_qualifier *q)
285 {
286 if (q->flags.q.constant)
287 printf("const ");
288
289 if (q->flags.q.invariant)
290 printf("invariant ");
291
292 if (q->flags.q.attribute)
293 printf("attribute ");
294
295 if (q->flags.q.varying)
296 printf("varying ");
297
298 if (q->flags.q.in && q->flags.q.out)
299 printf("inout ");
300 else {
301 if (q->flags.q.in)
302 printf("in ");
303
304 if (q->flags.q.out)
305 printf("out ");
306 }
307
308 if (q->flags.q.centroid)
309 printf("centroid ");
310 if (q->flags.q.uniform)
311 printf("uniform ");
312 if (q->flags.q.smooth)
313 printf("smooth ");
314 if (q->flags.q.flat)
315 printf("flat ");
316 if (q->flags.q.noperspective)
317 printf("noperspective ");
318 }
319
320
321 void
322 ast_node::print(void) const
323 {
324 printf("unhandled node ");
325 }
326
327
328 ast_node::ast_node(void)
329 {
330 this->location.source = 0;
331 this->location.line = 0;
332 this->location.column = 0;
333 }
334
335
336 static void
337 ast_opt_array_size_print(bool is_array, const ast_expression *array_size)
338 {
339 if (is_array) {
340 printf("[ ");
341
342 if (array_size)
343 array_size->print();
344
345 printf("] ");
346 }
347 }
348
349
350 void
351 ast_compound_statement::print(void) const
352 {
353 printf("{\n");
354
355 foreach_list_const(n, &this->statements) {
356 ast_node *ast = exec_node_data(ast_node, n, link);
357 ast->print();
358 }
359
360 printf("}\n");
361 }
362
363
364 ast_compound_statement::ast_compound_statement(int new_scope,
365 ast_node *statements)
366 {
367 this->new_scope = new_scope;
368
369 if (statements != NULL) {
370 this->statements.push_degenerate_list_at_head(&statements->link);
371 }
372 }
373
374
375 void
376 ast_expression::print(void) const
377 {
378 switch (oper) {
379 case ast_assign:
380 case ast_mul_assign:
381 case ast_div_assign:
382 case ast_mod_assign:
383 case ast_add_assign:
384 case ast_sub_assign:
385 case ast_ls_assign:
386 case ast_rs_assign:
387 case ast_and_assign:
388 case ast_xor_assign:
389 case ast_or_assign:
390 subexpressions[0]->print();
391 printf("%s ", operator_string(oper));
392 subexpressions[1]->print();
393 break;
394
395 case ast_field_selection:
396 subexpressions[0]->print();
397 printf(". %s ", primary_expression.identifier);
398 break;
399
400 case ast_plus:
401 case ast_neg:
402 case ast_bit_not:
403 case ast_logic_not:
404 case ast_pre_inc:
405 case ast_pre_dec:
406 printf("%s ", operator_string(oper));
407 subexpressions[0]->print();
408 break;
409
410 case ast_post_inc:
411 case ast_post_dec:
412 subexpressions[0]->print();
413 printf("%s ", operator_string(oper));
414 break;
415
416 case ast_conditional:
417 subexpressions[0]->print();
418 printf("? ");
419 subexpressions[1]->print();
420 printf(": ");
421 subexpressions[1]->print();
422 break;
423
424 case ast_array_index:
425 subexpressions[0]->print();
426 printf("[ ");
427 subexpressions[1]->print();
428 printf("] ");
429 break;
430
431 case ast_function_call: {
432 subexpressions[0]->print();
433 printf("( ");
434
435 foreach_list_const (n, &this->expressions) {
436 if (n != this->expressions.get_head())
437 printf(", ");
438
439 ast_node *ast = exec_node_data(ast_node, n, link);
440 ast->print();
441 }
442
443 printf(") ");
444 break;
445 }
446
447 case ast_identifier:
448 printf("%s ", primary_expression.identifier);
449 break;
450
451 case ast_int_constant:
452 printf("%d ", primary_expression.int_constant);
453 break;
454
455 case ast_uint_constant:
456 printf("%u ", primary_expression.uint_constant);
457 break;
458
459 case ast_float_constant:
460 printf("%f ", primary_expression.float_constant);
461 break;
462
463 case ast_bool_constant:
464 printf("%s ",
465 primary_expression.bool_constant
466 ? "true" : "false");
467 break;
468
469 case ast_sequence: {
470 printf("( ");
471 foreach_list_const(n, & this->expressions) {
472 if (n != this->expressions.get_head())
473 printf(", ");
474
475 ast_node *ast = exec_node_data(ast_node, n, link);
476 ast->print();
477 }
478 printf(") ");
479 break;
480 }
481
482 default:
483 assert(0);
484 break;
485 }
486 }
487
488 ast_expression::ast_expression(int oper,
489 ast_expression *ex0,
490 ast_expression *ex1,
491 ast_expression *ex2)
492 {
493 this->oper = ast_operators(oper);
494 this->subexpressions[0] = ex0;
495 this->subexpressions[1] = ex1;
496 this->subexpressions[2] = ex2;
497 }
498
499
500 void
501 ast_expression_statement::print(void) const
502 {
503 if (expression)
504 expression->print();
505
506 printf("; ");
507 }
508
509
510 ast_expression_statement::ast_expression_statement(ast_expression *ex) :
511 expression(ex)
512 {
513 /* empty */
514 }
515
516
517 void
518 ast_function::print(void) const
519 {
520 return_type->print();
521 printf(" %s (", identifier);
522
523 foreach_list_const(n, & this->parameters) {
524 ast_node *ast = exec_node_data(ast_node, n, link);
525 ast->print();
526 }
527
528 printf(")");
529 }
530
531
532 ast_function::ast_function(void)
533 : is_definition(false), signature(NULL)
534 {
535 /* empty */
536 }
537
538
539 void
540 ast_fully_specified_type::print(void) const
541 {
542 _mesa_ast_type_qualifier_print(& qualifier);
543 specifier->print();
544 }
545
546
547 void
548 ast_parameter_declarator::print(void) const
549 {
550 type->print();
551 if (identifier)
552 printf("%s ", identifier);
553 ast_opt_array_size_print(is_array, array_size);
554 }
555
556
557 void
558 ast_function_definition::print(void) const
559 {
560 prototype->print();
561 body->print();
562 }
563
564
565 void
566 ast_declaration::print(void) const
567 {
568 printf("%s ", identifier);
569 ast_opt_array_size_print(is_array, array_size);
570
571 if (initializer) {
572 printf("= ");
573 initializer->print();
574 }
575 }
576
577
578 ast_declaration::ast_declaration(char *identifier, int is_array,
579 ast_expression *array_size,
580 ast_expression *initializer)
581 {
582 this->identifier = identifier;
583 this->is_array = is_array;
584 this->array_size = array_size;
585 this->initializer = initializer;
586 }
587
588
589 void
590 ast_declarator_list::print(void) const
591 {
592 assert(type || invariant);
593
594 if (type)
595 type->print();
596 else
597 printf("invariant ");
598
599 foreach_list_const (ptr, & this->declarations) {
600 if (ptr != this->declarations.get_head())
601 printf(", ");
602
603 ast_node *ast = exec_node_data(ast_node, ptr, link);
604 ast->print();
605 }
606
607 printf("; ");
608 }
609
610
611 ast_declarator_list::ast_declarator_list(ast_fully_specified_type *type)
612 {
613 this->type = type;
614 this->invariant = false;
615 }
616
617 void
618 ast_jump_statement::print(void) const
619 {
620 switch (mode) {
621 case ast_continue:
622 printf("continue; ");
623 break;
624 case ast_break:
625 printf("break; ");
626 break;
627 case ast_return:
628 printf("return ");
629 if (opt_return_value)
630 opt_return_value->print();
631
632 printf("; ");
633 break;
634 case ast_discard:
635 printf("discard; ");
636 break;
637 }
638 }
639
640
641 ast_jump_statement::ast_jump_statement(int mode, ast_expression *return_value)
642 {
643 this->mode = ast_jump_modes(mode);
644
645 if (mode == ast_return)
646 opt_return_value = return_value;
647 }
648
649
650 void
651 ast_selection_statement::print(void) const
652 {
653 printf("if ( ");
654 condition->print();
655 printf(") ");
656
657 then_statement->print();
658
659 if (else_statement) {
660 printf("else ");
661 else_statement->print();
662 }
663
664 }
665
666
667 ast_selection_statement::ast_selection_statement(ast_expression *condition,
668 ast_node *then_statement,
669 ast_node *else_statement)
670 {
671 this->condition = condition;
672 this->then_statement = then_statement;
673 this->else_statement = else_statement;
674 }
675
676
677 void
678 ast_iteration_statement::print(void) const
679 {
680 switch (mode) {
681 case ast_for:
682 printf("for( ");
683 if (init_statement)
684 init_statement->print();
685 printf("; ");
686
687 if (condition)
688 condition->print();
689 printf("; ");
690
691 if (rest_expression)
692 rest_expression->print();
693 printf(") ");
694
695 body->print();
696 break;
697
698 case ast_while:
699 printf("while ( ");
700 if (condition)
701 condition->print();
702 printf(") ");
703 body->print();
704 break;
705
706 case ast_do_while:
707 printf("do ");
708 body->print();
709 printf("while ( ");
710 if (condition)
711 condition->print();
712 printf("); ");
713 break;
714 }
715 }
716
717
718 ast_iteration_statement::ast_iteration_statement(int mode,
719 ast_node *init,
720 ast_node *condition,
721 ast_expression *rest_expression,
722 ast_node *body)
723 {
724 this->mode = ast_iteration_modes(mode);
725 this->init_statement = init;
726 this->condition = condition;
727 this->rest_expression = rest_expression;
728 this->body = body;
729 }
730
731
732 void
733 ast_struct_specifier::print(void) const
734 {
735 printf("struct %s { ", name);
736 foreach_list_const(n, &this->declarations) {
737 ast_node *ast = exec_node_data(ast_node, n, link);
738 ast->print();
739 }
740 printf("} ");
741 }
742
743
744 ast_struct_specifier::ast_struct_specifier(char *identifier,
745 ast_node *declarator_list)
746 {
747 if (identifier == NULL) {
748 static unsigned anon_count = 1;
749 identifier = ralloc_asprintf(this, "#anon_struct_%04x", anon_count);
750 anon_count++;
751 }
752 name = identifier;
753 this->declarations.push_degenerate_list_at_head(&declarator_list->link);
754 }
755
756 bool
757 do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations)
758 {
759 GLboolean progress = GL_FALSE;
760
761 progress = lower_instructions(ir, SUB_TO_ADD_NEG) || progress;
762
763 if (linked) {
764 progress = do_function_inlining(ir) || progress;
765 progress = do_dead_functions(ir) || progress;
766 }
767 progress = do_structure_splitting(ir) || progress;
768 progress = do_if_simplification(ir) || progress;
769 progress = do_discard_simplification(ir) || progress;
770 progress = do_copy_propagation(ir) || progress;
771 /*progress = do_copy_propagation_elements(ir) || progress;*/
772 if (linked)
773 progress = do_dead_code(ir) || progress;
774 else
775 progress = do_dead_code_unlinked(ir) || progress;
776 progress = do_dead_code_local(ir) || progress;
777 progress = do_tree_grafting(ir) || progress;
778 progress = do_constant_propagation(ir) || progress;
779 if (linked)
780 progress = do_constant_variable(ir) || progress;
781 else
782 progress = do_constant_variable_unlinked(ir) || progress;
783 progress = do_constant_folding(ir) || progress;
784 progress = do_algebraic(ir) || progress;
785 progress = do_lower_jumps(ir) || progress;
786 progress = do_vec_index_to_swizzle(ir) || progress;
787 progress = do_swizzle_swizzle(ir) || progress;
788 progress = do_noop_swizzle(ir) || progress;
789
790 progress = optimize_redundant_jumps(ir) || progress;
791
792 loop_state *ls = analyze_loop_variables(ir);
793 if (ls->loop_found) {
794 progress = set_loop_controls(ir, ls) || progress;
795 progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
796 }
797 delete ls;
798
799 return progress;
800 }
801
802 extern "C" {
803
804 /**
805 * To be called at GL teardown time, this frees compiler datastructures.
806 *
807 * After calling this, any previously compiled shaders and shader
808 * programs would be invalid. So this should happen at approximately
809 * program exit.
810 */
811 void
812 _mesa_destroy_shader_compiler(void)
813 {
814 _mesa_destroy_shader_compiler_caches();
815
816 _mesa_glsl_release_types();
817 }
818
819 /**
820 * Releases compiler caches to trade off performance for memory.
821 *
822 * Intended to be used with glReleaseShaderCompiler().
823 */
824 void
825 _mesa_destroy_shader_compiler_caches(void)
826 {
827 _mesa_glsl_release_functions();
828 }
829
830 }