1 diff -c -r Mesa-7.9/include/GL/gl.h MesaLib/include/GL/gl.h
2 *** Mesa-7.9/include/GL/gl.h Tue Apr 27 14:41:21 2010
3 --- MesaLib/include/GL/gl.h Thu Oct 14 14:41:53 2010
6 # if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
7 # define GLAPI __declspec(dllexport)
8 # elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
9 ! # define GLAPI __declspec(dllimport)
10 # else /* for use with static link lib build of Win32 edition only */
12 # endif /* _STATIC_MESA support */
14 # if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
15 # define GLAPI __declspec(dllexport)
16 # elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
17 ! // We always retrieve the entry points dynamically via GetProcAddress or
18 ! // OSMesaGetProcAddress. This works around an issue where using the MSVC
19 ! // multi-threaded runtime library, which defines _DLL.
20 ! //# define GLAPI __declspec(dllimport)
22 # else /* for use with static link lib build of Win32 edition only */
24 # endif /* _STATIC_MESA support */
28 #endif /* WIN32 && !CYGWIN */
30 ! #if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__)
31 ! # define PRAGMA_EXPORT_SUPPORTED 1
35 * WINDOWS: Include windows.h here to define APIENTRY.
38 #endif /* WIN32 && !CYGWIN */
40 ! // Disabled this because __QUICKDRAW__ is defined on Mac and gcc does not
41 ! // support the pragma.
42 ! //#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__)
43 ! //# define PRAGMA_EXPORT_SUPPORTED 1
47 * WINDOWS: Include windows.h here to define APIENTRY.
48 diff -c -r Mesa-7.9/include/GL/glext.h MesaLib/include/GL/glext.h
49 *** Mesa-7.9/include/GL/glext.h Fri Oct 1 15:51:28 2010
50 --- MesaLib/include/GL/glext.h Thu Oct 14 14:50:37 2010
54 #ifndef GL_VERSION_1_5
55 /* GL types for handling large vertex buffer objects */
56 ! typedef ptrdiff_t GLintptr;
57 ! typedef ptrdiff_t GLsizeiptr;
60 #ifndef GL_ARB_vertex_buffer_object
61 /* GL types for handling large vertex buffer objects */
62 ! typedef ptrdiff_t GLintptrARB;
63 ! typedef ptrdiff_t GLsizeiptrARB;
66 #ifndef GL_ARB_shader_objects
69 #ifndef GL_VERSION_1_5
70 /* GL types for handling large vertex buffer objects */
71 ! typedef signed long int GLintptr;
72 ! typedef signed long int GLsizeiptr;
75 #ifndef GL_ARB_vertex_buffer_object
76 /* GL types for handling large vertex buffer objects */
77 ! typedef signed long int GLintptrARB;
78 ! typedef signed long int GLsizeiptrARB;
81 #ifndef GL_ARB_shader_objects
82 diff -c -r Mesa-7.9/include/GL/osmesa.h MesaLib/include/GL/osmesa.h
83 *** Mesa-7.9/include/GL/osmesa.h Thu Feb 4 16:10:39 2010
84 --- MesaLib/include/GL/osmesa.h Thu Oct 14 14:47:08 2010
87 typedef struct osmesa_context *OSMesaContext;
90 ! #if defined(__BEOS__) || defined(__QUICKDRAW__)
97 typedef struct osmesa_context *OSMesaContext;
100 ! // Disabled this because __QUICKDRAW__ is defined on Mac and gcc does not
101 ! // support the pragma.
102 ! //#if defined(__BEOS__) || defined(__QUICKDRAW__)
103 ! //#pragma export on
110 OSMesaColorClamp(GLboolean enable);
113 ! #if defined(__BEOS__) || defined(__QUICKDRAW__)
120 OSMesaColorClamp(GLboolean enable);
123 ! // Disabled this because __QUICKDRAW__ is defined on Mac and gcc does not
124 ! // support the pragma.
125 ! //#if defined(__BEOS__) || defined(__QUICKDRAW__)
126 ! //#pragma export off
131 diff -c -r Mesa-7.9/src/glsl/ast_to_hir.cpp MesaLib/src/glsl/ast_to_hir.cpp
132 *** Mesa-7.9/src/glsl/ast_to_hir.cpp Fri Oct 1 15:51:28 2010
133 --- MesaLib/src/glsl/ast_to_hir.cpp Fri Oct 22 15:28:47 2010
138 #include "glsl_types.h"
140 + #include "safe_strcmp.h"
143 _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state)
146 var->pixel_center_integer = qual->pixel_center_integer;
147 var->origin_upper_left = qual->origin_upper_left;
148 if ((qual->origin_upper_left || qual->pixel_center_integer)
149 ! && (strcmp(var->name, "gl_FragCoord") != 0)) {
150 const char *const qual_string = (qual->origin_upper_left)
151 ? "origin_upper_left" : "pixel_center_integer";
154 var->pixel_center_integer = qual->pixel_center_integer;
155 var->origin_upper_left = qual->origin_upper_left;
156 if ((qual->origin_upper_left || qual->pixel_center_integer)
157 ! && (safe_strcmp(var->name, "gl_FragCoord") != 0)) {
158 const char *const qual_string = (qual->origin_upper_left)
159 ? "origin_upper_left" : "pixel_center_integer";
163 * gl_MaxTextureCoords."
165 const unsigned size = unsigned(var->type->array_size());
166 ! if ((strcmp("gl_TexCoord", var->name) == 0)
167 && (size > state->Const.MaxTextureCoords)) {
168 YYLTYPE loc = this->get_location();
171 * gl_MaxTextureCoords."
173 const unsigned size = unsigned(var->type->array_size());
174 ! if ((safe_strcmp("gl_TexCoord", var->name) == 0)
175 && (size > state->Const.MaxTextureCoords)) {
176 YYLTYPE loc = this->get_location();
182 } else if (state->extensions->ARB_fragment_coord_conventions
183 ! && strcmp(var->name, "gl_FragCoord") == 0
184 && earlier->type == var->type
185 && earlier->mode == var->mode) {
186 /* Allow redeclaration of gl_FragCoord for ARB_fcc layout
190 } else if (state->extensions->ARB_fragment_coord_conventions
191 ! && safe_strcmp(var->name, "gl_FragCoord") == 0
192 && earlier->type == var->type
193 && earlier->mode == var->mode) {
194 /* Allow redeclaration of gl_FragCoord for ARB_fcc layout
199 /* Verify the return type of main() */
200 ! if (strcmp(name, "main") == 0) {
201 if (! return_type->is_void()) {
202 YYLTYPE loc = this->get_location();
207 /* Verify the return type of main() */
208 ! if (safe_strcmp(name, "main") == 0) {
209 if (! return_type->is_void()) {
210 YYLTYPE loc = this->get_location();
212 diff -c -r Mesa-7.9/src/glsl/glcpp/glcpp-parse.c MesaLib/src/glsl/glcpp/glcpp-parse.c
213 *** Mesa-7.9/src/glsl/glcpp/glcpp-parse.c Fri Oct 1 15:51:28 2010
214 --- MesaLib/src/glsl/glcpp/glcpp-parse.c Fri Oct 22 15:30:59 2010
221 + /* The #include of inttypes.h causes problems on Windows */
223 #include <inttypes.h>
225 + /* Windows headers do not define PRIiMAX */
227 + #define PRIiMAX "I64i"
231 #include "main/core.h" /* for struct gl_extensions */
232 #include "main/mtypes.h" /* for gl_api enum */
233 + #include "safe_strcmp.h"
235 #define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str)
236 #define glcpp_printf(stream, fmt, args, ...) \
241 for (i = 0, node = list->head; node; i++, node = node->next) {
242 ! if (strcmp (node->str, member) == 0) {
249 for (i = 0, node = list->head; node; i++, node = node->next) {
250 ! if (safe_strcmp (node->str, member) == 0) {
257 node_a = node_a->next, node_b = node_b->next)
259 ! if (strcmp (node_a->str, node_b->str))
265 node_a = node_a->next, node_b = node_b->next)
267 ! if (safe_strcmp (node_a->str, node_b->str))
276 ! if (strcmp (node_a->token->value.str,
277 ! node_b->token->value.str))
285 ! if (safe_strcmp (node_a->token->value.str,
286 ! node_b->token->value.str))
294 for (node = list; node; node = node->next)
295 ! if (strcmp (node->identifier, identifier) == 0)
302 for (node = list; node; node = node->next)
303 ! if (safe_strcmp (node->identifier, identifier) == 0)
307 diff -c -r Mesa-7.9/src/glsl/glcpp/glcpp-parse.y MesaLib/src/glsl/glcpp/glcpp-parse.y
308 *** Mesa-7.9/src/glsl/glcpp/glcpp-parse.y Fri Oct 1 15:51:28 2010
309 --- MesaLib/src/glsl/glcpp/glcpp-parse.y Fri Oct 22 15:30:47 2010
316 + /* The #include of inttypes.h causes problems on Windows */
318 #include <inttypes.h>
320 + /* Windows headers do not define PRIiMAX */
322 + #define PRIiMAX "I64i"
326 #include "main/core.h" /* for struct gl_extensions */
327 #include "main/mtypes.h" /* for gl_api enum */
328 + #include "safe_strcmp.h"
330 #define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str)
331 #define glcpp_printf(stream, fmt, args, ...) \
336 for (i = 0, node = list->head; node; i++, node = node->next) {
337 ! if (strcmp (node->str, member) == 0) {
344 for (i = 0, node = list->head; node; i++, node = node->next) {
345 ! if (safe_strcmp (node->str, member) == 0) {
352 node_a = node_a->next, node_b = node_b->next)
354 ! if (strcmp (node_a->str, node_b->str))
360 node_a = node_a->next, node_b = node_b->next)
362 ! if (safe_strcmp (node_a->str, node_b->str))
371 ! if (strcmp (node_a->token->value.str,
372 ! node_b->token->value.str))
380 ! if (safe_strcmp (node_a->token->value.str,
381 ! node_b->token->value.str))
389 for (node = list; node; node = node->next)
390 ! if (strcmp (node->identifier, identifier) == 0)
397 for (node = list; node; node = node->next)
398 ! if (safe_strcmp (node->identifier, identifier) == 0)
402 diff -c -r Mesa-7.9/src/glsl/glcpp/glcpp.c MesaLib/src/glsl/glcpp/glcpp.c
403 *** Mesa-7.9/src/glsl/glcpp/glcpp.c Fri Oct 1 15:51:28 2010
404 --- MesaLib/src/glsl/glcpp/glcpp.c Fri Oct 22 15:31:25 2010
410 #include "main/mtypes.h"
411 + #include "safe_strcmp.h"
420 ! if (filename == NULL || strcmp (filename, "-") == 0)
421 return load_text_fd (ctx, STDIN_FILENO);
423 fd = open (filename, O_RDONLY);
428 ! if (filename == NULL || safe_strcmp (filename, "-") == 0)
429 return load_text_fd (ctx, STDIN_FILENO);
431 fd = open (filename, O_RDONLY);
432 diff -c -r Mesa-7.9/src/glsl/glcpp/glcpp.h MesaLib/src/glsl/glcpp/glcpp.h
433 *** Mesa-7.9/src/glsl/glcpp/glcpp.h Fri Oct 1 15:51:28 2010
434 --- MesaLib/src/glsl/glcpp/glcpp.h Fri Oct 22 15:32:43 2010
441 + /* Windows does not currently have stdint.h. */
452 typedef union YYSTYPE
460 string_list_t *string_list;
462 diff -c -r Mesa-7.9/src/glsl/glsl_parser.cpp MesaLib/src/glsl/glsl_parser.cpp
463 *** Mesa-7.9/src/glsl/glsl_parser.cpp Fri Oct 1 15:51:28 2010
464 --- MesaLib/src/glsl/glsl_parser.cpp Fri Oct 22 15:33:24 2010
469 #include "glsl_parser_extras.h"
470 #include "glsl_types.h"
471 + #include "safe_strcmp.h"
473 #define YYLEX_PARAM state->scanner
477 if (state->ARB_fragment_coord_conventions_enable) {
478 bool got_one = false;
480 ! if (strcmp((yyvsp[(1) - (1)].identifier), "origin_upper_left") == 0) {
482 (yyval.type_qualifier).q.origin_upper_left = 1;
483 ! } else if (strcmp((yyvsp[(1) - (1)].identifier), "pixel_center_integer") == 0) {
485 (yyval.type_qualifier).q.pixel_center_integer = 1;
488 if (state->ARB_fragment_coord_conventions_enable) {
489 bool got_one = false;
491 ! if (safe_strcmp((yyvsp[(1) - (1)].identifier), "origin_upper_left") == 0) {
493 (yyval.type_qualifier).q.origin_upper_left = 1;
494 ! } else if (safe_strcmp((yyvsp[(1) - (1)].identifier), "pixel_center_integer") == 0) {
496 (yyval.type_qualifier).q.pixel_center_integer = 1;
498 diff -c -r Mesa-7.9/src/glsl/glsl_parser_extras.cpp MesaLib/src/glsl/glsl_parser_extras.cpp
499 *** Mesa-7.9/src/glsl/glsl_parser_extras.cpp Fri Oct 1 15:51:28 2010
500 --- MesaLib/src/glsl/glsl_parser_extras.cpp Fri Oct 22 15:33:37 2010
504 #include "glsl_parser.h"
505 #include "ir_optimization.h"
506 #include "loop_analysis.h"
507 + #include "safe_strcmp.h"
509 _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx,
510 GLenum target, void *mem_ctx)
516 ! if (strcmp(behavior, "warn") == 0) {
517 ext_mode = extension_warn;
518 ! } else if (strcmp(behavior, "require") == 0) {
519 ext_mode = extension_require;
520 ! } else if (strcmp(behavior, "enable") == 0) {
521 ext_mode = extension_enable;
522 ! } else if (strcmp(behavior, "disable") == 0) {
523 ext_mode = extension_disable;
525 _mesa_glsl_error(behavior_locp, state,
530 ! if (safe_strcmp(behavior, "warn") == 0) {
531 ext_mode = extension_warn;
532 ! } else if (safe_strcmp(behavior, "require") == 0) {
533 ext_mode = extension_require;
534 ! } else if (safe_strcmp(behavior, "enable") == 0) {
535 ext_mode = extension_enable;
536 ! } else if (safe_strcmp(behavior, "disable") == 0) {
537 ext_mode = extension_disable;
539 _mesa_glsl_error(behavior_locp, state,
543 bool unsupported = false;
545 ! if (strcmp(name, "all") == 0) {
546 if ((ext_mode == extension_enable) || (ext_mode == extension_require)) {
547 _mesa_glsl_error(name_locp, state, "Cannot %s all extensions",
548 (ext_mode == extension_enable)
549 ? "enable" : "require");
552 ! } else if (strcmp(name, "GL_ARB_draw_buffers") == 0) {
553 /* This extension is only supported in fragment shaders.
555 if (state->target != fragment_shader) {
558 bool unsupported = false;
560 ! if (safe_strcmp(name, "all") == 0) {
561 if ((ext_mode == extension_enable) || (ext_mode == extension_require)) {
562 _mesa_glsl_error(name_locp, state, "Cannot %s all extensions",
563 (ext_mode == extension_enable)
564 ? "enable" : "require");
567 ! } else if (safe_strcmp(name, "GL_ARB_draw_buffers") == 0) {
568 /* This extension is only supported in fragment shaders.
570 if (state->target != fragment_shader) {
573 state->ARB_draw_buffers_enable = (ext_mode != extension_disable);
574 state->ARB_draw_buffers_warn = (ext_mode == extension_warn);
576 ! } else if (strcmp(name, "GL_ARB_fragment_coord_conventions") == 0) {
577 state->ARB_fragment_coord_conventions_enable =
578 (ext_mode != extension_disable);
579 state->ARB_fragment_coord_conventions_warn =
580 (ext_mode == extension_warn);
582 unsupported = !state->extensions->ARB_fragment_coord_conventions;
583 ! } else if (strcmp(name, "GL_ARB_texture_rectangle") == 0) {
584 state->ARB_texture_rectangle_enable = (ext_mode != extension_disable);
585 state->ARB_texture_rectangle_warn = (ext_mode == extension_warn);
586 ! } else if (strcmp(name, "GL_EXT_texture_array") == 0) {
587 state->EXT_texture_array_enable = (ext_mode != extension_disable);
588 state->EXT_texture_array_warn = (ext_mode == extension_warn);
591 state->ARB_draw_buffers_enable = (ext_mode != extension_disable);
592 state->ARB_draw_buffers_warn = (ext_mode == extension_warn);
594 ! } else if (safe_strcmp(name, "GL_ARB_fragment_coord_conventions") == 0) {
595 state->ARB_fragment_coord_conventions_enable =
596 (ext_mode != extension_disable);
597 state->ARB_fragment_coord_conventions_warn =
598 (ext_mode == extension_warn);
600 unsupported = !state->extensions->ARB_fragment_coord_conventions;
601 ! } else if (safe_strcmp(name, "GL_ARB_texture_rectangle") == 0) {
602 state->ARB_texture_rectangle_enable = (ext_mode != extension_disable);
603 state->ARB_texture_rectangle_warn = (ext_mode == extension_warn);
604 ! } else if (safe_strcmp(name, "GL_EXT_texture_array") == 0) {
605 state->EXT_texture_array_enable = (ext_mode != extension_disable);
606 state->EXT_texture_array_warn = (ext_mode == extension_warn);
608 diff -c -r Mesa-7.9/src/glsl/glsl_types.cpp MesaLib/src/glsl/glsl_types.cpp
609 *** Mesa-7.9/src/glsl/glsl_types.cpp Fri Oct 1 15:51:28 2010
610 --- MesaLib/src/glsl/glsl_types.cpp Fri Oct 22 15:33:51 2010
614 #include "glsl_symbol_table.h"
615 #include "glsl_parser_extras.h"
616 #include "glsl_types.h"
617 + #include "safe_strcmp.h"
618 #include "builtin_types.h"
620 #include "program/hash_table.h"
623 /* Return zero is the types match (there is zero difference) or non-zero
626 ! if (strcmp(key1->name, key2->name) != 0)
629 if (key1->length != key2->length)
631 /* Return zero is the types match (there is zero difference) or non-zero
634 ! if (safe_strcmp(key1->name, key2->name) != 0)
637 if (key1->length != key2->length)
640 for (unsigned i = 0; i < key1->length; i++) {
641 if (key1->fields.structure[i].type != key2->fields.structure[i].type)
643 ! if (strcmp(key1->fields.structure[i].name,
644 key2->fields.structure[i].name) != 0)
648 for (unsigned i = 0; i < key1->length; i++) {
649 if (key1->fields.structure[i].type != key2->fields.structure[i].type)
651 ! if (safe_strcmp(key1->fields.structure[i].name,
652 key2->fields.structure[i].name) != 0)
658 assert(t->base_type == GLSL_TYPE_STRUCT);
659 assert(t->length == num_fields);
660 ! assert(strcmp(t->name, name) == 0);
666 assert(t->base_type == GLSL_TYPE_STRUCT);
667 assert(t->length == num_fields);
668 ! assert(safe_strcmp(t->name, name) == 0);
676 for (unsigned i = 0; i < this->length; i++) {
677 ! if (strcmp(name, this->fields.structure[i].name) == 0)
678 return this->fields.structure[i].type;
684 for (unsigned i = 0; i < this->length; i++) {
685 ! if (safe_strcmp(name, this->fields.structure[i].name) == 0)
686 return this->fields.structure[i].type;
693 for (unsigned i = 0; i < this->length; i++) {
694 ! if (strcmp(name, this->fields.structure[i].name) == 0)
701 for (unsigned i = 0; i < this->length; i++) {
702 ! if (safe_strcmp(name, this->fields.structure[i].name) == 0)
706 diff -c -r Mesa-7.9/src/glsl/hir_field_selection.cpp MesaLib/src/glsl/hir_field_selection.cpp
707 *** Mesa-7.9/src/glsl/hir_field_selection.cpp Fri Oct 1 15:51:28 2010
708 --- MesaLib/src/glsl/hir_field_selection.cpp Fri Oct 22 15:34:11 2010
712 #include "glsl_parser_extras.h"
714 #include "glsl_types.h"
715 + #include "safe_strcmp.h"
718 _mesa_ast_field_selection_to_hir(const ast_expression *expr,
722 method = call->subexpressions[0]->primary_expression.identifier;
724 ! if (op->type->is_array() && strcmp(method, "length") == 0) {
725 if (!call->expressions.is_empty())
726 _mesa_glsl_error(&loc, state, "length method takes no arguments.");
730 method = call->subexpressions[0]->primary_expression.identifier;
732 ! if (op->type->is_array() && safe_strcmp(method, "length") == 0) {
733 if (!call->expressions.is_empty())
734 _mesa_glsl_error(&loc, state, "length method takes no arguments.");
736 diff -c -r Mesa-7.9/src/glsl/ir.cpp MesaLib/src/glsl/ir.cpp
737 *** Mesa-7.9/src/glsl/ir.cpp Fri Oct 1 15:51:28 2010
738 --- MesaLib/src/glsl/ir.cpp Fri Oct 22 15:34:20 2010
743 #include "ir_visitor.h"
744 #include "glsl_types.h"
745 + #include "safe_strcmp.h"
747 ir_rvalue::ir_rvalue()
752 const int operator_count = sizeof(operator_strs) / sizeof(operator_strs[0]);
753 for (int op = 0; op < operator_count; op++) {
754 ! if (strcmp(str, operator_strs[op]) == 0)
755 return (ir_expression_operation) op;
757 return (ir_expression_operation) -1;
760 const int operator_count = sizeof(operator_strs) / sizeof(operator_strs[0]);
761 for (int op = 0; op < operator_count; op++) {
762 ! if (safe_strcmp(str, operator_strs[op]) == 0)
763 return (ir_expression_operation) op;
765 return (ir_expression_operation) -1;
769 const int count = sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0]);
770 for (int op = 0; op < count; op++) {
771 ! if (strcmp(str, tex_opcode_strs[op]) == 0)
772 return (ir_texture_opcode) op;
774 return (ir_texture_opcode) -1;
777 const int count = sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0]);
778 for (int op = 0; op < count; op++) {
779 ! if (safe_strcmp(str, tex_opcode_strs[op]) == 0)
780 return (ir_texture_opcode) op;
782 return (ir_texture_opcode) -1;
783 diff -c -r Mesa-7.9/src/glsl/ir_constant_expression.cpp MesaLib/src/glsl/ir_constant_expression.cpp
784 *** Mesa-7.9/src/glsl/ir_constant_expression.cpp Fri Oct 1 15:51:28 2010
785 --- MesaLib/src/glsl/ir_constant_expression.cpp Fri Oct 22 15:34:40 2010
790 #include "ir_visitor.h"
791 #include "glsl_types.h"
792 + #include "safe_strcmp.h"
795 dot(ir_constant *op0, ir_constant *op1)
798 memset(&data, 0, sizeof(data));
800 const char *callee = this->callee_name();
801 ! if (strcmp(callee, "abs") == 0) {
802 expr = new(mem_ctx) ir_expression(ir_unop_abs, type, op[0], NULL);
803 ! } else if (strcmp(callee, "all") == 0) {
804 assert(op[0]->type->is_boolean());
805 for (unsigned c = 0; c < op[0]->type->components(); c++) {
806 if (!op[0]->value.b[c])
807 return new(mem_ctx) ir_constant(false);
809 return new(mem_ctx) ir_constant(true);
810 ! } else if (strcmp(callee, "any") == 0) {
811 assert(op[0]->type->is_boolean());
812 for (unsigned c = 0; c < op[0]->type->components(); c++) {
813 if (op[0]->value.b[c])
814 return new(mem_ctx) ir_constant(true);
816 return new(mem_ctx) ir_constant(false);
817 ! } else if (strcmp(callee, "acos") == 0) {
818 assert(op[0]->type->is_float());
819 for (unsigned c = 0; c < op[0]->type->components(); c++)
820 data.f[c] = acosf(op[0]->value.f[c]);
821 ! } else if (strcmp(callee, "asin") == 0) {
822 assert(op[0]->type->is_float());
823 for (unsigned c = 0; c < op[0]->type->components(); c++)
824 data.f[c] = asinf(op[0]->value.f[c]);
825 ! } else if (strcmp(callee, "atan") == 0) {
826 assert(op[0]->type->is_float());
827 if (num_parameters == 2) {
828 assert(op[1]->type->is_float());
830 memset(&data, 0, sizeof(data));
832 const char *callee = this->callee_name();
833 ! if (safe_strcmp(callee, "abs") == 0) {
834 expr = new(mem_ctx) ir_expression(ir_unop_abs, type, op[0], NULL);
835 ! } else if (safe_strcmp(callee, "all") == 0) {
836 assert(op[0]->type->is_boolean());
837 for (unsigned c = 0; c < op[0]->type->components(); c++) {
838 if (!op[0]->value.b[c])
839 return new(mem_ctx) ir_constant(false);
841 return new(mem_ctx) ir_constant(true);
842 ! } else if (safe_strcmp(callee, "any") == 0) {
843 assert(op[0]->type->is_boolean());
844 for (unsigned c = 0; c < op[0]->type->components(); c++) {
845 if (op[0]->value.b[c])
846 return new(mem_ctx) ir_constant(true);
848 return new(mem_ctx) ir_constant(false);
849 ! } else if (safe_strcmp(callee, "acos") == 0) {
850 assert(op[0]->type->is_float());
851 for (unsigned c = 0; c < op[0]->type->components(); c++)
852 data.f[c] = acosf(op[0]->value.f[c]);
853 ! } else if (safe_strcmp(callee, "asin") == 0) {
854 assert(op[0]->type->is_float());
855 for (unsigned c = 0; c < op[0]->type->components(); c++)
856 data.f[c] = asinf(op[0]->value.f[c]);
857 ! } else if (safe_strcmp(callee, "atan") == 0) {
858 assert(op[0]->type->is_float());
859 if (num_parameters == 2) {
860 assert(op[1]->type->is_float());
863 for (unsigned c = 0; c < op[0]->type->components(); c++)
864 data.f[c] = atanf(op[0]->value.f[c]);
866 ! } else if (strcmp(callee, "dFdx") == 0 || strcmp(callee, "dFdy") == 0) {
867 return ir_constant::zero(mem_ctx, this->type);
868 ! } else if (strcmp(callee, "ceil") == 0) {
869 expr = new(mem_ctx) ir_expression(ir_unop_ceil, type, op[0], NULL);
870 ! } else if (strcmp(callee, "clamp") == 0) {
871 assert(num_parameters == 3);
872 unsigned c1_inc = op[1]->type->is_scalar() ? 0 : 1;
873 unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1;
875 for (unsigned c = 0; c < op[0]->type->components(); c++)
876 data.f[c] = atanf(op[0]->value.f[c]);
878 ! } else if (safe_strcmp(callee, "dFdx") == 0 || safe_strcmp(callee, "dFdy") == 0) {
879 return ir_constant::zero(mem_ctx, this->type);
880 ! } else if (safe_strcmp(callee, "ceil") == 0) {
881 expr = new(mem_ctx) ir_expression(ir_unop_ceil, type, op[0], NULL);
882 ! } else if (safe_strcmp(callee, "clamp") == 0) {
883 assert(num_parameters == 3);
884 unsigned c1_inc = op[1]->type->is_scalar() ? 0 : 1;
885 unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1;
888 assert(!"Should not get here.");
891 ! } else if (strcmp(callee, "cos") == 0) {
892 expr = new(mem_ctx) ir_expression(ir_unop_cos, type, op[0], NULL);
893 ! } else if (strcmp(callee, "cosh") == 0) {
894 assert(op[0]->type->is_float());
895 for (unsigned c = 0; c < op[0]->type->components(); c++)
896 data.f[c] = coshf(op[0]->value.f[c]);
897 ! } else if (strcmp(callee, "cross") == 0) {
898 expr = new(mem_ctx) ir_expression(ir_binop_cross, type, op[0], op[1]);
899 ! } else if (strcmp(callee, "degrees") == 0) {
900 assert(op[0]->type->is_float());
901 for (unsigned c = 0; c < op[0]->type->components(); c++)
902 data.f[c] = 180.0/M_PI * op[0]->value.f[c];
903 ! } else if (strcmp(callee, "distance") == 0) {
904 assert(op[0]->type->is_float() && op[1]->type->is_float());
905 float length_squared = 0.0;
906 for (unsigned c = 0; c < op[0]->type->components(); c++) {
908 assert(!"Should not get here.");
911 ! } else if (safe_strcmp(callee, "cos") == 0) {
912 expr = new(mem_ctx) ir_expression(ir_unop_cos, type, op[0], NULL);
913 ! } else if (safe_strcmp(callee, "cosh") == 0) {
914 assert(op[0]->type->is_float());
915 for (unsigned c = 0; c < op[0]->type->components(); c++)
916 data.f[c] = coshf(op[0]->value.f[c]);
917 ! } else if (safe_strcmp(callee, "cross") == 0) {
918 expr = new(mem_ctx) ir_expression(ir_binop_cross, type, op[0], op[1]);
919 ! } else if (safe_strcmp(callee, "degrees") == 0) {
920 assert(op[0]->type->is_float());
921 for (unsigned c = 0; c < op[0]->type->components(); c++)
922 data.f[c] = 180.0/M_PI * op[0]->value.f[c];
923 ! } else if (safe_strcmp(callee, "distance") == 0) {
924 assert(op[0]->type->is_float() && op[1]->type->is_float());
925 float length_squared = 0.0;
926 for (unsigned c = 0; c < op[0]->type->components(); c++) {
929 length_squared += t * t;
931 return new(mem_ctx) ir_constant(sqrtf(length_squared));
932 ! } else if (strcmp(callee, "dot") == 0) {
933 return new(mem_ctx) ir_constant(dot(op[0], op[1]));
934 ! } else if (strcmp(callee, "equal") == 0) {
935 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
936 for (unsigned c = 0; c < op[0]->type->components(); c++) {
937 switch (op[0]->type->base_type) {
939 length_squared += t * t;
941 return new(mem_ctx) ir_constant(sqrtf(length_squared));
942 ! } else if (safe_strcmp(callee, "dot") == 0) {
943 return new(mem_ctx) ir_constant(dot(op[0], op[1]));
944 ! } else if (safe_strcmp(callee, "equal") == 0) {
945 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
946 for (unsigned c = 0; c < op[0]->type->components(); c++) {
947 switch (op[0]->type->base_type) {
950 assert(!"Should not get here.");
953 ! } else if (strcmp(callee, "exp") == 0) {
954 expr = new(mem_ctx) ir_expression(ir_unop_exp, type, op[0], NULL);
955 ! } else if (strcmp(callee, "exp2") == 0) {
956 expr = new(mem_ctx) ir_expression(ir_unop_exp2, type, op[0], NULL);
957 ! } else if (strcmp(callee, "faceforward") == 0) {
958 if (dot(op[2], op[1]) < 0)
960 for (unsigned c = 0; c < op[0]->type->components(); c++)
961 data.f[c] = -op[0]->value.f[c];
962 ! } else if (strcmp(callee, "floor") == 0) {
963 expr = new(mem_ctx) ir_expression(ir_unop_floor, type, op[0], NULL);
964 ! } else if (strcmp(callee, "fract") == 0) {
965 expr = new(mem_ctx) ir_expression(ir_unop_fract, type, op[0], NULL);
966 ! } else if (strcmp(callee, "fwidth") == 0) {
967 return ir_constant::zero(mem_ctx, this->type);
968 ! } else if (strcmp(callee, "greaterThan") == 0) {
969 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
970 for (unsigned c = 0; c < op[0]->type->components(); c++) {
971 switch (op[0]->type->base_type) {
973 assert(!"Should not get here.");
976 ! } else if (safe_strcmp(callee, "exp") == 0) {
977 expr = new(mem_ctx) ir_expression(ir_unop_exp, type, op[0], NULL);
978 ! } else if (safe_strcmp(callee, "exp2") == 0) {
979 expr = new(mem_ctx) ir_expression(ir_unop_exp2, type, op[0], NULL);
980 ! } else if (safe_strcmp(callee, "faceforward") == 0) {
981 if (dot(op[2], op[1]) < 0)
983 for (unsigned c = 0; c < op[0]->type->components(); c++)
984 data.f[c] = -op[0]->value.f[c];
985 ! } else if (safe_strcmp(callee, "floor") == 0) {
986 expr = new(mem_ctx) ir_expression(ir_unop_floor, type, op[0], NULL);
987 ! } else if (safe_strcmp(callee, "fract") == 0) {
988 expr = new(mem_ctx) ir_expression(ir_unop_fract, type, op[0], NULL);
989 ! } else if (safe_strcmp(callee, "fwidth") == 0) {
990 return ir_constant::zero(mem_ctx, this->type);
991 ! } else if (safe_strcmp(callee, "greaterThan") == 0) {
992 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
993 for (unsigned c = 0; c < op[0]->type->components(); c++) {
994 switch (op[0]->type->base_type) {
997 assert(!"Should not get here.");
1000 ! } else if (strcmp(callee, "greaterThanEqual") == 0) {
1001 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
1002 for (unsigned c = 0; c < op[0]->type->components(); c++) {
1003 switch (op[0]->type->base_type) {
1005 assert(!"Should not get here.");
1008 ! } else if (safe_strcmp(callee, "greaterThanEqual") == 0) {
1009 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
1010 for (unsigned c = 0; c < op[0]->type->components(); c++) {
1011 switch (op[0]->type->base_type) {
1014 assert(!"Should not get here.");
1017 ! } else if (strcmp(callee, "inversesqrt") == 0) {
1018 expr = new(mem_ctx) ir_expression(ir_unop_rsq, type, op[0], NULL);
1019 ! } else if (strcmp(callee, "length") == 0) {
1020 return new(mem_ctx) ir_constant(sqrtf(dot(op[0], op[0])));
1021 ! } else if (strcmp(callee, "lessThan") == 0) {
1022 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
1023 for (unsigned c = 0; c < op[0]->type->components(); c++) {
1024 switch (op[0]->type->base_type) {
1026 assert(!"Should not get here.");
1029 ! } else if (safe_strcmp(callee, "inversesqrt") == 0) {
1030 expr = new(mem_ctx) ir_expression(ir_unop_rsq, type, op[0], NULL);
1031 ! } else if (safe_strcmp(callee, "length") == 0) {
1032 return new(mem_ctx) ir_constant(sqrtf(dot(op[0], op[0])));
1033 ! } else if (safe_strcmp(callee, "lessThan") == 0) {
1034 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
1035 for (unsigned c = 0; c < op[0]->type->components(); c++) {
1036 switch (op[0]->type->base_type) {
1039 assert(!"Should not get here.");
1042 ! } else if (strcmp(callee, "lessThanEqual") == 0) {
1043 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
1044 for (unsigned c = 0; c < op[0]->type->components(); c++) {
1045 switch (op[0]->type->base_type) {
1047 assert(!"Should not get here.");
1050 ! } else if (safe_strcmp(callee, "lessThanEqual") == 0) {
1051 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
1052 for (unsigned c = 0; c < op[0]->type->components(); c++) {
1053 switch (op[0]->type->base_type) {
1056 assert(!"Should not get here.");
1059 ! } else if (strcmp(callee, "log") == 0) {
1060 expr = new(mem_ctx) ir_expression(ir_unop_log, type, op[0], NULL);
1061 ! } else if (strcmp(callee, "log2") == 0) {
1062 expr = new(mem_ctx) ir_expression(ir_unop_log2, type, op[0], NULL);
1063 ! } else if (strcmp(callee, "matrixCompMult") == 0) {
1064 assert(op[0]->type->is_float() && op[1]->type->is_float());
1065 for (unsigned c = 0; c < op[0]->type->components(); c++)
1066 data.f[c] = op[0]->value.f[c] * op[1]->value.f[c];
1067 ! } else if (strcmp(callee, "max") == 0) {
1068 expr = new(mem_ctx) ir_expression(ir_binop_max, type, op[0], op[1]);
1069 ! } else if (strcmp(callee, "min") == 0) {
1070 expr = new(mem_ctx) ir_expression(ir_binop_min, type, op[0], op[1]);
1071 ! } else if (strcmp(callee, "mix") == 0) {
1072 assert(op[0]->type->is_float() && op[1]->type->is_float());
1073 if (op[2]->type->is_float()) {
1074 unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1;
1076 assert(!"Should not get here.");
1079 ! } else if (safe_strcmp(callee, "log") == 0) {
1080 expr = new(mem_ctx) ir_expression(ir_unop_log, type, op[0], NULL);
1081 ! } else if (safe_strcmp(callee, "log2") == 0) {
1082 expr = new(mem_ctx) ir_expression(ir_unop_log2, type, op[0], NULL);
1083 ! } else if (safe_strcmp(callee, "matrixCompMult") == 0) {
1084 assert(op[0]->type->is_float() && op[1]->type->is_float());
1085 for (unsigned c = 0; c < op[0]->type->components(); c++)
1086 data.f[c] = op[0]->value.f[c] * op[1]->value.f[c];
1087 ! } else if (safe_strcmp(callee, "max") == 0) {
1088 expr = new(mem_ctx) ir_expression(ir_binop_max, type, op[0], op[1]);
1089 ! } else if (safe_strcmp(callee, "min") == 0) {
1090 expr = new(mem_ctx) ir_expression(ir_binop_min, type, op[0], op[1]);
1091 ! } else if (safe_strcmp(callee, "mix") == 0) {
1092 assert(op[0]->type->is_float() && op[1]->type->is_float());
1093 if (op[2]->type->is_float()) {
1094 unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1;
1097 for (unsigned c = 0; c < op[0]->type->components(); c++)
1098 data.f[c] = op[op[2]->value.b[c] ? 1 : 0]->value.f[c];
1100 ! } else if (strcmp(callee, "mod") == 0) {
1101 expr = new(mem_ctx) ir_expression(ir_binop_mod, type, op[0], op[1]);
1102 ! } else if (strcmp(callee, "normalize") == 0) {
1103 assert(op[0]->type->is_float());
1104 float length = sqrtf(dot(op[0], op[0]));
1107 for (unsigned c = 0; c < op[0]->type->components(); c++)
1108 data.f[c] = op[op[2]->value.b[c] ? 1 : 0]->value.f[c];
1110 ! } else if (safe_strcmp(callee, "mod") == 0) {
1111 expr = new(mem_ctx) ir_expression(ir_binop_mod, type, op[0], op[1]);
1112 ! } else if (safe_strcmp(callee, "normalize") == 0) {
1113 assert(op[0]->type->is_float());
1114 float length = sqrtf(dot(op[0], op[0]));
1119 for (unsigned c = 0; c < op[0]->type->components(); c++)
1120 data.f[c] = op[0]->value.f[c] / length;
1121 ! } else if (strcmp(callee, "not") == 0) {
1122 expr = new(mem_ctx) ir_expression(ir_unop_logic_not, type, op[0], NULL);
1123 ! } else if (strcmp(callee, "notEqual") == 0) {
1124 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
1125 for (unsigned c = 0; c < op[0]->type->components(); c++) {
1126 switch (op[0]->type->base_type) {
1129 for (unsigned c = 0; c < op[0]->type->components(); c++)
1130 data.f[c] = op[0]->value.f[c] / length;
1131 ! } else if (safe_strcmp(callee, "not") == 0) {
1132 expr = new(mem_ctx) ir_expression(ir_unop_logic_not, type, op[0], NULL);
1133 ! } else if (safe_strcmp(callee, "notEqual") == 0) {
1134 assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector());
1135 for (unsigned c = 0; c < op[0]->type->components(); c++) {
1136 switch (op[0]->type->base_type) {
1139 assert(!"Should not get here.");
1142 ! } else if (strcmp(callee, "outerProduct") == 0) {
1143 assert(op[0]->type->is_vector() && op[1]->type->is_vector());
1144 const unsigned m = op[0]->type->vector_elements;
1145 const unsigned n = op[1]->type->vector_elements;
1147 assert(!"Should not get here.");
1150 ! } else if (safe_strcmp(callee, "outerProduct") == 0) {
1151 assert(op[0]->type->is_vector() && op[1]->type->is_vector());
1152 const unsigned m = op[0]->type->vector_elements;
1153 const unsigned n = op[1]->type->vector_elements;
1156 data.f[i+m*j] = op[0]->value.f[i] * op[1]->value.f[j];
1159 ! } else if (strcmp(callee, "pow") == 0) {
1160 expr = new(mem_ctx) ir_expression(ir_binop_pow, type, op[0], op[1]);
1161 ! } else if (strcmp(callee, "radians") == 0) {
1162 assert(op[0]->type->is_float());
1163 for (unsigned c = 0; c < op[0]->type->components(); c++)
1164 data.f[c] = M_PI/180.0 * op[0]->value.f[c];
1165 ! } else if (strcmp(callee, "reflect") == 0) {
1166 assert(op[0]->type->is_float());
1167 float dot_NI = dot(op[1], op[0]);
1168 for (unsigned c = 0; c < op[0]->type->components(); c++)
1169 data.f[c] = op[0]->value.f[c] - 2 * dot_NI * op[1]->value.f[c];
1170 ! } else if (strcmp(callee, "refract") == 0) {
1171 const float eta = op[2]->value.f[0];
1172 const float dot_NI = dot(op[1], op[0]);
1173 const float k = 1.0 - eta * eta * (1.0 - dot_NI * dot_NI);
1175 data.f[i+m*j] = op[0]->value.f[i] * op[1]->value.f[j];
1178 ! } else if (safe_strcmp(callee, "pow") == 0) {
1179 expr = new(mem_ctx) ir_expression(ir_binop_pow, type, op[0], op[1]);
1180 ! } else if (safe_strcmp(callee, "radians") == 0) {
1181 assert(op[0]->type->is_float());
1182 for (unsigned c = 0; c < op[0]->type->components(); c++)
1183 data.f[c] = M_PI/180.0 * op[0]->value.f[c];
1184 ! } else if (safe_strcmp(callee, "reflect") == 0) {
1185 assert(op[0]->type->is_float());
1186 float dot_NI = dot(op[1], op[0]);
1187 for (unsigned c = 0; c < op[0]->type->components(); c++)
1188 data.f[c] = op[0]->value.f[c] - 2 * dot_NI * op[1]->value.f[c];
1189 ! } else if (safe_strcmp(callee, "refract") == 0) {
1190 const float eta = op[2]->value.f[0];
1191 const float dot_NI = dot(op[1], op[0]);
1192 const float k = 1.0 - eta * eta * (1.0 - dot_NI * dot_NI);
1195 * op[1]->value.f[c];
1198 ! } else if (strcmp(callee, "sign") == 0) {
1199 expr = new(mem_ctx) ir_expression(ir_unop_sign, type, op[0], NULL);
1200 ! } else if (strcmp(callee, "sin") == 0) {
1201 expr = new(mem_ctx) ir_expression(ir_unop_sin, type, op[0], NULL);
1202 ! } else if (strcmp(callee, "sinh") == 0) {
1203 assert(op[0]->type->is_float());
1204 for (unsigned c = 0; c < op[0]->type->components(); c++)
1205 data.f[c] = sinhf(op[0]->value.f[c]);
1206 ! } else if (strcmp(callee, "smoothstep") == 0) {
1207 assert(num_parameters == 3);
1208 assert(op[1]->type == op[0]->type);
1209 unsigned edge_inc = op[0]->type->is_scalar() ? 0 : 1;
1211 * op[1]->value.f[c];
1214 ! } else if (safe_strcmp(callee, "sign") == 0) {
1215 expr = new(mem_ctx) ir_expression(ir_unop_sign, type, op[0], NULL);
1216 ! } else if (safe_strcmp(callee, "sin") == 0) {
1217 expr = new(mem_ctx) ir_expression(ir_unop_sin, type, op[0], NULL);
1218 ! } else if (safe_strcmp(callee, "sinh") == 0) {
1219 assert(op[0]->type->is_float());
1220 for (unsigned c = 0; c < op[0]->type->components(); c++)
1221 data.f[c] = sinhf(op[0]->value.f[c]);
1222 ! } else if (safe_strcmp(callee, "smoothstep") == 0) {
1223 assert(num_parameters == 3);
1224 assert(op[1]->type == op[0]->type);
1225 unsigned edge_inc = op[0]->type->is_scalar() ? 0 : 1;
1228 data.f[c] = t * t * (3 - 2 * t);
1231 ! } else if (strcmp(callee, "sqrt") == 0) {
1232 expr = new(mem_ctx) ir_expression(ir_unop_sqrt, type, op[0], NULL);
1233 ! } else if (strcmp(callee, "step") == 0) {
1234 assert(op[0]->type->is_float() && op[1]->type->is_float());
1235 /* op[0] (edge) may be either a scalar or a vector */
1236 const unsigned c0_inc = op[0]->type->is_scalar() ? 0 : 1;
1237 for (unsigned c = 0, c0 = 0; c < type->components(); c0 += c0_inc, c++)
1238 data.f[c] = (op[1]->value.f[c] < op[0]->value.f[c0]) ? 0.0 : 1.0;
1239 ! } else if (strcmp(callee, "tan") == 0) {
1240 assert(op[0]->type->is_float());
1241 for (unsigned c = 0; c < op[0]->type->components(); c++)
1242 data.f[c] = tanf(op[0]->value.f[c]);
1243 ! } else if (strcmp(callee, "tanh") == 0) {
1244 assert(op[0]->type->is_float());
1245 for (unsigned c = 0; c < op[0]->type->components(); c++)
1246 data.f[c] = tanhf(op[0]->value.f[c]);
1247 ! } else if (strcmp(callee, "transpose") == 0) {
1248 assert(op[0]->type->is_matrix());
1249 const unsigned n = op[0]->type->vector_elements;
1250 const unsigned m = op[0]->type->matrix_columns;
1252 data.f[c] = t * t * (3 - 2 * t);
1255 ! } else if (safe_strcmp(callee, "sqrt") == 0) {
1256 expr = new(mem_ctx) ir_expression(ir_unop_sqrt, type, op[0], NULL);
1257 ! } else if (safe_strcmp(callee, "step") == 0) {
1258 assert(op[0]->type->is_float() && op[1]->type->is_float());
1259 /* op[0] (edge) may be either a scalar or a vector */
1260 const unsigned c0_inc = op[0]->type->is_scalar() ? 0 : 1;
1261 for (unsigned c = 0, c0 = 0; c < type->components(); c0 += c0_inc, c++)
1262 data.f[c] = (op[1]->value.f[c] < op[0]->value.f[c0]) ? 0.0 : 1.0;
1263 ! } else if (safe_strcmp(callee, "tan") == 0) {
1264 assert(op[0]->type->is_float());
1265 for (unsigned c = 0; c < op[0]->type->components(); c++)
1266 data.f[c] = tanf(op[0]->value.f[c]);
1267 ! } else if (safe_strcmp(callee, "tanh") == 0) {
1268 assert(op[0]->type->is_float());
1269 for (unsigned c = 0; c < op[0]->type->components(); c++)
1270 data.f[c] = tanhf(op[0]->value.f[c]);
1271 ! } else if (safe_strcmp(callee, "transpose") == 0) {
1272 assert(op[0]->type->is_matrix());
1273 const unsigned n = op[0]->type->vector_elements;
1274 const unsigned m = op[0]->type->matrix_columns;
1275 diff -c -r Mesa-7.9/src/glsl/ir_dead_functions.cpp MesaLib/src/glsl/ir_dead_functions.cpp
1276 *** Mesa-7.9/src/glsl/ir_dead_functions.cpp Fri Oct 1 15:51:28 2010
1277 --- MesaLib/src/glsl/ir_dead_functions.cpp Fri Oct 22 15:34:54 2010
1281 #include "ir_visitor.h"
1282 #include "ir_expression_flattening.h"
1283 #include "glsl_types.h"
1284 + #include "safe_strcmp.h"
1286 class signature_entry : public exec_node
1291 signature_entry *entry = this->get_signature_entry(ir);
1293 ! if (strcmp(ir->function_name(), "main") == 0) {
1299 signature_entry *entry = this->get_signature_entry(ir);
1301 ! if (safe_strcmp(ir->function_name(), "main") == 0) {
1305 diff -c -r Mesa-7.9/src/glsl/ir_function_inlining.cpp MesaLib/src/glsl/ir_function_inlining.cpp
1306 *** Mesa-7.9/src/glsl/ir_function_inlining.cpp Fri Oct 1 15:51:28 2010
1307 --- MesaLib/src/glsl/ir_function_inlining.cpp Fri Oct 22 15:35:58 2010
1310 * Replaces calls to functions with the body of the function.
1313 ! #include <inttypes.h>
1315 #include "ir_visitor.h"
1316 #include "ir_function_inlining.h"
1318 * Replaces calls to functions with the body of the function.
1321 ! /* The use of inttypes.h seems to be unnecessary and causes problems on Windows. */
1322 ! /* #include <inttypes.h> */
1324 #include "ir_visitor.h"
1325 #include "ir_function_inlining.h"
1326 diff -c -r Mesa-7.9/src/glsl/ir_lower_jumps.cpp MesaLib/src/glsl/ir_lower_jumps.cpp
1327 *** Mesa-7.9/src/glsl/ir_lower_jumps.cpp Fri Oct 1 15:51:28 2010
1328 --- MesaLib/src/glsl/ir_lower_jumps.cpp Fri Oct 22 15:36:16 2010
1332 #include "glsl_types.h"
1335 + #include "safe_strcmp.h"
1341 this->return_flag = 0;
1342 this->return_value = 0;
1343 this->nesting_depth = 0;
1344 ! this->is_main = this->signature && (strcmp(this->signature->function_name(), "main") == 0);
1347 ir_variable* get_return_flag()
1349 this->return_flag = 0;
1350 this->return_value = 0;
1351 this->nesting_depth = 0;
1352 ! this->is_main = this->signature && (safe_strcmp(this->signature->function_name(), "main") == 0);
1355 ir_variable* get_return_flag()
1356 diff -c -r Mesa-7.9/src/glsl/ir_reader.cpp MesaLib/src/glsl/ir_reader.cpp
1357 *** Mesa-7.9/src/glsl/ir_reader.cpp Fri Oct 1 15:51:28 2010
1358 --- MesaLib/src/glsl/ir_reader.cpp Fri Oct 22 15:36:27 2010
1362 #include "glsl_parser_extras.h"
1363 #include "glsl_types.h"
1364 #include "s_expression.h"
1365 + #include "safe_strcmp.h"
1367 const static bool debug = false;
1371 ir_read_error(st, expr, "expected type (array ...) or (struct ...)");
1374 ! if (strcmp(type_sym->value(), "array") == 0) {
1375 if (list->length() != 3) {
1376 ir_read_error(st, expr, "expected type (array <type> <int>)");
1379 ir_read_error(st, expr, "expected type (array ...) or (struct ...)");
1382 ! if (safe_strcmp(type_sym->value(), "array") == 0) {
1383 if (list->length() != 3) {
1384 ir_read_error(st, expr, "expected type (array <type> <int>)");
1390 return glsl_type::get_array_instance(base_type, size->value());
1391 ! } else if (strcmp(type_sym->value(), "struct") == 0) {
1392 assert(false); // FINISHME
1394 ir_read_error(st, expr, "expected (array ...) or (struct ...); "
1398 return glsl_type::get_array_instance(base_type, size->value());
1399 ! } else if (safe_strcmp(type_sym->value(), "struct") == 0) {
1400 assert(false); // FINISHME
1402 ir_read_error(st, expr, "expected (array ...) or (struct ...); "
1405 continue; // not a (function ...); ignore it.
1407 s_symbol *tag = SX_AS_SYMBOL(sub->subexpressions.get_head());
1408 ! if (tag == NULL || strcmp(tag->value(), "function") != 0)
1409 continue; // not a (function ...); ignore it.
1411 ir_function *f = read_function(st, sub, true);
1413 continue; // not a (function ...); ignore it.
1415 s_symbol *tag = SX_AS_SYMBOL(sub->subexpressions.get_head());
1416 ! if (tag == NULL || safe_strcmp(tag->value(), "function") != 0)
1417 continue; // not a (function ...); ignore it.
1419 ir_function *f = read_function(st, sub, true);
1424 s_symbol *tag = SX_AS_SYMBOL(siglist->subexpressions.get_head());
1425 ! if (tag == NULL || strcmp(tag->value(), "signature") != 0) {
1426 ir_read_error(st, siglist, "Expected (signature ...)");
1432 s_symbol *tag = SX_AS_SYMBOL(siglist->subexpressions.get_head());
1433 ! if (tag == NULL || safe_strcmp(tag->value(), "signature") != 0) {
1434 ir_read_error(st, siglist, "Expected (signature ...)");
1441 s_symbol *paramtag = SX_AS_SYMBOL(paramlist->subexpressions.get_head());
1442 ! if (paramtag == NULL || strcmp(paramtag->value(), "parameters") != 0) {
1443 ir_read_error(st, paramlist, "Expected (parameters ...)");
1449 s_symbol *paramtag = SX_AS_SYMBOL(paramlist->subexpressions.get_head());
1450 ! if (paramtag == NULL || safe_strcmp(paramtag->value(), "parameters") != 0) {
1451 ir_read_error(st, paramlist, "Expected (parameters ...)");
1457 s_symbol *symbol = SX_AS_SYMBOL(expr);
1458 if (symbol != NULL) {
1459 ! if (strcmp(symbol->value(), "break") == 0 && loop_ctx != NULL)
1460 return new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
1461 ! if (strcmp(symbol->value(), "continue") == 0 && loop_ctx != NULL)
1462 return new(ctx) ir_loop_jump(ir_loop_jump::jump_continue);
1467 s_symbol *symbol = SX_AS_SYMBOL(expr);
1468 if (symbol != NULL) {
1469 ! if (safe_strcmp(symbol->value(), "break") == 0 && loop_ctx != NULL)
1470 return new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
1471 ! if (safe_strcmp(symbol->value(), "continue") == 0 && loop_ctx != NULL)
1472 return new(ctx) ir_loop_jump(ir_loop_jump::jump_continue);
1479 ir_instruction *inst = NULL;
1480 ! if (strcmp(tag->value(), "declare") == 0) {
1481 inst = read_declaration(st, list);
1482 ! } else if (strcmp(tag->value(), "assign") == 0) {
1483 inst = read_assignment(st, list);
1484 ! } else if (strcmp(tag->value(), "if") == 0) {
1485 inst = read_if(st, list, loop_ctx);
1486 ! } else if (strcmp(tag->value(), "loop") == 0) {
1487 inst = read_loop(st, list);
1488 ! } else if (strcmp(tag->value(), "return") == 0) {
1489 inst = read_return(st, list);
1490 ! } else if (strcmp(tag->value(), "function") == 0) {
1491 inst = read_function(st, list, false);
1493 inst = read_rvalue(st, list);
1497 ir_instruction *inst = NULL;
1498 ! if (safe_strcmp(tag->value(), "declare") == 0) {
1499 inst = read_declaration(st, list);
1500 ! } else if (safe_strcmp(tag->value(), "assign") == 0) {
1501 inst = read_assignment(st, list);
1502 ! } else if (safe_strcmp(tag->value(), "if") == 0) {
1503 inst = read_if(st, list, loop_ctx);
1504 ! } else if (safe_strcmp(tag->value(), "loop") == 0) {
1505 inst = read_loop(st, list);
1506 ! } else if (safe_strcmp(tag->value(), "return") == 0) {
1507 inst = read_return(st, list);
1508 ! } else if (safe_strcmp(tag->value(), "function") == 0) {
1509 inst = read_function(st, list, false);
1511 inst = read_rvalue(st, list);
1516 // FINISHME: Check for duplicate/conflicting qualifiers.
1517 ! if (strcmp(qualifier->value(), "centroid") == 0) {
1519 ! } else if (strcmp(qualifier->value(), "invariant") == 0) {
1521 ! } else if (strcmp(qualifier->value(), "uniform") == 0) {
1522 var->mode = ir_var_uniform;
1523 ! } else if (strcmp(qualifier->value(), "auto") == 0) {
1524 var->mode = ir_var_auto;
1525 ! } else if (strcmp(qualifier->value(), "in") == 0) {
1526 var->mode = ir_var_in;
1527 ! } else if (strcmp(qualifier->value(), "out") == 0) {
1528 var->mode = ir_var_out;
1529 ! } else if (strcmp(qualifier->value(), "inout") == 0) {
1530 var->mode = ir_var_inout;
1531 ! } else if (strcmp(qualifier->value(), "smooth") == 0) {
1532 var->interpolation = ir_var_smooth;
1533 ! } else if (strcmp(qualifier->value(), "flat") == 0) {
1534 var->interpolation = ir_var_flat;
1535 ! } else if (strcmp(qualifier->value(), "noperspective") == 0) {
1536 var->interpolation = ir_var_noperspective;
1538 ir_read_error(st, list, "unknown qualifier: %s", qualifier->value());
1542 // FINISHME: Check for duplicate/conflicting qualifiers.
1543 ! if (safe_strcmp(qualifier->value(), "centroid") == 0) {
1545 ! } else if (safe_strcmp(qualifier->value(), "invariant") == 0) {
1547 ! } else if (safe_strcmp(qualifier->value(), "uniform") == 0) {
1548 var->mode = ir_var_uniform;
1549 ! } else if (safe_strcmp(qualifier->value(), "auto") == 0) {
1550 var->mode = ir_var_auto;
1551 ! } else if (safe_strcmp(qualifier->value(), "in") == 0) {
1552 var->mode = ir_var_in;
1553 ! } else if (safe_strcmp(qualifier->value(), "out") == 0) {
1554 var->mode = ir_var_out;
1555 ! } else if (safe_strcmp(qualifier->value(), "inout") == 0) {
1556 var->mode = ir_var_inout;
1557 ! } else if (safe_strcmp(qualifier->value(), "smooth") == 0) {
1558 var->interpolation = ir_var_smooth;
1559 ! } else if (safe_strcmp(qualifier->value(), "flat") == 0) {
1560 var->interpolation = ir_var_flat;
1561 ! } else if (safe_strcmp(qualifier->value(), "noperspective") == 0) {
1562 var->interpolation = ir_var_noperspective;
1564 ir_read_error(st, list, "unknown qualifier: %s", qualifier->value());
1567 ir_rvalue *rvalue = read_dereference(st, list);
1568 if (rvalue != NULL || st->error)
1570 ! else if (strcmp(tag->value(), "swiz") == 0) {
1571 rvalue = read_swizzle(st, list);
1572 ! } else if (strcmp(tag->value(), "expression") == 0) {
1573 rvalue = read_expression(st, list);
1574 ! } else if (strcmp(tag->value(), "call") == 0) {
1575 rvalue = read_call(st, list);
1576 ! } else if (strcmp(tag->value(), "constant") == 0) {
1577 rvalue = read_constant(st, list);
1579 rvalue = read_texture(st, list);
1581 ir_rvalue *rvalue = read_dereference(st, list);
1582 if (rvalue != NULL || st->error)
1584 ! else if (safe_strcmp(tag->value(), "swiz") == 0) {
1585 rvalue = read_swizzle(st, list);
1586 ! } else if (safe_strcmp(tag->value(), "expression") == 0) {
1587 rvalue = read_expression(st, list);
1588 ! } else if (safe_strcmp(tag->value(), "call") == 0) {
1589 rvalue = read_call(st, list);
1590 ! } else if (safe_strcmp(tag->value(), "constant") == 0) {
1591 rvalue = read_constant(st, list);
1593 rvalue = read_texture(st, list);
1596 s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.head);
1597 assert(tag != NULL);
1599 ! if (strcmp(tag->value(), "var_ref") == 0)
1600 return read_var_ref(st, list);
1601 ! if (strcmp(tag->value(), "array_ref") == 0)
1602 return read_array_ref(st, list);
1603 ! if (strcmp(tag->value(), "record_ref") == 0)
1604 return read_record_ref(st, list);
1608 s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.head);
1609 assert(tag != NULL);
1611 ! if (safe_strcmp(tag->value(), "var_ref") == 0)
1612 return read_var_ref(st, list);
1613 ! if (safe_strcmp(tag->value(), "array_ref") == 0)
1614 return read_array_ref(st, list);
1615 ! if (safe_strcmp(tag->value(), "record_ref") == 0)
1616 return read_record_ref(st, list);
1619 diff -c -r Mesa-7.9/src/glsl/ir_structure_splitting.cpp MesaLib/src/glsl/ir_structure_splitting.cpp
1620 *** Mesa-7.9/src/glsl/ir_structure_splitting.cpp Fri Oct 1 15:51:28 2010
1621 --- MesaLib/src/glsl/ir_structure_splitting.cpp Fri Oct 22 15:36:52 2010
1625 #include "ir_print_visitor.h"
1626 #include "ir_rvalue_visitor.h"
1627 #include "glsl_types.h"
1628 + #include "safe_strcmp.h"
1630 static bool debug = false;
1636 for (i = 0; i < entry->var->type->length; i++) {
1637 ! if (strcmp(deref_record->field,
1638 ! entry->var->type->fields.structure[i].name) == 0)
1641 assert(i != entry->var->type->length);
1645 for (i = 0; i < entry->var->type->length; i++) {
1646 ! if (safe_strcmp(deref_record->field,
1647 ! entry->var->type->fields.structure[i].name) == 0)
1650 assert(i != entry->var->type->length);
1651 diff -c -r Mesa-7.9/src/glsl/ir_validate.cpp MesaLib/src/glsl/ir_validate.cpp
1652 *** Mesa-7.9/src/glsl/ir_validate.cpp Mon Oct 4 18:58:00 2010
1653 --- MesaLib/src/glsl/ir_validate.cpp Fri Oct 22 15:37:24 2010
1656 * a dereference chain.
1659 ! #include <inttypes.h>
1661 #include "ir_hierarchical_visitor.h"
1662 #include "program/hash_table.h"
1664 * a dereference chain.
1667 ! /* The use of inttypes.h seems to be unnecessary and causes problems on Windows. */
1668 ! /* #include <inttypes.h> */
1670 #include "ir_hierarchical_visitor.h"
1671 #include "program/hash_table.h"
1672 diff -c -r Mesa-7.9/src/glsl/linker.cpp MesaLib/src/glsl/linker.cpp
1673 *** Mesa-7.9/src/glsl/linker.cpp Fri Oct 1 15:51:28 2010
1674 --- MesaLib/src/glsl/linker.cpp Fri Oct 22 15:38:08 2010
1678 #include "program/hash_table.h"
1680 #include "ir_optimization.h"
1681 + #include "safe_strcmp.h"
1684 * Visitor that determines whether or not a variable is ever written.
1688 ir_variable *const var = ir->lhs->variable_referenced();
1690 ! if (strcmp(name, var->name) == 0) {
1696 ir_variable *const var = ir->lhs->variable_referenced();
1698 ! if (safe_strcmp(name, var->name) == 0) {
1704 if (sig_param->mode == ir_var_out ||
1705 sig_param->mode == ir_var_inout) {
1706 ir_variable *var = param_rval->variable_referenced();
1707 ! if (var && strcmp(name, var->name) == 0) {
1712 if (sig_param->mode == ir_var_out ||
1713 sig_param->mode == ir_var_inout) {
1714 ir_variable *var = param_rval->variable_referenced();
1715 ! if (var && safe_strcmp(name, var->name) == 0) {
1722 virtual ir_visitor_status visit(ir_dereference_variable *ir)
1724 ! if (strcmp(this->name, ir->var->name) == 0) {
1730 virtual ir_visitor_status visit(ir_dereference_variable *ir)
1732 ! if (safe_strcmp(this->name, ir->var->name) == 0) {
1741 ! if (strcmp(var->name, other_var->name) == 0 &&
1742 other_var->max_array_access > size) {
1743 size = other_var->max_array_access;
1749 ! if (safe_strcmp(var->name, other_var->name) == 0 &&
1750 other_var->max_array_access > size) {
1751 size = other_var->max_array_access;
1753 diff -c -r Mesa-7.9/src/mapi/glapi/glapi_nop.c MesaLib/src/mapi/glapi/glapi_nop.c
1754 *** Mesa-7.9/src/mapi/glapi/glapi_nop.c Fri Oct 1 15:51:28 2010
1755 --- MesaLib/src/mapi/glapi/glapi_nop.c Fri Oct 22 15:41:35 2010
1761 ! #define TABLE_ENTRY(name) (_glapi_proc) NoOpGeneric
1770 ! * This is called if the user somehow calls an unassigned GL dispatch function.
1775 ! return NoOpGeneric();
1779 ! * It is necessary to generate custom no-op entry points at least on
1780 ! * Windows, where the __stdcall calling convention is used (callee
1781 ! * cleans the stack). This calling convention can not tolerate a
1782 ! * mismatch between the numbers of arguments in caller and callee.
1784 ! #define KEYWORD1 static
1785 ! #define KEYWORD1_ALT static
1786 ! #define KEYWORD2 GLAPIENTRY
1787 ! #define NAME(func) NoOp##func
1788 ! #define DISPATCH(func, args, msg) NoOpGeneric();
1789 ! #define RETURN_DISPATCH(func, args, msg) return NoOpGeneric();
1792 ! * Defines for the table of no-op entry points.
1794 ! #define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
1798 diff -c -r Mesa-7.9/src/mesa/main/compiler.h MesaLib/src/mesa/main/compiler.h
1799 *** Mesa-7.9/src/mesa/main/compiler.h Fri Oct 1 15:51:28 2010
1800 --- MesaLib/src/mesa/main/compiler.h Fri Oct 22 15:44:23 2010
1804 # define PUBLIC __attribute__((visibility("default")))
1805 # define USED __attribute__((used))
1813 diff -c -r Mesa-7.9/src/mesa/main/histogram.c MesaLib/src/mesa/main/histogram.c
1814 *** Mesa-7.9/src/mesa/main/histogram.c Mon Oct 4 18:58:00 2010
1815 --- MesaLib/src/mesa/main/histogram.c Tue Oct 26 11:17:37 2010
1820 #include "main/dispatch.h"
1822 + #if defined(_MSC_VER)
1823 + #pragma optimize("", off)
1826 #if FEATURE_histogram
1828 diff -c -r Mesa-7.9/src/mesa/main/image.c MesaLib/src/mesa/main/image.c
1829 *** Mesa-7.9/src/mesa/main/image.c Mon Oct 4 18:58:00 2010
1830 --- MesaLib/src/mesa/main/image.c Tue Oct 26 11:17:45 2010
1834 #include "imports.h"
1837 + #if defined(_MSC_VER)
1838 + #pragma optimize("", off)
1843 diff -c -r Mesa-7.9/src/mesa/main/mipmap.c MesaLib/src/mesa/main/mipmap.c
1844 *** Mesa-7.9/src/mesa/main/mipmap.c Fri Oct 1 15:51:28 2010
1845 --- MesaLib/src/mesa/main/mipmap.c Tue Oct 26 11:17:52 2010
1848 #include "texstore.h"
1854 bytes_per_pixel(GLenum datatype, GLuint comps)
1856 #include "texstore.h"
1859 ! #if defined(_MSC_VER)
1860 ! #pragma optimize("", off)
1864 bytes_per_pixel(GLenum datatype, GLuint comps)
1865 diff -c -r Mesa-7.9/src/mesa/main/querymatrix.c MesaLib/src/mesa/main/querymatrix.c
1866 *** Mesa-7.9/src/mesa/main/querymatrix.c Mon Oct 4 18:58:00 2010
1867 --- MesaLib/src/mesa/main/querymatrix.c Wed Oct 6 16:36:08 2010
1870 #elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \
1871 defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
1872 (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) || \
1873 ! (defined(__sun) && defined(__GNUC__))
1875 /* fpclassify is available. */
1878 #elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \
1879 defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
1880 (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) || \
1881 ! (defined(__sun) && defined(__GNUC__)) || \
1882 ! (defined(__linux) && defined(__GNUC__))
1884 /* fpclassify is available. */
1886 diff -c -r Mesa-7.9/src/mesa/math/m_eval.c MesaLib/src/mesa/math/m_eval.c
1887 *** Mesa-7.9/src/mesa/math/m_eval.c Thu Feb 4 16:10:40 2010
1888 --- MesaLib/src/mesa/math/m_eval.c Tue Oct 26 11:18:00 2010
1892 #include "main/config.h"
1895 + #if defined(_MSC_VER)
1896 + #pragma optimize("", off)
1899 static GLfloat inv_tab[MAX_EVAL_ORDER];
1902 diff -c -r Mesa-7.9/src/mesa/swrast/s_texcombine.c MesaLib/src/mesa/swrast/s_texcombine.c
1903 *** Mesa-7.9/src/mesa/swrast/s_texcombine.c Fri Oct 1 15:51:28 2010
1904 --- MesaLib/src/mesa/swrast/s_texcombine.c Tue Oct 26 11:01:39 2010
1908 #include "s_context.h"
1909 #include "s_texcombine.h"
1911 + #if defined(_MSC_VER)
1912 + #pragma optimize("", off)
1916 * Pointer to array of float[4]
1917 diff -c -r Mesa-7.9/src/mapi/glapi/gen/gl_apitemp.py MesaLib/src/mapi/glapi/gen/gl_apitemp.py
1918 *** Mesa-7.9/src/mapi/glapi/gen/gl_apitemp.py Mon Aug 15 09:14:29 2011
1919 --- MesaLib/src/mapi/glapi/gen/gl_apitemp.py Thu Aug 11 21:23:47 2011
1925 - if f.return_type != 'void':
1926 - dispatch = "RETURN_DISPATCH"
1928 - dispatch = "DISPATCH"
1931 if not f.is_static_entry_point(name):
1937 print '%s %s KEYWORD2 NAME(%s)(%s)' % (keyword, f.return_type, n, f.get_parameter_string(name))
1939 ! if p_string == "":
1940 ! print ' %s(%s, (), (F, "gl%s();\\n"));' \
1941 ! % (dispatch, f.name, name)
1943 ! print ' %s(%s, (%s), (F, "gl%s(%s);\\n", %s));' \
1944 ! % (dispatch, f.name, p_string, name, t_string, o_string)
1950 print '%s %s KEYWORD2 NAME(%s)(%s)' % (keyword, f.return_type, n, f.get_parameter_string(name))
1952 ! if f.return_type != 'void':
1953 ! dispatch = "RETURN_DISPATCH"
1954 ! if p_string == "":
1955 ! print ' %s(%s, %s, (), (F, "gl%s();\\n"));' \
1956 ! % (dispatch, f.return_type, f.name, name)
1958 ! print ' %s(%s, %s, (%s), (F, "gl%s(%s);\\n", %s));' \
1959 ! % (dispatch, f.return_type, f.name, p_string, name, t_string, o_string)
1961 ! dispatch = "DISPATCH"
1962 ! if p_string == "":
1963 ! print ' %s(%s, (), (F, "gl%s();\\n"));' \
1964 ! % (dispatch, f.name, name)
1966 ! print ' %s(%s, (%s), (F, "gl%s(%s);\\n", %s));' \
1967 ! % (dispatch, f.name, p_string, name, t_string, o_string)
1973 * NAME(n) - builds the final function name (usually add "gl" prefix)
1974 * DISPATCH(func, args, msg) - code to do dispatch of named function.
1975 * msg is a printf-style debug message.
1976 ! * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value
1978 * Here is an example which generates the usual OpenGL functions:
1981 * NAME(n) - builds the final function name (usually add "gl" prefix)
1982 * DISPATCH(func, args, msg) - code to do dispatch of named function.
1983 * msg is a printf-style debug message.
1984 ! * RETURN_DISPATCH(type, func, args, msg) - code to do dispatch with a
1985 ! * return value of type.
1987 * Here is an example which generates the usual OpenGL functions:
1989 diff -c -r Mesa-7.9/src/mapi/glapi/glapi_dispatch.c MesaLib/src/mapi/glapi/glapi_dispatch.c
1990 *** Mesa-7.9/src/mapi/glapi/glapi_dispatch.c Mon Aug 15 09:14:30 2011
1991 --- MesaLib/src/mapi/glapi/glapi_dispatch.c Thu Aug 11 21:25:55 2011
1995 CALL_ ## FUNC(GET_DISPATCH(), ARGS);
1997 ! #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
1999 return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
2003 CALL_ ## FUNC(GET_DISPATCH(), ARGS);
2005 ! #define RETURN_DISPATCH(TYPE, FUNC, ARGS, MESSAGE) \
2007 return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
2011 #define DISPATCH(FUNC, ARGS, MESSAGE) \
2012 CALL_ ## FUNC(GET_DISPATCH(), ARGS);
2014 ! #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
2015 return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
2017 #endif /* logging */
2019 #define DISPATCH(FUNC, ARGS, MESSAGE) \
2020 CALL_ ## FUNC(GET_DISPATCH(), ARGS);
2022 ! #define RETURN_DISPATCH(TYPE, FUNC, ARGS, MESSAGE) \
2023 return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
2025 #endif /* logging */
2026 diff -c -r Mesa-7.9/src/mapi/glapi/glapi_nop.c MesaLib/src/mapi/glapi/glapi_nop.c
2027 *** Mesa-7.9/src/mapi/glapi/glapi_nop.c Mon Aug 15 09:14:30 2011
2028 --- MesaLib/src/mapi/glapi/glapi_nop.c Thu Aug 11 21:29:46 2011
2031 #define KEYWORD2 GLAPIENTRY
2032 #define NAME(func) NoOp##func
2033 #define DISPATCH(func, args, msg) Warn(#func);
2034 ! #define RETURN_DISPATCH(func, args, msg) Warn(#func); return 0
2039 #define KEYWORD2 GLAPIENTRY
2040 #define NAME(func) NoOp##func
2041 #define DISPATCH(func, args, msg) Warn(#func);
2042 ! #define RETURN_DISPATCH(type, func, args, msg) Warn(#func); return (type)0
2054 #if !defined(_WIN32_WCE)
2062 #if !defined(_WIN32_WCE)
2065 fprintf(stderr, "GL User Error: calling GL function without a rendering context\n");
2078 ! return NoOpGeneric();
2093 #define KEYWORD2 GLAPIENTRY
2094 #define NAME(func) NoOp##func
2095 #define DISPATCH(func, args, msg) NoOpGeneric();
2096 ! #define RETURN_DISPATCH(func, args, msg) return NoOpGeneric();
2099 * Defines for the table of no-op entry points.
2101 #define KEYWORD2 GLAPIENTRY
2102 #define NAME(func) NoOp##func
2103 #define DISPATCH(func, args, msg) NoOpGeneric();
2104 ! #define RETURN_DISPATCH(type, func, args, msg) NoOpGeneric(); return (type)0
2107 * Defines for the table of no-op entry points.