diff options
author | marha <marha@users.sourceforge.net> | 2010-11-29 22:05:53 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-11-29 22:05:53 +0000 |
commit | fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7 (patch) | |
tree | fa1ba494685a71e28a096990a8707680c7cb378b /mesalib/src | |
parent | ae340911c1ba1f98b418bd8f1a487fa4d79491b0 (diff) | |
parent | 6fda93be42ace9eeab0e82ceebb6798961c9105c (diff) | |
download | vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.tar.gz vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.tar.bz2 vcxsrv-fed109d6a33c0871291d1bb2f3f6b7a3d1a3e9d7.zip |
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src')
525 files changed, 152382 insertions, 59460 deletions
diff --git a/mesalib/src/glsl/Makefile b/mesalib/src/glsl/Makefile index ca7f2d2ac..47ac42667 100644 --- a/mesalib/src/glsl/Makefile +++ b/mesalib/src/glsl/Makefile @@ -1,15 +1,184 @@ -# src/glsl/Makefile +#src/glsl/pp/Makefile TOP = ../.. include $(TOP)/configs/current -SUBDIRS = pp cl apps +LIBNAME = glsl -default install clean: - @for dir in $(SUBDIRS) ; do \ - if [ -d $$dir ] ; then \ - (cd $$dir && $(MAKE) $@) || exit 1; \ - fi \ - done +LIBGLCPP_SOURCES = \ + glcpp/glcpp-lex.c \ + glcpp/glcpp-parse.c \ + glcpp/pp.c +GLCPP_SOURCES = \ + $(LIBGLCPP_SOURCES) \ + glcpp/glcpp.c + +C_SOURCES = \ + $(LIBGLCPP_SOURCES) + +CXX_SOURCES = \ + ast_expr.cpp \ + ast_function.cpp \ + ast_to_hir.cpp \ + ast_type.cpp \ + builtin_function.cpp \ + glsl_lexer.cpp \ + glsl_parser.cpp \ + glsl_parser_extras.cpp \ + glsl_types.cpp \ + glsl_symbol_table.cpp \ + hir_field_selection.cpp \ + ir_algebraic.cpp \ + ir_basic_block.cpp \ + ir_clone.cpp \ + ir_constant_expression.cpp \ + ir_constant_folding.cpp \ + ir_constant_propagation.cpp \ + ir_constant_variable.cpp \ + ir_copy_propagation.cpp \ + ir.cpp \ + ir_dead_code.cpp \ + ir_dead_code_local.cpp \ + ir_dead_functions.cpp \ + ir_div_to_mul_rcp.cpp \ + ir_explog_to_explog2.cpp \ + ir_expression_flattening.cpp \ + ir_function_can_inline.cpp \ + ir_function.cpp \ + ir_function_inlining.cpp \ + ir_hierarchical_visitor.cpp \ + ir_hv_accept.cpp \ + ir_if_simplification.cpp \ + ir_if_to_cond_assign.cpp \ + ir_import_prototypes.cpp \ + ir_lower_jumps.cpp \ + ir_mat_op_to_vec.cpp \ + ir_mod_to_fract.cpp \ + ir_noop_swizzle.cpp \ + ir_print_visitor.cpp \ + ir_reader.cpp \ + ir_rvalue_visitor.cpp \ + ir_set_program_inouts.cpp \ + ir_structure_splitting.cpp \ + ir_sub_to_add_neg.cpp \ + ir_swizzle_swizzle.cpp \ + ir_tree_grafting.cpp \ + ir_validate.cpp \ + ir_variable.cpp \ + ir_variable_refcount.cpp \ + ir_vec_index_to_cond_assign.cpp \ + ir_vec_index_to_swizzle.cpp \ + linker.cpp \ + link_functions.cpp \ + loop_analysis.cpp \ + loop_controls.cpp \ + loop_unroll.cpp \ + lower_noise.cpp \ + lower_variable_index_to_cond_assign.cpp \ + opt_redundant_jumps.cpp \ + s_expression.cpp + +LIBS = \ + $(TOP)/src/glsl/libglsl.a \ + $(TALLOC_LIBS) + +APPS = glsl_compiler glcpp/glcpp + +GLSL2_C_SOURCES = \ + ../mesa/program/hash_table.c \ + ../mesa/program/symbol_table.c +GLSL2_CXX_SOURCES = \ + main.cpp + +GLSL2_OBJECTS = \ + $(GLSL2_C_SOURCES:.c=.o) \ + $(GLSL2_CXX_SOURCES:.cpp=.o) + +### Basic defines ### + +DEFINES += \ + $(LIBRARY_DEFINES) \ + $(API_DEFINES) + +GLCPP_OBJECTS = \ + $(GLCPP_SOURCES:.c=.o) \ + ../mesa/program/hash_table.o + +OBJECTS = \ + $(C_SOURCES:.c=.o) \ + $(CXX_SOURCES:.cpp=.o) + +INCLUDES = \ + $(TALLOC_CFLAGS) \ + -I. \ + -I../mesa \ + -I../mapi \ + -I../../include \ + $(LIBRARY_INCLUDES) + +ALL_SOURCES = \ + $(C_SOURCES) \ + $(CXX_SOURCES) \ + $(GLSL2_CXX_SOURCES) \ + $(GLSL2_C_SOURCES) + +##### TARGETS ##### + +default: depend lib$(LIBNAME).a $(APPS) + +lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template + $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) + +depend: $(ALL_SOURCES) Makefile + rm -f depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null + +# Remove .o and backup files +clean: + rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak + -rm -f $(APPS) + +# Dummy target +install: + @echo -n "" + + +##### RULES ##### + +glsl_compiler: $(GLSL2_OBJECTS) libglsl.a + $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@ + +glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a + $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) $(LIBS) -o $@ + +.cpp.o: + $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@ + +.c.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + +glsl_lexer.cpp: glsl_lexer.lpp + flex --nounistd -o$@ $< + +glsl_parser.cpp: glsl_parser.ypp + bison -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $< + +glcpp/glcpp-lex.c: glcpp/glcpp-lex.l + flex --nounistd -o$@ $< + +glcpp/glcpp-parse.c: glcpp/glcpp-parse.y + bison -v -o "$@" --defines=glcpp/glcpp-parse.h $< + +builtins: builtin_function.cpp builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py + @echo Bootstrapping the compiler... + cp builtins/tools/builtin_function.cpp . + make glsl_compiler + @echo Regenerating builtin_function.cpp... + ./builtins/tools/generate_builtins.py > builtin_function.cpp + @echo Rebuilding the real compiler... + make glsl_compiler + +-include depend diff --git a/mesalib/src/glsl/README b/mesalib/src/glsl/README new file mode 100644 index 000000000..dd80a53d4 --- /dev/null +++ b/mesalib/src/glsl/README @@ -0,0 +1,229 @@ +Welcome to Mesa's GLSL compiler. A brief overview of how things flow: + +1) lex and yacc-based preprocessor takes the incoming shader string +and produces a new string containing the preprocessed shader. This +takes care of things like #if, #ifdef, #define, and preprocessor macro +invocations. Note that #version, #extension, and some others are +passed straight through. See glcpp/* + +2) lex and yacc-based parser takes the preprocessed string and +generates the AST (abstract syntax tree). Almost no checking is +performed in this stage. See glsl_lexer.lpp and glsl_parser.ypp. + +3) The AST is converted to "HIR". This is the intermediate +representation of the compiler. Constructors are generated, function +calls are resolved to particular function signatures, and all the +semantic checking is performed. See ast_*.cpp for the conversion, and +ir.h for the IR structures. + +4) The driver (Mesa, or main.cpp for the standalone binary) performs +optimizations. These include copy propagation, dead code elimination, +constant folding, and others. Generally the driver will call +optimizations in a loop, as each may open up opportunities for other +optimizations to do additional work. See most files called ir_*.cpp + +5) linking is performed. This does checking to ensure that the +outputs of the vertex shader match the inputs of the fragment shader, +and assigns locations to uniforms, attributes, and varyings. See +linker.cpp. + +6) The driver may perform additional optimization at this point, as +for example dead code elimination previously couldn't remove functions +or global variable usage when we didn't know what other code would be +linked in. + +7) The driver performs code generation out of the IR, taking a linked +shader program and producing a compiled program for each stage. See +ir_to_mesa.cpp for Mesa IR code generation. + +FAQ: + +Q: What is HIR versus IR versus LIR? + +A: The idea behind the naming was that ast_to_hir would produce a +high-level IR ("HIR"), with things like matrix operations, structure +assignments, etc., present. A series of lowering passes would occur +that do things like break matrix multiplication into a series of dot +products/MADs, make structure assignment be a series of assignment of +components, flatten if statements into conditional moves, and such, +producing a low level IR ("LIR"). + +However, it now appears that each driver will have different +requirements from a LIR. A 915-generation chipset wants all functions +inlined, all loops unrolled, all ifs flattened, no variable array +accesses, and matrix multiplication broken down. The Mesa IR backend +for swrast would like matrices and structure assignment broken down, +but it can support function calls and dynamic branching. A 965 vertex +shader IR backend could potentially even handle some matrix operations +without breaking them down, but the 965 fragment shader IR backend +would want to break to have (almost) all operations down channel-wise +and perform optimization on that. As a result, there's no single +low-level IR that will make everyone happy. So that usage has fallen +out of favor, and each driver will perform a series of lowering passes +to take the HIR down to whatever restrictions it wants to impose +before doing codegen. + +Q: How is the IR structured? + +A: The best way to get started seeing it would be to run the +standalone compiler against a shader: + +./glsl_compiler --dump-lir \ + ~/src/piglit/tests/shaders/glsl-orangebook-ch06-bump.frag + +So for example one of the ir_instructions in main() contains: + +(assign (constant bool (1)) (var_ref litColor) (expression vec3 * (var_ref Surf +aceColor) (var_ref __retval) ) ) + +Or more visually: + (assign) + / | \ + (var_ref) (expression *) (constant bool 1) + / / \ +(litColor) (var_ref) (var_ref) + / \ + (SurfaceColor) (__retval) + +which came from: + +litColor = SurfaceColor * max(dot(normDelta, LightDir), 0.0); + +(the max call is not represented in this expression tree, as it was a +function call that got inlined but not brought into this expression +tree) + +Each of those nodes is a subclass of ir_instruction. A particular +ir_instruction instance may only appear once in the whole IR tree with +the exception of ir_variables, which appear once as variable +declarations: + +(declare () vec3 normDelta) + +and multiple times as the targets of variable dereferences: +... +(assign (constant bool (1)) (var_ref __retval) (expression float dot + (var_ref normDelta) (var_ref LightDir) ) ) +... +(assign (constant bool (1)) (var_ref __retval) (expression vec3 - + (var_ref LightDir) (expression vec3 * (constant float (2.000000)) + (expression vec3 * (expression float dot (var_ref normDelta) (var_ref + LightDir) ) (var_ref normDelta) ) ) ) ) +... + +Each node has a type. Expressions may involve several different types: +(declare (uniform ) mat4 gl_ModelViewMatrix) +((assign (constant bool (1)) (var_ref constructor_tmp) (expression + vec4 * (var_ref gl_ModelViewMatrix) (var_ref gl_Vertex) ) ) + +An expression tree can be arbitrarily deep, and the compiler tries to +keep them structured like that so that things like algebraic +optimizations ((color * 1.0 == color) and ((mat1 * mat2) * vec == mat1 +* (mat2 * vec))) or recognizing operation patterns for code generation +(vec1 * vec2 + vec3 == mad(vec1, vec2, vec3)) are easier. This comes +at the expense of additional trickery in implementing some +optimizations like CSE where one must navigate an expression tree. + +Q: Why no SSA representation? + +A: Converting an IR tree to SSA form makes dead code elmimination, +common subexpression elimination, and many other optimizations much +easier. However, in our primarily vector-based language, there's some +major questions as to how it would work. Do we do SSA on the scalar +or vector level? If we do it at the vector level, we're going to end +up with many different versions of the variable when encountering code +like: + +(assign (constant bool (1)) (swiz x (var_ref __retval) ) (var_ref a) ) +(assign (constant bool (1)) (swiz y (var_ref __retval) ) (var_ref b) ) +(assign (constant bool (1)) (swiz z (var_ref __retval) ) (var_ref c) ) + +If every masked update of a component relies on the previous value of +the variable, then we're probably going to be quite limited in our +dead code elimination wins, and recognizing common expressions may +just not happen. On the other hand, if we operate channel-wise, then +we'll be prone to optimizing the operation on one of the channels at +the expense of making its instruction flow different from the other +channels, and a vector-based GPU would end up with worse code than if +we didn't optimize operations on that channel! + +Once again, it appears that our optimization requirements are driven +significantly by the target architecture. For now, targeting the Mesa +IR backend, SSA does not appear to be that important to producing +excellent code, but we do expect to do some SSA-based optimizations +for the 965 fragment shader backend when that is developed. + +Q: How should I expand instructions that take multiple backend instructions? + +Sometimes you'll have to do the expansion in your code generation -- +see, for example, ir_to_mesa.cpp's handling of ir_unop_sqrt. However, +in many cases you'll want to do a pass over the IR to convert +non-native instructions to a series of native instructions. For +example, for the Mesa backend we have ir_div_to_mul_rcp.cpp because +Mesa IR (and many hardware backends) only have a reciprocal +instruction, not a divide. Implementing non-native instructions this +way gives the chance for constant folding to occur, so (a / 2.0) +becomes (a * 0.5) after codegen instead of (a * (1.0 / 2.0)) + +Q: How shoud I handle my special hardware instructions with respect to IR? + +Our current theory is that if multiple targets have an instruction for +some operation, then we should probably be able to represent that in +the IR. Generally this is in the form of an ir_{bin,un}op expression +type. For example, we initially implemented fract() using (a - +floor(a)), but both 945 and 965 have instructions to give that result, +and it would also simplify the implementation of mod(), so +ir_unop_fract was added. The following areas need updating to add a +new expression type: + +ir.h (new enum) +ir.cpp:get_num_operands() (used for ir_reader) +ir.cpp:operator_strs (used for ir_reader) +ir_constant_expression.cpp (you probably want to be able to constant fold) +ir_validate.cpp (check users have the right types) + +You may also need to update the backends if they will see the new expr type: + +../mesa/shaders/ir_to_mesa.cpp + +You can then use the new expression from builtins (if all backends +would rather see it), or scan the IR and convert to use your new +expression type (see ir_mod_to_fract, for example). + +Q: How is memory management handled in the compiler? + +The hierarchical memory allocator "talloc" developed for the Samba +project is used, so that things like optimization passes don't have to +worry about their garbage collection so much. It has a few nice +features, including low performance overhead and good debugging +support that's trivially available. + +Generally, each stage of the compile creates a talloc context and +allocates its memory out of that or children of it. At the end of the +stage, the pieces still live are stolen to a new context and the old +one freed, or the whole context is kept for use by the next stage. + +For IR transformations, a temporary context is used, then at the end +of all transformations, reparent_ir reparents all live nodes under the +shader's IR list, and the old context full of dead nodes is freed. +When developing a single IR transformation pass, this means that you +want to allocate instruction nodes out of the temporary context, so if +it becomes dead it doesn't live on as the child of a live node. At +the moment, optimization passes aren't passed that temporary context, +so they find it by calling talloc_parent() on a nearby IR node. The +talloc_parent() call is expensive, so many passes will cache the +result of the first talloc_parent(). Cleaning up all the optimization +passes to take a context argument and not call talloc_parent() is left +as an exercise. + +Q: What is the file naming convention in this directory? + +Initially, there really wasn't one. We have since adopted one: + + - Files that implement code lowering passes should be named lower_* + (e.g., lower_noise.cpp). + - Files that implement optimization passes should be named opt_*. + - Files that implement a class that is used throught the code should + take the name of that class (e.g., ir_hierarchical_visitor.cpp). + - Files that contain code not fitting in one of the previous + categories should have a sensible name (e.g., glsl_parser.ypp). diff --git a/mesalib/src/glsl/SConscript b/mesalib/src/glsl/SConscript index 8e18626c4..c183e208d 100644 --- a/mesalib/src/glsl/SConscript +++ b/mesalib/src/glsl/SConscript @@ -4,23 +4,78 @@ Import('*') env = env.Clone() +env.Prepend(CPPPATH = [ + '#src/mapi', + '#src/mesa', +]) + +if env['platform'] == 'windows': + env.Prepend(CPPPATH = ['#src/talloc']) + sources = [ - 'pp/sl_pp_context.c', - 'pp/sl_pp_define.c', - 'pp/sl_pp_dict.c', - 'pp/sl_pp_error.c', - 'pp/sl_pp_expression.c', - 'pp/sl_pp_extension.c', - 'pp/sl_pp_if.c', - 'pp/sl_pp_line.c', - 'pp/sl_pp_macro.c', - 'pp/sl_pp_pragma.c', - 'pp/sl_pp_process.c', - 'pp/sl_pp_purify.c', - 'pp/sl_pp_token.c', - 'pp/sl_pp_token_util.c', - 'pp/sl_pp_version.c', - 'cl/sl_cl_parse.c', + 'glcpp/glcpp-lex.c', + 'glcpp/glcpp-parse.c', + 'glcpp/pp.c', + 'ast_expr.cpp', + 'ast_function.cpp', + 'ast_to_hir.cpp', + 'ast_type.cpp', + 'builtin_function.cpp', + 'glsl_lexer.cpp', + 'glsl_parser.cpp', + 'glsl_parser_extras.cpp', + 'glsl_types.cpp', + 'glsl_symbol_table.cpp', + 'hir_field_selection.cpp', + 'ir_algebraic.cpp', + 'ir_basic_block.cpp', + 'ir_clone.cpp', + 'ir_constant_expression.cpp', + 'ir_constant_folding.cpp', + 'ir_constant_propagation.cpp', + 'ir_constant_variable.cpp', + 'ir_copy_propagation.cpp', + 'ir.cpp', + 'ir_dead_code.cpp', + 'ir_dead_code_local.cpp', + 'ir_dead_functions.cpp', + 'ir_div_to_mul_rcp.cpp', + 'ir_explog_to_explog2.cpp', + 'ir_expression_flattening.cpp', + 'ir_function_can_inline.cpp', + 'ir_function.cpp', + 'ir_function_inlining.cpp', + 'ir_hierarchical_visitor.cpp', + 'ir_hv_accept.cpp', + 'ir_if_simplification.cpp', + 'ir_if_to_cond_assign.cpp', + 'ir_import_prototypes.cpp', + 'ir_lower_jumps.cpp', + 'ir_mat_op_to_vec.cpp', + 'ir_mod_to_fract.cpp', + 'ir_noop_swizzle.cpp', + 'ir_print_visitor.cpp', + 'ir_reader.cpp', + 'ir_rvalue_visitor.cpp', + 'ir_set_program_inouts.cpp', + 'ir_structure_splitting.cpp', + 'ir_sub_to_add_neg.cpp', + 'ir_swizzle_swizzle.cpp', + 'ir_tree_grafting.cpp', + 'ir_validate.cpp', + 'ir_variable.cpp', + 'ir_variable_refcount.cpp', + 'ir_vec_index_to_cond_assign.cpp', + 'ir_vec_index_to_swizzle.cpp', + 'linker.cpp', + 'link_functions.cpp', + 'loop_analysis.cpp', + 'loop_controls.cpp', + 'loop_unroll.cpp', + 'lower_noise.cpp', + 'lower_variable_index_to_cond_assign.cpp', + 'opt_redundant_jumps.cpp', + 's_expression.cpp', ] glsl = env.ConvenienceLibrary( @@ -30,6 +85,9 @@ glsl = env.ConvenienceLibrary( Export('glsl') +# FIXME: We can't build the programs because there's a cyclic dependency between tis directory and src/mesa +Return() + env = env.Clone() if env['platform'] == 'windows': @@ -37,33 +95,16 @@ if env['platform'] == 'windows': 'user32', ]) -env.Prepend(LIBS = [glsl]) - -env.Program( - target = 'purify', - source = ['apps/purify.c'], -) +env.Prepend(LIBS = [glsl, talloc]) env.Program( - target = 'tokenise', - source = ['apps/tokenise.c'], + target = 'glsl2', + source = [ + 'main.cpp', + ] ) env.Program( - target = 'version', - source = ['apps/version.c'], + target = 'glcpp', + source = ['glcpp/glcpp.c'], ) - -env.Program( - target = 'process', - source = ['apps/process.c'], -) - -glsl_compile = env.Program( - target = 'compile', - source = ['apps/compile.c'], -) - -if env['platform'] == common.default_platform: - # Only export the GLSL compiler when building for the host platform - Export('glsl_compile') diff --git a/mesalib/src/glsl/apps/Makefile b/mesalib/src/glsl/apps/Makefile deleted file mode 100644 index 39a0df7fe..000000000 --- a/mesalib/src/glsl/apps/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# src/glsl/apps/Makefile - -TOP = ../../.. - -include $(TOP)/configs/current - -LIBS = \ - $(TOP)/src/glsl/pp/libglslpp.a \ - $(TOP)/src/glsl/cl/libglslcl.a - -SOURCES = \ - compile.c \ - process.c \ - purify.c \ - tokenise.c \ - version.c - -APPS = $(SOURCES:%.c=%) - -INCLUDES = -I. - - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: - $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - -.c.o: - $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: $(APPS) - -install: - -clean: - -rm -f $(APPS) - -rm -f *.o diff --git a/mesalib/src/glsl/apps/compile.c b/mesalib/src/glsl/apps/compile.c deleted file mode 100644 index 21c2b7617..000000000 --- a/mesalib/src/glsl/apps/compile.c +++ /dev/null @@ -1,192 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include "../pp/sl_pp_public.h" -#include "../cl/sl_cl_parse.h" - - -static void -usage(void) -{ - printf("Usage:\n"); - printf(" compile fragment|vertex <source> <output>\n"); -} - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - char errmsg[100] = ""; - struct sl_pp_context *context; - unsigned int version; - FILE *out; - unsigned char *outbytes; - unsigned int cboutbytes; - unsigned int shader_type; - - if (argc != 4) { - usage(); - return 1; - } - - if (!strcmp(argv[1], "fragment")) { - shader_type = 1; - } else if (!strcmp(argv[1], "vertex")) { - shader_type = 2; - } else { - usage(); - return 1; - } - - in = fopen(argv[2], "rb"); - if (!in) { - printf("Could not open `%s' for read.\n", argv[2]); - usage(); - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - fseek(in, 0, SEEK_SET); - - out = fopen(argv[3], "w"); - if (!out) { - fclose(in); - printf("Could not open `%s' for write.\n", argv[3]); - usage(); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - printf("Out of memory.\n"); - return 0; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - printf("Could not read from `%s'.\n", argv[2]); - return 0; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(inbuf, &options); - if (!context) { - fprintf(out, "$CONTEXERROR\n"); - - free(inbuf); - fclose(out); - printf("Could not create parse context.\n"); - return 0; - } - - if (sl_pp_version(context, &version)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - printf("Error: %s\n", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; - } - - if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") || - sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - printf("Error: %s\n", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; - } - - if (sl_cl_compile(context, shader_type, 1, &outbytes, &cboutbytes, errmsg, sizeof(errmsg)) == 0) { - unsigned int i; - unsigned int line = 0; - - fprintf(out, "\n/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */"); - fprintf(out, "\n/* %s */", argv[2]); - fprintf(out, "\n\n"); - - for (i = 0; i < cboutbytes; i++) { - unsigned int a; - - if (outbytes[i] < 10) { - a = 1; - } else if (outbytes[i] < 100) { - a = 2; - } else { - a = 3; - } - if (i < cboutbytes - 1) { - a++; - } - if (line + a >= 100) { - fprintf (out, "\n"); - line = 0; - } - line += a; - fprintf (out, "%u", outbytes[i]); - if (i < cboutbytes - 1) { - fprintf (out, ","); - } - } - fprintf (out, "\n"); - free(outbytes); - } else { - fprintf(out, "$SYNTAXERROR: `%s'\n", errmsg); - - printf("Error: %s\n", errmsg); - } - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; -} diff --git a/mesalib/src/glsl/apps/process.c b/mesalib/src/glsl/apps/process.c deleted file mode 100644 index c8a1a1868..000000000 --- a/mesalib/src/glsl/apps/process.c +++ /dev/null @@ -1,383 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include "../pp/sl_pp_public.h" - - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - struct sl_pp_context *context; - unsigned int version; - struct sl_pp_token_info *outtokens; - FILE *out; - unsigned int i; - - if (argc != 3) { - printf("Usage: process infile outfile\n"); - return 1; - } - - in = fopen(argv[1], "rb"); - if (!in) { - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - fseek(in, 0, SEEK_SET); - - out = fopen(argv[2], "wb"); - if (!out) { - fclose(in); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - return 1; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - return 1; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(inbuf, &options); - if (!context) { - fprintf(out, "$CONTEXERROR\n"); - - free(inbuf); - fclose(out); - return 1; - } - - if (sl_pp_version(context, &version)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return -1; - } - - if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") || - sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - printf("Error: %s\n", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; - } - - if (sl_pp_context_add_predefined(context, "__GLSL_PP_PREDEFINED_MACRO_TEST", "1")) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - printf("Error: %s\n", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 0; - } - - if (sl_pp_process(context, &outtokens)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return -1; - } - - free(inbuf); - - for (i = 0; outtokens[i].token != SL_PP_EOF; i++) { - switch (outtokens[i].token) { - case SL_PP_NEWLINE: - fprintf(out, "\n"); - break; - - case SL_PP_COMMA: - fprintf(out, ", "); - break; - - case SL_PP_SEMICOLON: - fprintf(out, "; "); - break; - - case SL_PP_LBRACE: - fprintf(out, "{ "); - break; - - case SL_PP_RBRACE: - fprintf(out, "} "); - break; - - case SL_PP_LPAREN: - fprintf(out, "( "); - break; - - case SL_PP_RPAREN: - fprintf(out, ") "); - break; - - case SL_PP_LBRACKET: - fprintf(out, "[ "); - break; - - case SL_PP_RBRACKET: - fprintf(out, "] "); - break; - - case SL_PP_DOT: - fprintf(out, ". "); - break; - - case SL_PP_INCREMENT: - fprintf(out, "++ "); - break; - - case SL_PP_ADDASSIGN: - fprintf(out, "+= "); - break; - - case SL_PP_PLUS: - fprintf(out, "+ "); - break; - - case SL_PP_DECREMENT: - fprintf(out, "-- "); - break; - - case SL_PP_SUBASSIGN: - fprintf(out, "-= "); - break; - - case SL_PP_MINUS: - fprintf(out, "- "); - break; - - case SL_PP_BITNOT: - fprintf(out, "~ "); - break; - - case SL_PP_NOTEQUAL: - fprintf(out, "!= "); - break; - - case SL_PP_NOT: - fprintf(out, "! "); - break; - - case SL_PP_MULASSIGN: - fprintf(out, "*= "); - break; - - case SL_PP_STAR: - fprintf(out, "* "); - break; - - case SL_PP_DIVASSIGN: - fprintf(out, "/= "); - break; - - case SL_PP_SLASH: - fprintf(out, "/ "); - break; - - case SL_PP_MODASSIGN: - fprintf(out, "%%= "); - break; - - case SL_PP_MODULO: - fprintf(out, "%% "); - break; - - case SL_PP_LSHIFTASSIGN: - fprintf(out, "<<= "); - break; - - case SL_PP_LSHIFT: - fprintf(out, "<< "); - break; - - case SL_PP_LESSEQUAL: - fprintf(out, "<= "); - break; - - case SL_PP_LESS: - fprintf(out, "< "); - break; - - case SL_PP_RSHIFTASSIGN: - fprintf(out, ">>= "); - break; - - case SL_PP_RSHIFT: - fprintf(out, ">> "); - break; - - case SL_PP_GREATEREQUAL: - fprintf(out, ">= "); - break; - - case SL_PP_GREATER: - fprintf(out, "> "); - break; - - case SL_PP_EQUAL: - fprintf(out, "== "); - break; - - case SL_PP_ASSIGN: - fprintf(out, "= "); - break; - - case SL_PP_AND: - fprintf(out, "&& "); - break; - - case SL_PP_BITANDASSIGN: - fprintf(out, "&= "); - break; - - case SL_PP_BITAND: - fprintf(out, "& "); - break; - - case SL_PP_XOR: - fprintf(out, "^^ "); - break; - - case SL_PP_BITXORASSIGN: - fprintf(out, "^= "); - break; - - case SL_PP_BITXOR: - fprintf(out, "^ "); - break; - - case SL_PP_OR: - fprintf(out, "|| "); - break; - - case SL_PP_BITORASSIGN: - fprintf(out, "|= "); - break; - - case SL_PP_BITOR: - fprintf(out, "| "); - break; - - case SL_PP_QUESTION: - fprintf(out, "? "); - break; - - case SL_PP_COLON: - fprintf(out, ": "); - break; - - case SL_PP_IDENTIFIER: - fprintf(out, "%s ", sl_pp_context_cstr(context, outtokens[i].data.identifier)); - break; - - case SL_PP_UINT: - fprintf(out, "%s ", sl_pp_context_cstr(context, outtokens[i].data._uint)); - break; - - case SL_PP_FLOAT: - fprintf(out, "%s ", sl_pp_context_cstr(context, outtokens[i].data._float)); - break; - - case SL_PP_OTHER: - fprintf(out, "%c", outtokens[i].data.other); - break; - - case SL_PP_PRAGMA_OPTIMIZE: - fprintf(out, "#pragma optimize(%s)", outtokens[i].data.pragma ? "on" : "off"); - break; - - case SL_PP_PRAGMA_DEBUG: - fprintf(out, "#pragma debug(%s)", outtokens[i].data.pragma ? "on" : "off"); - break; - - case SL_PP_EXTENSION_REQUIRE: - fprintf(out, "#extension %s : require", sl_pp_context_cstr(context, outtokens[i].data.extension)); - break; - - case SL_PP_EXTENSION_ENABLE: - fprintf(out, "#extension %s : enable", sl_pp_context_cstr(context, outtokens[i].data.extension)); - break; - - case SL_PP_EXTENSION_WARN: - fprintf(out, "#extension %s : warn", sl_pp_context_cstr(context, outtokens[i].data.extension)); - break; - - case SL_PP_EXTENSION_DISABLE: - fprintf(out, "#extension %s : disable", sl_pp_context_cstr(context, outtokens[i].data.extension)); - break; - - case SL_PP_LINE: - fprintf(out, "#line %u %u", outtokens[i].data.line.lineno, outtokens[i].data.line.fileno); - break; - - default: - assert(0); - } - } - - sl_pp_context_destroy(context); - free(outtokens); - fclose(out); - - return 0; -} diff --git a/mesalib/src/glsl/apps/purify.c b/mesalib/src/glsl/apps/purify.c deleted file mode 100644 index 5ab6bae96..000000000 --- a/mesalib/src/glsl/apps/purify.c +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "../pp/sl_pp_public.h" - - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - char *outbuf; - char errmsg[100] = ""; - unsigned int errline = 0; - FILE *out; - - if (argc != 3) { - printf("Usage: purify infile outfile\n"); - return 1; - } - - in = fopen(argv[1], "rb"); - if (!in) { - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - fseek(in, 0, SEEK_SET); - - out = fopen(argv[2], "wb"); - if (!out) { - fclose(in); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - return 1; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - return 1; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - if (sl_pp_purify(inbuf, &options, &outbuf, errmsg, sizeof(errmsg), &errline)) { - fprintf(out, "$PURIFYERROR %u: %s\n", errline, errmsg); - - free(inbuf); - fclose(out); - return 1; - } - - free(inbuf); - - fwrite(outbuf, 1, strlen(outbuf), out); - - free(outbuf); - fclose(out); - - return 0; -} diff --git a/mesalib/src/glsl/apps/tokenise.c b/mesalib/src/glsl/apps/tokenise.c deleted file mode 100644 index b4c6d6093..000000000 --- a/mesalib/src/glsl/apps/tokenise.c +++ /dev/null @@ -1,335 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include "../pp/sl_pp_public.h" - - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - struct sl_pp_context *context; - struct sl_pp_token_info *tokens; - FILE *out; - unsigned int i; - - if (argc != 3) { - printf("Usage: tokenize infile outfile\n"); - return 1; - } - - in = fopen(argv[1], "rb"); - if (!in) { - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - fseek(in, 0, SEEK_SET); - - out = fopen(argv[2], "wb"); - if (!out) { - fclose(in); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - return 1; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - return 1; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(inbuf, &options); - if (!context) { - fprintf(out, "$CONTEXERROR\n"); - - free(inbuf); - fclose(out); - return 1; - } - - if (sl_pp_tokenise(context, &tokens)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return 1; - } - - free(inbuf); - - for (i = 0; tokens[i].token != SL_PP_EOF; i++) { - switch (tokens[i].token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_NEWLINE: - fprintf(out, "\n"); - break; - - case SL_PP_HASH: - fprintf(out, "# "); - break; - - case SL_PP_COMMA: - fprintf(out, ", "); - break; - - case SL_PP_SEMICOLON: - fprintf(out, "; "); - break; - - case SL_PP_LBRACE: - fprintf(out, "{ "); - break; - - case SL_PP_RBRACE: - fprintf(out, "} "); - break; - - case SL_PP_LPAREN: - fprintf(out, "( "); - break; - - case SL_PP_RPAREN: - fprintf(out, ") "); - break; - - case SL_PP_LBRACKET: - fprintf(out, "[ "); - break; - - case SL_PP_RBRACKET: - fprintf(out, "] "); - break; - - case SL_PP_DOT: - fprintf(out, ". "); - break; - - case SL_PP_INCREMENT: - fprintf(out, "++ "); - break; - - case SL_PP_ADDASSIGN: - fprintf(out, "+= "); - break; - - case SL_PP_PLUS: - fprintf(out, "+ "); - break; - - case SL_PP_DECREMENT: - fprintf(out, "-- "); - break; - - case SL_PP_SUBASSIGN: - fprintf(out, "-= "); - break; - - case SL_PP_MINUS: - fprintf(out, "- "); - break; - - case SL_PP_BITNOT: - fprintf(out, "~ "); - break; - - case SL_PP_NOTEQUAL: - fprintf(out, "!= "); - break; - - case SL_PP_NOT: - fprintf(out, "! "); - break; - - case SL_PP_MULASSIGN: - fprintf(out, "*= "); - break; - - case SL_PP_STAR: - fprintf(out, "* "); - break; - - case SL_PP_DIVASSIGN: - fprintf(out, "/= "); - break; - - case SL_PP_SLASH: - fprintf(out, "/ "); - break; - - case SL_PP_MODASSIGN: - fprintf(out, "%%= "); - break; - - case SL_PP_MODULO: - fprintf(out, "%% "); - break; - - case SL_PP_LSHIFTASSIGN: - fprintf(out, "<<= "); - break; - - case SL_PP_LSHIFT: - fprintf(out, "<< "); - break; - - case SL_PP_LESSEQUAL: - fprintf(out, "<= "); - break; - - case SL_PP_LESS: - fprintf(out, "< "); - break; - - case SL_PP_RSHIFTASSIGN: - fprintf(out, ">>= "); - break; - - case SL_PP_RSHIFT: - fprintf(out, ">> "); - break; - - case SL_PP_GREATEREQUAL: - fprintf(out, ">= "); - break; - - case SL_PP_GREATER: - fprintf(out, "> "); - break; - - case SL_PP_EQUAL: - fprintf(out, "== "); - break; - - case SL_PP_ASSIGN: - fprintf(out, "= "); - break; - - case SL_PP_AND: - fprintf(out, "&& "); - break; - - case SL_PP_BITANDASSIGN: - fprintf(out, "&= "); - break; - - case SL_PP_BITAND: - fprintf(out, "& "); - break; - - case SL_PP_XOR: - fprintf(out, "^^ "); - break; - - case SL_PP_BITXORASSIGN: - fprintf(out, "^= "); - break; - - case SL_PP_BITXOR: - fprintf(out, "^ "); - break; - - case SL_PP_OR: - fprintf(out, "|| "); - break; - - case SL_PP_BITORASSIGN: - fprintf(out, "|= "); - break; - - case SL_PP_BITOR: - fprintf(out, "| "); - break; - - case SL_PP_QUESTION: - fprintf(out, "? "); - break; - - case SL_PP_COLON: - fprintf(out, ": "); - break; - - case SL_PP_IDENTIFIER: - fprintf(out, "%s ", sl_pp_context_cstr(context, tokens[i].data.identifier)); - break; - - case SL_PP_UINT: - fprintf(out, "(%s) ", sl_pp_context_cstr(context, tokens[i].data._uint)); - break; - - case SL_PP_FLOAT: - fprintf(out, "(%s) ", sl_pp_context_cstr(context, tokens[i].data._float)); - break; - - case SL_PP_OTHER: - if (tokens[i].data.other == '\'') { - fprintf(out, "'\\'' "); - } else { - fprintf(out, "'%c' ", tokens[i].data.other); - } - break; - - default: - assert(0); - } - } - - sl_pp_context_destroy(context); - free(tokens); - fclose(out); - - return 0; -} diff --git a/mesalib/src/glsl/apps/version.c b/mesalib/src/glsl/apps/version.c deleted file mode 100644 index 9820ad94d..000000000 --- a/mesalib/src/glsl/apps/version.c +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include "../pp/sl_pp_public.h" - - -int -main(int argc, - char *argv[]) -{ - FILE *in; - long size; - char *inbuf; - struct sl_pp_purify_options options; - struct sl_pp_context *context; - unsigned int version; - FILE *out; - - if (argc != 3) { - printf("Usage: version infile outfile\n"); - return 1; - } - - in = fopen(argv[1], "rb"); - if (!in) { - return 1; - } - - fseek(in, 0, SEEK_END); - size = ftell(in); - assert(size != -1); - fseek(in, 0, SEEK_SET); - - out = fopen(argv[2], "wb"); - if (!out) { - fclose(in); - return 1; - } - - inbuf = malloc(size + 1); - if (!inbuf) { - fprintf(out, "$OOMERROR\n"); - - fclose(out); - fclose(in); - return 1; - } - - if (fread(inbuf, 1, size, in) != size) { - fprintf(out, "$READERROR\n"); - - free(inbuf); - fclose(out); - fclose(in); - return 1; - } - inbuf[size] = '\0'; - - fclose(in); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(inbuf, &options); - if (!context) { - fprintf(out, "$CONTEXERROR\n"); - - free(inbuf); - fclose(out); - return 1; - } - - if (sl_pp_version(context, &version)) { - fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context)); - - sl_pp_context_destroy(context); - free(inbuf); - fclose(out); - return -1; - } - - sl_pp_context_destroy(context); - free(inbuf); - - fprintf(out, "%u\n", version); - - fclose(out); - - return 0; -} diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h new file mode 100644 index 000000000..ba30f65df --- /dev/null +++ b/mesalib/src/glsl/ast.h @@ -0,0 +1,702 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef AST_H +#define AST_H + +#include "list.h" +#include "glsl_parser_extras.h" + +struct _mesa_glsl_parse_state; + +struct YYLTYPE; + +/** + * \defgroup AST Abstract syntax tree node definitions + * + * An abstract syntax tree is generated by the parser. This is a fairly + * direct representation of the gramma derivation for the source program. + * No symantic checking is done during the generation of the AST. Only + * syntactic checking is done. Symantic checking is performed by a later + * stage that converts the AST to a more generic intermediate representation. + * + *@{ + */ +/** + * Base class of all abstract syntax tree nodes + */ +class ast_node { +public: + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *node; + + node = talloc_zero_size(ctx, size); + assert(node != NULL); + + return node; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *table, void *ctx) + { + talloc_free(table); + } + static void operator delete(void *table) + { + talloc_free(table); + } + + /** + * Print an AST node in something approximating the original GLSL code + */ + virtual void print(void) const; + + /** + * Convert the AST node to the high-level intermediate representation + */ + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + /** + * Retrieve the source location of an AST node + * + * This function is primarily used to get the source position of an AST node + * into a form that can be passed to \c _mesa_glsl_error. + * + * \sa _mesa_glsl_error, ast_node::set_location + */ + struct YYLTYPE get_location(void) const + { + struct YYLTYPE locp; + + locp.source = this->location.source; + locp.first_line = this->location.line; + locp.first_column = this->location.column; + locp.last_line = locp.first_line; + locp.last_column = locp.first_column; + + return locp; + } + + /** + * Set the source location of an AST node from a parser location + * + * \sa ast_node::get_location + */ + void set_location(const struct YYLTYPE &locp) + { + this->location.source = locp.source; + this->location.line = locp.first_line; + this->location.column = locp.first_column; + } + + /** + * Source location of the AST node. + */ + struct { + unsigned source; /**< GLSL source number. */ + unsigned line; /**< Line number within the source string. */ + unsigned column; /**< Column in the line. */ + } location; + + exec_node link; + +protected: + /** + * The only constructor is protected so that only derived class objects can + * be created. + */ + ast_node(void); +}; + + +/** + * Operators for AST expression nodes. + */ +enum ast_operators { + ast_assign, + ast_plus, /**< Unary + operator. */ + ast_neg, + ast_add, + ast_sub, + ast_mul, + ast_div, + ast_mod, + ast_lshift, + ast_rshift, + ast_less, + ast_greater, + ast_lequal, + ast_gequal, + ast_equal, + ast_nequal, + ast_bit_and, + ast_bit_xor, + ast_bit_or, + ast_bit_not, + ast_logic_and, + ast_logic_xor, + ast_logic_or, + ast_logic_not, + + ast_mul_assign, + ast_div_assign, + ast_mod_assign, + ast_add_assign, + ast_sub_assign, + ast_ls_assign, + ast_rs_assign, + ast_and_assign, + ast_xor_assign, + ast_or_assign, + + ast_conditional, + + ast_pre_inc, + ast_pre_dec, + ast_post_inc, + ast_post_dec, + ast_field_selection, + ast_array_index, + + ast_function_call, + + ast_identifier, + ast_int_constant, + ast_uint_constant, + ast_float_constant, + ast_bool_constant, + + ast_sequence +}; + +/** + * Representation of any sort of expression. + */ +class ast_expression : public ast_node { +public: + ast_expression(int oper, ast_expression *, + ast_expression *, ast_expression *); + + ast_expression(const char *identifier) : + oper(ast_identifier) + { + subexpressions[0] = NULL; + subexpressions[1] = NULL; + subexpressions[2] = NULL; + primary_expression.identifier = (char *) identifier; + } + + static const char *operator_string(enum ast_operators op); + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + virtual void print(void) const; + + enum ast_operators oper; + + ast_expression *subexpressions[3]; + + union { + char *identifier; + int int_constant; + float float_constant; + unsigned uint_constant; + int bool_constant; + } primary_expression; + + + /** + * List of expressions for an \c ast_sequence or parameters for an + * \c ast_function_call + */ + exec_list expressions; +}; + +class ast_expression_bin : public ast_expression { +public: + ast_expression_bin(int oper, ast_expression *, ast_expression *); + + virtual void print(void) const; +}; + +/** + * Subclass of expressions for function calls + */ +class ast_function_expression : public ast_expression { +public: + ast_function_expression(ast_expression *callee) + : ast_expression(ast_function_call, callee, + NULL, NULL), + cons(false) + { + /* empty */ + } + + ast_function_expression(class ast_type_specifier *type) + : ast_expression(ast_function_call, (ast_expression *) type, + NULL, NULL), + cons(true) + { + /* empty */ + } + + bool is_constructor() const + { + return cons; + } + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +private: + /** + * Is this function call actually a constructor? + */ + bool cons; +}; + + +/** + * Number of possible operators for an ast_expression + * + * This is done as a define instead of as an additional value in the enum so + * that the compiler won't generate spurious messages like "warning: + * enumeration value ‘ast_num_operators’ not handled in switch" + */ +#define AST_NUM_OPERATORS (ast_sequence + 1) + + +class ast_compound_statement : public ast_node { +public: + ast_compound_statement(int new_scope, ast_node *statements); + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + int new_scope; + exec_list statements; +}; + +class ast_declaration : public ast_node { +public: + ast_declaration(char *identifier, int is_array, ast_expression *array_size, + ast_expression *initializer); + virtual void print(void) const; + + char *identifier; + + int is_array; + ast_expression *array_size; + + ast_expression *initializer; +}; + + +enum { + ast_precision_high = 0, /**< Default precision. */ + ast_precision_medium, + ast_precision_low +}; + +struct ast_type_qualifier { + unsigned invariant:1; + unsigned constant:1; + unsigned attribute:1; + unsigned varying:1; + unsigned in:1; + unsigned out:1; + unsigned centroid:1; + unsigned uniform:1; + unsigned smooth:1; + unsigned flat:1; + unsigned noperspective:1; + + /** \name Layout qualifiers for GL_ARB_fragment_coord_conventions */ + /*@{*/ + unsigned origin_upper_left:1; + unsigned pixel_center_integer:1; + /*@}*/ +}; + +class ast_struct_specifier : public ast_node { +public: + ast_struct_specifier(char *identifier, ast_node *declarator_list); + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + char *name; + exec_list declarations; +}; + + +enum ast_types { + ast_void, + ast_float, + ast_int, + ast_uint, + ast_bool, + ast_vec2, + ast_vec3, + ast_vec4, + ast_bvec2, + ast_bvec3, + ast_bvec4, + ast_ivec2, + ast_ivec3, + ast_ivec4, + ast_uvec2, + ast_uvec3, + ast_uvec4, + ast_mat2, + ast_mat2x3, + ast_mat2x4, + ast_mat3x2, + ast_mat3, + ast_mat3x4, + ast_mat4x2, + ast_mat4x3, + ast_mat4, + ast_sampler1d, + ast_sampler2d, + ast_sampler2drect, + ast_sampler3d, + ast_samplercube, + ast_sampler1dshadow, + ast_sampler2dshadow, + ast_sampler2drectshadow, + ast_samplercubeshadow, + ast_sampler1darray, + ast_sampler2darray, + ast_sampler1darrayshadow, + ast_sampler2darrayshadow, + ast_isampler1d, + ast_isampler2d, + ast_isampler3d, + ast_isamplercube, + ast_isampler1darray, + ast_isampler2darray, + ast_usampler1d, + ast_usampler2d, + ast_usampler3d, + ast_usamplercube, + ast_usampler1darray, + ast_usampler2darray, + + ast_struct, + ast_type_name +}; + + +class ast_type_specifier : public ast_node { +public: + ast_type_specifier(int specifier); + + /** Construct a type specifier from a type name */ + ast_type_specifier(const char *name) + : type_specifier(ast_type_name), type_name(name), structure(NULL), + is_array(false), array_size(NULL), precision(ast_precision_high) + { + /* empty */ + } + + /** Construct a type specifier from a structure definition */ + ast_type_specifier(ast_struct_specifier *s) + : type_specifier(ast_struct), type_name(s->name), structure(s), + is_array(false), array_size(NULL), precision(ast_precision_high) + { + /* empty */ + } + + const struct glsl_type *glsl_type(const char **name, + struct _mesa_glsl_parse_state *state) + const; + + virtual void print(void) const; + + ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *); + + enum ast_types type_specifier; + + const char *type_name; + ast_struct_specifier *structure; + + int is_array; + ast_expression *array_size; + + unsigned precision:2; +}; + + +class ast_fully_specified_type : public ast_node { +public: + virtual void print(void) const; + bool has_qualifiers() const; + + ast_type_qualifier qualifier; + ast_type_specifier *specifier; +}; + + +class ast_declarator_list : public ast_node { +public: + ast_declarator_list(ast_fully_specified_type *); + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + ast_fully_specified_type *type; + exec_list declarations; + + /** + * Special flag for vertex shader "invariant" declarations. + * + * Vertex shaders can contain "invariant" variable redeclarations that do + * not include a type. For example, "invariant gl_Position;". This flag + * is used to note these cases when no type is specified. + */ + int invariant; +}; + + +class ast_parameter_declarator : public ast_node { +public: + ast_parameter_declarator() + { + this->identifier = NULL; + this->is_array = false; + this->array_size = 0; + } + + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + ast_fully_specified_type *type; + char *identifier; + int is_array; + ast_expression *array_size; + + static void parameters_to_hir(exec_list *ast_parameters, + bool formal, exec_list *ir_parameters, + struct _mesa_glsl_parse_state *state); + +private: + /** Is this parameter declaration part of a formal parameter list? */ + bool formal_parameter; + + /** + * Is this parameter 'void' type? + * + * This field is set by \c ::hir. + */ + bool is_void; +}; + + +class ast_function : public ast_node { +public: + ast_function(void); + + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + ast_fully_specified_type *return_type; + char *identifier; + + exec_list parameters; + +private: + /** + * Is this prototype part of the function definition? + * + * Used by ast_function_definition::hir to process the parameters, etc. + * of the function. + * + * \sa ::hir + */ + bool is_definition; + + /** + * Function signature corresponding to this function prototype instance + * + * Used by ast_function_definition::hir to process the parameters, etc. + * of the function. + * + * \sa ::hir + */ + class ir_function_signature *signature; + + friend class ast_function_definition; +}; + + +class ast_declaration_statement : public ast_node { +public: + ast_declaration_statement(void); + + enum { + ast_function, + ast_declaration, + ast_precision + } mode; + + union { + class ast_function *function; + ast_declarator_list *declarator; + ast_type_specifier *type; + ast_node *node; + } declaration; +}; + + +class ast_expression_statement : public ast_node { +public: + ast_expression_statement(ast_expression *); + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + ast_expression *expression; +}; + + +class ast_case_label : public ast_node { +public: + + /** + * An expression of NULL means 'default'. + */ + ast_expression *expression; +}; + +class ast_selection_statement : public ast_node { +public: + ast_selection_statement(ast_expression *condition, + ast_node *then_statement, + ast_node *else_statement); + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + ast_expression *condition; + ast_node *then_statement; + ast_node *else_statement; +}; + + +class ast_switch_statement : public ast_node { +public: + ast_expression *expression; + exec_list statements; +}; + +class ast_iteration_statement : public ast_node { +public: + ast_iteration_statement(int mode, ast_node *init, ast_node *condition, + ast_expression *rest_expression, ast_node *body); + + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *, struct _mesa_glsl_parse_state *); + + enum ast_iteration_modes { + ast_for, + ast_while, + ast_do_while + } mode; + + + ast_node *init_statement; + ast_node *condition; + ast_expression *rest_expression; + + ast_node *body; + +private: + /** + * Generate IR from the condition of a loop + * + * This is factored out of ::hir because some loops have the condition + * test at the top (for and while), and others have it at the end (do-while). + */ + void condition_to_hir(class ir_loop *, struct _mesa_glsl_parse_state *); +}; + + +class ast_jump_statement : public ast_node { +public: + ast_jump_statement(int mode, ast_expression *return_value); + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + enum ast_jump_modes { + ast_continue, + ast_break, + ast_return, + ast_discard + } mode; + + ast_expression *opt_return_value; +}; + + +class ast_function_definition : public ast_node { +public: + virtual void print(void) const; + + virtual ir_rvalue *hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + ast_function *prototype; + ast_compound_statement *body; +}; +/*@}*/ + +extern void +_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); + +extern ir_rvalue * +_mesa_ast_field_selection_to_hir(const ast_expression *expr, + exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +#endif /* AST_H */ diff --git a/mesalib/src/glsl/ast_expr.cpp b/mesalib/src/glsl/ast_expr.cpp new file mode 100644 index 000000000..4e83decb9 --- /dev/null +++ b/mesalib/src/glsl/ast_expr.cpp @@ -0,0 +1,96 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <cstdio> +#include <cassert> +#include "ast.h" + +const char * +ast_expression::operator_string(enum ast_operators op) +{ + static const char *const operators[] = { + "=", + "+", + "-", + "+", + "-", + "*", + "/", + "%", + "<<", + ">>", + "<", + ">", + "<=", + ">=", + "==", + "!=", + "&", + "^", + "|", + "~", + "&&", + "^^", + "||", + "!", + + "*=", + "/=", + "%=", + "+=", + "-=", + "<<=", + ">>=", + "&=", + "^=", + "|=", + + "?:", + + "++", + "--", + "++", + "--", + ".", + }; + + assert((unsigned int)op < sizeof(operators) / sizeof(operators[0])); + + return operators[op]; +} + + +ast_expression_bin::ast_expression_bin(int oper, ast_expression *ex0, + ast_expression *ex1) : + ast_expression(oper, ex0, ex1, NULL) +{ + assert((oper >= ast_plus) && (oper <= ast_logic_not)); +} + + +void +ast_expression_bin::print(void) const +{ + subexpressions[0]->print(); + printf("%s ", operator_string(oper)); + subexpressions[1]->print(); +} diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp new file mode 100644 index 000000000..20448f5a9 --- /dev/null +++ b/mesalib/src/glsl/ast_function.cpp @@ -0,0 +1,1241 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glsl_symbol_table.h" +#include "ast.h" +#include "glsl_types.h" +#include "ir.h" +#include "main/core.h" /* for MIN2 */ + +static ir_rvalue * +convert_component(ir_rvalue *src, const glsl_type *desired_type); + +bool +apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from, + struct _mesa_glsl_parse_state *state); + +static unsigned +process_parameters(exec_list *instructions, exec_list *actual_parameters, + exec_list *parameters, + struct _mesa_glsl_parse_state *state) +{ + unsigned count = 0; + + foreach_list (n, parameters) { + ast_node *const ast = exec_node_data(ast_node, n, link); + ir_rvalue *result = ast->hir(instructions, state); + + ir_constant *const constant = result->constant_expression_value(); + if (constant != NULL) + result = constant; + + actual_parameters->push_tail(result); + count++; + } + + return count; +} + + +/** + * Generate a source prototype for a function signature + * + * \param return_type Return type of the function. May be \c NULL. + * \param name Name of the function. + * \param parameters Parameter list for the function. This may be either a + * formal or actual parameter list. Only the type is used. + * + * \return + * A talloced string representing the prototype of the function. + */ +char * +prototype_string(const glsl_type *return_type, const char *name, + exec_list *parameters) +{ + char *str = NULL; + + if (return_type != NULL) + str = talloc_asprintf(str, "%s ", return_type->name); + + str = talloc_asprintf_append(str, "%s(", name); + + const char *comma = ""; + foreach_list(node, parameters) { + const ir_instruction *const param = (ir_instruction *) node; + + str = talloc_asprintf_append(str, "%s%s", comma, param->type->name); + comma = ", "; + } + + str = talloc_strdup_append(str, ")"); + return str; +} + + +static ir_rvalue * +process_call(exec_list *instructions, ir_function *f, + YYLTYPE *loc, exec_list *actual_parameters, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + + ir_function_signature *sig = f->matching_signature(actual_parameters); + + /* The instructions param will be used when the FINISHMEs below are done */ + (void) instructions; + + if (sig != NULL) { + /* Verify that 'out' and 'inout' actual parameters are lvalues. This + * isn't done in ir_function::matching_signature because that function + * cannot generate the necessary diagnostics. + */ + exec_list_iterator actual_iter = actual_parameters->iterator(); + exec_list_iterator formal_iter = sig->parameters.iterator(); + + while (actual_iter.has_next()) { + ir_rvalue *actual = (ir_rvalue *) actual_iter.get(); + ir_variable *formal = (ir_variable *) formal_iter.get(); + + assert(actual != NULL); + assert(formal != NULL); + + if ((formal->mode == ir_var_out) + || (formal->mode == ir_var_inout)) { + if (! actual->is_lvalue()) { + /* FINISHME: Log a better diagnostic here. There is no way + * FINISHME: to tell the user which parameter is invalid. + */ + _mesa_glsl_error(loc, state, "`%s' parameter is not lvalue", + (formal->mode == ir_var_out) ? "out" : "inout"); + } + } + + if (formal->type->is_numeric() || formal->type->is_boolean()) { + ir_rvalue *converted = convert_component(actual, formal->type); + actual->replace_with(converted); + } + + actual_iter.next(); + formal_iter.next(); + } + + /* Always insert the call in the instruction stream, and return a deref + * of its return val if it returns a value, since we don't know if + * the rvalue is going to be assigned to anything or not. + */ + ir_call *call = new(ctx) ir_call(sig, actual_parameters); + if (!sig->return_type->is_void()) { + ir_variable *var; + ir_dereference_variable *deref; + + var = new(ctx) ir_variable(sig->return_type, + talloc_asprintf(ctx, "%s_retval", + sig->function_name()), + ir_var_temporary); + instructions->push_tail(var); + + deref = new(ctx) ir_dereference_variable(var); + ir_assignment *assign = new(ctx) ir_assignment(deref, call, NULL); + instructions->push_tail(assign); + if (state->language_version >= 120) + var->constant_value = call->constant_expression_value(); + + deref = new(ctx) ir_dereference_variable(var); + return deref; + } else { + instructions->push_tail(call); + return NULL; + } + } else { + char *str = prototype_string(NULL, f->name, actual_parameters); + + _mesa_glsl_error(loc, state, "no matching function for call to `%s'", + str); + talloc_free(str); + + const char *prefix = "candidates are: "; + foreach_list (node, &f->signatures) { + ir_function_signature *sig = (ir_function_signature *) node; + + str = prototype_string(sig->return_type, f->name, &sig->parameters); + _mesa_glsl_error(loc, state, "%s%s\n", prefix, str); + talloc_free(str); + + prefix = " "; + } + + return ir_call::get_error_instruction(ctx); + } +} + + +static ir_rvalue * +match_function_by_name(exec_list *instructions, const char *name, + YYLTYPE *loc, exec_list *actual_parameters, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + ir_function *f = state->symbols->get_function(name); + + if (f == NULL) { + _mesa_glsl_error(loc, state, "function `%s' undeclared", name); + return ir_call::get_error_instruction(ctx); + } + + /* Once we've determined that the function being called might exist, try + * to find an overload of the function that matches the parameters. + */ + return process_call(instructions, f, loc, actual_parameters, state); +} + + +/** + * Perform automatic type conversion of constructor parameters + * + * This implements the rules in the "Conversion and Scalar Constructors" + * section (GLSL 1.10 section 5.4.1), not the "Implicit Conversions" rules. + */ +static ir_rvalue * +convert_component(ir_rvalue *src, const glsl_type *desired_type) +{ + void *ctx = talloc_parent(src); + const unsigned a = desired_type->base_type; + const unsigned b = src->type->base_type; + ir_expression *result = NULL; + + if (src->type->is_error()) + return src; + + assert(a <= GLSL_TYPE_BOOL); + assert(b <= GLSL_TYPE_BOOL); + + if ((a == b) || (src->type->is_integer() && desired_type->is_integer())) + return src; + + switch (a) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + if (b == GLSL_TYPE_FLOAT) + result = new(ctx) ir_expression(ir_unop_f2i, desired_type, src, NULL); + else { + assert(b == GLSL_TYPE_BOOL); + result = new(ctx) ir_expression(ir_unop_b2i, desired_type, src, NULL); + } + break; + case GLSL_TYPE_FLOAT: + switch (b) { + case GLSL_TYPE_UINT: + result = new(ctx) ir_expression(ir_unop_u2f, desired_type, src, NULL); + break; + case GLSL_TYPE_INT: + result = new(ctx) ir_expression(ir_unop_i2f, desired_type, src, NULL); + break; + case GLSL_TYPE_BOOL: + result = new(ctx) ir_expression(ir_unop_b2f, desired_type, src, NULL); + break; + } + break; + case GLSL_TYPE_BOOL: + switch (b) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + result = new(ctx) ir_expression(ir_unop_i2b, desired_type, src, NULL); + break; + case GLSL_TYPE_FLOAT: + result = new(ctx) ir_expression(ir_unop_f2b, desired_type, src, NULL); + break; + } + break; + } + + assert(result != NULL); + + /* Try constant folding; it may fold in the conversion we just added. */ + ir_constant *const constant = result->constant_expression_value(); + return (constant != NULL) ? (ir_rvalue *) constant : (ir_rvalue *) result; +} + +/** + * Dereference a specific component from a scalar, vector, or matrix + */ +static ir_rvalue * +dereference_component(ir_rvalue *src, unsigned component) +{ + void *ctx = talloc_parent(src); + assert(component < src->type->components()); + + /* If the source is a constant, just create a new constant instead of a + * dereference of the existing constant. + */ + ir_constant *constant = src->as_constant(); + if (constant) + return new(ctx) ir_constant(constant, component); + + if (src->type->is_scalar()) { + return src; + } else if (src->type->is_vector()) { + return new(ctx) ir_swizzle(src, component, 0, 0, 0, 1); + } else { + assert(src->type->is_matrix()); + + /* Dereference a row of the matrix, then call this function again to get + * a specific element from that row. + */ + const int c = component / src->type->column_type()->vector_elements; + const int r = component % src->type->column_type()->vector_elements; + ir_constant *const col_index = new(ctx) ir_constant(c); + ir_dereference *const col = new(ctx) ir_dereference_array(src, col_index); + + col->type = src->type->column_type(); + + return dereference_component(col, r); + } + + assert(!"Should not get here."); + return NULL; +} + + +static ir_rvalue * +process_array_constructor(exec_list *instructions, + const glsl_type *constructor_type, + YYLTYPE *loc, exec_list *parameters, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + /* Array constructors come in two forms: sized and unsized. Sized array + * constructors look like 'vec4[2](a, b)', where 'a' and 'b' are vec4 + * variables. In this case the number of parameters must exactly match the + * specified size of the array. + * + * Unsized array constructors look like 'vec4[](a, b)', where 'a' and 'b' + * are vec4 variables. In this case the size of the array being constructed + * is determined by the number of parameters. + * + * From page 52 (page 58 of the PDF) of the GLSL 1.50 spec: + * + * "There must be exactly the same number of arguments as the size of + * the array being constructed. If no size is present in the + * constructor, then the array is explicitly sized to the number of + * arguments provided. The arguments are assigned in order, starting at + * element 0, to the elements of the constructed array. Each argument + * must be the same type as the element type of the array, or be a type + * that can be converted to the element type of the array according to + * Section 4.1.10 "Implicit Conversions."" + */ + exec_list actual_parameters; + const unsigned parameter_count = + process_parameters(instructions, &actual_parameters, parameters, state); + + if ((parameter_count == 0) + || ((constructor_type->length != 0) + && (constructor_type->length != parameter_count))) { + const unsigned min_param = (constructor_type->length == 0) + ? 1 : constructor_type->length; + + _mesa_glsl_error(loc, state, "array constructor must have %s %u " + "parameter%s", + (constructor_type->length != 0) ? "at least" : "exactly", + min_param, (min_param <= 1) ? "" : "s"); + return ir_call::get_error_instruction(ctx); + } + + if (constructor_type->length == 0) { + constructor_type = + glsl_type::get_array_instance(constructor_type->element_type(), + parameter_count); + assert(constructor_type != NULL); + assert(constructor_type->length == parameter_count); + } + + bool all_parameters_are_constant = true; + + /* Type cast each parameter and, if possible, fold constants. */ + foreach_list_safe(n, &actual_parameters) { + ir_rvalue *ir = (ir_rvalue *) n; + ir_rvalue *result = ir; + + /* Apply implicit conversions (not the scalar constructor rules!) */ + if (constructor_type->element_type()->is_float()) { + const glsl_type *desired_type = + glsl_type::get_instance(GLSL_TYPE_FLOAT, + ir->type->vector_elements, + ir->type->matrix_columns); + result = convert_component(ir, desired_type); + } + + if (result->type != constructor_type->element_type()) { + _mesa_glsl_error(loc, state, "type error in array constructor: " + "expected: %s, found %s", + constructor_type->element_type()->name, + result->type->name); + } + + /* Attempt to convert the parameter to a constant valued expression. + * After doing so, track whether or not all the parameters to the + * constructor are trivially constant valued expressions. + */ + ir_rvalue *const constant = result->constant_expression_value(); + + if (constant != NULL) + result = constant; + else + all_parameters_are_constant = false; + + ir->replace_with(result); + } + + if (all_parameters_are_constant) + return new(ctx) ir_constant(constructor_type, &actual_parameters); + + ir_variable *var = new(ctx) ir_variable(constructor_type, "array_ctor", + ir_var_temporary); + instructions->push_tail(var); + + int i = 0; + foreach_list(node, &actual_parameters) { + ir_rvalue *rhs = (ir_rvalue *) node; + ir_rvalue *lhs = new(ctx) ir_dereference_array(var, + new(ctx) ir_constant(i)); + + ir_instruction *assignment = new(ctx) ir_assignment(lhs, rhs, NULL); + instructions->push_tail(assignment); + + i++; + } + + return new(ctx) ir_dereference_variable(var); +} + + +/** + * Try to convert a record constructor to a constant expression + */ +static ir_constant * +constant_record_constructor(const glsl_type *constructor_type, + exec_list *parameters, void *mem_ctx) +{ + foreach_list(node, parameters) { + ir_constant *constant = ((ir_instruction *) node)->as_constant(); + if (constant == NULL) + return NULL; + node->replace_with(constant); + } + + return new(mem_ctx) ir_constant(constructor_type, parameters); +} + + +/** + * Determine if a list consists of a single scalar r-value + */ +bool +single_scalar_parameter(exec_list *parameters) +{ + const ir_rvalue *const p = (ir_rvalue *) parameters->head; + assert(((ir_rvalue *)p)->as_rvalue() != NULL); + + return (p->type->is_scalar() && p->next->is_tail_sentinel()); +} + + +/** + * Generate inline code for a vector constructor + * + * The generated constructor code will consist of a temporary variable + * declaration of the same type as the constructor. A sequence of assignments + * from constructor parameters to the temporary will follow. + * + * \return + * An \c ir_dereference_variable of the temprorary generated in the constructor + * body. + */ +ir_rvalue * +emit_inline_vector_constructor(const glsl_type *type, + exec_list *instructions, + exec_list *parameters, + void *ctx) +{ + assert(!parameters->is_empty()); + + ir_variable *var = new(ctx) ir_variable(type, "vec_ctor", ir_var_temporary); + instructions->push_tail(var); + + /* There are two kinds of vector constructors. + * + * - Construct a vector from a single scalar by replicating that scalar to + * all components of the vector. + * + * - Construct a vector from an arbirary combination of vectors and + * scalars. The components of the constructor parameters are assigned + * to the vector in order until the vector is full. + */ + const unsigned lhs_components = type->components(); + if (single_scalar_parameter(parameters)) { + ir_rvalue *first_param = (ir_rvalue *)parameters->head; + ir_rvalue *rhs = new(ctx) ir_swizzle(first_param, 0, 0, 0, 0, + lhs_components); + ir_dereference_variable *lhs = new(ctx) ir_dereference_variable(var); + const unsigned mask = (1U << lhs_components) - 1; + + assert(rhs->type == lhs->type); + + ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL, mask); + instructions->push_tail(inst); + } else { + unsigned base_component = 0; + unsigned base_lhs_component = 0; + ir_constant_data data; + unsigned constant_mask = 0, constant_components = 0; + + memset(&data, 0, sizeof(data)); + + foreach_list(node, parameters) { + ir_rvalue *param = (ir_rvalue *) node; + unsigned rhs_components = param->type->components(); + + /* Do not try to assign more components to the vector than it has! + */ + if ((rhs_components + base_lhs_component) > lhs_components) { + rhs_components = lhs_components - base_lhs_component; + } + + const ir_constant *const c = param->as_constant(); + if (c != NULL) { + for (unsigned i = 0; i < rhs_components; i++) { + switch (c->type->base_type) { + case GLSL_TYPE_UINT: + data.u[i + base_component] = c->get_uint_component(i); + break; + case GLSL_TYPE_INT: + data.i[i + base_component] = c->get_int_component(i); + break; + case GLSL_TYPE_FLOAT: + data.f[i + base_component] = c->get_float_component(i); + break; + case GLSL_TYPE_BOOL: + data.b[i + base_component] = c->get_bool_component(i); + break; + default: + assert(!"Should not get here."); + break; + } + } + + /* Mask of fields to be written in the assignment. + */ + constant_mask |= ((1U << rhs_components) - 1) << base_lhs_component; + constant_components++; + + base_component += rhs_components; + } + /* Advance the component index by the number of components + * that were just assigned. + */ + base_lhs_component += rhs_components; + } + + if (constant_mask != 0) { + ir_dereference *lhs = new(ctx) ir_dereference_variable(var); + const glsl_type *rhs_type = glsl_type::get_instance(var->type->base_type, + constant_components, + 1); + ir_rvalue *rhs = new(ctx) ir_constant(rhs_type, &data); + + ir_instruction *inst = + new(ctx) ir_assignment(lhs, rhs, NULL, constant_mask); + instructions->push_tail(inst); + } + + base_component = 0; + foreach_list(node, parameters) { + ir_rvalue *param = (ir_rvalue *) node; + unsigned rhs_components = param->type->components(); + + /* Do not try to assign more components to the vector than it has! + */ + if ((rhs_components + base_component) > lhs_components) { + rhs_components = lhs_components - base_component; + } + + const ir_constant *const c = param->as_constant(); + if (c == NULL) { + /* Generate a swizzle in case rhs_components != rhs->type->vector_elements. */ + unsigned swiz[4] = { 0, 0, 0, 0 }; + for (unsigned i = 0; i < rhs_components; i++) + swiz[i] = i; + + /* Mask of fields to be written in the assignment. + */ + const unsigned write_mask = ((1U << rhs_components) - 1) + << base_component; + + ir_dereference *lhs = new(ctx) ir_dereference_variable(var); + ir_rvalue *rhs = new(ctx) ir_swizzle(param, swiz, rhs_components); + + ir_instruction *inst = + new(ctx) ir_assignment(lhs, rhs, NULL, write_mask); + instructions->push_tail(inst); + } + + /* Advance the component index by the number of components that were + * just assigned. + */ + base_component += rhs_components; + } + } + return new(ctx) ir_dereference_variable(var); +} + + +/** + * Generate assignment of a portion of a vector to a portion of a matrix column + * + * \param src_base First component of the source to be used in assignment + * \param column Column of destination to be assiged + * \param row_base First component of the destination column to be assigned + * \param count Number of components to be assigned + * + * \note + * \c src_base + \c count must be less than or equal to the number of components + * in the source vector. + */ +ir_instruction * +assign_to_matrix_column(ir_variable *var, unsigned column, unsigned row_base, + ir_rvalue *src, unsigned src_base, unsigned count, + void *mem_ctx) +{ + ir_constant *col_idx = new(mem_ctx) ir_constant(column); + ir_dereference *column_ref = new(mem_ctx) ir_dereference_array(var, col_idx); + + assert(column_ref->type->components() >= (row_base + count)); + assert(src->type->components() >= (src_base + count)); + + /* Generate a swizzle that puts the first element of the source at the + * location of the first element of the destination. + */ + unsigned swiz[4] = { src_base, src_base, src_base, src_base }; + for (unsigned i = 0; i < count; i++) + swiz[i + row_base] = i; + + ir_rvalue *const rhs = + new(mem_ctx) ir_swizzle(src, swiz, count); + + /* Mask of fields to be written in the assignment. + */ + const unsigned write_mask = ((1U << count) - 1) << row_base; + + return new(mem_ctx) ir_assignment(column_ref, rhs, NULL, write_mask); +} + + +/** + * Generate inline code for a matrix constructor + * + * The generated constructor code will consist of a temporary variable + * declaration of the same type as the constructor. A sequence of assignments + * from constructor parameters to the temporary will follow. + * + * \return + * An \c ir_dereference_variable of the temprorary generated in the constructor + * body. + */ +ir_rvalue * +emit_inline_matrix_constructor(const glsl_type *type, + exec_list *instructions, + exec_list *parameters, + void *ctx) +{ + assert(!parameters->is_empty()); + + ir_variable *var = new(ctx) ir_variable(type, "mat_ctor", ir_var_temporary); + instructions->push_tail(var); + + /* There are three kinds of matrix constructors. + * + * - Construct a matrix from a single scalar by replicating that scalar to + * along the diagonal of the matrix and setting all other components to + * zero. + * + * - Construct a matrix from an arbirary combination of vectors and + * scalars. The components of the constructor parameters are assigned + * to the matrix in colum-major order until the matrix is full. + * + * - Construct a matrix from a single matrix. The source matrix is copied + * to the upper left portion of the constructed matrix, and the remaining + * elements take values from the identity matrix. + */ + ir_rvalue *const first_param = (ir_rvalue *) parameters->head; + if (single_scalar_parameter(parameters)) { + /* Assign the scalar to the X component of a vec4, and fill the remaining + * components with zero. + */ + ir_variable *rhs_var = + new(ctx) ir_variable(glsl_type::vec4_type, "mat_ctor_vec", + ir_var_temporary); + instructions->push_tail(rhs_var); + + ir_constant_data zero; + zero.f[0] = 0.0; + zero.f[1] = 0.0; + zero.f[2] = 0.0; + zero.f[3] = 0.0; + + ir_instruction *inst = + new(ctx) ir_assignment(new(ctx) ir_dereference_variable(rhs_var), + new(ctx) ir_constant(rhs_var->type, &zero), + NULL); + instructions->push_tail(inst); + + ir_dereference *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var); + + inst = new(ctx) ir_assignment(rhs_ref, first_param, NULL, 0x01); + instructions->push_tail(inst); + + /* Assign the temporary vector to each column of the destination matrix + * with a swizzle that puts the X component on the diagonal of the + * matrix. In some cases this may mean that the X component does not + * get assigned into the column at all (i.e., when the matrix has more + * columns than rows). + */ + static const unsigned rhs_swiz[4][4] = { + { 0, 1, 1, 1 }, + { 1, 0, 1, 1 }, + { 1, 1, 0, 1 }, + { 1, 1, 1, 0 } + }; + + const unsigned cols_to_init = MIN2(type->matrix_columns, + type->vector_elements); + for (unsigned i = 0; i < cols_to_init; i++) { + ir_constant *const col_idx = new(ctx) ir_constant(i); + ir_rvalue *const col_ref = new(ctx) ir_dereference_array(var, col_idx); + + ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var); + ir_rvalue *const rhs = new(ctx) ir_swizzle(rhs_ref, rhs_swiz[i], + type->vector_elements); + + inst = new(ctx) ir_assignment(col_ref, rhs, NULL); + instructions->push_tail(inst); + } + + for (unsigned i = cols_to_init; i < type->matrix_columns; i++) { + ir_constant *const col_idx = new(ctx) ir_constant(i); + ir_rvalue *const col_ref = new(ctx) ir_dereference_array(var, col_idx); + + ir_rvalue *const rhs_ref = new(ctx) ir_dereference_variable(rhs_var); + ir_rvalue *const rhs = new(ctx) ir_swizzle(rhs_ref, 1, 1, 1, 1, + type->vector_elements); + + inst = new(ctx) ir_assignment(col_ref, rhs, NULL); + instructions->push_tail(inst); + } + } else if (first_param->type->is_matrix()) { + /* From page 50 (56 of the PDF) of the GLSL 1.50 spec: + * + * "If a matrix is constructed from a matrix, then each component + * (column i, row j) in the result that has a corresponding + * component (column i, row j) in the argument will be initialized + * from there. All other components will be initialized to the + * identity matrix. If a matrix argument is given to a matrix + * constructor, it is an error to have any other arguments." + */ + assert(first_param->next->is_tail_sentinel()); + ir_rvalue *const src_matrix = first_param; + + /* If the source matrix is smaller, pre-initialize the relavent parts of + * the destination matrix to the identity matrix. + */ + if ((src_matrix->type->matrix_columns < var->type->matrix_columns) + || (src_matrix->type->vector_elements < var->type->vector_elements)) { + + /* If the source matrix has fewer rows, every column of the destination + * must be initialized. Otherwise only the columns in the destination + * that do not exist in the source must be initialized. + */ + unsigned col = + (src_matrix->type->vector_elements < var->type->vector_elements) + ? 0 : src_matrix->type->matrix_columns; + + const glsl_type *const col_type = var->type->column_type(); + for (/* empty */; col < var->type->matrix_columns; col++) { + ir_constant_data ident; + + ident.f[0] = 0.0; + ident.f[1] = 0.0; + ident.f[2] = 0.0; + ident.f[3] = 0.0; + + ident.f[col] = 1.0; + + ir_rvalue *const rhs = new(ctx) ir_constant(col_type, &ident); + + ir_rvalue *const lhs = + new(ctx) ir_dereference_array(var, new(ctx) ir_constant(col)); + + ir_instruction *inst = new(ctx) ir_assignment(lhs, rhs, NULL); + instructions->push_tail(inst); + } + } + + /* Assign columns from the source matrix to the destination matrix. + * + * Since the parameter will be used in the RHS of multiple assignments, + * generate a temporary and copy the paramter there. + */ + ir_variable *const rhs_var = + new(ctx) ir_variable(first_param->type, "mat_ctor_mat", + ir_var_temporary); + instructions->push_tail(rhs_var); + + ir_dereference *const rhs_var_ref = + new(ctx) ir_dereference_variable(rhs_var); + ir_instruction *const inst = + new(ctx) ir_assignment(rhs_var_ref, first_param, NULL); + instructions->push_tail(inst); + + const unsigned last_row = MIN2(src_matrix->type->vector_elements, + var->type->vector_elements); + const unsigned last_col = MIN2(src_matrix->type->matrix_columns, + var->type->matrix_columns); + + unsigned swiz[4] = { 0, 0, 0, 0 }; + for (unsigned i = 1; i < last_row; i++) + swiz[i] = i; + + const unsigned write_mask = (1U << last_row) - 1; + + for (unsigned i = 0; i < last_col; i++) { + ir_dereference *const lhs = + new(ctx) ir_dereference_array(var, new(ctx) ir_constant(i)); + ir_rvalue *const rhs_col = + new(ctx) ir_dereference_array(rhs_var, new(ctx) ir_constant(i)); + + /* If one matrix has columns that are smaller than the columns of the + * other matrix, wrap the column access of the larger with a swizzle + * so that the LHS and RHS of the assignment have the same size (and + * therefore have the same type). + * + * It would be perfectly valid to unconditionally generate the + * swizzles, this this will typically result in a more compact IR tree. + */ + ir_rvalue *rhs; + if (lhs->type->vector_elements != rhs_col->type->vector_elements) { + rhs = new(ctx) ir_swizzle(rhs_col, swiz, last_row); + } else { + rhs = rhs_col; + } + + ir_instruction *inst = + new(ctx) ir_assignment(lhs, rhs, NULL, write_mask); + instructions->push_tail(inst); + } + } else { + const unsigned cols = type->matrix_columns; + const unsigned rows = type->vector_elements; + unsigned col_idx = 0; + unsigned row_idx = 0; + + foreach_list (node, parameters) { + ir_rvalue *const rhs = (ir_rvalue *) node; + const unsigned components_remaining_this_column = rows - row_idx; + unsigned rhs_components = rhs->type->components(); + unsigned rhs_base = 0; + + /* Since the parameter might be used in the RHS of two assignments, + * generate a temporary and copy the paramter there. + */ + ir_variable *rhs_var = + new(ctx) ir_variable(rhs->type, "mat_ctor_vec", ir_var_temporary); + instructions->push_tail(rhs_var); + + ir_dereference *rhs_var_ref = + new(ctx) ir_dereference_variable(rhs_var); + ir_instruction *inst = new(ctx) ir_assignment(rhs_var_ref, rhs, NULL); + instructions->push_tail(inst); + + /* Assign the current parameter to as many components of the matrix + * as it will fill. + * + * NOTE: A single vector parameter can span two matrix columns. A + * single vec4, for example, can completely fill a mat2. + */ + if (rhs_components >= components_remaining_this_column) { + const unsigned count = MIN2(rhs_components, + components_remaining_this_column); + + rhs_var_ref = new(ctx) ir_dereference_variable(rhs_var); + + ir_instruction *inst = assign_to_matrix_column(var, col_idx, + row_idx, + rhs_var_ref, 0, + count, ctx); + instructions->push_tail(inst); + + rhs_base = count; + + col_idx++; + row_idx = 0; + } + + /* If there is data left in the parameter and components left to be + * set in the destination, emit another assignment. It is possible + * that the assignment could be of a vec4 to the last element of the + * matrix. In this case col_idx==cols, but there is still data + * left in the source parameter. Obviously, don't emit an assignment + * to data outside the destination matrix. + */ + if ((col_idx < cols) && (rhs_base < rhs_components)) { + const unsigned count = rhs_components - rhs_base; + + rhs_var_ref = new(ctx) ir_dereference_variable(rhs_var); + + ir_instruction *inst = assign_to_matrix_column(var, col_idx, + row_idx, + rhs_var_ref, + rhs_base, + count, ctx); + instructions->push_tail(inst); + + row_idx += count; + } + } + } + + return new(ctx) ir_dereference_variable(var); +} + + +ir_rvalue * +emit_inline_record_constructor(const glsl_type *type, + exec_list *instructions, + exec_list *parameters, + void *mem_ctx) +{ + ir_variable *const var = + new(mem_ctx) ir_variable(type, "record_ctor", ir_var_temporary); + ir_dereference_variable *const d = new(mem_ctx) ir_dereference_variable(var); + + instructions->push_tail(var); + + exec_node *node = parameters->head; + for (unsigned i = 0; i < type->length; i++) { + assert(!node->is_tail_sentinel()); + + ir_dereference *const lhs = + new(mem_ctx) ir_dereference_record(d->clone(mem_ctx, NULL), + type->fields.structure[i].name); + + ir_rvalue *const rhs = ((ir_instruction *) node)->as_rvalue(); + assert(rhs != NULL); + + ir_instruction *const assign = new(mem_ctx) ir_assignment(lhs, rhs, NULL); + + instructions->push_tail(assign); + node = node->next; + } + + return d; +} + + +ir_rvalue * +ast_function_expression::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + /* There are three sorts of function calls. + * + * 1. constructors - The first subexpression is an ast_type_specifier. + * 2. methods - Only the .length() method of array types. + * 3. functions - Calls to regular old functions. + * + * Method calls are actually detected when the ast_field_selection + * expression is handled. + */ + if (is_constructor()) { + const ast_type_specifier *type = (ast_type_specifier *) subexpressions[0]; + YYLTYPE loc = type->get_location(); + const char *name; + + const glsl_type *const constructor_type = type->glsl_type(& name, state); + + + /* Constructors for samplers are illegal. + */ + if (constructor_type->is_sampler()) { + _mesa_glsl_error(& loc, state, "cannot construct sampler type `%s'", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + if (constructor_type->is_array()) { + if (state->language_version <= 110) { + _mesa_glsl_error(& loc, state, + "array constructors forbidden in GLSL 1.10"); + return ir_call::get_error_instruction(ctx); + } + + return process_array_constructor(instructions, constructor_type, + & loc, &this->expressions, state); + } + + + /* There are two kinds of constructor call. Constructors for built-in + * language types, such as mat4 and vec2, are free form. The only + * requirement is that the parameters must provide enough values of the + * correct scalar type. Constructors for arrays and structures must + * have the exact number of parameters with matching types in the + * correct order. These constructors follow essentially the same type + * matching rules as functions. + */ + if (!constructor_type->is_numeric() && !constructor_type->is_boolean()) + return ir_call::get_error_instruction(ctx); + + /* Total number of components of the type being constructed. */ + const unsigned type_components = constructor_type->components(); + + /* Number of components from parameters that have actually been + * consumed. This is used to perform several kinds of error checking. + */ + unsigned components_used = 0; + + unsigned matrix_parameters = 0; + unsigned nonmatrix_parameters = 0; + exec_list actual_parameters; + + foreach_list (n, &this->expressions) { + ast_node *ast = exec_node_data(ast_node, n, link); + ir_rvalue *result = ast->hir(instructions, state)->as_rvalue(); + + /* From page 50 (page 56 of the PDF) of the GLSL 1.50 spec: + * + * "It is an error to provide extra arguments beyond this + * last used argument." + */ + if (components_used >= type_components) { + _mesa_glsl_error(& loc, state, "too many parameters to `%s' " + "constructor", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + if (!result->type->is_numeric() && !result->type->is_boolean()) { + _mesa_glsl_error(& loc, state, "cannot construct `%s' from a " + "non-numeric data type", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + /* Count the number of matrix and nonmatrix parameters. This + * is used below to enforce some of the constructor rules. + */ + if (result->type->is_matrix()) + matrix_parameters++; + else + nonmatrix_parameters++; + + actual_parameters.push_tail(result); + components_used += result->type->components(); + } + + /* From page 28 (page 34 of the PDF) of the GLSL 1.10 spec: + * + * "It is an error to construct matrices from other matrices. This + * is reserved for future use." + */ + if (state->language_version == 110 && matrix_parameters > 0 + && constructor_type->is_matrix()) { + _mesa_glsl_error(& loc, state, "cannot construct `%s' from a " + "matrix in GLSL 1.10", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + /* From page 50 (page 56 of the PDF) of the GLSL 1.50 spec: + * + * "If a matrix argument is given to a matrix constructor, it is + * an error to have any other arguments." + */ + if ((matrix_parameters > 0) + && ((matrix_parameters + nonmatrix_parameters) > 1) + && constructor_type->is_matrix()) { + _mesa_glsl_error(& loc, state, "for matrix `%s' constructor, " + "matrix must be only parameter", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + /* From page 28 (page 34 of the PDF) of the GLSL 1.10 spec: + * + * "In these cases, there must be enough components provided in the + * arguments to provide an initializer for every component in the + * constructed value." + */ + if (components_used < type_components && components_used != 1 + && matrix_parameters == 0) { + _mesa_glsl_error(& loc, state, "too few components to construct " + "`%s'", + constructor_type->name); + return ir_call::get_error_instruction(ctx); + } + + /* Later, we cast each parameter to the same base type as the + * constructor. Since there are no non-floating point matrices, we + * need to break them up into a series of column vectors. + */ + if (constructor_type->base_type != GLSL_TYPE_FLOAT) { + foreach_list_safe(n, &actual_parameters) { + ir_rvalue *matrix = (ir_rvalue *) n; + + if (!matrix->type->is_matrix()) + continue; + + /* Create a temporary containing the matrix. */ + ir_variable *var = new(ctx) ir_variable(matrix->type, "matrix_tmp", + ir_var_temporary); + instructions->push_tail(var); + instructions->push_tail(new(ctx) ir_assignment(new(ctx) + ir_dereference_variable(var), matrix, NULL)); + var->constant_value = matrix->constant_expression_value(); + + /* Replace the matrix with dereferences of its columns. */ + for (int i = 0; i < matrix->type->matrix_columns; i++) { + matrix->insert_before(new (ctx) ir_dereference_array(var, + new(ctx) ir_constant(i))); + } + matrix->remove(); + } + } + + bool all_parameters_are_constant = true; + + /* Type cast each parameter and, if possible, fold constants.*/ + foreach_list_safe(n, &actual_parameters) { + ir_rvalue *ir = (ir_rvalue *) n; + + const glsl_type *desired_type = + glsl_type::get_instance(constructor_type->base_type, + ir->type->vector_elements, + ir->type->matrix_columns); + ir_rvalue *result = convert_component(ir, desired_type); + + /* Attempt to convert the parameter to a constant valued expression. + * After doing so, track whether or not all the parameters to the + * constructor are trivially constant valued expressions. + */ + ir_rvalue *const constant = result->constant_expression_value(); + + if (constant != NULL) + result = constant; + else + all_parameters_are_constant = false; + + if (result != ir) { + ir->replace_with(result); + } + } + + /* If all of the parameters are trivially constant, create a + * constant representing the complete collection of parameters. + */ + if (all_parameters_are_constant) { + return new(ctx) ir_constant(constructor_type, &actual_parameters); + } else if (constructor_type->is_scalar()) { + return dereference_component((ir_rvalue *) actual_parameters.head, + 0); + } else if (constructor_type->is_vector()) { + return emit_inline_vector_constructor(constructor_type, + instructions, + &actual_parameters, + ctx); + } else { + assert(constructor_type->is_matrix()); + return emit_inline_matrix_constructor(constructor_type, + instructions, + &actual_parameters, + ctx); + } + } else { + const ast_expression *id = subexpressions[0]; + YYLTYPE loc = id->get_location(); + exec_list actual_parameters; + + process_parameters(instructions, &actual_parameters, &this->expressions, + state); + + const glsl_type *const type = + state->symbols->get_type(id->primary_expression.identifier); + + if ((type != NULL) && type->is_record()) { + exec_node *node = actual_parameters.head; + for (unsigned i = 0; i < type->length; i++) { + ir_rvalue *ir = (ir_rvalue *) node; + + if (node->is_tail_sentinel()) { + _mesa_glsl_error(&loc, state, + "insufficient parameters to constructor " + "for `%s'", + type->name); + return ir_call::get_error_instruction(ctx); + } + + if (apply_implicit_conversion(type->fields.structure[i].type, ir, + state)) { + node->replace_with(ir); + } else { + _mesa_glsl_error(&loc, state, + "parameter type mismatch in constructor " + "for `%s.%s' (%s vs %s)", + type->name, + type->fields.structure[i].name, + ir->type->name, + type->fields.structure[i].type->name); + return ir_call::get_error_instruction(ctx);; + } + + node = node->next; + } + + if (!node->is_tail_sentinel()) { + _mesa_glsl_error(&loc, state, "too many parameters in constructor " + "for `%s'", type->name); + return ir_call::get_error_instruction(ctx); + } + + ir_rvalue *const constant = + constant_record_constructor(type, &actual_parameters, state); + + return (constant != NULL) + ? constant + : emit_inline_record_constructor(type, instructions, + &actual_parameters, state); + } + + return match_function_by_name(instructions, + id->primary_expression.identifier, & loc, + &actual_parameters, state); + } + + return ir_call::get_error_instruction(ctx); +} diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp new file mode 100644 index 000000000..0cbb4315a --- /dev/null +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -0,0 +1,2769 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ast_to_hir.c + * Convert abstract syntax to to high-level intermediate reprensentation (HIR). + * + * During the conversion to HIR, the majority of the symantic checking is + * preformed on the program. This includes: + * + * * Symbol table management + * * Type checking + * * Function binding + * + * The majority of this work could be done during parsing, and the parser could + * probably generate HIR directly. However, this results in frequent changes + * to the parser code. Since we do not assume that every system this complier + * is built on will have Flex and Bison installed, we have to store the code + * generated by these tools in our version control system. In other parts of + * the system we've seen problems where a parser was changed but the generated + * code was not committed, merge conflicts where created because two developers + * had slightly different versions of Bison installed, etc. + * + * I have also noticed that running Bison generated parsers in GDB is very + * irritating. When you get a segfault on '$$ = $1->foo', you can't very + * well 'print $1' in GDB. + * + * As a result, my preference is to put as little C code as possible in the + * parser (and lexer) sources. + */ + +#include "main/core.h" /* for struct gl_extensions */ +#include "glsl_symbol_table.h" +#include "glsl_parser_extras.h" +#include "ast.h" +#include "glsl_types.h" +#include "ir.h" + +void +_mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) +{ + _mesa_glsl_initialize_variables(instructions, state); + _mesa_glsl_initialize_functions(instructions, state); + + state->symbols->language_version = state->language_version; + + state->current_function = NULL; + + /* Section 4.2 of the GLSL 1.20 specification states: + * "The built-in functions are scoped in a scope outside the global scope + * users declare global variables in. That is, a shader's global scope, + * available for user-defined functions and global variables, is nested + * inside the scope containing the built-in functions." + * + * Since built-in functions like ftransform() access built-in variables, + * it follows that those must be in the outer scope as well. + * + * We push scope here to create this nesting effect...but don't pop. + * This way, a shader's globals are still in the symbol table for use + * by the linker. + */ + state->symbols->push_scope(); + + foreach_list_typed (ast_node, ast, link, & state->translation_unit) + ast->hir(instructions, state); +} + + +/** + * If a conversion is available, convert one operand to a different type + * + * The \c from \c ir_rvalue is converted "in place". + * + * \param to Type that the operand it to be converted to + * \param from Operand that is being converted + * \param state GLSL compiler state + * + * \return + * If a conversion is possible (or unnecessary), \c true is returned. + * Otherwise \c false is returned. + */ +bool +apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + if (to->base_type == from->type->base_type) + return true; + + /* This conversion was added in GLSL 1.20. If the compilation mode is + * GLSL 1.10, the conversion is skipped. + */ + if (state->language_version < 120) + return false; + + /* From page 27 (page 33 of the PDF) of the GLSL 1.50 spec: + * + * "There are no implicit array or structure conversions. For + * example, an array of int cannot be implicitly converted to an + * array of float. There are no implicit conversions between + * signed and unsigned integers." + */ + /* FINISHME: The above comment is partially a lie. There is int/uint + * FINISHME: conversion for immediate constants. + */ + if (!to->is_float() || !from->type->is_numeric()) + return false; + + /* Convert to a floating point type with the same number of components + * as the original type - i.e. int to float, not int to vec4. + */ + to = glsl_type::get_instance(GLSL_TYPE_FLOAT, from->type->vector_elements, + from->type->matrix_columns); + + switch (from->type->base_type) { + case GLSL_TYPE_INT: + from = new(ctx) ir_expression(ir_unop_i2f, to, from, NULL); + break; + case GLSL_TYPE_UINT: + from = new(ctx) ir_expression(ir_unop_u2f, to, from, NULL); + break; + case GLSL_TYPE_BOOL: + from = new(ctx) ir_expression(ir_unop_b2f, to, from, NULL); + break; + default: + assert(0); + } + + return true; +} + + +static const struct glsl_type * +arithmetic_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b, + bool multiply, + struct _mesa_glsl_parse_state *state, YYLTYPE *loc) +{ + const glsl_type *type_a = value_a->type; + const glsl_type *type_b = value_b->type; + + /* From GLSL 1.50 spec, page 56: + * + * "The arithmetic binary operators add (+), subtract (-), + * multiply (*), and divide (/) operate on integer and + * floating-point scalars, vectors, and matrices." + */ + if (!type_a->is_numeric() || !type_b->is_numeric()) { + _mesa_glsl_error(loc, state, + "Operands to arithmetic operators must be numeric"); + return glsl_type::error_type; + } + + + /* "If one operand is floating-point based and the other is + * not, then the conversions from Section 4.1.10 "Implicit + * Conversions" are applied to the non-floating-point-based operand." + */ + if (!apply_implicit_conversion(type_a, value_b, state) + && !apply_implicit_conversion(type_b, value_a, state)) { + _mesa_glsl_error(loc, state, + "Could not implicitly convert operands to " + "arithmetic operator"); + return glsl_type::error_type; + } + type_a = value_a->type; + type_b = value_b->type; + + /* "If the operands are integer types, they must both be signed or + * both be unsigned." + * + * From this rule and the preceeding conversion it can be inferred that + * both types must be GLSL_TYPE_FLOAT, or GLSL_TYPE_UINT, or GLSL_TYPE_INT. + * The is_numeric check above already filtered out the case where either + * type is not one of these, so now the base types need only be tested for + * equality. + */ + if (type_a->base_type != type_b->base_type) { + _mesa_glsl_error(loc, state, + "base type mismatch for arithmetic operator"); + return glsl_type::error_type; + } + + /* "All arithmetic binary operators result in the same fundamental type + * (signed integer, unsigned integer, or floating-point) as the + * operands they operate on, after operand type conversion. After + * conversion, the following cases are valid + * + * * The two operands are scalars. In this case the operation is + * applied, resulting in a scalar." + */ + if (type_a->is_scalar() && type_b->is_scalar()) + return type_a; + + /* "* One operand is a scalar, and the other is a vector or matrix. + * In this case, the scalar operation is applied independently to each + * component of the vector or matrix, resulting in the same size + * vector or matrix." + */ + if (type_a->is_scalar()) { + if (!type_b->is_scalar()) + return type_b; + } else if (type_b->is_scalar()) { + return type_a; + } + + /* All of the combinations of <scalar, scalar>, <vector, scalar>, + * <scalar, vector>, <scalar, matrix>, and <matrix, scalar> have been + * handled. + */ + assert(!type_a->is_scalar()); + assert(!type_b->is_scalar()); + + /* "* The two operands are vectors of the same size. In this case, the + * operation is done component-wise resulting in the same size + * vector." + */ + if (type_a->is_vector() && type_b->is_vector()) { + if (type_a == type_b) { + return type_a; + } else { + _mesa_glsl_error(loc, state, + "vector size mismatch for arithmetic operator"); + return glsl_type::error_type; + } + } + + /* All of the combinations of <scalar, scalar>, <vector, scalar>, + * <scalar, vector>, <scalar, matrix>, <matrix, scalar>, and + * <vector, vector> have been handled. At least one of the operands must + * be matrix. Further, since there are no integer matrix types, the base + * type of both operands must be float. + */ + assert(type_a->is_matrix() || type_b->is_matrix()); + assert(type_a->base_type == GLSL_TYPE_FLOAT); + assert(type_b->base_type == GLSL_TYPE_FLOAT); + + /* "* The operator is add (+), subtract (-), or divide (/), and the + * operands are matrices with the same number of rows and the same + * number of columns. In this case, the operation is done component- + * wise resulting in the same size matrix." + * * The operator is multiply (*), where both operands are matrices or + * one operand is a vector and the other a matrix. A right vector + * operand is treated as a column vector and a left vector operand as a + * row vector. In all these cases, it is required that the number of + * columns of the left operand is equal to the number of rows of the + * right operand. Then, the multiply (*) operation does a linear + * algebraic multiply, yielding an object that has the same number of + * rows as the left operand and the same number of columns as the right + * operand. Section 5.10 "Vector and Matrix Operations" explains in + * more detail how vectors and matrices are operated on." + */ + if (! multiply) { + if (type_a == type_b) + return type_a; + } else { + if (type_a->is_matrix() && type_b->is_matrix()) { + /* Matrix multiply. The columns of A must match the rows of B. Given + * the other previously tested constraints, this means the vector type + * of a row from A must be the same as the vector type of a column from + * B. + */ + if (type_a->row_type() == type_b->column_type()) { + /* The resulting matrix has the number of columns of matrix B and + * the number of rows of matrix A. We get the row count of A by + * looking at the size of a vector that makes up a column. The + * transpose (size of a row) is done for B. + */ + const glsl_type *const type = + glsl_type::get_instance(type_a->base_type, + type_a->column_type()->vector_elements, + type_b->row_type()->vector_elements); + assert(type != glsl_type::error_type); + + return type; + } + } else if (type_a->is_matrix()) { + /* A is a matrix and B is a column vector. Columns of A must match + * rows of B. Given the other previously tested constraints, this + * means the vector type of a row from A must be the same as the + * vector the type of B. + */ + if (type_a->row_type() == type_b) { + /* The resulting vector has a number of elements equal to + * the number of rows of matrix A. */ + const glsl_type *const type = + glsl_type::get_instance(type_a->base_type, + type_a->column_type()->vector_elements, + 1); + assert(type != glsl_type::error_type); + + return type; + } + } else { + assert(type_b->is_matrix()); + + /* A is a row vector and B is a matrix. Columns of A must match rows + * of B. Given the other previously tested constraints, this means + * the type of A must be the same as the vector type of a column from + * B. + */ + if (type_a == type_b->column_type()) { + /* The resulting vector has a number of elements equal to + * the number of columns of matrix B. */ + const glsl_type *const type = + glsl_type::get_instance(type_a->base_type, + type_b->row_type()->vector_elements, + 1); + assert(type != glsl_type::error_type); + + return type; + } + } + + _mesa_glsl_error(loc, state, "size mismatch for matrix multiplication"); + return glsl_type::error_type; + } + + + /* "All other cases are illegal." + */ + _mesa_glsl_error(loc, state, "type mismatch"); + return glsl_type::error_type; +} + + +static const struct glsl_type * +unary_arithmetic_result_type(const struct glsl_type *type, + struct _mesa_glsl_parse_state *state, YYLTYPE *loc) +{ + /* From GLSL 1.50 spec, page 57: + * + * "The arithmetic unary operators negate (-), post- and pre-increment + * and decrement (-- and ++) operate on integer or floating-point + * values (including vectors and matrices). All unary operators work + * component-wise on their operands. These result with the same type + * they operated on." + */ + if (!type->is_numeric()) { + _mesa_glsl_error(loc, state, + "Operands to arithmetic operators must be numeric"); + return glsl_type::error_type; + } + + return type; +} + + +static const struct glsl_type * +modulus_result_type(const struct glsl_type *type_a, + const struct glsl_type *type_b, + struct _mesa_glsl_parse_state *state, YYLTYPE *loc) +{ + /* From GLSL 1.50 spec, page 56: + * "The operator modulus (%) operates on signed or unsigned integers or + * integer vectors. The operand types must both be signed or both be + * unsigned." + */ + if (!type_a->is_integer() || !type_b->is_integer() + || (type_a->base_type != type_b->base_type)) { + _mesa_glsl_error(loc, state, "type mismatch"); + return glsl_type::error_type; + } + + /* "The operands cannot be vectors of differing size. If one operand is + * a scalar and the other vector, then the scalar is applied component- + * wise to the vector, resulting in the same type as the vector. If both + * are vectors of the same size, the result is computed component-wise." + */ + if (type_a->is_vector()) { + if (!type_b->is_vector() + || (type_a->vector_elements == type_b->vector_elements)) + return type_a; + } else + return type_b; + + /* "The operator modulus (%) is not defined for any other data types + * (non-integer types)." + */ + _mesa_glsl_error(loc, state, "type mismatch"); + return glsl_type::error_type; +} + + +static const struct glsl_type * +relational_result_type(ir_rvalue * &value_a, ir_rvalue * &value_b, + struct _mesa_glsl_parse_state *state, YYLTYPE *loc) +{ + const glsl_type *type_a = value_a->type; + const glsl_type *type_b = value_b->type; + + /* From GLSL 1.50 spec, page 56: + * "The relational operators greater than (>), less than (<), greater + * than or equal (>=), and less than or equal (<=) operate only on + * scalar integer and scalar floating-point expressions." + */ + if (!type_a->is_numeric() + || !type_b->is_numeric() + || !type_a->is_scalar() + || !type_b->is_scalar()) { + _mesa_glsl_error(loc, state, + "Operands to relational operators must be scalar and " + "numeric"); + return glsl_type::error_type; + } + + /* "Either the operands' types must match, or the conversions from + * Section 4.1.10 "Implicit Conversions" will be applied to the integer + * operand, after which the types must match." + */ + if (!apply_implicit_conversion(type_a, value_b, state) + && !apply_implicit_conversion(type_b, value_a, state)) { + _mesa_glsl_error(loc, state, + "Could not implicitly convert operands to " + "relational operator"); + return glsl_type::error_type; + } + type_a = value_a->type; + type_b = value_b->type; + + if (type_a->base_type != type_b->base_type) { + _mesa_glsl_error(loc, state, "base type mismatch"); + return glsl_type::error_type; + } + + /* "The result is scalar Boolean." + */ + return glsl_type::bool_type; +} + + +/** + * Validates that a value can be assigned to a location with a specified type + * + * Validates that \c rhs can be assigned to some location. If the types are + * not an exact match but an automatic conversion is possible, \c rhs will be + * converted. + * + * \return + * \c NULL if \c rhs cannot be assigned to a location with type \c lhs_type. + * Otherwise the actual RHS to be assigned will be returned. This may be + * \c rhs, or it may be \c rhs after some type conversion. + * + * \note + * In addition to being used for assignments, this function is used to + * type-check return values. + */ +ir_rvalue * +validate_assignment(struct _mesa_glsl_parse_state *state, + const glsl_type *lhs_type, ir_rvalue *rhs) +{ + const glsl_type *rhs_type = rhs->type; + + /* If there is already some error in the RHS, just return it. Anything + * else will lead to an avalanche of error message back to the user. + */ + if (rhs_type->is_error()) + return rhs; + + /* If the types are identical, the assignment can trivially proceed. + */ + if (rhs_type == lhs_type) + return rhs; + + /* If the array element types are the same and the size of the LHS is zero, + * the assignment is okay. + * + * Note: Whole-array assignments are not permitted in GLSL 1.10, but this + * is handled by ir_dereference::is_lvalue. + */ + if (lhs_type->is_array() && rhs->type->is_array() + && (lhs_type->element_type() == rhs->type->element_type()) + && (lhs_type->array_size() == 0)) { + return rhs; + } + + /* Check for implicit conversion in GLSL 1.20 */ + if (apply_implicit_conversion(lhs_type, rhs, state)) { + rhs_type = rhs->type; + if (rhs_type == lhs_type) + return rhs; + } + + return NULL; +} + +ir_rvalue * +do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state, + ir_rvalue *lhs, ir_rvalue *rhs, + YYLTYPE lhs_loc) +{ + void *ctx = state; + bool error_emitted = (lhs->type->is_error() || rhs->type->is_error()); + + if (!error_emitted) { + if (!lhs->is_lvalue()) { + _mesa_glsl_error(& lhs_loc, state, "non-lvalue in assignment"); + error_emitted = true; + } + + if (state->es_shader && lhs->type->is_array()) { + _mesa_glsl_error(&lhs_loc, state, "whole array assignment is not " + "allowed in GLSL ES 1.00."); + error_emitted = true; + } + } + + ir_rvalue *new_rhs = validate_assignment(state, lhs->type, rhs); + if (new_rhs == NULL) { + _mesa_glsl_error(& lhs_loc, state, "type mismatch"); + } else { + rhs = new_rhs; + + /* If the LHS array was not declared with a size, it takes it size from + * the RHS. If the LHS is an l-value and a whole array, it must be a + * dereference of a variable. Any other case would require that the LHS + * is either not an l-value or not a whole array. + */ + if (lhs->type->array_size() == 0) { + ir_dereference *const d = lhs->as_dereference(); + + assert(d != NULL); + + ir_variable *const var = d->variable_referenced(); + + assert(var != NULL); + + if (var->max_array_access >= unsigned(rhs->type->array_size())) { + /* FINISHME: This should actually log the location of the RHS. */ + _mesa_glsl_error(& lhs_loc, state, "array size must be > %u due to " + "previous access", + var->max_array_access); + } + + var->type = glsl_type::get_array_instance(lhs->type->element_type(), + rhs->type->array_size()); + d->type = var->type; + } + } + + /* Most callers of do_assignment (assign, add_assign, pre_inc/dec, + * but not post_inc) need the converted assigned value as an rvalue + * to handle things like: + * + * i = j += 1; + * + * So we always just store the computed value being assigned to a + * temporary and return a deref of that temporary. If the rvalue + * ends up not being used, the temp will get copy-propagated out. + */ + ir_variable *var = new(ctx) ir_variable(rhs->type, "assignment_tmp", + ir_var_temporary); + ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var); + instructions->push_tail(var); + instructions->push_tail(new(ctx) ir_assignment(deref_var, + rhs, + NULL)); + deref_var = new(ctx) ir_dereference_variable(var); + + if (!error_emitted) + instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var, NULL)); + + return new(ctx) ir_dereference_variable(var); +} + +static ir_rvalue * +get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue) +{ + void *ctx = talloc_parent(lvalue); + ir_variable *var; + + var = new(ctx) ir_variable(lvalue->type, "_post_incdec_tmp", + ir_var_temporary); + instructions->push_tail(var); + var->mode = ir_var_auto; + + instructions->push_tail(new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var), + lvalue, NULL)); + + /* Once we've created this temporary, mark it read only so it's no + * longer considered an lvalue. + */ + var->read_only = true; + + return new(ctx) ir_dereference_variable(var); +} + + +ir_rvalue * +ast_node::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + (void) instructions; + (void) state; + + return NULL; +} + + +ir_rvalue * +ast_expression::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + static const int operations[AST_NUM_OPERATORS] = { + -1, /* ast_assign doesn't convert to ir_expression. */ + -1, /* ast_plus doesn't convert to ir_expression. */ + ir_unop_neg, + ir_binop_add, + ir_binop_sub, + ir_binop_mul, + ir_binop_div, + ir_binop_mod, + ir_binop_lshift, + ir_binop_rshift, + ir_binop_less, + ir_binop_greater, + ir_binop_lequal, + ir_binop_gequal, + ir_binop_all_equal, + ir_binop_any_nequal, + ir_binop_bit_and, + ir_binop_bit_xor, + ir_binop_bit_or, + ir_unop_bit_not, + ir_binop_logic_and, + ir_binop_logic_xor, + ir_binop_logic_or, + ir_unop_logic_not, + + /* Note: The following block of expression types actually convert + * to multiple IR instructions. + */ + ir_binop_mul, /* ast_mul_assign */ + ir_binop_div, /* ast_div_assign */ + ir_binop_mod, /* ast_mod_assign */ + ir_binop_add, /* ast_add_assign */ + ir_binop_sub, /* ast_sub_assign */ + ir_binop_lshift, /* ast_ls_assign */ + ir_binop_rshift, /* ast_rs_assign */ + ir_binop_bit_and, /* ast_and_assign */ + ir_binop_bit_xor, /* ast_xor_assign */ + ir_binop_bit_or, /* ast_or_assign */ + + -1, /* ast_conditional doesn't convert to ir_expression. */ + ir_binop_add, /* ast_pre_inc. */ + ir_binop_sub, /* ast_pre_dec. */ + ir_binop_add, /* ast_post_inc. */ + ir_binop_sub, /* ast_post_dec. */ + -1, /* ast_field_selection doesn't conv to ir_expression. */ + -1, /* ast_array_index doesn't convert to ir_expression. */ + -1, /* ast_function_call doesn't conv to ir_expression. */ + -1, /* ast_identifier doesn't convert to ir_expression. */ + -1, /* ast_int_constant doesn't convert to ir_expression. */ + -1, /* ast_uint_constant doesn't conv to ir_expression. */ + -1, /* ast_float_constant doesn't conv to ir_expression. */ + -1, /* ast_bool_constant doesn't conv to ir_expression. */ + -1, /* ast_sequence doesn't convert to ir_expression. */ + }; + ir_rvalue *result = NULL; + ir_rvalue *op[3]; + const struct glsl_type *type = glsl_type::error_type; + bool error_emitted = false; + YYLTYPE loc; + + loc = this->get_location(); + + switch (this->oper) { + case ast_assign: { + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + result = do_assignment(instructions, state, op[0], op[1], + this->subexpressions[0]->get_location()); + error_emitted = result->type->is_error(); + type = result->type; + break; + } + + case ast_plus: + op[0] = this->subexpressions[0]->hir(instructions, state); + + type = unary_arithmetic_result_type(op[0]->type, state, & loc); + + error_emitted = type->is_error(); + + result = op[0]; + break; + + case ast_neg: + op[0] = this->subexpressions[0]->hir(instructions, state); + + type = unary_arithmetic_result_type(op[0]->type, state, & loc); + + error_emitted = type->is_error(); + + result = new(ctx) ir_expression(operations[this->oper], type, + op[0], NULL); + break; + + case ast_add: + case ast_sub: + case ast_mul: + case ast_div: + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + type = arithmetic_result_type(op[0], op[1], + (this->oper == ast_mul), + state, & loc); + error_emitted = type->is_error(); + + result = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + break; + + case ast_mod: + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + type = modulus_result_type(op[0]->type, op[1]->type, state, & loc); + + assert(operations[this->oper] == ir_binop_mod); + + result = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + error_emitted = type->is_error(); + break; + + case ast_lshift: + case ast_rshift: + _mesa_glsl_error(& loc, state, "FINISHME: implement bit-shift operators"); + error_emitted = true; + break; + + case ast_less: + case ast_greater: + case ast_lequal: + case ast_gequal: + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + type = relational_result_type(op[0], op[1], state, & loc); + + /* The relational operators must either generate an error or result + * in a scalar boolean. See page 57 of the GLSL 1.50 spec. + */ + assert(type->is_error() + || ((type->base_type == GLSL_TYPE_BOOL) + && type->is_scalar())); + + result = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + error_emitted = type->is_error(); + break; + + case ast_nequal: + case ast_equal: + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + /* From page 58 (page 64 of the PDF) of the GLSL 1.50 spec: + * + * "The equality operators equal (==), and not equal (!=) + * operate on all types. They result in a scalar Boolean. If + * the operand types do not match, then there must be a + * conversion from Section 4.1.10 "Implicit Conversions" + * applied to one operand that can make them match, in which + * case this conversion is done." + */ + if ((!apply_implicit_conversion(op[0]->type, op[1], state) + && !apply_implicit_conversion(op[1]->type, op[0], state)) + || (op[0]->type != op[1]->type)) { + _mesa_glsl_error(& loc, state, "operands of `%s' must have the same " + "type", (this->oper == ast_equal) ? "==" : "!="); + error_emitted = true; + } else if ((state->language_version <= 110) + && (op[0]->type->is_array() || op[1]->type->is_array())) { + _mesa_glsl_error(& loc, state, "array comparisons forbidden in " + "GLSL 1.10"); + error_emitted = true; + } + + result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type, + op[0], op[1]); + type = glsl_type::bool_type; + + assert(result->type == glsl_type::bool_type); + break; + + case ast_bit_and: + case ast_bit_xor: + case ast_bit_or: + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + if (state->language_version < 130) { + _mesa_glsl_error(&loc, state, "bit-wise operations require GLSL 1.30"); + error_emitted = true; + } + + if (!op[0]->type->is_integer()) { + _mesa_glsl_error(&loc, state, "LHS of `%s' must be an integer", + operator_string(this->oper)); + error_emitted = true; + } + + if (!op[1]->type->is_integer()) { + _mesa_glsl_error(&loc, state, "RHS of `%s' must be an integer", + operator_string(this->oper)); + error_emitted = true; + } + + if (op[0]->type->base_type != op[1]->type->base_type) { + _mesa_glsl_error(&loc, state, "operands of `%s' must have the same " + "base type", operator_string(this->oper)); + error_emitted = true; + } + + if (op[0]->type->is_vector() && op[1]->type->is_vector() + && op[0]->type->vector_elements != op[1]->type->vector_elements) { + _mesa_glsl_error(&loc, state, "operands of `%s' cannot be vectors of " + "different sizes", operator_string(this->oper)); + error_emitted = true; + } + + type = op[0]->type->is_scalar() ? op[1]->type : op[0]->type; + result = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + error_emitted = op[0]->type->is_error() || op[1]->type->is_error(); + break; + + case ast_bit_not: + op[0] = this->subexpressions[0]->hir(instructions, state); + + if (state->language_version < 130) { + _mesa_glsl_error(&loc, state, "bit-wise operations require GLSL 1.30"); + error_emitted = true; + } + + if (!op[0]->type->is_integer()) { + _mesa_glsl_error(&loc, state, "operand of `~' must be an integer"); + error_emitted = true; + } + + type = op[0]->type; + result = new(ctx) ir_expression(ir_unop_bit_not, type, op[0], NULL); + break; + + case ast_logic_and: { + op[0] = this->subexpressions[0]->hir(instructions, state); + + if (!op[0]->type->is_boolean() || !op[0]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[0]->get_location(); + + _mesa_glsl_error(& loc, state, "LHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + + ir_constant *op0_const = op[0]->constant_expression_value(); + if (op0_const) { + if (op0_const->value.b[0]) { + op[1] = this->subexpressions[1]->hir(instructions, state); + + if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[1]->get_location(); + + _mesa_glsl_error(& loc, state, + "RHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + result = op[1]; + } else { + result = op0_const; + } + type = glsl_type::bool_type; + } else { + ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, + "and_tmp", + ir_var_temporary); + instructions->push_tail(tmp); + + ir_if *const stmt = new(ctx) ir_if(op[0]); + instructions->push_tail(stmt); + + op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state); + + if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[1]->get_location(); + + _mesa_glsl_error(& loc, state, + "RHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + + ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp); + ir_assignment *const then_assign = + new(ctx) ir_assignment(then_deref, op[1], NULL); + stmt->then_instructions.push_tail(then_assign); + + ir_dereference *const else_deref = new(ctx) ir_dereference_variable(tmp); + ir_assignment *const else_assign = + new(ctx) ir_assignment(else_deref, new(ctx) ir_constant(false), NULL); + stmt->else_instructions.push_tail(else_assign); + + result = new(ctx) ir_dereference_variable(tmp); + type = tmp->type; + } + break; + } + + case ast_logic_or: { + op[0] = this->subexpressions[0]->hir(instructions, state); + + if (!op[0]->type->is_boolean() || !op[0]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[0]->get_location(); + + _mesa_glsl_error(& loc, state, "LHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + + ir_constant *op0_const = op[0]->constant_expression_value(); + if (op0_const) { + if (op0_const->value.b[0]) { + result = op0_const; + } else { + op[1] = this->subexpressions[1]->hir(instructions, state); + + if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[1]->get_location(); + + _mesa_glsl_error(& loc, state, + "RHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + result = op[1]; + } + type = glsl_type::bool_type; + } else { + ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, + "or_tmp", + ir_var_temporary); + instructions->push_tail(tmp); + + ir_if *const stmt = new(ctx) ir_if(op[0]); + instructions->push_tail(stmt); + + op[1] = this->subexpressions[1]->hir(&stmt->else_instructions, state); + + if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[1]->get_location(); + + _mesa_glsl_error(& loc, state, "RHS of `%s' must be scalar boolean", + operator_string(this->oper)); + error_emitted = true; + } + + ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp); + ir_assignment *const then_assign = + new(ctx) ir_assignment(then_deref, new(ctx) ir_constant(true), NULL); + stmt->then_instructions.push_tail(then_assign); + + ir_dereference *const else_deref = new(ctx) ir_dereference_variable(tmp); + ir_assignment *const else_assign = + new(ctx) ir_assignment(else_deref, op[1], NULL); + stmt->else_instructions.push_tail(else_assign); + + result = new(ctx) ir_dereference_variable(tmp); + type = tmp->type; + } + break; + } + + case ast_logic_xor: + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + + result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type, + op[0], op[1]); + type = glsl_type::bool_type; + break; + + case ast_logic_not: + op[0] = this->subexpressions[0]->hir(instructions, state); + + if (!op[0]->type->is_boolean() || !op[0]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[0]->get_location(); + + _mesa_glsl_error(& loc, state, + "operand of `!' must be scalar boolean"); + error_emitted = true; + } + + result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type, + op[0], NULL); + type = glsl_type::bool_type; + break; + + case ast_mul_assign: + case ast_div_assign: + case ast_add_assign: + case ast_sub_assign: { + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + type = arithmetic_result_type(op[0], op[1], + (this->oper == ast_mul_assign), + state, & loc); + + ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + + result = do_assignment(instructions, state, + op[0]->clone(ctx, NULL), temp_rhs, + this->subexpressions[0]->get_location()); + type = result->type; + error_emitted = (op[0]->type->is_error()); + + /* GLSL 1.10 does not allow array assignment. However, we don't have to + * explicitly test for this because none of the binary expression + * operators allow array operands either. + */ + + break; + } + + case ast_mod_assign: { + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + type = modulus_result_type(op[0]->type, op[1]->type, state, & loc); + + assert(operations[this->oper] == ir_binop_mod); + + ir_rvalue *temp_rhs; + temp_rhs = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + + result = do_assignment(instructions, state, + op[0]->clone(ctx, NULL), temp_rhs, + this->subexpressions[0]->get_location()); + type = result->type; + error_emitted = type->is_error(); + break; + } + + case ast_ls_assign: + case ast_rs_assign: + _mesa_glsl_error(& loc, state, + "FINISHME: implement bit-shift assignment operators"); + error_emitted = true; + break; + + case ast_and_assign: + case ast_xor_assign: + case ast_or_assign: + _mesa_glsl_error(& loc, state, + "FINISHME: implement logic assignment operators"); + error_emitted = true; + break; + + case ast_conditional: { + op[0] = this->subexpressions[0]->hir(instructions, state); + + /* From page 59 (page 65 of the PDF) of the GLSL 1.50 spec: + * + * "The ternary selection operator (?:). It operates on three + * expressions (exp1 ? exp2 : exp3). This operator evaluates the + * first expression, which must result in a scalar Boolean." + */ + if (!op[0]->type->is_boolean() || !op[0]->type->is_scalar()) { + YYLTYPE loc = this->subexpressions[0]->get_location(); + + _mesa_glsl_error(& loc, state, "?: condition must be scalar boolean"); + error_emitted = true; + } + + /* The :? operator is implemented by generating an anonymous temporary + * followed by an if-statement. The last instruction in each branch of + * the if-statement assigns a value to the anonymous temporary. This + * temporary is the r-value of the expression. + */ + exec_list then_instructions; + exec_list else_instructions; + + op[1] = this->subexpressions[1]->hir(&then_instructions, state); + op[2] = this->subexpressions[2]->hir(&else_instructions, state); + + /* From page 59 (page 65 of the PDF) of the GLSL 1.50 spec: + * + * "The second and third expressions can be any type, as + * long their types match, or there is a conversion in + * Section 4.1.10 "Implicit Conversions" that can be applied + * to one of the expressions to make their types match. This + * resulting matching type is the type of the entire + * expression." + */ + if ((!apply_implicit_conversion(op[1]->type, op[2], state) + && !apply_implicit_conversion(op[2]->type, op[1], state)) + || (op[1]->type != op[2]->type)) { + YYLTYPE loc = this->subexpressions[1]->get_location(); + + _mesa_glsl_error(& loc, state, "Second and third operands of ?: " + "operator must have matching types."); + error_emitted = true; + type = glsl_type::error_type; + } else { + type = op[1]->type; + } + + /* From page 33 (page 39 of the PDF) of the GLSL 1.10 spec: + * + * "The second and third expressions must be the same type, but can + * be of any type other than an array." + */ + if ((state->language_version <= 110) && type->is_array()) { + _mesa_glsl_error(& loc, state, "Second and third operands of ?: " + "operator must not be arrays."); + error_emitted = true; + } + + ir_constant *cond_val = op[0]->constant_expression_value(); + ir_constant *then_val = op[1]->constant_expression_value(); + ir_constant *else_val = op[2]->constant_expression_value(); + + if (then_instructions.is_empty() + && else_instructions.is_empty() + && (cond_val != NULL) && (then_val != NULL) && (else_val != NULL)) { + result = (cond_val->value.b[0]) ? then_val : else_val; + } else { + ir_variable *const tmp = + new(ctx) ir_variable(type, "conditional_tmp", ir_var_temporary); + instructions->push_tail(tmp); + + ir_if *const stmt = new(ctx) ir_if(op[0]); + instructions->push_tail(stmt); + + then_instructions.move_nodes_to(& stmt->then_instructions); + ir_dereference *const then_deref = + new(ctx) ir_dereference_variable(tmp); + ir_assignment *const then_assign = + new(ctx) ir_assignment(then_deref, op[1], NULL); + stmt->then_instructions.push_tail(then_assign); + + else_instructions.move_nodes_to(& stmt->else_instructions); + ir_dereference *const else_deref = + new(ctx) ir_dereference_variable(tmp); + ir_assignment *const else_assign = + new(ctx) ir_assignment(else_deref, op[2], NULL); + stmt->else_instructions.push_tail(else_assign); + + result = new(ctx) ir_dereference_variable(tmp); + } + break; + } + + case ast_pre_inc: + case ast_pre_dec: { + op[0] = this->subexpressions[0]->hir(instructions, state); + if (op[0]->type->base_type == GLSL_TYPE_FLOAT) + op[1] = new(ctx) ir_constant(1.0f); + else + op[1] = new(ctx) ir_constant(1); + + type = arithmetic_result_type(op[0], op[1], false, state, & loc); + + ir_rvalue *temp_rhs; + temp_rhs = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + + result = do_assignment(instructions, state, + op[0]->clone(ctx, NULL), temp_rhs, + this->subexpressions[0]->get_location()); + type = result->type; + error_emitted = op[0]->type->is_error(); + break; + } + + case ast_post_inc: + case ast_post_dec: { + op[0] = this->subexpressions[0]->hir(instructions, state); + if (op[0]->type->base_type == GLSL_TYPE_FLOAT) + op[1] = new(ctx) ir_constant(1.0f); + else + op[1] = new(ctx) ir_constant(1); + + error_emitted = op[0]->type->is_error() || op[1]->type->is_error(); + + type = arithmetic_result_type(op[0], op[1], false, state, & loc); + + ir_rvalue *temp_rhs; + temp_rhs = new(ctx) ir_expression(operations[this->oper], type, + op[0], op[1]); + + /* Get a temporary of a copy of the lvalue before it's modified. + * This may get thrown away later. + */ + result = get_lvalue_copy(instructions, op[0]->clone(ctx, NULL)); + + (void)do_assignment(instructions, state, + op[0]->clone(ctx, NULL), temp_rhs, + this->subexpressions[0]->get_location()); + + type = result->type; + error_emitted = op[0]->type->is_error(); + break; + } + + case ast_field_selection: + result = _mesa_ast_field_selection_to_hir(this, instructions, state); + type = result->type; + break; + + case ast_array_index: { + YYLTYPE index_loc = subexpressions[1]->get_location(); + + op[0] = subexpressions[0]->hir(instructions, state); + op[1] = subexpressions[1]->hir(instructions, state); + + error_emitted = op[0]->type->is_error() || op[1]->type->is_error(); + + ir_rvalue *const array = op[0]; + + result = new(ctx) ir_dereference_array(op[0], op[1]); + + /* Do not use op[0] after this point. Use array. + */ + op[0] = NULL; + + + if (error_emitted) + break; + + if (!array->type->is_array() + && !array->type->is_matrix() + && !array->type->is_vector()) { + _mesa_glsl_error(& index_loc, state, + "cannot dereference non-array / non-matrix / " + "non-vector"); + error_emitted = true; + } + + if (!op[1]->type->is_integer()) { + _mesa_glsl_error(& index_loc, state, + "array index must be integer type"); + error_emitted = true; + } else if (!op[1]->type->is_scalar()) { + _mesa_glsl_error(& index_loc, state, + "array index must be scalar"); + error_emitted = true; + } + + /* If the array index is a constant expression and the array has a + * declared size, ensure that the access is in-bounds. If the array + * index is not a constant expression, ensure that the array has a + * declared size. + */ + ir_constant *const const_index = op[1]->constant_expression_value(); + if (const_index != NULL) { + const int idx = const_index->value.i[0]; + const char *type_name; + unsigned bound = 0; + + if (array->type->is_matrix()) { + type_name = "matrix"; + } else if (array->type->is_vector()) { + type_name = "vector"; + } else { + type_name = "array"; + } + + /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec: + * + * "It is illegal to declare an array with a size, and then + * later (in the same shader) index the same array with an + * integral constant expression greater than or equal to the + * declared size. It is also illegal to index an array with a + * negative constant expression." + */ + if (array->type->is_matrix()) { + if (array->type->row_type()->vector_elements <= idx) { + bound = array->type->row_type()->vector_elements; + } + } else if (array->type->is_vector()) { + if (array->type->vector_elements <= idx) { + bound = array->type->vector_elements; + } + } else { + if ((array->type->array_size() > 0) + && (array->type->array_size() <= idx)) { + bound = array->type->array_size(); + } + } + + if (bound > 0) { + _mesa_glsl_error(& loc, state, "%s index must be < %u", + type_name, bound); + error_emitted = true; + } else if (idx < 0) { + _mesa_glsl_error(& loc, state, "%s index must be >= 0", + type_name); + error_emitted = true; + } + + if (array->type->is_array()) { + /* If the array is a variable dereference, it dereferences the + * whole array, by definition. Use this to get the variable. + * + * FINISHME: Should some methods for getting / setting / testing + * FINISHME: array access limits be added to ir_dereference? + */ + ir_variable *const v = array->whole_variable_referenced(); + if ((v != NULL) && (unsigned(idx) > v->max_array_access)) + v->max_array_access = idx; + } + } else if (array->type->array_size() == 0) { + _mesa_glsl_error(&loc, state, "unsized array index must be constant"); + } else { + if (array->type->is_array()) { + /* whole_variable_referenced can return NULL if the array is a + * member of a structure. In this case it is safe to not update + * the max_array_access field because it is never used for fields + * of structures. + */ + ir_variable *v = array->whole_variable_referenced(); + if (v != NULL) + v->max_array_access = array->type->array_size(); + } + } + + if (error_emitted) + result->type = glsl_type::error_type; + + type = result->type; + break; + } + + case ast_function_call: + /* Should *NEVER* get here. ast_function_call should always be handled + * by ast_function_expression::hir. + */ + assert(0); + break; + + case ast_identifier: { + /* ast_identifier can appear several places in a full abstract syntax + * tree. This particular use must be at location specified in the grammar + * as 'variable_identifier'. + */ + ir_variable *var = + state->symbols->get_variable(this->primary_expression.identifier); + + result = new(ctx) ir_dereference_variable(var); + + if (var != NULL) { + type = result->type; + } else { + _mesa_glsl_error(& loc, state, "`%s' undeclared", + this->primary_expression.identifier); + + error_emitted = true; + } + break; + } + + case ast_int_constant: + type = glsl_type::int_type; + result = new(ctx) ir_constant(this->primary_expression.int_constant); + break; + + case ast_uint_constant: + type = glsl_type::uint_type; + result = new(ctx) ir_constant(this->primary_expression.uint_constant); + break; + + case ast_float_constant: + type = glsl_type::float_type; + result = new(ctx) ir_constant(this->primary_expression.float_constant); + break; + + case ast_bool_constant: + type = glsl_type::bool_type; + result = new(ctx) ir_constant(bool(this->primary_expression.bool_constant)); + break; + + case ast_sequence: { + /* It should not be possible to generate a sequence in the AST without + * any expressions in it. + */ + assert(!this->expressions.is_empty()); + + /* The r-value of a sequence is the last expression in the sequence. If + * the other expressions in the sequence do not have side-effects (and + * therefore add instructions to the instruction list), they get dropped + * on the floor. + */ + foreach_list_typed (ast_node, ast, link, &this->expressions) + result = ast->hir(instructions, state); + + type = result->type; + + /* Any errors should have already been emitted in the loop above. + */ + error_emitted = true; + break; + } + } + + if (type->is_error() && !error_emitted) + _mesa_glsl_error(& loc, state, "type mismatch"); + + return result; +} + + +ir_rvalue * +ast_expression_statement::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + /* It is possible to have expression statements that don't have an + * expression. This is the solitary semicolon: + * + * for (i = 0; i < 5; i++) + * ; + * + * In this case the expression will be NULL. Test for NULL and don't do + * anything in that case. + */ + if (expression != NULL) + expression->hir(instructions, state); + + /* Statements do not have r-values. + */ + return NULL; +} + + +ir_rvalue * +ast_compound_statement::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + if (new_scope) + state->symbols->push_scope(); + + foreach_list_typed (ast_node, ast, link, &this->statements) + ast->hir(instructions, state); + + if (new_scope) + state->symbols->pop_scope(); + + /* Compound statements do not have r-values. + */ + return NULL; +} + + +static const glsl_type * +process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size, + struct _mesa_glsl_parse_state *state) +{ + unsigned length = 0; + + /* FINISHME: Reject delcarations of multidimensional arrays. */ + + if (array_size != NULL) { + exec_list dummy_instructions; + ir_rvalue *const ir = array_size->hir(& dummy_instructions, state); + YYLTYPE loc = array_size->get_location(); + + /* FINISHME: Verify that the grammar forbids side-effects in array + * FINISHME: sizes. i.e., 'vec4 [x = 12] data' + */ + assert(dummy_instructions.is_empty()); + + if (ir != NULL) { + if (!ir->type->is_integer()) { + _mesa_glsl_error(& loc, state, "array size must be integer type"); + } else if (!ir->type->is_scalar()) { + _mesa_glsl_error(& loc, state, "array size must be scalar type"); + } else { + ir_constant *const size = ir->constant_expression_value(); + + if (size == NULL) { + _mesa_glsl_error(& loc, state, "array size must be a " + "constant valued expression"); + } else if (size->value.i[0] <= 0) { + _mesa_glsl_error(& loc, state, "array size must be > 0"); + } else { + assert(size->type == ir->type); + length = size->value.u[0]; + } + } + } + } else if (state->es_shader) { + /* Section 10.17 of the GLSL ES 1.00 specification states that unsized + * array declarations have been removed from the language. + */ + _mesa_glsl_error(loc, state, "unsized array declarations are not " + "allowed in GLSL ES 1.00."); + } + + return glsl_type::get_array_instance(base, length); +} + + +const glsl_type * +ast_type_specifier::glsl_type(const char **name, + struct _mesa_glsl_parse_state *state) const +{ + const struct glsl_type *type; + + type = state->symbols->get_type(this->type_name); + *name = this->type_name; + + if (this->is_array) { + YYLTYPE loc = this->get_location(); + type = process_array_type(&loc, type, this->array_size, state); + } + + return type; +} + + +static void +apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, + ir_variable *var, + struct _mesa_glsl_parse_state *state, + YYLTYPE *loc) +{ + if (qual->invariant) + var->invariant = 1; + + /* FINISHME: Mark 'in' variables at global scope as read-only. */ + if (qual->constant || qual->attribute || qual->uniform + || (qual->varying && (state->target == fragment_shader))) + var->read_only = 1; + + if (qual->centroid) + var->centroid = 1; + + if (qual->attribute && state->target != vertex_shader) { + var->type = glsl_type::error_type; + _mesa_glsl_error(loc, state, + "`attribute' variables may not be declared in the " + "%s shader", + _mesa_glsl_shader_target_name(state->target)); + } + + /* From page 25 (page 31 of the PDF) of the GLSL 1.10 spec: + * + * "The varying qualifier can be used only with the data types + * float, vec2, vec3, vec4, mat2, mat3, and mat4, or arrays of + * these." + */ + if (qual->varying) { + const glsl_type *non_array_type; + + if (var->type && var->type->is_array()) + non_array_type = var->type->fields.array; + else + non_array_type = var->type; + + if (non_array_type && non_array_type->base_type != GLSL_TYPE_FLOAT) { + var->type = glsl_type::error_type; + _mesa_glsl_error(loc, state, + "varying variables must be of base type float"); + } + } + + /* If there is no qualifier that changes the mode of the variable, leave + * the setting alone. + */ + if (qual->in && qual->out) + var->mode = ir_var_inout; + else if (qual->attribute || qual->in + || (qual->varying && (state->target == fragment_shader))) + var->mode = ir_var_in; + else if (qual->out || (qual->varying && (state->target == vertex_shader))) + var->mode = ir_var_out; + else if (qual->uniform) + var->mode = ir_var_uniform; + + if (qual->flat) + var->interpolation = ir_var_flat; + else if (qual->noperspective) + var->interpolation = ir_var_noperspective; + else + var->interpolation = ir_var_smooth; + + var->pixel_center_integer = qual->pixel_center_integer; + var->origin_upper_left = qual->origin_upper_left; + if ((qual->origin_upper_left || qual->pixel_center_integer) + && (strcmp(var->name, "gl_FragCoord") != 0)) { + const char *const qual_string = (qual->origin_upper_left) + ? "origin_upper_left" : "pixel_center_integer"; + + _mesa_glsl_error(loc, state, + "layout qualifier `%s' can only be applied to " + "fragment shader input `gl_FragCoord'", + qual_string); + } + + if (var->type->is_array() && state->language_version != 110) { + var->array_lvalue = true; + } +} + + +ir_rvalue * +ast_declarator_list::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + const struct glsl_type *decl_type; + const char *type_name = NULL; + ir_rvalue *result = NULL; + YYLTYPE loc = this->get_location(); + + /* From page 46 (page 52 of the PDF) of the GLSL 1.50 spec: + * + * "To ensure that a particular output variable is invariant, it is + * necessary to use the invariant qualifier. It can either be used to + * qualify a previously declared variable as being invariant + * + * invariant gl_Position; // make existing gl_Position be invariant" + * + * In these cases the parser will set the 'invariant' flag in the declarator + * list, and the type will be NULL. + */ + if (this->invariant) { + assert(this->type == NULL); + + if (state->current_function != NULL) { + _mesa_glsl_error(& loc, state, + "All uses of `invariant' keyword must be at global " + "scope\n"); + } + + foreach_list_typed (ast_declaration, decl, link, &this->declarations) { + assert(!decl->is_array); + assert(decl->array_size == NULL); + assert(decl->initializer == NULL); + + ir_variable *const earlier = + state->symbols->get_variable(decl->identifier); + if (earlier == NULL) { + _mesa_glsl_error(& loc, state, + "Undeclared variable `%s' cannot be marked " + "invariant\n", decl->identifier); + } else if ((state->target == vertex_shader) + && (earlier->mode != ir_var_out)) { + _mesa_glsl_error(& loc, state, + "`%s' cannot be marked invariant, vertex shader " + "outputs only\n", decl->identifier); + } else if ((state->target == fragment_shader) + && (earlier->mode != ir_var_in)) { + _mesa_glsl_error(& loc, state, + "`%s' cannot be marked invariant, fragment shader " + "inputs only\n", decl->identifier); + } else { + earlier->invariant = true; + } + } + + /* Invariant redeclarations do not have r-values. + */ + return NULL; + } + + assert(this->type != NULL); + assert(!this->invariant); + + /* The type specifier may contain a structure definition. Process that + * before any of the variable declarations. + */ + (void) this->type->specifier->hir(instructions, state); + + decl_type = this->type->specifier->glsl_type(& type_name, state); + if (this->declarations.is_empty()) { + /* The only valid case where the declaration list can be empty is when + * the declaration is setting the default precision of a built-in type + * (e.g., 'precision highp vec4;'). + */ + + if (decl_type != NULL) { + } else { + _mesa_glsl_error(& loc, state, "incomplete declaration"); + } + } + + foreach_list_typed (ast_declaration, decl, link, &this->declarations) { + const struct glsl_type *var_type; + ir_variable *var; + + /* FINISHME: Emit a warning if a variable declaration shadows a + * FINISHME: declaration at a higher scope. + */ + + if ((decl_type == NULL) || decl_type->is_void()) { + if (type_name != NULL) { + _mesa_glsl_error(& loc, state, + "invalid type `%s' in declaration of `%s'", + type_name, decl->identifier); + } else { + _mesa_glsl_error(& loc, state, + "invalid type in declaration of `%s'", + decl->identifier); + } + continue; + } + + if (decl->is_array) { + var_type = process_array_type(&loc, decl_type, decl->array_size, + state); + } else { + var_type = decl_type; + } + + var = new(ctx) ir_variable(var_type, decl->identifier, ir_var_auto); + + /* From page 22 (page 28 of the PDF) of the GLSL 1.10 specification; + * + * "Global variables can only use the qualifiers const, + * attribute, uni form, or varying. Only one may be + * specified. + * + * Local variables can only use the qualifier const." + * + * This is relaxed in GLSL 1.30. + */ + if (state->language_version < 120) { + if (this->type->qualifier.out) { + _mesa_glsl_error(& loc, state, + "`out' qualifier in declaration of `%s' " + "only valid for function parameters in GLSL 1.10.", + decl->identifier); + } + if (this->type->qualifier.in) { + _mesa_glsl_error(& loc, state, + "`in' qualifier in declaration of `%s' " + "only valid for function parameters in GLSL 1.10.", + decl->identifier); + } + /* FINISHME: Test for other invalid qualifiers. */ + } + + apply_type_qualifier_to_variable(& this->type->qualifier, var, state, + & loc); + + if (this->type->qualifier.invariant) { + if ((state->target == vertex_shader) && !(var->mode == ir_var_out || + var->mode == ir_var_inout)) { + /* FINISHME: Note that this doesn't work for invariant on + * a function signature outval + */ + _mesa_glsl_error(& loc, state, + "`%s' cannot be marked invariant, vertex shader " + "outputs only\n", var->name); + } else if ((state->target == fragment_shader) && + !(var->mode == ir_var_in || var->mode == ir_var_inout)) { + /* FINISHME: Note that this doesn't work for invariant on + * a function signature inval + */ + _mesa_glsl_error(& loc, state, + "`%s' cannot be marked invariant, fragment shader " + "inputs only\n", var->name); + } + } + + if (state->current_function != NULL) { + const char *mode = NULL; + const char *extra = ""; + + /* There is no need to check for 'inout' here because the parser will + * only allow that in function parameter lists. + */ + if (this->type->qualifier.attribute) { + mode = "attribute"; + } else if (this->type->qualifier.uniform) { + mode = "uniform"; + } else if (this->type->qualifier.varying) { + mode = "varying"; + } else if (this->type->qualifier.in) { + mode = "in"; + extra = " or in function parameter list"; + } else if (this->type->qualifier.out) { + mode = "out"; + extra = " or in function parameter list"; + } + + if (mode) { + _mesa_glsl_error(& loc, state, + "%s variable `%s' must be declared at " + "global scope%s", + mode, var->name, extra); + } + } else if (var->mode == ir_var_in) { + if (state->target == vertex_shader) { + bool error_emitted = false; + + /* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec: + * + * "Vertex shader inputs can only be float, floating-point + * vectors, matrices, signed and unsigned integers and integer + * vectors. Vertex shader inputs can also form arrays of these + * types, but not structures." + * + * From page 31 (page 27 of the PDF) of the GLSL 1.30 spec: + * + * "Vertex shader inputs can only be float, floating-point + * vectors, matrices, signed and unsigned integers and integer + * vectors. They cannot be arrays or structures." + * + * From page 23 (page 29 of the PDF) of the GLSL 1.20 spec: + * + * "The attribute qualifier can be used only with float, + * floating-point vectors, and matrices. Attribute variables + * cannot be declared as arrays or structures." + */ + const glsl_type *check_type = var->type->is_array() + ? var->type->fields.array : var->type; + + switch (check_type->base_type) { + case GLSL_TYPE_FLOAT: + break; + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + if (state->language_version > 120) + break; + /* FALLTHROUGH */ + default: + _mesa_glsl_error(& loc, state, + "vertex shader input / attribute cannot have " + "type %s`%s'", + var->type->is_array() ? "array of " : "", + check_type->name); + error_emitted = true; + } + + if (!error_emitted && (state->language_version <= 130) + && var->type->is_array()) { + _mesa_glsl_error(& loc, state, + "vertex shader input / attribute cannot have " + "array type"); + error_emitted = true; + } + } + } + + /* Process the initializer and add its instructions to a temporary + * list. This list will be added to the instruction stream (below) after + * the declaration is added. This is done because in some cases (such as + * redeclarations) the declaration may not actually be added to the + * instruction stream. + */ + exec_list initializer_instructions; + if (decl->initializer != NULL) { + YYLTYPE initializer_loc = decl->initializer->get_location(); + + /* From page 24 (page 30 of the PDF) of the GLSL 1.10 spec: + * + * "All uniform variables are read-only and are initialized either + * directly by an application via API commands, or indirectly by + * OpenGL." + */ + if ((state->language_version <= 110) + && (var->mode == ir_var_uniform)) { + _mesa_glsl_error(& initializer_loc, state, + "cannot initialize uniforms in GLSL 1.10"); + } + + if (var->type->is_sampler()) { + _mesa_glsl_error(& initializer_loc, state, + "cannot initialize samplers"); + } + + if ((var->mode == ir_var_in) && (state->current_function == NULL)) { + _mesa_glsl_error(& initializer_loc, state, + "cannot initialize %s shader input / %s", + _mesa_glsl_shader_target_name(state->target), + (state->target == vertex_shader) + ? "attribute" : "varying"); + } + + ir_dereference *const lhs = new(ctx) ir_dereference_variable(var); + ir_rvalue *rhs = decl->initializer->hir(&initializer_instructions, + state); + + /* Calculate the constant value if this is a const or uniform + * declaration. + */ + if (this->type->qualifier.constant || this->type->qualifier.uniform) { + ir_rvalue *new_rhs = validate_assignment(state, var->type, rhs); + if (new_rhs != NULL) { + rhs = new_rhs; + + ir_constant *constant_value = rhs->constant_expression_value(); + if (!constant_value) { + _mesa_glsl_error(& initializer_loc, state, + "initializer of %s variable `%s' must be a " + "constant expression", + (this->type->qualifier.constant) + ? "const" : "uniform", + decl->identifier); + if (var->type->is_numeric()) { + /* Reduce cascading errors. */ + var->constant_value = ir_constant::zero(ctx, var->type); + } + } else { + rhs = constant_value; + var->constant_value = constant_value; + } + } else { + _mesa_glsl_error(&initializer_loc, state, + "initializer of type %s cannot be assigned to " + "variable of type %s", + rhs->type->name, var->type->name); + if (var->type->is_numeric()) { + /* Reduce cascading errors. */ + var->constant_value = ir_constant::zero(ctx, var->type); + } + } + } + + if (rhs && !rhs->type->is_error()) { + bool temp = var->read_only; + if (this->type->qualifier.constant) + var->read_only = false; + + /* Never emit code to initialize a uniform. + */ + if (!this->type->qualifier.uniform) + result = do_assignment(&initializer_instructions, state, + lhs, rhs, + this->get_location()); + var->read_only = temp; + } + } + + /* From page 23 (page 29 of the PDF) of the GLSL 1.10 spec: + * + * "It is an error to write to a const variable outside of + * its declaration, so they must be initialized when + * declared." + */ + if (this->type->qualifier.constant && decl->initializer == NULL) { + _mesa_glsl_error(& loc, state, + "const declaration of `%s' must be initialized"); + } + + /* Check if this declaration is actually a re-declaration, either to + * resize an array or add qualifiers to an existing variable. + * + * This is allowed for variables in the current scope, or when at + * global scope (for built-ins in the implicit outer scope). + */ + ir_variable *earlier = state->symbols->get_variable(decl->identifier); + if (earlier != NULL && (state->current_function == NULL || + state->symbols->name_declared_this_scope(decl->identifier))) { + + /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec, + * + * "It is legal to declare an array without a size and then + * later re-declare the same name as an array of the same + * type and specify a size." + */ + if ((earlier->type->array_size() == 0) + && var->type->is_array() + && (var->type->element_type() == earlier->type->element_type())) { + /* FINISHME: This doesn't match the qualifiers on the two + * FINISHME: declarations. It's not 100% clear whether this is + * FINISHME: required or not. + */ + + /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: + * + * "The size [of gl_TexCoord] can be at most + * gl_MaxTextureCoords." + */ + const unsigned size = unsigned(var->type->array_size()); + if ((strcmp("gl_TexCoord", var->name) == 0) + && (size > state->Const.MaxTextureCoords)) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "`gl_TexCoord' array size cannot " + "be larger than gl_MaxTextureCoords (%u)\n", + state->Const.MaxTextureCoords); + } else if ((size > 0) && (size <= earlier->max_array_access)) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "array size must be > %u due to " + "previous access", + earlier->max_array_access); + } + + earlier->type = var->type; + delete var; + var = NULL; + } else if (state->extensions->ARB_fragment_coord_conventions + && strcmp(var->name, "gl_FragCoord") == 0 + && earlier->type == var->type + && earlier->mode == var->mode) { + /* Allow redeclaration of gl_FragCoord for ARB_fcc layout + * qualifiers. + */ + earlier->origin_upper_left = var->origin_upper_left; + earlier->pixel_center_integer = var->pixel_center_integer; + } else { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, "`%s' redeclared", decl->identifier); + } + + continue; + } + + /* By now, we know it's a new variable declaration (we didn't hit the + * above "continue"). + * + * From page 15 (page 21 of the PDF) of the GLSL 1.10 spec, + * + * "Identifiers starting with "gl_" are reserved for use by + * OpenGL, and may not be declared in a shader as either a + * variable or a function." + */ + if (strncmp(decl->identifier, "gl_", 3) == 0) + _mesa_glsl_error(& loc, state, + "identifier `%s' uses reserved `gl_' prefix", + decl->identifier); + + /* Add the variable to the symbol table. Note that the initializer's + * IR was already processed earlier (though it hasn't been emitted yet), + * without the variable in scope. + * + * This differs from most C-like languages, but it follows the GLSL + * specification. From page 28 (page 34 of the PDF) of the GLSL 1.50 + * spec: + * + * "Within a declaration, the scope of a name starts immediately + * after the initializer if present or immediately after the name + * being declared if not." + */ + if (!state->symbols->add_variable(var->name, var)) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, "name `%s' already taken in the " + "current scope", decl->identifier); + continue; + } + + /* Push the variable declaration to the top. It means that all + * the variable declarations will appear in a funny + * last-to-first order, but otherwise we run into trouble if a + * function is prototyped, a global var is decled, then the + * function is defined with usage of the global var. See + * glslparsertest's CorrectModule.frag. + */ + instructions->push_head(var); + instructions->append_list(&initializer_instructions); + } + + + /* Generally, variable declarations do not have r-values. However, + * one is used for the declaration in + * + * while (bool b = some_condition()) { + * ... + * } + * + * so we return the rvalue from the last seen declaration here. + */ + return result; +} + + +ir_rvalue * +ast_parameter_declarator::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + const struct glsl_type *type; + const char *name = NULL; + YYLTYPE loc = this->get_location(); + + type = this->type->specifier->glsl_type(& name, state); + + if (type == NULL) { + if (name != NULL) { + _mesa_glsl_error(& loc, state, + "invalid type `%s' in declaration of `%s'", + name, this->identifier); + } else { + _mesa_glsl_error(& loc, state, + "invalid type in declaration of `%s'", + this->identifier); + } + + type = glsl_type::error_type; + } + + /* From page 62 (page 68 of the PDF) of the GLSL 1.50 spec: + * + * "Functions that accept no input arguments need not use void in the + * argument list because prototypes (or definitions) are required and + * therefore there is no ambiguity when an empty argument list "( )" is + * declared. The idiom "(void)" as a parameter list is provided for + * convenience." + * + * Placing this check here prevents a void parameter being set up + * for a function, which avoids tripping up checks for main taking + * parameters and lookups of an unnamed symbol. + */ + if (type->is_void()) { + if (this->identifier != NULL) + _mesa_glsl_error(& loc, state, + "named parameter cannot have type `void'"); + + is_void = true; + return NULL; + } + + if (formal_parameter && (this->identifier == NULL)) { + _mesa_glsl_error(& loc, state, "formal parameter lacks a name"); + return NULL; + } + + /* This only handles "vec4 foo[..]". The earlier specifier->glsl_type(...) + * call already handled the "vec4[..] foo" case. + */ + if (this->is_array) { + type = process_array_type(&loc, type, this->array_size, state); + } + + if (type->array_size() == 0) { + _mesa_glsl_error(&loc, state, "arrays passed as parameters must have " + "a declared size."); + type = glsl_type::error_type; + } + + is_void = false; + ir_variable *var = new(ctx) ir_variable(type, this->identifier, ir_var_in); + + /* Apply any specified qualifiers to the parameter declaration. Note that + * for function parameters the default mode is 'in'. + */ + apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc); + + instructions->push_tail(var); + + /* Parameter declarations do not have r-values. + */ + return NULL; +} + + +void +ast_parameter_declarator::parameters_to_hir(exec_list *ast_parameters, + bool formal, + exec_list *ir_parameters, + _mesa_glsl_parse_state *state) +{ + ast_parameter_declarator *void_param = NULL; + unsigned count = 0; + + foreach_list_typed (ast_parameter_declarator, param, link, ast_parameters) { + param->formal_parameter = formal; + param->hir(ir_parameters, state); + + if (param->is_void) + void_param = param; + + count++; + } + + if ((void_param != NULL) && (count > 1)) { + YYLTYPE loc = void_param->get_location(); + + _mesa_glsl_error(& loc, state, + "`void' parameter must be only parameter"); + } +} + + +ir_rvalue * +ast_function::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + ir_function *f = NULL; + ir_function_signature *sig = NULL; + exec_list hir_parameters; + + const char *const name = identifier; + + /* From page 21 (page 27 of the PDF) of the GLSL 1.20 spec, + * + * "Function declarations (prototypes) cannot occur inside of functions; + * they must be at global scope, or for the built-in functions, outside + * the global scope." + * + * From page 27 (page 33 of the PDF) of the GLSL ES 1.00.16 spec, + * + * "User defined functions may only be defined within the global scope." + * + * Note that this language does not appear in GLSL 1.10. + */ + if ((state->current_function != NULL) && (state->language_version != 110)) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, + "declaration of function `%s' not allowed within " + "function body", name); + } + + /* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec, + * + * "Identifiers starting with "gl_" are reserved for use by + * OpenGL, and may not be declared in a shader as either a + * variable or a function." + */ + if (strncmp(name, "gl_", 3) == 0) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, + "identifier `%s' uses reserved `gl_' prefix", name); + } + + /* Convert the list of function parameters to HIR now so that they can be + * used below to compare this function's signature with previously seen + * signatures for functions with the same name. + */ + ast_parameter_declarator::parameters_to_hir(& this->parameters, + is_definition, + & hir_parameters, state); + + const char *return_type_name; + const glsl_type *return_type = + this->return_type->specifier->glsl_type(& return_type_name, state); + + if (!return_type) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, + "function `%s' has undeclared return type `%s'", + name, return_type_name); + return_type = glsl_type::error_type; + } + + /* From page 56 (page 62 of the PDF) of the GLSL 1.30 spec: + * "No qualifier is allowed on the return type of a function." + */ + if (this->return_type->has_qualifiers()) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(& loc, state, + "function `%s' return type has qualifiers", name); + } + + /* Verify that this function's signature either doesn't match a previously + * seen signature for a function with the same name, or, if a match is found, + * that the previously seen signature does not have an associated definition. + */ + f = state->symbols->get_function(name); + if (f != NULL && (state->es_shader || f->has_user_signature())) { + sig = f->exact_matching_signature(&hir_parameters); + if (sig != NULL) { + const char *badvar = sig->qualifiers_match(&hir_parameters); + if (badvar != NULL) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(&loc, state, "function `%s' parameter `%s' " + "qualifiers don't match prototype", name, badvar); + } + + if (sig->return_type != return_type) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(&loc, state, "function `%s' return type doesn't " + "match prototype", name); + } + + if (is_definition && sig->is_defined) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "function `%s' redefined", name); + } + } + } else { + f = new(ctx) ir_function(name); + if (!state->symbols->add_function(f->name, f)) { + /* This function name shadows a non-function use of the same name. */ + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(&loc, state, "function name `%s' conflicts with " + "non-function", name); + return NULL; + } + + /* Emit the new function header */ + if (state->current_function == NULL) + instructions->push_tail(f); + else { + /* IR invariants disallow function declarations or definitions nested + * within other function definitions. Insert the new ir_function + * block in the instruction sequence before the ir_function block + * containing the current ir_function_signature. + * + * This can only happen in a GLSL 1.10 shader. In all other GLSL + * versions this nesting is disallowed. There is a check for this at + * the top of this function. + */ + ir_function *const curr = + const_cast<ir_function *>(state->current_function->function()); + + curr->insert_before(f); + } + } + + /* Verify the return type of main() */ + if (strcmp(name, "main") == 0) { + if (! return_type->is_void()) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "main() must return void"); + } + + if (!hir_parameters.is_empty()) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "main() must not take any parameters"); + } + } + + /* Finish storing the information about this new function in its signature. + */ + if (sig == NULL) { + sig = new(ctx) ir_function_signature(return_type); + f->add_signature(sig); + } + + sig->replace_parameters(&hir_parameters); + signature = sig; + + /* Function declarations (prototypes) do not have r-values. + */ + return NULL; +} + + +ir_rvalue * +ast_function_definition::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + prototype->is_definition = true; + prototype->hir(instructions, state); + + ir_function_signature *signature = prototype->signature; + if (signature == NULL) + return NULL; + + assert(state->current_function == NULL); + state->current_function = signature; + state->found_return = false; + + /* Duplicate parameters declared in the prototype as concrete variables. + * Add these to the symbol table. + */ + state->symbols->push_scope(); + foreach_iter(exec_list_iterator, iter, signature->parameters) { + ir_variable *const var = ((ir_instruction *) iter.get())->as_variable(); + + assert(var != NULL); + + /* The only way a parameter would "exist" is if two parameters have + * the same name. + */ + if (state->symbols->name_declared_this_scope(var->name)) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, "parameter `%s' redeclared", var->name); + } else { + state->symbols->add_variable(var->name, var); + } + } + + /* Convert the body of the function to HIR. */ + this->body->hir(&signature->body, state); + signature->is_defined = true; + + state->symbols->pop_scope(); + + assert(state->current_function == signature); + state->current_function = NULL; + + if (!signature->return_type->is_void() && !state->found_return) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(& loc, state, "function `%s' has non-void return type " + "%s, but no return statement", + signature->function_name(), + signature->return_type->name); + } + + /* Function definitions do not have r-values. + */ + return NULL; +} + + +ir_rvalue * +ast_jump_statement::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + + switch (mode) { + case ast_return: { + ir_return *inst; + assert(state->current_function); + + if (opt_return_value) { + if (state->current_function->return_type->base_type == + GLSL_TYPE_VOID) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`return` with a value, in function `%s' " + "returning void", + state->current_function->function_name()); + } + + ir_expression *const ret = (ir_expression *) + opt_return_value->hir(instructions, state); + assert(ret != NULL); + + /* Implicit conversions are not allowed for return values. */ + if (state->current_function->return_type != ret->type) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`return' with wrong type %s, in function `%s' " + "returning %s", + ret->type->name, + state->current_function->function_name(), + state->current_function->return_type->name); + } + + inst = new(ctx) ir_return(ret); + } else { + if (state->current_function->return_type->base_type != + GLSL_TYPE_VOID) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`return' with no value, in function %s returning " + "non-void", + state->current_function->function_name()); + } + inst = new(ctx) ir_return; + } + + state->found_return = true; + instructions->push_tail(inst); + break; + } + + case ast_discard: + if (state->target != fragment_shader) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`discard' may only appear in a fragment shader"); + } + instructions->push_tail(new(ctx) ir_discard); + break; + + case ast_break: + case ast_continue: + /* FINISHME: Handle switch-statements. They cannot contain 'continue', + * FINISHME: and they use a different IR instruction for 'break'. + */ + /* FINISHME: Correctly handle the nesting. If a switch-statement is + * FINISHME: inside a loop, a 'continue' is valid and will bind to the + * FINISHME: loop. + */ + if (state->loop_or_switch_nesting == NULL) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`%s' may only appear in a loop", + (mode == ast_break) ? "break" : "continue"); + } else { + ir_loop *const loop = state->loop_or_switch_nesting->as_loop(); + + /* Inline the for loop expression again, since we don't know + * where near the end of the loop body the normal copy of it + * is going to be placed. + */ + if (mode == ast_continue && + state->loop_or_switch_nesting_ast->rest_expression) { + state->loop_or_switch_nesting_ast->rest_expression->hir(instructions, + state); + } + + if (loop != NULL) { + ir_loop_jump *const jump = + new(ctx) ir_loop_jump((mode == ast_break) + ? ir_loop_jump::jump_break + : ir_loop_jump::jump_continue); + instructions->push_tail(jump); + } + } + + break; + } + + /* Jump instructions do not have r-values. + */ + return NULL; +} + + +ir_rvalue * +ast_selection_statement::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + + ir_rvalue *const condition = this->condition->hir(instructions, state); + + /* From page 66 (page 72 of the PDF) of the GLSL 1.50 spec: + * + * "Any expression whose type evaluates to a Boolean can be used as the + * conditional expression bool-expression. Vector types are not accepted + * as the expression to if." + * + * The checks are separated so that higher quality diagnostics can be + * generated for cases where both rules are violated. + */ + if (!condition->type->is_boolean() || !condition->type->is_scalar()) { + YYLTYPE loc = this->condition->get_location(); + + _mesa_glsl_error(& loc, state, "if-statement condition must be scalar " + "boolean"); + } + + ir_if *const stmt = new(ctx) ir_if(condition); + + if (then_statement != NULL) { + state->symbols->push_scope(); + then_statement->hir(& stmt->then_instructions, state); + state->symbols->pop_scope(); + } + + if (else_statement != NULL) { + state->symbols->push_scope(); + else_statement->hir(& stmt->else_instructions, state); + state->symbols->pop_scope(); + } + + instructions->push_tail(stmt); + + /* if-statements do not have r-values. + */ + return NULL; +} + + +void +ast_iteration_statement::condition_to_hir(ir_loop *stmt, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + + if (condition != NULL) { + ir_rvalue *const cond = + condition->hir(& stmt->body_instructions, state); + + if ((cond == NULL) + || !cond->type->is_boolean() || !cond->type->is_scalar()) { + YYLTYPE loc = condition->get_location(); + + _mesa_glsl_error(& loc, state, + "loop condition must be scalar boolean"); + } else { + /* As the first code in the loop body, generate a block that looks + * like 'if (!condition) break;' as the loop termination condition. + */ + ir_rvalue *const not_cond = + new(ctx) ir_expression(ir_unop_logic_not, glsl_type::bool_type, cond, + NULL); + + ir_if *const if_stmt = new(ctx) ir_if(not_cond); + + ir_jump *const break_stmt = + new(ctx) ir_loop_jump(ir_loop_jump::jump_break); + + if_stmt->then_instructions.push_tail(break_stmt); + stmt->body_instructions.push_tail(if_stmt); + } + } +} + + +ir_rvalue * +ast_iteration_statement::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + + /* For-loops and while-loops start a new scope, but do-while loops do not. + */ + if (mode != ast_do_while) + state->symbols->push_scope(); + + if (init_statement != NULL) + init_statement->hir(instructions, state); + + ir_loop *const stmt = new(ctx) ir_loop(); + instructions->push_tail(stmt); + + /* Track the current loop and / or switch-statement nesting. + */ + ir_instruction *const nesting = state->loop_or_switch_nesting; + ast_iteration_statement *nesting_ast = state->loop_or_switch_nesting_ast; + + state->loop_or_switch_nesting = stmt; + state->loop_or_switch_nesting_ast = this; + + if (mode != ast_do_while) + condition_to_hir(stmt, state); + + if (body != NULL) + body->hir(& stmt->body_instructions, state); + + if (rest_expression != NULL) + rest_expression->hir(& stmt->body_instructions, state); + + if (mode == ast_do_while) + condition_to_hir(stmt, state); + + if (mode != ast_do_while) + state->symbols->pop_scope(); + + /* Restore previous nesting before returning. + */ + state->loop_or_switch_nesting = nesting; + state->loop_or_switch_nesting_ast = nesting_ast; + + /* Loops do not have r-values. + */ + return NULL; +} + + +ir_rvalue * +ast_type_specifier::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + if (this->structure != NULL) + return this->structure->hir(instructions, state); + + return NULL; +} + + +ir_rvalue * +ast_struct_specifier::hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + unsigned decl_count = 0; + + /* Make an initial pass over the list of structure fields to determine how + * many there are. Each element in this list is an ast_declarator_list. + * This means that we actually need to count the number of elements in the + * 'declarations' list in each of the elements. + */ + foreach_list_typed (ast_declarator_list, decl_list, link, + &this->declarations) { + foreach_list_const (decl_ptr, & decl_list->declarations) { + decl_count++; + } + } + + /* Allocate storage for the structure fields and process the field + * declarations. As the declarations are processed, try to also convert + * the types to HIR. This ensures that structure definitions embedded in + * other structure definitions are processed. + */ + glsl_struct_field *const fields = talloc_array(state, glsl_struct_field, + decl_count); + + unsigned i = 0; + foreach_list_typed (ast_declarator_list, decl_list, link, + &this->declarations) { + const char *type_name; + + decl_list->type->specifier->hir(instructions, state); + + /* Section 10.9 of the GLSL ES 1.00 specification states that + * embedded structure definitions have been removed from the language. + */ + if (state->es_shader && decl_list->type->specifier->structure != NULL) { + YYLTYPE loc = this->get_location(); + _mesa_glsl_error(&loc, state, "Embedded structure definitions are " + "not allowed in GLSL ES 1.00."); + } + + const glsl_type *decl_type = + decl_list->type->specifier->glsl_type(& type_name, state); + + foreach_list_typed (ast_declaration, decl, link, + &decl_list->declarations) { + const struct glsl_type *field_type = decl_type; + if (decl->is_array) { + YYLTYPE loc = decl->get_location(); + field_type = process_array_type(&loc, decl_type, decl->array_size, + state); + } + fields[i].type = (field_type != NULL) + ? field_type : glsl_type::error_type; + fields[i].name = decl->identifier; + i++; + } + } + + assert(i == decl_count); + + const glsl_type *t = + glsl_type::get_record_instance(fields, decl_count, this->name); + + YYLTYPE loc = this->get_location(); + if (!state->symbols->add_type(name, t)) { + _mesa_glsl_error(& loc, state, "struct `%s' previously defined", name); + } else { + + const glsl_type **s = (const glsl_type **) + realloc(state->user_structures, + sizeof(state->user_structures[0]) * + (state->num_user_structures + 1)); + if (s != NULL) { + s[state->num_user_structures] = t; + state->user_structures = s; + state->num_user_structures++; + } + } + + /* Structure type definitions do not have r-values. + */ + return NULL; +} diff --git a/mesalib/src/glsl/ast_type.cpp b/mesalib/src/glsl/ast_type.cpp new file mode 100644 index 000000000..9a957044e --- /dev/null +++ b/mesalib/src/glsl/ast_type.cpp @@ -0,0 +1,122 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <cstdio> +#include "ast.h" +extern "C" { +#include "program/symbol_table.h" +} + +void +ast_type_specifier::print(void) const +{ + if (type_specifier == ast_struct) { + structure->print(); + } else { + printf("%s ", type_name); + } + + if (is_array) { + printf("[ "); + + if (array_size) { + array_size->print(); + } + + printf("] "); + } +} + +ast_type_specifier::ast_type_specifier(int specifier) + : type_specifier(ast_types(specifier)), type_name(NULL), structure(NULL), + is_array(false), array_size(NULL), precision(ast_precision_high) +{ + static const char *const names[] = { + "void", + "float", + "int", + "uint", + "bool", + "vec2", + "vec3", + "vec4", + "bvec2", + "bvec3", + "bvec4", + "ivec2", + "ivec3", + "ivec4", + "uvec2", + "uvec3", + "uvec4", + "mat2", + "mat2x3", + "mat2x4", + "mat3x2", + "mat3", + "mat3x4", + "mat4x2", + "mat4x3", + "mat4", + "sampler1D", + "sampler2D", + "sampler2DRect", + "sampler3D", + "samplerCube", + "sampler1DShadow", + "sampler2DShadow", + "sampler2DRectShadow", + "samplerCubeShadow", + "sampler1DArray", + "sampler2DArray", + "sampler1DArrayShadow", + "sampler2DArrayShadow", + "isampler1D", + "isampler2D", + "isampler3D", + "isamplerCube", + "isampler1DArray", + "isampler2DArray", + "usampler1D", + "usampler2D", + "usampler3D", + "usamplerCube", + "usampler1DArray", + "usampler2DArray", + + NULL, /* ast_struct */ + NULL /* ast_type_name */ + }; + + type_name = names[specifier]; +} + +bool +ast_fully_specified_type::has_qualifiers() const +{ + return qualifier.invariant || qualifier.constant || qualifier.attribute + || qualifier.varying || qualifier.in + || qualifier.out || qualifier.centroid + || qualifier.uniform || qualifier.smooth + || qualifier.flat || qualifier.noperspective; +} diff --git a/mesalib/src/glsl/builtin_function.cpp b/mesalib/src/glsl/builtin_function.cpp new file mode 100644 index 000000000..5f9bbec2f --- /dev/null +++ b/mesalib/src/glsl/builtin_function.cpp @@ -0,0 +1,19203 @@ +/* DO NOT MODIFY - automatically generated by generate_builtins.py */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include "main/core.h" /* for struct gl_shader */ +#include "glsl_parser_extras.h" +#include "ir_reader.h" +#include "program.h" +#include "ast.h" + +extern "C" struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); + +gl_shader * +read_builtins(GLenum target, const char *protos, const char **functions, unsigned count) +{ + GLcontext fakeCtx; + fakeCtx.API = API_OPENGL; + gl_shader *sh = _mesa_new_shader(NULL, 0, target); + struct _mesa_glsl_parse_state *st = + new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh); + + st->language_version = 130; + st->symbols->language_version = 130; + st->ARB_texture_rectangle_enable = true; + st->EXT_texture_array_enable = true; + _mesa_glsl_initialize_types(st); + + sh->ir = new(sh) exec_list; + sh->symbols = st->symbols; + + /* Read the IR containing the prototypes */ + _mesa_glsl_read_ir(st, sh->ir, protos, true); + + /* Read ALL the function bodies, telling the IR reader not to scan for + * prototypes (we've already created them). The IR reader will skip any + * signature that does not already exist as a prototype. + */ + for (unsigned i = 0; i < count; i++) { + _mesa_glsl_read_ir(st, sh->ir, functions[i], false); + + if (st->error) { + printf("error reading builtin: %.35s ...\n", functions[i]); + printf("Info log:\n%s\n", st->info_log); + talloc_free(sh); + return NULL; + } + } + + reparent_ir(sh->ir, sh); + delete st; + + return sh; +} + +static const char *builtin_abs = + "((function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float abs (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 abs (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 abs (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 abs (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_acos = + "((function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 - (constant float (1.5707963))\n" + " (call asin ((var_ref x)))))))\n" + "))\n" + "" +; +static const char *builtin_all = + "((function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" + "))\n" + "" +; +static const char *builtin_any = + "((function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bool any (var_ref arg0)))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bool any (var_ref arg0)))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bool any (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_asin = + "((function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float *\n" + " (expression float sign (var_ref x))\n" + " (expression float -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression float *\n" + " (expression float sqrt\n" + " (expression float -\n" + " (constant float (1.0))\n" + " (expression float abs (var_ref x))))\n" + " (expression float +\n" + " (constant float (1.5707288))\n" + " (expression float *\n" + " (expression float abs (var_ref x))\n" + " (expression float +\n" + " (constant float (-0.2121144))\n" + " (expression float *\n" + " (constant float (0.0742610))\n" + " (expression float abs (var_ref x))))))))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 *\n" + " (expression vec2 sign (var_ref x))\n" + " (expression vec2 -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec2 *\n" + " (expression vec2 sqrt\n" + " (expression vec2 -\n" + " (constant float (1.0))\n" + " (expression vec2 abs (var_ref x))))\n" + " (expression vec2 +\n" + " (constant float (1.5707288))\n" + " (expression vec2 *\n" + " (expression vec2 abs (var_ref x))\n" + " (expression vec2 +\n" + " (constant float (-0.2121144))\n" + " (expression vec2 *\n" + " (constant float (0.0742610))\n" + " (expression vec2 abs (var_ref x))))))))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 *\n" + " (expression vec3 sign (var_ref x))\n" + " (expression vec3 -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec3 *\n" + " (expression vec3 sqrt\n" + " (expression vec3 -\n" + " (constant float (1.0))\n" + " (expression vec3 abs (var_ref x))))\n" + " (expression vec3 +\n" + " (constant float (1.5707288))\n" + " (expression vec3 *\n" + " (expression vec3 abs (var_ref x))\n" + " (expression vec3 +\n" + " (constant float (-0.2121144))\n" + " (expression vec3 *\n" + " (constant float (0.0742610))\n" + " (expression vec3 abs (var_ref x))))))))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 *\n" + " (expression vec4 sign (var_ref x))\n" + " (expression vec4 -\n" + " (expression float *\n" + " (constant float (3.1415926))\n" + " (constant float (0.5)))\n" + " (expression vec4 *\n" + " (expression vec4 sqrt\n" + " (expression vec4 -\n" + " (constant float (1.0))\n" + " (expression vec4 abs (var_ref x))))\n" + " (expression vec4 +\n" + " (constant float (1.5707288))\n" + " (expression vec4 *\n" + " (expression vec4 abs (var_ref x))\n" + " (expression vec4 +\n" + " (constant float (-0.2121144))\n" + " (expression vec4 *\n" + " (constant float (0.0742610))\n" + " (expression vec4 abs (var_ref x))))))))))))\n" + "))\n" + "" +; +static const char *builtin_atan = + "((function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (call asin ((expression float *\n" + " (var_ref x)\n" + " (expression float rsq\n" + " (expression float +\n" + " (expression float *\n" + " (var_ref x)\n" + " (var_ref x))\n" + " (constant float (1.0))))))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ((return (call asin ((expression vec2 *\n" + " (var_ref y_over_x)\n" + " (expression vec2 rsq\n" + " (expression vec2 +\n" + " (expression vec2 *\n" + " (var_ref y_over_x)\n" + " (var_ref y_over_x))\n" + " (constant float (1.0))))))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ((return (call asin ((expression vec3 *\n" + " (var_ref y_over_x)\n" + " (expression vec3 rsq\n" + " (expression vec3 +\n" + " (expression vec3 *\n" + " (var_ref y_over_x)\n" + " (var_ref y_over_x))\n" + " (constant float (1.0))))))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ((return (call asin ((expression vec4 *\n" + " (var_ref y_over_x)\n" + " (expression vec4 rsq\n" + " (expression vec4 +\n" + " (expression vec4 *\n" + " (var_ref y_over_x)\n" + " (var_ref y_over_x))\n" + " (constant float (1.0))))))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in ) float y)\n" + " (declare (in ) float x)\n" + " )\n" + " (\n" + " (declare () float r)\n" + " (declare ( ) float abs_retval)\n" + " (assign (constant bool (1)) (x) (var_ref abs_retval) (call abs ((var_ref x) ))\n" + ")\n" + " (if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) (\n" + " (declare ( ) float atan_retval)\n" + " (assign (constant bool (1)) (x) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))\n" + ")\n" + " (assign (constant bool (1)) (x) (var_ref r) (var_ref atan_retval) )\n" + " (if (expression bool < (var_ref x) (constant float (0.000000)) ) (\n" + " (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (\n" + " (declare ( ) float assignment_tmp)\n" + " (assign (constant bool (1)) (x) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) )\n" + " (assign (constant bool (1)) (x) (var_ref r) (var_ref assignment_tmp) )\n" + " )\n" + " (\n" + " (declare ( ) float assignment_tmp)\n" + " (assign (constant bool (1)) (x) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) )\n" + " (assign (constant bool (1)) (x) (var_ref r) (var_ref assignment_tmp) )\n" + " ))\n" + "\n" + " )\n" + " (\n" + " ))\n" + "\n" + " )\n" + " (\n" + " (declare () float sgn)\n" + " (assign (constant bool (1)) (x) (var_ref sgn) (expression float sign (var_ref y)))\n" + " (assign (constant bool (1)) (x) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))\n" + " ))\n" + "\n" + " (return (var_ref r) )\n" + " ))\n" + "\n" + "\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 r)\n" + " (assign (constant bool (1)) (x) (var_ref r)\n" + " (call atan ((swiz x (var_ref y))\n" + " (swiz x (var_ref x)))))\n" + " (assign (constant bool (1)) (y) (var_ref r)\n" + " (call atan ((swiz y (var_ref y))\n" + " (swiz y (var_ref x)))))\n" + " (return (var_ref r))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 r)\n" + " (assign (constant bool (1)) (x) (var_ref r)\n" + " (call atan ((swiz x (var_ref y))\n" + " (swiz x (var_ref x)))))\n" + " (assign (constant bool (1)) (y) (var_ref r)\n" + " (call atan ((swiz y (var_ref y))\n" + " (swiz y (var_ref x)))))\n" + " (assign (constant bool (1)) (z) (var_ref r)\n" + " (call atan ((swiz z (var_ref y))\n" + " (swiz z (var_ref x)))))\n" + " (return (var_ref r))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 r)\n" + " (assign (constant bool (1)) (x) (var_ref r)\n" + " (call atan ((swiz x (var_ref y))\n" + " (swiz x (var_ref x)))))\n" + " (assign (constant bool (1)) (y) (var_ref r)\n" + " (call atan ((swiz y (var_ref y))\n" + " (swiz y (var_ref x)))))\n" + " (assign (constant bool (1)) (z) (var_ref r)\n" + " (call atan ((swiz z (var_ref y))\n" + " (swiz z (var_ref x)))))\n" + " (assign (constant bool (1)) (w) (var_ref r)\n" + " (call atan ((swiz w (var_ref y))\n" + " (swiz w (var_ref x)))))\n" + " (return (var_ref r)))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_ceil = + "((function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float ceil (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 ceil (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 ceil (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 ceil (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_clamp = + "((function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) vec2 arg2))\n" + " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) vec3 arg2))\n" + " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) vec4 arg2))\n" + " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((return (expression int max (expression int min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1)\n" + " (declare (in) ivec2 arg2))\n" + " ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1)\n" + " (declare (in) ivec3 arg2))\n" + " ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1)\n" + " (declare (in) ivec4 arg2))\n" + " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((return (expression ivec2 max (expression ivec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((return (expression ivec3 max (expression ivec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) int arg1)\n" + " (declare (in) int arg2))\n" + " ((return (expression ivec4 max (expression ivec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((return (expression uint max (expression uint min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1)\n" + " (declare (in) uvec2 arg2))\n" + " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1)\n" + " (declare (in) uvec3 arg2))\n" + " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1)\n" + " (declare (in) uvec4 arg2))\n" + " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((return (expression uvec2 max (expression uvec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((return (expression uvec3 max (expression uvec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uint arg1)\n" + " (declare (in) uint arg2))\n" + " ((return (expression uvec4 max (expression uvec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_cos = + "((function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ((return (expression float cos (var_ref angle)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ((return (expression vec2 cos (var_ref angle)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ((return (expression vec3 cos (var_ref angle)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 cos (var_ref angle)))))\n" + "))\n" + "" +; +static const char *builtin_cosh = + "((function cosh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float * (constant float (0.5))\n" + " (expression float +\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 * (constant vec2 (0.5))\n" + " (expression vec2 +\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 * (constant vec3 (0.5))\n" + " (expression vec3 +\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 * (constant vec4 (0.5))\n" + " (expression vec4 +\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + "))\n" + "" +; +static const char *builtin_cross = + "((function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 cross (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_dFdx = + "((function dFdx\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ((return (expression float dFdx (var_ref p)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ((return (expression vec2 dFdx (var_ref p)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ((return (expression vec3 dFdx (var_ref p)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 dFdx (var_ref p)))))\n" + "))\n" + "" +; +static const char *builtin_dFdy = + "((function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ((return (expression float dFdy (var_ref p)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ((return (expression vec2 dFdy (var_ref p)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ((return (expression vec3 dFdy (var_ref p)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 dFdy (var_ref p)))))\n" + "))\n" + "" +; +static const char *builtin_degrees = + "((function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float * (var_ref arg0) (constant float (57.295780))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (constant float (57.295780))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (constant float (57.295780))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (constant float (57.295780))))))\n" + "))\n" + "" +; +static const char *builtin_distance = + "((function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ((return (expression float abs (expression float - (var_ref p0) (var_ref p1))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ((declare () vec2 p)\n" + " (assign (constant bool (1)) (xy) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ((declare () vec3 p)\n" + " (assign (constant bool (1)) (xyz) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ((declare () vec4 p)\n" + " (assign (constant bool (1)) (xyzw) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))\n" + " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n" + "))\n" + "" +; +static const char *builtin_dot = + "((function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float * (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_equal = + "((function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 arg0)\n" + " (declare (in) bvec2 arg1))\n" + " ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 arg0)\n" + " (declare (in) bvec3 arg1))\n" + " ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 arg0)\n" + " (declare (in) bvec4 arg1))\n" + " ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression bvec2 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression bvec3 == (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression bvec4 == (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_exp = + "((function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float exp (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 exp (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 exp (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 exp (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_exp2 = + "((function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float exp2 (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 exp2 (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 exp2 (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 exp2 (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_faceforward = + "((function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ((if (expression bool < (expression float * (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression float neg (var_ref N)))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression vec2 neg (var_ref N)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression vec3 neg (var_ref N)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n" + " ((return (var_ref N)))\n" + " ((return (expression vec4 neg (var_ref N)))))))\n" + "))\n" + "" +; +static const char *builtin_floor = + "((function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float floor (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 floor (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 floor (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 floor (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_fract = + "((function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float fract (var_ref x)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 fract (var_ref x)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 fract (var_ref x)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 fract (var_ref x)))))\n" + "))\n" + "\n" + "" +; +static const char *builtin_ftransform = + "((declare (uniform) mat4 gl_ModelViewProjectionMatrix)\n" + " (declare (in) vec4 gl_Vertex)\n" + " (function ftransform\n" + " (signature vec4\n" + " (parameters)\n" + " ((return (expression vec4 *\n" + " (var_ref gl_ModelViewProjectionMatrix)\n" + " (var_ref gl_Vertex)))))\n" + "))\n" + "" +; +static const char *builtin_fwidth = + "((function fwidth\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ((return (expression float +\n" + " (expression float abs (expression float dFdx (var_ref p)))\n" + " (expression float abs (expression float dFdy (var_ref p)))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ((return (expression vec2 +\n" + " (expression vec2 abs (expression vec2 dFdx (var_ref p)))\n" + " (expression vec2 abs (expression vec2 dFdy (var_ref p)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ((return (expression vec3 +\n" + " (expression vec3 abs (expression vec3 dFdx (var_ref p)))\n" + " (expression vec3 abs (expression vec3 dFdy (var_ref p)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ((return (expression vec4 +\n" + " (expression vec4 abs (expression vec4 dFdx (var_ref p)))\n" + " (expression vec4 abs (expression vec4 dFdy (var_ref p)))))))\n" + "))\n" + "" +; +static const char *builtin_greaterThan = + "((function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression bvec2 > (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression bvec3 > (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression bvec4 > (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_greaterThanEqual = + "((function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression bvec2 >= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression bvec3 >= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression bvec4 >= (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_inversesqrt = + "((function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float rsq (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 rsq (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 rsq (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 rsq (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_length = + "((function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float abs (var_ref arg0)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "))\n" + "" +; +static const char *builtin_lessThan = + "((function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression bvec2 < (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression bvec3 < (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression bvec4 < (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_lessThanEqual = + "((function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression bvec2 <= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression bvec3 <= (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression bvec4 <= (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_log = + "((function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float log (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 log (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 log (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 log (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_log2 = + "((function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float log2 (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 log2 (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 log2 (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 log2 (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_matrixCompMult = + "((function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ((declare () mat2 z)\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n" + "(return (var_ref z))))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ((declare () mat3 z)\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n" + "(return (var_ref z))))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ((declare () mat4 z)\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))\n" + "(return (var_ref z))))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ((declare () mat2x3 z)\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n" + "(return (var_ref z))))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ((declare () mat3x2 z)\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n" + "(return (var_ref z))))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ((declare () mat2x4 z)\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n" + "(return (var_ref z))))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ((declare () mat4x2 z)\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))\n" + "(return (var_ref z))))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ((declare () mat3x4 z)\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n" + "(return (var_ref z))))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ((declare () mat4x3 z)\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))\n" + "(return (var_ref z))))\n" + "))\n" + "" +; +static const char *builtin_max = + "((function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression int max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec4 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uint max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec4 max (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_min = + "((function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression int min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) int arg1))\n" + " ((return (expression ivec4 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uint min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uint arg1))\n" + " ((return (expression uvec4 min (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_mix = + "((function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) vec2 arg2))\n" + " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) vec3 arg2))\n" + " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) vec4 arg2))\n" + " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float v1)\n" + " (declare (in) float v2)\n" + " (declare (in) bool a))\n" + " ((assign (var_ref a) (var_ref v1) (var_ref v2))\n" + " (return (var_ref v1))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 v1)\n" + " (declare (in) vec2 v2)\n" + " (declare (in) bvec2 a))\n" + " ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))\n" + " (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))\n" + " (return (var_ref v1))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 v1)\n" + " (declare (in) vec3 v2)\n" + " (declare (in) bvec3 a))\n" + " ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))\n" + " (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))\n" + " (assign (swiz z (var_ref a)) (z) (var_ref v1) (swiz z (var_ref v2)))\n" + " (return (var_ref v1))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 v1)\n" + " (declare (in) vec4 v2)\n" + " (declare (in) bvec4 a))\n" + " ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))\n" + " (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))\n" + " (assign (swiz z (var_ref a)) (z) (var_ref v1) (swiz z (var_ref v2)))\n" + " (assign (swiz w (var_ref a)) (w) (var_ref v1) (swiz w (var_ref v2)))\n" + " (return (var_ref v1))))\n" + "))\n" + "" +; +static const char *builtin_mod = + "((function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_noise1 = + "((function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float noise (var_ref x)))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression float noise (var_ref x)))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression float noise (var_ref x)))))\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression float noise (var_ref x)))))\n" + "))\n" + "" +; +static const char *builtin_noise2 = + "((function noise2\n" + " (signature vec2\n" + " (parameters (declare (in) vec4 p))\n" + " (\n" + " (declare () float a)\n" + " (declare () float b)\n" + " (declare () vec2 t)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (return (var_ref t))\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters (declare (in) vec3 p))\n" + " (\n" + " (declare () float a)\n" + " (declare () float b)\n" + " (declare () vec2 t)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (return (var_ref t))\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) vec2 p)\n" + " )\n" + " (\n" + " (declare () float a)\n" + " (declare () float b)\n" + " (declare () vec2 t)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (return (var_ref t))\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in ) float p)\n" + " )\n" + " (\n" + " (declare () float a)\n" + " (declare () float b)\n" + " (declare () vec2 t)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (return (var_ref t))\n" + " ))\n" + "))\n" + "" +; +static const char *builtin_noise3 = + "((function noise3\n" + " (signature vec3\n" + " (parameters (declare (in) vec4 p))\n" + " (\n" + " (declare () float a)\n" + " (declare () float b)\n" + " (declare () float c)\n" + " (declare () vec3 t)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0)))))\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n" + " (return (var_ref t))\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters (declare (in) vec3 p))\n" + " (\n" + " (declare () float a)\n" + " (declare () float b)\n" + " (declare () float c)\n" + " (declare () vec3 t)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0)))))\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n" + " (return (var_ref t))\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters (declare (in) vec2 p))\n" + " (\n" + " (declare () float a)\n" + " (declare () float b)\n" + " (declare () float c)\n" + " (declare () vec3 t)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0)))))\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n" + " (return (var_ref t))\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters (declare (in) float p))\n" + " (\n" + " (declare () float a)\n" + " (declare () float b)\n" + " (declare () float c)\n" + " (declare () vec3 t)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0)))))\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref t) (var_ref a))\n" + " (assign (constant bool (1)) (y) (var_ref t) (var_ref b))\n" + " (assign (constant bool (1)) (z) (var_ref t) (var_ref c))\n" + " (return (var_ref t))\n" + " ))\n" + "))\n" + "" +; +static const char *builtin_noise4 = + "((function noise4\n" + " (signature vec4\n" + " (parameters (declare (in) vec4 p))\n" + " (\n" + " (declare () float _x)\n" + " (declare () float _y)\n" + " (declare () float _z)\n" + " (declare () float _w)\n" + " (declare () vec4 _r)\n" + "\n" + " (declare () vec4 _p)\n" + " (assign (constant bool (1)) (xyzw) (var_ref _p) (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0))) )\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n" + " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n" + " (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n" + " (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n" + " (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n" + " (return (var_ref _r))\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters (declare (in) vec3 p))\n" + " (\n" + " (declare () float _x)\n" + " (declare () float _y)\n" + " (declare () float _z)\n" + " (declare () float _w)\n" + " (declare () vec4 _r)\n" + "\n" + " (declare () vec3 _p)\n" + " (assign (constant bool (1)) (xyz) (var_ref _p) (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0))) )\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n" + " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0)))))\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n" + " (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n" + " (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n" + " (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n" + " (return (var_ref _r))\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters (declare (in) vec2 p))\n" + " (\n" + " (declare () float _x)\n" + " (declare () float _y)\n" + " (declare () float _z)\n" + " (declare () float _w)\n" + " (declare () vec4 _r)\n" + "\n" + " (declare () vec2 _p)\n" + " (assign (constant bool (1)) (xy) (var_ref _p) (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0))) )\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n" + " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0)))))\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n" + " (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n" + " (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n" + " (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n" + " (return (var_ref _r))\n" + " ))\n" + "\n" + " (signature vec4\n" + " (parameters (declare (in) float p))\n" + " (\n" + " (declare () float _x)\n" + " (declare () float _y)\n" + " (declare () float _z)\n" + " (declare () float _w)\n" + " (declare () vec4 _r)\n" + "\n" + " (declare () float _p)\n" + " (assign (constant bool (1)) (x) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n" + " (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0)))))\n" + " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n" + " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0)))))\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref _r) (var_ref _x))\n" + " (assign (constant bool (1)) (y) (var_ref _r) (var_ref _y))\n" + " (assign (constant bool (1)) (z) (var_ref _r) (var_ref _z))\n" + " (assign (constant bool (1)) (w) (var_ref _r) (var_ref _w))\n" + " (return (var_ref _r))\n" + " ))\n" + "))\n" + "" +; +static const char *builtin_normalize = + "((function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float sign (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "))\n" + "" +; +static const char *builtin_not = + "((function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bvec2 ! (var_ref arg0)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bvec3 ! (var_ref arg0)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bvec4 ! (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_notEqual = + "((function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 arg0)\n" + " (declare (in) bvec2 arg1))\n" + " ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 arg0)\n" + " (declare (in) bvec3 arg1))\n" + " ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 arg0)\n" + " (declare (in) bvec4 arg1))\n" + " ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((return (expression bvec2 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((return (expression bvec3 != (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((return (expression bvec4 != (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_outerProduct = + "((function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec2 v))\n" + " ((declare () mat2 m)\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" + " (return (var_ref m))))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec2 v))\n" + " ((declare () mat2x3 m)\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" + " (return (var_ref m))))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec2 v))\n" + " ((declare () mat2x4 m)\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" + " (return (var_ref m))))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec3 v))\n" + " ((declare () mat3x2 m)\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n" + " (return (var_ref m))\n" + " ))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec3 v))\n" + " ((declare () mat3 m)\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n" + " (return (var_ref m))))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec3 v))\n" + " ((declare () mat3x4 m)\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n" + " (return (var_ref m))))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) vec2 u)\n" + " (declare (in) vec4 v))\n" + " ((declare () mat4x2 m)\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n" + " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))\n" + " (return (var_ref m))))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) vec3 u)\n" + " (declare (in) vec4 v))\n" + " ((declare () mat4x3 m)\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n" + " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))\n" + " (return (var_ref m))))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) vec4 u)\n" + " (declare (in) vec4 v))\n" + " ((declare () mat4 m)\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n" + " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))\n" + " (return (var_ref m))))\n" + "))\n" + "" +; +static const char *builtin_pow = + "((function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float pow (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 pow (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 pow (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))\n" + "))\n" + "" +; +static const char *builtin_radians = + "((function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float * (var_ref arg0) (constant float (0.017453))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (constant float (0.017453))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (constant float (0.017453))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))\n" + "))\n" + "" +; +static const char *builtin_reflect = + "((function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float i)\n" + " (declare (in) float n))\n" + " ((return (expression float -\n" + " (var_ref i)\n" + " (expression float *\n" + " (constant float (2.0))\n" + " (expression float *\n" + " (expression float *\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 i)\n" + " (declare (in) vec2 n))\n" + " ((return (expression vec2 -\n" + " (var_ref i)\n" + " (expression vec2 *\n" + " (constant float (2.0))\n" + " (expression vec2 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 i)\n" + " (declare (in) vec3 n))\n" + " ((return (expression vec3 -\n" + " (var_ref i)\n" + " (expression vec3 *\n" + " (constant float (2.0))\n" + " (expression vec3 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 i)\n" + " (declare (in) vec4 n))\n" + " ((return (expression vec4 -\n" + " (var_ref i)\n" + " (expression vec4 *\n" + " (constant float (2.0))\n" + " (expression vec4 *\n" + " (expression float dot\n" + " (var_ref n)\n" + " (var_ref i))\n" + " (var_ref n)))))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_refract = + "((function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float i)\n" + " (declare (in) float n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (x) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float * (var_ref n) (var_ref i))\n" + " (expression float * (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant float (0.0))))\n" + " ((return (expression float -\n" + " (expression float * (var_ref eta) (var_ref i))\n" + " (expression float *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 i)\n" + " (declare (in) vec2 n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (x) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant vec2 (0.0 0.0))))\n" + " ((return (expression vec2 -\n" + " (expression vec2 * (var_ref eta) (var_ref i))\n" + " (expression vec2 *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 i)\n" + " (declare (in) vec3 n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (x) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant vec3 (0.0 0.0 0.0))))\n" + " ((return (expression vec3 -\n" + " (expression vec3 * (var_ref eta) (var_ref i))\n" + " (expression vec3 *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 i)\n" + " (declare (in) vec4 n)\n" + " (declare (in) float eta))\n" + " ((declare () float k)\n" + " (assign (constant bool (1)) (x) (var_ref k)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * (var_ref eta)\n" + " (expression float * (var_ref eta)\n" + " (expression float - (constant float (1.0))\n" + " (expression float * \n" + " (expression float dot (var_ref n) (var_ref i))\n" + " (expression float dot (var_ref n) (var_ref i))))))))\n" + " (if (expression bool < (var_ref k) (constant float (0.0)))\n" + " ((return (constant vec4 (0.0 0.0 0.0 0.0))))\n" + " ((return (expression vec4 -\n" + " (expression vec4 * (var_ref eta) (var_ref i))\n" + " (expression vec4 *\n" + " (expression float +\n" + " (expression float * (var_ref eta)\n" + " (expression float dot (var_ref n) (var_ref i)))\n" + " (expression float sqrt (var_ref k)))\n" + " (var_ref n))))))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow1D = + "((function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow1DArray = + "((function shadow1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow1DArrayLod = + "((function shadow1DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow1DLod = + "((function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow1DProj = + "((function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow1DProjLod = + "((function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow2D = + "((function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow2DArray = + "((function shadow2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) 1 (swiz w (var_ref P)) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow2DLod = + "((function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow2DProj = + "((function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow2DProjLod = + "((function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow2DRect = + "((function shadow2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) 1 (swiz z (var_ref P)) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_shadow2DRectProj = + "((function shadow2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) (swiz z (var_ref P)) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_sign = + "((function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float sign (var_ref x)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 sign (var_ref x)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 sign (var_ref x)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 sign (var_ref x)))))\n" + "\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x))\n" + " ((return (expression int sign (var_ref x)))))\n" + "\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x))\n" + " ((return (expression ivec2 sign (var_ref x)))))\n" + "\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x))\n" + " ((return (expression ivec3 sign (var_ref x)))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x))\n" + " ((return (expression ivec4 sign (var_ref x)))))\n" + "))\n" + "\n" + "" +; +static const char *builtin_sin = + "((function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ((return (expression float sin (var_ref angle)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ((return (expression vec2 sin (var_ref angle)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ((return (expression vec3 sin (var_ref angle)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 sin (var_ref angle)))))\n" + "))\n" + "" +; +static const char *builtin_sinh = + "((function sinh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float * (constant float (0.5))\n" + " (expression float -\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 * (constant vec2 (0.5))\n" + " (expression vec2 -\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 * (constant vec3 (0.5))\n" + " (expression vec3 -\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 * (constant vec4 (0.5))\n" + " (expression vec4 -\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + "))\n" + "" +; +static const char *builtin_smoothstep = + "((function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ((declare () float t)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t))))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (declare () vec2 retval)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (y) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (declare () vec3 retval)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (y) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (z) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" + "\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (declare () vec4 retval)\n" + "\n" + " (assign (constant bool (1)) (x) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (y) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (z) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" + "\n" + " (assign (constant bool (1)) (w) (var_ref t)\n" + " (expression float max\n" + " (expression float min\n" + " (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (assign (constant bool (1)) (w) (var_ref retval) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n" + " (return (var_ref retval))\n" + " ))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 max\n" + " (expression vec2 min\n" + " (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0)))\n" + " (constant vec2 (1.0 1.0)))\n" + " (constant vec2 (0.0 0.0))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 max\n" + " (expression vec3 min\n" + " (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0)))\n" + " (constant vec3 (1.0 1.0 1.0)))\n" + " (constant vec3 (0.0 0.0 0.0))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 max\n" + " (expression vec4 min\n" + " (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0)))\n" + " (constant vec4 (1.0 1.0 1.0 1.0)))\n" + " (constant vec4 (0.0 0.0 0.0 0.0))))))\n" + "))\n" + "\n" + "" +; +static const char *builtin_sqrt = + "((function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float sqrt (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 sqrt (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 sqrt (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 sqrt (var_ref arg0)))))\n" + "))\n" + "" +; +static const char *builtin_step = + "((function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ((return (expression float b2f (expression bool >= (var_ref x) (var_ref edge))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n" + " (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ((declare () vec2 t)\n" + " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n" + " (return (var_ref t))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ((declare () vec4 t)\n" + " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n" + " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n" + " (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n" + " (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))\n" + " (return (var_ref t))))\n" + "))\n" + "\n" + "" +; +static const char *builtin_tan = + "((function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ((return (expression float / (expression float sin (var_ref angle)) (expression float cos (var_ref angle))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ((return (expression vec2 / (expression vec2 sin (var_ref angle)) (expression vec2 cos (var_ref angle))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ((return (expression vec3 / (expression vec3 sin (var_ref angle)) (expression vec3 cos (var_ref angle))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ((return (expression vec4 / (expression vec4 sin (var_ref angle)) (expression vec4 cos (var_ref angle))))))\n" + "))\n" + "" +; +static const char *builtin_tanh = + "((function tanh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ((return (expression float /\n" + " (expression float -\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))\n" + " (expression float +\n" + " (expression float exp (var_ref x))\n" + " (expression float exp (expression float neg (var_ref x))))))))\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ((return (expression vec2 /\n" + " (expression vec2 -\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))\n" + " (expression vec2 +\n" + " (expression vec2 exp (var_ref x))\n" + " (expression vec2 exp (expression vec2 neg (var_ref x))))))))\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ((return (expression vec3 /\n" + " (expression vec3 -\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))\n" + " (expression vec3 +\n" + " (expression vec3 exp (var_ref x))\n" + " (expression vec3 exp (expression vec3 neg (var_ref x))))))))\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ((return (expression vec4 /\n" + " (expression vec4 -\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))\n" + " (expression vec4 +\n" + " (expression vec4 exp (var_ref x))\n" + " (expression vec4 exp (expression vec4 neg (var_ref x))))))))\n" + "))\n" + "" +; +static const char *builtin_texelFetch = + "((function texelFetch\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) int P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) int P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) int P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) ivec2 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) ivec3 P) \n" + " (declare (in) int lod) )\n" + " ((return (txf (var_ref sampler) (var_ref P) (0 0 0) (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture = + "((function texture\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture1D = + "((function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture1DArray = + "((function texture1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture1DArrayLod = + "((function texture1DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture1DLod = + "((function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture1DProj = + "((function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture1DProjLod = + "((function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture2D = + "((function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture2DArray = + "((function texture2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture2DArrayLod = + "((function texture2DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture2DLod = + "((function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture2DProj = + "((function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture2DProjLod = + "((function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture2DRect = + "((function texture2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture2DRectProj = + "((function texture2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture3D = + "((function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture3DLod = + "((function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture3DProj = + "((function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_texture3DProjLod = + "((function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_textureCube = + "((function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (var_ref P) (0 0 0) 1 () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_textureCubeLod = + "((function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_textureGrad = + "((function textureGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (var_ref P) (0 0 0) 1 () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_textureLod = + "((function textureLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (var_ref P) (0 0 0) 1 () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_textureProj = + "((function textureProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) )\n" + " ((return (tex (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float bias) )\n" + " ((return (txb (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref bias) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_textureProjGrad = + "((function textureProjGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float dPdx) \n" + " (declare (in) float dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec2 dPdx) \n" + " (declare (in) vec2 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) vec3 dPdx) \n" + " (declare (in) vec3 dPdy) )\n" + " ((return (txd (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () ((var_ref dPdx) (var_ref dPdy)) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_textureProjLod = + "((function textureProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz y (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz x (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz z (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xy (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P) \n" + " (declare (in) float lod) )\n" + " ((return (txl (var_ref sampler) (swiz xyz (var_ref P)) (0 0 0) (swiz w (var_ref P)) () (var_ref lod) ))))\n" + "\n" + "))\n" + "" +; +static const char *builtin_transpose = + "((function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 m))\n" + " ((declare () mat2 t)\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n" + "(return (var_ref t))))\n" + "\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat2x3 m))\n" + " ((declare () mat3x2 t)\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n" + "(return (var_ref t))))\n" + "\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat2x4 m))\n" + " ((declare () mat4x2 t)\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))\n" + "(return (var_ref t))))\n" + "\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat3x2 m))\n" + " ((declare () mat2x3 t)\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n" + "(return (var_ref t))))\n" + "\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 m))\n" + " ((declare () mat3 t)\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n" + "(return (var_ref t))))\n" + "\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat3x4 m))\n" + " ((declare () mat4x3 t)\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))\n" + "(return (var_ref t))))\n" + "\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat4x2 m))\n" + " ((declare () mat2x4 t)\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))\n" + " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))\n" + "(return (var_ref t))))\n" + "\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat4x3 m))\n" + " ((declare () mat3x4 t)\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))\n" + " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))\n" + " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))\n" + "(return (var_ref t))))\n" + "\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 m))\n" + " ((declare () mat4 t)\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))\n" + " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))\n" + " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))\n" + " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))\n" + " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (3)))))\n" + "(return (var_ref t))))\n" + ")\n" + "\n" + ")\n" + "\n" + "" +; +static const char *prototypes_for_100_frag = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float degrees))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 degrees))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 degrees))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float radians))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 radians))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 radians))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 radians))\n" + " ()))\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y_over_x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ()))\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())))" +; +static const char *functions_for_100_frag [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cross, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_sign, + builtin_sin, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture2D, + builtin_texture2DProj, + builtin_textureCube, +}; +static const char *prototypes_for_100_vert = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float degrees))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 degrees))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 degrees))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float radians))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 radians))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 radians))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 radians))\n" + " ()))\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y_over_x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ()))\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())))" +; +static const char *functions_for_100_vert [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cross, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_sign, + builtin_sin, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture2D, + builtin_texture2DLod, + builtin_texture2DProj, + builtin_texture2DProjLod, + builtin_textureCube, + builtin_textureCubeLod, +}; +static const char *prototypes_for_110_frag = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float degrees))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 degrees))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 degrees))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float radians))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 radians))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 radians))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 radians))\n" + " ()))\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y_over_x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ()))\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function dFdx\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function fwidth\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())))" +; +static const char *functions_for_110_frag [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cross, + builtin_dFdx, + builtin_dFdy, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_fwidth, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_noise1, + builtin_noise2, + builtin_noise3, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DProj, + builtin_shadow2D, + builtin_shadow2DProj, + builtin_sign, + builtin_sin, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture1D, + builtin_texture1DProj, + builtin_texture2D, + builtin_texture2DProj, + builtin_texture3D, + builtin_texture3DProj, + builtin_textureCube, +}; +static const char *prototypes_for_110_vert = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float degrees))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 degrees))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 degrees))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float radians))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 radians))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 radians))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 radians))\n" + " ()))\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y_over_x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ftransform\n" + " (signature vec4\n" + " (parameters)\n" + " ()))\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ()))\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ()))\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())))" +; +static const char *functions_for_110_vert [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cross, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_ftransform, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_noise1, + builtin_noise2, + builtin_noise3, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DLod, + builtin_shadow1DProj, + builtin_shadow1DProjLod, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_shadow2DProj, + builtin_shadow2DProjLod, + builtin_sign, + builtin_sin, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture1D, + builtin_texture1DLod, + builtin_texture1DProj, + builtin_texture1DProjLod, + builtin_texture2D, + builtin_texture2DLod, + builtin_texture2DProj, + builtin_texture2DProjLod, + builtin_texture3D, + builtin_texture3DLod, + builtin_texture3DProj, + builtin_texture3DProjLod, + builtin_textureCube, + builtin_textureCubeLod, +}; +static const char *prototypes_for_120_frag = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float degrees))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 degrees))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 degrees))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float radians))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 radians))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 radians))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 radians))\n" + " ()))\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y_over_x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ()))\n" + "(function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" + " ()))\n" + "(function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 m))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 m))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 m))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat3x2 m))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat2x3 m))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat4x2 m))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat2x4 m))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat4x3 m))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat3x4 m))\n" + " ()))\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function dFdx\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function fwidth\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())))" +; +static const char *functions_for_120_frag [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cross, + builtin_dFdx, + builtin_dFdy, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_fwidth, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_noise1, + builtin_noise2, + builtin_noise3, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_outerProduct, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DProj, + builtin_shadow2D, + builtin_shadow2DProj, + builtin_sign, + builtin_sin, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture1D, + builtin_texture1DProj, + builtin_texture2D, + builtin_texture2DProj, + builtin_texture3D, + builtin_texture3DProj, + builtin_textureCube, + builtin_transpose, +}; +static const char *prototypes_for_120_vert = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float degrees))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 degrees))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 degrees))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float radians))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 radians))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 radians))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 radians))\n" + " ()))\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y_over_x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ()))\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ()))\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ftransform\n" + " (signature vec4\n" + " (parameters)\n" + " ()))\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ()))\n" + "(function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" + " ()))\n" + "(function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 m))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 m))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 m))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat3x2 m))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat2x3 m))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat4x2 m))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat2x4 m))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat4x3 m))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat3x4 m))\n" + " ()))\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ()))\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ()))\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())))" +; +static const char *functions_for_120_vert [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cross, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_ftransform, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_noise1, + builtin_noise2, + builtin_noise3, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_outerProduct, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DLod, + builtin_shadow1DProj, + builtin_shadow1DProjLod, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_shadow2DProj, + builtin_shadow2DProjLod, + builtin_sign, + builtin_sin, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_texture1D, + builtin_texture1DLod, + builtin_texture1DProj, + builtin_texture1DProjLod, + builtin_texture2D, + builtin_texture2DLod, + builtin_texture2DProj, + builtin_texture2DProjLod, + builtin_texture3D, + builtin_texture3DLod, + builtin_texture3DProj, + builtin_texture3DProjLod, + builtin_textureCube, + builtin_textureCubeLod, + builtin_transpose, +}; +static const char *prototypes_for_130_frag = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float degrees))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 degrees))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 degrees))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float radians))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 radians))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 radians))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 radians))\n" + " ()))\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y_over_x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function sinh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function cosh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function tanh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 minVal)\n" + " (declare (in) ivec2 maxVal))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 minVal)\n" + " (declare (in) ivec3 maxVal))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 minVal)\n" + " (declare (in) ivec4 maxVal))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 minVal)\n" + " (declare (in) uvec2 maxVal))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 minVal)\n" + " (declare (in) uvec3 maxVal))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 minVal)\n" + " (declare (in) uvec4 maxVal))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ()))\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ()))\n" + "(function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" + " ()))\n" + "(function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 m))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 m))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 m))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat3x2 m))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat2x3 m))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat4x2 m))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat2x4 m))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat4x3 m))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat3x4 m))\n" + " ()))\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function texture\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texelFetch\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ()))\n" + "(function textureProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function textureGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" + "(function textureProjGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function dFdx\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function dFdy\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function fwidth\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 p))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 p))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 p))\n" + " ()))\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())))" +; +static const char *functions_for_130_frag [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cosh, + builtin_cross, + builtin_dFdx, + builtin_dFdy, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_fwidth, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_noise1, + builtin_noise2, + builtin_noise3, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_outerProduct, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DLod, + builtin_shadow1DProj, + builtin_shadow1DProjLod, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_shadow2DProj, + builtin_shadow2DProjLod, + builtin_sign, + builtin_sin, + builtin_sinh, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_tanh, + builtin_texelFetch, + builtin_texture, + builtin_texture1D, + builtin_texture1DLod, + builtin_texture1DProj, + builtin_texture1DProjLod, + builtin_texture2D, + builtin_texture2DLod, + builtin_texture2DProj, + builtin_texture2DProjLod, + builtin_texture3D, + builtin_texture3DLod, + builtin_texture3DProj, + builtin_texture3DProjLod, + builtin_textureCube, + builtin_textureCubeLod, + builtin_textureGrad, + builtin_textureLod, + builtin_textureProj, + builtin_textureProjGrad, + builtin_textureProjLod, + builtin_transpose, +}; +static const char *prototypes_for_130_vert = + "(\n" + "(function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float degrees))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 degrees))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 degrees))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 degrees))\n" + " ()))\n" + "(function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float radians))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 radians))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 radians))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 radians))\n" + " ()))\n" + "(function sin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function cos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function tan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function asin\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function acos\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float angle))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 angle))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 angle))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 angle))\n" + " ()))\n" + "(function atan\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float y_over_x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 y_over_x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 y_over_x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 y_over_x))\n" + " ()))\n" + "(function sinh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function cosh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function tanh\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x))\n" + " ()))\n" + "(function sign\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x))\n" + " ()))\n" + "(function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function fract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" + "(function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int y))\n" + " ())\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint y))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint y))\n" + " ()))\n" + "(function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 minVal)\n" + " (declare (in) vec2 maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 minVal)\n" + " (declare (in) vec3 maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 minVal)\n" + " (declare (in) vec4 maxVal))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) float minVal)\n" + " (declare (in) float maxVal))\n" + " ())\n" + " (signature int\n" + " (parameters\n" + " (declare (in) int x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 minVal)\n" + " (declare (in) ivec2 maxVal))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 minVal)\n" + " (declare (in) ivec3 maxVal))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 minVal)\n" + " (declare (in) ivec4 maxVal))\n" + " ())\n" + " (signature ivec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" + " (signature ivec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) int minVal)\n" + " (declare (in) int maxVal))\n" + " ())\n" + " (signature uint\n" + " (parameters\n" + " (declare (in) uint x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 minVal)\n" + " (declare (in) uvec2 maxVal))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 minVal)\n" + " (declare (in) uvec3 maxVal))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 minVal)\n" + " (declare (in) uvec4 maxVal))\n" + " ())\n" + " (signature uvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" + " (signature uvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uint minVal)\n" + " (declare (in) uint maxVal))\n" + " ()))\n" + "(function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) vec2 a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) vec3 a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) vec4 a))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y)\n" + " (declare (in) float a))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y)\n" + " (declare (in) float a))\n" + " ()))\n" + "(function step\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function smoothstep\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 edge0)\n" + " (declare (in) vec2 edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 edge0)\n" + " (declare (in) vec3 edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 edge0)\n" + " (declare (in) vec4 edge1)\n" + " (declare (in) vec4 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float edge0)\n" + " (declare (in) float edge1)\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function distance\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float p0)\n" + " (declare (in) float p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 p0)\n" + " (declare (in) vec2 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 p0)\n" + " (declare (in) vec3 p1))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 p0)\n" + " (declare (in) vec4 p1))\n" + " ()))\n" + "(function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x)\n" + " (declare (in) float y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ()))\n" + "(function cross\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ()))\n" + "(function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function ftransform\n" + " (signature vec4\n" + " (parameters)\n" + " ()))\n" + "(function faceforward\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float N)\n" + " (declare (in) float I)\n" + " (declare (in) float Nref))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 N)\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 Nref))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 N)\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 Nref))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 N)\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 Nref))\n" + " ()))\n" + "(function reflect\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N))\n" + " ()))\n" + "(function refract\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float I)\n" + " (declare (in) float N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 I)\n" + " (declare (in) vec2 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 I)\n" + " (declare (in) vec3 N)\n" + " (declare (in) float eta))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 I)\n" + " (declare (in) vec4 N)\n" + " (declare (in) float eta))\n" + " ()))\n" + "(function matrixCompMult\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 x)\n" + " (declare (in) mat2 y))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 x)\n" + " (declare (in) mat3 y))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 x)\n" + " (declare (in) mat4 y))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat2x3 x)\n" + " (declare (in) mat2x3 y))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat2x4 x)\n" + " (declare (in) mat2x4 y))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat3x2 x)\n" + " (declare (in) mat3x2 y))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat3x4 x)\n" + " (declare (in) mat3x4 y))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat4x2 x)\n" + " (declare (in) mat4x2 y))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat4x3 x)\n" + " (declare (in) mat4x3 y))\n" + " ()))\n" + "(function outerProduct\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec2 r))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) vec2 c)\n" + " (declare (in) vec4 r))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) vec4 c)\n" + " (declare (in) vec3 r))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) vec3 c)\n" + " (declare (in) vec4 r))\n" + " ()))\n" + "(function transpose\n" + " (signature mat2\n" + " (parameters\n" + " (declare (in) mat2 m))\n" + " ())\n" + " (signature mat3\n" + " (parameters\n" + " (declare (in) mat3 m))\n" + " ())\n" + " (signature mat4\n" + " (parameters\n" + " (declare (in) mat4 m))\n" + " ())\n" + " (signature mat2x3\n" + " (parameters\n" + " (declare (in) mat3x2 m))\n" + " ())\n" + " (signature mat3x2\n" + " (parameters\n" + " (declare (in) mat2x3 m))\n" + " ())\n" + " (signature mat2x4\n" + " (parameters\n" + " (declare (in) mat4x2 m))\n" + " ())\n" + " (signature mat4x2\n" + " (parameters\n" + " (declare (in) mat2x4 m))\n" + " ())\n" + " (signature mat3x4\n" + " (parameters\n" + " (declare (in) mat4x3 m))\n" + " ())\n" + " (signature mat4x3\n" + " (parameters\n" + " (declare (in) mat3x4 m))\n" + " ()))\n" + "(function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" + "(function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" + "(function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" + "(function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ()))\n" + "(function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 x)\n" + " (declare (in) vec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 x)\n" + " (declare (in) vec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 x)\n" + " (declare (in) vec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 x)\n" + " (declare (in) ivec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 x)\n" + " (declare (in) ivec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 x)\n" + " (declare (in) ivec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 x)\n" + " (declare (in) uvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 x)\n" + " (declare (in) uvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 x)\n" + " (declare (in) uvec4 y))\n" + " ())\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x)\n" + " (declare (in) bvec2 y))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x)\n" + " (declare (in) bvec3 y))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x)\n" + " (declare (in) bvec4 y))\n" + " ()))\n" + "(function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 x))\n" + " ())\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 x))\n" + " ())\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 x))\n" + " ()))\n" + "(function texture\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texelFetch\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) int P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) ivec2 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) ivec3 P)\n" + " (declare (in) int lod))\n" + " ()))\n" + "(function textureProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function textureGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) float P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usamplerCube sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) samplerCubeShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1DArray sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2DArray sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" + "(function textureProjGrad\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec2 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler1D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec3 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler2D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature ivec4\n" + " (parameters\n" + " (declare (in) isampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature uvec4\n" + " (parameters\n" + " (declare (in) usampler3D sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec3 dPdx)\n" + " (declare (in) vec3 dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) float dPdx)\n" + " (declare (in) float dPdy))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 P)\n" + " (declare (in) vec2 dPdx)\n" + " (declare (in) vec2 dPdy))\n" + " ()))\n" + "(function texture1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) float coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture3DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture3DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler3D sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function textureCube\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function textureCubeLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) samplerCube sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2D\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2DProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DProjLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DShadow sampler)\n" + " (declare (in) vec4 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function noise1\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise2\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise3\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ()))\n" + "(function noise4\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) float x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec2 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec3 x))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 x))\n" + " ())))" +; +static const char *functions_for_130_vert [] = { + builtin_abs, + builtin_acos, + builtin_all, + builtin_any, + builtin_asin, + builtin_atan, + builtin_ceil, + builtin_clamp, + builtin_cos, + builtin_cosh, + builtin_cross, + builtin_degrees, + builtin_distance, + builtin_dot, + builtin_equal, + builtin_exp, + builtin_exp2, + builtin_faceforward, + builtin_floor, + builtin_fract, + builtin_ftransform, + builtin_greaterThan, + builtin_greaterThanEqual, + builtin_inversesqrt, + builtin_length, + builtin_lessThan, + builtin_lessThanEqual, + builtin_log, + builtin_log2, + builtin_matrixCompMult, + builtin_max, + builtin_min, + builtin_mix, + builtin_mod, + builtin_noise1, + builtin_noise2, + builtin_noise3, + builtin_noise4, + builtin_normalize, + builtin_not, + builtin_notEqual, + builtin_outerProduct, + builtin_pow, + builtin_radians, + builtin_reflect, + builtin_refract, + builtin_shadow1D, + builtin_shadow1DLod, + builtin_shadow1DProj, + builtin_shadow1DProjLod, + builtin_shadow2D, + builtin_shadow2DLod, + builtin_shadow2DProj, + builtin_shadow2DProjLod, + builtin_sign, + builtin_sin, + builtin_sinh, + builtin_smoothstep, + builtin_sqrt, + builtin_step, + builtin_tan, + builtin_tanh, + builtin_texelFetch, + builtin_texture, + builtin_texture1D, + builtin_texture1DLod, + builtin_texture1DProj, + builtin_texture1DProjLod, + builtin_texture2D, + builtin_texture2DLod, + builtin_texture2DProj, + builtin_texture2DProjLod, + builtin_texture3D, + builtin_texture3DLod, + builtin_texture3DProj, + builtin_texture3DProjLod, + builtin_textureCube, + builtin_textureCubeLod, + builtin_textureGrad, + builtin_textureLod, + builtin_textureProj, + builtin_textureProjGrad, + builtin_textureProjLod, + builtin_transpose, +}; +static const char *prototypes_for_ARB_texture_rectangle_frag = + "(\n" + "(function texture2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" +; +static const char *functions_for_ARB_texture_rectangle_frag [] = { + builtin_shadow2DRect, + builtin_shadow2DRectProj, + builtin_texture2DRect, + builtin_texture2DRectProj, +}; +static const char *prototypes_for_ARB_texture_rectangle_vert = + "(\n" + "(function texture2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRect sampler)\n" + " (declare (in) vec4 coord))\n" + " ()))\n" + "(function shadow2DRect\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow2DRectProj\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DRectShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" +; +static const char *functions_for_ARB_texture_rectangle_vert [] = { + builtin_shadow2DRect, + builtin_shadow2DRectProj, + builtin_texture2DRect, + builtin_texture2DRectProj, +}; +static const char *prototypes_for_EXT_texture_array_frag = + "(\n" + "(function texture1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function texture2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ())\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float bias))\n" + " ()))\n" + "(function shadow2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" +; +static const char *functions_for_EXT_texture_array_frag [] = { + builtin_shadow1DArray, + builtin_shadow2DArray, + builtin_texture1DArray, + builtin_texture2DArray, +}; +static const char *prototypes_for_EXT_texture_array_vert = + "(\n" + "(function texture1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord))\n" + " ()))\n" + "(function texture1DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArray sampler)\n" + " (declare (in) vec2 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function texture2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function texture2DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArray sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow1DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord))\n" + " ()))\n" + "(function shadow1DArrayLod\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler1DArrayShadow sampler)\n" + " (declare (in) vec3 coord)\n" + " (declare (in) float lod))\n" + " ()))\n" + "(function shadow2DArray\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) sampler2DArrayShadow sampler)\n" + " (declare (in) vec4 coord))\n" + " ())))" +; +static const char *functions_for_EXT_texture_array_vert [] = { + builtin_shadow1DArray, + builtin_shadow1DArrayLod, + builtin_shadow2DArray, + builtin_texture1DArray, + builtin_texture1DArrayLod, + builtin_texture2DArray, + builtin_texture2DArrayLod, +}; +static gl_shader *builtin_profiles[12]; + +void *builtin_mem_ctx = NULL; + +void +_mesa_glsl_release_functions(void) +{ + talloc_free(builtin_mem_ctx); + builtin_mem_ctx = NULL; + memset(builtin_profiles, 0, sizeof(builtin_profiles)); +} + +static void +_mesa_read_profile(struct _mesa_glsl_parse_state *state, + exec_list *instructions, + int profile_index, + const char *prototypes, + const char **functions, + int count) +{ + gl_shader *sh = builtin_profiles[profile_index]; + + if (sh == NULL) { + sh = read_builtins(GL_VERTEX_SHADER, prototypes, functions, count); + talloc_steal(builtin_mem_ctx, sh); + builtin_profiles[profile_index] = sh; + } + + import_prototypes(sh->ir, instructions, state->symbols, state); + state->builtins_to_link[state->num_builtins_to_link] = sh; + state->num_builtins_to_link++; +} + +void +_mesa_glsl_initialize_functions(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + if (builtin_mem_ctx == NULL) { + builtin_mem_ctx = talloc_init("GLSL built-in functions"); + memset(&builtin_profiles, 0, sizeof(builtin_profiles)); + } + + state->num_builtins_to_link = 0; + + if (state->target == fragment_shader && state->language_version == 100) { + _mesa_read_profile(state, instructions, 0, + prototypes_for_100_frag, + functions_for_100_frag, + Elements(functions_for_100_frag)); + } + + if (state->target == vertex_shader && state->language_version == 100) { + _mesa_read_profile(state, instructions, 1, + prototypes_for_100_vert, + functions_for_100_vert, + Elements(functions_for_100_vert)); + } + + if (state->target == fragment_shader && state->language_version == 110) { + _mesa_read_profile(state, instructions, 2, + prototypes_for_110_frag, + functions_for_110_frag, + Elements(functions_for_110_frag)); + } + + if (state->target == vertex_shader && state->language_version == 110) { + _mesa_read_profile(state, instructions, 3, + prototypes_for_110_vert, + functions_for_110_vert, + Elements(functions_for_110_vert)); + } + + if (state->target == fragment_shader && state->language_version == 120) { + _mesa_read_profile(state, instructions, 4, + prototypes_for_120_frag, + functions_for_120_frag, + Elements(functions_for_120_frag)); + } + + if (state->target == vertex_shader && state->language_version == 120) { + _mesa_read_profile(state, instructions, 5, + prototypes_for_120_vert, + functions_for_120_vert, + Elements(functions_for_120_vert)); + } + + if (state->target == fragment_shader && state->language_version == 130) { + _mesa_read_profile(state, instructions, 6, + prototypes_for_130_frag, + functions_for_130_frag, + Elements(functions_for_130_frag)); + } + + if (state->target == vertex_shader && state->language_version == 130) { + _mesa_read_profile(state, instructions, 7, + prototypes_for_130_vert, + functions_for_130_vert, + Elements(functions_for_130_vert)); + } + + if (state->target == fragment_shader && state->ARB_texture_rectangle_enable) { + _mesa_read_profile(state, instructions, 8, + prototypes_for_ARB_texture_rectangle_frag, + functions_for_ARB_texture_rectangle_frag, + Elements(functions_for_ARB_texture_rectangle_frag)); + } + + if (state->target == vertex_shader && state->ARB_texture_rectangle_enable) { + _mesa_read_profile(state, instructions, 9, + prototypes_for_ARB_texture_rectangle_vert, + functions_for_ARB_texture_rectangle_vert, + Elements(functions_for_ARB_texture_rectangle_vert)); + } + + if (state->target == fragment_shader && state->EXT_texture_array_enable) { + _mesa_read_profile(state, instructions, 10, + prototypes_for_EXT_texture_array_frag, + functions_for_EXT_texture_array_frag, + Elements(functions_for_EXT_texture_array_frag)); + } + + if (state->target == vertex_shader && state->EXT_texture_array_enable) { + _mesa_read_profile(state, instructions, 11, + prototypes_for_EXT_texture_array_vert, + functions_for_EXT_texture_array_vert, + Elements(functions_for_EXT_texture_array_vert)); + } + +} diff --git a/mesalib/src/glsl/builtin_types.h b/mesalib/src/glsl/builtin_types.h new file mode 100644 index 000000000..6dabbf0d3 --- /dev/null +++ b/mesalib/src/glsl/builtin_types.h @@ -0,0 +1,297 @@ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +const glsl_type glsl_type::_error_type = + glsl_type(GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0, ""); + +const glsl_type glsl_type::void_type = + glsl_type(GL_INVALID_ENUM, GLSL_TYPE_VOID, 0, 0, "void"); + +const glsl_type *const glsl_type::error_type = & glsl_type::_error_type; + +/** \name Core built-in types + * + * These types exist in all versions of GLSL. + */ +/*@{*/ + +const glsl_type glsl_type::builtin_core_types[] = { + glsl_type(GL_BOOL, GLSL_TYPE_BOOL, 1, 1, "bool"), + glsl_type(GL_BOOL_VEC2, GLSL_TYPE_BOOL, 2, 1, "bvec2"), + glsl_type(GL_BOOL_VEC3, GLSL_TYPE_BOOL, 3, 1, "bvec3"), + glsl_type(GL_BOOL_VEC4, GLSL_TYPE_BOOL, 4, 1, "bvec4"), + glsl_type(GL_INT, GLSL_TYPE_INT, 1, 1, "int"), + glsl_type(GL_INT_VEC2, GLSL_TYPE_INT, 2, 1, "ivec2"), + glsl_type(GL_INT_VEC3, GLSL_TYPE_INT, 3, 1, "ivec3"), + glsl_type(GL_INT_VEC4, GLSL_TYPE_INT, 4, 1, "ivec4"), + glsl_type(GL_FLOAT, GLSL_TYPE_FLOAT, 1, 1, "float"), + glsl_type(GL_FLOAT_VEC2, GLSL_TYPE_FLOAT, 2, 1, "vec2"), + glsl_type(GL_FLOAT_VEC3, GLSL_TYPE_FLOAT, 3, 1, "vec3"), + glsl_type(GL_FLOAT_VEC4, GLSL_TYPE_FLOAT, 4, 1, "vec4"), + glsl_type(GL_FLOAT_MAT2, GLSL_TYPE_FLOAT, 2, 2, "mat2"), + glsl_type(GL_FLOAT_MAT3, GLSL_TYPE_FLOAT, 3, 3, "mat3"), + glsl_type(GL_FLOAT_MAT4, GLSL_TYPE_FLOAT, 4, 4, "mat4"), + glsl_type(GL_SAMPLER_2D, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT, + "sampler2D"), + glsl_type(GL_SAMPLER_CUBE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT, + "samplerCube"), +}; + +const glsl_type *const glsl_type::bool_type = & builtin_core_types[0]; +const glsl_type *const glsl_type::int_type = & builtin_core_types[4]; +const glsl_type *const glsl_type::ivec4_type = & builtin_core_types[7]; +const glsl_type *const glsl_type::float_type = & builtin_core_types[8]; +const glsl_type *const glsl_type::vec2_type = & builtin_core_types[9]; +const glsl_type *const glsl_type::vec3_type = & builtin_core_types[10]; +const glsl_type *const glsl_type::vec4_type = & builtin_core_types[11]; +const glsl_type *const glsl_type::mat2_type = & builtin_core_types[12]; +const glsl_type *const glsl_type::mat3_type = & builtin_core_types[13]; +const glsl_type *const glsl_type::mat4_type = & builtin_core_types[14]; +/*@}*/ + +/** \name GLSL structures that have not been deprecated. + */ +/*@{*/ + +static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = { + { glsl_type::float_type, "near" }, + { glsl_type::float_type, "far" }, + { glsl_type::float_type, "diff" }, +}; + +const glsl_type glsl_type::builtin_structure_types[] = { + glsl_type(gl_DepthRangeParameters_fields, + Elements(gl_DepthRangeParameters_fields), + "gl_DepthRangeParameters"), +}; +/*@}*/ + +/** \name GLSL 1.00 / 1.10 structures that are deprecated in GLSL 1.30 + */ +/*@{*/ + +static const struct glsl_struct_field gl_PointParameters_fields[] = { + { glsl_type::float_type, "size" }, + { glsl_type::float_type, "sizeMin" }, + { glsl_type::float_type, "sizeMax" }, + { glsl_type::float_type, "fadeThresholdSize" }, + { glsl_type::float_type, "distanceConstantAttenuation" }, + { glsl_type::float_type, "distanceLinearAttenuation" }, + { glsl_type::float_type, "distanceQuadraticAttenuation" }, +}; + +static const struct glsl_struct_field gl_MaterialParameters_fields[] = { + { glsl_type::vec4_type, "emission" }, + { glsl_type::vec4_type, "ambient" }, + { glsl_type::vec4_type, "diffuse" }, + { glsl_type::vec4_type, "specular" }, + { glsl_type::float_type, "shininess" }, +}; + +static const struct glsl_struct_field gl_LightSourceParameters_fields[] = { + { glsl_type::vec4_type, "ambient" }, + { glsl_type::vec4_type, "diffuse" }, + { glsl_type::vec4_type, "specular" }, + { glsl_type::vec4_type, "position" }, + { glsl_type::vec4_type, "halfVector" }, + { glsl_type::vec3_type, "spotDirection" }, + { glsl_type::float_type, "spotExponent" }, + { glsl_type::float_type, "spotCutoff" }, + { glsl_type::float_type, "spotCosCutoff" }, + { glsl_type::float_type, "constantAttenuation" }, + { glsl_type::float_type, "linearAttenuation" }, + { glsl_type::float_type, "quadraticAttenuation" }, +}; + +static const struct glsl_struct_field gl_LightModelParameters_fields[] = { + { glsl_type::vec4_type, "ambient" }, +}; + +static const struct glsl_struct_field gl_LightModelProducts_fields[] = { + { glsl_type::vec4_type, "sceneColor" }, +}; + +static const struct glsl_struct_field gl_LightProducts_fields[] = { + { glsl_type::vec4_type, "ambient" }, + { glsl_type::vec4_type, "diffuse" }, + { glsl_type::vec4_type, "specular" }, +}; + +static const struct glsl_struct_field gl_FogParameters_fields[] = { + { glsl_type::vec4_type, "color" }, + { glsl_type::float_type, "density" }, + { glsl_type::float_type, "start" }, + { glsl_type::float_type, "end" }, + { glsl_type::float_type, "scale" }, +}; + +const glsl_type glsl_type::builtin_110_deprecated_structure_types[] = { + glsl_type(gl_PointParameters_fields, + Elements(gl_PointParameters_fields), + "gl_PointParameters"), + glsl_type(gl_MaterialParameters_fields, + Elements(gl_MaterialParameters_fields), + "gl_MaterialParameters"), + glsl_type(gl_LightSourceParameters_fields, + Elements(gl_LightSourceParameters_fields), + "gl_LightSourceParameters"), + glsl_type(gl_LightModelParameters_fields, + Elements(gl_LightModelParameters_fields), + "gl_LightModelParameters"), + glsl_type(gl_LightModelProducts_fields, + Elements(gl_LightModelProducts_fields), + "gl_LightModelProducts"), + glsl_type(gl_LightProducts_fields, + Elements(gl_LightProducts_fields), + "gl_LightProducts"), + glsl_type(gl_FogParameters_fields, + Elements(gl_FogParameters_fields), + "gl_FogParameters"), +}; +/*@}*/ + +/** \name Types in GLSL 1.10 (but not GLSL ES 1.00) + */ +/*@{*/ +const glsl_type glsl_type::builtin_110_types[] = { + glsl_type(GL_SAMPLER_1D, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT, + "sampler1D"), + glsl_type(GL_SAMPLER_1D_SHADOW, GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT, + "sampler1DShadow"), + glsl_type(GL_SAMPLER_2D_SHADOW, GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT, + "sampler2DShadow"), + glsl_type(GL_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT, + "sampler3D"), +}; +/*@}*/ + +/** \name Types added in GLSL 1.20 + */ +/*@{*/ + +const glsl_type glsl_type::builtin_120_types[] = { + glsl_type(GL_FLOAT_MAT2x3, GLSL_TYPE_FLOAT, 3, 2, "mat2x3"), + glsl_type(GL_FLOAT_MAT2x4, GLSL_TYPE_FLOAT, 4, 2, "mat2x4"), + glsl_type(GL_FLOAT_MAT3x2, GLSL_TYPE_FLOAT, 2, 3, "mat3x2"), + glsl_type(GL_FLOAT_MAT3x4, GLSL_TYPE_FLOAT, 4, 3, "mat3x4"), + glsl_type(GL_FLOAT_MAT4x2, GLSL_TYPE_FLOAT, 2, 4, "mat4x2"), + glsl_type(GL_FLOAT_MAT4x3, GLSL_TYPE_FLOAT, 3, 4, "mat4x3"), +}; +const glsl_type *const glsl_type::mat2x3_type = & builtin_120_types[0]; +const glsl_type *const glsl_type::mat2x4_type = & builtin_120_types[1]; +const glsl_type *const glsl_type::mat3x2_type = & builtin_120_types[2]; +const glsl_type *const glsl_type::mat3x4_type = & builtin_120_types[3]; +const glsl_type *const glsl_type::mat4x2_type = & builtin_120_types[4]; +const glsl_type *const glsl_type::mat4x3_type = & builtin_120_types[5]; +/*@}*/ + +/** \name Types added in GLSL 1.30 + */ +/*@{*/ + +const glsl_type glsl_type::builtin_130_types[] = { + glsl_type(GL_UNSIGNED_INT, GLSL_TYPE_UINT, 1, 1, "uint"), + glsl_type(GL_UNSIGNED_INT_VEC2, GLSL_TYPE_UINT, 2, 1, "uvec2"), + glsl_type(GL_UNSIGNED_INT_VEC3, GLSL_TYPE_UINT, 3, 1, "uvec3"), + glsl_type(GL_UNSIGNED_INT_VEC4, GLSL_TYPE_UINT, 4, 1, "uvec4"), + + /* 1D and 2D texture arrays - several of these are included only in + * builtin_EXT_texture_array_types. + */ + glsl_type(GL_INT_SAMPLER_1D_ARRAY, + GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT, "isampler1DArray"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, + GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT, "usampler1DArray"), + glsl_type(GL_INT_SAMPLER_2D_ARRAY, + GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT, "isampler2DArray"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, + GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT, "usampler2DArray"), + + /* cube shadow samplers */ + glsl_type(GL_SAMPLER_CUBE_SHADOW, + GLSL_SAMPLER_DIM_CUBE, 1, 0, GLSL_TYPE_FLOAT, "samplerCubeShadow"), + + /* signed and unsigned integer samplers */ + glsl_type(GL_INT_SAMPLER_1D, + GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT, "isampler1D"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_1D, + GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT, "usampler1D"), + glsl_type(GL_INT_SAMPLER_2D, + GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT, "isampler2D"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_2D, + GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT, "usampler2D"), + glsl_type(GL_INT_SAMPLER_3D, + GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT, "isampler3D"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_3D, + GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT, "usampler3D"), + glsl_type(GL_INT_SAMPLER_CUBE, + GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT, "isamplerCube"), + glsl_type(GL_INT_SAMPLER_CUBE, + GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT, "usamplerCube"), +}; + +const glsl_type *const glsl_type::uint_type = & builtin_130_types[0]; +const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3]; +/*@}*/ + +/** \name Sampler types added by GL_ARB_texture_rectangle + */ +/*@{*/ + +const glsl_type glsl_type::builtin_ARB_texture_rectangle_types[] = { + glsl_type(GL_SAMPLER_2D_RECT, + GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT, "sampler2DRect"), + glsl_type(GL_SAMPLER_2D_RECT_SHADOW, + GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT, "sampler2DRectShadow"), +}; +/*@}*/ + +/** \name Sampler types added by GL_EXT_texture_array + */ +/*@{*/ + +const glsl_type glsl_type::builtin_EXT_texture_array_types[] = { + glsl_type(GL_SAMPLER_1D_ARRAY, + GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT, "sampler1DArray"), + glsl_type(GL_SAMPLER_1D_ARRAY_SHADOW, + GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT, "sampler2DArray"), + glsl_type(GL_SAMPLER_2D_ARRAY, + GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT, "sampler1DArrayShadow"), + glsl_type(GL_SAMPLER_2D_ARRAY_SHADOW, + GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT, "sampler2DArrayShadow"), +}; +/*@}*/ + +/** \name Sampler types added by GL_EXT_texture_buffer_object + */ +/*@{*/ + +const glsl_type glsl_type::builtin_EXT_texture_buffer_object_types[] = { + glsl_type(GL_SAMPLER_BUFFER, + GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT, "samplerBuffer"), + glsl_type(GL_INT_SAMPLER_BUFFER, + GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT, "isamplerBuffer"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_BUFFER, + GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT, "usamplerBuffer"), +}; +/*@}*/ diff --git a/mesalib/src/glsl/builtin_variables.h b/mesalib/src/glsl/builtin_variables.h new file mode 100644 index 000000000..a34c67e34 --- /dev/null +++ b/mesalib/src/glsl/builtin_variables.h @@ -0,0 +1,105 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "main/core.h" /* for slot numbers */ + +struct builtin_variable { + enum ir_variable_mode mode; + int slot; + const char *type; + const char *name; +}; + +static const builtin_variable builtin_core_vs_variables[] = { + { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, + { ir_var_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, +}; + +static const builtin_variable builtin_core_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, + { ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, +}; + +static const builtin_variable builtin_100ES_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, +}; + +static const builtin_variable builtin_110_fs_variables[] = { + { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, +}; + +static const builtin_variable builtin_110_deprecated_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, + { ir_var_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, + { ir_var_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, +}; + +static const builtin_variable builtin_110_deprecated_vs_variables[] = { + { ir_var_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" }, + { ir_var_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" }, + { ir_var_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" }, + { ir_var_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" }, + { ir_var_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" }, + { ir_var_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" }, + { ir_var_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" }, + { ir_var_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" }, + { ir_var_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" }, + { ir_var_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" }, + { ir_var_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, + { ir_var_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, + { ir_var_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, + { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_ClipVertex" }, + { ir_var_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, + { ir_var_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, + { ir_var_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, + { ir_var_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, + { ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, +}; + +static const builtin_variable builtin_120_fs_variables[] = { + { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, +}; + +static const builtin_variable builtin_130_vs_variables[] = { + { ir_var_in, -1, "int", "gl_VertexID" }, +}; + +static const builtin_variable builtin_110_deprecated_uniforms[] = { + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrix" }, + { ir_var_uniform, -1, "mat3", "gl_NormalMatrix" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverse" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewMatrixInverseTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ProjectionMatrixInverseTranspose" }, + { ir_var_uniform, -1, "mat4", "gl_ModelViewProjectionMatrixInverseTranspose" }, + { ir_var_uniform, -1, "float", "gl_NormalScale" }, + { ir_var_uniform, -1, "gl_LightModelParameters", "gl_LightModel"}, +}; + diff --git a/mesalib/src/glsl/cl/Makefile b/mesalib/src/glsl/cl/Makefile deleted file mode 100644 index 04a52df8c..000000000 --- a/mesalib/src/glsl/cl/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -#src/glsl/cl/Makefile - -TOP = ../../.. - -include $(TOP)/configs/current - -LIBNAME = glslcl - -C_SOURCES = \ - sl_cl_parse.c - -include ../Makefile.template - diff --git a/mesalib/src/glsl/cl/sl_cl_parse.c b/mesalib/src/glsl/cl/sl_cl_parse.c deleted file mode 100644 index 771bdfd08..000000000 --- a/mesalib/src/glsl/cl/sl_cl_parse.c +++ /dev/null @@ -1,3001 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <assert.h> -#include <stdlib.h> -#include <string.h> -#include "../pp/sl_pp_public.h" -#include "sl_cl_parse.h" - - -/* revision number - increment after each change affecting emitted output */ -#define REVISION 5 - -/* external declaration (or precision or invariant stmt) */ -#define EXTERNAL_NULL 0 -#define EXTERNAL_FUNCTION_DEFINITION 1 -#define EXTERNAL_DECLARATION 2 -#define DEFAULT_PRECISION 3 -#define INVARIANT_STMT 4 - -/* precision */ -#define PRECISION_DEFAULT 0 -#define PRECISION_LOW 1 -#define PRECISION_MEDIUM 2 -#define PRECISION_HIGH 3 - -/* declaration */ -#define DECLARATION_FUNCTION_PROTOTYPE 1 -#define DECLARATION_INIT_DECLARATOR_LIST 2 - -/* function type */ -#define FUNCTION_ORDINARY 0 -#define FUNCTION_CONSTRUCTOR 1 -#define FUNCTION_OPERATOR 2 - -/* function call type */ -#define FUNCTION_CALL_NONARRAY 0 -#define FUNCTION_CALL_ARRAY 1 - -/* operator type */ -#define OPERATOR_ADDASSIGN 1 -#define OPERATOR_SUBASSIGN 2 -#define OPERATOR_MULASSIGN 3 -#define OPERATOR_DIVASSIGN 4 -/*#define OPERATOR_MODASSIGN 5*/ -/*#define OPERATOR_LSHASSIGN 6*/ -/*#define OPERATOR_RSHASSIGN 7*/ -/*#define OPERATOR_ORASSIGN 8*/ -/*#define OPERATOR_XORASSIGN 9*/ -/*#define OPERATOR_ANDASSIGN 10*/ -#define OPERATOR_LOGICALXOR 11 -/*#define OPERATOR_BITOR 12*/ -/*#define OPERATOR_BITXOR 13*/ -/*#define OPERATOR_BITAND 14*/ -#define OPERATOR_LESS 15 -#define OPERATOR_GREATER 16 -#define OPERATOR_LESSEQUAL 17 -#define OPERATOR_GREATEREQUAL 18 -/*#define OPERATOR_LSHIFT 19*/ -/*#define OPERATOR_RSHIFT 20*/ -#define OPERATOR_MULTIPLY 21 -#define OPERATOR_DIVIDE 22 -/*#define OPERATOR_MODULUS 23*/ -#define OPERATOR_INCREMENT 24 -#define OPERATOR_DECREMENT 25 -#define OPERATOR_PLUS 26 -#define OPERATOR_MINUS 27 -/*#define OPERATOR_COMPLEMENT 28*/ -#define OPERATOR_NOT 29 - -/* init declarator list */ -#define DECLARATOR_NONE 0 -#define DECLARATOR_NEXT 1 - -/* variable declaration */ -#define VARIABLE_NONE 0 -#define VARIABLE_IDENTIFIER 1 -#define VARIABLE_INITIALIZER 2 -#define VARIABLE_ARRAY_EXPLICIT 3 -#define VARIABLE_ARRAY_UNKNOWN 4 - -/* type qualifier */ -#define TYPE_QUALIFIER_NONE 0 -#define TYPE_QUALIFIER_CONST 1 -#define TYPE_QUALIFIER_ATTRIBUTE 2 -#define TYPE_QUALIFIER_VARYING 3 -#define TYPE_QUALIFIER_UNIFORM 4 -#define TYPE_QUALIFIER_FIXEDOUTPUT 5 -#define TYPE_QUALIFIER_FIXEDINPUT 6 - -/* invariant qualifier */ -#define TYPE_VARIANT 90 -#define TYPE_INVARIANT 91 - -/* centroid qualifier */ -#define TYPE_CENTER 95 -#define TYPE_CENTROID 96 - -/* layout qualifiers */ -#define LAYOUT_QUALIFIER_NONE 0 -#define LAYOUT_QUALIFIER_UPPER_LEFT 1 -#define LAYOUT_QUALIFIER_PIXEL_CENTER_INTEGER 2 - -/* type specifier */ -#define TYPE_SPECIFIER_VOID 0 -#define TYPE_SPECIFIER_BOOL 1 -#define TYPE_SPECIFIER_BVEC2 2 -#define TYPE_SPECIFIER_BVEC3 3 -#define TYPE_SPECIFIER_BVEC4 4 -#define TYPE_SPECIFIER_INT 5 -#define TYPE_SPECIFIER_IVEC2 6 -#define TYPE_SPECIFIER_IVEC3 7 -#define TYPE_SPECIFIER_IVEC4 8 -#define TYPE_SPECIFIER_FLOAT 9 -#define TYPE_SPECIFIER_VEC2 10 -#define TYPE_SPECIFIER_VEC3 11 -#define TYPE_SPECIFIER_VEC4 12 -#define TYPE_SPECIFIER_MAT2 13 -#define TYPE_SPECIFIER_MAT3 14 -#define TYPE_SPECIFIER_MAT4 15 -#define TYPE_SPECIFIER_SAMPLER1D 16 -#define TYPE_SPECIFIER_SAMPLER2D 17 -#define TYPE_SPECIFIER_SAMPLER3D 18 -#define TYPE_SPECIFIER_SAMPLERCUBE 19 -#define TYPE_SPECIFIER_SAMPLER1DSHADOW 20 -#define TYPE_SPECIFIER_SAMPLER2DSHADOW 21 -#define TYPE_SPECIFIER_SAMPLER2DRECT 22 -#define TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23 -#define TYPE_SPECIFIER_STRUCT 24 -#define TYPE_SPECIFIER_TYPENAME 25 - -/* OpenGL 2.1 */ -#define TYPE_SPECIFIER_MAT23 26 -#define TYPE_SPECIFIER_MAT32 27 -#define TYPE_SPECIFIER_MAT24 28 -#define TYPE_SPECIFIER_MAT42 29 -#define TYPE_SPECIFIER_MAT34 30 -#define TYPE_SPECIFIER_MAT43 31 - -/* GL_EXT_texture_array */ -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY 32 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY 33 -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW 34 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW 35 - -/* type specifier array */ -#define TYPE_SPECIFIER_NONARRAY 0 -#define TYPE_SPECIFIER_ARRAY 1 - -/* structure field */ -#define FIELD_NONE 0 -#define FIELD_NEXT 1 -#define FIELD_ARRAY 2 - -/* operation */ -#define OP_END 0 -#define OP_BLOCK_BEGIN_NO_NEW_SCOPE 1 -#define OP_BLOCK_BEGIN_NEW_SCOPE 2 -#define OP_DECLARE 3 -#define OP_ASM 4 -#define OP_BREAK 5 -#define OP_CONTINUE 6 -#define OP_DISCARD 7 -#define OP_RETURN 8 -#define OP_EXPRESSION 9 -#define OP_IF 10 -#define OP_WHILE 11 -#define OP_DO 12 -#define OP_FOR 13 -#define OP_PUSH_VOID 14 -#define OP_PUSH_BOOL 15 -#define OP_PUSH_INT 16 -#define OP_PUSH_FLOAT 17 -#define OP_PUSH_IDENTIFIER 18 -#define OP_SEQUENCE 19 -#define OP_ASSIGN 20 -#define OP_ADDASSIGN 21 -#define OP_SUBASSIGN 22 -#define OP_MULASSIGN 23 -#define OP_DIVASSIGN 24 -/*#define OP_MODASSIGN 25*/ -/*#define OP_LSHASSIGN 26*/ -/*#define OP_RSHASSIGN 27*/ -/*#define OP_ORASSIGN 28*/ -/*#define OP_XORASSIGN 29*/ -/*#define OP_ANDASSIGN 30*/ -#define OP_SELECT 31 -#define OP_LOGICALOR 32 -#define OP_LOGICALXOR 33 -#define OP_LOGICALAND 34 -/*#define OP_BITOR 35*/ -/*#define OP_BITXOR 36*/ -/*#define OP_BITAND 37*/ -#define OP_EQUAL 38 -#define OP_NOTEQUAL 39 -#define OP_LESS 40 -#define OP_GREATER 41 -#define OP_LESSEQUAL 42 -#define OP_GREATEREQUAL 43 -/*#define OP_LSHIFT 44*/ -/*#define OP_RSHIFT 45*/ -#define OP_ADD 46 -#define OP_SUBTRACT 47 -#define OP_MULTIPLY 48 -#define OP_DIVIDE 49 -/*#define OP_MODULUS 50*/ -#define OP_PREINCREMENT 51 -#define OP_PREDECREMENT 52 -#define OP_PLUS 53 -#define OP_MINUS 54 -/*#define OP_COMPLEMENT 55*/ -#define OP_NOT 56 -#define OP_SUBSCRIPT 57 -#define OP_CALL 58 -#define OP_FIELD 59 -#define OP_POSTINCREMENT 60 -#define OP_POSTDECREMENT 61 -#define OP_PRECISION 62 -#define OP_METHOD 63 - -/* parameter qualifier */ -#define PARAM_QUALIFIER_IN 0 -#define PARAM_QUALIFIER_OUT 1 -#define PARAM_QUALIFIER_INOUT 2 - -/* function parameter */ -#define PARAMETER_NONE 0 -#define PARAMETER_NEXT 1 - -/* function parameter array presence */ -#define PARAMETER_ARRAY_NOT_PRESENT 0 -#define PARAMETER_ARRAY_PRESENT 1 - - -struct parse_dict { - int _void; - int _float; - int _int; - int _bool; - int vec2; - int vec3; - int vec4; - int bvec2; - int bvec3; - int bvec4; - int ivec2; - int ivec3; - int ivec4; - int mat2; - int mat3; - int mat4; - int mat2x3; - int mat3x2; - int mat2x4; - int mat4x2; - int mat3x4; - int mat4x3; - int sampler1D; - int sampler2D; - int sampler3D; - int samplerCube; - int sampler1DShadow; - int sampler2DShadow; - int sampler2DRect; - int sampler2DRectShadow; - int sampler1DArray; - int sampler2DArray; - int sampler1DArrayShadow; - int sampler2DArrayShadow; - - int invariant; - - int centroid; - - int precision; - int lowp; - int mediump; - int highp; - - int _const; - int attribute; - int varying; - int uniform; - int __fixed_output; - int __fixed_input; - - int in; - int out; - int inout; - - int layout; - int origin_upper_left; - int pixel_center_integer; - - int _struct; - - int __constructor; - int __operator; - int ___asm; - - int _if; - int _else; - int _for; - int _while; - int _do; - - int _continue; - int _break; - int _return; - int discard; - - int _false; - int _true; - - int all; - int _GL_ARB_fragment_coord_conventions; -}; - - -struct parse_context { - struct sl_pp_context *context; - - struct parse_dict dict; - - struct sl_pp_token_info *tokens; - unsigned int tokens_read; - unsigned int tokens_cap; - - unsigned char *out_buf; - unsigned int out_cap; - - unsigned int shader_type; - unsigned int parsing_builtin; - - unsigned int fragment_coord_conventions:1; - - char error[256]; - int process_error; -}; - - -struct parse_state { - unsigned int in; - unsigned int out; -}; - - -static unsigned int -_emit(struct parse_context *ctx, - unsigned int *out, - unsigned char b) -{ - if (*out == ctx->out_cap) { - ctx->out_cap += 4096; - ctx->out_buf = (unsigned char *)realloc(ctx->out_buf, ctx->out_cap * sizeof(unsigned char)); - } - ctx->out_buf[*out] = b; - return (*out)++; -} - - -static void -_update(struct parse_context *ctx, - unsigned int out, - unsigned char b) -{ - ctx->out_buf[out] = b; -} - - -static void -_error(struct parse_context *ctx, - const char *msg) -{ - if (ctx->error[0] == '\0') { - strncpy(ctx->error, msg, sizeof(ctx->error) - 1); - ctx->error[sizeof(ctx->error) - 1] = '\0'; - } -} - - -static const struct sl_pp_token_info * -_fetch_token(struct parse_context *ctx, - unsigned int pos) -{ - if (ctx->process_error) { - return NULL; - } - - while (pos >= ctx->tokens_read) { - if (ctx->tokens_read == ctx->tokens_cap) { - ctx->tokens_cap += 1024; - ctx->tokens = realloc(ctx->tokens, - ctx->tokens_cap * sizeof(struct sl_pp_token_info)); - if (!ctx->tokens) { - _error(ctx, "out of memory"); - ctx->process_error = 1; - return NULL; - } - } - if (sl_pp_process_get(ctx->context, &ctx->tokens[ctx->tokens_read])) { - _error(ctx, sl_pp_context_error_message(ctx->context)); - ctx->process_error = 1; - return NULL; - } - switch (ctx->tokens[ctx->tokens_read].token) { - case SL_PP_COMMA: - case SL_PP_SEMICOLON: - case SL_PP_LBRACE: - case SL_PP_RBRACE: - case SL_PP_LPAREN: - case SL_PP_RPAREN: - case SL_PP_LBRACKET: - case SL_PP_RBRACKET: - case SL_PP_DOT: - case SL_PP_INCREMENT: - case SL_PP_ADDASSIGN: - case SL_PP_PLUS: - case SL_PP_DECREMENT: - case SL_PP_SUBASSIGN: - case SL_PP_MINUS: - case SL_PP_BITNOT: - case SL_PP_NOTEQUAL: - case SL_PP_NOT: - case SL_PP_MULASSIGN: - case SL_PP_STAR: - case SL_PP_DIVASSIGN: - case SL_PP_SLASH: - case SL_PP_MODASSIGN: - case SL_PP_MODULO: - case SL_PP_LSHIFTASSIGN: - case SL_PP_LSHIFT: - case SL_PP_LESSEQUAL: - case SL_PP_LESS: - case SL_PP_RSHIFTASSIGN: - case SL_PP_RSHIFT: - case SL_PP_GREATEREQUAL: - case SL_PP_GREATER: - case SL_PP_EQUAL: - case SL_PP_ASSIGN: - case SL_PP_AND: - case SL_PP_BITANDASSIGN: - case SL_PP_BITAND: - case SL_PP_XOR: - case SL_PP_BITXORASSIGN: - case SL_PP_BITXOR: - case SL_PP_OR: - case SL_PP_BITORASSIGN: - case SL_PP_BITOR: - case SL_PP_QUESTION: - case SL_PP_COLON: - case SL_PP_IDENTIFIER: - case SL_PP_UINT: - case SL_PP_FLOAT: - case SL_PP_EXTENSION_REQUIRE: - case SL_PP_EXTENSION_ENABLE: - case SL_PP_EXTENSION_WARN: - case SL_PP_EXTENSION_DISABLE: - case SL_PP_EOF: - ctx->tokens_read++; - break; - default: - ; /* no-op */ - } - } - return &ctx->tokens[pos]; -} - - -/** - * Try to parse/match a particular token. - * \return 0 for success, -1 for error. - */ -static int -_parse_token(struct parse_context *ctx, - enum sl_pp_token token, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == token) { - ps->in++; - return 0; - } - return -1; -} - - -/** - * Try to parse an identifer. - * \return 0 for success, -1 for error - */ -static int -_parse_id(struct parse_context *ctx, - int id, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == SL_PP_IDENTIFIER && input->data.identifier == id) { - ps->in++; - return 0; - } - return -1; -} - - -static int -_parse_identifier(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == SL_PP_IDENTIFIER) { - const char *cstr = sl_pp_context_cstr(ctx->context, input->data.identifier); - - do { - _emit(ctx, &ps->out, *cstr); - } while (*cstr++); - ps->in++; - return 0; - } - return -1; -} - - -static int -_parse_float(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == SL_PP_FLOAT) { - const char *cstr = sl_pp_context_cstr(ctx->context, input->data._float); - - _emit(ctx, &ps->out, 1); - do { - _emit(ctx, &ps->out, *cstr); - } while (*cstr++); - ps->in++; - return 0; - } - return -1; -} - - -static int -_parse_uint(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - - if (input && input->token == SL_PP_UINT) { - const char *cstr = sl_pp_context_cstr(ctx->context, input->data._uint); - - _emit(ctx, &ps->out, 1); - do { - _emit(ctx, &ps->out, *cstr); - } while (*cstr++); - ps->in++; - return 0; - } - return -1; -} - - -/**************************************/ - - -static int -_parse_unary_expression(struct parse_context *ctx, - struct parse_state *ps); - -static int -_parse_conditional_expression(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_constant_expression(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_primary_expression(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_statement(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_type_specifier(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_declaration(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_statement_list(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_assignment_expression(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_precision(struct parse_context *ctx, - struct parse_state *ps); - - -static int -_parse_overriden_operator(struct parse_context *ctx, - struct parse_state *ps) -{ - unsigned int op; - - if (_parse_token(ctx, SL_PP_INCREMENT, ps) == 0) { - op = OPERATOR_INCREMENT; - } else if (_parse_token(ctx, SL_PP_ADDASSIGN, ps) == 0) { - op = OPERATOR_ADDASSIGN; - } else if (_parse_token(ctx, SL_PP_PLUS, ps) == 0) { - op = OPERATOR_PLUS; - } else if (_parse_token(ctx, SL_PP_DECREMENT, ps) == 0) { - op = OPERATOR_DECREMENT; - } else if (_parse_token(ctx, SL_PP_SUBASSIGN, ps) == 0) { - op = OPERATOR_SUBASSIGN; - } else if (_parse_token(ctx, SL_PP_MINUS, ps) == 0) { - op = OPERATOR_MINUS; - } else if (_parse_token(ctx, SL_PP_NOT, ps) == 0) { - op = OPERATOR_NOT; - } else if (_parse_token(ctx, SL_PP_MULASSIGN, ps) == 0) { - op = OPERATOR_MULASSIGN; - } else if (_parse_token(ctx, SL_PP_STAR, ps) == 0) { - op = OPERATOR_MULTIPLY; - } else if (_parse_token(ctx, SL_PP_DIVASSIGN, ps) == 0) { - op = OPERATOR_DIVASSIGN; - } else if (_parse_token(ctx, SL_PP_SLASH, ps) == 0) { - op = OPERATOR_DIVIDE; - } else if (_parse_token(ctx, SL_PP_LESSEQUAL, ps) == 0) { - op = OPERATOR_LESSEQUAL; - } else if (_parse_token(ctx, SL_PP_LESS, ps) == 0) { - op = OPERATOR_LESS; - } else if (_parse_token(ctx, SL_PP_GREATEREQUAL, ps) == 0) { - op = OPERATOR_GREATEREQUAL; - } else if (_parse_token(ctx, SL_PP_GREATER, ps) == 0) { - op = OPERATOR_GREATER; - } else if (_parse_token(ctx, SL_PP_XOR, ps) == 0) { - op = OPERATOR_LOGICALXOR; - } else { - return -1; - } - - _emit(ctx, &ps->out, op); - return 0; -} - - -static int -_parse_function_decl_identifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, 0); - - if (ctx->parsing_builtin && _parse_id(ctx, ctx->dict.__constructor, &p) == 0) { - _update(ctx, e, FUNCTION_CONSTRUCTOR); - *ps = p; - return 0; - } - - if (ctx->parsing_builtin && _parse_id(ctx, ctx->dict.__operator, &p) == 0) { - _update(ctx, e, FUNCTION_OPERATOR); - if (_parse_overriden_operator(ctx, &p) == 0) { - *ps = p; - return 0; - } - return -1; - } - - if (_parse_identifier(ctx, &p) == 0) { - _update(ctx, e, FUNCTION_ORDINARY); - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_invariant_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_id(ctx, ctx->dict.invariant, ps)) { - return -1; - } - _emit(ctx, &ps->out, TYPE_INVARIANT); - return 0; -} - - -static int -_parse_centroid_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_id(ctx, ctx->dict.centroid, ps)) { - return -1; - } - _emit(ctx, &ps->out, TYPE_CENTROID); - return 0; -} - - -static int -_parse_layout_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_id(ctx, ctx->dict.layout, ps) == 0) { - if (!ctx->fragment_coord_conventions) { - _error(ctx, "GL_ARB_fragment_coord_conventions extension must be enabled " - "in order to use a layout qualifier"); - return -1; - } - - /* Layout qualifiers are only defined for fragment shaders, - * so do an early check. - */ - if (ctx->shader_type != 1) { - _error(ctx, "layout qualifiers are only valid for fragment shaders"); - return -1; - } - - /* start of a parenthesised list of layout qualifiers */ - - if (_parse_token(ctx, SL_PP_LPAREN, ps)) { - _error(ctx, "expected `('"); - return -1; - } - - /* parse comma-separated ID list */ - while (1) { - if (_parse_id(ctx, ctx->dict.origin_upper_left, ps) == 0) { - _emit(ctx, &ps->out, LAYOUT_QUALIFIER_UPPER_LEFT); - } - else if (_parse_id(ctx, ctx->dict.pixel_center_integer, ps) == 0) { - _emit(ctx, &ps->out, LAYOUT_QUALIFIER_PIXEL_CENTER_INTEGER); - } - else { - _error(ctx, "expected a layout qualifier name"); - return -1; - } - - if (_parse_token(ctx, SL_PP_RPAREN, ps) == 0) { - /* all done */ - break; - } - else if (_parse_token(ctx, SL_PP_COMMA, ps) == 0) { - /* another layout qualifier is coming */ - } - else { - _error(ctx, "expected `,' or `)'"); - return -1; - } - } - } - - return 0; -} - - -static int -_parse_storage_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - const struct sl_pp_token_info *input = _fetch_token(ctx, p.in); - unsigned int e = _emit(ctx, &p.out, 0); - int id; - - if (!input || input->token != SL_PP_IDENTIFIER) { - return -1; - } - id = input->data.identifier; - - if (id == ctx->dict._const) { - _update(ctx, e, TYPE_QUALIFIER_CONST); - } else if (ctx->shader_type == 2 && id == ctx->dict.attribute) { - _update(ctx, e, TYPE_QUALIFIER_ATTRIBUTE); - } else if (id == ctx->dict.varying) { - _update(ctx, e, TYPE_QUALIFIER_VARYING); - } else if (id == ctx->dict.uniform) { - _update(ctx, e, TYPE_QUALIFIER_UNIFORM); - } else if (ctx->parsing_builtin && id == ctx->dict.__fixed_output) { - _update(ctx, e, TYPE_QUALIFIER_FIXEDOUTPUT); - } else if (ctx->parsing_builtin && id == ctx->dict.__fixed_input) { - _update(ctx, e, TYPE_QUALIFIER_FIXEDINPUT); - } else { - return -1; - } - _parse_token(ctx, SL_PP_IDENTIFIER, &p); - *ps = p; - return 0; -} - - -static int -_parse_struct_declarator(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_identifier(ctx, &p)) { - return -1; - } - e = _emit(ctx, &p.out, FIELD_NONE); - *ps = p; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return 0; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - _update(ctx, e, FIELD_ARRAY); - *ps = p; - return 0; -} - - -static int -_parse_struct_declarator_list(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_struct_declarator(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - _emit(ctx, &p.out, FIELD_NEXT); - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_struct_declarator(ctx, &p)) { - return 0; - } - } -} - - -static int -_parse_struct_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_type_specifier(ctx, &p)) { - return -1; - } - if (_parse_struct_declarator_list(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - _emit(ctx, &p.out, FIELD_NONE); - *ps = p; - return 0; -} - - -static int -_parse_struct_declaration_list(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_struct_declaration(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - _emit(ctx, &p.out, FIELD_NEXT); - if (_parse_struct_declaration(ctx, &p)) { - return 0; - } - } -} - - -static int -_parse_struct_specifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict._struct, &p)) { - return -1; - } - if (_parse_identifier(ctx, &p)) { - _emit(ctx, &p.out, '\0'); - } - if (_parse_token(ctx, SL_PP_LBRACE, &p)) { - _error(ctx, "expected `{'"); - return -1; - } - if (_parse_struct_declaration_list(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, FIELD_NONE); - *ps = p; - return 0; -} - - -static int -_parse_type_specifier_nonarray(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, 0); - const struct sl_pp_token_info *input; - int id; - - if (_parse_struct_specifier(ctx, &p) == 0) { - _update(ctx, e, TYPE_SPECIFIER_STRUCT); - *ps = p; - return 0; - } - - input = _fetch_token(ctx, p.in); - if (!input || input->token != SL_PP_IDENTIFIER) { - return -1; - } - id = input->data.identifier; - - if (id == ctx->dict._void) { - _update(ctx, e, TYPE_SPECIFIER_VOID); - } else if (id == ctx->dict._float) { - _update(ctx, e, TYPE_SPECIFIER_FLOAT); - } else if (id == ctx->dict._int) { - _update(ctx, e, TYPE_SPECIFIER_INT); - } else if (id == ctx->dict._bool) { - _update(ctx, e, TYPE_SPECIFIER_BOOL); - } else if (id == ctx->dict.vec2) { - _update(ctx, e, TYPE_SPECIFIER_VEC2); - } else if (id == ctx->dict.vec3) { - _update(ctx, e, TYPE_SPECIFIER_VEC3); - } else if (id == ctx->dict.vec4) { - _update(ctx, e, TYPE_SPECIFIER_VEC4); - } else if (id == ctx->dict.bvec2) { - _update(ctx, e, TYPE_SPECIFIER_BVEC2); - } else if (id == ctx->dict.bvec3) { - _update(ctx, e, TYPE_SPECIFIER_BVEC3); - } else if (id == ctx->dict.bvec4) { - _update(ctx, e, TYPE_SPECIFIER_BVEC4); - } else if (id == ctx->dict.ivec2) { - _update(ctx, e, TYPE_SPECIFIER_IVEC2); - } else if (id == ctx->dict.ivec3) { - _update(ctx, e, TYPE_SPECIFIER_IVEC3); - } else if (id == ctx->dict.ivec4) { - _update(ctx, e, TYPE_SPECIFIER_IVEC4); - } else if (id == ctx->dict.mat2) { - _update(ctx, e, TYPE_SPECIFIER_MAT2); - } else if (id == ctx->dict.mat3) { - _update(ctx, e, TYPE_SPECIFIER_MAT3); - } else if (id == ctx->dict.mat4) { - _update(ctx, e, TYPE_SPECIFIER_MAT4); - } else if (id == ctx->dict.mat2x3) { - _update(ctx, e, TYPE_SPECIFIER_MAT23); - } else if (id == ctx->dict.mat3x2) { - _update(ctx, e, TYPE_SPECIFIER_MAT32); - } else if (id == ctx->dict.mat2x4) { - _update(ctx, e, TYPE_SPECIFIER_MAT24); - } else if (id == ctx->dict.mat4x2) { - _update(ctx, e, TYPE_SPECIFIER_MAT42); - } else if (id == ctx->dict.mat3x4) { - _update(ctx, e, TYPE_SPECIFIER_MAT34); - } else if (id == ctx->dict.mat4x3) { - _update(ctx, e, TYPE_SPECIFIER_MAT43); - } else if (id == ctx->dict.sampler1D) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER1D); - } else if (id == ctx->dict.sampler2D) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER2D); - } else if (id == ctx->dict.sampler3D) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER3D); - } else if (id == ctx->dict.samplerCube) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLERCUBE); - } else if (id == ctx->dict.sampler1DShadow) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER1DSHADOW); - } else if (id == ctx->dict.sampler2DShadow) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER2DSHADOW); - } else if (id == ctx->dict.sampler2DRect) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER2DRECT); - } else if (id == ctx->dict.sampler2DRectShadow) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER2DRECTSHADOW); - } else if (id == ctx->dict.sampler1DArray) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER_1D_ARRAY); - } else if (id == ctx->dict.sampler2DArray) { - /* XXX check for GL_EXT_texture_array */ - _update(ctx, e, TYPE_SPECIFIER_SAMPLER_2D_ARRAY); - } else if (id == ctx->dict.sampler1DArrayShadow) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW); - } else if (id == ctx->dict.sampler2DArrayShadow) { - _update(ctx, e, TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW); - } else if (_parse_identifier(ctx, &p) == 0) { - _update(ctx, e, TYPE_SPECIFIER_TYPENAME); - *ps = p; - return 0; - } else { - return -1; - } - - _parse_token(ctx, SL_PP_IDENTIFIER, &p); - *ps = p; - return 0; -} - - -static int -_parse_type_specifier_array(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return -1; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_type_specifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_type_specifier_nonarray(ctx, &p)) { - return -1; - } - - e = _emit(ctx, &p.out, TYPE_SPECIFIER_ARRAY); - if (_parse_type_specifier_array(ctx, &p)) { - _update(ctx, e, TYPE_SPECIFIER_NONARRAY); - } - *ps = p; - return 0; -} - - -static int -_parse_fully_specified_type(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_layout_qualifier(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, LAYOUT_QUALIFIER_NONE); - - if (_parse_invariant_qualifier(ctx, &p)) { - _emit(ctx, &p.out, TYPE_VARIANT); - } - - if (_parse_centroid_qualifier(ctx, &p)) { - _emit(ctx, &p.out, TYPE_CENTER); - } - if (_parse_storage_qualifier(ctx, &p)) { - _emit(ctx, &p.out, TYPE_QUALIFIER_NONE); - } - if (_parse_precision(ctx, &p)) { - _emit(ctx, &p.out, PRECISION_DEFAULT); - } - if (_parse_type_specifier(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_function_header(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_fully_specified_type(ctx, &p)) { - return -1; - } - if (_parse_function_decl_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_parameter_qualifier(struct parse_context *ctx, - struct parse_state *ps) -{ - unsigned int e = _emit(ctx, &ps->out, PARAM_QUALIFIER_IN); - - if (_parse_id(ctx, ctx->dict.out, ps) == 0) { - _update(ctx, e, PARAM_QUALIFIER_OUT); - } else if (_parse_id(ctx, ctx->dict.inout, ps) == 0) { - _update(ctx, e, PARAM_QUALIFIER_INOUT); - } else { - _parse_id(ctx, ctx->dict.in, ps); - } - return 0; -} - - -static int -_parse_function_identifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - unsigned int e; - - if (_parse_identifier(ctx, ps)) { - return -1; - } - e = _emit(ctx, &ps->out, FUNCTION_CALL_NONARRAY); - - p = *ps; - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return 0; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - _update(ctx, e, FUNCTION_CALL_ARRAY); - *ps = p; - return 0; -} - - -static int -_parse_function_call_header(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_assign_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int op; - - if (_parse_unary_expression(ctx, &p)) { - return -1; - } - - if (_parse_token(ctx, SL_PP_ASSIGN, &p) == 0) { - op = OP_ASSIGN; - } else if (_parse_token(ctx, SL_PP_MULASSIGN, &p) == 0) { - op = OP_MULASSIGN; - } else if (_parse_token(ctx, SL_PP_DIVASSIGN, &p) == 0) { - op = OP_DIVASSIGN; - } else if (_parse_token(ctx, SL_PP_ADDASSIGN, &p) == 0) { - op = OP_ADDASSIGN; - } else if (_parse_token(ctx, SL_PP_SUBASSIGN, &p) == 0) { - op = OP_SUBASSIGN; - } else { - return -1; - } - - if (_parse_assignment_expression(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, op); - - *ps = p; - return 0; -} - - -static int -_parse_assignment_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_assign_expression(ctx, ps) == 0) { - return 0; - } - - if (_parse_conditional_expression(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_function_call_header_with_parameters(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_call_header(ctx, &p)) { - return -1; - } - if (_parse_assignment_expression(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_assignment_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_END); - } -} - - -static int -_parse_function_call_header_no_parameters(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_function_call_header(ctx, ps)) { - return -1; - } - _parse_id(ctx, ctx->dict._void, ps); - return 0; -} - - -static int -_parse_function_call_generic(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_call_header_with_parameters(ctx, &p) == 0) { - if (_parse_token(ctx, SL_PP_RPAREN, &p) == 0) { - *ps = p; - return 0; - } - _error(ctx, "expected `)'"); - return -1; - } - - p = *ps; - if (_parse_function_call_header_no_parameters(ctx, &p) == 0) { - if (_parse_token(ctx, SL_PP_RPAREN, &p) == 0) { - *ps = p; - return 0; - } - _error(ctx, "expected `)'"); - return -1; - } - - return -1; -} - - -static int -_parse_method_call(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_METHOD); - if (_parse_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_DOT, &p)) { - return -1; - } - if (_parse_function_call_generic(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_regular_function_call(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_CALL); - if (_parse_function_call_generic(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_function_call(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_regular_function_call(ctx, ps) == 0) { - return 0; - } - - if (_parse_method_call(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_assignment_expression(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_assignment_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_SEQUENCE); - } -} - - -static int -_parse_postfix_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - - if (_parse_function_call(ctx, ps)) { - if (_parse_primary_expression(ctx, ps)) { - return -1; - } - } - - for (p = *ps;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_INCREMENT, &p) == 0) { - _emit(ctx, &p.out, OP_POSTINCREMENT); - } else if (_parse_token(ctx, SL_PP_DECREMENT, &p) == 0) { - _emit(ctx, &p.out, OP_POSTDECREMENT); - } else if (_parse_token(ctx, SL_PP_LBRACKET, &p) == 0) { - if (_parse_expression(ctx, &p)) { - _error(ctx, "expected an integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - _emit(ctx, &p.out, OP_SUBSCRIPT); - } else if (_parse_token(ctx, SL_PP_DOT, &p) == 0) { - _emit(ctx, &p.out, OP_FIELD); - if (_parse_identifier(ctx, &p)) { - return 0; - } - } else { - return 0; - } - } -} - - -static int -_parse_unary_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - unsigned int op; - - if (_parse_postfix_expression(ctx, ps) == 0) { - return 0; - } - - p = *ps; - if (_parse_token(ctx, SL_PP_INCREMENT, &p) == 0) { - op = OP_PREINCREMENT; - } else if (_parse_token(ctx, SL_PP_DECREMENT, &p) == 0) { - op = OP_PREDECREMENT; - } else if (_parse_token(ctx, SL_PP_PLUS, &p) == 0) { - op = OP_PLUS; - } else if (_parse_token(ctx, SL_PP_MINUS, &p) == 0) { - op = OP_MINUS; - } else if (_parse_token(ctx, SL_PP_NOT, &p) == 0) { - op = OP_NOT; - } else { - return -1; - } - - if (_parse_unary_expression(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, op); - *ps = p; - return 0; -} - - -static int -_parse_multiplicative_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_unary_expression(ctx, &p)) { - return -1; - } - for (;;) { - unsigned int op; - - *ps = p; - if (_parse_token(ctx, SL_PP_STAR, &p) == 0) { - op = OP_MULTIPLY; - } else if (_parse_token(ctx, SL_PP_SLASH, &p) == 0) { - op = OP_DIVIDE; - } else { - return 0; - } - if (_parse_unary_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, op); - } -} - - -static int -_parse_additive_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_multiplicative_expression(ctx, &p)) { - return -1; - } - for (;;) { - unsigned int op; - - *ps = p; - if (_parse_token(ctx, SL_PP_PLUS, &p) == 0) { - op = OP_ADD; - } else if (_parse_token(ctx, SL_PP_MINUS, &p) == 0) { - op = OP_SUBTRACT; - } else { - return 0; - } - if (_parse_multiplicative_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, op); - } -} - - -static int -_parse_relational_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_additive_expression(ctx, &p)) { - return -1; - } - for (;;) { - unsigned int op; - - *ps = p; - if (_parse_token(ctx, SL_PP_LESS, &p) == 0) { - op = OP_LESS; - } else if (_parse_token(ctx, SL_PP_GREATER, &p) == 0) { - op = OP_GREATER; - } else if (_parse_token(ctx, SL_PP_LESSEQUAL, &p) == 0) { - op = OP_LESSEQUAL; - } else if (_parse_token(ctx, SL_PP_GREATEREQUAL, &p) == 0) { - op = OP_GREATEREQUAL; - } else { - return 0; - } - if (_parse_additive_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, op); - } -} - - -static int -_parse_equality_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_relational_expression(ctx, &p)) { - return -1; - } - for (;;) { - unsigned int op; - - *ps = p; - if (_parse_token(ctx, SL_PP_EQUAL, &p) == 0) { - op = OP_EQUAL; - } else if (_parse_token(ctx, SL_PP_NOTEQUAL, &p) == 0) { - op = OP_NOTEQUAL; - } else { - return 0; - } - if (_parse_relational_expression(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, op); - } -} - - -static int -_parse_logical_and_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_equality_expression(ctx, &p)) { - return -1; - } - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_AND, &p)) { - return 0; - } - if (_parse_equality_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_LOGICALAND); - } -} - - -static int -_parse_logical_xor_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_logical_and_expression(ctx, &p)) { - return -1; - } - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_XOR, &p)) { - return 0; - } - if (_parse_logical_and_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_LOGICALXOR); - } -} - - -static int -_parse_logical_or_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_logical_xor_expression(ctx, &p)) { - return -1; - } - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_OR, &p)) { - return 0; - } - if (_parse_logical_xor_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_LOGICALOR); - } -} - - -static int -_parse_conditional_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_logical_or_expression(ctx, &p)) { - return -1; - } - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_QUESTION, &p)) { - return 0; - } - if (_parse_expression(ctx, &p)) { - return 0; - } - if (_parse_token(ctx, SL_PP_COLON, &p)) { - return 0; - } - if (_parse_conditional_expression(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_SELECT); - } -} - - -static int -_parse_constant_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_conditional_expression(ctx, ps)) { - return -1; - } - _emit(ctx, &ps->out, OP_END); - return 0; -} - - -static int -_parse_parameter_declarator_array(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return -1; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_parameter_declarator(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_type_specifier(ctx, &p)) { - return -1; - } - if (_parse_identifier(ctx, &p)) { - return -1; - } - e = _emit(ctx, &p.out, PARAMETER_ARRAY_PRESENT); - if (_parse_parameter_declarator_array(ctx, &p)) { - _update(ctx, e, PARAMETER_ARRAY_NOT_PRESENT); - } - *ps = p; - return 0; -} - - -static int -_parse_parameter_type_specifier_array(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p)) { - return -1; - } - if (_parse_constant_expression(ctx, &p)) { - _error(ctx, "expected constant integral expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p)) { - _error(ctx, "expected `]'"); - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_parameter_type_specifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_type_specifier(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, '\0'); - - e = _emit(ctx, &p.out, PARAMETER_ARRAY_PRESENT); - if (_parse_parameter_type_specifier_array(ctx, &p)) { - _update(ctx, e, PARAMETER_ARRAY_NOT_PRESENT); - } - *ps = p; - return 0; -} - - -static int -_parse_parameter_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, PARAMETER_NEXT); - - (void) e; - - if (_parse_storage_qualifier(ctx, &p)) { - _emit(ctx, &p.out, TYPE_QUALIFIER_NONE); - } - _parse_parameter_qualifier(ctx, &p); - if (_parse_precision(ctx, &p)) { - _emit(ctx, &p.out, PRECISION_DEFAULT); - } - if (_parse_parameter_declarator(ctx, &p) == 0) { - *ps = p; - return 0; - } - if (_parse_parameter_type_specifier(ctx, &p) == 0) { - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_function_header_with_parameters(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_header(ctx, &p)) { - return -1; - } - if (_parse_parameter_declaration(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_parameter_declaration(ctx, &p)) { - return 0; - } - } -} - - -static int -_parse_function_declarator(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_function_header_with_parameters(ctx, ps) == 0) { - return 0; - } - - if (_parse_function_header(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_function_prototype(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_header(ctx, &p) == 0) { - if (_parse_id(ctx, ctx->dict._void, &p) == 0) { - if (_parse_token(ctx, SL_PP_RPAREN, &p) == 0) { - _emit(ctx, &p.out, PARAMETER_NONE); - *ps = p; - return 0; - } - _error(ctx, "expected `)'"); - return -1; - } - } - - p = *ps; - if (_parse_function_declarator(ctx, &p) == 0) { - if (_parse_token(ctx, SL_PP_RPAREN, &p) == 0) { - _emit(ctx, &p.out, PARAMETER_NONE); - *ps = p; - return 0; - } - _error(ctx, "expected `)'"); - return -1; - } - - return -1; -} - - -static int -_parse_precision(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - int id; - unsigned int precision; - - if (!input || input->token != SL_PP_IDENTIFIER) { - return -1; - } - id = input->data.identifier; - - if (id == ctx->dict.lowp) { - precision = PRECISION_LOW; - } else if (id == ctx->dict.mediump) { - precision = PRECISION_MEDIUM; - } else if (id == ctx->dict.highp) { - precision = PRECISION_HIGH; - } else { - return -1; - } - - _parse_token(ctx, SL_PP_IDENTIFIER, ps); - _emit(ctx, &ps->out, precision); - return 0; -} - - -static int -_parse_prectype(struct parse_context *ctx, - struct parse_state *ps) -{ - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - int id; - unsigned int type; - - if (!input || input->token != SL_PP_IDENTIFIER) { - return -1; - } - id = input->data.identifier; - - if (id == ctx->dict._int) { - type = TYPE_SPECIFIER_INT; - } else if (id == ctx->dict._float) { - type = TYPE_SPECIFIER_FLOAT; - } else if (id == ctx->dict.sampler1D) { - type = TYPE_SPECIFIER_SAMPLER1D; - } else if (id == ctx->dict.sampler2D) { - type = TYPE_SPECIFIER_SAMPLER2D; - } else if (id == ctx->dict.sampler3D) { - type = TYPE_SPECIFIER_SAMPLER3D; - } else if (id == ctx->dict.samplerCube) { - type = TYPE_SPECIFIER_SAMPLERCUBE; - } else if (id == ctx->dict.sampler1DShadow) { - type = TYPE_SPECIFIER_SAMPLER1DSHADOW; - } else if (id == ctx->dict.sampler2DShadow) { - type = TYPE_SPECIFIER_SAMPLER2DSHADOW; - } else if (id == ctx->dict.sampler2DRect) { - type = TYPE_SPECIFIER_SAMPLER2DRECT; - } else if (id == ctx->dict.sampler2DRectShadow) { - type = TYPE_SPECIFIER_SAMPLER2DRECTSHADOW; - } else if (id == ctx->dict.sampler1DArray) { - type = TYPE_SPECIFIER_SAMPLER_1D_ARRAY; - } else if (id == ctx->dict.sampler2DArray) { - type = TYPE_SPECIFIER_SAMPLER_2D_ARRAY; - } else if (id == ctx->dict.sampler1DArrayShadow) { - type = TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW; - } else if (id == ctx->dict.sampler2DArrayShadow) { - type = TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW; - } else { - return -1; - } - - _parse_token(ctx, SL_PP_IDENTIFIER, ps); - _emit(ctx, &ps->out, type); - return 0; -} - - -static int -_parse_precision_stmt(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict.precision, &p)) { - return -1; - } - if (_parse_precision(ctx, &p)) { - return -1; - } - if (_parse_prectype(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_floatconstant(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_PUSH_FLOAT); - if (_parse_float(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_intconstant(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_PUSH_INT); - if (_parse_uint(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_boolconstant(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_id(ctx, ctx->dict._false, ps) == 0) { - _emit(ctx, &ps->out, OP_PUSH_BOOL); - _emit(ctx, &ps->out, 2); /* radix */ - _emit(ctx, &ps->out, '0'); - _emit(ctx, &ps->out, '\0'); - return 0; - } - - if (_parse_id(ctx, ctx->dict._true, ps) == 0) { - _emit(ctx, &ps->out, OP_PUSH_BOOL); - _emit(ctx, &ps->out, 2); /* radix */ - _emit(ctx, &ps->out, '1'); - _emit(ctx, &ps->out, '\0'); - return 0; - } - - return -1; -} - - -static int -_parse_variable_identifier(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_PUSH_IDENTIFIER); - if (_parse_identifier(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_primary_expression(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - - if (_parse_floatconstant(ctx, ps) == 0) { - return 0; - } - if (_parse_boolconstant(ctx, ps) == 0) { - return 0; - } - if (_parse_intconstant(ctx, ps) == 0) { - return 0; - } - if (_parse_variable_identifier(ctx, ps) == 0) { - return 0; - } - - p = *ps; - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - return -1; - } - if (_parse_expression(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - return -1; - } - - *ps = p; - return 0; -} - - -static int -_parse_asm_argument(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_variable_identifier(ctx, ps) == 0) { - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_DOT, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_FIELD); - if (_parse_identifier(ctx, &p)) { - return 0; - } - *ps = p; - return 0; - } - - if (_parse_floatconstant(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_asm_arguments(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_asm_argument(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - - for (;;) { - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - return 0; - } - if (_parse_asm_argument(ctx, &p)) { - return 0; - } - _emit(ctx, &p.out, OP_END); - } -} - - -static int -_parse_asm_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict.___asm, &p)) { - return -1; - } - if (_parse_identifier(ctx, &p)) { - return -1; - } - if (_parse_asm_arguments(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_selection_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_IF); - if (_parse_id(ctx, ctx->dict._if, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - _error(ctx, "expected `('"); - return -1; - } - if (_parse_expression(ctx, &p)) { - _error(ctx, "expected an expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - _error(ctx, "expected `)'"); - return -1; - } - _emit(ctx, &p.out, OP_END); - if (_parse_statement(ctx, &p)) { - return -1; - } - - *ps = p; - if (_parse_id(ctx, ctx->dict._else, &p) == 0) { - if (_parse_statement(ctx, &p) == 0) { - *ps = p; - return 0; - } - } - - _emit(ctx, &ps->out, OP_EXPRESSION); - _emit(ctx, &ps->out, OP_PUSH_VOID); - _emit(ctx, &ps->out, OP_END); - return 0; -} - - -static int -_parse_expression_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_expression(ctx, &p)) { - _emit(ctx, &p.out, OP_PUSH_VOID); - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_for_init_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, OP_EXPRESSION); - - if (_parse_expression_statement(ctx, &p) == 0) { - *ps = p; - return 0; - } - - if (_parse_declaration(ctx, &p) == 0) { - _update(ctx, e, OP_DECLARE); - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_initializer(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_assignment_expression(ctx, ps) == 0) { - _emit(ctx, &ps->out, OP_END); - return 0; - } - return -1; -} - - -static int -_parse_condition_initializer(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - _emit(ctx, &p.out, OP_DECLARE); - _emit(ctx, &p.out, DECLARATION_INIT_DECLARATOR_LIST); - if (_parse_fully_specified_type(ctx, &p)) { - return -1; - } - _emit(ctx, &p.out, VARIABLE_IDENTIFIER); - if (_parse_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_ASSIGN, &p)) { - _error(ctx, "expected `='"); - return -1; - } - _emit(ctx, &p.out, VARIABLE_INITIALIZER); - if (_parse_initializer(ctx, &p)) { - _error(ctx, "expected an initialiser"); - return -1; - } - _emit(ctx, &p.out, DECLARATOR_NONE); - *ps = p; - return 0; -} - - -static int -_parse_condition(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - - if (_parse_condition_initializer(ctx, ps) == 0) { - return 0; - } - - p = *ps; - _emit(ctx, &p.out, OP_EXPRESSION); - if (_parse_expression(ctx, &p) == 0) { - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_for_rest_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_condition(ctx, &p)) { - _emit(ctx, &p.out, OP_EXPRESSION); - _emit(ctx, &p.out, OP_PUSH_BOOL); - _emit(ctx, &p.out, 2); - _emit(ctx, &p.out, '1'); - _emit(ctx, &p.out, '\0'); - _emit(ctx, &p.out, OP_END); - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - if (_parse_expression(ctx, &p)) { - _emit(ctx, &p.out, OP_PUSH_VOID); - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_iteration_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict._while, &p) == 0) { - _emit(ctx, &p.out, OP_WHILE); - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - _error(ctx, "expected `('"); - return -1; - } - if (_parse_condition(ctx, &p)) { - _error(ctx, "expected an expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - _error(ctx, "expected `)'"); - return -1; - } - if (_parse_statement(ctx, &p)) { - return -1; - } - *ps = p; - return 0; - } - - if (_parse_id(ctx, ctx->dict._do, &p) == 0) { - _emit(ctx, &p.out, OP_DO); - if (_parse_statement(ctx, &p)) { - return -1; - } - if (_parse_id(ctx, ctx->dict._while, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - _error(ctx, "expected `('"); - return -1; - } - if (_parse_expression(ctx, &p)) { - _error(ctx, "expected an expression"); - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - _error(ctx, "expected `)'"); - return -1; - } - _emit(ctx, &p.out, OP_END); - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - _error(ctx, "expected `;'"); - return -1; - } - *ps = p; - return 0; - } - - if (_parse_id(ctx, ctx->dict._for, &p) == 0) { - _emit(ctx, &p.out, OP_FOR); - if (_parse_token(ctx, SL_PP_LPAREN, &p)) { - _error(ctx, "expected `('"); - return -1; - } - if (_parse_for_init_statement(ctx, &p)) { - return -1; - } - if (_parse_for_rest_statement(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_RPAREN, &p)) { - _error(ctx, "expected `)'"); - return -1; - } - if (_parse_statement(ctx, &p)) { - return -1; - } - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_jump_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, 0); - - if (_parse_id(ctx, ctx->dict._continue, &p) == 0) { - _update(ctx, e, OP_CONTINUE); - } else if (_parse_id(ctx, ctx->dict._break, &p) == 0) { - _update(ctx, e, OP_BREAK); - } else if (_parse_id(ctx, ctx->dict._return, &p) == 0) { - _update(ctx, e, OP_RETURN); - if (_parse_expression(ctx, &p)) { - _emit(ctx, &p.out, OP_PUSH_VOID); - } - _emit(ctx, &p.out, OP_END); - } else if (ctx->shader_type == 1 && _parse_id(ctx, ctx->dict.discard, &p) == 0) { - _update(ctx, e, OP_DISCARD); - } else { - return -1; - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_simple_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p; - unsigned int e; - - if (_parse_selection_statement(ctx, ps) == 0) { - return 0; - } - - if (_parse_iteration_statement(ctx, ps) == 0) { - return 0; - } - - if (_parse_jump_statement(ctx, ps) == 0) { - return 0; - } - - p = *ps; - e = _emit(ctx, &p.out, OP_EXPRESSION); - if (_parse_expression_statement(ctx, &p) == 0) { - *ps = p; - return 0; - } - - if (_parse_precision_stmt(ctx, &p) == 0) { - _update(ctx, e, OP_PRECISION); - *ps = p; - return 0; - } - - if (ctx->parsing_builtin && _parse_asm_statement(ctx, &p) == 0) { - _update(ctx, e, OP_ASM); - *ps = p; - return 0; - } - - if (_parse_declaration(ctx, &p) == 0) { - _update(ctx, e, OP_DECLARE); - *ps = p; - return 0; - } - - return -1; -} - - -static int -_parse_compound_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_BLOCK_BEGIN_NEW_SCOPE); - _parse_statement_list(ctx, &p); - if (_parse_token(ctx, SL_PP_RBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_statement(struct parse_context *ctx, - struct parse_state *ps) -{ - if (_parse_compound_statement(ctx, ps) == 0) { - return 0; - } - - if (_parse_simple_statement(ctx, ps) == 0) { - return 0; - } - - return -1; -} - - -static int -_parse_statement_list(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_statement(ctx, &p)) { - return -1; - } - - for (;;) { - *ps = p; - if (_parse_statement(ctx, &p)) { - return 0; - } - } -} - - -static int -_parse_compound_statement_no_new_scope(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_BLOCK_BEGIN_NO_NEW_SCOPE); - _parse_statement_list(ctx, &p); - if (_parse_token(ctx, SL_PP_RBRACE, &p)) { - return -1; - } - _emit(ctx, &p.out, OP_END); - *ps = p; - return 0; -} - - -static int -_parse_function_definition(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_function_prototype(ctx, &p)) { - return -1; - } - if (_parse_compound_statement_no_new_scope(ctx, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_invariant_stmt(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_id(ctx, ctx->dict.invariant, &p)) { - return -1; - } - if (_parse_identifier(ctx, &p)) { - return -1; - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_single_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e; - - if (_parse_fully_specified_type(ctx, &p)) { - return -1; - } - - e = _emit(ctx, &p.out, VARIABLE_IDENTIFIER); - if (_parse_identifier(ctx, &p)) { - _update(ctx, e, VARIABLE_NONE); - *ps = p; - return 0; - } - - e = _emit(ctx, &p.out, VARIABLE_NONE); - *ps = p; - - if (_parse_token(ctx, SL_PP_ASSIGN, &p) == 0) { - _update(ctx, e, VARIABLE_INITIALIZER); - if (_parse_initializer(ctx, &p) == 0) { - *ps = p; - return 0; - } - _error(ctx, "expected an initialiser"); - return -1; - } - p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p) == 0) { - if (_parse_constant_expression(ctx, &p)) { - _update(ctx, e, VARIABLE_ARRAY_UNKNOWN); - } else { - _update(ctx, e, VARIABLE_ARRAY_EXPLICIT); - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p) == 0) { - *ps = p; - return 0; - } - _error(ctx, "expected `]'"); - return -1; - } - return 0; -} - - -static int -_parse_init_declarator_list(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - - if (_parse_single_declaration(ctx, &p)) { - return -1; - } - - for (;;) { - unsigned int e; - - *ps = p; - if (_parse_token(ctx, SL_PP_COMMA, &p)) { - break; - } - _emit(ctx, &p.out, DECLARATOR_NEXT); - _emit(ctx, &p.out, VARIABLE_IDENTIFIER); - if (_parse_identifier(ctx, &p)) { - break; - } - - e = _emit(ctx, &p.out, VARIABLE_NONE); - *ps = p; - - if (_parse_token(ctx, SL_PP_ASSIGN, &p) == 0) { - if (_parse_initializer(ctx, &p) == 0) { - _update(ctx, e, VARIABLE_INITIALIZER); - *ps = p; - continue; - } - _error(ctx, "expected an initialiser"); - break; - } - p = *ps; - - if (_parse_token(ctx, SL_PP_LBRACKET, &p) == 0) { - unsigned int arr; - - if (_parse_constant_expression(ctx, &p)) { - arr = VARIABLE_ARRAY_UNKNOWN; - } else { - arr = VARIABLE_ARRAY_EXPLICIT; - } - if (_parse_token(ctx, SL_PP_RBRACKET, &p) == 0) { - _update(ctx, e, arr); - *ps = p; - continue; - } - _error(ctx, "expected `]'"); - break; - } - p = *ps; - } - - _emit(ctx, &ps->out, DECLARATOR_NONE); - return 0; -} - - -static int -_parse_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, DECLARATION_FUNCTION_PROTOTYPE); - - if (_parse_function_prototype(ctx, &p)) { - if (_parse_init_declarator_list(ctx, &p)) { - return -1; - } - _update(ctx, e, DECLARATION_INIT_DECLARATOR_LIST); - } - if (_parse_token(ctx, SL_PP_SEMICOLON, &p)) { - _error(ctx, "expected `;'"); - return -1; - } - *ps = p; - return 0; -} - - -static int -_parse_external_declaration(struct parse_context *ctx, - struct parse_state *ps) -{ - struct parse_state p = *ps; - unsigned int e = _emit(ctx, &p.out, 0); - - if (_parse_precision_stmt(ctx, &p) == 0) { - _update(ctx, e, DEFAULT_PRECISION); - *ps = p; - return 0; - } - - if (_parse_function_definition(ctx, &p) == 0) { - _update(ctx, e, EXTERNAL_FUNCTION_DEFINITION); - *ps = p; - return 0; - } - - if (_parse_invariant_stmt(ctx, &p) == 0) { - _update(ctx, e, INVARIANT_STMT); - *ps = p; - return 0; - } - - if (_parse_declaration(ctx, &p) == 0) { - _update(ctx, e, EXTERNAL_DECLARATION); - *ps = p; - return 0; - } - - _error(ctx, "expected an identifier"); - return -1; -} - - -static int -_parse_extensions(struct parse_context *ctx, - struct parse_state *ps) -{ - for (;;) { - const struct sl_pp_token_info *input = _fetch_token(ctx, ps->in); - unsigned int enable; - - if (!input) { - return -1; - } - - switch (input->token) { - case SL_PP_EXTENSION_REQUIRE: - case SL_PP_EXTENSION_ENABLE: - case SL_PP_EXTENSION_WARN: - enable = 1; - break; - case SL_PP_EXTENSION_DISABLE: - enable = 0; - break; - default: - return 0; - } - - ps->in++; - if (input->data.extension == ctx->dict.all) { - ctx->fragment_coord_conventions = enable; - } - else if (input->data.extension == ctx->dict._GL_ARB_fragment_coord_conventions) { - ctx->fragment_coord_conventions = enable; - } - } -} - - -static int -_parse_translation_unit(struct parse_context *ctx, - struct parse_state *ps) -{ - _emit(ctx, &ps->out, REVISION); - if (_parse_extensions(ctx, ps)) { - return -1; - } - if (_parse_external_declaration(ctx, ps)) { - return -1; - } - for (;;) { - if (_parse_extensions(ctx, ps)) { - return -1; - } - if (_parse_external_declaration(ctx, ps)) { - break; - } - } - _emit(ctx, &ps->out, EXTERNAL_NULL); - if (_parse_token(ctx, SL_PP_EOF, ps)) { - return -1; - } - return 0; -} - - -#define ADD_NAME_STR(CTX, NAME, STR)\ - do {\ - (CTX).dict.NAME = sl_pp_context_add_unique_str((CTX).context, (STR));\ - if ((CTX).dict.NAME == -1) {\ - return -1;\ - }\ - } while (0) - -#define ADD_NAME(CTX, NAME) ADD_NAME_STR(CTX, NAME, #NAME) - - -int -sl_cl_compile(struct sl_pp_context *context, - unsigned int shader_type, - unsigned int parsing_builtin, - unsigned char **output, - unsigned int *cboutput, - char *error, - unsigned int cberror) -{ - struct parse_context ctx; - struct parse_state ps; - - ctx.context = context; - - ADD_NAME_STR(ctx, _void, "void"); - ADD_NAME_STR(ctx, _float, "float"); - ADD_NAME_STR(ctx, _int, "int"); - ADD_NAME_STR(ctx, _bool, "bool"); - ADD_NAME(ctx, vec2); - ADD_NAME(ctx, vec3); - ADD_NAME(ctx, vec4); - ADD_NAME(ctx, bvec2); - ADD_NAME(ctx, bvec3); - ADD_NAME(ctx, bvec4); - ADD_NAME(ctx, ivec2); - ADD_NAME(ctx, ivec3); - ADD_NAME(ctx, ivec4); - ADD_NAME(ctx, mat2); - ADD_NAME(ctx, mat3); - ADD_NAME(ctx, mat4); - ADD_NAME(ctx, mat2x3); - ADD_NAME(ctx, mat3x2); - ADD_NAME(ctx, mat2x4); - ADD_NAME(ctx, mat4x2); - ADD_NAME(ctx, mat3x4); - ADD_NAME(ctx, mat4x3); - ADD_NAME(ctx, sampler1D); - ADD_NAME(ctx, sampler2D); - ADD_NAME(ctx, sampler3D); - ADD_NAME(ctx, samplerCube); - ADD_NAME(ctx, sampler1DShadow); - ADD_NAME(ctx, sampler2DShadow); - ADD_NAME(ctx, sampler2DRect); - ADD_NAME(ctx, sampler2DRectShadow); - ADD_NAME(ctx, sampler1DArray); - ADD_NAME(ctx, sampler2DArray); - ADD_NAME(ctx, sampler1DArrayShadow); - ADD_NAME(ctx, sampler2DArrayShadow); - - ADD_NAME(ctx, invariant); - - ADD_NAME(ctx, centroid); - - ADD_NAME(ctx, precision); - ADD_NAME(ctx, lowp); - ADD_NAME(ctx, mediump); - ADD_NAME(ctx, highp); - - ADD_NAME_STR(ctx, _const, "const"); - ADD_NAME(ctx, attribute); - ADD_NAME(ctx, varying); - ADD_NAME(ctx, uniform); - ADD_NAME(ctx, __fixed_output); - ADD_NAME(ctx, __fixed_input); - - ADD_NAME(ctx, in); - ADD_NAME(ctx, out); - ADD_NAME(ctx, inout); - - ADD_NAME(ctx, layout); - ADD_NAME(ctx, origin_upper_left); - ADD_NAME(ctx, pixel_center_integer); - - ADD_NAME_STR(ctx, _struct, "struct"); - - ADD_NAME(ctx, __constructor); - ADD_NAME(ctx, __operator); - ADD_NAME_STR(ctx, ___asm, "__asm"); - - ADD_NAME_STR(ctx, _if, "if"); - ADD_NAME_STR(ctx, _else, "else"); - ADD_NAME_STR(ctx, _for, "for"); - ADD_NAME_STR(ctx, _while, "while"); - ADD_NAME_STR(ctx, _do, "do"); - - ADD_NAME_STR(ctx, _continue, "continue"); - ADD_NAME_STR(ctx, _break, "break"); - ADD_NAME_STR(ctx, _return, "return"); - ADD_NAME(ctx, discard); - - ADD_NAME_STR(ctx, _false, "false"); - ADD_NAME_STR(ctx, _true, "true"); - - ADD_NAME(ctx, all); - ADD_NAME_STR(ctx, _GL_ARB_fragment_coord_conventions, "GL_ARB_fragment_coord_conventions"); - - ctx.out_buf = NULL; - ctx.out_cap = 0; - - ctx.shader_type = shader_type; - ctx.parsing_builtin = 1; - - ctx.fragment_coord_conventions = 0; - - ctx.error[0] = '\0'; - ctx.process_error = 0; - - ctx.tokens_cap = 1024; - ctx.tokens_read = 0; - ctx.tokens = malloc(ctx.tokens_cap * sizeof(struct sl_pp_token_info)); - if (!ctx.tokens) { - strncpy(error, "out of memory", cberror - 1); - error[cberror - 1] = '\0'; - return -1; - } - - ps.in = 0; - ps.out = 0; - - if (_parse_translation_unit(&ctx, &ps)) { - strncpy(error, ctx.error, cberror); - free(ctx.tokens); - return -1; - } - - *output = ctx.out_buf; - *cboutput = ps.out; - free(ctx.tokens); - return 0; -} diff --git a/mesalib/src/glsl/cl/sl_cl_parse.h b/mesalib/src/glsl/cl/sl_cl_parse.h deleted file mode 100644 index dd5791d59..000000000 --- a/mesalib/src/glsl/cl/sl_cl_parse.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_CL_PARSE_H -#define SL_CL_PARSE_H - -int -sl_cl_compile(struct sl_pp_context *context, - unsigned int shader_type, - unsigned int parsing_builtin, - unsigned char **output, - unsigned int *cboutput, - char *error, - unsigned int cberror); - -#endif /* SL_CL_PARSE_H */ diff --git a/mesalib/src/glsl/getopt.cpp b/mesalib/src/glsl/getopt.cpp new file mode 100644 index 000000000..ea5dd3927 --- /dev/null +++ b/mesalib/src/glsl/getopt.cpp @@ -0,0 +1,552 @@ +/* $OpenBSD: getopt_long.c,v 1.20 2005/10/25 15:49:37 jmc Exp $ */ +/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ +// Adapted for Box Backup by Chris Wilson <chris+boxbackup@qwirx.com> + +/* + * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Dieter Baron and Thomas Klausner. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +// #include "Box.h" + +#include <errno.h> +#include <stdarg.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#define __STDC__ 1 + +#include "getopt.h" + +#if defined _MSC_VER || defined __MINGW32__ +#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */ + +#ifdef REPLACE_GETOPT +int opterr = 1; /* if error message should be printed */ +int optind = 1; /* index into parent argv vector */ +int optopt = '?'; /* character checked for validity */ +int optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ +#endif + +#define PRINT_ERROR ((opterr) && (*options != ':')) + +#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */ +#define FLAG_ALLARGS 0x02 /* treat non-options as args to option "-1" */ +#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */ + +/* return values */ +#define BADCH (int)'?' +#define BADARG ((*options == ':') ? (int)':' : (int)'?') +#define INORDER (int)1 + +#define EMSG "" + +static void warnx(const char* fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + } + + static int getopt_internal(int, char * const *, const char *, + const struct option *, int *, int); + static int parse_long_options(char * const *, const char *, + const struct option *, int *, int); + static int gcd(int, int); + static void permute_args(int, int, int, char * const *); + + static char *place = EMSG; /* option letter processing */ + + /* XXX: set optreset to 1 rather than these two */ + static int nonopt_start = -1; /* first non option argument (for permute) */ + static int nonopt_end = -1; /* first option after non options (for permute) */ + + /* Error messages */ + static const char recargchar[] = "option requires an argument -- %c"; + static const char recargstring[] = "option requires an argument -- %s"; + static const char ambig[] = "ambiguous option -- %.*s"; + static const char noarg[] = "option doesn't take an argument -- %.*s"; + static const char illoptchar[] = "unknown option -- %c"; + static const char illoptstring[] = "unknown option -- %s"; + + /* + * Compute the greatest common divisor of a and b. + */ + static int + gcd(int a, int b) + { + int c; + + c = a % b; + while (c != 0) { + a = b; + b = c; + c = a % b; + } + + return (b); + } + + /* + * Exchange the block from nonopt_start to nonopt_end with the block + * from nonopt_end to opt_end (keeping the same order of arguments + * in each block). + */ + static void + permute_args(int panonopt_start, int panonopt_end, int opt_end, + char * const *nargv) + { + int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos; + char *swap; + + /* + * compute lengths of blocks and number and size of cycles + */ + nnonopts = panonopt_end - panonopt_start; + nopts = opt_end - panonopt_end; + ncycle = gcd(nnonopts, nopts); + cyclelen = (opt_end - panonopt_start) / ncycle; + + for (i = 0; i < ncycle; i++) { + cstart = panonopt_end+i; + pos = cstart; + for (j = 0; j < cyclelen; j++) { + if (pos >= panonopt_end) + pos -= nnonopts; + else + pos += nopts; + swap = nargv[pos]; + /* LINTED const cast */ + ((char **) nargv)[pos] = nargv[cstart]; + /* LINTED const cast */ + ((char **)nargv)[cstart] = swap; + } + } + } + + /* + * parse_long_options -- + * Parse long options in argc/argv argument vector. + * Returns -1 if short_too is set and the option does not match long_options. + */ + static int + parse_long_options(char * const *nargv, const char *options, + const struct option *long_options, int *idx, int short_too) + { + char *current_argv, *has_equal; + size_t current_argv_len; + int i, match; + + current_argv = place; + match = -1; + + optind++; + + if ((has_equal = strchr(current_argv, '=')) != NULL) { + /* argument found (--option=arg) */ + current_argv_len = has_equal - current_argv; + has_equal++; + } else + current_argv_len = strlen(current_argv); + + for (i = 0; long_options[i].name; i++) { + /* find matching long option */ + if (strncmp(current_argv, long_options[i].name, + current_argv_len)) + continue; + + if (strlen(long_options[i].name) == current_argv_len) { + /* exact match */ + match = i; + break; + } + /* + * If this is a known short option, don't allow + * a partial match of a single character. + */ + if (short_too && current_argv_len == 1) + continue; + + if (match == -1) /* partial match */ + match = i; + else { + /* ambiguous abbreviation */ + if (PRINT_ERROR) + warnx(ambig, (int)current_argv_len, + current_argv); + optopt = 0; + return (BADCH); + } + } + if (match != -1) { /* option found */ + if (long_options[match].has_arg == no_argument + && has_equal) { + if (PRINT_ERROR) + warnx(noarg, (int)current_argv_len, + current_argv); + /* + * XXX: GNU sets optopt to val regardless of flag + */ + if (long_options[match].flag == NULL) + optopt = long_options[match].val; + else + optopt = 0; + return (BADARG); + } + if (long_options[match].has_arg == required_argument || + long_options[match].has_arg == optional_argument) { + if (has_equal) + optarg = has_equal; + else if (long_options[match].has_arg == + required_argument) { + /* + * optional argument doesn't use next nargv + */ + optarg = nargv[optind++]; + } + } + if ((long_options[match].has_arg == required_argument) + && (optarg == NULL)) { + /* + * Missing argument; leading ':' indicates no error + * should be generated. + */ + if (PRINT_ERROR) + warnx(recargstring, + current_argv); + /* + * XXX: GNU sets optopt to val regardless of flag + */ + if (long_options[match].flag == NULL) + optopt = long_options[match].val; + else + optopt = 0; + --optind; + return (BADARG); + } + } else { /* unknown option */ + if (short_too) { + --optind; + return (-1); + } + if (PRINT_ERROR) + warnx(illoptstring, current_argv); + optopt = 0; + return (BADCH); + } + if (idx) + *idx = match; + if (long_options[match].flag) { + *long_options[match].flag = long_options[match].val; + return (0); + } else + return (long_options[match].val); + } + + /* + * getopt_internal -- + * Parse argc/argv argument vector. Called by user level routines. + */ + static int + getopt_internal(int nargc, char * const *nargv, const char *options, + const struct option *long_options, int *idx, int flags) + { + const char * oli; /* option letter list index */ + int optchar, short_too; + static int posixly_correct = -1; + + if (options == NULL) + return (-1); + + /* + * Disable GNU extensions if POSIXLY_CORRECT is set or options + * string begins with a '+'. + */ + if (posixly_correct == -1) + posixly_correct = (getenv("POSIXLY_CORRECT") != NULL); + if (posixly_correct || *options == '+') + flags &= ~FLAG_PERMUTE; + else if (*options == '-') + flags |= FLAG_ALLARGS; + if (*options == '+' || *options == '-') + options++; + + /* + * XXX Some GNU programs (like cvs) set optind to 0 instead of + * XXX using optreset. Work around this braindamage. + */ + if (optind == 0) + optind = optreset = 1; + + optarg = NULL; + if (optreset) + nonopt_start = nonopt_end = -1; + start: + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc) { /* end of argument vector */ + place = EMSG; + if (nonopt_end != -1) { + /* do permutation, if we have to */ + permute_args(nonopt_start, nonopt_end, + optind, nargv); + optind -= nonopt_end - nonopt_start; + } + else if (nonopt_start != -1) { + /* + * If we skipped non-options, set optind + * to the first of them. + */ + optind = nonopt_start; + } + nonopt_start = nonopt_end = -1; + return (-1); + } + if (*(place = nargv[optind]) != '-' || + (place[1] == '\0' && strchr(options, '-') == NULL)) { + place = EMSG; /* found non-option */ + if (flags & FLAG_ALLARGS) { + /* + * GNU extension: + * return non-option as argument to option 1 + */ + optarg = nargv[optind++]; + return (INORDER); + } + if (!(flags & FLAG_PERMUTE)) { + /* + * If no permutation wanted, stop parsing + * at first non-option. + */ + return (-1); + } + /* do permutation */ + if (nonopt_start == -1) + nonopt_start = optind; + else if (nonopt_end != -1) { + permute_args(nonopt_start, nonopt_end, + optind, nargv); + nonopt_start = optind - + (nonopt_end - nonopt_start); + nonopt_end = -1; + } + optind++; + /* process next argument */ + goto start; + } + if (nonopt_start != -1 && nonopt_end == -1) + nonopt_end = optind; + + /* + * If we have "-" do nothing, if "--" we are done. + */ + if (place[1] != '\0' && *++place == '-' && place[1] == '\0') { + optind++; + place = EMSG; + /* + * We found an option (--), so if we skipped + * non-options, we have to permute. + */ + if (nonopt_end != -1) { + permute_args(nonopt_start, nonopt_end, + optind, nargv); + optind -= nonopt_end - nonopt_start; + } + nonopt_start = nonopt_end = -1; + return (-1); + } + } + + /* + * Check long options if: + * 1) we were passed some + * 2) the arg is not just "-" + * 3) either the arg starts with -- we are getopt_long_only() + */ + if (long_options != NULL && place != nargv[optind] && + (*place == '-' || (flags & FLAG_LONGONLY))) { + short_too = 0; + if (*place == '-') + place++; /* --foo long option */ + else if (*place != ':' && strchr(options, *place) != NULL) + short_too = 1; /* could be short option too */ + + optchar = parse_long_options(nargv, options, long_options, + idx, short_too); + if (optchar != -1) { + place = EMSG; + return (optchar); + } + } + + if ((optchar = (int)*place++) == (int)':' || + optchar == (int)'-' && *place != '\0' || + (oli = strchr(options, optchar)) == NULL) { + /* + * If the user specified "-" and '-' isn't listed in + * options, return -1 (non-option) as per POSIX. + * Otherwise, it is an unknown option character (or ':'). + */ + if (optchar == (int)'-' && *place == '\0') + return (-1); + if (!*place) + ++optind; + if (PRINT_ERROR) + warnx(illoptchar, optchar); + optopt = optchar; + return (BADCH); + } + if (long_options != NULL && optchar == 'W' && oli[1] == ';') { + /* -W long-option */ + if (*place) /* no space */ + /* NOTHING */; + else if (++optind >= nargc) { /* no arg */ + place = EMSG; + if (PRINT_ERROR) + warnx(recargchar, optchar); + optopt = optchar; + return (BADARG); + } else /* white space */ + place = nargv[optind]; + optchar = parse_long_options(nargv, options, long_options, + idx, 0); + place = EMSG; + return (optchar); + } + if (*++oli != ':') { /* doesn't take argument */ + if (!*place) + ++optind; + } else { /* takes (optional) argument */ + optarg = NULL; + if (*place) /* no white space */ + optarg = place; + /* XXX: disable test for :: if PC? (GNU doesn't) */ + else if (oli[1] != ':') { /* arg not optional */ + if (++optind >= nargc) { /* no arg */ + place = EMSG; + if (PRINT_ERROR) + warnx(recargchar, optchar); + optopt = optchar; + return (BADARG); + } else + optarg = nargv[optind]; + } else if (!(flags & FLAG_PERMUTE)) { + /* + * If permutation is disabled, we can accept an + * optional arg separated by whitespace so long + * as it does not start with a dash (-). + */ + if (optind + 1 < nargc && *nargv[optind + 1] != '-') + optarg = nargv[++optind]; + } + place = EMSG; + ++optind; + } + /* dump back option letter */ + return (optchar); + } + + #ifdef REPLACE_GETOPT + /* + * getopt -- + * Parse argc/argv argument vector. + * + * [eventually this will replace the BSD getopt] + */ + int + getopt(int nargc, char * const *nargv, const char *options) + { + + /* + * We don't pass FLAG_PERMUTE to getopt_internal() since + * the BSD getopt(3) (unlike GNU) has never done this. + * + * Furthermore, since many privileged programs call getopt() + * before dropping privileges it makes sense to keep things + * as simple (and bug-free) as possible. + */ + return (getopt_internal(nargc, nargv, options, NULL, NULL, 0)); + } + #endif /* REPLACE_GETOPT */ + + /* + * getopt_long -- + * Parse argc/argv argument vector. + */ + int + getopt_long(int nargc, char * const *nargv, const char *options, + const struct option *long_options, int *idx) + { + + return (getopt_internal(nargc, nargv, options, long_options, idx, + FLAG_PERMUTE)); + } + + /* + * getopt_long_only -- + * Parse argc/argv argument vector. + */ + int + getopt_long_only(int nargc, char * const *nargv, const char *options, + const struct option *long_options, int *idx) + { + + return (getopt_internal(nargc, nargv, options, long_options, idx, + FLAG_PERMUTE|FLAG_LONGONLY)); + } + +#endif // defined _MSC_VER || defined __MINGW32__
\ No newline at end of file diff --git a/mesalib/src/glsl/glcpp/README b/mesalib/src/glsl/glcpp/README new file mode 100644 index 000000000..0b5ef508c --- /dev/null +++ b/mesalib/src/glsl/glcpp/README @@ -0,0 +1,32 @@ +glcpp -- GLSL "C" preprocessor + +This is a simple preprocessor designed to provide the preprocessing +needs of the GLSL language. The requirements for this preprocessor are +specified in the GLSL 1.30 specification availble from: + +http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.10.pdf + +This specification is not precise on some semantics, (for example, +#define and #if), defining these merely "as is standard for C++ +preprocessors". To fill in these details, I've been using a draft of +the C99 standard as available from: + +http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf + +Any downstream compiler accepting output from glcpp should be prepared +to encounter and deal with the following preprocessor macros: + + #line + #pragma + #extension + +All other macros will be handles according to the GLSL specification +and will not appear in the output. + +Known limitations +----------------- +The __LINE__ and __FILE__ macros are not yet supported. + +A file that ends with a function-like macro name as the last +non-whitespace token will result in a parse error, (where it should be +passed through as is).
\ No newline at end of file diff --git a/mesalib/src/glsl/glcpp/glcpp-lex.c b/mesalib/src/glsl/glcpp/glcpp-lex.c new file mode 100644 index 000000000..0f99ea1bb --- /dev/null +++ b/mesalib/src/glsl/glcpp/glcpp-lex.c @@ -0,0 +1,2691 @@ +#line 2 "glcpp/glcpp-lex.c" + +#line 4 "glcpp/glcpp-lex.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE glcpp_restart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via glcpp_restart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void glcpp_restart (FILE *input_file ,yyscan_t yyscanner ); +void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE glcpp__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void glcpp__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void glcpp__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void glcpp_pop_buffer_state (yyscan_t yyscanner ); + +static void glcpp_ensure_buffer_stack (yyscan_t yyscanner ); +static void glcpp__load_buffer_state (yyscan_t yyscanner ); +static void glcpp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER glcpp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE glcpp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE glcpp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE glcpp__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *glcpp_alloc (yy_size_t ,yyscan_t yyscanner ); +void *glcpp_realloc (void *,yy_size_t ,yyscan_t yyscanner ); +void glcpp_free (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer glcpp__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + glcpp_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + glcpp_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define glcpp_wrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 43 +#define YY_END_OF_BUFFER 44 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_acclist[137] = + { 0, + 3, 3, 44, 39, 43, 40, 43, 41, 43, 43, + 38, 43, 43, 38, 43, 38, 43, 38, 43, 25, + 39, 43, 24, 39, 43, 38, 43, 38, 43, 38, + 43, 37, 39, 43, 37, 39, 43, 38, 43, 40, + 43, 23, 43, 43, 3, 43, 4, 43, 5, 43, + 42, 43, 39, 18, 40, 32, 35, 33, 2, 1, + 25, 39, 25, 39, 39, 24, 39, 24, 39, 27, + 29, 31, 30, 28, 37, 39, 37, 39, 34, 40, + 23, 23, 3, 4, 5, 6, 5, 7, 1, 26, + 39, 37, 39,16398, 26, 39, 37, 39, 18, 37, + + 39,16399,16400, 8206, 18, 8206, 37, 39, 8207, 18, + 8208, 18,16401, 19,16396, 22, 36, 37, 39, 21, + 8209, 18, 19, 8204, 18,16397,16404, 8205, 18, 11, + 18, 9, 8, 8212, 10, 18 + } ; + +static yyconst flex_int16_t yy_accept[164] = + { 0, + 1, 1, 1, 1, 1, 2, 3, 3, 3, 4, + 6, 8, 10, 11, 13, 14, 16, 18, 20, 23, + 26, 28, 30, 32, 35, 38, 40, 42, 44, 45, + 47, 49, 51, 53, 54, 54, 55, 56, 57, 58, + 59, 60, 61, 63, 65, 66, 68, 70, 71, 72, + 73, 74, 75, 77, 79, 80, 81, 82, 83, 83, + 83, 83, 83, 83, 83, 83, 84, 85, 86, 87, + 88, 89, 90, 92, 94, 94, 94, 94, 94, 94, + 95, 95, 95, 95, 95, 97, 99, 99, 99, 99, + 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, + + 100, 102, 102, 103, 104, 104, 104, 104, 104, 106, + 106, 107, 107, 107, 107, 107, 107, 107, 109, 109, + 109, 111, 111, 113, 114, 115, 115, 116, 116, 116, + 116, 117, 117, 120, 121, 121, 123, 124, 124, 124, + 126, 127, 127, 127, 127, 128, 128, 128, 130, 130, + 132, 132, 133, 134, 134, 134, 134, 135, 135, 135, + 137, 137, 137 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 1, 6, 1, 7, 8, 1, 9, + 7, 10, 7, 7, 7, 7, 11, 12, 13, 13, + 13, 13, 13, 13, 13, 14, 14, 1, 7, 15, + 16, 17, 1, 1, 18, 18, 18, 18, 18, 18, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 20, 19, 19, 21, 19, 19, + 7, 1, 7, 7, 19, 1, 22, 18, 18, 23, + + 24, 25, 26, 19, 27, 19, 19, 28, 29, 30, + 31, 32, 19, 33, 34, 35, 36, 37, 19, 38, + 19, 19, 7, 39, 7, 7, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[40] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[182] = + { 0, + 0, 38, 0, 0, 38, 39, 499, 498, 500, 48, + 43, 552, 496, 44, 63, 495, 59, 65, 87, 125, + 58, 67, 68, 164, 203, 40, 75, 241, 552, 494, + 552, 140, 552, 140, 493, 552, 144, 492, 491, 487, + 486, 485, 156, 179, 267, 0, 209, 472, 471, 470, + 469, 468, 446, 124, 466, 153, 462, 458, 154, 198, + 159, 155, 183, 160, 193, 460, 552, 222, 552, 227, + 552, 459, 204, 161, 231, 232, 238, 243, 236, 303, + 245, 180, 247, 249, 281, 56, 257, 271, 248, 259, + 252, 264, 455, 454, 297, 299, 312, 313, 320, 294, + + 407, 295, 427, 426, 321, 296, 324, 425, 552, 424, + 552, 327, 329, 195, 328, 331, 332, 230, 334, 378, + 552, 377, 552, 371, 370, 335, 365, 337, 358, 342, + 360, 344, 326, 255, 340, 552, 260, 338, 246, 552, + 197, 364, 192, 352, 382, 348, 186, 552, 420, 552, + 423, 184, 141, 437, 421, 447, 79, 476, 346, 552, + 453, 552, 515, 517, 519, 521, 523, 525, 71, 527, + 529, 531, 533, 535, 537, 539, 541, 543, 545, 547, + 549 + } ; + +static yyconst flex_int16_t yy_def[182] = + { 0, + 162, 1, 163, 163, 164, 164, 165, 165, 162, 166, + 167, 162, 167, 167, 167, 167, 167, 167, 162, 166, + 167, 167, 167, 168, 168, 167, 167, 167, 162, 169, + 162, 170, 162, 20, 167, 162, 167, 167, 167, 167, + 167, 171, 19, 20, 20, 20, 20, 167, 167, 167, + 167, 167, 25, 25, 167, 167, 28, 28, 167, 167, + 167, 167, 167, 167, 167, 169, 162, 170, 162, 170, + 162, 171, 45, 25, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 20, 25, 167, 167, 167, 167, + 167, 167, 172, 173, 167, 167, 167, 167, 167, 167, + + 25, 167, 174, 175, 167, 167, 167, 172, 162, 173, + 162, 167, 167, 167, 167, 167, 167, 25, 167, 174, + 162, 175, 162, 176, 177, 167, 178, 167, 167, 167, + 167, 167, 25, 167, 176, 162, 177, 167, 178, 162, + 179, 167, 180, 167, 162, 167, 179, 162, 167, 162, + 167, 180, 167, 181, 167, 167, 167, 181, 167, 162, + 167, 0, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162 + } ; + +static yyconst flex_int16_t yy_nxt[592] = + { 0, + 10, 11, 12, 13, 14, 15, 16, 17, 16, 16, + 18, 19, 20, 20, 21, 22, 23, 24, 24, 24, + 24, 24, 25, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 26, 27, + 31, 31, 36, 28, 37, 36, 36, 32, 32, 35, + 36, 35, 35, 35, 35, 35, 35, 35, 35, 38, + 36, 36, 35, 35, 35, 36, 40, 36, 39, 36, + 36, 66, 48, 49, 41, 42, 56, 36, 55, 53, + 57, 36, 50, 51, 52, 101, 35, 34, 35, 36, + 35, 35, 35, 35, 35, 35, 35, 35, 43, 43, + + 34, 35, 35, 35, 34, 34, 44, 45, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 44, 34, 45, 35, 35, 36, 35, 35, + 35, 35, 35, 35, 35, 35, 46, 46, 46, 35, + 35, 35, 69, 36, 47, 37, 36, 53, 74, 70, + 71, 34, 34, 34, 56, 36, 36, 36, 57, 34, + 47, 36, 36, 35, 34, 35, 36, 35, 35, 35, + 35, 35, 35, 35, 35, 34, 34, 75, 35, 35, + 35, 81, 36, 80, 53, 36, 36, 86, 148, 83, + 34, 34, 34, 34, 36, 36, 129, 36, 34, 148, + + 36, 98, 35, 34, 35, 36, 35, 35, 35, 35, + 35, 35, 35, 35, 34, 82, 84, 35, 35, 35, + 34, 34, 34, 85, 69, 76, 54, 77, 34, 69, + 78, 162, 162, 36, 36, 79, 70, 71, 36, 85, + 36, 35, 58, 36, 34, 36, 39, 36, 140, 36, + 36, 36, 133, 53, 36, 87, 145, 36, 88, 36, + 90, 36, 36, 59, 60, 89, 36, 61, 62, 99, + 92, 104, 63, 36, 97, 91, 64, 65, 73, 73, + 73, 100, 106, 102, 73, 105, 34, 107, 73, 73, + 73, 73, 34, 34, 34, 103, 36, 36, 36, 36, + + 34, 36, 34, 93, 93, 94, 93, 93, 93, 93, + 93, 93, 93, 93, 36, 36, 34, 93, 93, 93, + 112, 113, 36, 36, 119, 95, 36, 117, 125, 36, + 36, 36, 96, 36, 36, 114, 36, 36, 115, 36, + 36, 93, 136, 116, 36, 124, 36, 159, 160, 53, + 36, 127, 128, 126, 36, 131, 130, 134, 132, 129, + 36, 141, 36, 143, 146, 149, 150, 140, 138, 142, + 142, 142, 36, 136, 144, 151, 151, 151, 155, 123, + 121, 153, 35, 145, 36, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 154, + + 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, + 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, + 35, 149, 150, 36, 149, 150, 111, 109, 123, 121, + 118, 156, 156, 156, 151, 151, 151, 35, 35, 36, + 35, 35, 35, 35, 35, 157, 35, 35, 159, 160, + 143, 35, 35, 35, 159, 160, 111, 109, 161, 161, + 161, 36, 67, 35, 161, 161, 161, 35, 36, 53, + 36, 36, 36, 36, 36, 35, 35, 35, 36, 35, + 35, 35, 35, 35, 157, 35, 35, 36, 36, 36, + 35, 35, 35, 36, 36, 36, 67, 36, 36, 162, + + 29, 29, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 35, 29, 29, 30, 30, 33, + 33, 34, 34, 35, 35, 53, 53, 68, 68, 72, + 72, 108, 108, 110, 110, 120, 120, 122, 122, 135, + 135, 137, 137, 139, 139, 147, 147, 152, 152, 158, + 158, 9, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162 + + } ; + +static yyconst flex_int16_t yy_chk[592] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 5, 6, 26, 2, 11, 11, 14, 5, 6, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 14, + 21, 17, 10, 10, 10, 15, 17, 18, 15, 22, + 23, 169, 21, 21, 18, 18, 27, 27, 26, 86, + 27, 157, 22, 23, 23, 86, 10, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 32, 153, 20, 37, 37, 54, 54, 32, + 32, 34, 34, 34, 56, 56, 59, 62, 56, 34, + 20, 61, 64, 20, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 34, 43, 59, 24, 24, + 24, 62, 82, 61, 74, 63, 152, 74, 147, 64, + 44, 44, 44, 43, 143, 65, 114, 114, 44, 141, + + 60, 82, 24, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 44, 63, 65, 25, 25, 25, + 47, 47, 47, 73, 68, 60, 25, 60, 47, 70, + 60, 68, 68, 75, 76, 60, 70, 70, 79, 73, + 77, 25, 28, 28, 47, 78, 28, 81, 139, 83, + 89, 84, 118, 118, 91, 75, 134, 134, 76, 87, + 77, 90, 137, 28, 28, 76, 92, 28, 28, 83, + 79, 89, 28, 88, 81, 78, 28, 28, 45, 45, + 45, 84, 91, 87, 45, 90, 45, 92, 45, 45, + 45, 45, 85, 85, 85, 88, 100, 102, 106, 95, + + 85, 96, 45, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 97, 98, 85, 80, 80, 80, + 95, 96, 99, 105, 102, 80, 107, 100, 106, 112, + 115, 113, 80, 116, 117, 97, 119, 126, 98, 128, + 138, 80, 135, 99, 130, 105, 132, 159, 159, 133, + 146, 112, 113, 107, 144, 116, 115, 119, 117, 129, + 129, 128, 131, 130, 138, 142, 142, 127, 126, 129, + 129, 129, 125, 124, 132, 142, 142, 142, 146, 122, + 120, 144, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, + 145, 149, 149, 155, 151, 151, 110, 108, 104, 103, + 101, 149, 149, 149, 151, 151, 151, 154, 154, 154, + 154, 154, 154, 154, 154, 154, 154, 154, 156, 156, + 155, 154, 154, 154, 161, 161, 94, 93, 156, 156, + 156, 72, 66, 58, 161, 161, 161, 57, 55, 53, + 52, 51, 50, 49, 48, 154, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 158, 42, 41, 40, + 158, 158, 158, 39, 38, 35, 30, 16, 13, 9, + + 8, 7, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 158, 163, 163, 164, 164, 165, + 165, 166, 166, 167, 167, 168, 168, 170, 170, 171, + 171, 172, 172, 173, 173, 174, 174, 175, 175, 176, + 176, 177, 177, 178, 178, 179, 179, 180, 180, 181, + 181, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, + 162 + + } ; + +#define YY_TRAILING_MASK 0x2000 +#define YY_TRAILING_HEAD_MASK 0x4000 +#define REJECT \ +{ \ +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ \ +yy_cp = yyg->yy_full_match; /* restore poss. backed-over text */ \ +yyg->yy_lp = yyg->yy_full_lp; /* restore orig. accepting pos. */ \ +yyg->yy_state_ptr = yyg->yy_full_state; /* restore orig. state */ \ +yy_current_state = *yyg->yy_state_ptr; /* restore curr. state */ \ +++yyg->yy_lp; \ +goto find_rule; \ +} + +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "glcpp/glcpp-lex.l" +#line 2 "glcpp/glcpp-lex.l" +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <ctype.h> + +#include "glcpp.h" +#include "glcpp-parse.h" + +/* Flex annoyingly generates some functions without making them + * static. Let's declare them here. */ +int glcpp_get_column (yyscan_t yyscanner); +void glcpp_set_column (int column_no , yyscan_t yyscanner); + +#define YY_NO_INPUT + +#define YY_USER_ACTION \ + do { \ + yylloc->first_column = yycolumn + 1; \ + yylloc->first_line = yylineno; \ + yycolumn += yyleng; \ + } while(0); + +#define YY_USER_INIT \ + do { \ + yylineno = 1; \ + yycolumn = 1; \ + yylloc->source = 0; \ + } while(0) + +#line 709 "glcpp/glcpp-lex.c" + +#define INITIAL 0 +#define DONE 1 +#define COMMENT 2 +#define UNREACHABLE 3 + +#define YY_EXTRA_TYPE glcpp_parser_t * + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + yy_state_type *yy_state_buf; + yy_state_type *yy_state_ptr; + char *yy_full_match; + int yy_lp; + + /* These are only needed for trailing context rules, + * but there's no conditional variable for that yet. */ + int yy_looking_for_trail_begin; + int yy_full_lp; + int *yy_full_state; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + YYLTYPE * yylloc_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + + # define yylloc yyg->yylloc_r + +int glcpp_lex_init (yyscan_t* scanner); + +int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int glcpp_lex_destroy (yyscan_t yyscanner ); + +int glcpp_get_debug (yyscan_t yyscanner ); + +void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner ); + +void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *glcpp_get_in (yyscan_t yyscanner ); + +void glcpp_set_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *glcpp_get_out (yyscan_t yyscanner ); + +void glcpp_set_out (FILE * out_str ,yyscan_t yyscanner ); + +int glcpp_get_leng (yyscan_t yyscanner ); + +char *glcpp_get_text (yyscan_t yyscanner ); + +int glcpp_get_lineno (yyscan_t yyscanner ); + +void glcpp_set_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * glcpp_get_lval (yyscan_t yyscanner ); + +void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + + YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner ); + + void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int glcpp_wrap (yyscan_t yyscanner ); +#else +extern int glcpp_wrap (yyscan_t yyscanner ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + + static void yy_push_state (int new_state ,yyscan_t yyscanner); + + static void yy_pop_state (yyscan_t yyscanner ); + + static int yy_top_state (yyscan_t yyscanner ); + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int glcpp_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int glcpp_lex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 76 "glcpp/glcpp-lex.l" + + + /* Single-line comments */ +#line 972 "glcpp/glcpp-lex.c" + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + /* Create the reject buffer large enough to save one state per allowed character. */ + if ( ! yyg->yy_state_buf ) + yyg->yy_state_buf = (yy_state_type *)glcpp_alloc(YY_STATE_BUF_SIZE ,yyscanner); + if ( ! yyg->yy_state_buf ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp_lex()" ); + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + glcpp_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + glcpp__load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); + + yyg->yy_state_ptr = yyg->yy_state_buf; + *yyg->yy_state_ptr++ = yy_current_state; + +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 163 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yyg->yy_state_ptr++ = yy_current_state; + ++yy_cp; + } + while ( yy_current_state != 162 ); + +yy_find_action: + yy_current_state = *--yyg->yy_state_ptr; + yyg->yy_lp = yy_accept[yy_current_state]; +find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( yyg->yy_lp && yyg->yy_lp < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[yyg->yy_lp]; + if ( yy_act & YY_TRAILING_HEAD_MASK || + yyg->yy_looking_for_trail_begin ) + { + if ( yy_act == yyg->yy_looking_for_trail_begin ) + { + yyg->yy_looking_for_trail_begin = 0; + yy_act &= ~YY_TRAILING_HEAD_MASK; + break; + } + } + else if ( yy_act & YY_TRAILING_MASK ) + { + yyg->yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK; + yyg->yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK; + yyg->yy_full_match = yy_cp; + yyg->yy_full_state = yyg->yy_state_ptr; + yyg->yy_full_lp = yyg->yy_lp; + } + else + { + yyg->yy_full_match = yy_cp; + yyg->yy_full_state = yyg->yy_state_ptr; + yyg->yy_full_lp = yyg->yy_lp; + break; + } + ++yyg->yy_lp; + goto find_rule; + } + --yy_cp; + yy_current_state = *--yyg->yy_state_ptr; + yyg->yy_lp = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ +case 1: +YY_RULE_SETUP +#line 79 "glcpp/glcpp-lex.l" +{ +} + YY_BREAK +/* Multi-line comments */ +case 2: +YY_RULE_SETUP +#line 83 "glcpp/glcpp-lex.l" +{ yy_push_state(COMMENT, yyscanner); } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 84 "glcpp/glcpp-lex.l" + + YY_BREAK +case 4: +/* rule 4 can match eol */ +YY_RULE_SETUP +#line 85 "glcpp/glcpp-lex.l" +{ yylineno++; yycolumn = 0; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 86 "glcpp/glcpp-lex.l" + + YY_BREAK +case 6: +/* rule 6 can match eol */ +YY_RULE_SETUP +#line 87 "glcpp/glcpp-lex.l" +{ yylineno++; yycolumn = 0; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 88 "glcpp/glcpp-lex.l" +{ + yy_pop_state(yyscanner); + if (yyextra->space_tokens) + return SPACE; +} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 94 "glcpp/glcpp-lex.l" +{ + yylval->str = talloc_strdup (yyextra, yytext); + yyextra->space_tokens = 0; + return HASH_VERSION; +} + YY_BREAK +/* glcpp doesn't handle #extension, #version, or #pragma directives. + * Simply pass them through to the main compiler's lexer/parser. */ +case 9: +YY_RULE_SETUP +#line 102 "glcpp/glcpp-lex.l" +{ + yylval->str = talloc_strdup (yyextra, yytext); + yylineno++; + yycolumn = 0; + return OTHER; +} + YY_BREAK +case 10: +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 109 "glcpp/glcpp-lex.l" +{ + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + yylloc->source = strtol(ptr, NULL, 0); +} + YY_BREAK +case 11: +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 125 "glcpp/glcpp-lex.l" +{ + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; +} + YY_BREAK +case 12: +/* rule 12 can match eol */ +YY_RULE_SETUP +#line 140 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IFDEF; +} + YY_BREAK +case 13: +/* rule 13 can match eol */ +YY_RULE_SETUP +#line 146 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IFNDEF; +} + YY_BREAK +case 14: +/* rule 14 can match eol */ +YY_RULE_SETUP +#line 152 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IF; +} + YY_BREAK +case 15: +/* rule 15 can match eol */ +YY_RULE_SETUP +#line 158 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_ELIF; +} + YY_BREAK +case 16: +/* rule 16 can match eol */ +YY_RULE_SETUP +#line 164 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_ELSE; +} + YY_BREAK +case 17: +/* rule 17 can match eol */ +YY_RULE_SETUP +#line 169 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_ENDIF; +} + YY_BREAK +/* When skipping (due to an #if 0 or similar) consume anything + * up to a newline. We do this with less priority than any + * #if-related directive (#if, #elif, #else, #endif), but with + * more priority than any other directive or token to avoid + * any side-effects from skipped content. + * + * We use the lexing_if flag to avoid skipping any part of an + * if conditional expression. */ +case 18: +/* rule 18 can match eol */ +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 182 "glcpp/glcpp-lex.l" +{ + /* Since this rule always matches, YY_USER_ACTION gets called for it, + * wrongly incrementing yycolumn. We undo that effect here. */ + yycolumn -= yyleng; + if (yyextra->lexing_if || + yyextra->skip_stack == NULL || + yyextra->skip_stack->type == SKIP_NO_SKIP) + { + REJECT; + } +} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 194 "glcpp/glcpp-lex.l" +{ + char *p; + for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ + p += 5; /* skip "error" */ + glcpp_error(yylloc, yyextra, "#error%s", p); +} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 201 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_DEFINE_FUNC; +} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 206 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_DEFINE_OBJ; +} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 211 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH_UNDEF; +} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 216 "glcpp/glcpp-lex.l" +{ + yyextra->space_tokens = 0; + return HASH; +} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 221 "glcpp/glcpp-lex.l" +{ + yylval->str = talloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 226 "glcpp/glcpp-lex.l" +{ + yylval->str = talloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 231 "glcpp/glcpp-lex.l" +{ + yylval->str = talloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 236 "glcpp/glcpp-lex.l" +{ + return LEFT_SHIFT; +} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 240 "glcpp/glcpp-lex.l" +{ + return RIGHT_SHIFT; +} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 244 "glcpp/glcpp-lex.l" +{ + return LESS_OR_EQUAL; +} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 248 "glcpp/glcpp-lex.l" +{ + return GREATER_OR_EQUAL; +} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 252 "glcpp/glcpp-lex.l" +{ + return EQUAL; +} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 256 "glcpp/glcpp-lex.l" +{ + return NOT_EQUAL; +} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 260 "glcpp/glcpp-lex.l" +{ + return AND; +} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 264 "glcpp/glcpp-lex.l" +{ + return OR; +} + YY_BREAK +case 35: +YY_RULE_SETUP +#line 268 "glcpp/glcpp-lex.l" +{ + return PASTE; +} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 272 "glcpp/glcpp-lex.l" +{ + return DEFINED; +} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 276 "glcpp/glcpp-lex.l" +{ + yylval->str = talloc_strdup (yyextra, yytext); + return IDENTIFIER; +} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 281 "glcpp/glcpp-lex.l" +{ + return yytext[0]; +} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 285 "glcpp/glcpp-lex.l" +{ + yylval->str = talloc_strdup (yyextra, yytext); + return OTHER; +} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 290 "glcpp/glcpp-lex.l" +{ + if (yyextra->space_tokens) { + return SPACE; + } +} + YY_BREAK +case 41: +/* rule 41 can match eol */ +YY_RULE_SETUP +#line 296 "glcpp/glcpp-lex.l" +{ + yyextra->lexing_if = 0; + yylineno++; + yycolumn = 0; + return NEWLINE; +} + YY_BREAK +/* Handle missing newline at EOF. */ +case YY_STATE_EOF(INITIAL): +#line 304 "glcpp/glcpp-lex.l" +{ + BEGIN DONE; /* Don't keep matching this rule forever. */ + yyextra->lexing_if = 0; + return NEWLINE; +} + YY_BREAK +/* We don't actually use the UNREACHABLE start condition. We + only have this action here so that we can pretend to call some + generated functions, (to avoid "defined but not used" + warnings. */ +case 42: +YY_RULE_SETUP +#line 314 "glcpp/glcpp-lex.l" +{ + unput('.'); + yy_top_state(yyextra); +} + YY_BREAK +case 43: +YY_RULE_SETUP +#line 319 "glcpp/glcpp-lex.l" +ECHO; + YY_BREAK +#line 1489 "glcpp/glcpp-lex.c" + case YY_STATE_EOF(DONE): + case YY_STATE_EOF(COMMENT): + case YY_STATE_EOF(UNREACHABLE): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * glcpp_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( glcpp_wrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of glcpp_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + glcpp_restart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); + + yyg->yy_state_ptr = yyg->yy_state_buf; + *yyg->yy_state_ptr++ = yy_current_state; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 163 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yyg->yy_state_ptr++ = yy_current_state; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 163 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 162); + if ( ! yy_is_jam ) + *yyg->yy_state_ptr++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +{ + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_cp = yyg->yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yyg->yy_hold_char; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yyg->yy_n_chars + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + glcpp_restart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( glcpp_wrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void glcpp_restart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + glcpp_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + glcpp__load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * glcpp_pop_buffer_state(); + * glcpp_push_buffer_state(new_buffer); + */ + glcpp_ensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + glcpp__load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (glcpp_wrap()) processing, but the only time this flag + * is looked at is after glcpp_wrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void glcpp__load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + glcpp__init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with glcpp__create_buffer() + * @param yyscanner The scanner object. + */ + void glcpp__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + glcpp_free((void *) b->yy_ch_buf ,yyscanner ); + + glcpp_free((void *) b ,yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a glcpp_restart() or at EOF. + */ + static void glcpp__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + glcpp__flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then glcpp__init_buffer was _probably_ + * called from glcpp_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void glcpp__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + glcpp__load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + glcpp_ensure_buffer_stack(yyscanner); + + /* This block is copied from glcpp__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from glcpp__switch_to_buffer. */ + glcpp__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void glcpp_pop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + glcpp__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void glcpp_ensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + glcpp__switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to glcpp_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * glcpp__scan_bytes() instead. + */ +YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) glcpp_alloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = glcpp__scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + + static void yy_push_state (int new_state , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) + { + yy_size_t new_size; + + yyg->yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yyg->yy_start_stack_depth * sizeof( int ); + + if ( ! yyg->yy_start_stack ) + yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner ); + + else + yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner ); + + if ( ! yyg->yy_start_stack ) + YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); + } + + yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); +} + + static void yy_pop_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( --yyg->yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); +} + + static int yy_top_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int glcpp_get_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int glcpp_get_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *glcpp_get_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *glcpp_get_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int glcpp_get_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *glcpp_get_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void glcpp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void glcpp_set_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void glcpp_set_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see glcpp__switch_to_buffer + */ +void glcpp_set_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void glcpp_set_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int glcpp_get_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void glcpp_set_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * glcpp_get_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void glcpp_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylloc; +} + +void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylloc = yylloc_param; +} + +/* User-visible API */ + +/* glcpp_lex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int glcpp_lex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to glcpp_alloc in + * the yyextra field. + */ + +int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + glcpp_set_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + glcpp_set_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from glcpp_lex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + + yyg->yy_state_buf = 0; + yyg->yy_state_ptr = 0; + yyg->yy_full_match = 0; + yyg->yy_lp = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * glcpp_lex_init() + */ + return 0; +} + +/* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */ +int glcpp_lex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + glcpp_pop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + glcpp_free(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + glcpp_free(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + glcpp_free ( yyg->yy_state_buf , yyscanner); + yyg->yy_state_buf = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * glcpp_lex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + glcpp_free ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *glcpp_alloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void glcpp_free (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see glcpp_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 319 "glcpp/glcpp-lex.l" + + + +void +glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader) +{ + glcpp__scan_string(shader,parser->scanner); +} + diff --git a/mesalib/src/glsl/glcpp/glcpp-lex.l b/mesalib/src/glsl/glcpp/glcpp-lex.l new file mode 100644 index 000000000..8eb84ed13 --- /dev/null +++ b/mesalib/src/glsl/glcpp/glcpp-lex.l @@ -0,0 +1,325 @@ +%{ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include <string.h> +#include <ctype.h> + +#include "glcpp.h" +#include "glcpp-parse.h" + +/* Flex annoyingly generates some functions without making them + * static. Let's declare them here. */ +int glcpp_get_column (yyscan_t yyscanner); +void glcpp_set_column (int column_no , yyscan_t yyscanner); + +#define YY_NO_INPUT + +#define YY_USER_ACTION \ + do { \ + yylloc->first_column = yycolumn + 1; \ + yylloc->first_line = yylineno; \ + yycolumn += yyleng; \ + } while(0); + +#define YY_USER_INIT \ + do { \ + yylineno = 1; \ + yycolumn = 1; \ + yylloc->source = 0; \ + } while(0) +%} + +%option bison-bridge bison-locations reentrant noyywrap +%option extra-type="glcpp_parser_t *" +%option prefix="glcpp_" +%option stack +%option never-interactive + +%x DONE COMMENT UNREACHABLE + +SPACE [[:space:]] +NONSPACE [^[:space:]] +NEWLINE [\n] +HSPACE [ \t] +HASH ^{HSPACE}*#{HSPACE}* +IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]* +PUNCTUATION [][(){}.&*~!/%<>^|;,=+-] +OTHER [^][(){}.&*~!/%<>^|;,=#[:space:]+-]+ + +DIGITS [0-9][0-9]* +DECIMAL_INTEGER [1-9][0-9]*[uU]? +OCTAL_INTEGER 0[0-7]*[uU]? +HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? + +%% + + /* Single-line comments */ +"//"[^\n]* { +} + + /* Multi-line comments */ +"/*" { yy_push_state(COMMENT, yyscanner); } +<COMMENT>[^*\n]* +<COMMENT>[^*\n]*\n { yylineno++; yycolumn = 0; } +<COMMENT>"*"+[^*/\n]* +<COMMENT>"*"+[^*/\n]*\n { yylineno++; yycolumn = 0; } +<COMMENT>"*"+"/" { + yy_pop_state(yyscanner); + if (yyextra->space_tokens) + return SPACE; +} + +{HASH}version { + yylval->str = talloc_strdup (yyextra, yytext); + yyextra->space_tokens = 0; + return HASH_VERSION; +} + + /* glcpp doesn't handle #extension, #version, or #pragma directives. + * Simply pass them through to the main compiler's lexer/parser. */ +{HASH}(extension|pragma)[^\n]+ { + yylval->str = talloc_strdup (yyextra, yytext); + yylineno++; + yycolumn = 0; + return OTHER; +} + +{HASH}line{HSPACE}+{DIGITS}{HSPACE}+{DIGITS}{HSPACE}*$ { + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + yylloc->source = strtol(ptr, NULL, 0); +} + +{HASH}line{HSPACE}+{DIGITS}{HSPACE}*$ { + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; +} + +{HASH}ifdef/.*\n { + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IFDEF; +} + +{HASH}ifndef/.*\n { + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IFNDEF; +} + +{HASH}if/[^_a-zA-Z0-9].*\n { + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_IF; +} + +{HASH}elif/.*\n { + yyextra->lexing_if = 1; + yyextra->space_tokens = 0; + return HASH_ELIF; +} + +{HASH}else/.*\n { + yyextra->space_tokens = 0; + return HASH_ELSE; +} + +{HASH}endif/.*\n { + yyextra->space_tokens = 0; + return HASH_ENDIF; +} + + /* When skipping (due to an #if 0 or similar) consume anything + * up to a newline. We do this with less priority than any + * #if-related directive (#if, #elif, #else, #endif), but with + * more priority than any other directive or token to avoid + * any side-effects from skipped content. + * + * We use the lexing_if flag to avoid skipping any part of an + * if conditional expression. */ +[^\n]+/\n { + /* Since this rule always matches, YY_USER_ACTION gets called for it, + * wrongly incrementing yycolumn. We undo that effect here. */ + yycolumn -= yyleng; + if (yyextra->lexing_if || + yyextra->skip_stack == NULL || + yyextra->skip_stack->type == SKIP_NO_SKIP) + { + REJECT; + } +} + +{HASH}error.* { + char *p; + for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */ + p += 5; /* skip "error" */ + glcpp_error(yylloc, yyextra, "#error%s", p); +} + +{HASH}define{HSPACE}+/{IDENTIFIER}"(" { + yyextra->space_tokens = 0; + return HASH_DEFINE_FUNC; +} + +{HASH}define { + yyextra->space_tokens = 0; + return HASH_DEFINE_OBJ; +} + +{HASH}undef { + yyextra->space_tokens = 0; + return HASH_UNDEF; +} + +{HASH} { + yyextra->space_tokens = 0; + return HASH; +} + +{DECIMAL_INTEGER} { + yylval->str = talloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + +{OCTAL_INTEGER} { + yylval->str = talloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + +{HEXADECIMAL_INTEGER} { + yylval->str = talloc_strdup (yyextra, yytext); + return INTEGER_STRING; +} + +"<<" { + return LEFT_SHIFT; +} + +">>" { + return RIGHT_SHIFT; +} + +"<=" { + return LESS_OR_EQUAL; +} + +">=" { + return GREATER_OR_EQUAL; +} + +"==" { + return EQUAL; +} + +"!=" { + return NOT_EQUAL; +} + +"&&" { + return AND; +} + +"||" { + return OR; +} + +"##" { + return PASTE; +} + +"defined" { + return DEFINED; +} + +{IDENTIFIER} { + yylval->str = talloc_strdup (yyextra, yytext); + return IDENTIFIER; +} + +{PUNCTUATION} { + return yytext[0]; +} + +{OTHER}+ { + yylval->str = talloc_strdup (yyextra, yytext); + return OTHER; +} + +{HSPACE}+ { + if (yyextra->space_tokens) { + return SPACE; + } +} + +\n { + yyextra->lexing_if = 0; + yylineno++; + yycolumn = 0; + return NEWLINE; +} + + /* Handle missing newline at EOF. */ +<INITIAL><<EOF>> { + BEGIN DONE; /* Don't keep matching this rule forever. */ + yyextra->lexing_if = 0; + return NEWLINE; +} + + /* We don't actually use the UNREACHABLE start condition. We + only have this action here so that we can pretend to call some + generated functions, (to avoid "defined but not used" + warnings. */ +<UNREACHABLE>. { + unput('.'); + yy_top_state(yyextra); +} + +%% + +void +glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader) +{ + yy_scan_string(shader, parser->scanner); +} diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.c b/mesalib/src/glsl/glcpp/glcpp-parse.c new file mode 100644 index 000000000..1773ca5c1 --- /dev/null +++ b/mesalib/src/glsl/glcpp/glcpp-parse.c @@ -0,0 +1,4184 @@ +/* A Bison parser, made by GNU Bison 2.4.3. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 1 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "glcpp/glcpp-parse.y" + +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <inttypes.h> + +#include "glcpp.h" +#include "main/core.h" /* for struct gl_extensions */ +#include "main/mtypes.h" /* for gl_api enum */ + +#define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) +#define glcpp_printf(stream, fmt, args, ...) \ + stream = talloc_asprintf_append(stream, fmt, args) + +static void +yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error); + +static void +_define_object_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *macro, + token_list_t *replacements); + +static void +_define_function_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *macro, + string_list_t *parameters, + token_list_t *replacements); + +static string_list_t * +_string_list_create (void *ctx); + +static void +_string_list_append_item (string_list_t *list, const char *str); + +static int +_string_list_contains (string_list_t *list, const char *member, int *index); + +static int +_string_list_length (string_list_t *list); + +static int +_string_list_equal (string_list_t *a, string_list_t *b); + +static argument_list_t * +_argument_list_create (void *ctx); + +static void +_argument_list_append (argument_list_t *list, token_list_t *argument); + +static int +_argument_list_length (argument_list_t *list); + +static token_list_t * +_argument_list_member_at (argument_list_t *list, int index); + +/* Note: This function talloc_steal()s the str pointer. */ +static token_t * +_token_create_str (void *ctx, int type, char *str); + +static token_t * +_token_create_ival (void *ctx, int type, int ival); + +static token_list_t * +_token_list_create (void *ctx); + +/* Note: This function adds a talloc_reference() to token. + * + * You may want to talloc_unlink any current reference if you no + * longer need it. */ +static void +_token_list_append (token_list_t *list, token_t *token); + +static void +_token_list_append_list (token_list_t *list, token_list_t *tail); + +static int +_token_list_equal_ignoring_space (token_list_t *a, token_list_t *b); + +static active_list_t * +_active_list_push (active_list_t *list, + const char *identifier, + token_node_t *marker); + +static active_list_t * +_active_list_pop (active_list_t *list); + +int +_active_list_contains (active_list_t *list, const char *identifier); + +static void +_glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list); + +static void +_glcpp_parser_expand_token_list (glcpp_parser_t *parser, + token_list_t *list); + +static void +_glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser, + token_list_t *list); + +static void +_glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, + int condition); + +static void +_glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc, + const char *type, int condition); + +static void +_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc); + +#define yylex glcpp_parser_lex + +static int +glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser); + +static void +glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list); + +static void +add_builtin_define(glcpp_parser_t *parser, const char *name, int value); + + + +/* Line 189 of yacc.c */ +#line 223 "glcpp/glcpp-parse.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + COMMA_FINAL = 258, + DEFINED = 259, + ELIF_EXPANDED = 260, + HASH = 261, + HASH_DEFINE_FUNC = 262, + HASH_DEFINE_OBJ = 263, + HASH_ELIF = 264, + HASH_ELSE = 265, + HASH_ENDIF = 266, + HASH_IF = 267, + HASH_IFDEF = 268, + HASH_IFNDEF = 269, + HASH_UNDEF = 270, + HASH_VERSION = 271, + IDENTIFIER = 272, + IF_EXPANDED = 273, + INTEGER = 274, + INTEGER_STRING = 275, + NEWLINE = 276, + OTHER = 277, + PLACEHOLDER = 278, + SPACE = 279, + PASTE = 280, + OR = 281, + AND = 282, + NOT_EQUAL = 283, + EQUAL = 284, + GREATER_OR_EQUAL = 285, + LESS_OR_EQUAL = 286, + RIGHT_SHIFT = 287, + LEFT_SHIFT = 288, + UNARY = 289 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 311 "glcpp/glcpp-parse.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 2 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 606 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 57 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 17 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 101 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 162 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 289 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 47, 2, 2, 2, 43, 30, 2, + 45, 46, 41, 39, 49, 40, 54, 42, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 55, + 33, 56, 34, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 50, 2, 51, 29, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 52, 28, 53, 48, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 31, 32, 35, 36, 37, 38, 44 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 4, 7, 9, 11, 13, 16, 20, + 24, 29, 36, 44, 48, 52, 55, 60, 65, 69, + 72, 75, 78, 82, 85, 87, 89, 91, 95, 99, + 103, 107, 111, 115, 119, 123, 127, 131, 135, 139, + 143, 147, 151, 155, 159, 163, 166, 169, 172, 175, + 179, 181, 185, 187, 190, 193, 194, 196, 197, 199, + 202, 207, 209, 211, 214, 216, 219, 221, 223, 225, + 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, + 247, 249, 251, 253, 255, 257, 259, 261, 263, 265, + 267, 269, 271, 273, 275, 277, 279, 281, 283, 285, + 287, 289 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 58, 0, -1, -1, 58, 59, -1, 61, -1, 65, + -1, 60, -1, 6, 66, -1, 18, 63, 21, -1, + 5, 63, 21, -1, 8, 17, 67, 21, -1, 7, + 17, 45, 46, 67, 21, -1, 7, 17, 45, 64, + 46, 67, 21, -1, 15, 17, 21, -1, 12, 70, + 21, -1, 12, 21, -1, 13, 17, 68, 21, -1, + 14, 17, 68, 21, -1, 9, 70, 21, -1, 9, + 21, -1, 10, 21, -1, 11, 21, -1, 16, 62, + 21, -1, 6, 21, -1, 20, -1, 19, -1, 62, + -1, 63, 26, 63, -1, 63, 27, 63, -1, 63, + 28, 63, -1, 63, 29, 63, -1, 63, 30, 63, + -1, 63, 31, 63, -1, 63, 32, 63, -1, 63, + 35, 63, -1, 63, 36, 63, -1, 63, 34, 63, + -1, 63, 33, 63, -1, 63, 37, 63, -1, 63, + 38, 63, -1, 63, 40, 63, -1, 63, 39, 63, + -1, 63, 43, 63, -1, 63, 42, 63, -1, 63, + 41, 63, -1, 47, 63, -1, 48, 63, -1, 40, + 63, -1, 39, 63, -1, 45, 63, 46, -1, 17, + -1, 64, 49, 17, -1, 21, -1, 71, 21, -1, + 71, 21, -1, -1, 71, -1, -1, 71, -1, 4, + 17, -1, 4, 45, 17, 46, -1, 72, -1, 69, + -1, 70, 69, -1, 72, -1, 71, 72, -1, 17, + -1, 20, -1, 73, -1, 22, -1, 24, -1, 50, + -1, 51, -1, 45, -1, 46, -1, 52, -1, 53, + -1, 54, -1, 30, -1, 41, -1, 39, -1, 40, + -1, 48, -1, 47, -1, 42, -1, 43, -1, 38, + -1, 37, -1, 33, -1, 34, -1, 36, -1, 35, + -1, 32, -1, 31, -1, 29, -1, 28, -1, 27, + -1, 26, -1, 55, -1, 49, -1, 56, -1, 25, + -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 188, 188, 190, 194, 197, 202, 203, 207, 210, + 216, 219, 222, 225, 233, 252, 262, 267, 272, 291, + 306, 309, 312, 325, 329, 338, 343, 344, 347, 350, + 353, 356, 359, 362, 365, 368, 371, 374, 377, 380, + 383, 386, 389, 392, 395, 398, 401, 404, 407, 410, + 416, 421, 429, 430, 434, 440, 441, 444, 446, 453, + 457, 461, 466, 472, 480, 486, 494, 498, 502, 506, + 510, 517, 518, 519, 520, 521, 522, 523, 524, 525, + 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, + 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, + 546, 547 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "COMMA_FINAL", "DEFINED", + "ELIF_EXPANDED", "HASH", "HASH_DEFINE_FUNC", "HASH_DEFINE_OBJ", + "HASH_ELIF", "HASH_ELSE", "HASH_ENDIF", "HASH_IF", "HASH_IFDEF", + "HASH_IFNDEF", "HASH_UNDEF", "HASH_VERSION", "IDENTIFIER", "IF_EXPANDED", + "INTEGER", "INTEGER_STRING", "NEWLINE", "OTHER", "PLACEHOLDER", "SPACE", + "PASTE", "OR", "AND", "'|'", "'^'", "'&'", "NOT_EQUAL", "EQUAL", "'<'", + "'>'", "GREATER_OR_EQUAL", "LESS_OR_EQUAL", "RIGHT_SHIFT", "LEFT_SHIFT", + "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'!'", "'~'", + "','", "'['", "']'", "'{'", "'}'", "'.'", "';'", "'='", "$accept", + "input", "line", "expanded_line", "control_line", "integer_constant", + "expression", "identifier_list", "text_line", "non_directive", + "replacement_list", "junk", "conditional_token", "conditional_tokens", + "pp_tokens", "preprocessing_token", "operator", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 124, 94, + 38, 283, 284, 60, 62, 285, 286, 287, 288, 43, + 45, 42, 47, 37, 289, 40, 41, 33, 126, 44, + 91, 93, 123, 125, 46, 59, 61 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 57, 58, 58, 59, 59, 59, 59, 60, 60, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 62, 62, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 64, 64, 65, 65, 66, 67, 67, 68, 68, 69, + 69, 69, 70, 70, 71, 71, 72, 72, 72, 72, + 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, + 73, 73 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 1, 1, 1, 2, 3, 3, + 4, 6, 7, 3, 3, 2, 4, 4, 3, 2, + 2, 2, 3, 2, 1, 1, 1, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 2, 2, 2, 2, 3, + 1, 3, 1, 2, 2, 0, 1, 0, 1, 2, + 4, 1, 1, 2, 1, 2, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 66, 0, 67, 52, 69, + 70, 101, 97, 96, 95, 94, 78, 93, 92, 88, + 89, 91, 90, 87, 86, 80, 81, 79, 84, 85, + 73, 74, 83, 82, 99, 71, 72, 75, 76, 77, + 98, 100, 3, 6, 4, 5, 0, 64, 68, 25, + 24, 0, 0, 0, 0, 0, 26, 0, 23, 7, + 0, 0, 55, 0, 19, 62, 0, 61, 20, 21, + 15, 0, 57, 57, 0, 0, 0, 53, 65, 48, + 47, 0, 45, 46, 9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 54, 0, 0, 56, 59, 0, 18, + 63, 14, 0, 58, 0, 13, 22, 8, 49, 27, + 28, 29, 30, 31, 32, 33, 37, 36, 34, 35, + 38, 39, 41, 40, 44, 43, 42, 50, 55, 0, + 10, 0, 16, 17, 0, 55, 0, 60, 11, 0, + 51, 12 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 1, 52, 53, 54, 66, 67, 149, 55, 69, + 115, 122, 75, 76, 116, 57, 58 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -147 +static const yytype_int16 yypact[] = +{ + -147, 112, -147, 28, -10, 55, 62, 152, -15, 59, + 192, 85, 86, 87, 51, -147, 28, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, + -147, -147, -147, -147, -147, -147, 312, -147, -147, -147, + -147, 28, 28, 28, 28, 28, -147, 428, -147, -147, + 352, 63, 392, 17, -147, -147, 232, -147, -147, -147, + -147, 272, 392, 392, 84, 89, 451, -147, -147, -147, + -147, 469, -147, -147, -147, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, -147, 60, 90, 392, -147, 96, -147, + -147, -147, 93, 392, 94, -147, -147, -147, -147, 489, + 505, 520, 534, 547, 558, 558, 18, 18, 18, 18, + 563, 563, 23, 23, -147, -147, -147, -147, 392, 32, + -147, 61, -147, -147, 110, 392, 118, -147, -147, 149, + -147, -147 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -147, -147, -147, -147, -147, 157, -11, -147, -147, -147, + -146, 92, -68, 200, 0, -7, -147 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = +{ + 77, 56, 154, 77, 70, 86, 78, 15, 120, 159, + 17, 68, 19, 120, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 117, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 59, 60, 88, + 89, 90, 91, 92, 93, 106, 107, 108, 109, 110, + 111, 112, 118, 88, 110, 111, 112, 61, 62, 77, + 59, 60, 71, 63, 77, 64, 65, 147, 155, 72, + 79, 156, 123, 123, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 82, 83, 84, 125, 148, 157, 114, 88, + 126, 150, 2, 151, 152, 153, 88, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 158, 17, 18, 19, 160, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 73, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 161, 85, 17, 74, 19, 124, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 73, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 81, 0, 17, 80, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 73, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 119, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 73, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 121, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 87, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 113, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 15, + 0, 0, 17, 0, 19, 0, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 94, + 0, 0, 0, 0, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 127, 0, 0, 0, 0, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 0, 0, 128, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 108, 109, 110, 111, 112 +}; + +static const yytype_int16 yycheck[] = +{ + 7, 1, 148, 10, 4, 16, 21, 17, 76, 155, + 20, 21, 22, 81, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 17, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 19, 20, 56, + 61, 62, 63, 64, 65, 37, 38, 39, 40, 41, + 42, 43, 45, 70, 41, 42, 43, 39, 40, 76, + 19, 20, 17, 45, 81, 47, 48, 17, 46, 17, + 21, 49, 82, 83, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 17, 17, 17, 21, 46, 46, 45, 116, + 21, 21, 0, 17, 21, 21, 123, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 21, 20, 21, 22, 17, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 4, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + 21, 14, 20, 21, 22, 83, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 4, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + 10, -1, 20, 21, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 4, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, 21, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 4, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, 21, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, 21, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, 21, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 17, + -1, -1, 20, -1, 22, -1, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 21, + -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 21, -1, -1, -1, -1, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, -1, -1, 46, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 39, 40, 41, 42, 43 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 58, 0, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 59, 60, 61, 65, 71, 72, 73, 19, + 20, 39, 40, 45, 47, 48, 62, 63, 21, 66, + 71, 17, 17, 4, 21, 69, 70, 72, 21, 21, + 21, 70, 17, 17, 17, 62, 63, 21, 72, 63, + 63, 63, 63, 63, 21, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 21, 45, 67, 71, 17, 45, 21, + 69, 21, 68, 71, 68, 21, 21, 21, 46, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 17, 46, 64, + 21, 17, 21, 21, 67, 46, 49, 46, 21, 67, + 17, 21 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ + +#define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, parser, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval, &yylloc, parser) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, parser); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, glcpp_parser_t *parser) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, parser) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + glcpp_parser_t *parser; +#endif +{ + if (!yyvaluep) + return; + YYUSE (yylocationp); + YYUSE (parser); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, glcpp_parser_t *parser) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, parser) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + glcpp_parser_t *parser; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, parser); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, glcpp_parser_t *parser) +#else +static void +yy_reduce_print (yyvsp, yylsp, yyrule, parser) + YYSTYPE *yyvsp; + YYLTYPE *yylsp; + int yyrule; + glcpp_parser_t *parser; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , parser); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, yylsp, Rule, parser); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, glcpp_parser_t *parser) +#else +static void +yydestruct (yymsg, yytype, yyvaluep, yylocationp, parser) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; + YYLTYPE *yylocationp; + glcpp_parser_t *parser; +#endif +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (parser); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (glcpp_parser_t *parser); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (glcpp_parser_t *parser) +#else +int +yyparse (parser) + glcpp_parser_t *parser; +#endif +#endif +{ +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + yylsp = yyls; + +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; +#endif + +/* User initialization code. */ + +/* Line 1251 of yacc.c */ +#line 155 "glcpp/glcpp-parse.y" +{ + yylloc.first_line = 1; + yylloc.first_column = 1; + yylloc.last_line = 1; + yylloc.last_column = 1; + yylloc.source = 0; +} + +/* Line 1251 of yacc.c */ +#line 1625 "glcpp/glcpp-parse.c" + yylsp[0] = yylloc; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: + +/* Line 1464 of yacc.c */ +#line 194 "glcpp/glcpp-parse.y" + { + glcpp_print(parser->output, "\n"); + ;} + break; + + case 5: + +/* Line 1464 of yacc.c */ +#line 197 "glcpp/glcpp-parse.y" + { + _glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list)); + glcpp_print(parser->output, "\n"); + talloc_free ((yyvsp[(1) - (1)].token_list)); + ;} + break; + + case 8: + +/* Line 1464 of yacc.c */ +#line 207 "glcpp/glcpp-parse.y" + { + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival)); + ;} + break; + + case 9: + +/* Line 1464 of yacc.c */ +#line 210 "glcpp/glcpp-parse.y" + { + _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival)); + ;} + break; + + case 10: + +/* Line 1464 of yacc.c */ +#line 216 "glcpp/glcpp-parse.y" + { + _define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list)); + ;} + break; + + case 11: + +/* Line 1464 of yacc.c */ +#line 219 "glcpp/glcpp-parse.y" + { + _define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list)); + ;} + break; + + case 12: + +/* Line 1464 of yacc.c */ +#line 222 "glcpp/glcpp-parse.y" + { + _define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list)); + ;} + break; + + case 13: + +/* Line 1464 of yacc.c */ +#line 225 "glcpp/glcpp-parse.y" + { + macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str)); + if (macro) { + hash_table_remove (parser->defines, (yyvsp[(2) - (3)].str)); + talloc_free (macro); + } + talloc_free ((yyvsp[(2) - (3)].str)); + ;} + break; + + case 14: + +/* Line 1464 of yacc.c */ +#line 233 "glcpp/glcpp-parse.y" + { + /* Be careful to only evaluate the 'if' expression if + * we are not skipping. When we are skipping, we + * simply push a new 0-valued 'if' onto the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + _glcpp_parser_expand_if (parser, IF_EXPANDED, (yyvsp[(2) - (3)].token_list)); + } + else + { + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), 0); + parser->skip_stack->type = SKIP_TO_ENDIF; + } + ;} + break; + + case 15: + +/* Line 1464 of yacc.c */ +#line 252 "glcpp/glcpp-parse.y" + { + /* #if without an expression is only an error if we + * are not skipping */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + glcpp_error(& (yylsp[(1) - (2)]), parser, "#if with no expression"); + } + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (2)]), 0); + ;} + break; + + case 16: + +/* Line 1464 of yacc.c */ +#line 262 "glcpp/glcpp-parse.y" + { + macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); + talloc_free ((yyvsp[(2) - (4)].str)); + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (4)]), macro != NULL); + ;} + break; + + case 17: + +/* Line 1464 of yacc.c */ +#line 267 "glcpp/glcpp-parse.y" + { + macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str)); + talloc_free ((yyvsp[(2) - (4)].str)); + _glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (4)]), macro == NULL); + ;} + break; + + case 18: + +/* Line 1464 of yacc.c */ +#line 272 "glcpp/glcpp-parse.y" + { + /* Be careful to only evaluate the 'elif' expression + * if we are not skipping. When we are skipping, we + * simply change to a 0-valued 'elif' on the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { + _glcpp_parser_expand_if (parser, ELIF_EXPANDED, (yyvsp[(2) - (3)].token_list)); + } + else + { + _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), + "elif", 0); + } + ;} + break; + + case 19: + +/* Line 1464 of yacc.c */ +#line 291 "glcpp/glcpp-parse.y" + { + /* #elif without an expression is an error unless we + * are skipping. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { + glcpp_error(& (yylsp[(1) - (2)]), parser, "#elif with no expression"); + } + else + { + _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), + "elif", 0); + glcpp_warning(& (yylsp[(1) - (2)]), parser, "ignoring illegal #elif without expression"); + } + ;} + break; + + case 20: + +/* Line 1464 of yacc.c */ +#line 306 "glcpp/glcpp-parse.y" + { + _glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1); + ;} + break; + + case 21: + +/* Line 1464 of yacc.c */ +#line 309 "glcpp/glcpp-parse.y" + { + _glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)])); + ;} + break; + + case 22: + +/* Line 1464 of yacc.c */ +#line 312 "glcpp/glcpp-parse.y" + { + macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); + if (macro) { + hash_table_remove (parser->defines, "__VERSION__"); + talloc_free (macro); + } + add_builtin_define (parser, "__VERSION__", (yyvsp[(2) - (3)].ival)); + + if ((yyvsp[(2) - (3)].ival) == 100) + add_builtin_define (parser, "GL_ES", 1); + + glcpp_printf(parser->output, "#version %" PRIiMAX, (yyvsp[(2) - (3)].ival)); + ;} + break; + + case 24: + +/* Line 1464 of yacc.c */ +#line 329 "glcpp/glcpp-parse.y" + { + if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) { + (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16); + } else if ((yyvsp[(1) - (1)].str)[0] == '0') { + (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str), NULL, 8); + } else { + (yyval.ival) = strtoll ((yyvsp[(1) - (1)].str), NULL, 10); + } + ;} + break; + + case 25: + +/* Line 1464 of yacc.c */ +#line 338 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (1)].ival); + ;} + break; + + case 27: + +/* Line 1464 of yacc.c */ +#line 344 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival); + ;} + break; + + case 28: + +/* Line 1464 of yacc.c */ +#line 347 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival); + ;} + break; + + case 29: + +/* Line 1464 of yacc.c */ +#line 350 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); + ;} + break; + + case 30: + +/* Line 1464 of yacc.c */ +#line 353 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival); + ;} + break; + + case 31: + +/* Line 1464 of yacc.c */ +#line 356 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival); + ;} + break; + + case 32: + +/* Line 1464 of yacc.c */ +#line 359 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival); + ;} + break; + + case 33: + +/* Line 1464 of yacc.c */ +#line 362 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival); + ;} + break; + + case 34: + +/* Line 1464 of yacc.c */ +#line 365 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival); + ;} + break; + + case 35: + +/* Line 1464 of yacc.c */ +#line 368 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival); + ;} + break; + + case 36: + +/* Line 1464 of yacc.c */ +#line 371 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival); + ;} + break; + + case 37: + +/* Line 1464 of yacc.c */ +#line 374 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival); + ;} + break; + + case 38: + +/* Line 1464 of yacc.c */ +#line 377 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival); + ;} + break; + + case 39: + +/* Line 1464 of yacc.c */ +#line 380 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival); + ;} + break; + + case 40: + +/* Line 1464 of yacc.c */ +#line 383 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival); + ;} + break; + + case 41: + +/* Line 1464 of yacc.c */ +#line 386 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival); + ;} + break; + + case 42: + +/* Line 1464 of yacc.c */ +#line 389 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival); + ;} + break; + + case 43: + +/* Line 1464 of yacc.c */ +#line 392 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival); + ;} + break; + + case 44: + +/* Line 1464 of yacc.c */ +#line 395 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival); + ;} + break; + + case 45: + +/* Line 1464 of yacc.c */ +#line 398 "glcpp/glcpp-parse.y" + { + (yyval.ival) = ! (yyvsp[(2) - (2)].ival); + ;} + break; + + case 46: + +/* Line 1464 of yacc.c */ +#line 401 "glcpp/glcpp-parse.y" + { + (yyval.ival) = ~ (yyvsp[(2) - (2)].ival); + ;} + break; + + case 47: + +/* Line 1464 of yacc.c */ +#line 404 "glcpp/glcpp-parse.y" + { + (yyval.ival) = - (yyvsp[(2) - (2)].ival); + ;} + break; + + case 48: + +/* Line 1464 of yacc.c */ +#line 407 "glcpp/glcpp-parse.y" + { + (yyval.ival) = + (yyvsp[(2) - (2)].ival); + ;} + break; + + case 49: + +/* Line 1464 of yacc.c */ +#line 410 "glcpp/glcpp-parse.y" + { + (yyval.ival) = (yyvsp[(2) - (3)].ival); + ;} + break; + + case 50: + +/* Line 1464 of yacc.c */ +#line 416 "glcpp/glcpp-parse.y" + { + (yyval.string_list) = _string_list_create (parser); + _string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str)); + talloc_steal ((yyval.string_list), (yyvsp[(1) - (1)].str)); + ;} + break; + + case 51: + +/* Line 1464 of yacc.c */ +#line 421 "glcpp/glcpp-parse.y" + { + (yyval.string_list) = (yyvsp[(1) - (3)].string_list); + _string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str)); + talloc_steal ((yyval.string_list), (yyvsp[(3) - (3)].str)); + ;} + break; + + case 52: + +/* Line 1464 of yacc.c */ +#line 429 "glcpp/glcpp-parse.y" + { (yyval.token_list) = NULL; ;} + break; + + case 54: + +/* Line 1464 of yacc.c */ +#line 434 "glcpp/glcpp-parse.y" + { + yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #"); + ;} + break; + + case 55: + +/* Line 1464 of yacc.c */ +#line 440 "glcpp/glcpp-parse.y" + { (yyval.token_list) = NULL; ;} + break; + + case 58: + +/* Line 1464 of yacc.c */ +#line 446 "glcpp/glcpp-parse.y" + { + glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive"); + ;} + break; + + case 59: + +/* Line 1464 of yacc.c */ +#line 453 "glcpp/glcpp-parse.y" + { + int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0; + (yyval.token) = _token_create_ival (parser, INTEGER, v); + ;} + break; + + case 60: + +/* Line 1464 of yacc.c */ +#line 457 "glcpp/glcpp-parse.y" + { + int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0; + (yyval.token) = _token_create_ival (parser, INTEGER, v); + ;} + break; + + case 62: + +/* Line 1464 of yacc.c */ +#line 466 "glcpp/glcpp-parse.y" + { + parser->space_tokens = 1; + (yyval.token_list) = _token_list_create (parser); + _token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token)); + talloc_unlink (parser, (yyvsp[(1) - (1)].token)); + ;} + break; + + case 63: + +/* Line 1464 of yacc.c */ +#line 472 "glcpp/glcpp-parse.y" + { + (yyval.token_list) = (yyvsp[(1) - (2)].token_list); + _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); + talloc_unlink (parser, (yyvsp[(2) - (2)].token)); + ;} + break; + + case 64: + +/* Line 1464 of yacc.c */ +#line 480 "glcpp/glcpp-parse.y" + { + parser->space_tokens = 1; + (yyval.token_list) = _token_list_create (parser); + _token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token)); + talloc_unlink (parser, (yyvsp[(1) - (1)].token)); + ;} + break; + + case 65: + +/* Line 1464 of yacc.c */ +#line 486 "glcpp/glcpp-parse.y" + { + (yyval.token_list) = (yyvsp[(1) - (2)].token_list); + _token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token)); + talloc_unlink (parser, (yyvsp[(2) - (2)].token)); + ;} + break; + + case 66: + +/* Line 1464 of yacc.c */ +#line 494 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str)); + (yyval.token)->location = yylloc; + ;} + break; + + case 67: + +/* Line 1464 of yacc.c */ +#line 498 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str)); + (yyval.token)->location = yylloc; + ;} + break; + + case 68: + +/* Line 1464 of yacc.c */ +#line 502 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival)); + (yyval.token)->location = yylloc; + ;} + break; + + case 69: + +/* Line 1464 of yacc.c */ +#line 506 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str)); + (yyval.token)->location = yylloc; + ;} + break; + + case 70: + +/* Line 1464 of yacc.c */ +#line 510 "glcpp/glcpp-parse.y" + { + (yyval.token) = _token_create_ival (parser, SPACE, SPACE); + (yyval.token)->location = yylloc; + ;} + break; + + case 71: + +/* Line 1464 of yacc.c */ +#line 517 "glcpp/glcpp-parse.y" + { (yyval.ival) = '['; ;} + break; + + case 72: + +/* Line 1464 of yacc.c */ +#line 518 "glcpp/glcpp-parse.y" + { (yyval.ival) = ']'; ;} + break; + + case 73: + +/* Line 1464 of yacc.c */ +#line 519 "glcpp/glcpp-parse.y" + { (yyval.ival) = '('; ;} + break; + + case 74: + +/* Line 1464 of yacc.c */ +#line 520 "glcpp/glcpp-parse.y" + { (yyval.ival) = ')'; ;} + break; + + case 75: + +/* Line 1464 of yacc.c */ +#line 521 "glcpp/glcpp-parse.y" + { (yyval.ival) = '{'; ;} + break; + + case 76: + +/* Line 1464 of yacc.c */ +#line 522 "glcpp/glcpp-parse.y" + { (yyval.ival) = '}'; ;} + break; + + case 77: + +/* Line 1464 of yacc.c */ +#line 523 "glcpp/glcpp-parse.y" + { (yyval.ival) = '.'; ;} + break; + + case 78: + +/* Line 1464 of yacc.c */ +#line 524 "glcpp/glcpp-parse.y" + { (yyval.ival) = '&'; ;} + break; + + case 79: + +/* Line 1464 of yacc.c */ +#line 525 "glcpp/glcpp-parse.y" + { (yyval.ival) = '*'; ;} + break; + + case 80: + +/* Line 1464 of yacc.c */ +#line 526 "glcpp/glcpp-parse.y" + { (yyval.ival) = '+'; ;} + break; + + case 81: + +/* Line 1464 of yacc.c */ +#line 527 "glcpp/glcpp-parse.y" + { (yyval.ival) = '-'; ;} + break; + + case 82: + +/* Line 1464 of yacc.c */ +#line 528 "glcpp/glcpp-parse.y" + { (yyval.ival) = '~'; ;} + break; + + case 83: + +/* Line 1464 of yacc.c */ +#line 529 "glcpp/glcpp-parse.y" + { (yyval.ival) = '!'; ;} + break; + + case 84: + +/* Line 1464 of yacc.c */ +#line 530 "glcpp/glcpp-parse.y" + { (yyval.ival) = '/'; ;} + break; + + case 85: + +/* Line 1464 of yacc.c */ +#line 531 "glcpp/glcpp-parse.y" + { (yyval.ival) = '%'; ;} + break; + + case 86: + +/* Line 1464 of yacc.c */ +#line 532 "glcpp/glcpp-parse.y" + { (yyval.ival) = LEFT_SHIFT; ;} + break; + + case 87: + +/* Line 1464 of yacc.c */ +#line 533 "glcpp/glcpp-parse.y" + { (yyval.ival) = RIGHT_SHIFT; ;} + break; + + case 88: + +/* Line 1464 of yacc.c */ +#line 534 "glcpp/glcpp-parse.y" + { (yyval.ival) = '<'; ;} + break; + + case 89: + +/* Line 1464 of yacc.c */ +#line 535 "glcpp/glcpp-parse.y" + { (yyval.ival) = '>'; ;} + break; + + case 90: + +/* Line 1464 of yacc.c */ +#line 536 "glcpp/glcpp-parse.y" + { (yyval.ival) = LESS_OR_EQUAL; ;} + break; + + case 91: + +/* Line 1464 of yacc.c */ +#line 537 "glcpp/glcpp-parse.y" + { (yyval.ival) = GREATER_OR_EQUAL; ;} + break; + + case 92: + +/* Line 1464 of yacc.c */ +#line 538 "glcpp/glcpp-parse.y" + { (yyval.ival) = EQUAL; ;} + break; + + case 93: + +/* Line 1464 of yacc.c */ +#line 539 "glcpp/glcpp-parse.y" + { (yyval.ival) = NOT_EQUAL; ;} + break; + + case 94: + +/* Line 1464 of yacc.c */ +#line 540 "glcpp/glcpp-parse.y" + { (yyval.ival) = '^'; ;} + break; + + case 95: + +/* Line 1464 of yacc.c */ +#line 541 "glcpp/glcpp-parse.y" + { (yyval.ival) = '|'; ;} + break; + + case 96: + +/* Line 1464 of yacc.c */ +#line 542 "glcpp/glcpp-parse.y" + { (yyval.ival) = AND; ;} + break; + + case 97: + +/* Line 1464 of yacc.c */ +#line 543 "glcpp/glcpp-parse.y" + { (yyval.ival) = OR; ;} + break; + + case 98: + +/* Line 1464 of yacc.c */ +#line 544 "glcpp/glcpp-parse.y" + { (yyval.ival) = ';'; ;} + break; + + case 99: + +/* Line 1464 of yacc.c */ +#line 545 "glcpp/glcpp-parse.y" + { (yyval.ival) = ','; ;} + break; + + case 100: + +/* Line 1464 of yacc.c */ +#line 546 "glcpp/glcpp-parse.y" + { (yyval.ival) = '='; ;} + break; + + case 101: + +/* Line 1464 of yacc.c */ +#line 547 "glcpp/glcpp-parse.y" + { (yyval.ival) = PASTE; ;} + break; + + + +/* Line 1464 of yacc.c */ +#line 2656 "glcpp/glcpp-parse.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, parser, YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (&yylloc, parser, yymsg); + } + else + { + yyerror (&yylloc, parser, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + yyerror_range[1] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, parser); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[1] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[1] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, parser); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + yyerror_range[2] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, parser, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, parser); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, parser); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1684 of yacc.c */ +#line 550 "glcpp/glcpp-parse.y" + + +string_list_t * +_string_list_create (void *ctx) +{ + string_list_t *list; + + list = talloc (ctx, string_list_t); + list->head = NULL; + list->tail = NULL; + + return list; +} + +void +_string_list_append_item (string_list_t *list, const char *str) +{ + string_node_t *node; + + node = talloc (list, string_node_t); + node->str = talloc_strdup (node, str); + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; +} + +int +_string_list_contains (string_list_t *list, const char *member, int *index) +{ + string_node_t *node; + int i; + + if (list == NULL) + return 0; + + for (i = 0, node = list->head; node; i++, node = node->next) { + if (strcmp (node->str, member) == 0) { + if (index) + *index = i; + return 1; + } + } + + return 0; +} + +int +_string_list_length (string_list_t *list) +{ + int length = 0; + string_node_t *node; + + if (list == NULL) + return 0; + + for (node = list->head; node; node = node->next) + length++; + + return length; +} + +int +_string_list_equal (string_list_t *a, string_list_t *b) +{ + string_node_t *node_a, *node_b; + + if (a == NULL && b == NULL) + return 1; + + if (a == NULL || b == NULL) + return 0; + + for (node_a = a->head, node_b = b->head; + node_a && node_b; + node_a = node_a->next, node_b = node_b->next) + { + if (strcmp (node_a->str, node_b->str)) + return 0; + } + + /* Catch the case of lists being different lengths, (which + * would cause the loop above to terminate after the shorter + * list). */ + return node_a == node_b; +} + +argument_list_t * +_argument_list_create (void *ctx) +{ + argument_list_t *list; + + list = talloc (ctx, argument_list_t); + list->head = NULL; + list->tail = NULL; + + return list; +} + +void +_argument_list_append (argument_list_t *list, token_list_t *argument) +{ + argument_node_t *node; + + node = talloc (list, argument_node_t); + node->argument = argument; + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; +} + +int +_argument_list_length (argument_list_t *list) +{ + int length = 0; + argument_node_t *node; + + if (list == NULL) + return 0; + + for (node = list->head; node; node = node->next) + length++; + + return length; +} + +token_list_t * +_argument_list_member_at (argument_list_t *list, int index) +{ + argument_node_t *node; + int i; + + if (list == NULL) + return NULL; + + node = list->head; + for (i = 0; i < index; i++) { + node = node->next; + if (node == NULL) + break; + } + + if (node) + return node->argument; + + return NULL; +} + +/* Note: This function talloc_steal()s the str pointer. */ +token_t * +_token_create_str (void *ctx, int type, char *str) +{ + token_t *token; + + token = talloc (ctx, token_t); + token->type = type; + token->value.str = talloc_steal (token, str); + + return token; +} + +token_t * +_token_create_ival (void *ctx, int type, int ival) +{ + token_t *token; + + token = talloc (ctx, token_t); + token->type = type; + token->value.ival = ival; + + return token; +} + +token_list_t * +_token_list_create (void *ctx) +{ + token_list_t *list; + + list = talloc (ctx, token_list_t); + list->head = NULL; + list->tail = NULL; + list->non_space_tail = NULL; + + return list; +} + +void +_token_list_append (token_list_t *list, token_t *token) +{ + token_node_t *node; + + node = talloc (list, token_node_t); + node->token = talloc_reference (list, token); + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; + if (token->type != SPACE) + list->non_space_tail = node; +} + +void +_token_list_append_list (token_list_t *list, token_list_t *tail) +{ + if (tail == NULL || tail->head == NULL) + return; + + if (list->head == NULL) { + list->head = tail->head; + } else { + list->tail->next = tail->head; + } + + list->tail = tail->tail; + list->non_space_tail = tail->non_space_tail; +} + +static token_list_t * +_token_list_copy (void *ctx, token_list_t *other) +{ + token_list_t *copy; + token_node_t *node; + + if (other == NULL) + return NULL; + + copy = _token_list_create (ctx); + for (node = other->head; node; node = node->next) + _token_list_append (copy, node->token); + + return copy; +} + +static void +_token_list_trim_trailing_space (token_list_t *list) +{ + token_node_t *tail, *next; + + if (list->non_space_tail) { + tail = list->non_space_tail->next; + list->non_space_tail->next = NULL; + list->tail = list->non_space_tail; + + while (tail) { + next = tail->next; + talloc_free (tail); + tail = next; + } + } +} + +int +_token_list_equal_ignoring_space (token_list_t *a, token_list_t *b) +{ + token_node_t *node_a, *node_b; + + node_a = a->head; + node_b = b->head; + + while (1) + { + if (node_a == NULL && node_b == NULL) + break; + + if (node_a == NULL || node_b == NULL) + return 0; + + if (node_a->token->type == SPACE) { + node_a = node_a->next; + continue; + } + + if (node_b->token->type == SPACE) { + node_b = node_b->next; + continue; + } + + if (node_a->token->type != node_b->token->type) + return 0; + + switch (node_a->token->type) { + case INTEGER: + if (node_a->token->value.ival != + node_b->token->value.ival) + { + return 0; + } + break; + case IDENTIFIER: + case INTEGER_STRING: + case OTHER: + if (strcmp (node_a->token->value.str, + node_b->token->value.str)) + { + return 0; + } + break; + } + + node_a = node_a->next; + node_b = node_b->next; + } + + return 1; +} + +static void +_token_print (char **out, token_t *token) +{ + if (token->type < 256) { + glcpp_printf (*out, "%c", token->type); + return; + } + + switch (token->type) { + case INTEGER: + glcpp_printf (*out, "%" PRIiMAX, token->value.ival); + break; + case IDENTIFIER: + case INTEGER_STRING: + case OTHER: + glcpp_print (*out, token->value.str); + break; + case SPACE: + glcpp_print (*out, " "); + break; + case LEFT_SHIFT: + glcpp_print (*out, "<<"); + break; + case RIGHT_SHIFT: + glcpp_print (*out, ">>"); + break; + case LESS_OR_EQUAL: + glcpp_print (*out, "<="); + break; + case GREATER_OR_EQUAL: + glcpp_print (*out, ">="); + break; + case EQUAL: + glcpp_print (*out, "=="); + break; + case NOT_EQUAL: + glcpp_print (*out, "!="); + break; + case AND: + glcpp_print (*out, "&&"); + break; + case OR: + glcpp_print (*out, "||"); + break; + case PASTE: + glcpp_print (*out, "##"); + break; + case COMMA_FINAL: + glcpp_print (*out, ","); + break; + case PLACEHOLDER: + /* Nothing to print. */ + break; + default: + assert(!"Error: Don't know how to print token."); + break; + } +} + +/* Return a new token (talloc()ed off of 'token') formed by pasting + * 'token' and 'other'. Note that this function may return 'token' or + * 'other' directly rather than allocating anything new. + * + * Caution: Only very cursory error-checking is performed to see if + * the final result is a valid single token. */ +static token_t * +_token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) +{ + token_t *combined = NULL; + + /* Pasting a placeholder onto anything makes no change. */ + if (other->type == PLACEHOLDER) + return token; + + /* When 'token' is a placeholder, just return 'other'. */ + if (token->type == PLACEHOLDER) + return other; + + /* A very few single-character punctuators can be combined + * with another to form a multi-character punctuator. */ + switch (token->type) { + case '<': + if (other->type == '<') + combined = _token_create_ival (token, LEFT_SHIFT, LEFT_SHIFT); + else if (other->type == '=') + combined = _token_create_ival (token, LESS_OR_EQUAL, LESS_OR_EQUAL); + break; + case '>': + if (other->type == '>') + combined = _token_create_ival (token, RIGHT_SHIFT, RIGHT_SHIFT); + else if (other->type == '=') + combined = _token_create_ival (token, GREATER_OR_EQUAL, GREATER_OR_EQUAL); + break; + case '=': + if (other->type == '=') + combined = _token_create_ival (token, EQUAL, EQUAL); + break; + case '!': + if (other->type == '=') + combined = _token_create_ival (token, NOT_EQUAL, NOT_EQUAL); + break; + case '&': + if (other->type == '&') + combined = _token_create_ival (token, AND, AND); + break; + case '|': + if (other->type == '|') + combined = _token_create_ival (token, OR, OR); + break; + } + + if (combined != NULL) { + /* Inherit the location from the first token */ + combined->location = token->location; + return combined; + } + + /* Two string-valued tokens can usually just be mashed + * together. + * + * XXX: This isn't actually legitimate. Several things here + * should result in a diagnostic since the result cannot be a + * valid, single pre-processing token. For example, pasting + * "123" and "abc" is not legal, but we don't catch that + * here. */ + if ((token->type == IDENTIFIER || token->type == OTHER || token->type == INTEGER_STRING) && + (other->type == IDENTIFIER || other->type == OTHER || other->type == INTEGER_STRING)) + { + char *str; + + str = talloc_asprintf (token, "%s%s", token->value.str, + other->value.str); + combined = _token_create_str (token, token->type, str); + combined->location = token->location; + return combined; + } + + glcpp_error (&token->location, parser, ""); + glcpp_print (parser->info_log, "Pasting \""); + _token_print (&parser->info_log, token); + glcpp_print (parser->info_log, "\" and \""); + _token_print (&parser->info_log, other); + glcpp_print (parser->info_log, "\" does not give a valid preprocessing token.\n"); + + return token; +} + +static void +_token_list_print (glcpp_parser_t *parser, token_list_t *list) +{ + token_node_t *node; + + if (list == NULL) + return; + + for (node = list->head; node; node = node->next) + _token_print (&parser->output, node->token); +} + +void +yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error) +{ + glcpp_error(locp, parser, "%s", error); +} + +static void add_builtin_define(glcpp_parser_t *parser, + const char *name, int value) +{ + token_t *tok; + token_list_t *list; + + tok = _token_create_ival (parser, INTEGER, value); + + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, name, list); + + talloc_unlink(parser, tok); +} + +glcpp_parser_t * +glcpp_parser_create (const struct gl_extensions *extensions, int api) +{ + glcpp_parser_t *parser; + int language_version; + + parser = talloc (NULL, glcpp_parser_t); + + glcpp_lex_init_extra (parser, &parser->scanner); + parser->defines = hash_table_ctor (32, hash_table_string_hash, + hash_table_string_compare); + parser->active = NULL; + parser->lexing_if = 0; + parser->space_tokens = 1; + parser->newline_as_space = 0; + parser->in_control_line = 0; + parser->paren_count = 0; + + parser->skip_stack = NULL; + + parser->lex_from_list = NULL; + parser->lex_from_node = NULL; + + parser->output = talloc_strdup(parser, ""); + parser->info_log = talloc_strdup(parser, ""); + parser->error = 0; + + /* Add pre-defined macros. */ + add_builtin_define(parser, "GL_ARB_draw_buffers", 1); + add_builtin_define(parser, "GL_ARB_texture_rectangle", 1); + + if (api == API_OPENGLES2) + add_builtin_define(parser, "GL_ES", 1); + + if (extensions != NULL) { + if (extensions->EXT_texture_array) { + add_builtin_define(parser, "GL_EXT_texture_array", 1); + } + + if (extensions->ARB_fragment_coord_conventions) + add_builtin_define(parser, "GL_ARB_fragment_coord_conventions", + 1); + } + + language_version = 110; + add_builtin_define(parser, "__VERSION__", language_version); + + return parser; +} + +int +glcpp_parser_parse (glcpp_parser_t *parser) +{ + return yyparse (parser); +} + +void +glcpp_parser_destroy (glcpp_parser_t *parser) +{ + glcpp_lex_destroy (parser->scanner); + hash_table_dtor (parser->defines); + talloc_free (parser); +} + +typedef enum function_status +{ + FUNCTION_STATUS_SUCCESS, + FUNCTION_NOT_A_FUNCTION, + FUNCTION_UNBALANCED_PARENTHESES +} function_status_t; + +/* Find a set of function-like macro arguments by looking for a + * balanced set of parentheses. + * + * When called, 'node' should be the opening-parenthesis token, (or + * perhaps preceeding SPACE tokens). Upon successful return *last will + * be the last consumed node, (corresponding to the closing right + * parenthesis). + * + * Return values: + * + * FUNCTION_STATUS_SUCCESS: + * + * Successfully parsed a set of function arguments. + * + * FUNCTION_NOT_A_FUNCTION: + * + * Macro name not followed by a '('. This is not an error, but + * simply that the macro name should be treated as a non-macro. + * + * FUNCTION_UNBALANCED_PARENTHESES + * + * Macro name is not followed by a balanced set of parentheses. + */ +static function_status_t +_arguments_parse (argument_list_t *arguments, + token_node_t *node, + token_node_t **last) +{ + token_list_t *argument; + int paren_count; + + node = node->next; + + /* Ignore whitespace before first parenthesis. */ + while (node && node->token->type == SPACE) + node = node->next; + + if (node == NULL || node->token->type != '(') + return FUNCTION_NOT_A_FUNCTION; + + node = node->next; + + argument = _token_list_create (arguments); + _argument_list_append (arguments, argument); + + for (paren_count = 1; node; node = node->next) { + if (node->token->type == '(') + { + paren_count++; + } + else if (node->token->type == ')') + { + paren_count--; + if (paren_count == 0) + break; + } + + if (node->token->type == ',' && + paren_count == 1) + { + _token_list_trim_trailing_space (argument); + argument = _token_list_create (arguments); + _argument_list_append (arguments, argument); + } + else { + if (argument->head == NULL) { + /* Don't treat initial whitespace as + * part of the arguement. */ + if (node->token->type == SPACE) + continue; + } + _token_list_append (argument, node->token); + } + } + + if (paren_count) + return FUNCTION_UNBALANCED_PARENTHESES; + + *last = node; + + return FUNCTION_STATUS_SUCCESS; +} + +static token_list_t * +_token_list_create_with_one_space (void *ctx) +{ + token_list_t *list; + token_t *space; + + list = _token_list_create (ctx); + space = _token_create_ival (list, SPACE, SPACE); + _token_list_append (list, space); + + return list; +} + +static void +_glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list) +{ + token_list_t *expanded; + token_t *token; + + expanded = _token_list_create (parser); + token = _token_create_ival (parser, type, type); + _token_list_append (expanded, token); + _glcpp_parser_expand_token_list (parser, list); + _token_list_append_list (expanded, list); + glcpp_parser_lex_from (parser, expanded); +} + +/* This is a helper function that's essentially part of the + * implementation of _glcpp_parser_expand_node. It shouldn't be called + * except for by that function. + * + * Returns NULL if node is a simple token with no expansion, (that is, + * although 'node' corresponds to an identifier defined as a + * function-like macro, it is not followed with a parenthesized + * argument list). + * + * Compute the complete expansion of node (which is a function-like + * macro) and subsequent nodes which are arguments. + * + * Returns the token list that results from the expansion and sets + * *last to the last node in the list that was consumed by the + * expansion. Specifically, *last will be set as follows: as the + * token of the closing right parenthesis. + */ +static token_list_t * +_glcpp_parser_expand_function (glcpp_parser_t *parser, + token_node_t *node, + token_node_t **last) + +{ + macro_t *macro; + const char *identifier; + argument_list_t *arguments; + function_status_t status; + token_list_t *substituted; + int parameter_index; + + identifier = node->token->value.str; + + macro = hash_table_find (parser->defines, identifier); + + assert (macro->is_function); + + arguments = _argument_list_create (parser); + status = _arguments_parse (arguments, node, last); + + switch (status) { + case FUNCTION_STATUS_SUCCESS: + break; + case FUNCTION_NOT_A_FUNCTION: + return NULL; + case FUNCTION_UNBALANCED_PARENTHESES: + glcpp_error (&node->token->location, parser, "Macro %s call has unbalanced parentheses\n", identifier); + return NULL; + } + + /* Replace a macro defined as empty with a SPACE token. */ + if (macro->replacements == NULL) { + talloc_free (arguments); + return _token_list_create_with_one_space (parser); + } + + if (! ((_argument_list_length (arguments) == + _string_list_length (macro->parameters)) || + (_string_list_length (macro->parameters) == 0 && + _argument_list_length (arguments) == 1 && + arguments->head->argument->head == NULL))) + { + glcpp_error (&node->token->location, parser, + "Error: macro %s invoked with %d arguments (expected %d)\n", + identifier, + _argument_list_length (arguments), + _string_list_length (macro->parameters)); + return NULL; + } + + /* Perform argument substitution on the replacement list. */ + substituted = _token_list_create (arguments); + + for (node = macro->replacements->head; node; node = node->next) + { + if (node->token->type == IDENTIFIER && + _string_list_contains (macro->parameters, + node->token->value.str, + ¶meter_index)) + { + token_list_t *argument; + argument = _argument_list_member_at (arguments, + parameter_index); + /* Before substituting, we expand the argument + * tokens, or append a placeholder token for + * an empty argument. */ + if (argument->head) { + token_list_t *expanded_argument; + expanded_argument = _token_list_copy (parser, + argument); + _glcpp_parser_expand_token_list (parser, + expanded_argument); + _token_list_append_list (substituted, + expanded_argument); + } else { + token_t *new_token; + + new_token = _token_create_ival (substituted, + PLACEHOLDER, + PLACEHOLDER); + _token_list_append (substituted, new_token); + } + } else { + _token_list_append (substituted, node->token); + } + } + + /* After argument substitution, and before further expansion + * below, implement token pasting. */ + + _token_list_trim_trailing_space (substituted); + + node = substituted->head; + while (node) + { + token_node_t *next_non_space; + + /* Look ahead for a PASTE token, skipping space. */ + next_non_space = node->next; + while (next_non_space && next_non_space->token->type == SPACE) + next_non_space = next_non_space->next; + + if (next_non_space == NULL) + break; + + if (next_non_space->token->type != PASTE) { + node = next_non_space; + continue; + } + + /* Now find the next non-space token after the PASTE. */ + next_non_space = next_non_space->next; + while (next_non_space && next_non_space->token->type == SPACE) + next_non_space = next_non_space->next; + + if (next_non_space == NULL) { + yyerror (&node->token->location, parser, "'##' cannot appear at either end of a macro expansion\n"); + return NULL; + } + + node->token = _token_paste (parser, node->token, next_non_space->token); + node->next = next_non_space->next; + if (next_non_space == substituted->tail) + substituted->tail = node; + + node = node->next; + } + + substituted->non_space_tail = substituted->tail; + + return substituted; +} + +/* Compute the complete expansion of node, (and subsequent nodes after + * 'node' in the case that 'node' is a function-like macro and + * subsequent nodes are arguments). + * + * Returns NULL if node is a simple token with no expansion. + * + * Otherwise, returns the token list that results from the expansion + * and sets *last to the last node in the list that was consumed by + * the expansion. Specifically, *last will be set as follows: + * + * As 'node' in the case of object-like macro expansion. + * + * As the token of the closing right parenthesis in the case of + * function-like macro expansion. + */ +static token_list_t * +_glcpp_parser_expand_node (glcpp_parser_t *parser, + token_node_t *node, + token_node_t **last) +{ + token_t *token = node->token; + const char *identifier; + macro_t *macro; + + /* We only expand identifiers */ + if (token->type != IDENTIFIER) { + /* We change any COMMA into a COMMA_FINAL to prevent + * it being mistaken for an argument separator + * later. */ + if (token->type == ',') { + token->type = COMMA_FINAL; + token->value.ival = COMMA_FINAL; + } + + return NULL; + } + + /* Look up this identifier in the hash table. */ + identifier = token->value.str; + macro = hash_table_find (parser->defines, identifier); + + /* Not a macro, so no expansion needed. */ + if (macro == NULL) + return NULL; + + /* Finally, don't expand this macro if we're already actively + * expanding it, (to avoid infinite recursion). */ + if (_active_list_contains (parser->active, identifier)) { + /* We change the token type here from IDENTIFIER to + * OTHER to prevent any future expansion of this + * unexpanded token. */ + char *str; + token_list_t *expansion; + token_t *final; + + str = talloc_strdup (parser, token->value.str); + final = _token_create_str (parser, OTHER, str); + expansion = _token_list_create (parser); + _token_list_append (expansion, final); + *last = node; + return expansion; + } + + if (! macro->is_function) + { + *last = node; + + /* Replace a macro defined as empty with a SPACE token. */ + if (macro->replacements == NULL) + return _token_list_create_with_one_space (parser); + + return _token_list_copy (parser, macro->replacements); + } + + return _glcpp_parser_expand_function (parser, node, last); +} + +/* Push a new identifier onto the active list, returning the new list. + * + * Here, 'marker' is the token node that appears in the list after the + * expansion of 'identifier'. That is, when the list iterator begins + * examinging 'marker', then it is time to pop this node from the + * active stack. + */ +active_list_t * +_active_list_push (active_list_t *list, + const char *identifier, + token_node_t *marker) +{ + active_list_t *node; + + node = talloc (list, active_list_t); + node->identifier = talloc_strdup (node, identifier); + node->marker = marker; + node->next = list; + + return node; +} + +active_list_t * +_active_list_pop (active_list_t *list) +{ + active_list_t *node = list; + + if (node == NULL) + return NULL; + + node = list->next; + talloc_free (list); + + return node; +} + +int +_active_list_contains (active_list_t *list, const char *identifier) +{ + active_list_t *node; + + if (list == NULL) + return 0; + + for (node = list; node; node = node->next) + if (strcmp (node->identifier, identifier) == 0) + return 1; + + return 0; +} + +/* Walk over the token list replacing nodes with their expansion. + * Whenever nodes are expanded the walking will walk over the new + * nodes, continuing to expand as necessary. The results are placed in + * 'list' itself; + */ +static void +_glcpp_parser_expand_token_list (glcpp_parser_t *parser, + token_list_t *list) +{ + token_node_t *node_prev; + token_node_t *node, *last = NULL; + token_list_t *expansion; + + if (list == NULL) + return; + + _token_list_trim_trailing_space (list); + + node_prev = NULL; + node = list->head; + + while (node) { + + while (parser->active && parser->active->marker == node) + parser->active = _active_list_pop (parser->active); + + /* Find the expansion for node, which will replace all + * nodes from node to last, inclusive. */ + expansion = _glcpp_parser_expand_node (parser, node, &last); + if (expansion) { + token_node_t *n; + + for (n = node; n != last->next; n = n->next) + while (parser->active && + parser->active->marker == n) + { + parser->active = _active_list_pop (parser->active); + } + + parser->active = _active_list_push (parser->active, + node->token->value.str, + last->next); + + /* Splice expansion into list, supporting a + * simple deletion if the expansion is + * empty. */ + if (expansion->head) { + if (node_prev) + node_prev->next = expansion->head; + else + list->head = expansion->head; + expansion->tail->next = last->next; + if (last == list->tail) + list->tail = expansion->tail; + } else { + if (node_prev) + node_prev->next = last->next; + else + list->head = last->next; + if (last == list->tail) + list->tail = NULL; + } + } else { + node_prev = node; + } + node = node_prev ? node_prev->next : list->head; + } + + while (parser->active) + parser->active = _active_list_pop (parser->active); + + list->non_space_tail = list->tail; +} + +void +_glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser, + token_list_t *list) +{ + if (list == NULL) + return; + + _glcpp_parser_expand_token_list (parser, list); + + _token_list_trim_trailing_space (list); + + _token_list_print (parser, list); +} + +static void +_check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc, + const char *identifier) +{ + /* According to the GLSL specification, macro names starting with "__" + * or "GL_" are reserved for future use. So, don't allow them. + */ + if (strncmp(identifier, "__", 2) == 0) { + glcpp_error (loc, parser, "Macro names starting with \"__\" are reserved.\n"); + } + if (strncmp(identifier, "GL_", 3) == 0) { + glcpp_error (loc, parser, "Macro names starting with \"GL_\" are reserved.\n"); + } +} + +static int +_macro_equal (macro_t *a, macro_t *b) +{ + if (a->is_function != b->is_function) + return 0; + + if (a->is_function) { + if (! _string_list_equal (a->parameters, b->parameters)) + return 0; + } + + return _token_list_equal_ignoring_space (a->replacements, + b->replacements); +} + +void +_define_object_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *identifier, + token_list_t *replacements) +{ + macro_t *macro, *previous; + + if (loc != NULL) + _check_for_reserved_macro_name(parser, loc, identifier); + + macro = talloc (parser, macro_t); + + macro->is_function = 0; + macro->parameters = NULL; + macro->identifier = talloc_strdup (macro, identifier); + macro->replacements = talloc_steal (macro, replacements); + + previous = hash_table_find (parser->defines, identifier); + if (previous) { + if (_macro_equal (macro, previous)) { + talloc_free (macro); + return; + } + glcpp_error (loc, parser, "Redefinition of macro %s\n", + identifier); + } + + hash_table_insert (parser->defines, macro, identifier); +} + +void +_define_function_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *identifier, + string_list_t *parameters, + token_list_t *replacements) +{ + macro_t *macro, *previous; + + _check_for_reserved_macro_name(parser, loc, identifier); + + macro = talloc (parser, macro_t); + + macro->is_function = 1; + macro->parameters = talloc_steal (macro, parameters); + macro->identifier = talloc_strdup (macro, identifier); + macro->replacements = talloc_steal (macro, replacements); + + previous = hash_table_find (parser->defines, identifier); + if (previous) { + if (_macro_equal (macro, previous)) { + talloc_free (macro); + return; + } + glcpp_error (loc, parser, "Redefinition of macro %s\n", + identifier); + } + + hash_table_insert (parser->defines, macro, identifier); +} + +static int +glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser) +{ + token_node_t *node; + int ret; + + if (parser->lex_from_list == NULL) { + ret = glcpp_lex (yylval, yylloc, parser->scanner); + + /* XXX: This ugly block of code exists for the sole + * purpose of converting a NEWLINE token into a SPACE + * token, but only in the case where we have seen a + * function-like macro name, but have not yet seen its + * closing parenthesis. + * + * There's perhaps a more compact way to do this with + * mid-rule actions in the grammar. + * + * I'm definitely not pleased with the complexity of + * this code here. + */ + if (parser->newline_as_space) + { + if (ret == '(') { + parser->paren_count++; + } else if (ret == ')') { + parser->paren_count--; + if (parser->paren_count == 0) + parser->newline_as_space = 0; + } else if (ret == NEWLINE) { + ret = SPACE; + } else if (ret != SPACE) { + if (parser->paren_count == 0) + parser->newline_as_space = 0; + } + } + else if (parser->in_control_line) + { + if (ret == NEWLINE) + parser->in_control_line = 0; + } + else if (ret == HASH_DEFINE_OBJ || ret == HASH_DEFINE_FUNC || + ret == HASH_UNDEF || ret == HASH_IF || + ret == HASH_IFDEF || ret == HASH_IFNDEF || + ret == HASH_ELIF || ret == HASH_ELSE || + ret == HASH_ENDIF || ret == HASH) + { + parser->in_control_line = 1; + } + else if (ret == IDENTIFIER) + { + macro_t *macro; + macro = hash_table_find (parser->defines, + yylval->str); + if (macro && macro->is_function) { + parser->newline_as_space = 1; + parser->paren_count = 0; + } + } + + return ret; + } + + node = parser->lex_from_node; + + if (node == NULL) { + talloc_free (parser->lex_from_list); + parser->lex_from_list = NULL; + return NEWLINE; + } + + *yylval = node->token->value; + ret = node->token->type; + + parser->lex_from_node = node->next; + + return ret; +} + +static void +glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list) +{ + token_node_t *node; + + assert (parser->lex_from_list == NULL); + + /* Copy list, eliminating any space tokens. */ + parser->lex_from_list = _token_list_create (parser); + + for (node = list->head; node; node = node->next) { + if (node->token->type == SPACE) + continue; + _token_list_append (parser->lex_from_list, node->token); + } + + talloc_free (list); + + parser->lex_from_node = parser->lex_from_list->head; + + /* It's possible the list consisted of nothing but whitespace. */ + if (parser->lex_from_node == NULL) { + talloc_free (parser->lex_from_list); + parser->lex_from_list = NULL; + } +} + +static void +_glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, + int condition) +{ + skip_type_t current = SKIP_NO_SKIP; + skip_node_t *node; + + if (parser->skip_stack) + current = parser->skip_stack->type; + + node = talloc (parser, skip_node_t); + node->loc = *loc; + + if (current == SKIP_NO_SKIP) { + if (condition) + node->type = SKIP_NO_SKIP; + else + node->type = SKIP_TO_ELSE; + } else { + node->type = SKIP_TO_ENDIF; + } + + node->next = parser->skip_stack; + parser->skip_stack = node; +} + +static void +_glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc, + const char *type, int condition) +{ + if (parser->skip_stack == NULL) { + glcpp_error (loc, parser, "%s without #if\n", type); + return; + } + + if (parser->skip_stack->type == SKIP_TO_ELSE) { + if (condition) + parser->skip_stack->type = SKIP_NO_SKIP; + } else { + parser->skip_stack->type = SKIP_TO_ENDIF; + } +} + +static void +_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc) +{ + skip_node_t *node; + + if (parser->skip_stack == NULL) { + glcpp_error (loc, parser, "#endif without #if\n"); + return; + } + + node = parser->skip_stack; + parser->skip_stack = node->next; + talloc_free (node); +} + diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.h b/mesalib/src/glsl/glcpp/glcpp-parse.h new file mode 100644 index 000000000..40556854f --- /dev/null +++ b/mesalib/src/glsl/glcpp/glcpp-parse.h @@ -0,0 +1,100 @@ +/* A Bison parser, made by GNU Bison 2.4.3. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + COMMA_FINAL = 258, + DEFINED = 259, + ELIF_EXPANDED = 260, + HASH = 261, + HASH_DEFINE_FUNC = 262, + HASH_DEFINE_OBJ = 263, + HASH_ELIF = 264, + HASH_ELSE = 265, + HASH_ENDIF = 266, + HASH_IF = 267, + HASH_IFDEF = 268, + HASH_IFNDEF = 269, + HASH_UNDEF = 270, + HASH_VERSION = 271, + IDENTIFIER = 272, + IF_EXPANDED = 273, + INTEGER = 274, + INTEGER_STRING = 275, + NEWLINE = 276, + OTHER = 277, + PLACEHOLDER = 278, + SPACE = 279, + PASTE = 280, + OR = 281, + AND = 282, + NOT_EQUAL = 283, + EQUAL = 284, + GREATER_OR_EQUAL = 285, + LESS_OR_EQUAL = 286, + RIGHT_SHIFT = 287, + LEFT_SHIFT = 288, + UNARY = 289 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + + diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y new file mode 100644 index 000000000..43513ebb6 --- /dev/null +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -0,0 +1,1858 @@ +%{ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <inttypes.h> + +#include "glcpp.h" +#include "main/core.h" /* for struct gl_extensions */ +#include "main/mtypes.h" /* for gl_api enum */ + +#define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str) +#define glcpp_printf(stream, fmt, args, ...) \ + stream = talloc_asprintf_append(stream, fmt, args) + +static void +yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error); + +static void +_define_object_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *macro, + token_list_t *replacements); + +static void +_define_function_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *macro, + string_list_t *parameters, + token_list_t *replacements); + +static string_list_t * +_string_list_create (void *ctx); + +static void +_string_list_append_item (string_list_t *list, const char *str); + +static int +_string_list_contains (string_list_t *list, const char *member, int *index); + +static int +_string_list_length (string_list_t *list); + +static int +_string_list_equal (string_list_t *a, string_list_t *b); + +static argument_list_t * +_argument_list_create (void *ctx); + +static void +_argument_list_append (argument_list_t *list, token_list_t *argument); + +static int +_argument_list_length (argument_list_t *list); + +static token_list_t * +_argument_list_member_at (argument_list_t *list, int index); + +/* Note: This function talloc_steal()s the str pointer. */ +static token_t * +_token_create_str (void *ctx, int type, char *str); + +static token_t * +_token_create_ival (void *ctx, int type, int ival); + +static token_list_t * +_token_list_create (void *ctx); + +/* Note: This function adds a talloc_reference() to token. + * + * You may want to talloc_unlink any current reference if you no + * longer need it. */ +static void +_token_list_append (token_list_t *list, token_t *token); + +static void +_token_list_append_list (token_list_t *list, token_list_t *tail); + +static int +_token_list_equal_ignoring_space (token_list_t *a, token_list_t *b); + +static active_list_t * +_active_list_push (active_list_t *list, + const char *identifier, + token_node_t *marker); + +static active_list_t * +_active_list_pop (active_list_t *list); + +int +_active_list_contains (active_list_t *list, const char *identifier); + +static void +_glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list); + +static void +_glcpp_parser_expand_token_list (glcpp_parser_t *parser, + token_list_t *list); + +static void +_glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser, + token_list_t *list); + +static void +_glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, + int condition); + +static void +_glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc, + const char *type, int condition); + +static void +_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc); + +#define yylex glcpp_parser_lex + +static int +glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser); + +static void +glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list); + +static void +add_builtin_define(glcpp_parser_t *parser, const char *name, int value); + +%} + +%pure-parser +%error-verbose + +%locations +%initial-action { + @$.first_line = 1; + @$.first_column = 1; + @$.last_line = 1; + @$.last_column = 1; + @$.source = 0; +} + +%parse-param {glcpp_parser_t *parser} +%lex-param {glcpp_parser_t *parser} + +%expect 0 +%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE_FUNC HASH_DEFINE_OBJ HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_UNDEF HASH_VERSION IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING NEWLINE OTHER PLACEHOLDER SPACE +%token PASTE +%type <ival> expression INTEGER operator SPACE integer_constant +%type <str> IDENTIFIER INTEGER_STRING OTHER +%type <string_list> identifier_list +%type <token> preprocessing_token conditional_token +%type <token_list> pp_tokens replacement_list text_line conditional_tokens +%left OR +%left AND +%left '|' +%left '^' +%left '&' +%left EQUAL NOT_EQUAL +%left '<' '>' LESS_OR_EQUAL GREATER_OR_EQUAL +%left LEFT_SHIFT RIGHT_SHIFT +%left '+' '-' +%left '*' '/' '%' +%right UNARY + +%% + +input: + /* empty */ +| input line +; + +line: + control_line { + glcpp_print(parser->output, "\n"); + } +| text_line { + _glcpp_parser_print_expanded_token_list (parser, $1); + glcpp_print(parser->output, "\n"); + talloc_free ($1); + } +| expanded_line +| HASH non_directive +; + +expanded_line: + IF_EXPANDED expression NEWLINE { + _glcpp_parser_skip_stack_push_if (parser, & @1, $2); + } +| ELIF_EXPANDED expression NEWLINE { + _glcpp_parser_skip_stack_change_if (parser, & @1, "elif", $2); + } +; + +control_line: + HASH_DEFINE_OBJ IDENTIFIER replacement_list NEWLINE { + _define_object_macro (parser, & @2, $2, $3); + } +| HASH_DEFINE_FUNC IDENTIFIER '(' ')' replacement_list NEWLINE { + _define_function_macro (parser, & @2, $2, NULL, $5); + } +| HASH_DEFINE_FUNC IDENTIFIER '(' identifier_list ')' replacement_list NEWLINE { + _define_function_macro (parser, & @2, $2, $4, $6); + } +| HASH_UNDEF IDENTIFIER NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $2); + if (macro) { + hash_table_remove (parser->defines, $2); + talloc_free (macro); + } + talloc_free ($2); + } +| HASH_IF conditional_tokens NEWLINE { + /* Be careful to only evaluate the 'if' expression if + * we are not skipping. When we are skipping, we + * simply push a new 0-valued 'if' onto the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + _glcpp_parser_expand_if (parser, IF_EXPANDED, $2); + } + else + { + _glcpp_parser_skip_stack_push_if (parser, & @1, 0); + parser->skip_stack->type = SKIP_TO_ENDIF; + } + } +| HASH_IF NEWLINE { + /* #if without an expression is only an error if we + * are not skipping */ + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + glcpp_error(& @1, parser, "#if with no expression"); + } + _glcpp_parser_skip_stack_push_if (parser, & @1, 0); + } +| HASH_IFDEF IDENTIFIER junk NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $2); + talloc_free ($2); + _glcpp_parser_skip_stack_push_if (parser, & @1, macro != NULL); + } +| HASH_IFNDEF IDENTIFIER junk NEWLINE { + macro_t *macro = hash_table_find (parser->defines, $2); + talloc_free ($2); + _glcpp_parser_skip_stack_push_if (parser, & @1, macro == NULL); + } +| HASH_ELIF conditional_tokens NEWLINE { + /* Be careful to only evaluate the 'elif' expression + * if we are not skipping. When we are skipping, we + * simply change to a 0-valued 'elif' on the skip + * stack. + * + * This avoids generating diagnostics for invalid + * expressions that are being skipped. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { + _glcpp_parser_expand_if (parser, ELIF_EXPANDED, $2); + } + else + { + _glcpp_parser_skip_stack_change_if (parser, & @1, + "elif", 0); + } + } +| HASH_ELIF NEWLINE { + /* #elif without an expression is an error unless we + * are skipping. */ + if (parser->skip_stack && + parser->skip_stack->type == SKIP_TO_ELSE) + { + glcpp_error(& @1, parser, "#elif with no expression"); + } + else + { + _glcpp_parser_skip_stack_change_if (parser, & @1, + "elif", 0); + glcpp_warning(& @1, parser, "ignoring illegal #elif without expression"); + } + } +| HASH_ELSE NEWLINE { + _glcpp_parser_skip_stack_change_if (parser, & @1, "else", 1); + } +| HASH_ENDIF NEWLINE { + _glcpp_parser_skip_stack_pop (parser, & @1); + } +| HASH_VERSION integer_constant NEWLINE { + macro_t *macro = hash_table_find (parser->defines, "__VERSION__"); + if (macro) { + hash_table_remove (parser->defines, "__VERSION__"); + talloc_free (macro); + } + add_builtin_define (parser, "__VERSION__", $2); + + if ($2 == 100) + add_builtin_define (parser, "GL_ES", 1); + + glcpp_printf(parser->output, "#version %" PRIiMAX, $2); + } +| HASH NEWLINE +; + +integer_constant: + INTEGER_STRING { + if (strlen ($1) >= 3 && strncmp ($1, "0x", 2) == 0) { + $$ = strtoll ($1 + 2, NULL, 16); + } else if ($1[0] == '0') { + $$ = strtoll ($1, NULL, 8); + } else { + $$ = strtoll ($1, NULL, 10); + } + } +| INTEGER { + $$ = $1; + } + +expression: + integer_constant +| expression OR expression { + $$ = $1 || $3; + } +| expression AND expression { + $$ = $1 && $3; + } +| expression '|' expression { + $$ = $1 | $3; + } +| expression '^' expression { + $$ = $1 ^ $3; + } +| expression '&' expression { + $$ = $1 & $3; + } +| expression NOT_EQUAL expression { + $$ = $1 != $3; + } +| expression EQUAL expression { + $$ = $1 == $3; + } +| expression GREATER_OR_EQUAL expression { + $$ = $1 >= $3; + } +| expression LESS_OR_EQUAL expression { + $$ = $1 <= $3; + } +| expression '>' expression { + $$ = $1 > $3; + } +| expression '<' expression { + $$ = $1 < $3; + } +| expression RIGHT_SHIFT expression { + $$ = $1 >> $3; + } +| expression LEFT_SHIFT expression { + $$ = $1 << $3; + } +| expression '-' expression { + $$ = $1 - $3; + } +| expression '+' expression { + $$ = $1 + $3; + } +| expression '%' expression { + $$ = $1 % $3; + } +| expression '/' expression { + $$ = $1 / $3; + } +| expression '*' expression { + $$ = $1 * $3; + } +| '!' expression %prec UNARY { + $$ = ! $2; + } +| '~' expression %prec UNARY { + $$ = ~ $2; + } +| '-' expression %prec UNARY { + $$ = - $2; + } +| '+' expression %prec UNARY { + $$ = + $2; + } +| '(' expression ')' { + $$ = $2; + } +; + +identifier_list: + IDENTIFIER { + $$ = _string_list_create (parser); + _string_list_append_item ($$, $1); + talloc_steal ($$, $1); + } +| identifier_list ',' IDENTIFIER { + $$ = $1; + _string_list_append_item ($$, $3); + talloc_steal ($$, $3); + } +; + +text_line: + NEWLINE { $$ = NULL; } +| pp_tokens NEWLINE +; + +non_directive: + pp_tokens NEWLINE { + yyerror (& @1, parser, "Invalid tokens after #"); + } +; + +replacement_list: + /* empty */ { $$ = NULL; } +| pp_tokens +; + +junk: + /* empty */ +| pp_tokens { + glcpp_warning(&@1, parser, "extra tokens at end of directive"); + } +; + +conditional_token: + /* Handle "defined" operator */ + DEFINED IDENTIFIER { + int v = hash_table_find (parser->defines, $2) ? 1 : 0; + $$ = _token_create_ival (parser, INTEGER, v); + } +| DEFINED '(' IDENTIFIER ')' { + int v = hash_table_find (parser->defines, $3) ? 1 : 0; + $$ = _token_create_ival (parser, INTEGER, v); + } +| preprocessing_token +; + +conditional_tokens: + /* Exactly the same as pp_tokens, but using conditional_token */ + conditional_token { + parser->space_tokens = 1; + $$ = _token_list_create (parser); + _token_list_append ($$, $1); + talloc_unlink (parser, $1); + } +| conditional_tokens conditional_token { + $$ = $1; + _token_list_append ($$, $2); + talloc_unlink (parser, $2); + } +; + +pp_tokens: + preprocessing_token { + parser->space_tokens = 1; + $$ = _token_list_create (parser); + _token_list_append ($$, $1); + talloc_unlink (parser, $1); + } +| pp_tokens preprocessing_token { + $$ = $1; + _token_list_append ($$, $2); + talloc_unlink (parser, $2); + } +; + +preprocessing_token: + IDENTIFIER { + $$ = _token_create_str (parser, IDENTIFIER, $1); + $$->location = yylloc; + } +| INTEGER_STRING { + $$ = _token_create_str (parser, INTEGER_STRING, $1); + $$->location = yylloc; + } +| operator { + $$ = _token_create_ival (parser, $1, $1); + $$->location = yylloc; + } +| OTHER { + $$ = _token_create_str (parser, OTHER, $1); + $$->location = yylloc; + } +| SPACE { + $$ = _token_create_ival (parser, SPACE, SPACE); + $$->location = yylloc; + } +; + +operator: + '[' { $$ = '['; } +| ']' { $$ = ']'; } +| '(' { $$ = '('; } +| ')' { $$ = ')'; } +| '{' { $$ = '{'; } +| '}' { $$ = '}'; } +| '.' { $$ = '.'; } +| '&' { $$ = '&'; } +| '*' { $$ = '*'; } +| '+' { $$ = '+'; } +| '-' { $$ = '-'; } +| '~' { $$ = '~'; } +| '!' { $$ = '!'; } +| '/' { $$ = '/'; } +| '%' { $$ = '%'; } +| LEFT_SHIFT { $$ = LEFT_SHIFT; } +| RIGHT_SHIFT { $$ = RIGHT_SHIFT; } +| '<' { $$ = '<'; } +| '>' { $$ = '>'; } +| LESS_OR_EQUAL { $$ = LESS_OR_EQUAL; } +| GREATER_OR_EQUAL { $$ = GREATER_OR_EQUAL; } +| EQUAL { $$ = EQUAL; } +| NOT_EQUAL { $$ = NOT_EQUAL; } +| '^' { $$ = '^'; } +| '|' { $$ = '|'; } +| AND { $$ = AND; } +| OR { $$ = OR; } +| ';' { $$ = ';'; } +| ',' { $$ = ','; } +| '=' { $$ = '='; } +| PASTE { $$ = PASTE; } +; + +%% + +string_list_t * +_string_list_create (void *ctx) +{ + string_list_t *list; + + list = talloc (ctx, string_list_t); + list->head = NULL; + list->tail = NULL; + + return list; +} + +void +_string_list_append_item (string_list_t *list, const char *str) +{ + string_node_t *node; + + node = talloc (list, string_node_t); + node->str = talloc_strdup (node, str); + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; +} + +int +_string_list_contains (string_list_t *list, const char *member, int *index) +{ + string_node_t *node; + int i; + + if (list == NULL) + return 0; + + for (i = 0, node = list->head; node; i++, node = node->next) { + if (strcmp (node->str, member) == 0) { + if (index) + *index = i; + return 1; + } + } + + return 0; +} + +int +_string_list_length (string_list_t *list) +{ + int length = 0; + string_node_t *node; + + if (list == NULL) + return 0; + + for (node = list->head; node; node = node->next) + length++; + + return length; +} + +int +_string_list_equal (string_list_t *a, string_list_t *b) +{ + string_node_t *node_a, *node_b; + + if (a == NULL && b == NULL) + return 1; + + if (a == NULL || b == NULL) + return 0; + + for (node_a = a->head, node_b = b->head; + node_a && node_b; + node_a = node_a->next, node_b = node_b->next) + { + if (strcmp (node_a->str, node_b->str)) + return 0; + } + + /* Catch the case of lists being different lengths, (which + * would cause the loop above to terminate after the shorter + * list). */ + return node_a == node_b; +} + +argument_list_t * +_argument_list_create (void *ctx) +{ + argument_list_t *list; + + list = talloc (ctx, argument_list_t); + list->head = NULL; + list->tail = NULL; + + return list; +} + +void +_argument_list_append (argument_list_t *list, token_list_t *argument) +{ + argument_node_t *node; + + node = talloc (list, argument_node_t); + node->argument = argument; + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; +} + +int +_argument_list_length (argument_list_t *list) +{ + int length = 0; + argument_node_t *node; + + if (list == NULL) + return 0; + + for (node = list->head; node; node = node->next) + length++; + + return length; +} + +token_list_t * +_argument_list_member_at (argument_list_t *list, int index) +{ + argument_node_t *node; + int i; + + if (list == NULL) + return NULL; + + node = list->head; + for (i = 0; i < index; i++) { + node = node->next; + if (node == NULL) + break; + } + + if (node) + return node->argument; + + return NULL; +} + +/* Note: This function talloc_steal()s the str pointer. */ +token_t * +_token_create_str (void *ctx, int type, char *str) +{ + token_t *token; + + token = talloc (ctx, token_t); + token->type = type; + token->value.str = talloc_steal (token, str); + + return token; +} + +token_t * +_token_create_ival (void *ctx, int type, int ival) +{ + token_t *token; + + token = talloc (ctx, token_t); + token->type = type; + token->value.ival = ival; + + return token; +} + +token_list_t * +_token_list_create (void *ctx) +{ + token_list_t *list; + + list = talloc (ctx, token_list_t); + list->head = NULL; + list->tail = NULL; + list->non_space_tail = NULL; + + return list; +} + +void +_token_list_append (token_list_t *list, token_t *token) +{ + token_node_t *node; + + node = talloc (list, token_node_t); + node->token = talloc_reference (list, token); + + node->next = NULL; + + if (list->head == NULL) { + list->head = node; + } else { + list->tail->next = node; + } + + list->tail = node; + if (token->type != SPACE) + list->non_space_tail = node; +} + +void +_token_list_append_list (token_list_t *list, token_list_t *tail) +{ + if (tail == NULL || tail->head == NULL) + return; + + if (list->head == NULL) { + list->head = tail->head; + } else { + list->tail->next = tail->head; + } + + list->tail = tail->tail; + list->non_space_tail = tail->non_space_tail; +} + +static token_list_t * +_token_list_copy (void *ctx, token_list_t *other) +{ + token_list_t *copy; + token_node_t *node; + + if (other == NULL) + return NULL; + + copy = _token_list_create (ctx); + for (node = other->head; node; node = node->next) + _token_list_append (copy, node->token); + + return copy; +} + +static void +_token_list_trim_trailing_space (token_list_t *list) +{ + token_node_t *tail, *next; + + if (list->non_space_tail) { + tail = list->non_space_tail->next; + list->non_space_tail->next = NULL; + list->tail = list->non_space_tail; + + while (tail) { + next = tail->next; + talloc_free (tail); + tail = next; + } + } +} + +int +_token_list_equal_ignoring_space (token_list_t *a, token_list_t *b) +{ + token_node_t *node_a, *node_b; + + node_a = a->head; + node_b = b->head; + + while (1) + { + if (node_a == NULL && node_b == NULL) + break; + + if (node_a == NULL || node_b == NULL) + return 0; + + if (node_a->token->type == SPACE) { + node_a = node_a->next; + continue; + } + + if (node_b->token->type == SPACE) { + node_b = node_b->next; + continue; + } + + if (node_a->token->type != node_b->token->type) + return 0; + + switch (node_a->token->type) { + case INTEGER: + if (node_a->token->value.ival != + node_b->token->value.ival) + { + return 0; + } + break; + case IDENTIFIER: + case INTEGER_STRING: + case OTHER: + if (strcmp (node_a->token->value.str, + node_b->token->value.str)) + { + return 0; + } + break; + } + + node_a = node_a->next; + node_b = node_b->next; + } + + return 1; +} + +static void +_token_print (char **out, token_t *token) +{ + if (token->type < 256) { + glcpp_printf (*out, "%c", token->type); + return; + } + + switch (token->type) { + case INTEGER: + glcpp_printf (*out, "%" PRIiMAX, token->value.ival); + break; + case IDENTIFIER: + case INTEGER_STRING: + case OTHER: + glcpp_print (*out, token->value.str); + break; + case SPACE: + glcpp_print (*out, " "); + break; + case LEFT_SHIFT: + glcpp_print (*out, "<<"); + break; + case RIGHT_SHIFT: + glcpp_print (*out, ">>"); + break; + case LESS_OR_EQUAL: + glcpp_print (*out, "<="); + break; + case GREATER_OR_EQUAL: + glcpp_print (*out, ">="); + break; + case EQUAL: + glcpp_print (*out, "=="); + break; + case NOT_EQUAL: + glcpp_print (*out, "!="); + break; + case AND: + glcpp_print (*out, "&&"); + break; + case OR: + glcpp_print (*out, "||"); + break; + case PASTE: + glcpp_print (*out, "##"); + break; + case COMMA_FINAL: + glcpp_print (*out, ","); + break; + case PLACEHOLDER: + /* Nothing to print. */ + break; + default: + assert(!"Error: Don't know how to print token."); + break; + } +} + +/* Return a new token (talloc()ed off of 'token') formed by pasting + * 'token' and 'other'. Note that this function may return 'token' or + * 'other' directly rather than allocating anything new. + * + * Caution: Only very cursory error-checking is performed to see if + * the final result is a valid single token. */ +static token_t * +_token_paste (glcpp_parser_t *parser, token_t *token, token_t *other) +{ + token_t *combined = NULL; + + /* Pasting a placeholder onto anything makes no change. */ + if (other->type == PLACEHOLDER) + return token; + + /* When 'token' is a placeholder, just return 'other'. */ + if (token->type == PLACEHOLDER) + return other; + + /* A very few single-character punctuators can be combined + * with another to form a multi-character punctuator. */ + switch (token->type) { + case '<': + if (other->type == '<') + combined = _token_create_ival (token, LEFT_SHIFT, LEFT_SHIFT); + else if (other->type == '=') + combined = _token_create_ival (token, LESS_OR_EQUAL, LESS_OR_EQUAL); + break; + case '>': + if (other->type == '>') + combined = _token_create_ival (token, RIGHT_SHIFT, RIGHT_SHIFT); + else if (other->type == '=') + combined = _token_create_ival (token, GREATER_OR_EQUAL, GREATER_OR_EQUAL); + break; + case '=': + if (other->type == '=') + combined = _token_create_ival (token, EQUAL, EQUAL); + break; + case '!': + if (other->type == '=') + combined = _token_create_ival (token, NOT_EQUAL, NOT_EQUAL); + break; + case '&': + if (other->type == '&') + combined = _token_create_ival (token, AND, AND); + break; + case '|': + if (other->type == '|') + combined = _token_create_ival (token, OR, OR); + break; + } + + if (combined != NULL) { + /* Inherit the location from the first token */ + combined->location = token->location; + return combined; + } + + /* Two string-valued tokens can usually just be mashed + * together. + * + * XXX: This isn't actually legitimate. Several things here + * should result in a diagnostic since the result cannot be a + * valid, single pre-processing token. For example, pasting + * "123" and "abc" is not legal, but we don't catch that + * here. */ + if ((token->type == IDENTIFIER || token->type == OTHER || token->type == INTEGER_STRING) && + (other->type == IDENTIFIER || other->type == OTHER || other->type == INTEGER_STRING)) + { + char *str; + + str = talloc_asprintf (token, "%s%s", token->value.str, + other->value.str); + combined = _token_create_str (token, token->type, str); + combined->location = token->location; + return combined; + } + + glcpp_error (&token->location, parser, ""); + glcpp_print (parser->info_log, "Pasting \""); + _token_print (&parser->info_log, token); + glcpp_print (parser->info_log, "\" and \""); + _token_print (&parser->info_log, other); + glcpp_print (parser->info_log, "\" does not give a valid preprocessing token.\n"); + + return token; +} + +static void +_token_list_print (glcpp_parser_t *parser, token_list_t *list) +{ + token_node_t *node; + + if (list == NULL) + return; + + for (node = list->head; node; node = node->next) + _token_print (&parser->output, node->token); +} + +void +yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error) +{ + glcpp_error(locp, parser, "%s", error); +} + +static void add_builtin_define(glcpp_parser_t *parser, + const char *name, int value) +{ + token_t *tok; + token_list_t *list; + + tok = _token_create_ival (parser, INTEGER, value); + + list = _token_list_create(parser); + _token_list_append(list, tok); + _define_object_macro(parser, NULL, name, list); + + talloc_unlink(parser, tok); +} + +glcpp_parser_t * +glcpp_parser_create (const struct gl_extensions *extensions, int api) +{ + glcpp_parser_t *parser; + int language_version; + + parser = talloc (NULL, glcpp_parser_t); + + glcpp_lex_init_extra (parser, &parser->scanner); + parser->defines = hash_table_ctor (32, hash_table_string_hash, + hash_table_string_compare); + parser->active = NULL; + parser->lexing_if = 0; + parser->space_tokens = 1; + parser->newline_as_space = 0; + parser->in_control_line = 0; + parser->paren_count = 0; + + parser->skip_stack = NULL; + + parser->lex_from_list = NULL; + parser->lex_from_node = NULL; + + parser->output = talloc_strdup(parser, ""); + parser->info_log = talloc_strdup(parser, ""); + parser->error = 0; + + /* Add pre-defined macros. */ + add_builtin_define(parser, "GL_ARB_draw_buffers", 1); + add_builtin_define(parser, "GL_ARB_texture_rectangle", 1); + + if (api == API_OPENGLES2) + add_builtin_define(parser, "GL_ES", 1); + + if (extensions != NULL) { + if (extensions->EXT_texture_array) { + add_builtin_define(parser, "GL_EXT_texture_array", 1); + } + + if (extensions->ARB_fragment_coord_conventions) + add_builtin_define(parser, "GL_ARB_fragment_coord_conventions", + 1); + } + + language_version = 110; + add_builtin_define(parser, "__VERSION__", language_version); + + return parser; +} + +int +glcpp_parser_parse (glcpp_parser_t *parser) +{ + return yyparse (parser); +} + +void +glcpp_parser_destroy (glcpp_parser_t *parser) +{ + glcpp_lex_destroy (parser->scanner); + hash_table_dtor (parser->defines); + talloc_free (parser); +} + +typedef enum function_status +{ + FUNCTION_STATUS_SUCCESS, + FUNCTION_NOT_A_FUNCTION, + FUNCTION_UNBALANCED_PARENTHESES +} function_status_t; + +/* Find a set of function-like macro arguments by looking for a + * balanced set of parentheses. + * + * When called, 'node' should be the opening-parenthesis token, (or + * perhaps preceeding SPACE tokens). Upon successful return *last will + * be the last consumed node, (corresponding to the closing right + * parenthesis). + * + * Return values: + * + * FUNCTION_STATUS_SUCCESS: + * + * Successfully parsed a set of function arguments. + * + * FUNCTION_NOT_A_FUNCTION: + * + * Macro name not followed by a '('. This is not an error, but + * simply that the macro name should be treated as a non-macro. + * + * FUNCTION_UNBALANCED_PARENTHESES + * + * Macro name is not followed by a balanced set of parentheses. + */ +static function_status_t +_arguments_parse (argument_list_t *arguments, + token_node_t *node, + token_node_t **last) +{ + token_list_t *argument; + int paren_count; + + node = node->next; + + /* Ignore whitespace before first parenthesis. */ + while (node && node->token->type == SPACE) + node = node->next; + + if (node == NULL || node->token->type != '(') + return FUNCTION_NOT_A_FUNCTION; + + node = node->next; + + argument = _token_list_create (arguments); + _argument_list_append (arguments, argument); + + for (paren_count = 1; node; node = node->next) { + if (node->token->type == '(') + { + paren_count++; + } + else if (node->token->type == ')') + { + paren_count--; + if (paren_count == 0) + break; + } + + if (node->token->type == ',' && + paren_count == 1) + { + _token_list_trim_trailing_space (argument); + argument = _token_list_create (arguments); + _argument_list_append (arguments, argument); + } + else { + if (argument->head == NULL) { + /* Don't treat initial whitespace as + * part of the arguement. */ + if (node->token->type == SPACE) + continue; + } + _token_list_append (argument, node->token); + } + } + + if (paren_count) + return FUNCTION_UNBALANCED_PARENTHESES; + + *last = node; + + return FUNCTION_STATUS_SUCCESS; +} + +static token_list_t * +_token_list_create_with_one_space (void *ctx) +{ + token_list_t *list; + token_t *space; + + list = _token_list_create (ctx); + space = _token_create_ival (list, SPACE, SPACE); + _token_list_append (list, space); + + return list; +} + +static void +_glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list) +{ + token_list_t *expanded; + token_t *token; + + expanded = _token_list_create (parser); + token = _token_create_ival (parser, type, type); + _token_list_append (expanded, token); + _glcpp_parser_expand_token_list (parser, list); + _token_list_append_list (expanded, list); + glcpp_parser_lex_from (parser, expanded); +} + +/* This is a helper function that's essentially part of the + * implementation of _glcpp_parser_expand_node. It shouldn't be called + * except for by that function. + * + * Returns NULL if node is a simple token with no expansion, (that is, + * although 'node' corresponds to an identifier defined as a + * function-like macro, it is not followed with a parenthesized + * argument list). + * + * Compute the complete expansion of node (which is a function-like + * macro) and subsequent nodes which are arguments. + * + * Returns the token list that results from the expansion and sets + * *last to the last node in the list that was consumed by the + * expansion. Specifically, *last will be set as follows: as the + * token of the closing right parenthesis. + */ +static token_list_t * +_glcpp_parser_expand_function (glcpp_parser_t *parser, + token_node_t *node, + token_node_t **last) + +{ + macro_t *macro; + const char *identifier; + argument_list_t *arguments; + function_status_t status; + token_list_t *substituted; + int parameter_index; + + identifier = node->token->value.str; + + macro = hash_table_find (parser->defines, identifier); + + assert (macro->is_function); + + arguments = _argument_list_create (parser); + status = _arguments_parse (arguments, node, last); + + switch (status) { + case FUNCTION_STATUS_SUCCESS: + break; + case FUNCTION_NOT_A_FUNCTION: + return NULL; + case FUNCTION_UNBALANCED_PARENTHESES: + glcpp_error (&node->token->location, parser, "Macro %s call has unbalanced parentheses\n", identifier); + return NULL; + } + + /* Replace a macro defined as empty with a SPACE token. */ + if (macro->replacements == NULL) { + talloc_free (arguments); + return _token_list_create_with_one_space (parser); + } + + if (! ((_argument_list_length (arguments) == + _string_list_length (macro->parameters)) || + (_string_list_length (macro->parameters) == 0 && + _argument_list_length (arguments) == 1 && + arguments->head->argument->head == NULL))) + { + glcpp_error (&node->token->location, parser, + "Error: macro %s invoked with %d arguments (expected %d)\n", + identifier, + _argument_list_length (arguments), + _string_list_length (macro->parameters)); + return NULL; + } + + /* Perform argument substitution on the replacement list. */ + substituted = _token_list_create (arguments); + + for (node = macro->replacements->head; node; node = node->next) + { + if (node->token->type == IDENTIFIER && + _string_list_contains (macro->parameters, + node->token->value.str, + ¶meter_index)) + { + token_list_t *argument; + argument = _argument_list_member_at (arguments, + parameter_index); + /* Before substituting, we expand the argument + * tokens, or append a placeholder token for + * an empty argument. */ + if (argument->head) { + token_list_t *expanded_argument; + expanded_argument = _token_list_copy (parser, + argument); + _glcpp_parser_expand_token_list (parser, + expanded_argument); + _token_list_append_list (substituted, + expanded_argument); + } else { + token_t *new_token; + + new_token = _token_create_ival (substituted, + PLACEHOLDER, + PLACEHOLDER); + _token_list_append (substituted, new_token); + } + } else { + _token_list_append (substituted, node->token); + } + } + + /* After argument substitution, and before further expansion + * below, implement token pasting. */ + + _token_list_trim_trailing_space (substituted); + + node = substituted->head; + while (node) + { + token_node_t *next_non_space; + + /* Look ahead for a PASTE token, skipping space. */ + next_non_space = node->next; + while (next_non_space && next_non_space->token->type == SPACE) + next_non_space = next_non_space->next; + + if (next_non_space == NULL) + break; + + if (next_non_space->token->type != PASTE) { + node = next_non_space; + continue; + } + + /* Now find the next non-space token after the PASTE. */ + next_non_space = next_non_space->next; + while (next_non_space && next_non_space->token->type == SPACE) + next_non_space = next_non_space->next; + + if (next_non_space == NULL) { + yyerror (&node->token->location, parser, "'##' cannot appear at either end of a macro expansion\n"); + return NULL; + } + + node->token = _token_paste (parser, node->token, next_non_space->token); + node->next = next_non_space->next; + if (next_non_space == substituted->tail) + substituted->tail = node; + + node = node->next; + } + + substituted->non_space_tail = substituted->tail; + + return substituted; +} + +/* Compute the complete expansion of node, (and subsequent nodes after + * 'node' in the case that 'node' is a function-like macro and + * subsequent nodes are arguments). + * + * Returns NULL if node is a simple token with no expansion. + * + * Otherwise, returns the token list that results from the expansion + * and sets *last to the last node in the list that was consumed by + * the expansion. Specifically, *last will be set as follows: + * + * As 'node' in the case of object-like macro expansion. + * + * As the token of the closing right parenthesis in the case of + * function-like macro expansion. + */ +static token_list_t * +_glcpp_parser_expand_node (glcpp_parser_t *parser, + token_node_t *node, + token_node_t **last) +{ + token_t *token = node->token; + const char *identifier; + macro_t *macro; + + /* We only expand identifiers */ + if (token->type != IDENTIFIER) { + /* We change any COMMA into a COMMA_FINAL to prevent + * it being mistaken for an argument separator + * later. */ + if (token->type == ',') { + token->type = COMMA_FINAL; + token->value.ival = COMMA_FINAL; + } + + return NULL; + } + + /* Look up this identifier in the hash table. */ + identifier = token->value.str; + macro = hash_table_find (parser->defines, identifier); + + /* Not a macro, so no expansion needed. */ + if (macro == NULL) + return NULL; + + /* Finally, don't expand this macro if we're already actively + * expanding it, (to avoid infinite recursion). */ + if (_active_list_contains (parser->active, identifier)) { + /* We change the token type here from IDENTIFIER to + * OTHER to prevent any future expansion of this + * unexpanded token. */ + char *str; + token_list_t *expansion; + token_t *final; + + str = talloc_strdup (parser, token->value.str); + final = _token_create_str (parser, OTHER, str); + expansion = _token_list_create (parser); + _token_list_append (expansion, final); + *last = node; + return expansion; + } + + if (! macro->is_function) + { + *last = node; + + /* Replace a macro defined as empty with a SPACE token. */ + if (macro->replacements == NULL) + return _token_list_create_with_one_space (parser); + + return _token_list_copy (parser, macro->replacements); + } + + return _glcpp_parser_expand_function (parser, node, last); +} + +/* Push a new identifier onto the active list, returning the new list. + * + * Here, 'marker' is the token node that appears in the list after the + * expansion of 'identifier'. That is, when the list iterator begins + * examinging 'marker', then it is time to pop this node from the + * active stack. + */ +active_list_t * +_active_list_push (active_list_t *list, + const char *identifier, + token_node_t *marker) +{ + active_list_t *node; + + node = talloc (list, active_list_t); + node->identifier = talloc_strdup (node, identifier); + node->marker = marker; + node->next = list; + + return node; +} + +active_list_t * +_active_list_pop (active_list_t *list) +{ + active_list_t *node = list; + + if (node == NULL) + return NULL; + + node = list->next; + talloc_free (list); + + return node; +} + +int +_active_list_contains (active_list_t *list, const char *identifier) +{ + active_list_t *node; + + if (list == NULL) + return 0; + + for (node = list; node; node = node->next) + if (strcmp (node->identifier, identifier) == 0) + return 1; + + return 0; +} + +/* Walk over the token list replacing nodes with their expansion. + * Whenever nodes are expanded the walking will walk over the new + * nodes, continuing to expand as necessary. The results are placed in + * 'list' itself; + */ +static void +_glcpp_parser_expand_token_list (glcpp_parser_t *parser, + token_list_t *list) +{ + token_node_t *node_prev; + token_node_t *node, *last = NULL; + token_list_t *expansion; + + if (list == NULL) + return; + + _token_list_trim_trailing_space (list); + + node_prev = NULL; + node = list->head; + + while (node) { + + while (parser->active && parser->active->marker == node) + parser->active = _active_list_pop (parser->active); + + /* Find the expansion for node, which will replace all + * nodes from node to last, inclusive. */ + expansion = _glcpp_parser_expand_node (parser, node, &last); + if (expansion) { + token_node_t *n; + + for (n = node; n != last->next; n = n->next) + while (parser->active && + parser->active->marker == n) + { + parser->active = _active_list_pop (parser->active); + } + + parser->active = _active_list_push (parser->active, + node->token->value.str, + last->next); + + /* Splice expansion into list, supporting a + * simple deletion if the expansion is + * empty. */ + if (expansion->head) { + if (node_prev) + node_prev->next = expansion->head; + else + list->head = expansion->head; + expansion->tail->next = last->next; + if (last == list->tail) + list->tail = expansion->tail; + } else { + if (node_prev) + node_prev->next = last->next; + else + list->head = last->next; + if (last == list->tail) + list->tail = NULL; + } + } else { + node_prev = node; + } + node = node_prev ? node_prev->next : list->head; + } + + while (parser->active) + parser->active = _active_list_pop (parser->active); + + list->non_space_tail = list->tail; +} + +void +_glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser, + token_list_t *list) +{ + if (list == NULL) + return; + + _glcpp_parser_expand_token_list (parser, list); + + _token_list_trim_trailing_space (list); + + _token_list_print (parser, list); +} + +static void +_check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc, + const char *identifier) +{ + /* According to the GLSL specification, macro names starting with "__" + * or "GL_" are reserved for future use. So, don't allow them. + */ + if (strncmp(identifier, "__", 2) == 0) { + glcpp_error (loc, parser, "Macro names starting with \"__\" are reserved.\n"); + } + if (strncmp(identifier, "GL_", 3) == 0) { + glcpp_error (loc, parser, "Macro names starting with \"GL_\" are reserved.\n"); + } +} + +static int +_macro_equal (macro_t *a, macro_t *b) +{ + if (a->is_function != b->is_function) + return 0; + + if (a->is_function) { + if (! _string_list_equal (a->parameters, b->parameters)) + return 0; + } + + return _token_list_equal_ignoring_space (a->replacements, + b->replacements); +} + +void +_define_object_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *identifier, + token_list_t *replacements) +{ + macro_t *macro, *previous; + + if (loc != NULL) + _check_for_reserved_macro_name(parser, loc, identifier); + + macro = talloc (parser, macro_t); + + macro->is_function = 0; + macro->parameters = NULL; + macro->identifier = talloc_strdup (macro, identifier); + macro->replacements = talloc_steal (macro, replacements); + + previous = hash_table_find (parser->defines, identifier); + if (previous) { + if (_macro_equal (macro, previous)) { + talloc_free (macro); + return; + } + glcpp_error (loc, parser, "Redefinition of macro %s\n", + identifier); + } + + hash_table_insert (parser->defines, macro, identifier); +} + +void +_define_function_macro (glcpp_parser_t *parser, + YYLTYPE *loc, + const char *identifier, + string_list_t *parameters, + token_list_t *replacements) +{ + macro_t *macro, *previous; + + _check_for_reserved_macro_name(parser, loc, identifier); + + macro = talloc (parser, macro_t); + + macro->is_function = 1; + macro->parameters = talloc_steal (macro, parameters); + macro->identifier = talloc_strdup (macro, identifier); + macro->replacements = talloc_steal (macro, replacements); + + previous = hash_table_find (parser->defines, identifier); + if (previous) { + if (_macro_equal (macro, previous)) { + talloc_free (macro); + return; + } + glcpp_error (loc, parser, "Redefinition of macro %s\n", + identifier); + } + + hash_table_insert (parser->defines, macro, identifier); +} + +static int +glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser) +{ + token_node_t *node; + int ret; + + if (parser->lex_from_list == NULL) { + ret = glcpp_lex (yylval, yylloc, parser->scanner); + + /* XXX: This ugly block of code exists for the sole + * purpose of converting a NEWLINE token into a SPACE + * token, but only in the case where we have seen a + * function-like macro name, but have not yet seen its + * closing parenthesis. + * + * There's perhaps a more compact way to do this with + * mid-rule actions in the grammar. + * + * I'm definitely not pleased with the complexity of + * this code here. + */ + if (parser->newline_as_space) + { + if (ret == '(') { + parser->paren_count++; + } else if (ret == ')') { + parser->paren_count--; + if (parser->paren_count == 0) + parser->newline_as_space = 0; + } else if (ret == NEWLINE) { + ret = SPACE; + } else if (ret != SPACE) { + if (parser->paren_count == 0) + parser->newline_as_space = 0; + } + } + else if (parser->in_control_line) + { + if (ret == NEWLINE) + parser->in_control_line = 0; + } + else if (ret == HASH_DEFINE_OBJ || ret == HASH_DEFINE_FUNC || + ret == HASH_UNDEF || ret == HASH_IF || + ret == HASH_IFDEF || ret == HASH_IFNDEF || + ret == HASH_ELIF || ret == HASH_ELSE || + ret == HASH_ENDIF || ret == HASH) + { + parser->in_control_line = 1; + } + else if (ret == IDENTIFIER) + { + macro_t *macro; + macro = hash_table_find (parser->defines, + yylval->str); + if (macro && macro->is_function) { + parser->newline_as_space = 1; + parser->paren_count = 0; + } + } + + return ret; + } + + node = parser->lex_from_node; + + if (node == NULL) { + talloc_free (parser->lex_from_list); + parser->lex_from_list = NULL; + return NEWLINE; + } + + *yylval = node->token->value; + ret = node->token->type; + + parser->lex_from_node = node->next; + + return ret; +} + +static void +glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list) +{ + token_node_t *node; + + assert (parser->lex_from_list == NULL); + + /* Copy list, eliminating any space tokens. */ + parser->lex_from_list = _token_list_create (parser); + + for (node = list->head; node; node = node->next) { + if (node->token->type == SPACE) + continue; + _token_list_append (parser->lex_from_list, node->token); + } + + talloc_free (list); + + parser->lex_from_node = parser->lex_from_list->head; + + /* It's possible the list consisted of nothing but whitespace. */ + if (parser->lex_from_node == NULL) { + talloc_free (parser->lex_from_list); + parser->lex_from_list = NULL; + } +} + +static void +_glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc, + int condition) +{ + skip_type_t current = SKIP_NO_SKIP; + skip_node_t *node; + + if (parser->skip_stack) + current = parser->skip_stack->type; + + node = talloc (parser, skip_node_t); + node->loc = *loc; + + if (current == SKIP_NO_SKIP) { + if (condition) + node->type = SKIP_NO_SKIP; + else + node->type = SKIP_TO_ELSE; + } else { + node->type = SKIP_TO_ENDIF; + } + + node->next = parser->skip_stack; + parser->skip_stack = node; +} + +static void +_glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc, + const char *type, int condition) +{ + if (parser->skip_stack == NULL) { + glcpp_error (loc, parser, "%s without #if\n", type); + return; + } + + if (parser->skip_stack->type == SKIP_TO_ELSE) { + if (condition) + parser->skip_stack->type = SKIP_NO_SKIP; + } else { + parser->skip_stack->type = SKIP_TO_ENDIF; + } +} + +static void +_glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc) +{ + skip_node_t *node; + + if (parser->skip_stack == NULL) { + glcpp_error (loc, parser, "#endif without #if\n"); + return; + } + + node = parser->skip_stack; + parser->skip_stack = node->next; + talloc_free (node); +} diff --git a/mesalib/src/glsl/glcpp/glcpp.c b/mesalib/src/glsl/glcpp/glcpp.c new file mode 100644 index 000000000..419b1fc25 --- /dev/null +++ b/mesalib/src/glsl/glcpp/glcpp.c @@ -0,0 +1,131 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include "glcpp.h" +#include "main/mtypes.h" + +#ifdef _MSC_VER +#include <io.h> +#define STDIN_FILENO 0 +#define read _read +#define open _open +#define close _close +#endif + +extern int yydebug; + +/* Read from fd until EOF and return a string of everything read. + */ +static char * +load_text_fd (void *ctx, int fd) +{ +#define CHUNK 4096 + char *text = NULL; + ssize_t text_size = 0; + ssize_t total_read = 0; + ssize_t bytes; + + while (1) { + if (total_read + CHUNK + 1 > text_size) { + text_size = text_size ? text_size * 2 : CHUNK + 1; + text = talloc_realloc_size (ctx, text, text_size); + if (text == NULL) { + fprintf (stderr, "Out of memory\n"); + return NULL; + } + } + bytes = read (fd, text + total_read, CHUNK); + if (bytes < 0) { + fprintf (stderr, "Error while reading: %s\n", + strerror (errno)); + talloc_free (text); + return NULL; + } + + if (bytes == 0) { + break; + } + + total_read += bytes; + } + + text[total_read] = '\0'; + + return text; +} + +static char * +load_text_file(void *ctx, const char *filename) +{ + char *text; + int fd; + + if (filename == NULL || strcmp (filename, "-") == 0) + return load_text_fd (ctx, STDIN_FILENO); + + fd = open (filename, O_RDONLY); + if (fd < 0) { + fprintf (stderr, "Failed to open file %s: %s\n", + filename, strerror (errno)); + return NULL; + } + + text = load_text_fd (ctx, fd); + + close(fd); + + return text; +} + +int +main (int argc, char *argv[]) +{ + char *filename = NULL; + void *ctx = talloc(NULL, void*); + char *info_log = talloc_strdup(ctx, ""); + const char *shader; + int ret; + + if (argc) { + filename = argv[1]; + } + + shader = load_text_file (ctx, filename); + if (shader == NULL) + return 1; + + ret = preprocess(ctx, &shader, &info_log, NULL, API_OPENGL); + + printf("%s", shader); + fprintf(stderr, "%s", info_log); + + talloc_free(ctx); + + return ret; +} diff --git a/mesalib/src/glsl/glcpp/glcpp.h b/mesalib/src/glsl/glcpp/glcpp.h new file mode 100644 index 000000000..7125d325d --- /dev/null +++ b/mesalib/src/glsl/glcpp/glcpp.h @@ -0,0 +1,222 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef GLCPP_H +#define GLCPP_H + +#include <stdint.h> + +#include <talloc.h> + +#include "program/hash_table.h" + +#define yyscan_t void* + +/* Some data types used for parser values. */ + +typedef struct string_node { + const char *str; + struct string_node *next; +} string_node_t; + +typedef struct string_list { + string_node_t *head; + string_node_t *tail; +} string_list_t; + +typedef struct token token_t; +typedef struct token_list token_list_t; + +typedef union YYSTYPE +{ + intmax_t ival; + char *str; + string_list_t *string_list; + token_t *token; + token_list_t *token_list; +} YYSTYPE; + +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 + +typedef struct YYLTYPE { + int first_line; + int first_column; + int last_line; + int last_column; + unsigned source; +} YYLTYPE; +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 + +# define YYLLOC_DEFAULT(Current, Rhs, N) \ +do { \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + } \ + (Current).source = 0; \ +} while (0) + +struct token { + int type; + YYSTYPE value; + YYLTYPE location; +}; + +typedef struct token_node { + token_t *token; + struct token_node *next; +} token_node_t; + +struct token_list { + token_node_t *head; + token_node_t *tail; + token_node_t *non_space_tail; +}; + +typedef struct argument_node { + token_list_t *argument; + struct argument_node *next; +} argument_node_t; + +typedef struct argument_list { + argument_node_t *head; + argument_node_t *tail; +} argument_list_t; + +typedef struct glcpp_parser glcpp_parser_t; + +typedef enum { + TOKEN_CLASS_IDENTIFIER, + TOKEN_CLASS_IDENTIFIER_FINALIZED, + TOKEN_CLASS_FUNC_MACRO, + TOKEN_CLASS_OBJ_MACRO +} token_class_t; + +token_class_t +glcpp_parser_classify_token (glcpp_parser_t *parser, + const char *identifier, + int *parameter_index); + +typedef struct { + int is_function; + string_list_t *parameters; + const char *identifier; + token_list_t *replacements; +} macro_t; + +typedef struct expansion_node { + macro_t *macro; + token_node_t *replacements; + struct expansion_node *next; +} expansion_node_t; + +typedef enum skip_type { + SKIP_NO_SKIP, + SKIP_TO_ELSE, + SKIP_TO_ENDIF +} skip_type_t; + +typedef struct skip_node { + skip_type_t type; + YYLTYPE loc; /* location of the initial #if/#elif/... */ + struct skip_node *next; +} skip_node_t; + +typedef struct active_list { + const char *identifier; + token_node_t *marker; + struct active_list *next; +} active_list_t; + +struct glcpp_parser { + yyscan_t scanner; + struct hash_table *defines; + active_list_t *active; + int lexing_if; + int space_tokens; + int newline_as_space; + int in_control_line; + int paren_count; + skip_node_t *skip_stack; + token_list_t *lex_from_list; + token_node_t *lex_from_node; + char *output; + char *info_log; + int error; +}; + +struct gl_extensions; + +glcpp_parser_t * +glcpp_parser_create (const struct gl_extensions *extensions, int api); + +int +glcpp_parser_parse (glcpp_parser_t *parser); + +void +glcpp_parser_destroy (glcpp_parser_t *parser); + +int +preprocess(void *talloc_ctx, const char **shader, char **info_log, + const struct gl_extensions *extensions, int api); + +/* Functions for writing to the info log */ + +void +glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...); + +void +glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...); + +/* Generated by glcpp-lex.l to glcpp-lex.c */ + +int +glcpp_lex_init_extra (glcpp_parser_t *parser, yyscan_t* scanner); + +void +glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader); + +int +glcpp_lex (YYSTYPE *lvalp, YYLTYPE *llocp, yyscan_t scanner); + +int +glcpp_lex_destroy (yyscan_t scanner); + +/* Generated by glcpp-parse.y to glcpp-parse.c */ + +int +yyparse (glcpp_parser_t *parser); + +#endif diff --git a/mesalib/src/glsl/glcpp/pp.c b/mesalib/src/glsl/glcpp/pp.c new file mode 100644 index 000000000..e1a3a88a3 --- /dev/null +++ b/mesalib/src/glsl/glcpp/pp.c @@ -0,0 +1,167 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <assert.h> +#include <string.h> +#include <ctype.h> +#include "glcpp.h" +#include "main/core.h" /* for isblank() on MSVC */ + +void +glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) +{ + va_list ap; + + parser->error = 1; + parser->info_log = talloc_asprintf_append(parser->info_log, + "%u:%u(%u): " + "preprocessor error: ", + locp->source, + locp->first_line, + locp->first_column); + va_start(ap, fmt); + parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap); + va_end(ap); + parser->info_log = talloc_strdup_append(parser->info_log, "\n"); +} + +void +glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) +{ + va_list ap; + + parser->info_log = talloc_asprintf_append(parser->info_log, + "%u:%u(%u): " + "preprocessor warning: ", + locp->source, + locp->first_line, + locp->first_column); + va_start(ap, fmt); + parser->info_log = talloc_vasprintf_append(parser->info_log, fmt, ap); + va_end(ap); + parser->info_log = talloc_strdup_append(parser->info_log, "\n"); +} + +/* Searches backwards for '^ *#' from a given starting point. */ +static int +in_directive(const char *shader, const char *ptr) +{ + assert(ptr >= shader); + + /* Search backwards for '#'. If we find a \n first, it doesn't count */ + for (; ptr >= shader && *ptr != '#'; ptr--) { + if (*ptr == '\n') + return 0; + } + if (ptr >= shader) { + /* Found '#'...look for spaces preceded by a newline */ + for (ptr--; ptr >= shader && isblank(*ptr); ptr--); + // FIXME: I don't think the '\n' case can happen + if (ptr < shader || *ptr == '\n') + return 1; + } + return 0; +} + +/* Remove any line continuation characters in preprocessing directives. + * However, ignore any in GLSL code, as "There is no line continuation + * character" (1.30 page 9) in GLSL. + */ +static char * +remove_line_continuations(glcpp_parser_t *ctx, const char *shader) +{ + int in_continued_line = 0; + int extra_newlines = 0; + char *clean = talloc_strdup(ctx, ""); + const char *search_start = shader; + const char *newline; + while ((newline = strchr(search_start, '\n')) != NULL) { + const char *backslash = NULL; + + /* # of characters preceding the newline. */ + int n = newline - shader; + + /* Find the preceding '\', if it exists */ + if (n >= 1 && newline[-1] == '\\') + backslash = newline - 1; + else if (n >= 2 && newline[-1] == '\r' && newline[-2] == '\\') + backslash = newline - 2; + + /* Double backslashes don't count (the backslash is escaped) */ + if (backslash != NULL && backslash[-1] == '\\') { + backslash = NULL; + } + + if (backslash != NULL) { + /* We found a line continuation, but do we care? */ + if (!in_continued_line) { + if (in_directive(shader, backslash)) { + in_continued_line = 1; + extra_newlines = 0; + } + } + if (in_continued_line) { + /* Copy everything before the \ */ + clean = talloc_strndup_append(clean, shader, backslash - shader); + shader = newline + 1; + extra_newlines++; + } + } else if (in_continued_line) { + /* Copy everything up to and including the \n */ + clean = talloc_strndup_append(clean, shader, newline - shader + 1); + shader = newline + 1; + /* Output extra newlines to make line numbers match */ + for (; extra_newlines > 0; extra_newlines--) + clean = talloc_strdup_append(clean, "\n"); + in_continued_line = 0; + } + search_start = newline + 1; + } + clean = talloc_strdup_append(clean, shader); + return clean; +} + +int +preprocess(void *talloc_ctx, const char **shader, char **info_log, + const struct gl_extensions *extensions, int api) +{ + int errors; + glcpp_parser_t *parser = glcpp_parser_create (extensions, api); + *shader = remove_line_continuations(parser, *shader); + + glcpp_lex_set_source_string (parser, *shader); + + glcpp_parser_parse (parser); + + if (parser->skip_stack) + glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n"); + + *info_log = talloc_strdup_append(*info_log, parser->info_log); + + talloc_steal(talloc_ctx, parser->output); + *shader = parser->output; + + errors = parser->error; + glcpp_parser_destroy (parser); + return errors; +} diff --git a/mesalib/src/glsl/glsl_lexer.cpp b/mesalib/src/glsl/glsl_lexer.cpp new file mode 100644 index 000000000..7661bbe98 --- /dev/null +++ b/mesalib/src/glsl/glsl_lexer.cpp @@ -0,0 +1,3488 @@ +#line 2 "glsl_lexer.cpp" + +#line 4 "glsl_lexer.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE _mesa_glsl_restart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via _mesa_glsl_restart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void _mesa_glsl_restart (FILE *input_file ,yyscan_t yyscanner ); +void _mesa_glsl__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE _mesa_glsl__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void _mesa_glsl__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void _mesa_glsl__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void _mesa_glsl_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void _mesa_glsl_pop_buffer_state (yyscan_t yyscanner ); + +static void _mesa_glsl_ensure_buffer_stack (yyscan_t yyscanner ); +static void _mesa_glsl__load_buffer_state (yyscan_t yyscanner ); +static void _mesa_glsl__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER _mesa_glsl__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE _mesa_glsl__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE _mesa_glsl__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *_mesa_glsl_alloc (yy_size_t ,yyscan_t yyscanner ); +void *_mesa_glsl_realloc (void *,yy_size_t ,yyscan_t yyscanner ); +void _mesa_glsl_free (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer _mesa_glsl__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + _mesa_glsl_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + _mesa_glsl_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define _mesa_glsl_wrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 183 +#define YY_END_OF_BUFFER 184 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[708] = + { 0, + 0, 0, 15, 15, 0, 0, 184, 182, 1, 20, + 182, 182, 182, 182, 182, 182, 182, 182, 96, 94, + 182, 182, 182, 181, 182, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 182, 1, 182, 91, 183, + 15, 19, 183, 18, 16, 17, 13, 12, 1, 80, + 87, 81, 90, 84, 75, 86, 76, 93, 98, 85, + 99, 96, 0, 0, 101, 0, 94, 0, 77, 79, + 78, 0, 181, 83, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 28, 181, 181, 181, + + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 32, 181, 181, 56, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 92, 82, 1, 0, 0, + 2, 0, 0, 0, 0, 15, 14, 18, 17, 0, + 98, 97, 0, 99, 0, 100, 95, 88, 89, 181, + 104, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 31, 181, 181, 181, 181, 181, 181, 181, + + 181, 181, 181, 25, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 57, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 0, 0, 0, 0, 14, 0, 98, 0, + 97, 0, 99, 100, 181, 181, 23, 181, 181, 144, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 30, + 107, 181, 181, 181, 181, 63, 181, 181, 112, 126, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 123, 147, 44, 45, 46, 181, 181, 181, 181, + + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 110, 102, 181, 181, + 181, 181, 181, 181, 181, 41, 42, 43, 73, 181, + 181, 0, 0, 0, 0, 0, 97, 181, 181, 26, + 35, 36, 37, 181, 105, 181, 22, 181, 181, 181, + 181, 134, 135, 136, 181, 103, 181, 127, 24, 137, + 138, 139, 149, 131, 132, 133, 181, 181, 181, 58, + 129, 181, 181, 38, 39, 40, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 181, 124, 181, 181, 181, 181, 181, 181, 181, + + 181, 181, 181, 106, 181, 146, 181, 181, 29, 0, + 0, 0, 0, 153, 181, 181, 151, 181, 181, 181, + 125, 120, 156, 181, 181, 181, 181, 181, 181, 115, + 181, 181, 74, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 181, 181, 181, 181, 130, 111, 181, 181, + 118, 34, 181, 181, 143, 64, 119, 72, 154, 113, + 181, 181, 181, 181, 181, 181, 181, 0, 0, 0, + 0, 181, 181, 181, 114, 33, 181, 181, 181, 181, + 181, 181, 157, 158, 159, 181, 181, 181, 181, 148, + 181, 181, 181, 181, 181, 181, 181, 181, 108, 181, + + 181, 181, 181, 181, 59, 181, 60, 181, 0, 0, + 0, 0, 0, 181, 61, 27, 121, 161, 162, 163, + 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 116, 181, 181, 181, 181, 181, 181, 181, 181, + 181, 109, 165, 166, 167, 181, 181, 128, 117, 0, + 0, 6, 0, 0, 0, 11, 3, 21, 181, 181, + 181, 181, 181, 181, 181, 181, 181, 160, 122, 62, + 145, 181, 152, 150, 180, 66, 67, 68, 181, 181, + 181, 181, 181, 181, 0, 0, 0, 0, 0, 0, + 181, 181, 181, 164, 181, 181, 181, 181, 181, 181, + + 181, 181, 181, 181, 181, 181, 181, 181, 181, 168, + 4, 0, 5, 0, 0, 0, 0, 0, 181, 181, + 181, 181, 181, 181, 181, 177, 181, 181, 181, 181, + 181, 181, 69, 181, 181, 181, 0, 0, 0, 181, + 181, 178, 169, 181, 170, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 179, 0, 0, 171, 172, 175, + 176, 65, 181, 140, 181, 141, 155, 173, 174, 0, + 0, 181, 181, 181, 0, 0, 0, 70, 181, 71, + 0, 0, 0, 181, 0, 0, 0, 181, 0, 0, + 7, 0, 0, 181, 0, 8, 0, 0, 142, 0, + + 0, 0, 0, 9, 0, 10, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 1, 6, 1, 7, 8, 1, 9, + 10, 11, 12, 1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 21, 21, 22, 22, 23, 1, 24, + 25, 26, 1, 1, 27, 28, 29, 30, 31, 32, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 34, 35, 33, 33, 33, 33, 36, 33, 33, + 1, 1, 1, 37, 38, 1, 39, 40, 41, 42, + + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 33, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 1, 64, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[65] = + { 0, + 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, + 4, 5, 1, 1, 1, 1, 6, 6, 6, 6, + 5, 5, 7, 7, 7, 8, 1, 7, 6, 6, + 6, 6, 5, 5, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 7, 7, 1 + } ; + +static yyconst flex_int16_t yy_base[719] = + { 0, + 0, 63, 88, 0, 1076, 1075, 1077, 1080, 64, 1080, + 1051, 1050, 59, 1049, 58, 60, 58, 1048, 139, 187, + 47, 1047, 56, 0, 1034, 121, 110, 137, 138, 134, + 163, 1017, 173, 177, 115, 149, 140, 1011, 159, 121, + 187, 194, 194, 172, 1022, 171, 249, 240, 1042, 1080, + 250, 1080, 1051, 241, 1080, 0, 1080, 1080, 262, 1080, + 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 236, 1080, + 238, 187, 286, 303, 1080, 0, 0, 1040, 1080, 1080, + 1080, 1039, 0, 1080, 1006, 1011, 1004, 1007, 1016, 1015, + 1001, 1004, 1016, 35, 1010, 997, 994, 1008, 994, 991, + + 991, 997, 215, 232, 991, 1002, 987, 993, 997, 998, + 0, 989, 1000, 234, 995, 975, 226, 979, 993, 983, + 119, 976, 234, 989, 991, 973, 969, 977, 974, 963, + 972, 256, 970, 976, 971, 974, 962, 965, 967, 245, + 970, 961, 974, 227, 967, 1080, 1080, 308, 294, 324, + 1080, 952, 965, 956, 967, 329, 0, 338, 0, 368, + 1080, 303, 379, 1080, 386, 393, 0, 1080, 1080, 962, + 0, 953, 957, 967, 964, 947, 946, 946, 950, 216, + 961, 958, 958, 956, 953, 944, 951, 937, 935, 948, + 933, 950, 0, 947, 934, 942, 939, 943, 944, 937, + + 934, 922, 921, 935, 938, 935, 922, 929, 919, 320, + 925, 928, 918, 926, 914, 918, 909, 924, 914, 905, + 924, 907, 905, 916, 905, 900, 898, 912, 897, 899, + 896, 908, 907, 910, 288, 901, 895, 884, 331, 903, + 905, 893, 885, 889, 901, 884, 0, 400, 410, 427, + 1080, 439, 446, 1080, 879, 890, 0, 887, 343, 0, + 880, 878, 880, 875, 884, 872, 890, 878, 346, 0, + 0, 872, 883, 882, 882, 0, 866, 350, 0, 0, + 868, 353, 876, 877, 867, 861, 860, 861, 860, 357, + 856, 0, 0, 852, 851, 850, 852, 853, 858, 852, + + 848, 862, 857, 856, 855, 846, 849, 849, 841, 844, + 839, 848, 853, 838, 851, 841, 0, 0, 848, 844, + 835, 835, 841, 840, 837, 0, 0, 0, 0, 826, + 839, 838, 837, 834, 822, 453, 463, 834, 836, 0, + 0, 0, 0, 822, 0, 822, 0, 821, 822, 816, + 827, 0, 0, 0, 817, 0, 813, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 824, 469, 823, 0, + 0, 821, 817, 0, 0, 0, 806, 415, 432, 473, + 811, 807, 813, 803, 801, 815, 799, 799, 813, 801, + 813, 808, 0, 806, 803, 807, 790, 792, 799, 805, + + 800, 799, 786, 0, 788, 0, 787, 791, 0, 785, + 834, 784, 787, 0, 775, 785, 0, 773, 773, 787, + 0, 789, 0, 482, 797, 796, 795, 766, 765, 0, + 783, 782, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 766, 780, 766, 763, 0, 0, 769, 768, + 0, 0, 766, 758, 0, 0, 0, 0, 0, 0, + 755, 767, 485, 759, 766, 763, 757, 750, 503, 766, + 751, 746, 760, 758, 0, 0, 750, 769, 768, 767, + 738, 737, 301, 481, 0, 750, 753, 751, 739, 0, + 749, 746, 745, 734, 733, 732, 509, 741, 0, 753, + + 752, 751, 722, 721, 0, 736, 0, 734, 729, 515, + 527, 773, 722, 730, 0, 0, 0, 745, 744, 0, + 726, 729, 713, 721, 711, 719, 720, 720, 719, 704, + 717, 0, 718, 706, 705, 701, 725, 724, 723, 694, + 693, 0, 723, 722, 0, 704, 707, 0, 0, 693, + 537, 1080, 561, 0, 567, 340, 1080, 0, 690, 689, + 699, 699, 686, 701, 684, 699, 694, 0, 0, 0, + 0, 679, 0, 0, 0, 700, 389, 700, 689, 692, + 676, 675, 685, 685, 675, 529, 589, 474, 683, 671, + 669, 668, 679, 0, 682, 678, 680, 676, 662, 669, + + 669, 671, 667, 669, 667, 667, 654, 653, 664, 0, + 1080, 531, 1080, 596, 0, 616, 666, 648, 665, 664, + 647, 635, 643, 633, 634, 0, 627, 646, 635, 607, + 604, 601, 0, 604, 603, 586, 533, 572, 580, 564, + 563, 0, 0, 564, 0, 540, 554, 552, 516, 530, + 505, 486, 453, 450, 0, 461, 443, 0, 0, 0, + 0, 0, 400, 406, 385, 0, 0, 0, 0, 343, + 389, 319, 267, 249, 487, 341, 235, 0, 200, 0, + 507, 498, 184, 157, 150, 564, 559, 136, 565, 591, + 1080, 593, 550, 112, 594, 1080, 569, 576, 0, 123, + + 619, 621, 637, 1080, 638, 1080, 1080, 648, 653, 658, + 663, 665, 667, 673, 680, 685, 690, 695 + } ; + +static yyconst flex_int16_t yy_def[719] = + { 0, + 707, 1, 707, 3, 708, 708, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 709, 707, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 710, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 711, 707, + 712, 19, 707, 707, 707, 713, 20, 707, 707, 707, + 707, 707, 709, 707, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 714, 707, 710, 707, + 707, 712, 707, 707, 707, 707, 713, 707, 707, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 707, 707, 707, 707, 714, 707, 707, 707, + 707, 707, 707, 707, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 707, 707, 707, 707, 707, 707, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 707, + 707, 707, 707, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 707, 707, 707, + 707, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 707, 715, + 707, 707, 707, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 707, + 707, 707, 707, 716, 707, 707, 707, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 707, 717, 707, 716, 707, 707, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 707, 707, 707, 707, 718, 707, 707, 707, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 718, 707, 707, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 709, + 709, 709, 709, 709, 709, 707, 707, 709, 709, 709, + 709, 709, 709, 709, 709, 709, 709, 709, 709, 707, + 707, 709, 709, 709, 707, 707, 707, 709, 709, 709, + 707, 707, 707, 709, 707, 707, 707, 709, 707, 707, + 707, 707, 707, 709, 707, 707, 707, 707, 709, 707, + + 707, 707, 707, 707, 707, 707, 0, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707 + } ; + +static yyconst flex_int16_t yy_nxt[1145] = + { 0, + 8, 9, 10, 9, 11, 8, 12, 13, 8, 8, + 14, 15, 16, 17, 18, 19, 20, 20, 20, 20, + 20, 20, 8, 21, 22, 23, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 25, 24, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 24, 24, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 24, 24, 24, 46, 47, 59, 62, 59, 48, 65, + 78, 79, 67, 69, 69, 69, 69, 69, 69, 69, + 81, 82, 66, 63, 68, 179, 180, 49, 50, 51, + 52, 51, 50, 50, 50, 50, 50, 50, 50, 50, + + 50, 50, 53, 50, 54, 54, 54, 54, 54, 54, + 55, 50, 50, 50, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 50, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 50, 71, 116, 72, 72, 72, 72, 72, 72, + 73, 85, 88, 126, 89, 213, 702, 117, 90, 74, + 75, 699, 214, 127, 76, 91, 86, 87, 120, 92, + 95, 74, 75, 99, 96, 100, 93, 118, 694, 94, + 97, 119, 121, 689, 101, 146, 98, 123, 688, 76, + + 71, 102, 77, 77, 77, 77, 77, 77, 77, 103, + 142, 108, 104, 124, 143, 105, 125, 74, 75, 109, + 111, 106, 707, 112, 144, 128, 687, 113, 114, 74, + 75, 110, 129, 130, 147, 115, 135, 131, 684, 136, + 139, 150, 151, 132, 133, 140, 134, 707, 137, 141, + 148, 156, 59, 156, 149, 138, 158, 158, 158, 158, + 158, 158, 158, 59, 189, 59, 160, 161, 163, 164, + 191, 264, 265, 240, 216, 190, 241, 208, 160, 161, + 163, 164, 152, 201, 192, 209, 202, 203, 217, 153, + 204, 235, 205, 154, 226, 150, 151, 683, 155, 71, + + 236, 73, 73, 73, 73, 73, 73, 73, 680, 148, + 227, 59, 679, 149, 165, 165, 74, 75, 166, 166, + 166, 166, 166, 166, 166, 150, 151, 523, 74, 75, + 156, 321, 156, 250, 251, 524, 152, 294, 295, 296, + 322, 556, 681, 153, 675, 250, 251, 154, 326, 327, + 328, 676, 155, 158, 158, 158, 158, 158, 158, 158, + 341, 342, 343, 352, 353, 354, 152, 360, 361, 362, + 364, 365, 366, 153, 374, 375, 376, 154, 678, 248, + 248, 589, 155, 249, 249, 249, 249, 249, 249, 249, + 252, 252, 590, 682, 253, 253, 253, 253, 253, 253, + + 253, 166, 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 249, 249, 249, 249, 249, + 249, 249, 602, 603, 254, 249, 249, 249, 249, 249, + 249, 249, 434, 435, 436, 677, 254, 674, 336, 336, + 673, 161, 337, 337, 337, 337, 337, 337, 337, 437, + 438, 439, 672, 161, 253, 253, 253, 253, 253, 253, + 253, 253, 253, 253, 253, 253, 253, 253, 337, 337, + 337, 337, 337, 337, 337, 551, 552, 164, 337, 337, + 337, 337, 337, 337, 337, 425, 426, 427, 675, 164, + 440, 441, 442, 671, 251, 676, 428, 429, 478, 479, + + 480, 500, 501, 502, 469, 670, 251, 525, 681, 481, + 482, 669, 503, 504, 668, 526, 551, 552, 510, 511, + 511, 511, 511, 511, 511, 537, 538, 539, 551, 552, + 612, 613, 612, 613, 612, 613, 540, 541, 551, 552, + 667, 685, 555, 555, 555, 555, 555, 555, 555, 686, + 554, 697, 586, 587, 587, 587, 587, 587, 587, 682, + 692, 666, 551, 552, 615, 690, 695, 693, 551, 552, + 697, 665, 664, 691, 696, 554, 553, 553, 553, 553, + 553, 553, 555, 555, 555, 555, 555, 555, 555, 615, + 612, 613, 690, 663, 692, 695, 662, 612, 613, 661, + + 691, 693, 698, 696, 616, 616, 616, 616, 616, 616, + 616, 614, 614, 614, 614, 614, 614, 612, 613, 700, + 703, 698, 705, 660, 659, 658, 657, 701, 704, 656, + 706, 616, 616, 616, 616, 616, 616, 616, 703, 705, + 655, 654, 653, 652, 651, 650, 704, 706, 57, 57, + 57, 57, 57, 57, 57, 57, 83, 83, 83, 83, + 83, 159, 159, 159, 159, 159, 69, 69, 162, 162, + 167, 167, 167, 247, 247, 649, 247, 247, 247, 247, + 247, 553, 553, 553, 648, 647, 646, 553, 588, 588, + 588, 614, 614, 614, 645, 644, 643, 614, 637, 637, + + 637, 642, 641, 640, 639, 638, 636, 635, 634, 633, + 632, 631, 630, 629, 628, 627, 626, 625, 624, 623, + 622, 621, 620, 619, 618, 617, 611, 610, 609, 608, + 607, 606, 605, 604, 601, 600, 599, 598, 597, 596, + 595, 594, 593, 592, 591, 585, 584, 583, 582, 581, + 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, + 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, + 560, 559, 558, 557, 556, 550, 549, 548, 547, 546, + 545, 544, 543, 542, 536, 535, 534, 533, 532, 531, + 530, 529, 528, 527, 522, 521, 520, 519, 518, 517, + + 516, 515, 514, 513, 512, 509, 508, 507, 506, 505, + 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, + 489, 488, 487, 486, 485, 484, 483, 477, 476, 475, + 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, + 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, + 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, + 444, 443, 433, 432, 431, 430, 424, 423, 422, 421, + 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, + 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, + 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, + + 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, + 380, 379, 378, 377, 373, 372, 371, 370, 369, 368, + 367, 363, 359, 358, 357, 356, 355, 351, 350, 349, + 348, 347, 346, 345, 344, 340, 339, 338, 335, 334, + 333, 332, 331, 330, 329, 325, 324, 323, 320, 319, + 318, 317, 316, 315, 314, 313, 312, 311, 310, 309, + 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, + 298, 297, 293, 292, 291, 290, 289, 288, 287, 286, + 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, + 275, 274, 273, 272, 271, 270, 269, 268, 267, 266, + + 263, 262, 261, 260, 259, 258, 257, 256, 255, 246, + 245, 244, 243, 242, 239, 238, 237, 234, 233, 232, + 231, 230, 229, 228, 225, 224, 223, 222, 221, 220, + 219, 218, 215, 212, 211, 210, 207, 206, 200, 199, + 198, 197, 196, 195, 194, 193, 188, 187, 186, 185, + 184, 183, 182, 181, 178, 177, 176, 175, 174, 173, + 172, 171, 170, 169, 168, 157, 80, 145, 122, 107, + 84, 80, 70, 64, 61, 60, 707, 58, 58, 7, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707 + } ; + +static yyconst flex_int16_t yy_chk[1145] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 9, 13, 9, 2, 15, + 21, 21, 16, 17, 17, 17, 17, 17, 17, 17, + 23, 23, 15, 13, 16, 94, 94, 2, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 19, 35, 19, 19, 19, 19, 19, 19, + 19, 26, 27, 40, 27, 121, 700, 35, 27, 19, + 19, 694, 121, 40, 19, 28, 26, 26, 37, 28, + 29, 19, 19, 30, 29, 30, 28, 36, 688, 28, + 29, 36, 37, 685, 30, 46, 29, 39, 684, 19, + + 20, 31, 20, 20, 20, 20, 20, 20, 20, 31, + 44, 33, 31, 39, 44, 31, 39, 20, 20, 33, + 34, 31, 72, 34, 44, 41, 683, 34, 34, 20, + 20, 33, 41, 41, 46, 34, 42, 41, 679, 42, + 43, 48, 48, 41, 41, 43, 41, 72, 42, 43, + 47, 51, 47, 51, 47, 42, 54, 54, 54, 54, + 54, 54, 54, 59, 103, 59, 69, 69, 71, 71, + 104, 180, 180, 144, 123, 103, 144, 117, 69, 69, + 71, 71, 48, 114, 104, 117, 114, 114, 123, 48, + 114, 140, 114, 48, 132, 149, 149, 677, 48, 73, + + 140, 73, 73, 73, 73, 73, 73, 73, 674, 148, + 132, 148, 673, 148, 74, 74, 73, 73, 74, 74, + 74, 74, 74, 74, 74, 150, 150, 483, 73, 73, + 156, 235, 156, 162, 162, 483, 149, 210, 210, 210, + 235, 556, 676, 149, 670, 162, 162, 149, 239, 239, + 239, 670, 149, 158, 158, 158, 158, 158, 158, 158, + 259, 259, 259, 269, 269, 269, 150, 278, 278, 278, + 282, 282, 282, 150, 290, 290, 290, 150, 672, 160, + 160, 556, 150, 160, 160, 160, 160, 160, 160, 160, + 163, 163, 556, 676, 163, 163, 163, 163, 163, 163, + + 163, 165, 165, 165, 165, 165, 165, 165, 166, 166, + 166, 166, 166, 166, 166, 248, 248, 248, 248, 248, + 248, 248, 577, 577, 166, 249, 249, 249, 249, 249, + 249, 249, 378, 378, 378, 671, 166, 665, 250, 250, + 664, 249, 250, 250, 250, 250, 250, 250, 250, 379, + 379, 379, 663, 249, 252, 252, 252, 252, 252, 252, + 252, 253, 253, 253, 253, 253, 253, 253, 336, 336, + 336, 336, 336, 336, 336, 588, 588, 253, 337, 337, + 337, 337, 337, 337, 337, 368, 368, 368, 675, 253, + 380, 380, 380, 657, 337, 675, 368, 368, 424, 424, + + 424, 463, 463, 463, 469, 656, 337, 484, 681, 424, + 424, 654, 463, 463, 653, 484, 510, 510, 469, 469, + 469, 469, 469, 469, 469, 497, 497, 497, 511, 511, + 586, 586, 612, 612, 637, 637, 497, 497, 551, 551, + 652, 682, 511, 511, 511, 511, 511, 511, 511, 682, + 510, 693, 551, 551, 551, 551, 551, 551, 551, 681, + 687, 651, 553, 553, 586, 686, 689, 687, 555, 555, + 697, 650, 649, 686, 689, 510, 553, 553, 553, 553, + 553, 553, 555, 555, 555, 555, 555, 555, 555, 586, + 587, 587, 690, 648, 692, 695, 647, 614, 614, 646, + + 690, 692, 693, 695, 587, 587, 587, 587, 587, 587, + 587, 614, 614, 614, 614, 614, 614, 616, 616, 698, + 701, 697, 702, 644, 641, 640, 639, 698, 701, 638, + 702, 616, 616, 616, 616, 616, 616, 616, 703, 705, + 636, 635, 634, 632, 631, 630, 703, 705, 708, 708, + 708, 708, 708, 708, 708, 708, 709, 709, 709, 709, + 709, 710, 710, 710, 710, 710, 711, 711, 712, 712, + 713, 713, 713, 714, 714, 629, 714, 714, 714, 714, + 714, 715, 715, 715, 628, 627, 625, 715, 716, 716, + 716, 717, 717, 717, 624, 623, 622, 717, 718, 718, + + 718, 621, 620, 619, 618, 617, 609, 608, 607, 606, + 605, 604, 603, 602, 601, 600, 599, 598, 597, 596, + 595, 593, 592, 591, 590, 589, 585, 584, 583, 582, + 581, 580, 579, 578, 576, 572, 567, 566, 565, 564, + 563, 562, 561, 560, 559, 550, 547, 546, 544, 543, + 541, 540, 539, 538, 537, 536, 535, 534, 533, 531, + 530, 529, 528, 527, 526, 525, 524, 523, 522, 521, + 519, 518, 514, 513, 512, 509, 508, 506, 504, 503, + 502, 501, 500, 498, 496, 495, 494, 493, 492, 491, + 489, 488, 487, 486, 482, 481, 480, 479, 478, 477, + + 474, 473, 472, 471, 470, 468, 467, 466, 465, 464, + 462, 461, 454, 453, 450, 449, 446, 445, 444, 443, + 432, 431, 429, 428, 427, 426, 425, 422, 420, 419, + 418, 416, 415, 413, 412, 411, 410, 408, 407, 405, + 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, + 392, 391, 390, 389, 388, 387, 386, 385, 384, 383, + 382, 381, 377, 373, 372, 369, 367, 357, 355, 351, + 350, 349, 348, 346, 344, 339, 338, 335, 334, 333, + 332, 331, 330, 325, 324, 323, 322, 321, 320, 319, + 316, 315, 314, 313, 312, 311, 310, 309, 308, 307, + + 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, + 296, 295, 294, 291, 289, 288, 287, 286, 285, 284, + 283, 281, 277, 275, 274, 273, 272, 268, 267, 266, + 265, 264, 263, 262, 261, 258, 256, 255, 246, 245, + 244, 243, 242, 241, 240, 238, 237, 236, 234, 233, + 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, + 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, + 212, 211, 209, 208, 207, 206, 205, 204, 203, 202, + 201, 200, 199, 198, 197, 196, 195, 194, 192, 191, + 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, + + 179, 178, 177, 176, 175, 174, 173, 172, 170, 155, + 154, 153, 152, 145, 143, 142, 141, 139, 138, 137, + 136, 135, 134, 133, 131, 130, 129, 128, 127, 126, + 125, 124, 122, 120, 119, 118, 116, 115, 113, 112, + 110, 109, 108, 107, 106, 105, 102, 101, 100, 99, + 98, 97, 96, 95, 93, 92, 91, 90, 89, 88, + 87, 86, 85, 82, 78, 53, 49, 45, 38, 32, + 25, 22, 18, 14, 12, 11, 7, 6, 5, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, + 707, 707, 707, 707 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "glsl_lexer.lpp" +#line 2 "glsl_lexer.lpp" +/* + * Copyright © 2008, 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <ctype.h> +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_parser.h" + +#define YY_USER_ACTION \ + do { \ + yylloc->source = 0; \ + yylloc->first_column = yycolumn + 1; \ + yylloc->first_line = yylineno + 1; \ + yycolumn += yyleng; \ + } while(0); + +#define YY_USER_INIT yylineno = 0; yycolumn = 0; + +#define TOKEN_OR_IDENTIFIER(version, token) \ + do { \ + if (yyextra->language_version >= version) { \ + return token; \ + } else { \ + yylval->identifier = strdup(yytext); \ + return IDENTIFIER; \ + } \ + } while (0) + +/* Handle reserved words in GLSL ES (version 100) */ +#define TOKEN_OR_IDENTIFIER_ES(version, token) \ + do { \ + if (yyextra->es_shader) { \ + return token; \ + } else { \ + TOKEN_OR_IDENTIFIER(version, token); \ + } \ + } while (0) + +#define RESERVED_WORD(version, token) \ + do { \ + if (yyextra->language_version >= version) { \ + return token; \ + } else { \ + _mesa_glsl_error(yylloc, yyextra, \ + "Illegal use of reserved word `%s'", yytext); \ + return ERROR_TOK; \ + } \ + } while (0) + +#line 990 "glsl_lexer.cpp" + +#define INITIAL 0 +#define PP 1 +#define PRAGMA 2 + +#define YY_EXTRA_TYPE struct _mesa_glsl_parse_state * + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + YYLTYPE * yylloc_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + + # define yylloc yyg->yylloc_r + +int _mesa_glsl_lex_init (yyscan_t* scanner); + +int _mesa_glsl_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int _mesa_glsl_lex_destroy (yyscan_t yyscanner ); + +int _mesa_glsl_get_debug (yyscan_t yyscanner ); + +void _mesa_glsl_set_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE _mesa_glsl_get_extra (yyscan_t yyscanner ); + +void _mesa_glsl_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *_mesa_glsl_get_in (yyscan_t yyscanner ); + +void _mesa_glsl_set_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *_mesa_glsl_get_out (yyscan_t yyscanner ); + +void _mesa_glsl_set_out (FILE * out_str ,yyscan_t yyscanner ); + +int _mesa_glsl_get_leng (yyscan_t yyscanner ); + +char *_mesa_glsl_get_text (yyscan_t yyscanner ); + +int _mesa_glsl_get_lineno (yyscan_t yyscanner ); + +void _mesa_glsl_set_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * _mesa_glsl_get_lval (yyscan_t yyscanner ); + +void _mesa_glsl_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + + YYLTYPE *_mesa_glsl_get_lloc (yyscan_t yyscanner ); + + void _mesa_glsl_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int _mesa_glsl_wrap (yyscan_t yyscanner ); +#else +extern int _mesa_glsl_wrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int _mesa_glsl_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int _mesa_glsl_lex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 86 "glsl_lexer.lpp" + + +#line 1227 "glsl_lexer.cpp" + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + _mesa_glsl_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + _mesa_glsl__load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 708 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 707 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 88 "glsl_lexer.lpp" +; + YY_BREAK +/* Preprocessor tokens. */ +case 2: +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 91 "glsl_lexer.lpp" +; + YY_BREAK +case 3: +YY_RULE_SETUP +#line 92 "glsl_lexer.lpp" +{ BEGIN PP; return VERSION; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 93 "glsl_lexer.lpp" +{ BEGIN PP; return EXTENSION; } + YY_BREAK +case 5: +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 94 "glsl_lexer.lpp" +{ + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + yylloc->source = strtol(ptr, NULL, 0); + } + YY_BREAK +case 6: +*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +yyg->yy_c_buf_p = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +#line 109 "glsl_lexer.lpp" +{ + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 123 "glsl_lexer.lpp" +{ + BEGIN PP; + return PRAGMA_DEBUG_ON; + } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 127 "glsl_lexer.lpp" +{ + BEGIN PP; + return PRAGMA_DEBUG_OFF; + } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 131 "glsl_lexer.lpp" +{ + BEGIN PP; + return PRAGMA_OPTIMIZE_ON; + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 135 "glsl_lexer.lpp" +{ + BEGIN PP; + return PRAGMA_OPTIMIZE_OFF; + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 139 "glsl_lexer.lpp" +{ BEGIN PRAGMA; } + YY_BREAK +case 12: +/* rule 12 can match eol */ +YY_RULE_SETUP +#line 141 "glsl_lexer.lpp" +{ BEGIN 0; yylineno++; yycolumn = 0; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 142 "glsl_lexer.lpp" +{ } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 144 "glsl_lexer.lpp" +{ } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 145 "glsl_lexer.lpp" +{ } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 146 "glsl_lexer.lpp" +return COLON; + YY_BREAK +case 17: +YY_RULE_SETUP +#line 147 "glsl_lexer.lpp" +{ + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 151 "glsl_lexer.lpp" +{ + yylval->n = strtol(yytext, NULL, 10); + return INTCONSTANT; + } + YY_BREAK +case 19: +/* rule 19 can match eol */ +YY_RULE_SETUP +#line 155 "glsl_lexer.lpp" +{ BEGIN 0; yylineno++; yycolumn = 0; return EOL; } + YY_BREAK +case 20: +/* rule 20 can match eol */ +YY_RULE_SETUP +#line 157 "glsl_lexer.lpp" +{ yylineno++; yycolumn = 0; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 159 "glsl_lexer.lpp" +return ATTRIBUTE; + YY_BREAK +case 22: +YY_RULE_SETUP +#line 160 "glsl_lexer.lpp" +return CONST_TOK; + YY_BREAK +case 23: +YY_RULE_SETUP +#line 161 "glsl_lexer.lpp" +return BOOL_TOK; + YY_BREAK +case 24: +YY_RULE_SETUP +#line 162 "glsl_lexer.lpp" +return FLOAT_TOK; + YY_BREAK +case 25: +YY_RULE_SETUP +#line 163 "glsl_lexer.lpp" +return INT_TOK; + YY_BREAK +case 26: +YY_RULE_SETUP +#line 165 "glsl_lexer.lpp" +return BREAK; + YY_BREAK +case 27: +YY_RULE_SETUP +#line 166 "glsl_lexer.lpp" +return CONTINUE; + YY_BREAK +case 28: +YY_RULE_SETUP +#line 167 "glsl_lexer.lpp" +return DO; + YY_BREAK +case 29: +YY_RULE_SETUP +#line 168 "glsl_lexer.lpp" +return WHILE; + YY_BREAK +case 30: +YY_RULE_SETUP +#line 169 "glsl_lexer.lpp" +return ELSE; + YY_BREAK +case 31: +YY_RULE_SETUP +#line 170 "glsl_lexer.lpp" +return FOR; + YY_BREAK +case 32: +YY_RULE_SETUP +#line 171 "glsl_lexer.lpp" +return IF; + YY_BREAK +case 33: +YY_RULE_SETUP +#line 172 "glsl_lexer.lpp" +return DISCARD; + YY_BREAK +case 34: +YY_RULE_SETUP +#line 173 "glsl_lexer.lpp" +return RETURN; + YY_BREAK +case 35: +YY_RULE_SETUP +#line 175 "glsl_lexer.lpp" +return BVEC2; + YY_BREAK +case 36: +YY_RULE_SETUP +#line 176 "glsl_lexer.lpp" +return BVEC3; + YY_BREAK +case 37: +YY_RULE_SETUP +#line 177 "glsl_lexer.lpp" +return BVEC4; + YY_BREAK +case 38: +YY_RULE_SETUP +#line 178 "glsl_lexer.lpp" +return IVEC2; + YY_BREAK +case 39: +YY_RULE_SETUP +#line 179 "glsl_lexer.lpp" +return IVEC3; + YY_BREAK +case 40: +YY_RULE_SETUP +#line 180 "glsl_lexer.lpp" +return IVEC4; + YY_BREAK +case 41: +YY_RULE_SETUP +#line 181 "glsl_lexer.lpp" +return VEC2; + YY_BREAK +case 42: +YY_RULE_SETUP +#line 182 "glsl_lexer.lpp" +return VEC3; + YY_BREAK +case 43: +YY_RULE_SETUP +#line 183 "glsl_lexer.lpp" +return VEC4; + YY_BREAK +case 44: +YY_RULE_SETUP +#line 184 "glsl_lexer.lpp" +return MAT2X2; + YY_BREAK +case 45: +YY_RULE_SETUP +#line 185 "glsl_lexer.lpp" +return MAT3X3; + YY_BREAK +case 46: +YY_RULE_SETUP +#line 186 "glsl_lexer.lpp" +return MAT4X4; + YY_BREAK +case 47: +YY_RULE_SETUP +#line 187 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT2X2); + YY_BREAK +case 48: +YY_RULE_SETUP +#line 188 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT2X3); + YY_BREAK +case 49: +YY_RULE_SETUP +#line 189 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT2X4); + YY_BREAK +case 50: +YY_RULE_SETUP +#line 190 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT3X2); + YY_BREAK +case 51: +YY_RULE_SETUP +#line 191 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT3X3); + YY_BREAK +case 52: +YY_RULE_SETUP +#line 192 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT3X4); + YY_BREAK +case 53: +YY_RULE_SETUP +#line 193 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT4X2); + YY_BREAK +case 54: +YY_RULE_SETUP +#line 194 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT4X3); + YY_BREAK +case 55: +YY_RULE_SETUP +#line 195 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, MAT4X4); + YY_BREAK +case 56: +YY_RULE_SETUP +#line 197 "glsl_lexer.lpp" +return IN_TOK; + YY_BREAK +case 57: +YY_RULE_SETUP +#line 198 "glsl_lexer.lpp" +return OUT_TOK; + YY_BREAK +case 58: +YY_RULE_SETUP +#line 199 "glsl_lexer.lpp" +return INOUT_TOK; + YY_BREAK +case 59: +YY_RULE_SETUP +#line 200 "glsl_lexer.lpp" +return UNIFORM; + YY_BREAK +case 60: +YY_RULE_SETUP +#line 201 "glsl_lexer.lpp" +return VARYING; + YY_BREAK +case 61: +YY_RULE_SETUP +#line 202 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(120, CENTROID); + YY_BREAK +case 62: +YY_RULE_SETUP +#line 203 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, INVARIANT); + YY_BREAK +case 63: +YY_RULE_SETUP +#line 205 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(130, FLAT); + YY_BREAK +case 64: +YY_RULE_SETUP +#line 206 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, SMOOTH); + YY_BREAK +case 65: +YY_RULE_SETUP +#line 207 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE); + YY_BREAK +case 66: +YY_RULE_SETUP +#line 209 "glsl_lexer.lpp" +return SAMPLER1D; + YY_BREAK +case 67: +YY_RULE_SETUP +#line 210 "glsl_lexer.lpp" +return SAMPLER2D; + YY_BREAK +case 68: +YY_RULE_SETUP +#line 211 "glsl_lexer.lpp" +return SAMPLER3D; + YY_BREAK +case 69: +YY_RULE_SETUP +#line 212 "glsl_lexer.lpp" +return SAMPLERCUBE; + YY_BREAK +case 70: +YY_RULE_SETUP +#line 213 "glsl_lexer.lpp" +return SAMPLER1DSHADOW; + YY_BREAK +case 71: +YY_RULE_SETUP +#line 214 "glsl_lexer.lpp" +return SAMPLER2DSHADOW; + YY_BREAK +case 72: +YY_RULE_SETUP +#line 216 "glsl_lexer.lpp" +return STRUCT; + YY_BREAK +case 73: +YY_RULE_SETUP +#line 217 "glsl_lexer.lpp" +return VOID_TOK; + YY_BREAK +case 74: +YY_RULE_SETUP +#line 219 "glsl_lexer.lpp" +{ + if ((yyextra->language_version >= 140) + || (yyextra->ARB_fragment_coord_conventions_enable)){ + return LAYOUT_TOK; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + YY_BREAK +case 75: +YY_RULE_SETUP +#line 229 "glsl_lexer.lpp" +return INC_OP; + YY_BREAK +case 76: +YY_RULE_SETUP +#line 230 "glsl_lexer.lpp" +return DEC_OP; + YY_BREAK +case 77: +YY_RULE_SETUP +#line 231 "glsl_lexer.lpp" +return LE_OP; + YY_BREAK +case 78: +YY_RULE_SETUP +#line 232 "glsl_lexer.lpp" +return GE_OP; + YY_BREAK +case 79: +YY_RULE_SETUP +#line 233 "glsl_lexer.lpp" +return EQ_OP; + YY_BREAK +case 80: +YY_RULE_SETUP +#line 234 "glsl_lexer.lpp" +return NE_OP; + YY_BREAK +case 81: +YY_RULE_SETUP +#line 235 "glsl_lexer.lpp" +return AND_OP; + YY_BREAK +case 82: +YY_RULE_SETUP +#line 236 "glsl_lexer.lpp" +return OR_OP; + YY_BREAK +case 83: +YY_RULE_SETUP +#line 237 "glsl_lexer.lpp" +return XOR_OP; + YY_BREAK +case 84: +YY_RULE_SETUP +#line 239 "glsl_lexer.lpp" +return MUL_ASSIGN; + YY_BREAK +case 85: +YY_RULE_SETUP +#line 240 "glsl_lexer.lpp" +return DIV_ASSIGN; + YY_BREAK +case 86: +YY_RULE_SETUP +#line 241 "glsl_lexer.lpp" +return ADD_ASSIGN; + YY_BREAK +case 87: +YY_RULE_SETUP +#line 242 "glsl_lexer.lpp" +return MOD_ASSIGN; + YY_BREAK +case 88: +YY_RULE_SETUP +#line 243 "glsl_lexer.lpp" +return LEFT_ASSIGN; + YY_BREAK +case 89: +YY_RULE_SETUP +#line 244 "glsl_lexer.lpp" +return RIGHT_ASSIGN; + YY_BREAK +case 90: +YY_RULE_SETUP +#line 245 "glsl_lexer.lpp" +return AND_ASSIGN; + YY_BREAK +case 91: +YY_RULE_SETUP +#line 246 "glsl_lexer.lpp" +return XOR_ASSIGN; + YY_BREAK +case 92: +YY_RULE_SETUP +#line 247 "glsl_lexer.lpp" +return OR_ASSIGN; + YY_BREAK +case 93: +YY_RULE_SETUP +#line 248 "glsl_lexer.lpp" +return SUB_ASSIGN; + YY_BREAK +case 94: +YY_RULE_SETUP +#line 250 "glsl_lexer.lpp" +{ + yylval->n = strtol(yytext, NULL, 10); + return INTCONSTANT; + } + YY_BREAK +case 95: +YY_RULE_SETUP +#line 254 "glsl_lexer.lpp" +{ + yylval->n = strtol(yytext + 2, NULL, 16); + return INTCONSTANT; + } + YY_BREAK +case 96: +YY_RULE_SETUP +#line 258 "glsl_lexer.lpp" +{ + yylval->n = strtol(yytext, NULL, 8); + return INTCONSTANT; + } + YY_BREAK +case 97: +YY_RULE_SETUP +#line 263 "glsl_lexer.lpp" +{ + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + YY_BREAK +case 98: +YY_RULE_SETUP +#line 267 "glsl_lexer.lpp" +{ + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + YY_BREAK +case 99: +YY_RULE_SETUP +#line 271 "glsl_lexer.lpp" +{ + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + YY_BREAK +case 100: +YY_RULE_SETUP +#line 275 "glsl_lexer.lpp" +{ + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + YY_BREAK +case 101: +YY_RULE_SETUP +#line 279 "glsl_lexer.lpp" +{ + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + YY_BREAK +case 102: +YY_RULE_SETUP +#line 284 "glsl_lexer.lpp" +{ + yylval->n = 1; + return BOOLCONSTANT; + } + YY_BREAK +case 103: +YY_RULE_SETUP +#line 288 "glsl_lexer.lpp" +{ + yylval->n = 0; + return BOOLCONSTANT; + } + YY_BREAK +/* Reserved words in GLSL 1.10. */ +case 104: +YY_RULE_SETUP +#line 295 "glsl_lexer.lpp" +RESERVED_WORD(999, ASM); + YY_BREAK +case 105: +YY_RULE_SETUP +#line 296 "glsl_lexer.lpp" +RESERVED_WORD(999, CLASS); + YY_BREAK +case 106: +YY_RULE_SETUP +#line 297 "glsl_lexer.lpp" +RESERVED_WORD(999, UNION); + YY_BREAK +case 107: +YY_RULE_SETUP +#line 298 "glsl_lexer.lpp" +RESERVED_WORD(999, ENUM); + YY_BREAK +case 108: +YY_RULE_SETUP +#line 299 "glsl_lexer.lpp" +RESERVED_WORD(999, TYPEDEF); + YY_BREAK +case 109: +YY_RULE_SETUP +#line 300 "glsl_lexer.lpp" +RESERVED_WORD(999, TEMPLATE); + YY_BREAK +case 110: +YY_RULE_SETUP +#line 301 "glsl_lexer.lpp" +RESERVED_WORD(999, THIS); + YY_BREAK +case 111: +YY_RULE_SETUP +#line 302 "glsl_lexer.lpp" +RESERVED_WORD(999, PACKED_TOK); + YY_BREAK +case 112: +YY_RULE_SETUP +#line 303 "glsl_lexer.lpp" +RESERVED_WORD(999, GOTO); + YY_BREAK +case 113: +YY_RULE_SETUP +#line 304 "glsl_lexer.lpp" +RESERVED_WORD(130, SWITCH); + YY_BREAK +case 114: +YY_RULE_SETUP +#line 305 "glsl_lexer.lpp" +RESERVED_WORD(130, DEFAULT); + YY_BREAK +case 115: +YY_RULE_SETUP +#line 306 "glsl_lexer.lpp" +RESERVED_WORD(999, INLINE_TOK); + YY_BREAK +case 116: +YY_RULE_SETUP +#line 307 "glsl_lexer.lpp" +RESERVED_WORD(999, NOINLINE); + YY_BREAK +case 117: +YY_RULE_SETUP +#line 308 "glsl_lexer.lpp" +RESERVED_WORD(999, VOLATILE); + YY_BREAK +case 118: +YY_RULE_SETUP +#line 309 "glsl_lexer.lpp" +RESERVED_WORD(999, PUBLIC_TOK); + YY_BREAK +case 119: +YY_RULE_SETUP +#line 310 "glsl_lexer.lpp" +RESERVED_WORD(999, STATIC); + YY_BREAK +case 120: +YY_RULE_SETUP +#line 311 "glsl_lexer.lpp" +RESERVED_WORD(999, EXTERN); + YY_BREAK +case 121: +YY_RULE_SETUP +#line 312 "glsl_lexer.lpp" +RESERVED_WORD(999, EXTERNAL); + YY_BREAK +case 122: +YY_RULE_SETUP +#line 313 "glsl_lexer.lpp" +RESERVED_WORD(999, INTERFACE); + YY_BREAK +case 123: +YY_RULE_SETUP +#line 314 "glsl_lexer.lpp" +RESERVED_WORD(999, LONG_TOK); + YY_BREAK +case 124: +YY_RULE_SETUP +#line 315 "glsl_lexer.lpp" +RESERVED_WORD(999, SHORT_TOK); + YY_BREAK +case 125: +YY_RULE_SETUP +#line 316 "glsl_lexer.lpp" +RESERVED_WORD(999, DOUBLE_TOK); + YY_BREAK +case 126: +YY_RULE_SETUP +#line 317 "glsl_lexer.lpp" +RESERVED_WORD(999, HALF); + YY_BREAK +case 127: +YY_RULE_SETUP +#line 318 "glsl_lexer.lpp" +RESERVED_WORD(999, FIXED_TOK); + YY_BREAK +case 128: +YY_RULE_SETUP +#line 319 "glsl_lexer.lpp" +RESERVED_WORD(999, UNSIGNED); + YY_BREAK +case 129: +YY_RULE_SETUP +#line 320 "glsl_lexer.lpp" +RESERVED_WORD(999, INPUT_TOK); + YY_BREAK +case 130: +YY_RULE_SETUP +#line 321 "glsl_lexer.lpp" +RESERVED_WORD(999, OUTPUT); + YY_BREAK +case 131: +YY_RULE_SETUP +#line 322 "glsl_lexer.lpp" +RESERVED_WORD(999, HVEC2); + YY_BREAK +case 132: +YY_RULE_SETUP +#line 323 "glsl_lexer.lpp" +RESERVED_WORD(999, HVEC3); + YY_BREAK +case 133: +YY_RULE_SETUP +#line 324 "glsl_lexer.lpp" +RESERVED_WORD(999, HVEC4); + YY_BREAK +case 134: +YY_RULE_SETUP +#line 325 "glsl_lexer.lpp" +RESERVED_WORD(999, DVEC2); + YY_BREAK +case 135: +YY_RULE_SETUP +#line 326 "glsl_lexer.lpp" +RESERVED_WORD(999, DVEC3); + YY_BREAK +case 136: +YY_RULE_SETUP +#line 327 "glsl_lexer.lpp" +RESERVED_WORD(999, DVEC4); + YY_BREAK +case 137: +YY_RULE_SETUP +#line 328 "glsl_lexer.lpp" +RESERVED_WORD(999, FVEC2); + YY_BREAK +case 138: +YY_RULE_SETUP +#line 329 "glsl_lexer.lpp" +RESERVED_WORD(999, FVEC3); + YY_BREAK +case 139: +YY_RULE_SETUP +#line 330 "glsl_lexer.lpp" +RESERVED_WORD(999, FVEC4); + YY_BREAK +case 140: +YY_RULE_SETUP +#line 331 "glsl_lexer.lpp" +return SAMPLER2DRECT; + YY_BREAK +case 141: +YY_RULE_SETUP +#line 332 "glsl_lexer.lpp" +RESERVED_WORD(999, SAMPLER3DRECT); + YY_BREAK +case 142: +YY_RULE_SETUP +#line 333 "glsl_lexer.lpp" +return SAMPLER2DRECTSHADOW; + YY_BREAK +case 143: +YY_RULE_SETUP +#line 334 "glsl_lexer.lpp" +RESERVED_WORD(999, SIZEOF); + YY_BREAK +case 144: +YY_RULE_SETUP +#line 335 "glsl_lexer.lpp" +RESERVED_WORD(999, CAST); + YY_BREAK +case 145: +YY_RULE_SETUP +#line 336 "glsl_lexer.lpp" +RESERVED_WORD(999, NAMESPACE); + YY_BREAK +case 146: +YY_RULE_SETUP +#line 337 "glsl_lexer.lpp" +RESERVED_WORD(999, USING); + YY_BREAK +/* Additional reserved words in GLSL 1.20. */ +case 147: +YY_RULE_SETUP +#line 340 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, LOWP); + YY_BREAK +case 148: +YY_RULE_SETUP +#line 341 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, MEDIUMP); + YY_BREAK +case 149: +YY_RULE_SETUP +#line 342 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, HIGHP); + YY_BREAK +case 150: +YY_RULE_SETUP +#line 343 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(120, PRECISION); + YY_BREAK +/* Additional reserved words in GLSL 1.30. */ +case 151: +YY_RULE_SETUP +#line 346 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, COMMON); + YY_BREAK +case 152: +YY_RULE_SETUP +#line 347 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, PARTITION); + YY_BREAK +case 153: +YY_RULE_SETUP +#line 348 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, ACTIVE); + YY_BREAK +case 154: +YY_RULE_SETUP +#line 349 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER_ES(130, SUPERP); + YY_BREAK +case 155: +YY_RULE_SETUP +#line 350 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER); + YY_BREAK +case 156: +YY_RULE_SETUP +#line 351 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, FILTER); + YY_BREAK +case 157: +YY_RULE_SETUP +#line 352 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE1D); + YY_BREAK +case 158: +YY_RULE_SETUP +#line 353 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE2D); + YY_BREAK +case 159: +YY_RULE_SETUP +#line 354 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE3D); + YY_BREAK +case 160: +YY_RULE_SETUP +#line 355 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGECUBE); + YY_BREAK +case 161: +YY_RULE_SETUP +#line 356 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE1D); + YY_BREAK +case 162: +YY_RULE_SETUP +#line 357 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE2D); + YY_BREAK +case 163: +YY_RULE_SETUP +#line 358 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE3D); + YY_BREAK +case 164: +YY_RULE_SETUP +#line 359 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGECUBE); + YY_BREAK +case 165: +YY_RULE_SETUP +#line 360 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE1D); + YY_BREAK +case 166: +YY_RULE_SETUP +#line 361 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE2D); + YY_BREAK +case 167: +YY_RULE_SETUP +#line 362 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE3D); + YY_BREAK +case 168: +YY_RULE_SETUP +#line 363 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGECUBE); + YY_BREAK +case 169: +YY_RULE_SETUP +#line 364 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE1DARRAY); + YY_BREAK +case 170: +YY_RULE_SETUP +#line 365 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE2DARRAY); + YY_BREAK +case 171: +YY_RULE_SETUP +#line 366 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE1DARRAY); + YY_BREAK +case 172: +YY_RULE_SETUP +#line 367 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGE2DARRAY); + YY_BREAK +case 173: +YY_RULE_SETUP +#line 368 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE1DARRAY); + YY_BREAK +case 174: +YY_RULE_SETUP +#line 369 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGE2DARRAY); + YY_BREAK +case 175: +YY_RULE_SETUP +#line 370 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE1DSHADOW); + YY_BREAK +case 176: +YY_RULE_SETUP +#line 371 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGE2DSHADOW); + YY_BREAK +case 177: +YY_RULE_SETUP +#line 372 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IMAGEBUFFER); + YY_BREAK +case 178: +YY_RULE_SETUP +#line 373 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, IIMAGEBUFFER); + YY_BREAK +case 179: +YY_RULE_SETUP +#line 374 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, UIMAGEBUFFER); + YY_BREAK +case 180: +YY_RULE_SETUP +#line 375 "glsl_lexer.lpp" +TOKEN_OR_IDENTIFIER(130, ROW_MAJOR); + YY_BREAK +case 181: +YY_RULE_SETUP +#line 377 "glsl_lexer.lpp" +{ + struct _mesa_glsl_parse_state *state = yyextra; + void *ctx = state; + yylval->identifier = talloc_strdup(ctx, yytext); + return IDENTIFIER; + } + YY_BREAK +case 182: +YY_RULE_SETUP +#line 384 "glsl_lexer.lpp" +{ return yytext[0]; } + YY_BREAK +case 183: +YY_RULE_SETUP +#line 386 "glsl_lexer.lpp" +ECHO; + YY_BREAK +#line 2330 "glsl_lexer.cpp" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(PP): +case YY_STATE_EOF(PRAGMA): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * _mesa_glsl_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( _mesa_glsl_wrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of _mesa_glsl_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + _mesa_glsl_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + _mesa_glsl_restart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) _mesa_glsl_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 708 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 708 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 707); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + _mesa_glsl_restart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( _mesa_glsl_wrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void _mesa_glsl_restart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + _mesa_glsl_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + _mesa_glsl__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + _mesa_glsl__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + _mesa_glsl__load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void _mesa_glsl__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * _mesa_glsl_pop_buffer_state(); + * _mesa_glsl_push_buffer_state(new_buffer); + */ + _mesa_glsl_ensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + _mesa_glsl__load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (_mesa_glsl_wrap()) processing, but the only time this flag + * is looked at is after _mesa_glsl_wrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void _mesa_glsl__load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE _mesa_glsl__create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) _mesa_glsl_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) _mesa_glsl_alloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + _mesa_glsl__init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with _mesa_glsl__create_buffer() + * @param yyscanner The scanner object. + */ + void _mesa_glsl__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + _mesa_glsl_free((void *) b->yy_ch_buf ,yyscanner ); + + _mesa_glsl_free((void *) b ,yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a _mesa_glsl_restart() or at EOF. + */ + static void _mesa_glsl__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + _mesa_glsl__flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then _mesa_glsl__init_buffer was _probably_ + * called from _mesa_glsl_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void _mesa_glsl__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + _mesa_glsl__load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void _mesa_glsl_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + _mesa_glsl_ensure_buffer_stack(yyscanner); + + /* This block is copied from _mesa_glsl__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from _mesa_glsl__switch_to_buffer. */ + _mesa_glsl__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void _mesa_glsl_pop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + _mesa_glsl__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + _mesa_glsl__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void _mesa_glsl_ensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)_mesa_glsl_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl_ensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)_mesa_glsl_realloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE _mesa_glsl__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) _mesa_glsl_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + _mesa_glsl__switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to _mesa_glsl_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * _mesa_glsl__scan_bytes() instead. + */ +YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return _mesa_glsl__scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE _mesa_glsl__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) _mesa_glsl_alloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in _mesa_glsl__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = _mesa_glsl__scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in _mesa_glsl__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE _mesa_glsl_get_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int _mesa_glsl_get_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int _mesa_glsl_get_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *_mesa_glsl_get_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *_mesa_glsl_get_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int _mesa_glsl_get_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *_mesa_glsl_get_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void _mesa_glsl_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void _mesa_glsl_set_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "_mesa_glsl_set_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void _mesa_glsl_set_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "_mesa_glsl_set_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see _mesa_glsl__switch_to_buffer + */ +void _mesa_glsl_set_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void _mesa_glsl_set_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int _mesa_glsl_get_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void _mesa_glsl_set_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * _mesa_glsl_get_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void _mesa_glsl_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +YYLTYPE *_mesa_glsl_get_lloc (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylloc; +} + +void _mesa_glsl_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylloc = yylloc_param; +} + +/* User-visible API */ + +/* _mesa_glsl_lex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int _mesa_glsl_lex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) _mesa_glsl_alloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* _mesa_glsl_lex_init_extra has the same functionality as _mesa_glsl_lex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to _mesa_glsl_alloc in + * the yyextra field. + */ + +int _mesa_glsl_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + _mesa_glsl_set_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) _mesa_glsl_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + _mesa_glsl_set_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from _mesa_glsl_lex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * _mesa_glsl_lex_init() + */ + return 0; +} + +/* _mesa_glsl_lex_destroy is for both reentrant and non-reentrant scanners. */ +int _mesa_glsl_lex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + _mesa_glsl__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + _mesa_glsl_pop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + _mesa_glsl_free(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + _mesa_glsl_free(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * _mesa_glsl_lex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + _mesa_glsl_free ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *_mesa_glsl_alloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *_mesa_glsl_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see _mesa_glsl_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 386 "glsl_lexer.lpp" + + + +void +_mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string) +{ + _mesa_glsl_lex_init_extra(state,& state->scanner); + _mesa_glsl__scan_string(string,state->scanner); +} + +void +_mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state) +{ + _mesa_glsl_lex_destroy(state->scanner); +} + diff --git a/mesalib/src/glsl/glsl_lexer.lpp b/mesalib/src/glsl/glsl_lexer.lpp new file mode 100644 index 000000000..ed3cb251a --- /dev/null +++ b/mesalib/src/glsl/glsl_lexer.lpp @@ -0,0 +1,399 @@ +%{ +/* + * Copyright © 2008, 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <ctype.h> +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_parser.h" + +#define YY_USER_ACTION \ + do { \ + yylloc->source = 0; \ + yylloc->first_column = yycolumn + 1; \ + yylloc->first_line = yylineno + 1; \ + yycolumn += yyleng; \ + } while(0); + +#define YY_USER_INIT yylineno = 0; yycolumn = 0; + +#define TOKEN_OR_IDENTIFIER(version, token) \ + do { \ + if (yyextra->language_version >= version) { \ + return token; \ + } else { \ + yylval->identifier = strdup(yytext); \ + return IDENTIFIER; \ + } \ + } while (0) + +/* Handle reserved words in GLSL ES (version 100) */ +#define TOKEN_OR_IDENTIFIER_ES(version, token) \ + do { \ + if (yyextra->es_shader) { \ + return token; \ + } else { \ + TOKEN_OR_IDENTIFIER(version, token); \ + } \ + } while (0) + +#define RESERVED_WORD(version, token) \ + do { \ + if (yyextra->language_version >= version) { \ + return token; \ + } else { \ + _mesa_glsl_error(yylloc, yyextra, \ + "Illegal use of reserved word `%s'", yytext); \ + return ERROR_TOK; \ + } \ + } while (0) +%} + +%option bison-bridge bison-locations reentrant noyywrap +%option nounput noyy_top_state +%option never-interactive +%option prefix="_mesa_glsl_" +%option extra-type="struct _mesa_glsl_parse_state *" + +%x PP PRAGMA + +DEC_INT [1-9][0-9]* +HEX_INT 0[xX][0-9a-fA-F]+ +OCT_INT 0[0-7]* +INT ({DEC_INT}|{HEX_INT}|{OCT_INT}) +SPC [ \t]* +SPCP [ \t]+ +HASH ^{SPC}#{SPC} +%% + +[ \r\t]+ ; + + /* Preprocessor tokens. */ +^[ \t]*#[ \t]*$ ; +^[ \t]*#[ \t]*version { BEGIN PP; return VERSION; } +^[ \t]*#[ \t]*extension { BEGIN PP; return EXTENSION; } +{HASH}line{SPCP}{INT}{SPCP}{INT}{SPC}$ { + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + yylloc->source = strtol(ptr, NULL, 0); + } +{HASH}line{SPCP}{INT}{SPC}$ { + /* Eat characters until the first digit is + * encountered + */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + + /* Subtract one from the line number because + * yylineno is zero-based instead of + * one-based. + */ + yylineno = strtol(ptr, &ptr, 0) - 1; + } +^{SPC}#{SPC}pragma{SPCP}debug{SPC}\({SPC}on{SPC}\) { + BEGIN PP; + return PRAGMA_DEBUG_ON; + } +^{SPC}#{SPC}pragma{SPCP}debug{SPC}\({SPC}off{SPC}\) { + BEGIN PP; + return PRAGMA_DEBUG_OFF; + } +^{SPC}#{SPC}pragma{SPCP}optimize{SPC}\({SPC}on{SPC}\) { + BEGIN PP; + return PRAGMA_OPTIMIZE_ON; + } +^{SPC}#{SPC}pragma{SPCP}optimize{SPC}\({SPC}off{SPC}\) { + BEGIN PP; + return PRAGMA_OPTIMIZE_OFF; + } +^{SPC}#{SPC}pragma{SPCP} { BEGIN PRAGMA; } + +<PRAGMA>\n { BEGIN 0; yylineno++; yycolumn = 0; } +<PRAGMA>. { } + +<PP>\/\/[^\n]* { } +<PP>[ \t\r]* { } +<PP>: return COLON; +<PP>[_a-zA-Z][_a-zA-Z0-9]* { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } +<PP>[1-9][0-9]* { + yylval->n = strtol(yytext, NULL, 10); + return INTCONSTANT; + } +<PP>\n { BEGIN 0; yylineno++; yycolumn = 0; return EOL; } + +\n { yylineno++; yycolumn = 0; } + +attribute return ATTRIBUTE; +const return CONST_TOK; +bool return BOOL_TOK; +float return FLOAT_TOK; +int return INT_TOK; + +break return BREAK; +continue return CONTINUE; +do return DO; +while return WHILE; +else return ELSE; +for return FOR; +if return IF; +discard return DISCARD; +return return RETURN; + +bvec2 return BVEC2; +bvec3 return BVEC3; +bvec4 return BVEC4; +ivec2 return IVEC2; +ivec3 return IVEC3; +ivec4 return IVEC4; +vec2 return VEC2; +vec3 return VEC3; +vec4 return VEC4; +mat2 return MAT2X2; +mat3 return MAT3X3; +mat4 return MAT4X4; +mat2x2 TOKEN_OR_IDENTIFIER(120, MAT2X2); +mat2x3 TOKEN_OR_IDENTIFIER(120, MAT2X3); +mat2x4 TOKEN_OR_IDENTIFIER(120, MAT2X4); +mat3x2 TOKEN_OR_IDENTIFIER(120, MAT3X2); +mat3x3 TOKEN_OR_IDENTIFIER(120, MAT3X3); +mat3x4 TOKEN_OR_IDENTIFIER(120, MAT3X4); +mat4x2 TOKEN_OR_IDENTIFIER(120, MAT4X2); +mat4x3 TOKEN_OR_IDENTIFIER(120, MAT4X3); +mat4x4 TOKEN_OR_IDENTIFIER(120, MAT4X4); + +in return IN_TOK; +out return OUT_TOK; +inout return INOUT_TOK; +uniform return UNIFORM; +varying return VARYING; +centroid TOKEN_OR_IDENTIFIER(120, CENTROID); +invariant TOKEN_OR_IDENTIFIER_ES(120, INVARIANT); + +flat TOKEN_OR_IDENTIFIER_ES(130, FLAT); +smooth TOKEN_OR_IDENTIFIER(130, SMOOTH); +noperspective TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE); + +sampler1D return SAMPLER1D; +sampler2D return SAMPLER2D; +sampler3D return SAMPLER3D; +samplerCube return SAMPLERCUBE; +sampler1DShadow return SAMPLER1DSHADOW; +sampler2DShadow return SAMPLER2DSHADOW; + +struct return STRUCT; +void return VOID_TOK; + +layout { + if ((yyextra->language_version >= 140) + || (yyextra->ARB_fragment_coord_conventions_enable)){ + return LAYOUT_TOK; + } else { + yylval->identifier = strdup(yytext); + return IDENTIFIER; + } + } + +\+\+ return INC_OP; +-- return DEC_OP; +\<= return LE_OP; +>= return GE_OP; +== return EQ_OP; +!= return NE_OP; +&& return AND_OP; +\|\| return OR_OP; +"^^" return XOR_OP; + +\*= return MUL_ASSIGN; +\/= return DIV_ASSIGN; +\+= return ADD_ASSIGN; +\%= return MOD_ASSIGN; +\<\<= return LEFT_ASSIGN; +>>= return RIGHT_ASSIGN; +&= return AND_ASSIGN; +^= return XOR_ASSIGN; +\|= return OR_ASSIGN; +-= return SUB_ASSIGN; + +[1-9][0-9]* { + yylval->n = strtol(yytext, NULL, 10); + return INTCONSTANT; + } +0[xX][0-9a-fA-F]+ { + yylval->n = strtol(yytext + 2, NULL, 16); + return INTCONSTANT; + } +0[0-7]* { + yylval->n = strtol(yytext, NULL, 8); + return INTCONSTANT; + } + +[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } +\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } +[0-9]+\.([eE][+-]?[0-9]+)?[fF]? { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } +[0-9]+[eE][+-]?[0-9]+[fF]? { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } +[0-9]+[fF] { + yylval->real = strtod(yytext, NULL); + return FLOATCONSTANT; + } + +true { + yylval->n = 1; + return BOOLCONSTANT; + } +false { + yylval->n = 0; + return BOOLCONSTANT; + } + + + /* Reserved words in GLSL 1.10. */ +asm RESERVED_WORD(999, ASM); +class RESERVED_WORD(999, CLASS); +union RESERVED_WORD(999, UNION); +enum RESERVED_WORD(999, ENUM); +typedef RESERVED_WORD(999, TYPEDEF); +template RESERVED_WORD(999, TEMPLATE); +this RESERVED_WORD(999, THIS); +packed RESERVED_WORD(999, PACKED_TOK); +goto RESERVED_WORD(999, GOTO); +switch RESERVED_WORD(130, SWITCH); +default RESERVED_WORD(130, DEFAULT); +inline RESERVED_WORD(999, INLINE_TOK); +noinline RESERVED_WORD(999, NOINLINE); +volatile RESERVED_WORD(999, VOLATILE); +public RESERVED_WORD(999, PUBLIC_TOK); +static RESERVED_WORD(999, STATIC); +extern RESERVED_WORD(999, EXTERN); +external RESERVED_WORD(999, EXTERNAL); +interface RESERVED_WORD(999, INTERFACE); +long RESERVED_WORD(999, LONG_TOK); +short RESERVED_WORD(999, SHORT_TOK); +double RESERVED_WORD(999, DOUBLE_TOK); +half RESERVED_WORD(999, HALF); +fixed RESERVED_WORD(999, FIXED_TOK); +unsigned RESERVED_WORD(999, UNSIGNED); +input RESERVED_WORD(999, INPUT_TOK); +output RESERVED_WORD(999, OUTPUT); +hvec2 RESERVED_WORD(999, HVEC2); +hvec3 RESERVED_WORD(999, HVEC3); +hvec4 RESERVED_WORD(999, HVEC4); +dvec2 RESERVED_WORD(999, DVEC2); +dvec3 RESERVED_WORD(999, DVEC3); +dvec4 RESERVED_WORD(999, DVEC4); +fvec2 RESERVED_WORD(999, FVEC2); +fvec3 RESERVED_WORD(999, FVEC3); +fvec4 RESERVED_WORD(999, FVEC4); +sampler2DRect return SAMPLER2DRECT; +sampler3DRect RESERVED_WORD(999, SAMPLER3DRECT); +sampler2DRectShadow return SAMPLER2DRECTSHADOW; +sizeof RESERVED_WORD(999, SIZEOF); +cast RESERVED_WORD(999, CAST); +namespace RESERVED_WORD(999, NAMESPACE); +using RESERVED_WORD(999, USING); + + /* Additional reserved words in GLSL 1.20. */ +lowp TOKEN_OR_IDENTIFIER_ES(120, LOWP); +mediump TOKEN_OR_IDENTIFIER_ES(120, MEDIUMP); +highp TOKEN_OR_IDENTIFIER_ES(120, HIGHP); +precision TOKEN_OR_IDENTIFIER_ES(120, PRECISION); + + /* Additional reserved words in GLSL 1.30. */ +common TOKEN_OR_IDENTIFIER(130, COMMON); +partition TOKEN_OR_IDENTIFIER(130, PARTITION); +active TOKEN_OR_IDENTIFIER(130, ACTIVE); +superp TOKEN_OR_IDENTIFIER_ES(130, SUPERP); +samplerBuffer TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER); +filter TOKEN_OR_IDENTIFIER(130, FILTER); +image1D TOKEN_OR_IDENTIFIER(130, IMAGE1D); +image2D TOKEN_OR_IDENTIFIER(130, IMAGE2D); +image3D TOKEN_OR_IDENTIFIER(130, IMAGE3D); +imageCube TOKEN_OR_IDENTIFIER(130, IMAGECUBE); +iimage1D TOKEN_OR_IDENTIFIER(130, IIMAGE1D); +iimage2D TOKEN_OR_IDENTIFIER(130, IIMAGE2D); +iimage3D TOKEN_OR_IDENTIFIER(130, IIMAGE3D); +iimageCube TOKEN_OR_IDENTIFIER(130, IIMAGECUBE); +uimage1D TOKEN_OR_IDENTIFIER(130, UIMAGE1D); +uimage2D TOKEN_OR_IDENTIFIER(130, UIMAGE2D); +uimage3D TOKEN_OR_IDENTIFIER(130, UIMAGE3D); +uimageCube TOKEN_OR_IDENTIFIER(130, UIMAGECUBE); +image1DArray TOKEN_OR_IDENTIFIER(130, IMAGE1DARRAY); +image2DArray TOKEN_OR_IDENTIFIER(130, IMAGE2DARRAY); +iimage1DArray TOKEN_OR_IDENTIFIER(130, IIMAGE1DARRAY); +iimage2DArray TOKEN_OR_IDENTIFIER(130, IIMAGE2DARRAY); +uimage1DArray TOKEN_OR_IDENTIFIER(130, UIMAGE1DARRAY); +uimage2DArray TOKEN_OR_IDENTIFIER(130, UIMAGE2DARRAY); +image1DShadow TOKEN_OR_IDENTIFIER(130, IMAGE1DSHADOW); +image2DShadow TOKEN_OR_IDENTIFIER(130, IMAGE2DSHADOW); +imageBuffer TOKEN_OR_IDENTIFIER(130, IMAGEBUFFER); +iimageBuffer TOKEN_OR_IDENTIFIER(130, IIMAGEBUFFER); +uimageBuffer TOKEN_OR_IDENTIFIER(130, UIMAGEBUFFER); +row_major TOKEN_OR_IDENTIFIER(130, ROW_MAJOR); + +[_a-zA-Z][_a-zA-Z0-9]* { + struct _mesa_glsl_parse_state *state = yyextra; + void *ctx = state; + yylval->identifier = talloc_strdup(ctx, yytext); + return IDENTIFIER; + } + +. { return yytext[0]; } + +%% + +void +_mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string) +{ + yylex_init_extra(state, & state->scanner); + yy_scan_string(string, state->scanner); +} + +void +_mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state) +{ + yylex_destroy(state->scanner); +} diff --git a/mesalib/src/glsl/glsl_parser.cpp b/mesalib/src/glsl/glsl_parser.cpp new file mode 100644 index 000000000..301c22189 --- /dev/null +++ b/mesalib/src/glsl/glsl_parser.cpp @@ -0,0 +1,5232 @@ +/* A Bison parser, made by GNU Bison 2.4.3. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 1 + +/* Substitute the variable and function names. */ +#define yyparse _mesa_glsl_parse +#define yylex _mesa_glsl_lex +#define yyerror _mesa_glsl_error +#define yylval _mesa_glsl_lval +#define yychar _mesa_glsl_char +#define yydebug _mesa_glsl_debug +#define yynerrs _mesa_glsl_nerrs +#define yylloc _mesa_glsl_lloc + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "glsl_parser.ypp" + +/* + * Copyright © 2008, 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_types.h" + +#define YYLEX_PARAM state->scanner + + + +/* Line 189 of yacc.c */ +#line 117 "glsl_parser.cpp" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ATTRIBUTE = 258, + CONST_TOK = 259, + BOOL_TOK = 260, + FLOAT_TOK = 261, + INT_TOK = 262, + UINT_TOK = 263, + BREAK = 264, + CONTINUE = 265, + DO = 266, + ELSE = 267, + FOR = 268, + IF = 269, + DISCARD = 270, + RETURN = 271, + SWITCH = 272, + CASE = 273, + DEFAULT = 274, + BVEC2 = 275, + BVEC3 = 276, + BVEC4 = 277, + IVEC2 = 278, + IVEC3 = 279, + IVEC4 = 280, + UVEC2 = 281, + UVEC3 = 282, + UVEC4 = 283, + VEC2 = 284, + VEC3 = 285, + VEC4 = 286, + CENTROID = 287, + IN_TOK = 288, + OUT_TOK = 289, + INOUT_TOK = 290, + UNIFORM = 291, + VARYING = 292, + NOPERSPECTIVE = 293, + FLAT = 294, + SMOOTH = 295, + MAT2X2 = 296, + MAT2X3 = 297, + MAT2X4 = 298, + MAT3X2 = 299, + MAT3X3 = 300, + MAT3X4 = 301, + MAT4X2 = 302, + MAT4X3 = 303, + MAT4X4 = 304, + SAMPLER1D = 305, + SAMPLER2D = 306, + SAMPLER3D = 307, + SAMPLERCUBE = 308, + SAMPLER1DSHADOW = 309, + SAMPLER2DSHADOW = 310, + SAMPLERCUBESHADOW = 311, + SAMPLER1DARRAY = 312, + SAMPLER2DARRAY = 313, + SAMPLER1DARRAYSHADOW = 314, + SAMPLER2DARRAYSHADOW = 315, + ISAMPLER1D = 316, + ISAMPLER2D = 317, + ISAMPLER3D = 318, + ISAMPLERCUBE = 319, + ISAMPLER1DARRAY = 320, + ISAMPLER2DARRAY = 321, + USAMPLER1D = 322, + USAMPLER2D = 323, + USAMPLER3D = 324, + USAMPLERCUBE = 325, + USAMPLER1DARRAY = 326, + USAMPLER2DARRAY = 327, + STRUCT = 328, + VOID_TOK = 329, + WHILE = 330, + IDENTIFIER = 331, + FLOATCONSTANT = 332, + INTCONSTANT = 333, + UINTCONSTANT = 334, + BOOLCONSTANT = 335, + FIELD_SELECTION = 336, + LEFT_OP = 337, + RIGHT_OP = 338, + INC_OP = 339, + DEC_OP = 340, + LE_OP = 341, + GE_OP = 342, + EQ_OP = 343, + NE_OP = 344, + AND_OP = 345, + OR_OP = 346, + XOR_OP = 347, + MUL_ASSIGN = 348, + DIV_ASSIGN = 349, + ADD_ASSIGN = 350, + MOD_ASSIGN = 351, + LEFT_ASSIGN = 352, + RIGHT_ASSIGN = 353, + AND_ASSIGN = 354, + XOR_ASSIGN = 355, + OR_ASSIGN = 356, + SUB_ASSIGN = 357, + INVARIANT = 358, + LOWP = 359, + MEDIUMP = 360, + HIGHP = 361, + SUPERP = 362, + PRECISION = 363, + VERSION = 364, + EXTENSION = 365, + LINE = 366, + COLON = 367, + EOL = 368, + INTERFACE = 369, + OUTPUT = 370, + PRAGMA_DEBUG_ON = 371, + PRAGMA_DEBUG_OFF = 372, + PRAGMA_OPTIMIZE_ON = 373, + PRAGMA_OPTIMIZE_OFF = 374, + LAYOUT_TOK = 375, + ASM = 376, + CLASS = 377, + UNION = 378, + ENUM = 379, + TYPEDEF = 380, + TEMPLATE = 381, + THIS = 382, + PACKED_TOK = 383, + GOTO = 384, + INLINE_TOK = 385, + NOINLINE = 386, + VOLATILE = 387, + PUBLIC_TOK = 388, + STATIC = 389, + EXTERN = 390, + EXTERNAL = 391, + LONG_TOK = 392, + SHORT_TOK = 393, + DOUBLE_TOK = 394, + HALF = 395, + FIXED_TOK = 396, + UNSIGNED = 397, + INPUT_TOK = 398, + OUPTUT = 399, + HVEC2 = 400, + HVEC3 = 401, + HVEC4 = 402, + DVEC2 = 403, + DVEC3 = 404, + DVEC4 = 405, + FVEC2 = 406, + FVEC3 = 407, + FVEC4 = 408, + SAMPLER2DRECT = 409, + SAMPLER3DRECT = 410, + SAMPLER2DRECTSHADOW = 411, + SIZEOF = 412, + CAST = 413, + NAMESPACE = 414, + USING = 415, + ERROR_TOK = 416, + COMMON = 417, + PARTITION = 418, + ACTIVE = 419, + SAMPLERBUFFER = 420, + FILTER = 421, + IMAGE1D = 422, + IMAGE2D = 423, + IMAGE3D = 424, + IMAGECUBE = 425, + IMAGE1DARRAY = 426, + IMAGE2DARRAY = 427, + IIMAGE1D = 428, + IIMAGE2D = 429, + IIMAGE3D = 430, + IIMAGECUBE = 431, + IIMAGE1DARRAY = 432, + IIMAGE2DARRAY = 433, + UIMAGE1D = 434, + UIMAGE2D = 435, + UIMAGE3D = 436, + UIMAGECUBE = 437, + UIMAGE1DARRAY = 438, + UIMAGE2DARRAY = 439, + IMAGE1DSHADOW = 440, + IMAGE2DSHADOW = 441, + IMAGEBUFFER = 442, + IIMAGEBUFFER = 443, + UIMAGEBUFFER = 444, + ROW_MAJOR = 445 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 214 of yacc.c */ +#line 52 "glsl_parser.ypp" + + int n; + float real; + char *identifier; + + union { + struct ast_type_qualifier q; + unsigned i; + } type_qualifier; + + ast_node *node; + ast_type_specifier *type_specifier; + ast_fully_specified_type *fully_specified_type; + ast_function *function; + ast_parameter_declarator *parameter_declarator; + ast_function_definition *function_definition; + ast_compound_statement *compound_statement; + ast_expression *expression; + ast_declarator_list *declarator_list; + ast_struct_specifier *struct_specifier; + ast_declaration *declaration; + + struct { + ast_node *cond; + ast_expression *rest; + } for_rest_statement; + + struct { + ast_node *then_statement; + ast_node *else_statement; + } selection_rest_statement; + + + +/* Line 214 of yacc.c */ +#line 378 "glsl_parser.cpp" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 403 "glsl_parser.cpp" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ + && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 5 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 4005 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 215 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 88 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 274 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 409 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 445 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 199, 2, 2, 2, 203, 206, 2, + 191, 192, 201, 197, 196, 198, 195, 202, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 210, 212, + 204, 211, 205, 209, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 193, 2, 194, 207, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 213, 208, 214, 200, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 4, 9, 10, 14, 17, 20, 23, + 26, 27, 30, 36, 38, 41, 43, 45, 47, 49, + 51, 53, 57, 59, 64, 66, 70, 73, 76, 78, + 80, 82, 86, 89, 92, 95, 97, 100, 104, 107, + 109, 111, 113, 115, 118, 121, 124, 126, 128, 130, + 132, 134, 138, 142, 146, 148, 152, 156, 158, 162, + 166, 168, 172, 176, 180, 184, 186, 190, 194, 196, + 200, 202, 206, 208, 212, 214, 218, 220, 224, 226, + 230, 232, 238, 240, 244, 246, 248, 250, 252, 254, + 256, 258, 260, 262, 264, 266, 268, 272, 274, 277, + 280, 285, 288, 290, 292, 295, 299, 303, 306, 312, + 316, 319, 323, 326, 327, 329, 331, 333, 335, 337, + 341, 347, 354, 362, 371, 377, 379, 382, 387, 393, + 400, 408, 413, 416, 418, 421, 422, 424, 429, 431, + 435, 437, 439, 441, 443, 445, 447, 450, 453, 455, + 457, 460, 463, 466, 468, 471, 474, 476, 478, 481, + 483, 487, 492, 494, 496, 498, 500, 502, 504, 506, + 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, + 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, + 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, + 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, + 588, 590, 592, 594, 596, 598, 600, 602, 604, 606, + 612, 617, 619, 622, 626, 628, 632, 634, 639, 641, + 643, 645, 647, 649, 651, 653, 655, 657, 659, 661, + 664, 668, 670, 672, 675, 679, 681, 684, 686, 689, + 695, 699, 701, 703, 708, 714, 718, 721, 727, 735, + 742, 744, 746, 748, 749, 752, 756, 759, 762, 765, + 769, 772, 774, 776, 778 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 216, 0, -1, -1, 218, 220, 217, 222, -1, -1, + 109, 78, 113, -1, 116, 113, -1, 117, 113, -1, + 118, 113, -1, 119, 113, -1, -1, 220, 221, -1, + 110, 76, 112, 76, 113, -1, 301, -1, 222, 301, + -1, 76, -1, 223, -1, 78, -1, 79, -1, 77, + -1, 80, -1, 191, 250, 192, -1, 224, -1, 225, + 193, 226, 194, -1, 227, -1, 225, 195, 76, -1, + 225, 84, -1, 225, 85, -1, 250, -1, 228, -1, + 229, -1, 225, 195, 229, -1, 231, 192, -1, 230, + 192, -1, 232, 74, -1, 232, -1, 232, 248, -1, + 231, 196, 248, -1, 233, 191, -1, 272, -1, 76, + -1, 81, -1, 225, -1, 84, 234, -1, 85, 234, + -1, 235, 234, -1, 197, -1, 198, -1, 199, -1, + 200, -1, 234, -1, 236, 201, 234, -1, 236, 202, + 234, -1, 236, 203, 234, -1, 236, -1, 237, 197, + 236, -1, 237, 198, 236, -1, 237, -1, 238, 82, + 237, -1, 238, 83, 237, -1, 238, -1, 239, 204, + 238, -1, 239, 205, 238, -1, 239, 86, 238, -1, + 239, 87, 238, -1, 239, -1, 240, 88, 239, -1, + 240, 89, 239, -1, 240, -1, 241, 206, 240, -1, + 241, -1, 242, 207, 241, -1, 242, -1, 243, 208, + 242, -1, 243, -1, 244, 90, 243, -1, 244, -1, + 245, 92, 244, -1, 245, -1, 246, 91, 245, -1, + 246, -1, 246, 209, 250, 210, 248, -1, 247, -1, + 234, 249, 248, -1, 211, -1, 93, -1, 94, -1, + 96, -1, 95, -1, 102, -1, 97, -1, 98, -1, + 99, -1, 100, -1, 101, -1, 248, -1, 250, 196, + 248, -1, 247, -1, 253, 212, -1, 261, 212, -1, + 108, 276, 273, 212, -1, 254, 192, -1, 256, -1, + 255, -1, 256, 258, -1, 255, 196, 258, -1, 263, + 76, 191, -1, 272, 76, -1, 272, 76, 193, 251, + 194, -1, 269, 259, 257, -1, 259, 257, -1, 269, + 259, 260, -1, 259, 260, -1, -1, 33, -1, 34, + -1, 35, -1, 272, -1, 262, -1, 261, 196, 76, + -1, 261, 196, 76, 193, 194, -1, 261, 196, 76, + 193, 251, 194, -1, 261, 196, 76, 193, 194, 211, + 282, -1, 261, 196, 76, 193, 251, 194, 211, 282, + -1, 261, 196, 76, 211, 282, -1, 263, -1, 263, + 76, -1, 263, 76, 193, 194, -1, 263, 76, 193, + 251, 194, -1, 263, 76, 193, 194, 211, 282, -1, + 263, 76, 193, 251, 194, 211, 282, -1, 263, 76, + 211, 282, -1, 103, 76, -1, 272, -1, 270, 272, + -1, -1, 265, -1, 120, 191, 266, 192, -1, 267, + -1, 266, 196, 267, -1, 76, -1, 40, -1, 39, + -1, 38, -1, 4, -1, 271, -1, 268, 270, -1, + 103, 270, -1, 4, -1, 3, -1, 264, 37, -1, + 32, 37, -1, 264, 33, -1, 34, -1, 32, 33, + -1, 32, 34, -1, 36, -1, 273, -1, 276, 273, + -1, 274, -1, 274, 193, 194, -1, 274, 193, 251, + 194, -1, 275, -1, 277, -1, 76, -1, 74, -1, + 6, -1, 7, -1, 8, -1, 5, -1, 29, -1, + 30, -1, 31, -1, 20, -1, 21, -1, 22, -1, + 23, -1, 24, -1, 25, -1, 26, -1, 27, -1, + 28, -1, 41, -1, 42, -1, 43, -1, 44, -1, + 45, -1, 46, -1, 47, -1, 48, -1, 49, -1, + 50, -1, 51, -1, 154, -1, 52, -1, 53, -1, + 54, -1, 55, -1, 156, -1, 56, -1, 57, -1, + 58, -1, 59, -1, 60, -1, 61, -1, 62, -1, + 63, -1, 64, -1, 65, -1, 66, -1, 67, -1, + 68, -1, 69, -1, 70, -1, 71, -1, 72, -1, + 106, -1, 105, -1, 104, -1, 73, 76, 213, 278, + 214, -1, 73, 213, 278, 214, -1, 279, -1, 278, + 279, -1, 272, 280, 212, -1, 281, -1, 280, 196, + 281, -1, 76, -1, 76, 193, 251, 194, -1, 248, + -1, 252, -1, 286, -1, 285, -1, 283, -1, 290, + -1, 291, -1, 294, -1, 295, -1, 296, -1, 300, + -1, 213, 214, -1, 213, 289, 214, -1, 288, -1, + 285, -1, 213, 214, -1, 213, 289, 214, -1, 284, + -1, 289, 284, -1, 212, -1, 250, 212, -1, 14, + 191, 250, 192, 292, -1, 284, 12, 284, -1, 284, + -1, 250, -1, 263, 76, 211, 282, -1, 17, 191, + 250, 192, 286, -1, 18, 250, 210, -1, 19, 210, + -1, 75, 191, 293, 192, 287, -1, 11, 284, 75, + 191, 250, 192, 212, -1, 13, 191, 297, 299, 192, + 287, -1, 290, -1, 283, -1, 293, -1, -1, 298, + 212, -1, 298, 212, 250, -1, 10, 212, -1, 9, + 212, -1, 16, 212, -1, 16, 250, 212, -1, 15, + 212, -1, 302, -1, 252, -1, 219, -1, 253, 288, + -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 214, 214, 213, 220, 222, 242, 243, 244, 245, + 248, 250, 254, 263, 271, 282, 286, 293, 300, 307, + 314, 321, 328, 329, 335, 339, 346, 352, 361, 365, + 369, 370, 379, 380, 384, 385, 389, 395, 407, 411, + 417, 424, 435, 436, 442, 448, 458, 459, 460, 461, + 465, 466, 472, 478, 487, 488, 494, 503, 504, 510, + 519, 520, 526, 532, 538, 547, 548, 554, 563, 564, + 573, 574, 583, 584, 593, 594, 603, 604, 613, 614, + 623, 624, 633, 634, 643, 644, 645, 646, 647, 648, + 649, 650, 651, 652, 653, 657, 661, 677, 681, 685, + 689, 703, 707, 708, 712, 717, 725, 736, 746, 761, + 768, 773, 784, 796, 797, 798, 799, 803, 807, 808, + 817, 826, 835, 844, 853, 866, 877, 886, 895, 904, + 913, 922, 931, 945, 952, 963, 964, 968, 975, 976, + 983, 1017, 1018, 1019, 1023, 1027, 1028, 1032, 1040, 1041, + 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1052, 1053, 1061, + 1062, 1068, 1077, 1083, 1089, 1098, 1099, 1100, 1101, 1102, + 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, + 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, + 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, + 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, + 1143, 1144, 1145, 1146, 1147, 1148, 1152, 1163, 1174, 1188, + 1194, 1203, 1208, 1216, 1231, 1236, 1244, 1250, 1259, 1263, + 1269, 1270, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1284, + 1290, 1299, 1300, 1304, 1310, 1319, 1329, 1341, 1347, 1356, + 1365, 1370, 1378, 1382, 1396, 1400, 1401, 1405, 1412, 1419, + 1429, 1430, 1434, 1436, 1442, 1447, 1456, 1462, 1468, 1474, + 1480, 1489, 1490, 1491, 1495 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "ATTRIBUTE", "CONST_TOK", "BOOL_TOK", + "FLOAT_TOK", "INT_TOK", "UINT_TOK", "BREAK", "CONTINUE", "DO", "ELSE", + "FOR", "IF", "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", "BVEC2", + "BVEC3", "BVEC4", "IVEC2", "IVEC3", "IVEC4", "UVEC2", "UVEC3", "UVEC4", + "VEC2", "VEC3", "VEC4", "CENTROID", "IN_TOK", "OUT_TOK", "INOUT_TOK", + "UNIFORM", "VARYING", "NOPERSPECTIVE", "FLAT", "SMOOTH", "MAT2X2", + "MAT2X3", "MAT2X4", "MAT3X2", "MAT3X3", "MAT3X4", "MAT4X2", "MAT4X3", + "MAT4X4", "SAMPLER1D", "SAMPLER2D", "SAMPLER3D", "SAMPLERCUBE", + "SAMPLER1DSHADOW", "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", + "SAMPLER1DARRAY", "SAMPLER2DARRAY", "SAMPLER1DARRAYSHADOW", + "SAMPLER2DARRAYSHADOW", "ISAMPLER1D", "ISAMPLER2D", "ISAMPLER3D", + "ISAMPLERCUBE", "ISAMPLER1DARRAY", "ISAMPLER2DARRAY", "USAMPLER1D", + "USAMPLER2D", "USAMPLER3D", "USAMPLERCUBE", "USAMPLER1DARRAY", + "USAMPLER2DARRAY", "STRUCT", "VOID_TOK", "WHILE", "IDENTIFIER", + "FLOATCONSTANT", "INTCONSTANT", "UINTCONSTANT", "BOOLCONSTANT", + "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", + "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", + "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", + "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "SUB_ASSIGN", "INVARIANT", + "LOWP", "MEDIUMP", "HIGHP", "SUPERP", "PRECISION", "VERSION", + "EXTENSION", "LINE", "COLON", "EOL", "INTERFACE", "OUTPUT", + "PRAGMA_DEBUG_ON", "PRAGMA_DEBUG_OFF", "PRAGMA_OPTIMIZE_ON", + "PRAGMA_OPTIMIZE_OFF", "LAYOUT_TOK", "ASM", "CLASS", "UNION", "ENUM", + "TYPEDEF", "TEMPLATE", "THIS", "PACKED_TOK", "GOTO", "INLINE_TOK", + "NOINLINE", "VOLATILE", "PUBLIC_TOK", "STATIC", "EXTERN", "EXTERNAL", + "LONG_TOK", "SHORT_TOK", "DOUBLE_TOK", "HALF", "FIXED_TOK", "UNSIGNED", + "INPUT_TOK", "OUPTUT", "HVEC2", "HVEC3", "HVEC4", "DVEC2", "DVEC3", + "DVEC4", "FVEC2", "FVEC3", "FVEC4", "SAMPLER2DRECT", "SAMPLER3DRECT", + "SAMPLER2DRECTSHADOW", "SIZEOF", "CAST", "NAMESPACE", "USING", + "ERROR_TOK", "COMMON", "PARTITION", "ACTIVE", "SAMPLERBUFFER", "FILTER", + "IMAGE1D", "IMAGE2D", "IMAGE3D", "IMAGECUBE", "IMAGE1DARRAY", + "IMAGE2DARRAY", "IIMAGE1D", "IIMAGE2D", "IIMAGE3D", "IIMAGECUBE", + "IIMAGE1DARRAY", "IIMAGE2DARRAY", "UIMAGE1D", "UIMAGE2D", "UIMAGE3D", + "UIMAGECUBE", "UIMAGE1DARRAY", "UIMAGE2DARRAY", "IMAGE1DSHADOW", + "IMAGE2DSHADOW", "IMAGEBUFFER", "IIMAGEBUFFER", "UIMAGEBUFFER", + "ROW_MAJOR", "'('", "')'", "'['", "']'", "'.'", "','", "'+'", "'-'", + "'!'", "'~'", "'*'", "'/'", "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", + "'?'", "':'", "'='", "';'", "'{'", "'}'", "$accept", "translation_unit", + "$@1", "version_statement", "pragma_statement", + "extension_statement_list", "extension_statement", + "external_declaration_list", "variable_identifier", "primary_expression", + "postfix_expression", "integer_expression", "function_call", + "function_call_or_method", "function_call_generic", + "function_call_header_no_parameters", + "function_call_header_with_parameters", "function_call_header", + "function_identifier", "unary_expression", "unary_operator", + "multiplicative_expression", "additive_expression", "shift_expression", + "relational_expression", "equality_expression", "and_expression", + "exclusive_or_expression", "inclusive_or_expression", + "logical_and_expression", "logical_xor_expression", + "logical_or_expression", "conditional_expression", + "assignment_expression", "assignment_operator", "expression", + "constant_expression", "declaration", "function_prototype", + "function_declarator", "function_header_with_parameters", + "function_header", "parameter_declarator", "parameter_declaration", + "parameter_qualifier", "parameter_type_specifier", + "init_declarator_list", "single_declaration", "fully_specified_type", + "opt_layout_qualifier", "layout_qualifier", "layout_qualifier_id_list", + "layout_qualifier_id", "interpolation_qualifier", + "parameter_type_qualifier", "type_qualifier", "storage_qualifier", + "type_specifier", "type_specifier_no_prec", "type_specifier_nonarray", + "basic_type_specifier_nonarray", "precision_qualifier", + "struct_specifier", "struct_declaration_list", "struct_declaration", + "struct_declarator_list", "struct_declarator", "initializer", + "declaration_statement", "statement", "simple_statement", + "compound_statement", "statement_no_new_scope", + "compound_statement_no_new_scope", "statement_list", + "expression_statement", "selection_statement", + "selection_rest_statement", "condition", "switch_statement", + "case_label", "iteration_statement", "for_init_statement", + "conditionopt", "for_rest_statement", "jump_statement", + "external_declaration", "function_definition", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, + 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, + 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, + 445, 40, 41, 91, 93, 46, 44, 43, 45, 33, + 126, 42, 47, 37, 60, 62, 38, 94, 124, 63, + 58, 61, 59, 123, 125 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint16 yyr1[] = +{ + 0, 215, 217, 216, 218, 218, 219, 219, 219, 219, + 220, 220, 221, 222, 222, 223, 224, 224, 224, 224, + 224, 224, 225, 225, 225, 225, 225, 225, 226, 227, + 228, 228, 229, 229, 230, 230, 231, 231, 232, 233, + 233, 233, 234, 234, 234, 234, 235, 235, 235, 235, + 236, 236, 236, 236, 237, 237, 237, 238, 238, 238, + 239, 239, 239, 239, 239, 240, 240, 240, 241, 241, + 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, + 247, 247, 248, 248, 249, 249, 249, 249, 249, 249, + 249, 249, 249, 249, 249, 250, 250, 251, 252, 252, + 252, 253, 254, 254, 255, 255, 256, 257, 257, 258, + 258, 258, 258, 259, 259, 259, 259, 260, 261, 261, + 261, 261, 261, 261, 261, 262, 262, 262, 262, 262, + 262, 262, 262, 263, 263, 264, 264, 265, 266, 266, + 267, 268, 268, 268, 269, 270, 270, 270, 271, 271, + 271, 271, 271, 271, 271, 271, 271, 272, 272, 273, + 273, 273, 274, 274, 274, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, + 275, 275, 275, 275, 275, 275, 276, 276, 276, 277, + 277, 278, 278, 279, 280, 280, 281, 281, 282, 283, + 284, 284, 285, 285, 285, 285, 285, 285, 285, 286, + 286, 287, 287, 288, 288, 289, 289, 290, 290, 291, + 292, 292, 293, 293, 294, 295, 295, 296, 296, 296, + 297, 297, 298, 298, 299, 299, 300, 300, 300, 300, + 300, 301, 301, 301, 302 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 4, 0, 3, 2, 2, 2, 2, + 0, 2, 5, 1, 2, 1, 1, 1, 1, 1, + 1, 3, 1, 4, 1, 3, 2, 2, 1, 1, + 1, 3, 2, 2, 2, 1, 2, 3, 2, 1, + 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, + 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, + 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 5, 1, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 1, 2, 2, + 4, 2, 1, 1, 2, 3, 3, 2, 5, 3, + 2, 3, 2, 0, 1, 1, 1, 1, 1, 3, + 5, 6, 7, 8, 5, 1, 2, 4, 5, 6, + 7, 4, 2, 1, 2, 0, 1, 4, 1, 3, + 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, + 2, 2, 2, 1, 2, 2, 1, 1, 2, 1, + 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, + 4, 1, 2, 3, 1, 3, 1, 4, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 3, 1, 1, 2, 3, 1, 2, 1, 2, 5, + 3, 1, 1, 4, 5, 3, 2, 5, 7, 6, + 1, 1, 1, 0, 2, 3, 2, 2, 2, 3, + 2, 1, 1, 1, 2 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint16 yydefact[] = +{ + 4, 0, 0, 10, 0, 1, 2, 5, 0, 135, + 11, 0, 149, 148, 169, 166, 167, 168, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 170, 171, 172, + 0, 153, 156, 143, 142, 141, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 194, 195, 196, + 197, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 0, 165, + 164, 135, 218, 217, 216, 0, 0, 0, 0, 0, + 0, 193, 198, 273, 135, 272, 0, 0, 103, 113, + 0, 118, 125, 0, 136, 135, 0, 145, 133, 157, + 159, 162, 0, 163, 13, 271, 0, 154, 155, 151, + 0, 0, 132, 135, 147, 0, 6, 7, 8, 9, + 0, 14, 98, 135, 274, 101, 113, 144, 114, 115, + 116, 104, 0, 113, 0, 99, 126, 152, 150, 146, + 134, 0, 158, 0, 0, 0, 0, 221, 0, 140, + 0, 138, 0, 0, 135, 0, 0, 0, 0, 0, + 0, 0, 0, 15, 19, 17, 18, 20, 41, 0, + 0, 0, 46, 47, 48, 49, 247, 135, 243, 16, + 22, 42, 24, 29, 30, 0, 0, 35, 0, 50, + 0, 54, 57, 60, 65, 68, 70, 72, 74, 76, + 78, 80, 82, 95, 0, 229, 0, 133, 232, 245, + 231, 230, 135, 233, 234, 235, 236, 237, 238, 105, + 110, 112, 117, 0, 119, 106, 0, 0, 160, 50, + 97, 0, 39, 12, 0, 226, 0, 224, 220, 222, + 100, 137, 0, 267, 266, 0, 135, 0, 270, 268, + 0, 0, 0, 256, 135, 43, 44, 0, 239, 135, + 26, 27, 0, 0, 33, 32, 0, 165, 36, 38, + 85, 86, 88, 87, 90, 91, 92, 93, 94, 89, + 84, 0, 45, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 248, 244, 246, 107, 109, 111, + 0, 0, 127, 0, 228, 131, 161, 219, 0, 0, + 223, 139, 0, 261, 260, 135, 0, 269, 0, 255, + 252, 0, 0, 21, 240, 0, 28, 25, 31, 37, + 83, 51, 52, 53, 55, 56, 58, 59, 63, 64, + 61, 62, 66, 67, 69, 71, 73, 75, 77, 79, + 0, 96, 0, 120, 0, 124, 0, 128, 0, 225, + 0, 262, 0, 0, 135, 0, 0, 135, 23, 0, + 0, 0, 121, 129, 0, 227, 0, 264, 135, 251, + 249, 254, 0, 242, 257, 241, 81, 108, 122, 0, + 130, 0, 265, 259, 135, 253, 123, 258, 250 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 2, 9, 3, 83, 6, 10, 84, 179, 180, + 181, 335, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 281, 204, 231, 205, 206, 87, + 88, 89, 220, 131, 132, 221, 90, 91, 92, 93, + 94, 150, 151, 95, 133, 96, 97, 232, 99, 100, + 101, 102, 103, 146, 147, 236, 237, 315, 208, 209, + 210, 211, 394, 395, 212, 213, 214, 390, 332, 215, + 216, 217, 325, 372, 373, 218, 104, 105 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -329 +static const yytype_int16 yypact[] = +{ + -58, -22, 72, -329, -28, -329, -15, -329, 22, 3589, + -329, -4, -329, -329, -329, -329, -329, -329, -329, -329, + -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, + 44, -329, -329, -329, -329, -329, -329, -329, -329, -329, + -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, + -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, + -329, -329, -329, -329, -329, -329, -329, -329, -72, -329, + -329, 6, -329, -329, -329, 14, -8, 9, 11, 26, + -64, -329, -329, -329, 3470, -329, -159, -23, -12, -2, + -149, -329, 105, 57, -329, 140, 3777, -329, -329, -329, + 15, -329, 3849, -329, -329, -329, 131, -329, -329, -329, + -3, 3777, -329, 140, -329, 3849, -329, -329, -329, -329, + 133, -329, -329, 383, -329, -329, 32, -329, -329, -329, + -329, -329, 3777, 158, 135, -329, -150, -329, -329, -329, + -329, 2565, -329, 100, 3777, 141, 1954, -329, 4, -329, + -95, -329, 7, 8, 1231, 27, 31, 12, 2186, 37, + 3108, 13, 39, -59, -329, -329, -329, -329, -329, 3108, + 3108, 3108, -329, -329, -329, -329, -329, 595, -329, -329, + -329, -55, -329, -329, -329, 41, -92, 3289, 40, -75, + 3108, -7, -118, 51, -74, 109, 28, 29, 30, 145, + 147, -84, -329, -329, -148, -329, 34, 49, -329, -329, + -329, -329, 807, -329, -329, -329, -329, -329, -329, -329, + -329, -329, 166, 3777, -143, -329, 2746, 3108, -329, -329, + -329, 53, -329, -329, 2070, 55, -139, -329, -329, -329, + -329, -329, 133, -329, -329, 174, 1640, 3108, -329, -329, + -138, 3108, -134, -329, 2384, -329, -329, -81, -329, 1019, + -329, -329, 3108, 3705, -329, -329, 3108, 61, -329, -329, + -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, + -329, 3108, -329, 3108, 3108, 3108, 3108, 3108, 3108, 3108, + 3108, 3108, 3108, 3108, 3108, 3108, 3108, 3108, 3108, 3108, + 3108, 3108, 3108, 3108, -329, -329, -329, 62, -329, -329, + 2927, 3108, 43, 63, -329, -329, -329, -329, 3108, 141, + -329, -329, 65, -329, -329, 1838, -80, -329, -79, -329, + 66, 182, 69, -329, -329, 70, 66, 74, -329, -329, + -329, -329, -329, -329, -7, -7, -118, -118, 51, 51, + 51, 51, -74, -74, 109, 28, 29, 30, 145, 147, + -127, -329, 3108, 52, 75, -329, 3108, 59, 77, -329, + 3108, -329, 54, 76, 1231, 60, 64, 1442, -329, 3108, + 78, 3108, 67, -329, 3108, -329, -50, 3108, 1442, 262, + -329, -329, 3108, -329, -329, -329, -329, -329, -329, 3108, + -329, 71, 66, -329, 1231, -329, -329, -329, -329 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, + -329, -329, -329, -329, 16, -329, -329, -329, -329, -135, + -329, -87, -83, -104, -93, -20, -16, -21, -13, -11, + -17, -329, -133, -99, -329, -155, -189, 2, 5, -329, + -329, -329, 68, 161, 155, 73, -329, -329, -215, -329, + -329, -329, 48, -329, -329, -43, -329, -9, -31, -329, + -329, 217, -329, 150, -131, -329, -24, -140, 56, -153, + -328, -78, -90, 213, 124, 58, -329, -329, -19, -329, + -329, -329, -329, -329, -329, -329, 219, -329 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -264 +static const yytype_int16 yytable[] = +{ + 98, 245, 127, 250, 110, 252, 229, 301, 230, 12, + 13, 85, 290, 291, 86, 239, 257, -164, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 114, 260, + 261, 128, 129, 130, 255, 256, 127, 313, 30, 331, + 31, 225, 32, 226, 33, 34, 35, 134, 303, 393, + 310, 1, 139, 122, 123, 282, 4, 319, 303, 306, + 393, 227, 303, 135, 304, 128, 129, 130, 311, 303, + 114, 142, 5, 320, 327, 98, 329, 107, 108, 286, + 287, 109, 112, 379, 148, 7, 85, 140, 268, 86, + 137, 229, 326, 230, 138, 8, 328, 241, 11, 330, + 265, 242, 145, 239, 266, 116, 306, 336, 106, 113, + 331, 333, 374, 375, 207, 303, 303, 303, 72, 73, + 74, 364, 117, 222, 118, 302, 80, 120, 314, 368, + 292, 293, -40, 288, 289, 145, 280, 145, 262, 119, + 263, 111, 401, 12, 13, 207, 303, 360, 341, 342, + 343, 229, 229, 229, 229, 229, 229, 229, 229, 229, + 229, 229, 229, 229, 229, 229, 229, 339, 207, 125, + 330, 365, 30, 380, 31, 229, 32, 230, 33, 34, + 35, 136, 340, 229, 126, 230, 348, 349, 350, 351, + -102, 128, 129, 130, 283, 284, 285, 294, 295, 344, + 345, 352, 353, 207, 361, 346, 347, 143, 141, 149, + 144, 224, 314, 233, 222, 386, 240, 235, 246, 243, + 244, 389, 247, 253, 248, 145, 383, 229, 251, 230, + 254, 269, 402, 264, 296, 299, 297, 207, 298, 300, + -39, 398, 307, 113, 400, 207, 122, 316, 318, 322, + 207, 408, 405, -34, 366, 362, 370, 367, 376, 406, + 80, 377, 303, 381, 378, -40, 387, 314, 388, 382, + 384, 385, 397, 177, 404, 392, 354, 356, 399, 338, + 396, 355, 314, 407, 359, 314, 357, 219, 223, 358, + 321, 308, 115, 314, 234, 369, 309, 391, 403, 124, + 314, 259, 323, 121, 324, 0, 371, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 207, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 207, 0, 0, 207, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 207, + 0, 0, 0, 0, 0, 0, 12, 13, 14, 15, + 16, 17, 152, 153, 154, 207, 155, 156, 157, 158, + 159, 160, 161, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 0, 31, 0, 32, + 0, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 162, 163, + 164, 165, 166, 167, 168, 0, 0, 169, 170, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 71, 72, 73, 74, + 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 81, 0, 82, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, + 172, 173, 174, 175, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 176, 177, 178, 12, 13, + 14, 15, 16, 17, 152, 153, 154, 0, 155, 156, + 157, 158, 159, 160, 161, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 0, 31, + 0, 32, 0, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 162, 163, 164, 165, 166, 167, 168, 0, 0, 169, + 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 71, 72, + 73, 74, 0, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, + 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 171, 0, 0, 0, + 0, 0, 172, 173, 174, 175, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 176, 177, 258, + 12, 13, 14, 15, 16, 17, 152, 153, 154, 0, + 155, 156, 157, 158, 159, 160, 161, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 0, 31, 0, 32, 0, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 162, 163, 164, 165, 166, 167, 168, 0, + 0, 169, 170, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 71, 72, 73, 74, 0, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 81, 0, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 171, 0, + 0, 0, 0, 0, 172, 173, 174, 175, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, + 177, 305, 12, 13, 14, 15, 16, 17, 152, 153, + 154, 0, 155, 156, 157, 158, 159, 160, 161, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 0, 31, 0, 32, 0, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 162, 163, 164, 165, 166, 167, + 168, 0, 0, 169, 170, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 71, 72, 73, 74, 0, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 171, 0, 0, 0, 0, 0, 172, 173, 174, 175, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 176, 177, 334, 12, 13, 14, 15, 16, 17, + 152, 153, 154, 0, 155, 156, 157, 158, 159, 160, + 161, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 0, 31, 0, 32, 0, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 162, 163, 164, 165, + 166, 167, 168, 0, 0, 169, 170, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 71, 72, 73, 74, 0, 75, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 0, 82, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 171, 0, 0, 0, 0, 0, 172, 173, + 174, 175, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 176, 177, 12, 13, 14, 15, 16, + 17, 152, 153, 154, 0, 155, 156, 157, 158, 159, + 160, 161, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 0, 31, 0, 32, 0, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 162, 163, 164, + 165, 166, 167, 168, 0, 0, 169, 170, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 71, 72, 73, 74, 0, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 81, 0, 82, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 171, 0, 0, 0, 0, 0, 172, + 173, 174, 175, 12, 13, 14, 15, 16, 17, 0, + 0, 0, 0, 0, 176, 123, 0, 0, 0, 0, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 0, 31, 0, 32, 0, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 0, 163, 164, 165, 166, + 167, 168, 0, 0, 169, 170, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 71, 72, 73, 74, 0, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 81, 0, 82, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 171, 0, 0, 0, 0, 0, 172, 173, 174, + 175, 12, 13, 14, 15, 16, 17, 0, 0, 0, + 0, 0, 176, 0, 0, 0, 0, 0, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 0, 31, 0, 32, 0, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 0, 163, 164, 165, 166, 167, 168, + 0, 0, 169, 170, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 113, 72, 73, 74, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 80, 14, + 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, + 0, 0, 81, 0, 82, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 171, + 70, 0, 0, 0, 0, 172, 173, 174, 175, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -263, 0, 0, 0, 0, 0, 0, 0, 72, 73, + 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 14, 15, 16, 17, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 0, 0, 0, 0, 0, 0, 81, 0, + 82, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 0, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 238, 0, + 0, 0, 0, 0, 72, 73, 74, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, + 0, 0, 0, 0, 81, 0, 82, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 0, 163, 164, 165, 166, 167, 168, 0, 0, + 169, 170, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 317, 0, 0, 0, 0, 0, + 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 81, 0, 82, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 171, 0, 0, + 0, 0, 0, 172, 173, 174, 175, 12, 13, 14, + 15, 16, 17, 0, 0, 0, 0, 0, 249, 0, + 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 0, 31, 0, + 32, 0, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, + 163, 164, 165, 166, 167, 168, 0, 0, 169, 170, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 113, 72, 73, + 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, + 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 15, 16, 17, 0, 171, 0, 0, 0, 0, + 0, 172, 173, 174, 175, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 0, 163, 164, 165, 166, 167, 168, 0, 0, 169, + 170, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, + 73, 74, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, + 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 14, 15, 16, 17, 0, 171, 0, 0, 228, + 0, 0, 172, 173, 174, 175, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 0, 163, 164, 165, 166, 167, 168, 0, 0, + 169, 170, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 72, 73, 74, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 81, 0, 82, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 171, 0, 0, + 312, 0, 0, 172, 173, 174, 175, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 0, 163, 164, 165, 166, 167, 168, 0, + 0, 169, 170, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 72, 73, 74, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 81, 0, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 14, 15, 16, 17, 0, 171, 0, + 0, 363, 0, 0, 172, 173, 174, 175, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 0, 163, 164, 165, 166, 167, 168, + 0, 0, 169, 170, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 72, 73, 74, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 81, 0, 82, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 14, 15, 16, 17, 0, 171, + 0, 0, 0, 0, 0, 172, 173, 174, 175, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 267, 0, 163, 164, 165, 166, 167, + 168, 0, 0, 169, 170, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 72, 73, 74, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -3, 0, 0, 12, 13, 14, 15, 16, 17, 0, + 171, 0, 0, 0, 0, 0, 172, 173, 174, 175, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 0, 31, 0, 32, 0, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 0, 70, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 71, 72, 73, 74, 0, 75, 0, + 0, 0, 0, 0, 0, 0, 76, 77, 78, 79, + 80, 0, 12, 13, 14, 15, 16, 17, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 0, 31, 81, 32, 82, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 0, 70, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 71, 72, 73, 74, 0, 75, 0, 0, + 0, 0, 0, 0, 0, 76, 77, 78, 79, 80, + 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, + 0, 0, 0, 81, 0, 82, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 0, 337, 14, 15, 16, 17, 168, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 72, + 73, 74, 0, 0, 0, 0, 0, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 0, 70, 14, 15, 16, 17, 0, 81, + 0, 82, 0, 0, 0, 0, 0, 0, 0, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 72, 73, 74, 0, 0, 0, 0, 0, 0, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 0, 70, 0, 0, 0, 0, + 0, 81, 0, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 81, 0, 82 +}; + +static const yytype_int16 yycheck[] = +{ + 9, 154, 4, 158, 76, 160, 141, 91, 141, 3, + 4, 9, 86, 87, 9, 146, 171, 76, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 71, 84, + 85, 33, 34, 35, 169, 170, 4, 226, 32, 254, + 34, 191, 36, 193, 38, 39, 40, 196, 196, 377, + 193, 109, 95, 212, 213, 190, 78, 196, 196, 212, + 388, 211, 196, 212, 212, 33, 34, 35, 211, 196, + 113, 102, 0, 212, 212, 84, 210, 33, 34, 197, + 198, 37, 76, 210, 115, 113, 84, 96, 187, 84, + 33, 226, 247, 226, 37, 110, 251, 192, 76, 254, + 192, 196, 111, 234, 196, 113, 259, 262, 112, 103, + 325, 192, 192, 192, 123, 196, 196, 196, 104, 105, + 106, 310, 113, 132, 113, 209, 120, 191, 227, 318, + 204, 205, 191, 82, 83, 144, 211, 146, 193, 113, + 195, 213, 192, 3, 4, 154, 196, 302, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 266, 177, 192, + 325, 311, 32, 362, 34, 310, 36, 310, 38, 39, + 40, 76, 281, 318, 196, 318, 290, 291, 292, 293, + 192, 33, 34, 35, 201, 202, 203, 88, 89, 286, + 287, 294, 295, 212, 303, 288, 289, 76, 193, 76, + 213, 76, 311, 113, 223, 370, 212, 76, 191, 212, + 212, 374, 191, 210, 212, 234, 366, 362, 191, 362, + 191, 191, 387, 192, 206, 90, 207, 246, 208, 92, + 191, 381, 76, 103, 384, 254, 212, 194, 193, 75, + 259, 404, 392, 192, 211, 193, 191, 194, 76, 399, + 120, 192, 196, 211, 194, 191, 212, 366, 192, 194, + 211, 194, 194, 213, 12, 211, 296, 298, 211, 263, + 379, 297, 381, 212, 301, 384, 299, 126, 133, 300, + 242, 223, 75, 392, 144, 319, 223, 375, 388, 86, + 399, 177, 246, 84, 246, -1, 325, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 325, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 374, -1, -1, 377, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 388, + -1, -1, -1, -1, -1, -1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 404, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, -1, 34, -1, 36, + -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, -1, -1, 84, 85, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 103, 104, 105, 106, + -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 154, -1, 156, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, + 197, 198, 199, 200, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 212, 213, 214, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, + -1, 36, -1, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, -1, -1, 84, + 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 103, 104, + 105, 106, -1, 108, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, + -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, + -1, -1, 197, 198, 199, 200, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 212, 213, 214, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + -1, 34, -1, 36, -1, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, -1, + -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 103, 104, 105, 106, -1, 108, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, + -1, -1, -1, -1, 197, 198, 199, 200, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 212, + 213, 214, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, -1, 34, -1, 36, -1, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 103, 104, 105, 106, -1, 108, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 191, -1, -1, -1, -1, -1, 197, 198, 199, 200, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 212, 213, 214, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, -1, 34, -1, 36, -1, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, -1, -1, 84, 85, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 103, 104, 105, 106, -1, 108, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 154, -1, 156, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 191, -1, -1, -1, -1, -1, 197, 198, + 199, 200, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 212, 213, 3, 4, 5, 6, 7, + 8, 9, 10, 11, -1, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, -1, 34, -1, 36, -1, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, -1, -1, 84, 85, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 103, 104, 105, 106, -1, + 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 154, -1, 156, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 191, -1, -1, -1, -1, -1, 197, + 198, 199, 200, 3, 4, 5, 6, 7, 8, -1, + -1, -1, -1, -1, 212, 213, -1, -1, -1, -1, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, -1, 34, -1, 36, -1, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, + 80, 81, -1, -1, 84, 85, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 103, 104, 105, 106, -1, 108, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 154, -1, 156, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 191, -1, -1, -1, -1, -1, 197, 198, 199, + 200, 3, 4, 5, 6, 7, 8, -1, -1, -1, + -1, -1, 212, -1, -1, -1, -1, -1, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, -1, 34, -1, 36, -1, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, -1, 76, 77, 78, 79, 80, 81, + -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 103, 104, 105, 106, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 120, 5, + 6, 7, 8, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, + -1, -1, 154, -1, 156, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 191, + 76, -1, -1, -1, -1, 197, 198, 199, 200, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 212, -1, -1, -1, -1, -1, -1, -1, 104, 105, + 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 5, 6, 7, 8, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, -1, -1, -1, -1, -1, -1, 154, -1, + 156, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, -1, 76, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 214, -1, + -1, -1, -1, -1, 104, 105, 106, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 5, 6, 7, 8, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, + -1, -1, -1, -1, 154, -1, 156, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, -1, 76, 77, 78, 79, 80, 81, -1, -1, + 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 214, -1, -1, -1, -1, -1, + 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 191, -1, -1, + -1, -1, -1, 197, 198, 199, 200, 3, 4, 5, + 6, 7, 8, -1, -1, -1, -1, -1, 212, -1, + -1, -1, -1, -1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, -1, 34, -1, + 36, -1, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, + 76, 77, 78, 79, 80, 81, -1, -1, 84, 85, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 103, 104, 105, + 106, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, + 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 5, 6, 7, 8, -1, 191, -1, -1, -1, -1, + -1, 197, 198, 199, 200, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + -1, 76, 77, 78, 79, 80, 81, -1, -1, 84, + 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, + 105, 106, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, + -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 5, 6, 7, 8, -1, 191, -1, -1, 194, + -1, -1, 197, 198, 199, 200, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, -1, 76, 77, 78, 79, 80, 81, -1, -1, + 84, 85, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 104, 105, 106, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 154, -1, 156, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 7, 8, -1, 191, -1, -1, + 194, -1, -1, 197, 198, 199, 200, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, -1, 76, 77, 78, 79, 80, 81, -1, + -1, 84, 85, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 104, 105, 106, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 5, 6, 7, 8, -1, 191, -1, + -1, 194, -1, -1, 197, 198, 199, 200, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, -1, 76, 77, 78, 79, 80, 81, + -1, -1, 84, 85, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 104, 105, 106, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 154, -1, 156, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 5, 6, 7, 8, -1, 191, + -1, -1, -1, -1, -1, 197, 198, 199, 200, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, + 81, -1, -1, 84, 85, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 104, 105, 106, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 154, -1, 156, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, -1, -1, 3, 4, 5, 6, 7, 8, -1, + 191, -1, -1, -1, -1, -1, 197, 198, 199, 200, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, -1, 34, -1, 36, -1, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, -1, 76, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 103, 104, 105, 106, -1, 108, -1, + -1, -1, -1, -1, -1, -1, 116, 117, 118, 119, + 120, -1, 3, 4, 5, 6, 7, 8, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, -1, 34, 154, 36, 156, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, -1, 76, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 103, 104, 105, 106, -1, 108, -1, -1, + -1, -1, -1, -1, -1, 116, 117, 118, 119, 120, + 5, 6, 7, 8, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, -1, -1, -1, + -1, -1, -1, 154, -1, 156, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + -1, 76, 5, 6, 7, 8, 81, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 104, + 105, 106, -1, -1, -1, -1, -1, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, -1, 76, 5, 6, 7, 8, -1, 154, + -1, 156, -1, -1, -1, -1, -1, -1, -1, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 104, 105, 106, -1, -1, -1, -1, -1, -1, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, -1, 76, -1, -1, -1, -1, + -1, 154, -1, 156, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 154, -1, 156 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint16 yystos[] = +{ + 0, 109, 216, 218, 78, 0, 220, 113, 110, 217, + 221, 76, 3, 4, 5, 6, 7, 8, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 34, 36, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 76, 103, 104, 105, 106, 108, 116, 117, 118, 119, + 120, 154, 156, 219, 222, 252, 253, 254, 255, 256, + 261, 262, 263, 264, 265, 268, 270, 271, 272, 273, + 274, 275, 276, 277, 301, 302, 112, 33, 34, 37, + 76, 213, 76, 103, 270, 276, 113, 113, 113, 113, + 191, 301, 212, 213, 288, 192, 196, 4, 33, 34, + 35, 258, 259, 269, 196, 212, 76, 33, 37, 270, + 272, 193, 273, 76, 213, 272, 278, 279, 273, 76, + 266, 267, 9, 10, 11, 13, 14, 15, 16, 17, + 18, 19, 75, 76, 77, 78, 79, 80, 81, 84, + 85, 191, 197, 198, 199, 200, 212, 213, 214, 223, + 224, 225, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 250, 252, 253, 272, 283, 284, + 285, 286, 289, 290, 291, 294, 295, 296, 300, 258, + 257, 260, 272, 259, 76, 191, 193, 211, 194, 234, + 247, 251, 272, 113, 278, 76, 280, 281, 214, 279, + 212, 192, 196, 212, 212, 284, 191, 191, 212, 212, + 250, 191, 250, 210, 191, 234, 234, 250, 214, 289, + 84, 85, 193, 195, 192, 192, 196, 74, 248, 191, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 211, 249, 234, 201, 202, 203, 197, 198, 82, 83, + 86, 87, 204, 205, 88, 89, 206, 207, 208, 90, + 92, 91, 209, 196, 212, 214, 284, 76, 257, 260, + 193, 211, 194, 251, 248, 282, 194, 214, 193, 196, + 212, 267, 75, 283, 290, 297, 250, 212, 250, 210, + 250, 263, 293, 192, 214, 226, 250, 76, 229, 248, + 248, 234, 234, 234, 236, 236, 237, 237, 238, 238, + 238, 238, 239, 239, 240, 241, 242, 243, 244, 245, + 250, 248, 193, 194, 251, 282, 211, 194, 251, 281, + 191, 293, 298, 299, 192, 192, 76, 192, 194, 210, + 251, 211, 194, 282, 211, 194, 250, 212, 192, 284, + 292, 286, 211, 285, 287, 288, 248, 194, 282, 211, + 282, 192, 250, 287, 12, 282, 282, 212, 284 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ + +#define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, state, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) +#else +# define YYLEX yylex (&yylval, &yylloc, scanner) +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, state); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct _mesa_glsl_parse_state *state) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, state) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + struct _mesa_glsl_parse_state *state; +#endif +{ + if (!yyvaluep) + return; + YYUSE (yylocationp); + YYUSE (state); +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct _mesa_glsl_parse_state *state) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, state) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; + YYLTYPE const * const yylocationp; + struct _mesa_glsl_parse_state *state; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, state); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, struct _mesa_glsl_parse_state *state) +#else +static void +yy_reduce_print (yyvsp, yylsp, yyrule, state) + YYSTYPE *yyvsp; + YYLTYPE *yylsp; + int yyrule; + struct _mesa_glsl_parse_state *state; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , state); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, yylsp, Rule, state); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, struct _mesa_glsl_parse_state *state) +#else +static void +yydestruct (yymsg, yytype, yyvaluep, yylocationp, state) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; + YYLTYPE *yylocationp; + struct _mesa_glsl_parse_state *state; +#endif +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (state); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (struct _mesa_glsl_parse_state *state); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (struct _mesa_glsl_parse_state *state) +#else +int +yyparse (state) + struct _mesa_glsl_parse_state *state; +#endif +#endif +{ +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Location data for the lookahead symbol. */ +YYLTYPE yylloc; + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3]; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + yylsp = yyls; + +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + yylloc.first_line = yylloc.last_line = 1; + yylloc.first_column = yylloc.last_column = 1; +#endif + +/* User initialization code. */ + +/* Line 1251 of yacc.c */ +#line 41 "glsl_parser.ypp" +{ + yylloc.first_line = 1; + yylloc.first_column = 1; + yylloc.last_line = 1; + yylloc.last_column = 1; + yylloc.source = 0; +} + +/* Line 1251 of yacc.c */ +#line 2691 "glsl_parser.cpp" + yylsp[0] = yylloc; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: + +/* Line 1464 of yacc.c */ +#line 214 "glsl_parser.ypp" + { + _mesa_glsl_initialize_types(state); + ;} + break; + + case 5: + +/* Line 1464 of yacc.c */ +#line 223 "glsl_parser.ypp" + { + switch ((yyvsp[(2) - (3)].n)) { + case 100: + state->es_shader = true; + case 110: + case 120: + case 130: + /* FINISHME: Check against implementation support versions. */ + state->language_version = (yyvsp[(2) - (3)].n); + break; + default: + _mesa_glsl_error(& (yylsp[(2) - (3)]), state, "Shading language version" + "%u is not supported\n", (yyvsp[(2) - (3)].n)); + break; + } + ;} + break; + + case 12: + +/* Line 1464 of yacc.c */ +#line 255 "glsl_parser.ypp" + { + if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) { + YYERROR; + } + ;} + break; + + case 13: + +/* Line 1464 of yacc.c */ +#line 264 "glsl_parser.ypp" + { + /* FINISHME: The NULL test is only required because 'precision' + * FINISHME: statements are not yet supported. + */ + if ((yyvsp[(1) - (1)].node) != NULL) + state->translation_unit.push_tail(& (yyvsp[(1) - (1)].node)->link); + ;} + break; + + case 14: + +/* Line 1464 of yacc.c */ +#line 272 "glsl_parser.ypp" + { + /* FINISHME: The NULL test is only required because 'precision' + * FINISHME: statements are not yet supported. + */ + if ((yyvsp[(2) - (2)].node) != NULL) + state->translation_unit.push_tail(& (yyvsp[(2) - (2)].node)->link); + ;} + break; + + case 16: + +/* Line 1464 of yacc.c */ +#line 287 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.identifier = (yyvsp[(1) - (1)].identifier); + ;} + break; + + case 17: + +/* Line 1464 of yacc.c */ +#line 294 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.int_constant = (yyvsp[(1) - (1)].n); + ;} + break; + + case 18: + +/* Line 1464 of yacc.c */ +#line 301 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.uint_constant = (yyvsp[(1) - (1)].n); + ;} + break; + + case 19: + +/* Line 1464 of yacc.c */ +#line 308 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.float_constant = (yyvsp[(1) - (1)].real); + ;} + break; + + case 20: + +/* Line 1464 of yacc.c */ +#line 315 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.bool_constant = (yyvsp[(1) - (1)].n); + ;} + break; + + case 21: + +/* Line 1464 of yacc.c */ +#line 322 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(2) - (3)].expression); + ;} + break; + + case 23: + +/* Line 1464 of yacc.c */ +#line 330 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 24: + +/* Line 1464 of yacc.c */ +#line 336 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (1)].expression); + ;} + break; + + case 25: + +/* Line 1464 of yacc.c */ +#line 340 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->primary_expression.identifier = (yyvsp[(3) - (3)].identifier); + ;} + break; + + case 26: + +/* Line 1464 of yacc.c */ +#line 347 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 27: + +/* Line 1464 of yacc.c */ +#line 353 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 31: + +/* Line 1464 of yacc.c */ +#line 371 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 36: + +/* Line 1464 of yacc.c */ +#line 390 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (2)].expression); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->expressions.push_tail(& (yyvsp[(2) - (2)].expression)->link); + ;} + break; + + case 37: + +/* Line 1464 of yacc.c */ +#line 396 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (3)].expression); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->expressions.push_tail(& (yyvsp[(3) - (3)].expression)->link); + ;} + break; + + case 39: + +/* Line 1464 of yacc.c */ +#line 412 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 40: + +/* Line 1464 of yacc.c */ +#line 418 "glsl_parser.ypp" + { + void *ctx = state; + ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); + (yyval.expression) = new(ctx) ast_function_expression(callee); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 41: + +/* Line 1464 of yacc.c */ +#line 425 "glsl_parser.ypp" + { + void *ctx = state; + ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier)); + (yyval.expression) = new(ctx) ast_function_expression(callee); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 43: + +/* Line 1464 of yacc.c */ +#line 437 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 44: + +/* Line 1464 of yacc.c */ +#line 443 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 45: + +/* Line 1464 of yacc.c */ +#line 449 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 46: + +/* Line 1464 of yacc.c */ +#line 458 "glsl_parser.ypp" + { (yyval.n) = ast_plus; ;} + break; + + case 47: + +/* Line 1464 of yacc.c */ +#line 459 "glsl_parser.ypp" + { (yyval.n) = ast_neg; ;} + break; + + case 48: + +/* Line 1464 of yacc.c */ +#line 460 "glsl_parser.ypp" + { (yyval.n) = ast_logic_not; ;} + break; + + case 49: + +/* Line 1464 of yacc.c */ +#line 461 "glsl_parser.ypp" + { (yyval.n) = ast_bit_not; ;} + break; + + case 51: + +/* Line 1464 of yacc.c */ +#line 467 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 52: + +/* Line 1464 of yacc.c */ +#line 473 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 53: + +/* Line 1464 of yacc.c */ +#line 479 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 55: + +/* Line 1464 of yacc.c */ +#line 489 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 56: + +/* Line 1464 of yacc.c */ +#line 495 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 58: + +/* Line 1464 of yacc.c */ +#line 505 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 59: + +/* Line 1464 of yacc.c */ +#line 511 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 61: + +/* Line 1464 of yacc.c */ +#line 521 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 62: + +/* Line 1464 of yacc.c */ +#line 527 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 63: + +/* Line 1464 of yacc.c */ +#line 533 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 64: + +/* Line 1464 of yacc.c */ +#line 539 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 66: + +/* Line 1464 of yacc.c */ +#line 549 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 67: + +/* Line 1464 of yacc.c */ +#line 555 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 69: + +/* Line 1464 of yacc.c */ +#line 565 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 71: + +/* Line 1464 of yacc.c */ +#line 575 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 73: + +/* Line 1464 of yacc.c */ +#line 585 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 75: + +/* Line 1464 of yacc.c */ +#line 595 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 77: + +/* Line 1464 of yacc.c */ +#line 605 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 79: + +/* Line 1464 of yacc.c */ +#line 615 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 81: + +/* Line 1464 of yacc.c */ +#line 625 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression)); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 83: + +/* Line 1464 of yacc.c */ +#line 635 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL); + (yyval.expression)->set_location(yylloc); + ;} + break; + + case 84: + +/* Line 1464 of yacc.c */ +#line 643 "glsl_parser.ypp" + { (yyval.n) = ast_assign; ;} + break; + + case 85: + +/* Line 1464 of yacc.c */ +#line 644 "glsl_parser.ypp" + { (yyval.n) = ast_mul_assign; ;} + break; + + case 86: + +/* Line 1464 of yacc.c */ +#line 645 "glsl_parser.ypp" + { (yyval.n) = ast_div_assign; ;} + break; + + case 87: + +/* Line 1464 of yacc.c */ +#line 646 "glsl_parser.ypp" + { (yyval.n) = ast_mod_assign; ;} + break; + + case 88: + +/* Line 1464 of yacc.c */ +#line 647 "glsl_parser.ypp" + { (yyval.n) = ast_add_assign; ;} + break; + + case 89: + +/* Line 1464 of yacc.c */ +#line 648 "glsl_parser.ypp" + { (yyval.n) = ast_sub_assign; ;} + break; + + case 90: + +/* Line 1464 of yacc.c */ +#line 649 "glsl_parser.ypp" + { (yyval.n) = ast_ls_assign; ;} + break; + + case 91: + +/* Line 1464 of yacc.c */ +#line 650 "glsl_parser.ypp" + { (yyval.n) = ast_rs_assign; ;} + break; + + case 92: + +/* Line 1464 of yacc.c */ +#line 651 "glsl_parser.ypp" + { (yyval.n) = ast_and_assign; ;} + break; + + case 93: + +/* Line 1464 of yacc.c */ +#line 652 "glsl_parser.ypp" + { (yyval.n) = ast_xor_assign; ;} + break; + + case 94: + +/* Line 1464 of yacc.c */ +#line 653 "glsl_parser.ypp" + { (yyval.n) = ast_or_assign; ;} + break; + + case 95: + +/* Line 1464 of yacc.c */ +#line 658 "glsl_parser.ypp" + { + (yyval.expression) = (yyvsp[(1) - (1)].expression); + ;} + break; + + case 96: + +/* Line 1464 of yacc.c */ +#line 662 "glsl_parser.ypp" + { + void *ctx = state; + if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) { + (yyval.expression) = new(ctx) ast_expression(ast_sequence, NULL, NULL, NULL); + (yyval.expression)->set_location(yylloc); + (yyval.expression)->expressions.push_tail(& (yyvsp[(1) - (3)].expression)->link); + } else { + (yyval.expression) = (yyvsp[(1) - (3)].expression); + } + + (yyval.expression)->expressions.push_tail(& (yyvsp[(3) - (3)].expression)->link); + ;} + break; + + case 98: + +/* Line 1464 of yacc.c */ +#line 682 "glsl_parser.ypp" + { + (yyval.node) = (yyvsp[(1) - (2)].function); + ;} + break; + + case 99: + +/* Line 1464 of yacc.c */ +#line 686 "glsl_parser.ypp" + { + (yyval.node) = (yyvsp[(1) - (2)].declarator_list); + ;} + break; + + case 100: + +/* Line 1464 of yacc.c */ +#line 690 "glsl_parser.ypp" + { + if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float) + && ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) { + _mesa_glsl_error(& (yylsp[(3) - (4)]), state, "global precision qualifier can " + "only be applied to `int' or `float'\n"); + YYERROR; + } + + (yyval.node) = NULL; /* FINISHME */ + ;} + break; + + case 104: + +/* Line 1464 of yacc.c */ +#line 713 "glsl_parser.ypp" + { + (yyval.function) = (yyvsp[(1) - (2)].function); + (yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link); + ;} + break; + + case 105: + +/* Line 1464 of yacc.c */ +#line 718 "glsl_parser.ypp" + { + (yyval.function) = (yyvsp[(1) - (3)].function); + (yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link); + ;} + break; + + case 106: + +/* Line 1464 of yacc.c */ +#line 726 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.function) = new(ctx) ast_function(); + (yyval.function)->set_location(yylloc); + (yyval.function)->return_type = (yyvsp[(1) - (3)].fully_specified_type); + (yyval.function)->identifier = (yyvsp[(2) - (3)].identifier); + ;} + break; + + case 107: + +/* Line 1464 of yacc.c */ +#line 737 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); + (yyval.parameter_declarator)->set_location(yylloc); + (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type(); + (yyval.parameter_declarator)->type->set_location(yylloc); + (yyval.parameter_declarator)->type->specifier = (yyvsp[(1) - (2)].type_specifier); + (yyval.parameter_declarator)->identifier = (yyvsp[(2) - (2)].identifier); + ;} + break; + + case 108: + +/* Line 1464 of yacc.c */ +#line 747 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); + (yyval.parameter_declarator)->set_location(yylloc); + (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type(); + (yyval.parameter_declarator)->type->set_location(yylloc); + (yyval.parameter_declarator)->type->specifier = (yyvsp[(1) - (5)].type_specifier); + (yyval.parameter_declarator)->identifier = (yyvsp[(2) - (5)].identifier); + (yyval.parameter_declarator)->is_array = true; + (yyval.parameter_declarator)->array_size = (yyvsp[(4) - (5)].expression); + ;} + break; + + case 109: + +/* Line 1464 of yacc.c */ +#line 762 "glsl_parser.ypp" + { + (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; + + (yyval.parameter_declarator) = (yyvsp[(3) - (3)].parameter_declarator); + (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (3)].type_qualifier).q; + ;} + break; + + case 110: + +/* Line 1464 of yacc.c */ +#line 769 "glsl_parser.ypp" + { + (yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator); + (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; + ;} + break; + + case 111: + +/* Line 1464 of yacc.c */ +#line 774 "glsl_parser.ypp" + { + void *ctx = state; + (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i; + + (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); + (yyval.parameter_declarator)->set_location(yylloc); + (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type(); + (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (3)].type_qualifier).q; + (yyval.parameter_declarator)->type->specifier = (yyvsp[(3) - (3)].type_specifier); + ;} + break; + + case 112: + +/* Line 1464 of yacc.c */ +#line 785 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.parameter_declarator) = new(ctx) ast_parameter_declarator(); + (yyval.parameter_declarator)->set_location(yylloc); + (yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type(); + (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; + (yyval.parameter_declarator)->type->specifier = (yyvsp[(2) - (2)].type_specifier); + ;} + break; + + case 113: + +/* Line 1464 of yacc.c */ +#line 796 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; ;} + break; + + case 114: + +/* Line 1464 of yacc.c */ +#line 797 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} + break; + + case 115: + +/* Line 1464 of yacc.c */ +#line 798 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} + break; + + case 116: + +/* Line 1464 of yacc.c */ +#line 799 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;} + break; + + case 119: + +/* Line 1464 of yacc.c */ +#line 809 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (3)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 120: + +/* Line 1464 of yacc.c */ +#line 818 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (5)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 121: + +/* Line 1464 of yacc.c */ +#line 827 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (6)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 122: + +/* Line 1464 of yacc.c */ +#line 836 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression)); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (7)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 123: + +/* Line 1464 of yacc.c */ +#line 845 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression)); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (8)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 124: + +/* Line 1464 of yacc.c */ +#line 854 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression)); + decl->set_location(yylloc); + + (yyval.declarator_list) = (yyvsp[(1) - (5)].declarator_list); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 125: + +/* Line 1464 of yacc.c */ +#line 867 "glsl_parser.ypp" + { + void *ctx = state; + if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) { + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, "empty declaration list\n"); + YYERROR; + } else { + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (1)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + } + ;} + break; + + case 126: + +/* Line 1464 of yacc.c */ +#line 878 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (2)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 127: + +/* Line 1464 of yacc.c */ +#line 887 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (4)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 128: + +/* Line 1464 of yacc.c */ +#line 896 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (5)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 129: + +/* Line 1464 of yacc.c */ +#line 905 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression)); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (6)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 130: + +/* Line 1464 of yacc.c */ +#line 914 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression)); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (7)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 131: + +/* Line 1464 of yacc.c */ +#line 923 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); + + (yyval.declarator_list) = new(ctx) ast_declarator_list((yyvsp[(1) - (4)].fully_specified_type)); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 132: + +/* Line 1464 of yacc.c */ +#line 932 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL); + + (yyval.declarator_list) = new(ctx) ast_declarator_list(NULL); + (yyval.declarator_list)->set_location(yylloc); + (yyval.declarator_list)->invariant = true; + + (yyval.declarator_list)->declarations.push_tail(&decl->link); + ;} + break; + + case 133: + +/* Line 1464 of yacc.c */ +#line 946 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); + (yyval.fully_specified_type)->set_location(yylloc); + (yyval.fully_specified_type)->specifier = (yyvsp[(1) - (1)].type_specifier); + ;} + break; + + case 134: + +/* Line 1464 of yacc.c */ +#line 953 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.fully_specified_type) = new(ctx) ast_fully_specified_type(); + (yyval.fully_specified_type)->set_location(yylloc); + (yyval.fully_specified_type)->qualifier = (yyvsp[(1) - (2)].type_qualifier).q; + (yyval.fully_specified_type)->specifier = (yyvsp[(2) - (2)].type_specifier); + ;} + break; + + case 135: + +/* Line 1464 of yacc.c */ +#line 963 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; ;} + break; + + case 137: + +/* Line 1464 of yacc.c */ +#line 969 "glsl_parser.ypp" + { + (yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier); + ;} + break; + + case 139: + +/* Line 1464 of yacc.c */ +#line 977 "glsl_parser.ypp" + { + (yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i; + ;} + break; + + case 140: + +/* Line 1464 of yacc.c */ +#line 984 "glsl_parser.ypp" + { + (yyval.type_qualifier).i = 0; + + if (state->ARB_fragment_coord_conventions_enable) { + bool got_one = false; + + if (strcmp((yyvsp[(1) - (1)].identifier), "origin_upper_left") == 0) { + got_one = true; + (yyval.type_qualifier).q.origin_upper_left = 1; + } else if (strcmp((yyvsp[(1) - (1)].identifier), "pixel_center_integer") == 0) { + got_one = true; + (yyval.type_qualifier).q.pixel_center_integer = 1; + } + + if (state->ARB_fragment_coord_conventions_warn && got_one) { + _mesa_glsl_warning(& (yylsp[(1) - (1)]), state, + "GL_ARB_fragment_coord_conventions layout " + "identifier `%s' used\n", (yyvsp[(1) - (1)].identifier)); + } + } + + /* If the identifier didn't match any known layout identifiers, + * emit an error. + */ + if ((yyval.type_qualifier).i == 0) { + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, "unrecognized layout identifier " + "`%s'\n", (yyvsp[(1) - (1)].identifier)); + YYERROR; + } + ;} + break; + + case 141: + +/* Line 1464 of yacc.c */ +#line 1017 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;} + break; + + case 142: + +/* Line 1464 of yacc.c */ +#line 1018 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;} + break; + + case 143: + +/* Line 1464 of yacc.c */ +#line 1019 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;} + break; + + case 144: + +/* Line 1464 of yacc.c */ +#line 1023 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} + break; + + case 146: + +/* Line 1464 of yacc.c */ +#line 1029 "glsl_parser.ypp" + { + (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i; + ;} + break; + + case 147: + +/* Line 1464 of yacc.c */ +#line 1033 "glsl_parser.ypp" + { + (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier); + (yyval.type_qualifier).q.invariant = 1; + ;} + break; + + case 148: + +/* Line 1464 of yacc.c */ +#line 1040 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;} + break; + + case 149: + +/* Line 1464 of yacc.c */ +#line 1041 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;} + break; + + case 150: + +/* Line 1464 of yacc.c */ +#line 1042 "glsl_parser.ypp" + { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i; (yyval.type_qualifier).q.varying = 1; ;} + break; + + case 151: + +/* Line 1464 of yacc.c */ +#line 1043 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;} + break; + + case 152: + +/* Line 1464 of yacc.c */ +#line 1044 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;} + break; + + case 153: + +/* Line 1464 of yacc.c */ +#line 1045 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;} + break; + + case 154: + +/* Line 1464 of yacc.c */ +#line 1046 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;} + break; + + case 155: + +/* Line 1464 of yacc.c */ +#line 1047 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;} + break; + + case 156: + +/* Line 1464 of yacc.c */ +#line 1048 "glsl_parser.ypp" + { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;} + break; + + case 158: + +/* Line 1464 of yacc.c */ +#line 1054 "glsl_parser.ypp" + { + (yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier); + (yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n); + ;} + break; + + case 160: + +/* Line 1464 of yacc.c */ +#line 1063 "glsl_parser.ypp" + { + (yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier); + (yyval.type_specifier)->is_array = true; + (yyval.type_specifier)->array_size = NULL; + ;} + break; + + case 161: + +/* Line 1464 of yacc.c */ +#line 1069 "glsl_parser.ypp" + { + (yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier); + (yyval.type_specifier)->is_array = true; + (yyval.type_specifier)->array_size = (yyvsp[(3) - (4)].expression); + ;} + break; + + case 162: + +/* Line 1464 of yacc.c */ +#line 1078 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n)); + (yyval.type_specifier)->set_location(yylloc); + ;} + break; + + case 163: + +/* Line 1464 of yacc.c */ +#line 1084 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier)); + (yyval.type_specifier)->set_location(yylloc); + ;} + break; + + case 164: + +/* Line 1464 of yacc.c */ +#line 1090 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier)); + (yyval.type_specifier)->set_location(yylloc); + ;} + break; + + case 165: + +/* Line 1464 of yacc.c */ +#line 1098 "glsl_parser.ypp" + { (yyval.n) = ast_void; ;} + break; + + case 166: + +/* Line 1464 of yacc.c */ +#line 1099 "glsl_parser.ypp" + { (yyval.n) = ast_float; ;} + break; + + case 167: + +/* Line 1464 of yacc.c */ +#line 1100 "glsl_parser.ypp" + { (yyval.n) = ast_int; ;} + break; + + case 168: + +/* Line 1464 of yacc.c */ +#line 1101 "glsl_parser.ypp" + { (yyval.n) = ast_uint; ;} + break; + + case 169: + +/* Line 1464 of yacc.c */ +#line 1102 "glsl_parser.ypp" + { (yyval.n) = ast_bool; ;} + break; + + case 170: + +/* Line 1464 of yacc.c */ +#line 1103 "glsl_parser.ypp" + { (yyval.n) = ast_vec2; ;} + break; + + case 171: + +/* Line 1464 of yacc.c */ +#line 1104 "glsl_parser.ypp" + { (yyval.n) = ast_vec3; ;} + break; + + case 172: + +/* Line 1464 of yacc.c */ +#line 1105 "glsl_parser.ypp" + { (yyval.n) = ast_vec4; ;} + break; + + case 173: + +/* Line 1464 of yacc.c */ +#line 1106 "glsl_parser.ypp" + { (yyval.n) = ast_bvec2; ;} + break; + + case 174: + +/* Line 1464 of yacc.c */ +#line 1107 "glsl_parser.ypp" + { (yyval.n) = ast_bvec3; ;} + break; + + case 175: + +/* Line 1464 of yacc.c */ +#line 1108 "glsl_parser.ypp" + { (yyval.n) = ast_bvec4; ;} + break; + + case 176: + +/* Line 1464 of yacc.c */ +#line 1109 "glsl_parser.ypp" + { (yyval.n) = ast_ivec2; ;} + break; + + case 177: + +/* Line 1464 of yacc.c */ +#line 1110 "glsl_parser.ypp" + { (yyval.n) = ast_ivec3; ;} + break; + + case 178: + +/* Line 1464 of yacc.c */ +#line 1111 "glsl_parser.ypp" + { (yyval.n) = ast_ivec4; ;} + break; + + case 179: + +/* Line 1464 of yacc.c */ +#line 1112 "glsl_parser.ypp" + { (yyval.n) = ast_uvec2; ;} + break; + + case 180: + +/* Line 1464 of yacc.c */ +#line 1113 "glsl_parser.ypp" + { (yyval.n) = ast_uvec3; ;} + break; + + case 181: + +/* Line 1464 of yacc.c */ +#line 1114 "glsl_parser.ypp" + { (yyval.n) = ast_uvec4; ;} + break; + + case 182: + +/* Line 1464 of yacc.c */ +#line 1115 "glsl_parser.ypp" + { (yyval.n) = ast_mat2; ;} + break; + + case 183: + +/* Line 1464 of yacc.c */ +#line 1116 "glsl_parser.ypp" + { (yyval.n) = ast_mat2x3; ;} + break; + + case 184: + +/* Line 1464 of yacc.c */ +#line 1117 "glsl_parser.ypp" + { (yyval.n) = ast_mat2x4; ;} + break; + + case 185: + +/* Line 1464 of yacc.c */ +#line 1118 "glsl_parser.ypp" + { (yyval.n) = ast_mat3x2; ;} + break; + + case 186: + +/* Line 1464 of yacc.c */ +#line 1119 "glsl_parser.ypp" + { (yyval.n) = ast_mat3; ;} + break; + + case 187: + +/* Line 1464 of yacc.c */ +#line 1120 "glsl_parser.ypp" + { (yyval.n) = ast_mat3x4; ;} + break; + + case 188: + +/* Line 1464 of yacc.c */ +#line 1121 "glsl_parser.ypp" + { (yyval.n) = ast_mat4x2; ;} + break; + + case 189: + +/* Line 1464 of yacc.c */ +#line 1122 "glsl_parser.ypp" + { (yyval.n) = ast_mat4x3; ;} + break; + + case 190: + +/* Line 1464 of yacc.c */ +#line 1123 "glsl_parser.ypp" + { (yyval.n) = ast_mat4; ;} + break; + + case 191: + +/* Line 1464 of yacc.c */ +#line 1124 "glsl_parser.ypp" + { (yyval.n) = ast_sampler1d; ;} + break; + + case 192: + +/* Line 1464 of yacc.c */ +#line 1125 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2d; ;} + break; + + case 193: + +/* Line 1464 of yacc.c */ +#line 1126 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2drect; ;} + break; + + case 194: + +/* Line 1464 of yacc.c */ +#line 1127 "glsl_parser.ypp" + { (yyval.n) = ast_sampler3d; ;} + break; + + case 195: + +/* Line 1464 of yacc.c */ +#line 1128 "glsl_parser.ypp" + { (yyval.n) = ast_samplercube; ;} + break; + + case 196: + +/* Line 1464 of yacc.c */ +#line 1129 "glsl_parser.ypp" + { (yyval.n) = ast_sampler1dshadow; ;} + break; + + case 197: + +/* Line 1464 of yacc.c */ +#line 1130 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2dshadow; ;} + break; + + case 198: + +/* Line 1464 of yacc.c */ +#line 1131 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2drectshadow; ;} + break; + + case 199: + +/* Line 1464 of yacc.c */ +#line 1132 "glsl_parser.ypp" + { (yyval.n) = ast_samplercubeshadow; ;} + break; + + case 200: + +/* Line 1464 of yacc.c */ +#line 1133 "glsl_parser.ypp" + { (yyval.n) = ast_sampler1darray; ;} + break; + + case 201: + +/* Line 1464 of yacc.c */ +#line 1134 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2darray; ;} + break; + + case 202: + +/* Line 1464 of yacc.c */ +#line 1135 "glsl_parser.ypp" + { (yyval.n) = ast_sampler1darrayshadow; ;} + break; + + case 203: + +/* Line 1464 of yacc.c */ +#line 1136 "glsl_parser.ypp" + { (yyval.n) = ast_sampler2darrayshadow; ;} + break; + + case 204: + +/* Line 1464 of yacc.c */ +#line 1137 "glsl_parser.ypp" + { (yyval.n) = ast_isampler1d; ;} + break; + + case 205: + +/* Line 1464 of yacc.c */ +#line 1138 "glsl_parser.ypp" + { (yyval.n) = ast_isampler2d; ;} + break; + + case 206: + +/* Line 1464 of yacc.c */ +#line 1139 "glsl_parser.ypp" + { (yyval.n) = ast_isampler3d; ;} + break; + + case 207: + +/* Line 1464 of yacc.c */ +#line 1140 "glsl_parser.ypp" + { (yyval.n) = ast_isamplercube; ;} + break; + + case 208: + +/* Line 1464 of yacc.c */ +#line 1141 "glsl_parser.ypp" + { (yyval.n) = ast_isampler1darray; ;} + break; + + case 209: + +/* Line 1464 of yacc.c */ +#line 1142 "glsl_parser.ypp" + { (yyval.n) = ast_isampler2darray; ;} + break; + + case 210: + +/* Line 1464 of yacc.c */ +#line 1143 "glsl_parser.ypp" + { (yyval.n) = ast_usampler1d; ;} + break; + + case 211: + +/* Line 1464 of yacc.c */ +#line 1144 "glsl_parser.ypp" + { (yyval.n) = ast_usampler2d; ;} + break; + + case 212: + +/* Line 1464 of yacc.c */ +#line 1145 "glsl_parser.ypp" + { (yyval.n) = ast_usampler3d; ;} + break; + + case 213: + +/* Line 1464 of yacc.c */ +#line 1146 "glsl_parser.ypp" + { (yyval.n) = ast_usamplercube; ;} + break; + + case 214: + +/* Line 1464 of yacc.c */ +#line 1147 "glsl_parser.ypp" + { (yyval.n) = ast_usampler1darray; ;} + break; + + case 215: + +/* Line 1464 of yacc.c */ +#line 1148 "glsl_parser.ypp" + { (yyval.n) = ast_usampler2darray; ;} + break; + + case 216: + +/* Line 1464 of yacc.c */ +#line 1152 "glsl_parser.ypp" + { + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + (yyval.n) = ast_precision_high; + ;} + break; + + case 217: + +/* Line 1464 of yacc.c */ +#line 1163 "glsl_parser.ypp" + { + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + (yyval.n) = ast_precision_medium; + ;} + break; + + case 218: + +/* Line 1464 of yacc.c */ +#line 1174 "glsl_parser.ypp" + { + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + (yyval.n) = ast_precision_low; + ;} + break; + + case 219: + +/* Line 1464 of yacc.c */ +#line 1189 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node)); + (yyval.struct_specifier)->set_location(yylloc); + ;} + break; + + case 220: + +/* Line 1464 of yacc.c */ +#line 1195 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node)); + (yyval.struct_specifier)->set_location(yylloc); + ;} + break; + + case 221: + +/* Line 1464 of yacc.c */ +#line 1204 "glsl_parser.ypp" + { + (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list); + (yyvsp[(1) - (1)].declarator_list)->link.self_link(); + ;} + break; + + case 222: + +/* Line 1464 of yacc.c */ +#line 1209 "glsl_parser.ypp" + { + (yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node); + (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link); + ;} + break; + + case 223: + +/* Line 1464 of yacc.c */ +#line 1217 "glsl_parser.ypp" + { + void *ctx = state; + ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); + type->set_location(yylloc); + + type->specifier = (yyvsp[(1) - (3)].type_specifier); + (yyval.declarator_list) = new(ctx) ast_declarator_list(type); + (yyval.declarator_list)->set_location(yylloc); + + (yyval.declarator_list)->declarations.push_degenerate_list_at_head(& (yyvsp[(2) - (3)].declaration)->link); + ;} + break; + + case 224: + +/* Line 1464 of yacc.c */ +#line 1232 "glsl_parser.ypp" + { + (yyval.declaration) = (yyvsp[(1) - (1)].declaration); + (yyvsp[(1) - (1)].declaration)->link.self_link(); + ;} + break; + + case 225: + +/* Line 1464 of yacc.c */ +#line 1237 "glsl_parser.ypp" + { + (yyval.declaration) = (yyvsp[(1) - (3)].declaration); + (yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link); + ;} + break; + + case 226: + +/* Line 1464 of yacc.c */ +#line 1245 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL); + (yyval.declaration)->set_location(yylloc); + ;} + break; + + case 227: + +/* Line 1464 of yacc.c */ +#line 1251 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL); + (yyval.declaration)->set_location(yylloc); + ;} + break; + + case 230: + +/* Line 1464 of yacc.c */ +#line 1269 "glsl_parser.ypp" + { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} + break; + + case 235: + +/* Line 1464 of yacc.c */ +#line 1277 "glsl_parser.ypp" + { (yyval.node) = NULL; ;} + break; + + case 236: + +/* Line 1464 of yacc.c */ +#line 1278 "glsl_parser.ypp" + { (yyval.node) = NULL; ;} + break; + + case 239: + +/* Line 1464 of yacc.c */ +#line 1285 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL); + (yyval.compound_statement)->set_location(yylloc); + ;} + break; + + case 240: + +/* Line 1464 of yacc.c */ +#line 1291 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node)); + (yyval.compound_statement)->set_location(yylloc); + ;} + break; + + case 241: + +/* Line 1464 of yacc.c */ +#line 1299 "glsl_parser.ypp" + { (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;} + break; + + case 243: + +/* Line 1464 of yacc.c */ +#line 1305 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL); + (yyval.compound_statement)->set_location(yylloc); + ;} + break; + + case 244: + +/* Line 1464 of yacc.c */ +#line 1311 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node)); + (yyval.compound_statement)->set_location(yylloc); + ;} + break; + + case 245: + +/* Line 1464 of yacc.c */ +#line 1320 "glsl_parser.ypp" + { + if ((yyvsp[(1) - (1)].node) == NULL) { + _mesa_glsl_error(& (yylsp[(1) - (1)]), state, "<nil> statement\n"); + assert((yyvsp[(1) - (1)].node) != NULL); + } + + (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node)->link.self_link(); + ;} + break; + + case 246: + +/* Line 1464 of yacc.c */ +#line 1330 "glsl_parser.ypp" + { + if ((yyvsp[(2) - (2)].node) == NULL) { + _mesa_glsl_error(& (yylsp[(2) - (2)]), state, "<nil> statement\n"); + assert((yyvsp[(2) - (2)].node) != NULL); + } + (yyval.node) = (yyvsp[(1) - (2)].node); + (yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].node)->link); + ;} + break; + + case 247: + +/* Line 1464 of yacc.c */ +#line 1342 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_expression_statement(NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 248: + +/* Line 1464 of yacc.c */ +#line 1348 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 249: + +/* Line 1464 of yacc.c */ +#line 1357 "glsl_parser.ypp" + { + (yyval.node) = new(state) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].selection_rest_statement).then_statement, + (yyvsp[(5) - (5)].selection_rest_statement).else_statement); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 250: + +/* Line 1464 of yacc.c */ +#line 1366 "glsl_parser.ypp" + { + (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (3)].node); + (yyval.selection_rest_statement).else_statement = (yyvsp[(3) - (3)].node); + ;} + break; + + case 251: + +/* Line 1464 of yacc.c */ +#line 1371 "glsl_parser.ypp" + { + (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (1)].node); + (yyval.selection_rest_statement).else_statement = NULL; + ;} + break; + + case 252: + +/* Line 1464 of yacc.c */ +#line 1379 "glsl_parser.ypp" + { + (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression); + ;} + break; + + case 253: + +/* Line 1464 of yacc.c */ +#line 1383 "glsl_parser.ypp" + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression)); + ast_declarator_list *declarator = new(ctx) ast_declarator_list((yyvsp[(1) - (4)].fully_specified_type)); + decl->set_location(yylloc); + declarator->set_location(yylloc); + + declarator->declarations.push_tail(&decl->link); + (yyval.node) = declarator; + ;} + break; + + case 257: + +/* Line 1464 of yacc.c */ +#line 1406 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, + NULL, (yyvsp[(3) - (5)].node), NULL, (yyvsp[(5) - (5)].node)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 258: + +/* Line 1464 of yacc.c */ +#line 1413 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, + NULL, (yyvsp[(5) - (7)].expression), NULL, (yyvsp[(2) - (7)].node)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 259: + +/* Line 1464 of yacc.c */ +#line 1420 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, + (yyvsp[(3) - (6)].node), (yyvsp[(4) - (6)].for_rest_statement).cond, (yyvsp[(4) - (6)].for_rest_statement).rest, (yyvsp[(6) - (6)].node)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 263: + +/* Line 1464 of yacc.c */ +#line 1436 "glsl_parser.ypp" + { + (yyval.node) = NULL; + ;} + break; + + case 264: + +/* Line 1464 of yacc.c */ +#line 1443 "glsl_parser.ypp" + { + (yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node); + (yyval.for_rest_statement).rest = NULL; + ;} + break; + + case 265: + +/* Line 1464 of yacc.c */ +#line 1448 "glsl_parser.ypp" + { + (yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node); + (yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression); + ;} + break; + + case 266: + +/* Line 1464 of yacc.c */ +#line 1457 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 267: + +/* Line 1464 of yacc.c */ +#line 1463 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 268: + +/* Line 1464 of yacc.c */ +#line 1469 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 269: + +/* Line 1464 of yacc.c */ +#line 1475 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression)); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 270: + +/* Line 1464 of yacc.c */ +#line 1481 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); + (yyval.node)->set_location(yylloc); + ;} + break; + + case 271: + +/* Line 1464 of yacc.c */ +#line 1489 "glsl_parser.ypp" + { (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;} + break; + + case 272: + +/* Line 1464 of yacc.c */ +#line 1490 "glsl_parser.ypp" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 273: + +/* Line 1464 of yacc.c */ +#line 1491 "glsl_parser.ypp" + { (yyval.node) = NULL; ;} + break; + + case 274: + +/* Line 1464 of yacc.c */ +#line 1496 "glsl_parser.ypp" + { + void *ctx = state; + (yyval.function_definition) = new(ctx) ast_function_definition(); + (yyval.function_definition)->set_location(yylloc); + (yyval.function_definition)->prototype = (yyvsp[(1) - (2)].function); + (yyval.function_definition)->body = (yyvsp[(2) - (2)].compound_statement); + ;} + break; + + + +/* Line 1464 of yacc.c */ +#line 5016 "glsl_parser.cpp" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + *++yylsp = yyloc; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, state, YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (&yylloc, state, yymsg); + } + else + { + yyerror (&yylloc, state, YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + yyerror_range[1] = yylloc; + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, &yylloc, state); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + yyerror_range[1] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + yyerror_range[1] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, state); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + yyerror_range[2] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, state, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, &yylloc, state); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, state); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + diff --git a/mesalib/src/glsl/glsl_parser.h b/mesalib/src/glsl/glsl_parser.h new file mode 100644 index 000000000..4a780375b --- /dev/null +++ b/mesalib/src/glsl/glsl_parser.h @@ -0,0 +1,298 @@ +/* A Bison parser, made by GNU Bison 2.4.3. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2009, 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ATTRIBUTE = 258, + CONST_TOK = 259, + BOOL_TOK = 260, + FLOAT_TOK = 261, + INT_TOK = 262, + UINT_TOK = 263, + BREAK = 264, + CONTINUE = 265, + DO = 266, + ELSE = 267, + FOR = 268, + IF = 269, + DISCARD = 270, + RETURN = 271, + SWITCH = 272, + CASE = 273, + DEFAULT = 274, + BVEC2 = 275, + BVEC3 = 276, + BVEC4 = 277, + IVEC2 = 278, + IVEC3 = 279, + IVEC4 = 280, + UVEC2 = 281, + UVEC3 = 282, + UVEC4 = 283, + VEC2 = 284, + VEC3 = 285, + VEC4 = 286, + CENTROID = 287, + IN_TOK = 288, + OUT_TOK = 289, + INOUT_TOK = 290, + UNIFORM = 291, + VARYING = 292, + NOPERSPECTIVE = 293, + FLAT = 294, + SMOOTH = 295, + MAT2X2 = 296, + MAT2X3 = 297, + MAT2X4 = 298, + MAT3X2 = 299, + MAT3X3 = 300, + MAT3X4 = 301, + MAT4X2 = 302, + MAT4X3 = 303, + MAT4X4 = 304, + SAMPLER1D = 305, + SAMPLER2D = 306, + SAMPLER3D = 307, + SAMPLERCUBE = 308, + SAMPLER1DSHADOW = 309, + SAMPLER2DSHADOW = 310, + SAMPLERCUBESHADOW = 311, + SAMPLER1DARRAY = 312, + SAMPLER2DARRAY = 313, + SAMPLER1DARRAYSHADOW = 314, + SAMPLER2DARRAYSHADOW = 315, + ISAMPLER1D = 316, + ISAMPLER2D = 317, + ISAMPLER3D = 318, + ISAMPLERCUBE = 319, + ISAMPLER1DARRAY = 320, + ISAMPLER2DARRAY = 321, + USAMPLER1D = 322, + USAMPLER2D = 323, + USAMPLER3D = 324, + USAMPLERCUBE = 325, + USAMPLER1DARRAY = 326, + USAMPLER2DARRAY = 327, + STRUCT = 328, + VOID_TOK = 329, + WHILE = 330, + IDENTIFIER = 331, + FLOATCONSTANT = 332, + INTCONSTANT = 333, + UINTCONSTANT = 334, + BOOLCONSTANT = 335, + FIELD_SELECTION = 336, + LEFT_OP = 337, + RIGHT_OP = 338, + INC_OP = 339, + DEC_OP = 340, + LE_OP = 341, + GE_OP = 342, + EQ_OP = 343, + NE_OP = 344, + AND_OP = 345, + OR_OP = 346, + XOR_OP = 347, + MUL_ASSIGN = 348, + DIV_ASSIGN = 349, + ADD_ASSIGN = 350, + MOD_ASSIGN = 351, + LEFT_ASSIGN = 352, + RIGHT_ASSIGN = 353, + AND_ASSIGN = 354, + XOR_ASSIGN = 355, + OR_ASSIGN = 356, + SUB_ASSIGN = 357, + INVARIANT = 358, + LOWP = 359, + MEDIUMP = 360, + HIGHP = 361, + SUPERP = 362, + PRECISION = 363, + VERSION = 364, + EXTENSION = 365, + LINE = 366, + COLON = 367, + EOL = 368, + INTERFACE = 369, + OUTPUT = 370, + PRAGMA_DEBUG_ON = 371, + PRAGMA_DEBUG_OFF = 372, + PRAGMA_OPTIMIZE_ON = 373, + PRAGMA_OPTIMIZE_OFF = 374, + LAYOUT_TOK = 375, + ASM = 376, + CLASS = 377, + UNION = 378, + ENUM = 379, + TYPEDEF = 380, + TEMPLATE = 381, + THIS = 382, + PACKED_TOK = 383, + GOTO = 384, + INLINE_TOK = 385, + NOINLINE = 386, + VOLATILE = 387, + PUBLIC_TOK = 388, + STATIC = 389, + EXTERN = 390, + EXTERNAL = 391, + LONG_TOK = 392, + SHORT_TOK = 393, + DOUBLE_TOK = 394, + HALF = 395, + FIXED_TOK = 396, + UNSIGNED = 397, + INPUT_TOK = 398, + OUPTUT = 399, + HVEC2 = 400, + HVEC3 = 401, + HVEC4 = 402, + DVEC2 = 403, + DVEC3 = 404, + DVEC4 = 405, + FVEC2 = 406, + FVEC3 = 407, + FVEC4 = 408, + SAMPLER2DRECT = 409, + SAMPLER3DRECT = 410, + SAMPLER2DRECTSHADOW = 411, + SIZEOF = 412, + CAST = 413, + NAMESPACE = 414, + USING = 415, + ERROR_TOK = 416, + COMMON = 417, + PARTITION = 418, + ACTIVE = 419, + SAMPLERBUFFER = 420, + FILTER = 421, + IMAGE1D = 422, + IMAGE2D = 423, + IMAGE3D = 424, + IMAGECUBE = 425, + IMAGE1DARRAY = 426, + IMAGE2DARRAY = 427, + IIMAGE1D = 428, + IIMAGE2D = 429, + IIMAGE3D = 430, + IIMAGECUBE = 431, + IIMAGE1DARRAY = 432, + IIMAGE2DARRAY = 433, + UIMAGE1D = 434, + UIMAGE2D = 435, + UIMAGE3D = 436, + UIMAGECUBE = 437, + UIMAGE1DARRAY = 438, + UIMAGE2DARRAY = 439, + IMAGE1DSHADOW = 440, + IMAGE2DSHADOW = 441, + IMAGEBUFFER = 442, + IIMAGEBUFFER = 443, + UIMAGEBUFFER = 444, + ROW_MAJOR = 445 + }; +#endif + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1685 of yacc.c */ +#line 52 "glsl_parser.ypp" + + int n; + float real; + char *identifier; + + union { + struct ast_type_qualifier q; + unsigned i; + } type_qualifier; + + ast_node *node; + ast_type_specifier *type_specifier; + ast_fully_specified_type *fully_specified_type; + ast_function *function; + ast_parameter_declarator *parameter_declarator; + ast_function_definition *function_definition; + ast_compound_statement *compound_statement; + ast_expression *expression; + ast_declarator_list *declarator_list; + ast_struct_specifier *struct_specifier; + ast_declaration *declaration; + + struct { + ast_node *cond; + ast_expression *rest; + } for_rest_statement; + + struct { + ast_node *then_statement; + ast_node *else_statement; + } selection_rest_statement; + + + +/* Line 1685 of yacc.c */ +#line 276 "glsl_parser.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + + + diff --git a/mesalib/src/glsl/glsl_parser.ypp b/mesalib/src/glsl/glsl_parser.ypp new file mode 100644 index 000000000..0df1e480c --- /dev/null +++ b/mesalib/src/glsl/glsl_parser.ypp @@ -0,0 +1,1503 @@ +%{ +/* + * Copyright © 2008, 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_types.h" + +#define YYLEX_PARAM state->scanner + +%} + +%pure-parser +%error-verbose + +%locations +%initial-action { + @$.first_line = 1; + @$.first_column = 1; + @$.last_line = 1; + @$.last_column = 1; + @$.source = 0; +} + +%lex-param {void *scanner} +%parse-param {struct _mesa_glsl_parse_state *state} + +%union { + int n; + float real; + char *identifier; + + union { + struct ast_type_qualifier q; + unsigned i; + } type_qualifier; + + ast_node *node; + ast_type_specifier *type_specifier; + ast_fully_specified_type *fully_specified_type; + ast_function *function; + ast_parameter_declarator *parameter_declarator; + ast_function_definition *function_definition; + ast_compound_statement *compound_statement; + ast_expression *expression; + ast_declarator_list *declarator_list; + ast_struct_specifier *struct_specifier; + ast_declaration *declaration; + + struct { + ast_node *cond; + ast_expression *rest; + } for_rest_statement; + + struct { + ast_node *then_statement; + ast_node *else_statement; + } selection_rest_statement; +} + +%token ATTRIBUTE CONST_TOK BOOL_TOK FLOAT_TOK INT_TOK UINT_TOK +%token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT +%token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 UVEC2 UVEC3 UVEC4 VEC2 VEC3 VEC4 +%token CENTROID IN_TOK OUT_TOK INOUT_TOK UNIFORM VARYING +%token NOPERSPECTIVE FLAT SMOOTH +%token MAT2X2 MAT2X3 MAT2X4 +%token MAT3X2 MAT3X3 MAT3X4 +%token MAT4X2 MAT4X3 MAT4X4 +%token SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW +%token SAMPLERCUBESHADOW SAMPLER1DARRAY SAMPLER2DARRAY SAMPLER1DARRAYSHADOW +%token SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE +%token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D +%token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY +%token STRUCT VOID_TOK WHILE +%token <identifier> IDENTIFIER +%token <real> FLOATCONSTANT +%token <n> INTCONSTANT UINTCONSTANT BOOLCONSTANT +%token <identifier> FIELD_SELECTION +%token LEFT_OP RIGHT_OP +%token INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP +%token AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN +%token MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN +%token SUB_ASSIGN +%token INVARIANT +%token LOWP MEDIUMP HIGHP SUPERP PRECISION + +%token VERSION EXTENSION LINE COLON EOL INTERFACE OUTPUT +%token PRAGMA_DEBUG_ON PRAGMA_DEBUG_OFF +%token PRAGMA_OPTIMIZE_ON PRAGMA_OPTIMIZE_OFF +%token LAYOUT_TOK + + /* Reserved words that are not actually used in the grammar. + */ +%token ASM CLASS UNION ENUM TYPEDEF TEMPLATE THIS PACKED_TOK GOTO +%token INLINE_TOK NOINLINE VOLATILE PUBLIC_TOK STATIC EXTERN EXTERNAL +%token LONG_TOK SHORT_TOK DOUBLE_TOK HALF FIXED_TOK UNSIGNED INPUT_TOK OUPTUT +%token HVEC2 HVEC3 HVEC4 DVEC2 DVEC3 DVEC4 FVEC2 FVEC3 FVEC4 +%token SAMPLER2DRECT SAMPLER3DRECT SAMPLER2DRECTSHADOW +%token SIZEOF CAST NAMESPACE USING + +%token ERROR_TOK + +%token COMMON PARTITION ACTIVE SAMPLERBUFFER FILTER +%token IMAGE1D IMAGE2D IMAGE3D IMAGECUBE IMAGE1DARRAY IMAGE2DARRAY +%token IIMAGE1D IIMAGE2D IIMAGE3D IIMAGECUBE IIMAGE1DARRAY IIMAGE2DARRAY +%token UIMAGE1D UIMAGE2D UIMAGE3D UIMAGECUBE UIMAGE1DARRAY UIMAGE2DARRAY +%token IMAGE1DSHADOW IMAGE2DSHADOW IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER +%token ROW_MAJOR + +%type <identifier> variable_identifier +%type <node> statement +%type <node> statement_list +%type <node> simple_statement +%type <n> precision_qualifier +%type <type_qualifier> type_qualifier +%type <type_qualifier> storage_qualifier +%type <type_qualifier> interpolation_qualifier +%type <type_qualifier> opt_layout_qualifier layout_qualifier +%type <type_qualifier> layout_qualifier_id_list layout_qualifier_id +%type <type_specifier> type_specifier +%type <type_specifier> type_specifier_no_prec +%type <type_specifier> type_specifier_nonarray +%type <n> basic_type_specifier_nonarray +%type <fully_specified_type> fully_specified_type +%type <function> function_prototype +%type <function> function_header +%type <function> function_header_with_parameters +%type <function> function_declarator +%type <parameter_declarator> parameter_declarator +%type <parameter_declarator> parameter_declaration +%type <type_qualifier> parameter_qualifier +%type <type_qualifier> parameter_type_qualifier +%type <type_specifier> parameter_type_specifier +%type <function_definition> function_definition +%type <compound_statement> compound_statement_no_new_scope +%type <compound_statement> compound_statement +%type <node> statement_no_new_scope +%type <node> expression_statement +%type <expression> expression +%type <expression> primary_expression +%type <expression> assignment_expression +%type <expression> conditional_expression +%type <expression> logical_or_expression +%type <expression> logical_xor_expression +%type <expression> logical_and_expression +%type <expression> inclusive_or_expression +%type <expression> exclusive_or_expression +%type <expression> and_expression +%type <expression> equality_expression +%type <expression> relational_expression +%type <expression> shift_expression +%type <expression> additive_expression +%type <expression> multiplicative_expression +%type <expression> unary_expression +%type <expression> constant_expression +%type <expression> integer_expression +%type <expression> postfix_expression +%type <expression> function_call_header_with_parameters +%type <expression> function_call_header_no_parameters +%type <expression> function_call_header +%type <expression> function_call_generic +%type <expression> function_call_or_method +%type <expression> function_call +%type <n> assignment_operator +%type <n> unary_operator +%type <expression> function_identifier +%type <node> external_declaration +%type <declarator_list> init_declarator_list +%type <declarator_list> single_declaration +%type <expression> initializer +%type <node> declaration +%type <node> declaration_statement +%type <node> jump_statement +%type <struct_specifier> struct_specifier +%type <node> struct_declaration_list +%type <declarator_list> struct_declaration +%type <declaration> struct_declarator +%type <declaration> struct_declarator_list +%type <node> selection_statement +%type <selection_rest_statement> selection_rest_statement +%type <node> iteration_statement +%type <node> condition +%type <node> conditionopt +%type <node> for_init_statement +%type <for_rest_statement> for_rest_statement +%% + +translation_unit: + version_statement extension_statement_list + { + _mesa_glsl_initialize_types(state); + } + external_declaration_list + ; + +version_statement: + /* blank - no #version specified: defaults are already set */ + | VERSION INTCONSTANT EOL + { + switch ($2) { + case 100: + state->es_shader = true; + case 110: + case 120: + case 130: + /* FINISHME: Check against implementation support versions. */ + state->language_version = $2; + break; + default: + _mesa_glsl_error(& @2, state, "Shading language version" + "%u is not supported\n", $2); + break; + } + } + ; + +pragma_statement: + PRAGMA_DEBUG_ON EOL + | PRAGMA_DEBUG_OFF EOL + | PRAGMA_OPTIMIZE_ON EOL + | PRAGMA_OPTIMIZE_OFF EOL + ; + +extension_statement_list: + + | extension_statement_list extension_statement + ; + +extension_statement: + EXTENSION IDENTIFIER COLON IDENTIFIER EOL + { + if (!_mesa_glsl_process_extension($2, & @2, $4, & @4, state)) { + YYERROR; + } + } + ; + +external_declaration_list: + external_declaration + { + /* FINISHME: The NULL test is only required because 'precision' + * FINISHME: statements are not yet supported. + */ + if ($1 != NULL) + state->translation_unit.push_tail(& $1->link); + } + | external_declaration_list external_declaration + { + /* FINISHME: The NULL test is only required because 'precision' + * FINISHME: statements are not yet supported. + */ + if ($2 != NULL) + state->translation_unit.push_tail(& $2->link); + } + ; + +variable_identifier: + IDENTIFIER + ; + +primary_expression: + variable_identifier + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.identifier = $1; + } + | INTCONSTANT + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.int_constant = $1; + } + | UINTCONSTANT + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.uint_constant = $1; + } + | FLOATCONSTANT + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.float_constant = $1; + } + | BOOLCONSTANT + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.bool_constant = $1; + } + | '(' expression ')' + { + $$ = $2; + } + ; + +postfix_expression: + primary_expression + | postfix_expression '[' integer_expression ']' + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_array_index, $1, $3, NULL); + $$->set_location(yylloc); + } + | function_call + { + $$ = $1; + } + | postfix_expression '.' IDENTIFIER + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_field_selection, $1, NULL, NULL); + $$->set_location(yylloc); + $$->primary_expression.identifier = $3; + } + | postfix_expression INC_OP + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_post_inc, $1, NULL, NULL); + $$->set_location(yylloc); + } + | postfix_expression DEC_OP + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_post_dec, $1, NULL, NULL); + $$->set_location(yylloc); + } + ; + +integer_expression: + expression + ; + +function_call: + function_call_or_method + ; + +function_call_or_method: + function_call_generic + | postfix_expression '.' function_call_generic + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_field_selection, $1, $3, NULL); + $$->set_location(yylloc); + } + ; + +function_call_generic: + function_call_header_with_parameters ')' + | function_call_header_no_parameters ')' + ; + +function_call_header_no_parameters: + function_call_header VOID_TOK + | function_call_header + ; + +function_call_header_with_parameters: + function_call_header assignment_expression + { + $$ = $1; + $$->set_location(yylloc); + $$->expressions.push_tail(& $2->link); + } + | function_call_header_with_parameters ',' assignment_expression + { + $$ = $1; + $$->set_location(yylloc); + $$->expressions.push_tail(& $3->link); + } + ; + + // Grammar Note: Constructors look like functions, but lexical + // analysis recognized most of them as keywords. They are now + // recognized through "type_specifier". +function_call_header: + function_identifier '(' + ; + +function_identifier: + type_specifier + { + void *ctx = state; + $$ = new(ctx) ast_function_expression($1); + $$->set_location(yylloc); + } + | IDENTIFIER + { + void *ctx = state; + ast_expression *callee = new(ctx) ast_expression($1); + $$ = new(ctx) ast_function_expression(callee); + $$->set_location(yylloc); + } + | FIELD_SELECTION + { + void *ctx = state; + ast_expression *callee = new(ctx) ast_expression($1); + $$ = new(ctx) ast_function_expression(callee); + $$->set_location(yylloc); + } + ; + + // Grammar Note: No traditional style type casts. +unary_expression: + postfix_expression + | INC_OP unary_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_pre_inc, $2, NULL, NULL); + $$->set_location(yylloc); + } + | DEC_OP unary_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_pre_dec, $2, NULL, NULL); + $$->set_location(yylloc); + } + | unary_operator unary_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression($1, $2, NULL, NULL); + $$->set_location(yylloc); + } + ; + + // Grammar Note: No '*' or '&' unary ops. Pointers are not supported. +unary_operator: + '+' { $$ = ast_plus; } + | '-' { $$ = ast_neg; } + | '!' { $$ = ast_logic_not; } + | '~' { $$ = ast_bit_not; } + ; + +multiplicative_expression: + unary_expression + | multiplicative_expression '*' unary_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_mul, $1, $3); + $$->set_location(yylloc); + } + | multiplicative_expression '/' unary_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_div, $1, $3); + $$->set_location(yylloc); + } + | multiplicative_expression '%' unary_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_mod, $1, $3); + $$->set_location(yylloc); + } + ; + +additive_expression: + multiplicative_expression + | additive_expression '+' multiplicative_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_add, $1, $3); + $$->set_location(yylloc); + } + | additive_expression '-' multiplicative_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_sub, $1, $3); + $$->set_location(yylloc); + } + ; + +shift_expression: + additive_expression + | shift_expression LEFT_OP additive_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_lshift, $1, $3); + $$->set_location(yylloc); + } + | shift_expression RIGHT_OP additive_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_rshift, $1, $3); + $$->set_location(yylloc); + } + ; + +relational_expression: + shift_expression + | relational_expression '<' shift_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_less, $1, $3); + $$->set_location(yylloc); + } + | relational_expression '>' shift_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_greater, $1, $3); + $$->set_location(yylloc); + } + | relational_expression LE_OP shift_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_lequal, $1, $3); + $$->set_location(yylloc); + } + | relational_expression GE_OP shift_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_gequal, $1, $3); + $$->set_location(yylloc); + } + ; + +equality_expression: + relational_expression + | equality_expression EQ_OP relational_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_equal, $1, $3); + $$->set_location(yylloc); + } + | equality_expression NE_OP relational_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_nequal, $1, $3); + $$->set_location(yylloc); + } + ; + +and_expression: + equality_expression + | and_expression '&' equality_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_bit_or, $1, $3); + $$->set_location(yylloc); + } + ; + +exclusive_or_expression: + and_expression + | exclusive_or_expression '^' and_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_bit_xor, $1, $3); + $$->set_location(yylloc); + } + ; + +inclusive_or_expression: + exclusive_or_expression + | inclusive_or_expression '|' exclusive_or_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_bit_or, $1, $3); + $$->set_location(yylloc); + } + ; + +logical_and_expression: + inclusive_or_expression + | logical_and_expression AND_OP inclusive_or_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_logic_and, $1, $3); + $$->set_location(yylloc); + } + ; + +logical_xor_expression: + logical_and_expression + | logical_xor_expression XOR_OP logical_and_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_logic_xor, $1, $3); + $$->set_location(yylloc); + } + ; + +logical_or_expression: + logical_xor_expression + | logical_or_expression OR_OP logical_xor_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression_bin(ast_logic_or, $1, $3); + $$->set_location(yylloc); + } + ; + +conditional_expression: + logical_or_expression + | logical_or_expression '?' expression ':' assignment_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression(ast_conditional, $1, $3, $5); + $$->set_location(yylloc); + } + ; + +assignment_expression: + conditional_expression + | unary_expression assignment_operator assignment_expression + { + void *ctx = state; + $$ = new(ctx) ast_expression($2, $1, $3, NULL); + $$->set_location(yylloc); + } + ; + +assignment_operator: + '=' { $$ = ast_assign; } + | MUL_ASSIGN { $$ = ast_mul_assign; } + | DIV_ASSIGN { $$ = ast_div_assign; } + | MOD_ASSIGN { $$ = ast_mod_assign; } + | ADD_ASSIGN { $$ = ast_add_assign; } + | SUB_ASSIGN { $$ = ast_sub_assign; } + | LEFT_ASSIGN { $$ = ast_ls_assign; } + | RIGHT_ASSIGN { $$ = ast_rs_assign; } + | AND_ASSIGN { $$ = ast_and_assign; } + | XOR_ASSIGN { $$ = ast_xor_assign; } + | OR_ASSIGN { $$ = ast_or_assign; } + ; + +expression: + assignment_expression + { + $$ = $1; + } + | expression ',' assignment_expression + { + void *ctx = state; + if ($1->oper != ast_sequence) { + $$ = new(ctx) ast_expression(ast_sequence, NULL, NULL, NULL); + $$->set_location(yylloc); + $$->expressions.push_tail(& $1->link); + } else { + $$ = $1; + } + + $$->expressions.push_tail(& $3->link); + } + ; + +constant_expression: + conditional_expression + ; + +declaration: + function_prototype ';' + { + $$ = $1; + } + | init_declarator_list ';' + { + $$ = $1; + } + | PRECISION precision_qualifier type_specifier_no_prec ';' + { + if (($3->type_specifier != ast_float) + && ($3->type_specifier != ast_int)) { + _mesa_glsl_error(& @3, state, "global precision qualifier can " + "only be applied to `int' or `float'\n"); + YYERROR; + } + + $$ = NULL; /* FINISHME */ + } + ; + +function_prototype: + function_declarator ')' + ; + +function_declarator: + function_header + | function_header_with_parameters + ; + +function_header_with_parameters: + function_header parameter_declaration + { + $$ = $1; + $$->parameters.push_tail(& $2->link); + } + | function_header_with_parameters ',' parameter_declaration + { + $$ = $1; + $$->parameters.push_tail(& $3->link); + } + ; + +function_header: + fully_specified_type IDENTIFIER '(' + { + void *ctx = state; + $$ = new(ctx) ast_function(); + $$->set_location(yylloc); + $$->return_type = $1; + $$->identifier = $2; + } + ; + +parameter_declarator: + type_specifier IDENTIFIER + { + void *ctx = state; + $$ = new(ctx) ast_parameter_declarator(); + $$->set_location(yylloc); + $$->type = new(ctx) ast_fully_specified_type(); + $$->type->set_location(yylloc); + $$->type->specifier = $1; + $$->identifier = $2; + } + | type_specifier IDENTIFIER '[' constant_expression ']' + { + void *ctx = state; + $$ = new(ctx) ast_parameter_declarator(); + $$->set_location(yylloc); + $$->type = new(ctx) ast_fully_specified_type(); + $$->type->set_location(yylloc); + $$->type->specifier = $1; + $$->identifier = $2; + $$->is_array = true; + $$->array_size = $4; + } + ; + +parameter_declaration: + parameter_type_qualifier parameter_qualifier parameter_declarator + { + $1.i |= $2.i; + + $$ = $3; + $$->type->qualifier = $1.q; + } + | parameter_qualifier parameter_declarator + { + $$ = $2; + $$->type->qualifier = $1.q; + } + | parameter_type_qualifier parameter_qualifier parameter_type_specifier + { + void *ctx = state; + $1.i |= $2.i; + + $$ = new(ctx) ast_parameter_declarator(); + $$->set_location(yylloc); + $$->type = new(ctx) ast_fully_specified_type(); + $$->type->qualifier = $1.q; + $$->type->specifier = $3; + } + | parameter_qualifier parameter_type_specifier + { + void *ctx = state; + $$ = new(ctx) ast_parameter_declarator(); + $$->set_location(yylloc); + $$->type = new(ctx) ast_fully_specified_type(); + $$->type->qualifier = $1.q; + $$->type->specifier = $2; + } + ; + +parameter_qualifier: + /* empty */ { $$.i = 0; } + | IN_TOK { $$.i = 0; $$.q.in = 1; } + | OUT_TOK { $$.i = 0; $$.q.out = 1; } + | INOUT_TOK { $$.i = 0; $$.q.in = 1; $$.q.out = 1; } + ; + +parameter_type_specifier: + type_specifier + ; + +init_declarator_list: + single_declaration + | init_declarator_list ',' IDENTIFIER + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, NULL); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '[' ']' + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, NULL); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '[' constant_expression ']' + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, NULL); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '[' ']' '=' initializer + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($3, true, NULL, $7); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '[' constant_expression ']' '=' initializer + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($3, true, $5, $8); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + | init_declarator_list ',' IDENTIFIER '=' initializer + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($3, false, NULL, $5); + decl->set_location(yylloc); + + $$ = $1; + $$->declarations.push_tail(&decl->link); + } + ; + + // Grammar Note: No 'enum', or 'typedef'. +single_declaration: + fully_specified_type + { + void *ctx = state; + if ($1->specifier->type_specifier != ast_struct) { + _mesa_glsl_error(& @1, state, "empty declaration list\n"); + YYERROR; + } else { + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + } + } + | fully_specified_type IDENTIFIER + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '[' ']' + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, NULL); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '[' constant_expression ']' + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, NULL); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '[' ']' '=' initializer + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($2, true, NULL, $6); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '[' constant_expression ']' '=' initializer + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($2, true, $4, $7); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | fully_specified_type IDENTIFIER '=' initializer + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); + + $$ = new(ctx) ast_declarator_list($1); + $$->set_location(yylloc); + $$->declarations.push_tail(&decl->link); + } + | INVARIANT IDENTIFIER // Vertex only. + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, NULL); + + $$ = new(ctx) ast_declarator_list(NULL); + $$->set_location(yylloc); + $$->invariant = true; + + $$->declarations.push_tail(&decl->link); + } + ; + +fully_specified_type: + type_specifier + { + void *ctx = state; + $$ = new(ctx) ast_fully_specified_type(); + $$->set_location(yylloc); + $$->specifier = $1; + } + | type_qualifier type_specifier + { + void *ctx = state; + $$ = new(ctx) ast_fully_specified_type(); + $$->set_location(yylloc); + $$->qualifier = $1.q; + $$->specifier = $2; + } + ; + +opt_layout_qualifier: + { $$.i = 0; } + | layout_qualifier + ; + +layout_qualifier: + LAYOUT_TOK '(' layout_qualifier_id_list ')' + { + $$ = $3; + } + ; + +layout_qualifier_id_list: + layout_qualifier_id + | layout_qualifier_id_list ',' layout_qualifier_id + { + $$.i = $1.i | $3.i; + } + ; + +layout_qualifier_id: + IDENTIFIER + { + $$.i = 0; + + if (state->ARB_fragment_coord_conventions_enable) { + bool got_one = false; + + if (strcmp($1, "origin_upper_left") == 0) { + got_one = true; + $$.q.origin_upper_left = 1; + } else if (strcmp($1, "pixel_center_integer") == 0) { + got_one = true; + $$.q.pixel_center_integer = 1; + } + + if (state->ARB_fragment_coord_conventions_warn && got_one) { + _mesa_glsl_warning(& @1, state, + "GL_ARB_fragment_coord_conventions layout " + "identifier `%s' used\n", $1); + } + } + + /* If the identifier didn't match any known layout identifiers, + * emit an error. + */ + if ($$.i == 0) { + _mesa_glsl_error(& @1, state, "unrecognized layout identifier " + "`%s'\n", $1); + YYERROR; + } + } + ; + +interpolation_qualifier: + SMOOTH { $$.i = 0; $$.q.smooth = 1; } + | FLAT { $$.i = 0; $$.q.flat = 1; } + | NOPERSPECTIVE { $$.i = 0; $$.q.noperspective = 1; } + ; + +parameter_type_qualifier: + CONST_TOK { $$.i = 0; $$.q.constant = 1; } + ; + +type_qualifier: + storage_qualifier + | interpolation_qualifier type_qualifier + { + $$.i = $1.i | $2.i; + } + | INVARIANT type_qualifier + { + $$ = $2; + $$.q.invariant = 1; + } + ; + +storage_qualifier: + CONST_TOK { $$.i = 0; $$.q.constant = 1; } + | ATTRIBUTE { $$.i = 0; $$.q.attribute = 1; } + | opt_layout_qualifier VARYING { $$.i = $1.i; $$.q.varying = 1; } + | CENTROID VARYING { $$.i = 0; $$.q.centroid = 1; $$.q.varying = 1; } + | opt_layout_qualifier IN_TOK { $$.i = 0; $$.q.in = 1; } + | OUT_TOK { $$.i = 0; $$.q.out = 1; } + | CENTROID IN_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; } + | CENTROID OUT_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; } + | UNIFORM { $$.i = 0; $$.q.uniform = 1; } + ; + +type_specifier: + type_specifier_no_prec + | precision_qualifier type_specifier_no_prec + { + $$ = $2; + $$->precision = $1; + } + ; + +type_specifier_no_prec: + type_specifier_nonarray + | type_specifier_nonarray '[' ']' + { + $$ = $1; + $$->is_array = true; + $$->array_size = NULL; + } + | type_specifier_nonarray '[' constant_expression ']' + { + $$ = $1; + $$->is_array = true; + $$->array_size = $3; + } + ; + +type_specifier_nonarray: + basic_type_specifier_nonarray + { + void *ctx = state; + $$ = new(ctx) ast_type_specifier($1); + $$->set_location(yylloc); + } + | struct_specifier + { + void *ctx = state; + $$ = new(ctx) ast_type_specifier($1); + $$->set_location(yylloc); + } + | IDENTIFIER + { + void *ctx = state; + $$ = new(ctx) ast_type_specifier($1); + $$->set_location(yylloc); + } + ; + +basic_type_specifier_nonarray: + VOID_TOK { $$ = ast_void; } + | FLOAT_TOK { $$ = ast_float; } + | INT_TOK { $$ = ast_int; } + | UINT_TOK { $$ = ast_uint; } + | BOOL_TOK { $$ = ast_bool; } + | VEC2 { $$ = ast_vec2; } + | VEC3 { $$ = ast_vec3; } + | VEC4 { $$ = ast_vec4; } + | BVEC2 { $$ = ast_bvec2; } + | BVEC3 { $$ = ast_bvec3; } + | BVEC4 { $$ = ast_bvec4; } + | IVEC2 { $$ = ast_ivec2; } + | IVEC3 { $$ = ast_ivec3; } + | IVEC4 { $$ = ast_ivec4; } + | UVEC2 { $$ = ast_uvec2; } + | UVEC3 { $$ = ast_uvec3; } + | UVEC4 { $$ = ast_uvec4; } + | MAT2X2 { $$ = ast_mat2; } + | MAT2X3 { $$ = ast_mat2x3; } + | MAT2X4 { $$ = ast_mat2x4; } + | MAT3X2 { $$ = ast_mat3x2; } + | MAT3X3 { $$ = ast_mat3; } + | MAT3X4 { $$ = ast_mat3x4; } + | MAT4X2 { $$ = ast_mat4x2; } + | MAT4X3 { $$ = ast_mat4x3; } + | MAT4X4 { $$ = ast_mat4; } + | SAMPLER1D { $$ = ast_sampler1d; } + | SAMPLER2D { $$ = ast_sampler2d; } + | SAMPLER2DRECT { $$ = ast_sampler2drect; } + | SAMPLER3D { $$ = ast_sampler3d; } + | SAMPLERCUBE { $$ = ast_samplercube; } + | SAMPLER1DSHADOW { $$ = ast_sampler1dshadow; } + | SAMPLER2DSHADOW { $$ = ast_sampler2dshadow; } + | SAMPLER2DRECTSHADOW { $$ = ast_sampler2drectshadow; } + | SAMPLERCUBESHADOW { $$ = ast_samplercubeshadow; } + | SAMPLER1DARRAY { $$ = ast_sampler1darray; } + | SAMPLER2DARRAY { $$ = ast_sampler2darray; } + | SAMPLER1DARRAYSHADOW { $$ = ast_sampler1darrayshadow; } + | SAMPLER2DARRAYSHADOW { $$ = ast_sampler2darrayshadow; } + | ISAMPLER1D { $$ = ast_isampler1d; } + | ISAMPLER2D { $$ = ast_isampler2d; } + | ISAMPLER3D { $$ = ast_isampler3d; } + | ISAMPLERCUBE { $$ = ast_isamplercube; } + | ISAMPLER1DARRAY { $$ = ast_isampler1darray; } + | ISAMPLER2DARRAY { $$ = ast_isampler2darray; } + | USAMPLER1D { $$ = ast_usampler1d; } + | USAMPLER2D { $$ = ast_usampler2d; } + | USAMPLER3D { $$ = ast_usampler3d; } + | USAMPLERCUBE { $$ = ast_usamplercube; } + | USAMPLER1DARRAY { $$ = ast_usampler1darray; } + | USAMPLER2DARRAY { $$ = ast_usampler2darray; } + ; + +precision_qualifier: + HIGHP { + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& @1, state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + $$ = ast_precision_high; + } + | MEDIUMP { + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& @1, state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + $$ = ast_precision_medium; + } + | LOWP { + if (!state->es_shader && state->language_version < 130) + _mesa_glsl_error(& @1, state, + "precision qualifier forbidden " + "in GLSL %d.%d (1.30 or later " + "required)\n", + state->language_version / 100, + state->language_version % 100); + + $$ = ast_precision_low; + } + ; + +struct_specifier: + STRUCT IDENTIFIER '{' struct_declaration_list '}' + { + void *ctx = state; + $$ = new(ctx) ast_struct_specifier($2, $4); + $$->set_location(yylloc); + } + | STRUCT '{' struct_declaration_list '}' + { + void *ctx = state; + $$ = new(ctx) ast_struct_specifier(NULL, $3); + $$->set_location(yylloc); + } + ; + +struct_declaration_list: + struct_declaration + { + $$ = (ast_node *) $1; + $1->link.self_link(); + } + | struct_declaration_list struct_declaration + { + $$ = (ast_node *) $1; + $$->link.insert_before(& $2->link); + } + ; + +struct_declaration: + type_specifier struct_declarator_list ';' + { + void *ctx = state; + ast_fully_specified_type *type = new(ctx) ast_fully_specified_type(); + type->set_location(yylloc); + + type->specifier = $1; + $$ = new(ctx) ast_declarator_list(type); + $$->set_location(yylloc); + + $$->declarations.push_degenerate_list_at_head(& $2->link); + } + ; + +struct_declarator_list: + struct_declarator + { + $$ = $1; + $1->link.self_link(); + } + | struct_declarator_list ',' struct_declarator + { + $$ = $1; + $$->link.insert_before(& $3->link); + } + ; + +struct_declarator: + IDENTIFIER + { + void *ctx = state; + $$ = new(ctx) ast_declaration($1, false, NULL, NULL); + $$->set_location(yylloc); + } + | IDENTIFIER '[' constant_expression ']' + { + void *ctx = state; + $$ = new(ctx) ast_declaration($1, true, $3, NULL); + $$->set_location(yylloc); + } + ; + +initializer: + assignment_expression + ; + +declaration_statement: + declaration + ; + + // Grammar Note: labeled statements for SWITCH only; 'goto' is not + // supported. +statement: + compound_statement { $$ = (ast_node *) $1; } + | simple_statement + ; + +simple_statement: + declaration_statement + | expression_statement + | selection_statement + | switch_statement { $$ = NULL; } + | case_label { $$ = NULL; } + | iteration_statement + | jump_statement + ; + +compound_statement: + '{' '}' + { + void *ctx = state; + $$ = new(ctx) ast_compound_statement(true, NULL); + $$->set_location(yylloc); + } + | '{' statement_list '}' + { + void *ctx = state; + $$ = new(ctx) ast_compound_statement(true, $2); + $$->set_location(yylloc); + } + ; + +statement_no_new_scope: + compound_statement_no_new_scope { $$ = (ast_node *) $1; } + | simple_statement + ; + +compound_statement_no_new_scope: + '{' '}' + { + void *ctx = state; + $$ = new(ctx) ast_compound_statement(false, NULL); + $$->set_location(yylloc); + } + | '{' statement_list '}' + { + void *ctx = state; + $$ = new(ctx) ast_compound_statement(false, $2); + $$->set_location(yylloc); + } + ; + +statement_list: + statement + { + if ($1 == NULL) { + _mesa_glsl_error(& @1, state, "<nil> statement\n"); + assert($1 != NULL); + } + + $$ = $1; + $$->link.self_link(); + } + | statement_list statement + { + if ($2 == NULL) { + _mesa_glsl_error(& @2, state, "<nil> statement\n"); + assert($2 != NULL); + } + $$ = $1; + $$->link.insert_before(& $2->link); + } + ; + +expression_statement: + ';' + { + void *ctx = state; + $$ = new(ctx) ast_expression_statement(NULL); + $$->set_location(yylloc); + } + | expression ';' + { + void *ctx = state; + $$ = new(ctx) ast_expression_statement($1); + $$->set_location(yylloc); + } + ; + +selection_statement: + IF '(' expression ')' selection_rest_statement + { + $$ = new(state) ast_selection_statement($3, $5.then_statement, + $5.else_statement); + $$->set_location(yylloc); + } + ; + +selection_rest_statement: + statement ELSE statement + { + $$.then_statement = $1; + $$.else_statement = $3; + } + | statement + { + $$.then_statement = $1; + $$.else_statement = NULL; + } + ; + +condition: + expression + { + $$ = (ast_node *) $1; + } + | fully_specified_type IDENTIFIER '=' initializer + { + void *ctx = state; + ast_declaration *decl = new(ctx) ast_declaration($2, false, NULL, $4); + ast_declarator_list *declarator = new(ctx) ast_declarator_list($1); + decl->set_location(yylloc); + declarator->set_location(yylloc); + + declarator->declarations.push_tail(&decl->link); + $$ = declarator; + } + ; + +switch_statement: + SWITCH '(' expression ')' compound_statement + ; + +case_label: + CASE expression ':' + | DEFAULT ':' + ; + +iteration_statement: + WHILE '(' condition ')' statement_no_new_scope + { + void *ctx = state; + $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while, + NULL, $3, NULL, $5); + $$->set_location(yylloc); + } + | DO statement WHILE '(' expression ')' ';' + { + void *ctx = state; + $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while, + NULL, $5, NULL, $2); + $$->set_location(yylloc); + } + | FOR '(' for_init_statement for_rest_statement ')' statement_no_new_scope + { + void *ctx = state; + $$ = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for, + $3, $4.cond, $4.rest, $6); + $$->set_location(yylloc); + } + ; + +for_init_statement: + expression_statement + | declaration_statement + ; + +conditionopt: + condition + | /* empty */ + { + $$ = NULL; + } + ; + +for_rest_statement: + conditionopt ';' + { + $$.cond = $1; + $$.rest = NULL; + } + | conditionopt ';' expression + { + $$.cond = $1; + $$.rest = $3; + } + ; + + // Grammar Note: No 'goto'. Gotos are not supported. +jump_statement: + CONTINUE ';' + { + void *ctx = state; + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL); + $$->set_location(yylloc); + } + | BREAK ';' + { + void *ctx = state; + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL); + $$->set_location(yylloc); + } + | RETURN ';' + { + void *ctx = state; + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL); + $$->set_location(yylloc); + } + | RETURN expression ';' + { + void *ctx = state; + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, $2); + $$->set_location(yylloc); + } + | DISCARD ';' // Fragment shader only. + { + void *ctx = state; + $$ = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL); + $$->set_location(yylloc); + } + ; + +external_declaration: + function_definition { $$ = $1; } + | declaration { $$ = $1; } + | pragma_statement { $$ = NULL; } + ; + +function_definition: + function_prototype compound_statement_no_new_scope + { + void *ctx = state; + $$ = new(ctx) ast_function_definition(); + $$->set_location(yylloc); + $$->prototype = $1; + $$->body = $2; + } + ; diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp new file mode 100644 index 000000000..33ea664bc --- /dev/null +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -0,0 +1,762 @@ +/* + * Copyright © 2008, 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <assert.h> + +extern "C" { +#include <talloc.h> +#include "main/core.h" /* for struct __GLcontextRec */ +} + +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_parser.h" +#include "ir_optimization.h" +#include "loop_analysis.h" + +_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx, + GLenum target, void *mem_ctx) +{ + switch (target) { + case GL_VERTEX_SHADER: this->target = vertex_shader; break; + case GL_FRAGMENT_SHADER: this->target = fragment_shader; break; + case GL_GEOMETRY_SHADER: this->target = geometry_shader; break; + } + + this->scanner = NULL; + this->translation_unit.make_empty(); + this->symbols = new(mem_ctx) glsl_symbol_table; + this->info_log = talloc_strdup(mem_ctx, ""); + this->error = false; + this->loop_or_switch_nesting = NULL; + + /* Set default language version and extensions */ + this->language_version = 110; + this->es_shader = false; + this->ARB_texture_rectangle_enable = true; + + /* OpenGL ES 2.0 has different defaults from desktop GL. */ + if (ctx->API == API_OPENGLES2) { + this->language_version = 100; + this->es_shader = true; + this->ARB_texture_rectangle_enable = false; + } + + this->extensions = &ctx->Extensions; + + this->Const.MaxLights = ctx->Const.MaxLights; + this->Const.MaxClipPlanes = ctx->Const.MaxClipPlanes; + this->Const.MaxTextureUnits = ctx->Const.MaxTextureUnits; + this->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits; + this->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs; + this->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents; + this->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4; + this->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits; + this->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits; + this->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits; + this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents; + + this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; +} + +const char * +_mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target) +{ + switch (target) { + case vertex_shader: return "vertex"; + case fragment_shader: return "fragment"; + case geometry_shader: return "geometry"; + case ir_shader: break; + } + + assert(!"Should not get here."); + return "unknown"; +} + + +void +_mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, + const char *fmt, ...) +{ + va_list ap; + + state->error = true; + + assert(state->info_log != NULL); + state->info_log = talloc_asprintf_append(state->info_log, + "%u:%u(%u): error: ", + locp->source, + locp->first_line, + locp->first_column); + va_start(ap, fmt); + state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap); + va_end(ap); + state->info_log = talloc_strdup_append(state->info_log, "\n"); +} + + +void +_mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state, + const char *fmt, ...) +{ + va_list ap; + + assert(state->info_log != NULL); + state->info_log = talloc_asprintf_append(state->info_log, + "%u:%u(%u): warning: ", + locp->source, + locp->first_line, + locp->first_column); + va_start(ap, fmt); + state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap); + va_end(ap); + state->info_log = talloc_strdup_append(state->info_log, "\n"); +} + + +bool +_mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, + const char *behavior, YYLTYPE *behavior_locp, + _mesa_glsl_parse_state *state) +{ + enum { + extension_disable, + extension_enable, + extension_require, + extension_warn + } ext_mode; + + if (strcmp(behavior, "warn") == 0) { + ext_mode = extension_warn; + } else if (strcmp(behavior, "require") == 0) { + ext_mode = extension_require; + } else if (strcmp(behavior, "enable") == 0) { + ext_mode = extension_enable; + } else if (strcmp(behavior, "disable") == 0) { + ext_mode = extension_disable; + } else { + _mesa_glsl_error(behavior_locp, state, + "Unknown extension behavior `%s'", + behavior); + return false; + } + + bool unsupported = false; + + if (strcmp(name, "all") == 0) { + if ((ext_mode == extension_enable) || (ext_mode == extension_require)) { + _mesa_glsl_error(name_locp, state, "Cannot %s all extensions", + (ext_mode == extension_enable) + ? "enable" : "require"); + return false; + } + } else if (strcmp(name, "GL_ARB_draw_buffers") == 0) { + /* This extension is only supported in fragment shaders. + */ + if (state->target != fragment_shader) { + unsupported = true; + } else { + state->ARB_draw_buffers_enable = (ext_mode != extension_disable); + state->ARB_draw_buffers_warn = (ext_mode == extension_warn); + } + } else if (strcmp(name, "GL_ARB_fragment_coord_conventions") == 0) { + state->ARB_fragment_coord_conventions_enable = + (ext_mode != extension_disable); + state->ARB_fragment_coord_conventions_warn = + (ext_mode == extension_warn); + + unsupported = !state->extensions->ARB_fragment_coord_conventions; + } else if (strcmp(name, "GL_ARB_texture_rectangle") == 0) { + state->ARB_texture_rectangle_enable = (ext_mode != extension_disable); + state->ARB_texture_rectangle_warn = (ext_mode == extension_warn); + } else if (strcmp(name, "GL_EXT_texture_array") == 0) { + state->EXT_texture_array_enable = (ext_mode != extension_disable); + state->EXT_texture_array_warn = (ext_mode == extension_warn); + + unsupported = !state->extensions->EXT_texture_array; + } else { + unsupported = true; + } + + if (unsupported) { + static const char *const fmt = "extension `%s' unsupported in %s shader"; + + if (ext_mode == extension_require) { + _mesa_glsl_error(name_locp, state, fmt, + name, _mesa_glsl_shader_target_name(state->target)); + return false; + } else { + _mesa_glsl_warning(name_locp, state, fmt, + name, _mesa_glsl_shader_target_name(state->target)); + } + } + + return true; +} + +void +_mesa_ast_type_qualifier_print(const struct ast_type_qualifier *q) +{ + if (q->constant) + printf("const "); + + if (q->invariant) + printf("invariant "); + + if (q->attribute) + printf("attribute "); + + if (q->varying) + printf("varying "); + + if (q->in && q->out) + printf("inout "); + else { + if (q->in) + printf("in "); + + if (q->out) + printf("out "); + } + + if (q->centroid) + printf("centroid "); + if (q->uniform) + printf("uniform "); + if (q->smooth) + printf("smooth "); + if (q->flat) + printf("flat "); + if (q->noperspective) + printf("noperspective "); +} + + +void +ast_node::print(void) const +{ + printf("unhandled node "); +} + + +ast_node::ast_node(void) +{ + this->location.source = 0; + this->location.line = 0; + this->location.column = 0; +} + + +static void +ast_opt_array_size_print(bool is_array, const ast_expression *array_size) +{ + if (is_array) { + printf("[ "); + + if (array_size) + array_size->print(); + + printf("] "); + } +} + + +void +ast_compound_statement::print(void) const +{ + printf("{\n"); + + foreach_list_const(n, &this->statements) { + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + + printf("}\n"); +} + + +ast_compound_statement::ast_compound_statement(int new_scope, + ast_node *statements) +{ + this->new_scope = new_scope; + + if (statements != NULL) { + this->statements.push_degenerate_list_at_head(&statements->link); + } +} + + +void +ast_expression::print(void) const +{ + switch (oper) { + case ast_assign: + case ast_mul_assign: + case ast_div_assign: + case ast_mod_assign: + case ast_add_assign: + case ast_sub_assign: + case ast_ls_assign: + case ast_rs_assign: + case ast_and_assign: + case ast_xor_assign: + case ast_or_assign: + subexpressions[0]->print(); + printf("%s ", operator_string(oper)); + subexpressions[1]->print(); + break; + + case ast_field_selection: + subexpressions[0]->print(); + printf(". %s ", primary_expression.identifier); + break; + + case ast_plus: + case ast_neg: + case ast_bit_not: + case ast_logic_not: + case ast_pre_inc: + case ast_pre_dec: + printf("%s ", operator_string(oper)); + subexpressions[0]->print(); + break; + + case ast_post_inc: + case ast_post_dec: + subexpressions[0]->print(); + printf("%s ", operator_string(oper)); + break; + + case ast_conditional: + subexpressions[0]->print(); + printf("? "); + subexpressions[1]->print(); + printf(": "); + subexpressions[1]->print(); + break; + + case ast_array_index: + subexpressions[0]->print(); + printf("[ "); + subexpressions[1]->print(); + printf("] "); + break; + + case ast_function_call: { + subexpressions[0]->print(); + printf("( "); + + foreach_list_const (n, &this->expressions) { + if (n != this->expressions.get_head()) + printf(", "); + + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + + printf(") "); + break; + } + + case ast_identifier: + printf("%s ", primary_expression.identifier); + break; + + case ast_int_constant: + printf("%d ", primary_expression.int_constant); + break; + + case ast_uint_constant: + printf("%u ", primary_expression.uint_constant); + break; + + case ast_float_constant: + printf("%f ", primary_expression.float_constant); + break; + + case ast_bool_constant: + printf("%s ", + primary_expression.bool_constant + ? "true" : "false"); + break; + + case ast_sequence: { + printf("( "); + foreach_list_const(n, & this->expressions) { + if (n != this->expressions.get_head()) + printf(", "); + + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + printf(") "); + break; + } + + default: + assert(0); + break; + } +} + +ast_expression::ast_expression(int oper, + ast_expression *ex0, + ast_expression *ex1, + ast_expression *ex2) +{ + this->oper = ast_operators(oper); + this->subexpressions[0] = ex0; + this->subexpressions[1] = ex1; + this->subexpressions[2] = ex2; +} + + +void +ast_expression_statement::print(void) const +{ + if (expression) + expression->print(); + + printf("; "); +} + + +ast_expression_statement::ast_expression_statement(ast_expression *ex) : + expression(ex) +{ + /* empty */ +} + + +void +ast_function::print(void) const +{ + return_type->print(); + printf(" %s (", identifier); + + foreach_list_const(n, & this->parameters) { + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + + printf(")"); +} + + +ast_function::ast_function(void) + : is_definition(false), signature(NULL) +{ + /* empty */ +} + + +void +ast_fully_specified_type::print(void) const +{ + _mesa_ast_type_qualifier_print(& qualifier); + specifier->print(); +} + + +void +ast_parameter_declarator::print(void) const +{ + type->print(); + if (identifier) + printf("%s ", identifier); + ast_opt_array_size_print(is_array, array_size); +} + + +void +ast_function_definition::print(void) const +{ + prototype->print(); + body->print(); +} + + +void +ast_declaration::print(void) const +{ + printf("%s ", identifier); + ast_opt_array_size_print(is_array, array_size); + + if (initializer) { + printf("= "); + initializer->print(); + } +} + + +ast_declaration::ast_declaration(char *identifier, int is_array, + ast_expression *array_size, + ast_expression *initializer) +{ + this->identifier = identifier; + this->is_array = is_array; + this->array_size = array_size; + this->initializer = initializer; +} + + +void +ast_declarator_list::print(void) const +{ + assert(type || invariant); + + if (type) + type->print(); + else + printf("invariant "); + + foreach_list_const (ptr, & this->declarations) { + if (ptr != this->declarations.get_head()) + printf(", "); + + ast_node *ast = exec_node_data(ast_node, ptr, link); + ast->print(); + } + + printf("; "); +} + + +ast_declarator_list::ast_declarator_list(ast_fully_specified_type *type) +{ + this->type = type; + this->invariant = false; +} + +void +ast_jump_statement::print(void) const +{ + switch (mode) { + case ast_continue: + printf("continue; "); + break; + case ast_break: + printf("break; "); + break; + case ast_return: + printf("return "); + if (opt_return_value) + opt_return_value->print(); + + printf("; "); + break; + case ast_discard: + printf("discard; "); + break; + } +} + + +ast_jump_statement::ast_jump_statement(int mode, ast_expression *return_value) +{ + this->mode = ast_jump_modes(mode); + + if (mode == ast_return) + opt_return_value = return_value; +} + + +void +ast_selection_statement::print(void) const +{ + printf("if ( "); + condition->print(); + printf(") "); + + then_statement->print(); + + if (else_statement) { + printf("else "); + else_statement->print(); + } + +} + + +ast_selection_statement::ast_selection_statement(ast_expression *condition, + ast_node *then_statement, + ast_node *else_statement) +{ + this->condition = condition; + this->then_statement = then_statement; + this->else_statement = else_statement; +} + + +void +ast_iteration_statement::print(void) const +{ + switch (mode) { + case ast_for: + printf("for( "); + if (init_statement) + init_statement->print(); + printf("; "); + + if (condition) + condition->print(); + printf("; "); + + if (rest_expression) + rest_expression->print(); + printf(") "); + + body->print(); + break; + + case ast_while: + printf("while ( "); + if (condition) + condition->print(); + printf(") "); + body->print(); + break; + + case ast_do_while: + printf("do "); + body->print(); + printf("while ( "); + if (condition) + condition->print(); + printf("); "); + break; + } +} + + +ast_iteration_statement::ast_iteration_statement(int mode, + ast_node *init, + ast_node *condition, + ast_expression *rest_expression, + ast_node *body) +{ + this->mode = ast_iteration_modes(mode); + this->init_statement = init; + this->condition = condition; + this->rest_expression = rest_expression; + this->body = body; +} + + +void +ast_struct_specifier::print(void) const +{ + printf("struct %s { ", name); + foreach_list_const(n, &this->declarations) { + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + printf("} "); +} + + +ast_struct_specifier::ast_struct_specifier(char *identifier, + ast_node *declarator_list) +{ + if (identifier == NULL) { + static unsigned anon_count = 1; + identifier = talloc_asprintf(this, "#anon_struct_%04x", anon_count); + anon_count++; + } + name = identifier; + this->declarations.push_degenerate_list_at_head(&declarator_list->link); +} + +bool +do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations) +{ + GLboolean progress = GL_FALSE; + + progress = do_sub_to_add_neg(ir) || progress; + + if (linked) { + progress = do_function_inlining(ir) || progress; + progress = do_dead_functions(ir) || progress; + } + progress = do_structure_splitting(ir) || progress; + progress = do_if_simplification(ir) || progress; + progress = do_copy_propagation(ir) || progress; + if (linked) + progress = do_dead_code(ir) || progress; + else + progress = do_dead_code_unlinked(ir) || progress; + progress = do_dead_code_local(ir) || progress; + progress = do_tree_grafting(ir) || progress; + progress = do_constant_propagation(ir) || progress; + if (linked) + progress = do_constant_variable(ir) || progress; + else + progress = do_constant_variable_unlinked(ir) || progress; + progress = do_constant_folding(ir) || progress; + progress = do_algebraic(ir) || progress; + progress = do_lower_jumps(ir) || progress; + progress = do_vec_index_to_swizzle(ir) || progress; + progress = do_swizzle_swizzle(ir) || progress; + progress = do_noop_swizzle(ir) || progress; + + progress = optimize_redundant_jumps(ir) || progress; + + loop_state *ls = analyze_loop_variables(ir); + progress = set_loop_controls(ir, ls) || progress; + progress = unroll_loops(ir, ls, max_unroll_iterations) || progress; + delete ls; + + return progress; +} + +extern "C" { + +/** + * To be called at GL teardown time, this frees compiler datastructures. + * + * After calling this, any previously compiled shaders and shader + * programs would be invalid. So this should happen at approximately + * program exit. + */ +void +_mesa_destroy_shader_compiler(void) +{ + _mesa_destroy_shader_compiler_caches(); + + _mesa_glsl_release_types(); +} + +/** + * Releases compiler caches to trade off performance for memory. + * + * Intended to be used with glReleaseShaderCompiler(). + */ +void +_mesa_destroy_shader_compiler_caches(void) +{ + _mesa_glsl_release_functions(); +} + +} diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h new file mode 100644 index 000000000..f300ece4b --- /dev/null +++ b/mesalib/src/glsl/glsl_parser_extras.h @@ -0,0 +1,240 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef GLSL_PARSER_EXTRAS_H +#define GLSL_PARSER_EXTRAS_H + +/* + * Most of the definitions here only apply to C++ + */ +#ifdef __cplusplus + + +#include <cstdlib> +#include "glsl_symbol_table.h" + +enum _mesa_glsl_parser_targets { + vertex_shader, + geometry_shader, + fragment_shader, + ir_shader +}; + +struct __GLcontextRec; + +struct _mesa_glsl_parse_state { + _mesa_glsl_parse_state(struct __GLcontextRec *ctx, GLenum target, + void *mem_ctx); + + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *mem = talloc_zero_size(ctx, size); + assert(mem != NULL); + + return mem; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *mem, void *ctx) + { + talloc_free(mem); + } + static void operator delete(void *mem) + { + talloc_free(mem); + } + + void *scanner; + exec_list translation_unit; + glsl_symbol_table *symbols; + + bool es_shader; + unsigned language_version; + enum _mesa_glsl_parser_targets target; + + /** + * Implementation defined limits that affect built-in variables, etc. + * + * \sa struct gl_constants (in mtypes.h) + */ + struct { + /* 1.10 */ + unsigned MaxLights; + unsigned MaxClipPlanes; + unsigned MaxTextureUnits; + unsigned MaxTextureCoords; + unsigned MaxVertexAttribs; + unsigned MaxVertexUniformComponents; + unsigned MaxVaryingFloats; + unsigned MaxVertexTextureImageUnits; + unsigned MaxCombinedTextureImageUnits; + unsigned MaxTextureImageUnits; + unsigned MaxFragmentUniformComponents; + + /* ARB_draw_buffers */ + unsigned MaxDrawBuffers; + } Const; + + /** + * During AST to IR conversion, pointer to current IR function + * + * Will be \c NULL whenever the AST to IR conversion is not inside a + * function definition. + */ + class ir_function_signature *current_function; + + /** Have we found a return statement in this function? */ + bool found_return; + + /** Was there an error during compilation? */ + bool error; + + /** Loop or switch statement containing the current instructions. */ + class ir_instruction *loop_or_switch_nesting; + class ast_iteration_statement *loop_or_switch_nesting_ast; + + /** List of structures defined in user code. */ + const glsl_type **user_structures; + unsigned num_user_structures; + + char *info_log; + + /** + * \name Enable bits for GLSL extensions + */ + /*@{*/ + unsigned ARB_draw_buffers_enable:1; + unsigned ARB_draw_buffers_warn:1; + unsigned ARB_fragment_coord_conventions_enable:1; + unsigned ARB_fragment_coord_conventions_warn:1; + unsigned ARB_texture_rectangle_enable:1; + unsigned ARB_texture_rectangle_warn:1; + unsigned EXT_texture_array_enable:1; + unsigned EXT_texture_array_warn:1; + /*@}*/ + + /** Extensions supported by the OpenGL implementation. */ + const struct gl_extensions *extensions; + + /** Shaders containing built-in functions that are used for linking. */ + struct gl_shader *builtins_to_link[16]; + unsigned num_builtins_to_link; +}; + +typedef struct YYLTYPE { + int first_line; + int first_column; + int last_line; + int last_column; + unsigned source; +} YYLTYPE; +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 + +# define YYLLOC_DEFAULT(Current, Rhs, N) \ +do { \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC(Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC(Rhs, 0).last_column; \ + } \ + (Current).source = 0; \ +} while (0) + +extern void _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, + const char *fmt, ...); + +/** + * Emit a warning to the shader log + * + * \sa _mesa_glsl_error + */ +extern void _mesa_glsl_warning(const YYLTYPE *locp, + _mesa_glsl_parse_state *state, + const char *fmt, ...); + +extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, + const char *string); + +extern void _mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state); + +union YYSTYPE; +extern int _mesa_glsl_lex(union YYSTYPE *yylval, YYLTYPE *yylloc, + void *scanner); + +extern int _mesa_glsl_parse(struct _mesa_glsl_parse_state *); + +/** + * Process elements of the #extension directive + * + * \return + * If \c name and \c behavior are valid, \c true is returned. Otherwise + * \c false is returned. + */ +extern bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, + const char *behavior, + YYLTYPE *behavior_locp, + _mesa_glsl_parse_state *state); + +/** + * Get the textual name of the specified shader target + */ +extern const char * +_mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target); + + +#endif /* __cplusplus */ + + +/* + * These definitions apply to C and C++ + */ +#ifdef __cplusplus +extern "C" { +#endif + +extern int preprocess(void *ctx, const char **shader, char **info_log, + const struct gl_extensions *extensions, int api); + +extern void _mesa_destroy_shader_compiler(); +extern void _mesa_destroy_shader_compiler_caches(); + +#ifdef __cplusplus +} +#endif + + +#endif /* GLSL_PARSER_EXTRAS_H */ diff --git a/mesalib/src/glsl/glsl_symbol_table.cpp b/mesalib/src/glsl/glsl_symbol_table.cpp new file mode 100644 index 000000000..9537d86c9 --- /dev/null +++ b/mesalib/src/glsl/glsl_symbol_table.cpp @@ -0,0 +1,165 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glsl_symbol_table.h" + +class symbol_table_entry { +public: + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *entry = talloc_size(ctx, size); + assert(entry != NULL); + return entry; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. Here, C++ will have already called the + * destructor so tell talloc not to do that again. */ + static void operator delete(void *table, void *ctx) + { + talloc_set_destructor(table, NULL); + talloc_free(table); + } + static void operator delete(void *table) + { + talloc_set_destructor(table, NULL); + talloc_free(table); + } + + symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} + symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {} + symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {} + + ir_variable *v; + ir_function *f; + const glsl_type *t; +}; + +glsl_symbol_table::glsl_symbol_table() +{ + this->language_version = 120; + this->table = _mesa_symbol_table_ctor(); + this->mem_ctx = talloc_init("symbol table entries"); +} + +glsl_symbol_table::~glsl_symbol_table() +{ + _mesa_symbol_table_dtor(table); + talloc_free(mem_ctx); +} + +void glsl_symbol_table::push_scope() +{ + _mesa_symbol_table_push_scope(table); +} + +void glsl_symbol_table::pop_scope() +{ + _mesa_symbol_table_pop_scope(table); +} + +bool glsl_symbol_table::name_declared_this_scope(const char *name) +{ + return _mesa_symbol_table_symbol_scope(table, -1, name) == 0; +} + +bool glsl_symbol_table::add_variable(const char *name, ir_variable *v) +{ + if (this->language_version == 110) { + /* In 1.10, functions and variables have separate namespaces. */ + symbol_table_entry *existing = get_entry(name); + if (name_declared_this_scope(name)) { + /* If there's already an existing function (not a constructor!) in + * the current scope, just update the existing entry to include 'v'. + */ + if (existing->v == NULL && existing->t == NULL) { + existing->v = v; + return true; + } + } else { + /* If not declared at this scope, add a new entry. But if an existing + * entry includes a function, propagate that to this block - otherwise + * the new variable declaration would shadow the function. + */ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); + if (existing != NULL) + entry->f = existing->f; + int added = _mesa_symbol_table_add_symbol(table, -1, name, entry); + assert(added == 0); + (void)added; + return true; + } + return false; + } + + /* 1.20+ rules: */ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v); + return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; +} + +bool glsl_symbol_table::add_type(const char *name, const glsl_type *t) +{ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t); + return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; +} + +bool glsl_symbol_table::add_function(const char *name, ir_function *f) +{ + if (this->language_version == 110 && name_declared_this_scope(name)) { + /* In 1.10, functions and variables have separate namespaces. */ + symbol_table_entry *existing = get_entry(name); + if ((existing->f == NULL) && (existing->t == NULL)) { + existing->f = f; + return true; + } + } + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f); + return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0; +} + +ir_variable *glsl_symbol_table::get_variable(const char *name) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->v : NULL; +} + +const glsl_type *glsl_symbol_table::get_type(const char *name) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->t : NULL; +} + +ir_function *glsl_symbol_table::get_function(const char *name) +{ + symbol_table_entry *entry = get_entry(name); + return entry != NULL ? entry->f : NULL; +} + +symbol_table_entry *glsl_symbol_table::get_entry(const char *name) +{ + return (symbol_table_entry *) + _mesa_symbol_table_find_symbol(table, -1, name); +} diff --git a/mesalib/src/glsl/glsl_symbol_table.h b/mesalib/src/glsl/glsl_symbol_table.h new file mode 100644 index 000000000..02c45b2e0 --- /dev/null +++ b/mesalib/src/glsl/glsl_symbol_table.h @@ -0,0 +1,126 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef GLSL_SYMBOL_TABLE +#define GLSL_SYMBOL_TABLE + +#include <new> + +extern "C" { +#include "program/symbol_table.h" +} +#include "ir.h" +#include "glsl_types.h" + +class symbol_table_entry; + +/** + * Facade class for _mesa_symbol_table + * + * Wraps the existing \c _mesa_symbol_table data structure to enforce some + * type safe and some symbol table invariants. + */ +struct glsl_symbol_table { +private: + static int + _glsl_symbol_table_destructor (glsl_symbol_table *table) + { + table->~glsl_symbol_table(); + + return 0; + } + +public: + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *table; + + table = talloc_size(ctx, size); + assert(table != NULL); + + talloc_set_destructor(table, (int (*)(void*)) _glsl_symbol_table_destructor); + + return table; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. Here, C++ will have already called the + * destructor so tell talloc not to do that again. */ + static void operator delete(void *table, void *ctx) + { + talloc_set_destructor(table, NULL); + talloc_free(table); + } + static void operator delete(void *table) + { + talloc_set_destructor(table, NULL); + talloc_free(table); + } + + glsl_symbol_table(); + ~glsl_symbol_table(); + + unsigned int language_version; + + void push_scope(); + void pop_scope(); + + /** + * Determine whether a name was declared at the current scope + */ + bool name_declared_this_scope(const char *name); + + /** + * \name Methods to add symbols to the table + * + * There is some temptation to rename all these functions to \c add_symbol + * or similar. However, this breaks symmetry with the getter functions and + * reduces the clarity of the intention of code that uses these methods. + */ + /*@{*/ + bool add_variable(const char *name, ir_variable *v); + bool add_type(const char *name, const glsl_type *t); + bool add_function(const char *name, ir_function *f); + /*@}*/ + + /** + * \name Methods to get symbols from the table + */ + /*@{*/ + ir_variable *get_variable(const char *name); + const glsl_type *get_type(const char *name); + ir_function *get_function(const char *name); + /*@}*/ + +private: + symbol_table_entry *get_entry(const char *name); + + struct _mesa_symbol_table *table; + void *mem_ctx; +}; + +#endif /* GLSL_SYMBOL_TABLE */ diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp new file mode 100644 index 000000000..82eb47060 --- /dev/null +++ b/mesalib/src/glsl/glsl_types.cpp @@ -0,0 +1,497 @@ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <cstdio> +#include <stdlib.h> +#include "main/core.h" /* for Elements */ +#include "glsl_symbol_table.h" +#include "glsl_parser_extras.h" +#include "glsl_types.h" +#include "builtin_types.h" +extern "C" { +#include "program/hash_table.h" +} + +hash_table *glsl_type::array_types = NULL; +hash_table *glsl_type::record_types = NULL; +void *glsl_type::mem_ctx = NULL; + +void +glsl_type::init_talloc_type_ctx(void) +{ + if (glsl_type::mem_ctx == NULL) { + glsl_type::mem_ctx = talloc_autofree_context(); + assert(glsl_type::mem_ctx != NULL); + } +} + +glsl_type::glsl_type(GLenum gl_type, + unsigned base_type, unsigned vector_elements, + unsigned matrix_columns, const char *name) : + gl_type(gl_type), + base_type(base_type), + sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), + sampler_type(0), + vector_elements(vector_elements), matrix_columns(matrix_columns), + length(0) +{ + init_talloc_type_ctx(); + this->name = talloc_strdup(this->mem_ctx, name); + /* Neither dimension is zero or both dimensions are zero. + */ + assert((vector_elements == 0) == (matrix_columns == 0)); + memset(& fields, 0, sizeof(fields)); +} + +glsl_type::glsl_type(GLenum gl_type, + enum glsl_sampler_dim dim, bool shadow, bool array, + unsigned type, const char *name) : + gl_type(gl_type), + base_type(GLSL_TYPE_SAMPLER), + sampler_dimensionality(dim), sampler_shadow(shadow), + sampler_array(array), sampler_type(type), + vector_elements(0), matrix_columns(0), + length(0) +{ + init_talloc_type_ctx(); + this->name = talloc_strdup(this->mem_ctx, name); + memset(& fields, 0, sizeof(fields)); +} + +glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, + const char *name) : + base_type(GLSL_TYPE_STRUCT), + sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), + sampler_type(0), + vector_elements(0), matrix_columns(0), + length(num_fields) +{ + unsigned int i; + + init_talloc_type_ctx(); + this->name = talloc_strdup(this->mem_ctx, name); + this->fields.structure = talloc_array(this->mem_ctx, + glsl_struct_field, length); + for (i = 0; i < length; i++) { + this->fields.structure[i].type = fields[i].type; + this->fields.structure[i].name = talloc_strdup(this->fields.structure, + fields[i].name); + } +} + +static void +add_types_to_symbol_table(glsl_symbol_table *symtab, + const struct glsl_type *types, + unsigned num_types, bool warn) +{ + (void) warn; + + for (unsigned i = 0; i < num_types; i++) { + symtab->add_type(types[i].name, & types[i]); + } +} + +void +glsl_type::generate_100ES_types(glsl_symbol_table *symtab) +{ + add_types_to_symbol_table(symtab, builtin_core_types, + Elements(builtin_core_types), + false); + add_types_to_symbol_table(symtab, builtin_structure_types, + Elements(builtin_structure_types), + false); + add_types_to_symbol_table(symtab, &void_type, 1, false); +} + +void +glsl_type::generate_110_types(glsl_symbol_table *symtab) +{ + generate_100ES_types(symtab); + + add_types_to_symbol_table(symtab, builtin_110_types, + Elements(builtin_110_types), + false); + add_types_to_symbol_table(symtab, builtin_110_deprecated_structure_types, + Elements(builtin_110_deprecated_structure_types), + false); +} + + +void +glsl_type::generate_120_types(glsl_symbol_table *symtab) +{ + generate_110_types(symtab); + + add_types_to_symbol_table(symtab, builtin_120_types, + Elements(builtin_120_types), false); +} + + +void +glsl_type::generate_130_types(glsl_symbol_table *symtab) +{ + generate_120_types(symtab); + + add_types_to_symbol_table(symtab, builtin_130_types, + Elements(builtin_130_types), false); + generate_EXT_texture_array_types(symtab, false); +} + + +void +glsl_type::generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab, + bool warn) +{ + add_types_to_symbol_table(symtab, builtin_ARB_texture_rectangle_types, + Elements(builtin_ARB_texture_rectangle_types), + warn); +} + + +void +glsl_type::generate_EXT_texture_array_types(glsl_symbol_table *symtab, + bool warn) +{ + add_types_to_symbol_table(symtab, builtin_EXT_texture_array_types, + Elements(builtin_EXT_texture_array_types), + warn); +} + + +void +_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) +{ + switch (state->language_version) { + case 100: + assert(state->es_shader); + glsl_type::generate_100ES_types(state->symbols); + break; + case 110: + glsl_type::generate_110_types(state->symbols); + break; + case 120: + glsl_type::generate_120_types(state->symbols); + break; + case 130: + glsl_type::generate_130_types(state->symbols); + break; + default: + /* error */ + break; + } + + if (state->ARB_texture_rectangle_enable) { + glsl_type::generate_ARB_texture_rectangle_types(state->symbols, + state->ARB_texture_rectangle_warn); + } + + if (state->EXT_texture_array_enable && state->language_version < 130) { + // These are already included in 130; don't create twice. + glsl_type::generate_EXT_texture_array_types(state->symbols, + state->EXT_texture_array_warn); + } +} + + +const glsl_type *glsl_type::get_base_type() const +{ + switch (base_type) { + case GLSL_TYPE_UINT: + return uint_type; + case GLSL_TYPE_INT: + return int_type; + case GLSL_TYPE_FLOAT: + return float_type; + case GLSL_TYPE_BOOL: + return bool_type; + default: + return error_type; + } +} + + +void +_mesa_glsl_release_types(void) +{ + if (glsl_type::array_types != NULL) { + hash_table_dtor(glsl_type::array_types); + glsl_type::array_types = NULL; + } + + if (glsl_type::record_types != NULL) { + hash_table_dtor(glsl_type::record_types); + glsl_type::record_types = NULL; + } +} + + +glsl_type::glsl_type(const glsl_type *array, unsigned length) : + base_type(GLSL_TYPE_ARRAY), + sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), + sampler_type(0), + vector_elements(0), matrix_columns(0), + name(NULL), length(length) +{ + this->fields.array = array; + /* Inherit the gl type of the base. The GL type is used for + * uniform/statevar handling in Mesa and the arrayness of the type + * is represented by the size rather than the type. + */ + this->gl_type = array->gl_type; + + /* Allow a maximum of 10 characters for the array size. This is enough + * for 32-bits of ~0. The extra 3 are for the '[', ']', and terminating + * NUL. + */ + const unsigned name_length = strlen(array->name) + 10 + 3; + char *const n = (char *) talloc_size(this->mem_ctx, name_length); + + if (length == 0) + snprintf(n, name_length, "%s[]", array->name); + else + snprintf(n, name_length, "%s[%u]", array->name, length); + + this->name = n; +} + + +const glsl_type * +glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns) +{ + if (base_type == GLSL_TYPE_VOID) + return &void_type; + + if ((rows < 1) || (rows > 4) || (columns < 1) || (columns > 4)) + return error_type; + + /* Treat GLSL vectors as Nx1 matrices. + */ + if (columns == 1) { + switch (base_type) { + case GLSL_TYPE_UINT: + return uint_type + (rows - 1); + case GLSL_TYPE_INT: + return int_type + (rows - 1); + case GLSL_TYPE_FLOAT: + return float_type + (rows - 1); + case GLSL_TYPE_BOOL: + return bool_type + (rows - 1); + default: + return error_type; + } + } else { + if ((base_type != GLSL_TYPE_FLOAT) || (rows == 1)) + return error_type; + + /* GLSL matrix types are named mat{COLUMNS}x{ROWS}. Only the following + * combinations are valid: + * + * 1 2 3 4 + * 1 + * 2 x x x + * 3 x x x + * 4 x x x + */ +#define IDX(c,r) (((c-1)*3) + (r-1)) + + switch (IDX(columns, rows)) { + case IDX(2,2): return mat2_type; + case IDX(2,3): return mat2x3_type; + case IDX(2,4): return mat2x4_type; + case IDX(3,2): return mat3x2_type; + case IDX(3,3): return mat3_type; + case IDX(3,4): return mat3x4_type; + case IDX(4,2): return mat4x2_type; + case IDX(4,3): return mat4x3_type; + case IDX(4,4): return mat4_type; + default: return error_type; + } + } + + assert(!"Should not get here."); + return error_type; +} + + +const glsl_type * +glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) +{ + + if (array_types == NULL) { + array_types = hash_table_ctor(64, hash_table_string_hash, + hash_table_string_compare); + } + + /* Generate a name using the base type pointer in the key. This is + * done because the name of the base type may not be unique across + * shaders. For example, two shaders may have different record types + * named 'foo'. + */ + char key[128]; + snprintf(key, sizeof(key), "%p[%u]", (void *) base, array_size); + + const glsl_type *t = (glsl_type *) hash_table_find(array_types, key); + if (t == NULL) { + t = new glsl_type(base, array_size); + + hash_table_insert(array_types, (void *) t, talloc_strdup(mem_ctx, key)); + } + + assert(t->base_type == GLSL_TYPE_ARRAY); + assert(t->length == array_size); + assert(t->fields.array == base); + + return t; +} + + +int +glsl_type::record_key_compare(const void *a, const void *b) +{ + const glsl_type *const key1 = (glsl_type *) a; + const glsl_type *const key2 = (glsl_type *) b; + + /* Return zero is the types match (there is zero difference) or non-zero + * otherwise. + */ + if (strcmp(key1->name, key2->name) != 0) + return 1; + + if (key1->length != key2->length) + return 1; + + for (unsigned i = 0; i < key1->length; i++) { + if (key1->fields.structure[i].type != key2->fields.structure[i].type) + return 1; + if (strcmp(key1->fields.structure[i].name, + key2->fields.structure[i].name) != 0) + return 1; + } + + return 0; +} + + +unsigned +glsl_type::record_key_hash(const void *a) +{ + const glsl_type *const key = (glsl_type *) a; + char hash_key[128]; + unsigned size = 0; + + size = snprintf(hash_key, sizeof(hash_key), "%08x", key->length); + + for (unsigned i = 0; i < key->length; i++) { + if (size >= sizeof(hash_key)) + break; + + size += snprintf(& hash_key[size], sizeof(hash_key) - size, + "%p", (void *) key->fields.structure[i].type); + } + + return hash_table_string_hash(& hash_key); +} + + +const glsl_type * +glsl_type::get_record_instance(const glsl_struct_field *fields, + unsigned num_fields, + const char *name) +{ + const glsl_type key(fields, num_fields, name); + + if (record_types == NULL) { + record_types = hash_table_ctor(64, record_key_hash, record_key_compare); + } + + const glsl_type *t = (glsl_type *) hash_table_find(record_types, & key); + if (t == NULL) { + t = new glsl_type(fields, num_fields, name); + + hash_table_insert(record_types, (void *) t, t); + } + + assert(t->base_type == GLSL_TYPE_STRUCT); + assert(t->length == num_fields); + assert(strcmp(t->name, name) == 0); + + return t; +} + + +const glsl_type * +glsl_type::field_type(const char *name) const +{ + if (this->base_type != GLSL_TYPE_STRUCT) + return error_type; + + for (unsigned i = 0; i < this->length; i++) { + if (strcmp(name, this->fields.structure[i].name) == 0) + return this->fields.structure[i].type; + } + + return error_type; +} + + +int +glsl_type::field_index(const char *name) const +{ + if (this->base_type != GLSL_TYPE_STRUCT) + return -1; + + for (unsigned i = 0; i < this->length; i++) { + if (strcmp(name, this->fields.structure[i].name) == 0) + return i; + } + + return -1; +} + + +unsigned +glsl_type::component_slots() const +{ + switch (this->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + return this->components(); + + case GLSL_TYPE_STRUCT: { + unsigned size = 0; + + for (unsigned i = 0; i < this->length; i++) + size += this->fields.structure[i].type->component_slots(); + + return size; + } + + case GLSL_TYPE_ARRAY: + return this->length * this->fields.array->component_slots(); + + default: + return 0; + } +} diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h new file mode 100644 index 000000000..4f7d2f74a --- /dev/null +++ b/mesalib/src/glsl/glsl_types.h @@ -0,0 +1,476 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef GLSL_TYPES_H +#define GLSL_TYPES_H + +#include <cstring> +#include <cassert> + +extern "C" { +#include "GL/gl.h" +#include <talloc.h> +} + +struct _mesa_glsl_parse_state; +struct glsl_symbol_table; + +extern "C" void +_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state); + +extern "C" void +_mesa_glsl_release_types(void); + +#define GLSL_TYPE_UINT 0 +#define GLSL_TYPE_INT 1 +#define GLSL_TYPE_FLOAT 2 +#define GLSL_TYPE_BOOL 3 +#define GLSL_TYPE_SAMPLER 4 +#define GLSL_TYPE_STRUCT 5 +#define GLSL_TYPE_ARRAY 6 +#define GLSL_TYPE_FUNCTION 7 +#define GLSL_TYPE_VOID 8 +#define GLSL_TYPE_ERROR 9 + +enum glsl_sampler_dim { + GLSL_SAMPLER_DIM_1D = 0, + GLSL_SAMPLER_DIM_2D, + GLSL_SAMPLER_DIM_3D, + GLSL_SAMPLER_DIM_CUBE, + GLSL_SAMPLER_DIM_RECT, + GLSL_SAMPLER_DIM_BUF +}; + + +struct glsl_type { + GLenum gl_type; + unsigned base_type:4; + + unsigned sampler_dimensionality:3; + unsigned sampler_shadow:1; + unsigned sampler_array:1; + unsigned sampler_type:2; /**< Type of data returned using this sampler. + * only \c GLSL_TYPE_FLOAT, \c GLSL_TYPE_INT, + * and \c GLSL_TYPE_UINT are valid. + */ + + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'mem_ctx' (or any of its ancestors). */ + static void* operator new(size_t size) + { + if (glsl_type::mem_ctx == NULL) { + glsl_type::mem_ctx = talloc_init("glsl_type"); + assert(glsl_type::mem_ctx != NULL); + } + + void *type; + + type = talloc_size(glsl_type::mem_ctx, size); + assert(type != NULL); + + return type; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *type) + { + talloc_free(type); + } + + /** + * \name Vector and matrix element counts + * + * For scalars, each of these values will be 1. For non-numeric types + * these will be 0. + */ + /*@{*/ + unsigned vector_elements:3; /**< 1, 2, 3, or 4 vector elements. */ + unsigned matrix_columns:3; /**< 1, 2, 3, or 4 matrix columns. */ + /*@}*/ + + /** + * Name of the data type + * + * This may be \c NULL for anonymous structures, for arrays, or for + * function types. + */ + const char *name; + + /** + * For \c GLSL_TYPE_ARRAY, this is the length of the array. For + * \c GLSL_TYPE_STRUCT, it is the number of elements in the structure and + * the number of values pointed to by \c fields.structure (below). + * + * For \c GLSL_TYPE_FUNCTION, it is the number of parameters to the + * function. The return value from a function is implicitly the first + * parameter. The types of the parameters are stored in + * \c fields.parameters (below). + */ + unsigned length; + + /** + * Subtype of composite data types. + */ + union { + const struct glsl_type *array; /**< Type of array elements. */ + const struct glsl_type *parameters; /**< Parameters to function. */ + struct glsl_struct_field *structure; /**< List of struct fields. */ + } fields; + + + /** + * \name Pointers to various public type singletons + */ + /*@{*/ + static const glsl_type *const error_type; + static const glsl_type *const int_type; + static const glsl_type *const ivec4_type; + static const glsl_type *const uint_type; + static const glsl_type *const uvec4_type; + static const glsl_type *const float_type; + static const glsl_type *const vec2_type; + static const glsl_type *const vec3_type; + static const glsl_type *const vec4_type; + static const glsl_type *const bool_type; + static const glsl_type *const mat2_type; + static const glsl_type *const mat2x3_type; + static const glsl_type *const mat2x4_type; + static const glsl_type *const mat3x2_type; + static const glsl_type *const mat3_type; + static const glsl_type *const mat3x4_type; + static const glsl_type *const mat4x2_type; + static const glsl_type *const mat4x3_type; + static const glsl_type *const mat4_type; + /*@}*/ + + + /** + * For numeric and boolean derrived types returns the basic scalar type + * + * If the type is a numeric or boolean scalar, vector, or matrix type, + * this function gets the scalar type of the individual components. For + * all other types, including arrays of numeric or boolean types, the + * error type is returned. + */ + const glsl_type *get_base_type() const; + + /** + * Query the type of elements in an array + * + * \return + * Pointer to the type of elements in the array for array types, or \c NULL + * for non-array types. + */ + const glsl_type *element_type() const + { + return is_array() ? fields.array : NULL; + } + + /** + * Get the instance of a built-in scalar, vector, or matrix type + */ + static const glsl_type *get_instance(unsigned base_type, unsigned rows, + unsigned columns); + + /** + * Get the instance of an array type + */ + static const glsl_type *get_array_instance(const glsl_type *base, + unsigned elements); + + /** + * Get the instance of a record type + */ + static const glsl_type *get_record_instance(const glsl_struct_field *fields, + unsigned num_fields, + const char *name); + + /** + * Query the total number of scalars that make up a scalar, vector or matrix + */ + unsigned components() const + { + return vector_elements * matrix_columns; + } + + /** + * Calculate the number of components slots required to hold this type + * + * This is used to determine how many uniform or varying locations a type + * might occupy. + */ + unsigned component_slots() const; + + + /** + * Query whether or not a type is a scalar (non-vector and non-matrix). + */ + bool is_scalar() const + { + return (vector_elements == 1) + && (base_type >= GLSL_TYPE_UINT) + && (base_type <= GLSL_TYPE_BOOL); + } + + /** + * Query whether or not a type is a vector + */ + bool is_vector() const + { + return (vector_elements > 1) + && (matrix_columns == 1) + && (base_type >= GLSL_TYPE_UINT) + && (base_type <= GLSL_TYPE_BOOL); + } + + /** + * Query whether or not a type is a matrix + */ + bool is_matrix() const + { + /* GLSL only has float matrices. */ + return (matrix_columns > 1) && (base_type == GLSL_TYPE_FLOAT); + } + + /** + * Query whether or not a type is a non-array numeric type + */ + bool is_numeric() const + { + return (base_type >= GLSL_TYPE_UINT) && (base_type <= GLSL_TYPE_FLOAT); + } + + /** + * Query whether or not a type is an integral type + */ + bool is_integer() const + { + return (base_type == GLSL_TYPE_UINT) || (base_type == GLSL_TYPE_INT); + } + + /** + * Query whether or not a type is a float type + */ + bool is_float() const + { + return base_type == GLSL_TYPE_FLOAT; + } + + /** + * Query whether or not a type is a non-array boolean type + */ + bool is_boolean() const + { + return base_type == GLSL_TYPE_BOOL; + } + + /** + * Query whether or not a type is a sampler + */ + bool is_sampler() const + { + return base_type == GLSL_TYPE_SAMPLER; + } + + /** + * Query whether or not a type is an array + */ + bool is_array() const + { + return base_type == GLSL_TYPE_ARRAY; + } + + /** + * Query whether or not a type is a record + */ + bool is_record() const + { + return base_type == GLSL_TYPE_STRUCT; + } + + /** + * Query whether or not a type is the void type singleton. + */ + bool is_void() const + { + return base_type == GLSL_TYPE_VOID; + } + + /** + * Query whether or not a type is the error type singleton. + */ + bool is_error() const + { + return base_type == GLSL_TYPE_ERROR; + } + + /** + * Query the full type of a matrix row + * + * \return + * If the type is not a matrix, \c glsl_type::error_type is returned. + * Otherwise a type matching the rows of the matrix is returned. + */ + const glsl_type *row_type() const + { + return is_matrix() + ? get_instance(base_type, matrix_columns, 1) + : error_type; + } + + /** + * Query the full type of a matrix column + * + * \return + * If the type is not a matrix, \c glsl_type::error_type is returned. + * Otherwise a type matching the columns of the matrix is returned. + */ + const glsl_type *column_type() const + { + return is_matrix() + ? get_instance(base_type, vector_elements, 1) + : error_type; + } + + + /** + * Get the type of a structure field + * + * \return + * Pointer to the type of the named field. If the type is not a structure + * or the named field does not exist, \c glsl_type::error_type is returned. + */ + const glsl_type *field_type(const char *name) const; + + + /** + * Get the location of a filed within a record type + */ + int field_index(const char *name) const; + + + /** + * Query the number of elements in an array type + * + * \return + * The number of elements in the array for array types or -1 for non-array + * types. If the number of elements in the array has not yet been declared, + * zero is returned. + */ + int array_size() const + { + return is_array() ? length : -1; + } + +private: + /** + * talloc context for all glsl_type allocations + * + * Set on the first call to \c glsl_type::new. + */ + static void *mem_ctx; + + void init_talloc_type_ctx(void); + + /** Constructor for vector and matrix types */ + glsl_type(GLenum gl_type, + unsigned base_type, unsigned vector_elements, + unsigned matrix_columns, const char *name); + + /** Constructor for sampler types */ + glsl_type(GLenum gl_type, + enum glsl_sampler_dim dim, bool shadow, bool array, + unsigned type, const char *name); + + /** Constructor for record types */ + glsl_type(const glsl_struct_field *fields, unsigned num_fields, + const char *name); + + /** Constructor for array types */ + glsl_type(const glsl_type *array, unsigned length); + + /** Hash table containing the known array types. */ + static struct hash_table *array_types; + + /** Hash table containing the known record types. */ + static struct hash_table *record_types; + + static int record_key_compare(const void *a, const void *b); + static unsigned record_key_hash(const void *key); + + /** + * \name Pointers to various type singletons + */ + /*@{*/ + static const glsl_type _error_type; + static const glsl_type void_type; + static const glsl_type builtin_core_types[]; + static const glsl_type builtin_structure_types[]; + static const glsl_type builtin_110_deprecated_structure_types[]; + static const glsl_type builtin_110_types[]; + static const glsl_type builtin_120_types[]; + static const glsl_type builtin_130_types[]; + static const glsl_type builtin_ARB_texture_rectangle_types[]; + static const glsl_type builtin_EXT_texture_array_types[]; + static const glsl_type builtin_EXT_texture_buffer_object_types[]; + /*@}*/ + + /** + * \name Methods to populate a symbol table with built-in types. + * + * \internal + * This is one of the truely annoying things about C++. Methods that are + * completely internal and private to a type still have to be advertised to + * the world in a public header file. + */ + /*@{*/ + static void generate_100ES_types(glsl_symbol_table *); + static void generate_110_types(glsl_symbol_table *); + static void generate_120_types(glsl_symbol_table *); + static void generate_130_types(glsl_symbol_table *); + static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool); + static void generate_EXT_texture_array_types(glsl_symbol_table *, bool); + /*@}*/ + + /** + * \name Friend functions. + * + * These functions are friends because they must have C linkage and the + * need to call various private methods or access various private static + * data. + */ + /*@{*/ + friend void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *); + friend void _mesa_glsl_release_types(void); + /*@}*/ +}; + +struct glsl_struct_field { + const struct glsl_type *type; + const char *name; +}; + +#endif /* GLSL_TYPES_H */ diff --git a/mesalib/src/glsl/hir_field_selection.cpp b/mesalib/src/glsl/hir_field_selection.cpp new file mode 100644 index 000000000..3c33127b5 --- /dev/null +++ b/mesalib/src/glsl/hir_field_selection.cpp @@ -0,0 +1,102 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "ir.h" +#include "program/symbol_table.h" +#include "glsl_parser_extras.h" +#include "ast.h" +#include "glsl_types.h" + +ir_rvalue * +_mesa_ast_field_selection_to_hir(const ast_expression *expr, + exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + void *ctx = state; + ir_rvalue *result = NULL; + ir_rvalue *op; + + op = expr->subexpressions[0]->hir(instructions, state); + + /* There are two kinds of field selection. There is the selection of a + * specific field from a structure, and there is the selection of a + * swizzle / mask from a vector. Which is which is determined entirely + * by the base type of the thing to which the field selection operator is + * being applied. + */ + YYLTYPE loc = expr->get_location(); + if (op->type->is_error()) { + /* silently propagate the error */ + } else if (op->type->is_vector()) { + ir_swizzle *swiz = ir_swizzle::create(op, + expr->primary_expression.identifier, + op->type->vector_elements); + if (swiz != NULL) { + result = swiz; + } else { + /* FINISHME: Logging of error messages should be moved into + * FINISHME: ir_swizzle::create. This allows the generation of more + * FINISHME: specific error messages. + */ + _mesa_glsl_error(& loc, state, "Invalid swizzle / mask `%s'", + expr->primary_expression.identifier); + } + } else if (op->type->base_type == GLSL_TYPE_STRUCT) { + result = new(ctx) ir_dereference_record(op, + expr->primary_expression.identifier); + + if (result->type->is_error()) { + _mesa_glsl_error(& loc, state, "Cannot access field `%s' of " + "structure", + expr->primary_expression.identifier); + } + } else if (expr->subexpressions[1] != NULL) { + /* Handle "method calls" in GLSL 1.20 - namely, array.length() */ + if (state->language_version < 120) + _mesa_glsl_error(&loc, state, "Methods not supported in GLSL 1.10."); + + ast_expression *call = expr->subexpressions[1]; + assert(call->oper == ast_function_call); + + const char *method; + method = call->subexpressions[0]->primary_expression.identifier; + + if (op->type->is_array() && strcmp(method, "length") == 0) { + if (!call->expressions.is_empty()) + _mesa_glsl_error(&loc, state, "length method takes no arguments."); + + if (op->type->array_size() == 0) + _mesa_glsl_error(&loc, state, "length called on unsized array."); + + result = new(ctx) ir_constant(op->type->array_size()); + } else { + _mesa_glsl_error(&loc, state, "Unknown method: `%s'.", method); + } + } else { + _mesa_glsl_error(& loc, state, "Cannot access field `%s' of " + "non-structure / non-vector.", + expr->primary_expression.identifier); + } + + return result ? result : ir_call::get_error_instruction(ctx); +} diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp new file mode 100644 index 000000000..5e2109ecc --- /dev/null +++ b/mesalib/src/glsl/ir.cpp @@ -0,0 +1,1238 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <string.h> +#include "main/core.h" /* for MAX2 */ +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" + +ir_rvalue::ir_rvalue() +{ + this->type = glsl_type::error_type; +} + +/** + * Modify the swizzle make to move one component to another + * + * \param m IR swizzle to be modified + * \param from Component in the RHS that is to be swizzled + * \param to Desired swizzle location of \c from + */ +static void +update_rhs_swizzle(ir_swizzle_mask &m, unsigned from, unsigned to) +{ + switch (to) { + case 0: m.x = from; break; + case 1: m.y = from; break; + case 2: m.z = from; break; + case 3: m.w = from; break; + default: assert(!"Should not get here."); + } + + m.num_components = MAX2(m.num_components, (to + 1)); +} + +void +ir_assignment::set_lhs(ir_rvalue *lhs) +{ + void *mem_ctx = this; + bool swizzled = false; + + while (lhs != NULL) { + ir_swizzle *swiz = lhs->as_swizzle(); + + if (swiz == NULL) + break; + + unsigned write_mask = 0; + ir_swizzle_mask rhs_swiz = { 0, 0, 0, 0, 0, 0 }; + + for (unsigned i = 0; i < swiz->mask.num_components; i++) { + unsigned c = 0; + + switch (i) { + case 0: c = swiz->mask.x; break; + case 1: c = swiz->mask.y; break; + case 2: c = swiz->mask.z; break; + case 3: c = swiz->mask.w; break; + default: assert(!"Should not get here."); + } + + write_mask |= (((this->write_mask >> i) & 1) << c); + update_rhs_swizzle(rhs_swiz, i, c); + } + + this->write_mask = write_mask; + lhs = swiz->val; + + this->rhs = new(mem_ctx) ir_swizzle(this->rhs, rhs_swiz); + swizzled = true; + } + + if (swizzled) { + /* Now, RHS channels line up with the LHS writemask. Collapse it + * to just the channels that will be written. + */ + ir_swizzle_mask rhs_swiz = { 0, 0, 0, 0, 0, 0 }; + int rhs_chan = 0; + for (int i = 0; i < 4; i++) { + if (write_mask & (1 << i)) + update_rhs_swizzle(rhs_swiz, i, rhs_chan++); + } + this->rhs = new(mem_ctx) ir_swizzle(this->rhs, rhs_swiz); + } + + assert((lhs == NULL) || lhs->as_dereference()); + + this->lhs = (ir_dereference *) lhs; +} + +ir_variable * +ir_assignment::whole_variable_written() +{ + ir_variable *v = this->lhs->whole_variable_referenced(); + + if (v == NULL) + return NULL; + + if (v->type->is_scalar()) + return v; + + if (v->type->is_vector()) { + const unsigned mask = (1U << v->type->vector_elements) - 1; + + if (mask != this->write_mask) + return NULL; + } + + /* Either all the vector components are assigned or the variable is some + * composite type (and the whole thing is assigned. + */ + return v; +} + +ir_assignment::ir_assignment(ir_dereference *lhs, ir_rvalue *rhs, + ir_rvalue *condition, unsigned write_mask) +{ + this->ir_type = ir_type_assignment; + this->condition = condition; + this->rhs = rhs; + this->lhs = lhs; + this->write_mask = write_mask; + + if (lhs->type->is_scalar() || lhs->type->is_vector()) { + int lhs_components = 0; + for (int i = 0; i < 4; i++) { + if (write_mask & (1 << i)) + lhs_components++; + } + + assert(lhs_components == this->rhs->type->vector_elements); + } +} + +ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, + ir_rvalue *condition) +{ + this->ir_type = ir_type_assignment; + this->condition = condition; + this->rhs = rhs; + + /* If the RHS is a vector type, assume that all components of the vector + * type are being written to the LHS. The write mask comes from the RHS + * because we can have a case where the LHS is a vec4 and the RHS is a + * vec3. In that case, the assignment is: + * + * (assign (...) (xyz) (var_ref lhs) (var_ref rhs)) + */ + if (rhs->type->is_vector()) + this->write_mask = (1U << rhs->type->vector_elements) - 1; + else if (rhs->type->is_scalar()) + this->write_mask = 1; + else + this->write_mask = 0; + + this->set_lhs(lhs); +} + + +ir_expression::ir_expression(int op, const struct glsl_type *type, + ir_rvalue *op0, ir_rvalue *op1) +{ + this->ir_type = ir_type_expression; + this->type = type; + this->operation = ir_expression_operation(op); + this->operands[0] = op0; + this->operands[1] = op1; +} + +unsigned int +ir_expression::get_num_operands(ir_expression_operation op) +{ +/* Update ir_print_visitor.cpp when updating this list. */ + const int num_operands[] = { + 1, /* ir_unop_bit_not */ + 1, /* ir_unop_logic_not */ + 1, /* ir_unop_neg */ + 1, /* ir_unop_abs */ + 1, /* ir_unop_sign */ + 1, /* ir_unop_rcp */ + 1, /* ir_unop_rsq */ + 1, /* ir_unop_sqrt */ + 1, /* ir_unop_exp */ + 1, /* ir_unop_log */ + 1, /* ir_unop_exp2 */ + 1, /* ir_unop_log2 */ + 1, /* ir_unop_f2i */ + 1, /* ir_unop_i2f */ + 1, /* ir_unop_f2b */ + 1, /* ir_unop_b2f */ + 1, /* ir_unop_i2b */ + 1, /* ir_unop_b2i */ + 1, /* ir_unop_u2f */ + 1, /* ir_unop_any */ + + 1, /* ir_unop_trunc */ + 1, /* ir_unop_ceil */ + 1, /* ir_unop_floor */ + 1, /* ir_unop_fract */ + + 1, /* ir_unop_sin */ + 1, /* ir_unop_cos */ + + 1, /* ir_unop_dFdx */ + 1, /* ir_unop_dFdy */ + + 1, /* ir_unop_noise */ + + 2, /* ir_binop_add */ + 2, /* ir_binop_sub */ + 2, /* ir_binop_mul */ + 2, /* ir_binop_div */ + 2, /* ir_binop_mod */ + + 2, /* ir_binop_less */ + 2, /* ir_binop_greater */ + 2, /* ir_binop_lequal */ + 2, /* ir_binop_gequal */ + 2, /* ir_binop_equal */ + 2, /* ir_binop_nequal */ + 2, /* ir_binop_all_equal */ + 2, /* ir_binop_any_nequal */ + + 2, /* ir_binop_lshift */ + 2, /* ir_binop_rshift */ + 2, /* ir_binop_bit_and */ + 2, /* ir_binop_bit_xor */ + 2, /* ir_binop_bit_or */ + + 2, /* ir_binop_logic_and */ + 2, /* ir_binop_logic_xor */ + 2, /* ir_binop_logic_or */ + + 2, /* ir_binop_dot */ + 2, /* ir_binop_cross */ + 2, /* ir_binop_min */ + 2, /* ir_binop_max */ + + 2, /* ir_binop_pow */ + }; + + assert(sizeof(num_operands) / sizeof(num_operands[0]) == ir_binop_pow + 1); + + return num_operands[op]; +} + +static const char *const operator_strs[] = { + "~", + "!", + "neg", + "abs", + "sign", + "rcp", + "rsq", + "sqrt", + "exp", + "log", + "exp2", + "log2", + "f2i", + "i2f", + "f2b", + "b2f", + "i2b", + "b2i", + "u2f", + "any", + "trunc", + "ceil", + "floor", + "fract", + "sin", + "cos", + "dFdx", + "dFdy", + "noise", + "+", + "-", + "*", + "/", + "%", + "<", + ">", + "<=", + ">=", + "==", + "!=", + "all_equal", + "any_nequal", + "<<", + ">>", + "&", + "^", + "|", + "&&", + "^^", + "||", + "dot", + "cross", + "min", + "max", + "pow", +}; + +const char *ir_expression::operator_string(ir_expression_operation op) +{ + assert((unsigned int) op < Elements(operator_strs)); + assert(Elements(operator_strs) == (ir_binop_pow + 1)); + return operator_strs[op]; +} + +const char *ir_expression::operator_string() +{ + return operator_string(this->operation); +} + +ir_expression_operation +ir_expression::get_operator(const char *str) +{ + const int operator_count = sizeof(operator_strs) / sizeof(operator_strs[0]); + for (int op = 0; op < operator_count; op++) { + if (strcmp(str, operator_strs[op]) == 0) + return (ir_expression_operation) op; + } + return (ir_expression_operation) -1; +} + +ir_constant::ir_constant() +{ + this->ir_type = ir_type_constant; +} + +ir_constant::ir_constant(const struct glsl_type *type, + const ir_constant_data *data) +{ + assert((type->base_type >= GLSL_TYPE_UINT) + && (type->base_type <= GLSL_TYPE_BOOL)); + + this->ir_type = ir_type_constant; + this->type = type; + memcpy(& this->value, data, sizeof(this->value)); +} + +ir_constant::ir_constant(float f) +{ + this->ir_type = ir_type_constant; + this->type = glsl_type::float_type; + this->value.f[0] = f; + for (int i = 1; i < 16; i++) { + this->value.f[i] = 0; + } +} + +ir_constant::ir_constant(unsigned int u) +{ + this->ir_type = ir_type_constant; + this->type = glsl_type::uint_type; + this->value.u[0] = u; + for (int i = 1; i < 16; i++) { + this->value.u[i] = 0; + } +} + +ir_constant::ir_constant(int i) +{ + this->ir_type = ir_type_constant; + this->type = glsl_type::int_type; + this->value.i[0] = i; + for (int i = 1; i < 16; i++) { + this->value.i[i] = 0; + } +} + +ir_constant::ir_constant(bool b) +{ + this->ir_type = ir_type_constant; + this->type = glsl_type::bool_type; + this->value.b[0] = b; + for (int i = 1; i < 16; i++) { + this->value.b[i] = false; + } +} + +ir_constant::ir_constant(const ir_constant *c, unsigned i) +{ + this->ir_type = ir_type_constant; + this->type = c->type->get_base_type(); + + switch (this->type->base_type) { + case GLSL_TYPE_UINT: this->value.u[0] = c->value.u[i]; break; + case GLSL_TYPE_INT: this->value.i[0] = c->value.i[i]; break; + case GLSL_TYPE_FLOAT: this->value.f[0] = c->value.f[i]; break; + case GLSL_TYPE_BOOL: this->value.b[0] = c->value.b[i]; break; + default: assert(!"Should not get here."); break; + } +} + +ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list) +{ + this->ir_type = ir_type_constant; + this->type = type; + + assert(type->is_scalar() || type->is_vector() || type->is_matrix() + || type->is_record() || type->is_array()); + + if (type->is_array()) { + this->array_elements = talloc_array(this, ir_constant *, type->length); + unsigned i = 0; + foreach_list(node, value_list) { + ir_constant *value = (ir_constant *) node; + assert(value->as_constant() != NULL); + + this->array_elements[i++] = value; + } + return; + } + + /* If the constant is a record, the types of each of the entries in + * value_list must be a 1-for-1 match with the structure components. Each + * entry must also be a constant. Just move the nodes from the value_list + * to the list in the ir_constant. + */ + /* FINISHME: Should there be some type checking and / or assertions here? */ + /* FINISHME: Should the new constant take ownership of the nodes from + * FINISHME: value_list, or should it make copies? + */ + if (type->is_record()) { + value_list->move_nodes_to(& this->components); + return; + } + + for (unsigned i = 0; i < 16; i++) { + this->value.u[i] = 0; + } + + ir_constant *value = (ir_constant *) (value_list->head); + + /* Constructors with exactly one scalar argument are special for vectors + * and matrices. For vectors, the scalar value is replicated to fill all + * the components. For matrices, the scalar fills the components of the + * diagonal while the rest is filled with 0. + */ + if (value->type->is_scalar() && value->next->is_tail_sentinel()) { + if (type->is_matrix()) { + /* Matrix - fill diagonal (rest is already set to 0) */ + assert(type->base_type == GLSL_TYPE_FLOAT); + for (unsigned i = 0; i < type->matrix_columns; i++) + this->value.f[i * type->vector_elements + i] = value->value.f[0]; + } else { + /* Vector or scalar - fill all components */ + switch (type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + for (unsigned i = 0; i < type->components(); i++) + this->value.u[i] = value->value.u[0]; + break; + case GLSL_TYPE_FLOAT: + for (unsigned i = 0; i < type->components(); i++) + this->value.f[i] = value->value.f[0]; + break; + case GLSL_TYPE_BOOL: + for (unsigned i = 0; i < type->components(); i++) + this->value.b[i] = value->value.b[0]; + break; + default: + assert(!"Should not get here."); + break; + } + } + return; + } + + if (type->is_matrix() && value->type->is_matrix()) { + assert(value->next->is_tail_sentinel()); + + /* From section 5.4.2 of the GLSL 1.20 spec: + * "If a matrix is constructed from a matrix, then each component + * (column i, row j) in the result that has a corresponding component + * (column i, row j) in the argument will be initialized from there." + */ + unsigned cols = MIN2(type->matrix_columns, value->type->matrix_columns); + unsigned rows = MIN2(type->vector_elements, value->type->vector_elements); + for (unsigned i = 0; i < cols; i++) { + for (unsigned j = 0; j < rows; j++) { + const unsigned src = i * value->type->vector_elements + j; + const unsigned dst = i * type->vector_elements + j; + this->value.f[dst] = value->value.f[src]; + } + } + + /* "All other components will be initialized to the identity matrix." */ + for (unsigned i = cols; i < type->matrix_columns; i++) + this->value.f[i * type->vector_elements + i] = 1.0; + + return; + } + + /* Use each component from each entry in the value_list to initialize one + * component of the constant being constructed. + */ + for (unsigned i = 0; i < type->components(); /* empty */) { + assert(value->as_constant() != NULL); + assert(!value->is_tail_sentinel()); + + for (unsigned j = 0; j < value->type->components(); j++) { + switch (type->base_type) { + case GLSL_TYPE_UINT: + this->value.u[i] = value->get_uint_component(j); + break; + case GLSL_TYPE_INT: + this->value.i[i] = value->get_int_component(j); + break; + case GLSL_TYPE_FLOAT: + this->value.f[i] = value->get_float_component(j); + break; + case GLSL_TYPE_BOOL: + this->value.b[i] = value->get_bool_component(j); + break; + default: + /* FINISHME: What to do? Exceptions are not the answer. + */ + break; + } + + i++; + if (i >= type->components()) + break; + } + + value = (ir_constant *) value->next; + } +} + +ir_constant * +ir_constant::zero(void *mem_ctx, const glsl_type *type) +{ + assert(type->is_numeric() || type->is_boolean()); + + ir_constant *c = new(mem_ctx) ir_constant; + c->type = type; + memset(&c->value, 0, sizeof(c->value)); + + return c; +} + +bool +ir_constant::get_bool_component(unsigned i) const +{ + switch (this->type->base_type) { + case GLSL_TYPE_UINT: return this->value.u[i] != 0; + case GLSL_TYPE_INT: return this->value.i[i] != 0; + case GLSL_TYPE_FLOAT: return ((int)this->value.f[i]) != 0; + case GLSL_TYPE_BOOL: return this->value.b[i]; + default: assert(!"Should not get here."); break; + } + + /* Must return something to make the compiler happy. This is clearly an + * error case. + */ + return false; +} + +float +ir_constant::get_float_component(unsigned i) const +{ + switch (this->type->base_type) { + case GLSL_TYPE_UINT: return (float) this->value.u[i]; + case GLSL_TYPE_INT: return (float) this->value.i[i]; + case GLSL_TYPE_FLOAT: return this->value.f[i]; + case GLSL_TYPE_BOOL: return this->value.b[i] ? 1.0 : 0.0; + default: assert(!"Should not get here."); break; + } + + /* Must return something to make the compiler happy. This is clearly an + * error case. + */ + return 0.0; +} + +int +ir_constant::get_int_component(unsigned i) const +{ + switch (this->type->base_type) { + case GLSL_TYPE_UINT: return this->value.u[i]; + case GLSL_TYPE_INT: return this->value.i[i]; + case GLSL_TYPE_FLOAT: return (int) this->value.f[i]; + case GLSL_TYPE_BOOL: return this->value.b[i] ? 1 : 0; + default: assert(!"Should not get here."); break; + } + + /* Must return something to make the compiler happy. This is clearly an + * error case. + */ + return 0; +} + +unsigned +ir_constant::get_uint_component(unsigned i) const +{ + switch (this->type->base_type) { + case GLSL_TYPE_UINT: return this->value.u[i]; + case GLSL_TYPE_INT: return this->value.i[i]; + case GLSL_TYPE_FLOAT: return (unsigned) this->value.f[i]; + case GLSL_TYPE_BOOL: return this->value.b[i] ? 1 : 0; + default: assert(!"Should not get here."); break; + } + + /* Must return something to make the compiler happy. This is clearly an + * error case. + */ + return 0; +} + +ir_constant * +ir_constant::get_array_element(unsigned i) const +{ + assert(this->type->is_array()); + + /* From page 35 (page 41 of the PDF) of the GLSL 1.20 spec: + * + * "Behavior is undefined if a shader subscripts an array with an index + * less than 0 or greater than or equal to the size the array was + * declared with." + * + * Most out-of-bounds accesses are removed before things could get this far. + * There are cases where non-constant array index values can get constant + * folded. + */ + if (int(i) < 0) + i = 0; + else if (i >= this->type->length) + i = this->type->length - 1; + + return array_elements[i]; +} + +ir_constant * +ir_constant::get_record_field(const char *name) +{ + int idx = this->type->field_index(name); + + if (idx < 0) + return NULL; + + if (this->components.is_empty()) + return NULL; + + exec_node *node = this->components.head; + for (int i = 0; i < idx; i++) { + node = node->next; + + /* If the end of the list is encountered before the element matching the + * requested field is found, return NULL. + */ + if (node->is_tail_sentinel()) + return NULL; + } + + return (ir_constant *) node; +} + + +bool +ir_constant::has_value(const ir_constant *c) const +{ + if (this->type != c->type) + return false; + + if (this->type->is_array()) { + for (unsigned i = 0; i < this->type->length; i++) { + if (this->array_elements[i]->has_value(c->array_elements[i])) + return false; + } + return true; + } + + if (this->type->base_type == GLSL_TYPE_STRUCT) { + const exec_node *a_node = this->components.head; + const exec_node *b_node = c->components.head; + + while (!a_node->is_tail_sentinel()) { + assert(!b_node->is_tail_sentinel()); + + const ir_constant *const a_field = (ir_constant *) a_node; + const ir_constant *const b_field = (ir_constant *) b_node; + + if (!a_field->has_value(b_field)) + return false; + + a_node = a_node->next; + b_node = b_node->next; + } + + return true; + } + + for (unsigned i = 0; i < this->type->components(); i++) { + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + if (this->value.u[i] != c->value.u[i]) + return false; + break; + case GLSL_TYPE_INT: + if (this->value.i[i] != c->value.i[i]) + return false; + break; + case GLSL_TYPE_FLOAT: + if (this->value.f[i] != c->value.f[i]) + return false; + break; + case GLSL_TYPE_BOOL: + if (this->value.b[i] != c->value.b[i]) + return false; + break; + default: + assert(!"Should not get here."); + return false; + } + } + + return true; +} + + +ir_loop::ir_loop() +{ + this->ir_type = ir_type_loop; + this->cmp = ir_unop_neg; + this->from = NULL; + this->to = NULL; + this->increment = NULL; + this->counter = NULL; +} + + +ir_dereference_variable::ir_dereference_variable(ir_variable *var) +{ + this->ir_type = ir_type_dereference_variable; + this->var = var; + this->type = (var != NULL) ? var->type : glsl_type::error_type; +} + + +ir_dereference_array::ir_dereference_array(ir_rvalue *value, + ir_rvalue *array_index) +{ + this->ir_type = ir_type_dereference_array; + this->array_index = array_index; + this->set_array(value); +} + + +ir_dereference_array::ir_dereference_array(ir_variable *var, + ir_rvalue *array_index) +{ + void *ctx = talloc_parent(var); + + this->ir_type = ir_type_dereference_array; + this->array_index = array_index; + this->set_array(new(ctx) ir_dereference_variable(var)); +} + + +void +ir_dereference_array::set_array(ir_rvalue *value) +{ + this->array = value; + this->type = glsl_type::error_type; + + if (this->array != NULL) { + const glsl_type *const vt = this->array->type; + + if (vt->is_array()) { + type = vt->element_type(); + } else if (vt->is_matrix()) { + type = vt->column_type(); + } else if (vt->is_vector()) { + type = vt->get_base_type(); + } + } +} + + +ir_dereference_record::ir_dereference_record(ir_rvalue *value, + const char *field) +{ + this->ir_type = ir_type_dereference_record; + this->record = value; + this->field = talloc_strdup(this, field); + this->type = (this->record != NULL) + ? this->record->type->field_type(field) : glsl_type::error_type; +} + + +ir_dereference_record::ir_dereference_record(ir_variable *var, + const char *field) +{ + void *ctx = talloc_parent(var); + + this->ir_type = ir_type_dereference_record; + this->record = new(ctx) ir_dereference_variable(var); + this->field = talloc_strdup(this, field); + this->type = (this->record != NULL) + ? this->record->type->field_type(field) : glsl_type::error_type; +} + +bool type_contains_sampler(const glsl_type *type) +{ + if (type->is_array()) { + return type_contains_sampler(type->fields.array); + } else if (type->is_record()) { + for (unsigned int i = 0; i < type->length; i++) { + if (type_contains_sampler(type->fields.structure[i].type)) + return true; + } + return false; + } else { + return type->is_sampler(); + } +} + +bool +ir_dereference::is_lvalue() +{ + ir_variable *var = this->variable_referenced(); + + /* Every l-value derference chain eventually ends in a variable. + */ + if ((var == NULL) || var->read_only) + return false; + + if (this->type->is_array() && !var->array_lvalue) + return false; + + /* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec: + * + * "Samplers cannot be treated as l-values; hence cannot be used + * as out or inout function parameters, nor can they be + * assigned into." + */ + if (type_contains_sampler(this->type)) + return false; + + return true; +} + + +const char *tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf" }; + +const char *ir_texture::opcode_string() +{ + assert((unsigned int) op <= + sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0])); + return tex_opcode_strs[op]; +} + +ir_texture_opcode +ir_texture::get_opcode(const char *str) +{ + const int count = sizeof(tex_opcode_strs) / sizeof(tex_opcode_strs[0]); + for (int op = 0; op < count; op++) { + if (strcmp(str, tex_opcode_strs[op]) == 0) + return (ir_texture_opcode) op; + } + return (ir_texture_opcode) -1; +} + + +void +ir_texture::set_sampler(ir_dereference *sampler) +{ + assert(sampler != NULL); + this->sampler = sampler; + + switch (sampler->type->sampler_type) { + case GLSL_TYPE_FLOAT: + this->type = glsl_type::vec4_type; + break; + case GLSL_TYPE_INT: + this->type = glsl_type::ivec4_type; + break; + case GLSL_TYPE_UINT: + this->type = glsl_type::uvec4_type; + break; + } +} + + +void +ir_swizzle::init_mask(const unsigned *comp, unsigned count) +{ + assert((count >= 1) && (count <= 4)); + + memset(&this->mask, 0, sizeof(this->mask)); + this->mask.num_components = count; + + unsigned dup_mask = 0; + switch (count) { + case 4: + assert(comp[3] <= 3); + dup_mask |= (1U << comp[3]) + & ((1U << comp[0]) | (1U << comp[1]) | (1U << comp[2])); + this->mask.w = comp[3]; + + case 3: + assert(comp[2] <= 3); + dup_mask |= (1U << comp[2]) + & ((1U << comp[0]) | (1U << comp[1])); + this->mask.z = comp[2]; + + case 2: + assert(comp[1] <= 3); + dup_mask |= (1U << comp[1]) + & ((1U << comp[0])); + this->mask.y = comp[1]; + + case 1: + assert(comp[0] <= 3); + this->mask.x = comp[0]; + } + + this->mask.has_duplicates = dup_mask != 0; + + /* Based on the number of elements in the swizzle and the base type + * (i.e., float, int, unsigned, or bool) of the vector being swizzled, + * generate the type of the resulting value. + */ + type = glsl_type::get_instance(val->type->base_type, mask.num_components, 1); +} + +ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z, + unsigned w, unsigned count) + : val(val) +{ + const unsigned components[4] = { x, y, z, w }; + this->ir_type = ir_type_swizzle; + this->init_mask(components, count); +} + +ir_swizzle::ir_swizzle(ir_rvalue *val, const unsigned *comp, + unsigned count) + : val(val) +{ + this->ir_type = ir_type_swizzle; + this->init_mask(comp, count); +} + +ir_swizzle::ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask) +{ + this->ir_type = ir_type_swizzle; + this->val = val; + this->mask = mask; + this->type = glsl_type::get_instance(val->type->base_type, + mask.num_components, 1); +} + +#define X 1 +#define R 5 +#define S 9 +#define I 13 + +ir_swizzle * +ir_swizzle::create(ir_rvalue *val, const char *str, unsigned vector_length) +{ + void *ctx = talloc_parent(val); + + /* For each possible swizzle character, this table encodes the value in + * \c idx_map that represents the 0th element of the vector. For invalid + * swizzle characters (e.g., 'k'), a special value is used that will allow + * detection of errors. + */ + static const unsigned char base_idx[26] = { + /* a b c d e f g h i j k l m */ + R, R, I, I, I, I, R, I, I, I, I, I, I, + /* n o p q r s t u v w x y z */ + I, I, S, S, R, S, S, I, I, X, X, X, X + }; + + /* Each valid swizzle character has an entry in the previous table. This + * table encodes the base index encoded in the previous table plus the actual + * index of the swizzle character. When processing swizzles, the first + * character in the string is indexed in the previous table. Each character + * in the string is indexed in this table, and the value found there has the + * value form the first table subtracted. The result must be on the range + * [0,3]. + * + * For example, the string "wzyx" will get X from the first table. Each of + * the charcaters will get X+3, X+2, X+1, and X+0 from this table. After + * subtraction, the swizzle values are { 3, 2, 1, 0 }. + * + * The string "wzrg" will get X from the first table. Each of the characters + * will get X+3, X+2, R+0, and R+1 from this table. After subtraction, the + * swizzle values are { 3, 2, 4, 5 }. Since 4 and 5 are outside the range + * [0,3], the error is detected. + */ + static const unsigned char idx_map[26] = { + /* a b c d e f g h i j k l m */ + R+3, R+2, 0, 0, 0, 0, R+1, 0, 0, 0, 0, 0, 0, + /* n o p q r s t u v w x y z */ + 0, 0, S+2, S+3, R+0, S+0, S+1, 0, 0, X+3, X+0, X+1, X+2 + }; + + int swiz_idx[4] = { 0, 0, 0, 0 }; + unsigned i; + + + /* Validate the first character in the swizzle string and look up the base + * index value as described above. + */ + if ((str[0] < 'a') || (str[0] > 'z')) + return NULL; + + const unsigned base = base_idx[str[0] - 'a']; + + + for (i = 0; (i < 4) && (str[i] != '\0'); i++) { + /* Validate the next character, and, as described above, convert it to a + * swizzle index. + */ + if ((str[i] < 'a') || (str[i] > 'z')) + return NULL; + + swiz_idx[i] = idx_map[str[i] - 'a'] - base; + if ((swiz_idx[i] < 0) || (swiz_idx[i] >= (int) vector_length)) + return NULL; + } + + if (str[i] != '\0') + return NULL; + + return new(ctx) ir_swizzle(val, swiz_idx[0], swiz_idx[1], swiz_idx[2], + swiz_idx[3], i); +} + +#undef X +#undef R +#undef S +#undef I + +ir_variable * +ir_swizzle::variable_referenced() +{ + return this->val->variable_referenced(); +} + + +ir_variable::ir_variable(const struct glsl_type *type, const char *name, + ir_variable_mode mode) + : max_array_access(0), read_only(false), centroid(false), invariant(false), + mode(mode), interpolation(ir_var_smooth), array_lvalue(false) +{ + this->ir_type = ir_type_variable; + this->type = type; + this->name = talloc_strdup(this, name); + this->location = -1; + this->warn_extension = NULL; + this->constant_value = NULL; + this->origin_upper_left = false; + this->pixel_center_integer = false; + + if (type && type->base_type == GLSL_TYPE_SAMPLER) + this->read_only = true; +} + + +const char * +ir_variable::interpolation_string() const +{ + switch (this->interpolation) { + case ir_var_smooth: return "smooth"; + case ir_var_flat: return "flat"; + case ir_var_noperspective: return "noperspective"; + } + + assert(!"Should not get here."); + return ""; +} + + +unsigned +ir_variable::component_slots() const +{ + /* FINISHME: Sparsely accessed arrays require fewer slots. */ + return this->type->component_slots(); +} + + +ir_function_signature::ir_function_signature(const glsl_type *return_type) + : return_type(return_type), is_defined(false), _function(NULL) +{ + this->ir_type = ir_type_function_signature; + this->is_builtin = false; +} + + +const char * +ir_function_signature::qualifiers_match(exec_list *params) +{ + exec_list_iterator iter_a = parameters.iterator(); + exec_list_iterator iter_b = params->iterator(); + + /* check that the qualifiers match. */ + while (iter_a.has_next()) { + ir_variable *a = (ir_variable *)iter_a.get(); + ir_variable *b = (ir_variable *)iter_b.get(); + + if (a->read_only != b->read_only || + a->mode != b->mode || + a->interpolation != b->interpolation || + a->centroid != b->centroid) { + + /* parameter a's qualifiers don't match */ + return a->name; + } + + iter_a.next(); + iter_b.next(); + } + return NULL; +} + + +void +ir_function_signature::replace_parameters(exec_list *new_params) +{ + /* Destroy all of the previous parameter information. If the previous + * parameter information comes from the function prototype, it may either + * specify incorrect parameter names or not have names at all. + */ + foreach_iter(exec_list_iterator, iter, parameters) { + assert(((ir_instruction *) iter.get())->as_variable() != NULL); + + iter.remove(); + } + + new_params->move_nodes_to(¶meters); +} + + +ir_function::ir_function(const char *name) +{ + this->ir_type = ir_type_function; + this->name = talloc_strdup(this, name); +} + + +bool +ir_function::has_user_signature() +{ + foreach_list(n, &this->signatures) { + ir_function_signature *const sig = (ir_function_signature *) n; + if (!sig->is_builtin) + return true; + } + return false; +} + + +ir_call * +ir_call::get_error_instruction(void *ctx) +{ + ir_call *call = new(ctx) ir_call; + + call->type = glsl_type::error_type; + return call; +} + +void +ir_call::set_callee(ir_function_signature *sig) +{ + assert((this->type == NULL) || (this->type == sig->return_type)); + + this->callee = sig; +} + +void +visit_exec_list(exec_list *list, ir_visitor *visitor) +{ + foreach_iter(exec_list_iterator, iter, *list) { + ((ir_instruction *)iter.get())->accept(visitor); + } +} + + +static void +steal_memory(ir_instruction *ir, void *new_ctx) +{ + ir_variable *var = ir->as_variable(); + ir_constant *constant = ir->as_constant(); + if (var != NULL && var->constant_value != NULL) + steal_memory(var->constant_value, ir); + + /* The components of aggregate constants are not visited by the normal + * visitor, so steal their values by hand. + */ + if (constant != NULL) { + if (constant->type->is_record()) { + foreach_iter(exec_list_iterator, iter, constant->components) { + ir_constant *field = (ir_constant *)iter.get(); + steal_memory(field, ir); + } + } else if (constant->type->is_array()) { + for (unsigned int i = 0; i < constant->type->length; i++) { + steal_memory(constant->array_elements[i], ir); + } + } + } + + talloc_steal(new_ctx, ir); +} + + +void +reparent_ir(exec_list *list, void *mem_ctx) +{ + foreach_list(node, list) { + visit_tree((ir_instruction *) node, steal_memory, mem_ctx); + } +} diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h new file mode 100644 index 000000000..fa246b5e5 --- /dev/null +++ b/mesalib/src/glsl/ir.h @@ -0,0 +1,1511 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef IR_H +#define IR_H + +#include <cstdio> +#include <cstdlib> + +extern "C" { +#include <talloc.h> +} + +#include "list.h" +#include "ir_visitor.h" +#include "ir_hierarchical_visitor.h" + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +#endif + +/** + * \defgroup IR Intermediate representation nodes + * + * @{ + */ + +/** + * Class tags + * + * Each concrete class derived from \c ir_instruction has a value in this + * enumerant. The value for the type is stored in \c ir_instruction::ir_type + * by the constructor. While using type tags is not very C++, it is extremely + * convenient. For example, during debugging you can simply inspect + * \c ir_instruction::ir_type to find out the actual type of the object. + * + * In addition, it is possible to use a switch-statement based on \c + * \c ir_instruction::ir_type to select different behavior for different object + * types. For functions that have only slight differences for several object + * types, this allows writing very straightforward, readable code. + */ +enum ir_node_type { + /** + * Zero is unused so that the IR validator can detect cases where + * \c ir_instruction::ir_type has not been initialized. + */ + ir_type_unset, + ir_type_variable, + ir_type_assignment, + ir_type_call, + ir_type_constant, + ir_type_dereference_array, + ir_type_dereference_record, + ir_type_dereference_variable, + ir_type_discard, + ir_type_expression, + ir_type_function, + ir_type_function_signature, + ir_type_if, + ir_type_loop, + ir_type_loop_jump, + ir_type_return, + ir_type_swizzle, + ir_type_texture, + ir_type_max /**< maximum ir_type enum number, for validation */ +}; + +/** + * Base class of all IR instructions + */ +class ir_instruction : public exec_node { +public: + enum ir_node_type ir_type; + const struct glsl_type *type; + + /** ir_print_visitor helper for debugging. */ + void print(void) const; + + virtual void accept(ir_visitor *) = 0; + virtual ir_visitor_status accept(ir_hierarchical_visitor *) = 0; + virtual ir_instruction *clone(void *mem_ctx, + struct hash_table *ht) const = 0; + + /** + * \name IR instruction downcast functions + * + * These functions either cast the object to a derived class or return + * \c NULL if the object's type does not match the specified derived class. + * Additional downcast functions will be added as needed. + */ + /*@{*/ + virtual class ir_variable * as_variable() { return NULL; } + virtual class ir_function * as_function() { return NULL; } + virtual class ir_dereference * as_dereference() { return NULL; } + virtual class ir_dereference_array * as_dereference_array() { return NULL; } + virtual class ir_dereference_variable *as_dereference_variable() { return NULL; } + virtual class ir_expression * as_expression() { return NULL; } + virtual class ir_rvalue * as_rvalue() { return NULL; } + virtual class ir_loop * as_loop() { return NULL; } + virtual class ir_assignment * as_assignment() { return NULL; } + virtual class ir_call * as_call() { return NULL; } + virtual class ir_return * as_return() { return NULL; } + virtual class ir_if * as_if() { return NULL; } + virtual class ir_swizzle * as_swizzle() { return NULL; } + virtual class ir_constant * as_constant() { return NULL; } + /*@}*/ + +protected: + ir_instruction() + { + ir_type = ir_type_unset; + type = NULL; + } +}; + + +class ir_rvalue : public ir_instruction { +public: + virtual ir_rvalue *clone(void *mem_ctx, struct hash_table *) const = 0; + + virtual ir_constant *constant_expression_value() = 0; + + virtual ir_rvalue * as_rvalue() + { + return this; + } + + virtual bool is_lvalue() + { + return false; + } + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() + { + return NULL; + } + + + /** + * If an r-value is a reference to a whole variable, get that variable + * + * \return + * Pointer to a variable that is completely dereferenced by the r-value. If + * the r-value is not a dereference or the dereference does not access the + * entire variable (i.e., it's just one array element, struct field), \c NULL + * is returned. + */ + virtual ir_variable *whole_variable_referenced() + { + return NULL; + } + +protected: + ir_rvalue(); +}; + + +/** + * Variable storage classes + */ +enum ir_variable_mode { + ir_var_auto = 0, /**< Function local variables and globals. */ + ir_var_uniform, /**< Variable declared as a uniform. */ + ir_var_in, + ir_var_out, + ir_var_inout, + ir_var_temporary /**< Temporary variable generated during compilation. */ +}; + +enum ir_variable_interpolation { + ir_var_smooth = 0, + ir_var_flat, + ir_var_noperspective +}; + + +class ir_variable : public ir_instruction { +public: + ir_variable(const struct glsl_type *, const char *, ir_variable_mode); + + virtual ir_variable *clone(void *mem_ctx, struct hash_table *ht) const; + + virtual ir_variable *as_variable() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + + /** + * Get the string value for the interpolation qualifier + * + * \return The string that would be used in a shader to specify \c + * mode will be returned. + * + * This function should only be used on a shader input or output variable. + */ + const char *interpolation_string() const; + + /** + * Calculate the number of slots required to hold this variable + * + * This is used to determine how many uniform or varying locations a variable + * occupies. The count is in units of floating point components. + */ + unsigned component_slots() const; + + /** + * Delcared name of the variable + */ + const char *name; + + /** + * Highest element accessed with a constant expression array index + * + * Not used for non-array variables. + */ + unsigned max_array_access; + + /** + * Is the variable read-only? + * + * This is set for variables declared as \c const, shader inputs, + * and uniforms. + */ + unsigned read_only:1; + unsigned centroid:1; + unsigned invariant:1; + + /** + * Storage class of the variable. + * + * \sa ir_variable_mode + */ + unsigned mode:3; + + /** + * Interpolation mode for shader inputs / outputs + * + * \sa ir_variable_interpolation + */ + unsigned interpolation:2; + + /** + * Flag that the whole array is assignable + * + * In GLSL 1.20 and later whole arrays are assignable (and comparable for + * equality). This flag enables this behavior. + */ + unsigned array_lvalue:1; + + /** + * \name ARB_fragment_coord_conventions + * @{ + */ + unsigned origin_upper_left:1; + unsigned pixel_center_integer:1; + /*@}*/ + + /** + * Storage location of the base of this variable + * + * The precise meaning of this field depends on the nature of the variable. + * + * - Vertex shader input: one of the values from \c gl_vert_attrib. + * - Vertex shader output: one of the values from \c gl_vert_result. + * - Fragment shader input: one of the values from \c gl_frag_attrib. + * - Fragment shader output: one of the values from \c gl_frag_result. + * - Uniforms: Per-stage uniform slot number. + * - Other: This field is not currently used. + * + * If the variable is a uniform, shader input, or shader output, and the + * slot has not been assigned, the value will be -1. + */ + int location; + + /** + * Emit a warning if this variable is accessed. + */ + const char *warn_extension; + + /** + * Value assigned in the initializer of a variable declared "const" + */ + ir_constant *constant_value; +}; + + +/*@{*/ +/** + * The representation of a function instance; may be the full definition or + * simply a prototype. + */ +class ir_function_signature : public ir_instruction { + /* An ir_function_signature will be part of the list of signatures in + * an ir_function. + */ +public: + ir_function_signature(const glsl_type *return_type); + + virtual ir_function_signature *clone(void *mem_ctx, + struct hash_table *ht) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Get the name of the function for which this is a signature + */ + const char *function_name() const; + + /** + * Get a handle to the function for which this is a signature + * + * There is no setter function, this function returns a \c const pointer, + * and \c ir_function_signature::_function is private for a reason. The + * only way to make a connection between a function and function signature + * is via \c ir_function::add_signature. This helps ensure that certain + * invariants (i.e., a function signature is in the list of signatures for + * its \c _function) are met. + * + * \sa ir_function::add_signature + */ + inline const class ir_function *function() const + { + return this->_function; + } + + /** + * Check whether the qualifiers match between this signature's parameters + * and the supplied parameter list. If not, returns the name of the first + * parameter with mismatched qualifiers (for use in error messages). + */ + const char *qualifiers_match(exec_list *params); + + /** + * Replace the current parameter list with the given one. This is useful + * if the current information came from a prototype, and either has invalid + * or missing parameter names. + */ + void replace_parameters(exec_list *new_params); + + /** + * Function return type. + * + * \note This discards the optional precision qualifier. + */ + const struct glsl_type *return_type; + + /** + * List of ir_variable of function parameters. + * + * This represents the storage. The paramaters passed in a particular + * call will be in ir_call::actual_paramaters. + */ + struct exec_list parameters; + + /** Whether or not this function has a body (which may be empty). */ + unsigned is_defined:1; + + /** Whether or not this function signature is a built-in. */ + unsigned is_builtin:1; + + /** Body of instructions in the function. */ + struct exec_list body; + +private: + /** Function of which this signature is one overload. */ + class ir_function *_function; + + friend class ir_function; +}; + + +/** + * Header for tracking multiple overloaded functions with the same name. + * Contains a list of ir_function_signatures representing each of the + * actual functions. + */ +class ir_function : public ir_instruction { +public: + ir_function(const char *name); + + virtual ir_function *clone(void *mem_ctx, struct hash_table *ht) const; + + virtual ir_function *as_function() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + void add_signature(ir_function_signature *sig) + { + sig->_function = this; + this->signatures.push_tail(sig); + } + + /** + * Get an iterator for the set of function signatures + */ + exec_list_iterator iterator() + { + return signatures.iterator(); + } + + /** + * Find a signature that matches a set of actual parameters, taking implicit + * conversions into account. + */ + ir_function_signature *matching_signature(const exec_list *actual_param); + + /** + * Find a signature that exactly matches a set of actual parameters without + * any implicit type conversions. + */ + ir_function_signature *exact_matching_signature(const exec_list *actual_ps); + + /** + * Name of the function. + */ + const char *name; + + /** Whether or not this function has a signature that isn't a built-in. */ + bool has_user_signature(); + + /** + * List of ir_function_signature for each overloaded function with this name. + */ + struct exec_list signatures; +}; + +inline const char *ir_function_signature::function_name() const +{ + return this->_function->name; +} +/*@}*/ + + +/** + * IR instruction representing high-level if-statements + */ +class ir_if : public ir_instruction { +public: + ir_if(ir_rvalue *condition) + : condition(condition) + { + ir_type = ir_type_if; + } + + virtual ir_if *clone(void *mem_ctx, struct hash_table *ht) const; + + virtual ir_if *as_if() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *condition; + /** List of ir_instruction for the body of the then branch */ + exec_list then_instructions; + /** List of ir_instruction for the body of the else branch */ + exec_list else_instructions; +}; + + +/** + * IR instruction representing a high-level loop structure. + */ +class ir_loop : public ir_instruction { +public: + ir_loop(); + + virtual ir_loop *clone(void *mem_ctx, struct hash_table *ht) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + virtual ir_loop *as_loop() + { + return this; + } + + /** + * Get an iterator for the instructions of the loop body + */ + exec_list_iterator iterator() + { + return body_instructions.iterator(); + } + + /** List of ir_instruction that make up the body of the loop. */ + exec_list body_instructions; + + /** + * \name Loop counter and controls + * + * Represents a loop like a FORTRAN \c do-loop. + * + * \note + * If \c from and \c to are the same value, the loop will execute once. + */ + /*@{*/ + ir_rvalue *from; /** Value of the loop counter on the first + * iteration of the loop. + */ + ir_rvalue *to; /** Value of the loop counter on the last + * iteration of the loop. + */ + ir_rvalue *increment; + ir_variable *counter; + + /** + * Comparison operation in the loop terminator. + * + * If any of the loop control fields are non-\c NULL, this field must be + * one of \c ir_binop_less, \c ir_binop_greater, \c ir_binop_lequal, + * \c ir_binop_gequal, \c ir_binop_equal, or \c ir_binop_nequal. + */ + int cmp; + /*@}*/ +}; + + +class ir_assignment : public ir_instruction { +public: + ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition); + + /** + * Construct an assignment with an explicit write mask + * + * \note + * Since a write mask is supplied, the LHS must already be a bare + * \c ir_dereference. The cannot be any swizzles in the LHS. + */ + ir_assignment(ir_dereference *lhs, ir_rvalue *rhs, ir_rvalue *condition, + unsigned write_mask); + + virtual ir_assignment *clone(void *mem_ctx, struct hash_table *ht) const; + + virtual ir_constant *constant_expression_value(); + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + virtual ir_assignment * as_assignment() + { + return this; + } + + /** + * Get a whole variable written by an assignment + * + * If the LHS of the assignment writes a whole variable, the variable is + * returned. Otherwise \c NULL is returned. Examples of whole-variable + * assignment are: + * + * - Assigning to a scalar + * - Assigning to all components of a vector + * - Whole array (or matrix) assignment + * - Whole structure assignment + */ + ir_variable *whole_variable_written(); + + /** + * Set the LHS of an assignment + */ + void set_lhs(ir_rvalue *lhs); + + /** + * Left-hand side of the assignment. + * + * This should be treated as read only. If you need to set the LHS of an + * assignment, use \c ir_assignment::set_lhs. + */ + ir_dereference *lhs; + + /** + * Value being assigned + */ + ir_rvalue *rhs; + + /** + * Optional condition for the assignment. + */ + ir_rvalue *condition; + + + /** + * Component mask written + * + * For non-vector types in the LHS, this field will be zero. For vector + * types, a bit will be set for each component that is written. Note that + * for \c vec2 and \c vec3 types only the lower bits will ever be set. + * + * A partially-set write mask means that each enabled channel gets + * the value from a consecutive channel of the rhs. For example, + * to write just .xyw of gl_FrontColor with color: + * + * (assign (constant bool (1)) (xyw) + * (var_ref gl_FragColor) + * (swiz xyw (var_ref color))) + */ + unsigned write_mask:4; +}; + +/* Update ir_expression::num_operands() and operator_strs when + * updating this list. + */ +enum ir_expression_operation { + ir_unop_bit_not, + ir_unop_logic_not, + ir_unop_neg, + ir_unop_abs, + ir_unop_sign, + ir_unop_rcp, + ir_unop_rsq, + ir_unop_sqrt, + ir_unop_exp, /**< Log base e on gentype */ + ir_unop_log, /**< Natural log on gentype */ + ir_unop_exp2, + ir_unop_log2, + ir_unop_f2i, /**< Float-to-integer conversion. */ + ir_unop_i2f, /**< Integer-to-float conversion. */ + ir_unop_f2b, /**< Float-to-boolean conversion */ + ir_unop_b2f, /**< Boolean-to-float conversion */ + ir_unop_i2b, /**< int-to-boolean conversion */ + ir_unop_b2i, /**< Boolean-to-int conversion */ + ir_unop_u2f, /**< Unsigned-to-float conversion. */ + ir_unop_any, + + /** + * \name Unary floating-point rounding operations. + */ + /*@{*/ + ir_unop_trunc, + ir_unop_ceil, + ir_unop_floor, + ir_unop_fract, + /*@}*/ + + /** + * \name Trigonometric operations. + */ + /*@{*/ + ir_unop_sin, + ir_unop_cos, + /*@}*/ + + /** + * \name Partial derivatives. + */ + /*@{*/ + ir_unop_dFdx, + ir_unop_dFdy, + /*@}*/ + + ir_unop_noise, + + ir_binop_add, + ir_binop_sub, + ir_binop_mul, + ir_binop_div, + + /** + * Takes one of two combinations of arguments: + * + * - mod(vecN, vecN) + * - mod(vecN, float) + * + * Does not take integer types. + */ + ir_binop_mod, + + /** + * \name Binary comparison operators which return a boolean vector. + * The type of both operands must be equal. + */ + /*@{*/ + ir_binop_less, + ir_binop_greater, + ir_binop_lequal, + ir_binop_gequal, + ir_binop_equal, + ir_binop_nequal, + /** + * Returns single boolean for whether all components of operands[0] + * equal the components of operands[1]. + */ + ir_binop_all_equal, + /** + * Returns single boolean for whether any component of operands[0] + * is not equal to the corresponding component of operands[1]. + */ + ir_binop_any_nequal, + /*@}*/ + + /** + * \name Bit-wise binary operations. + */ + /*@{*/ + ir_binop_lshift, + ir_binop_rshift, + ir_binop_bit_and, + ir_binop_bit_xor, + ir_binop_bit_or, + /*@}*/ + + ir_binop_logic_and, + ir_binop_logic_xor, + ir_binop_logic_or, + + ir_binop_dot, + ir_binop_cross, + ir_binop_min, + ir_binop_max, + + ir_binop_pow +}; + +class ir_expression : public ir_rvalue { +public: + ir_expression(int op, const struct glsl_type *type, + ir_rvalue *, ir_rvalue *); + + virtual ir_expression *as_expression() + { + return this; + } + + virtual ir_expression *clone(void *mem_ctx, struct hash_table *ht) const; + + /** + * Attempt to constant-fold the expression + * + * If the expression cannot be constant folded, this method will return + * \c NULL. + */ + virtual ir_constant *constant_expression_value(); + + /** + * Determine the number of operands used by an expression + */ + static unsigned int get_num_operands(ir_expression_operation); + + /** + * Determine the number of operands used by an expression + */ + unsigned int get_num_operands() const + { + return get_num_operands(operation); + } + + /** + * Return a string representing this expression's operator. + */ + const char *operator_string(); + + /** + * Return a string representing this expression's operator. + */ + static const char *operator_string(ir_expression_operation); + + + /** + * Do a reverse-lookup to translate the given string into an operator. + */ + static ir_expression_operation get_operator(const char *); + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_expression_operation operation; + ir_rvalue *operands[2]; +}; + + +/** + * IR instruction representing a function call + */ +class ir_call : public ir_rvalue { +public: + ir_call(ir_function_signature *callee, exec_list *actual_parameters) + : callee(callee) + { + ir_type = ir_type_call; + assert(callee->return_type != NULL); + type = callee->return_type; + actual_parameters->move_nodes_to(& this->actual_parameters); + } + + virtual ir_call *clone(void *mem_ctx, struct hash_table *ht) const; + + virtual ir_constant *constant_expression_value(); + + virtual ir_call *as_call() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Get a generic ir_call object when an error occurs + * + * Any allocation will be performed with 'ctx' as talloc owner. + */ + static ir_call *get_error_instruction(void *ctx); + + /** + * Get an iterator for the set of acutal parameters + */ + exec_list_iterator iterator() + { + return actual_parameters.iterator(); + } + + /** + * Get the name of the function being called. + */ + const char *callee_name() const + { + return callee->function_name(); + } + + /** + * Get the function signature bound to this function call + */ + ir_function_signature *get_callee() + { + return callee; + } + + /** + * Set the function call target + */ + void set_callee(ir_function_signature *sig); + + /** + * Generates an inline version of the function before @ir, + * returning the return value of the function. + */ + ir_rvalue *generate_inline(ir_instruction *ir); + + /* List of ir_rvalue of paramaters passed in this call. */ + exec_list actual_parameters; + +private: + ir_call() + : callee(NULL) + { + this->ir_type = ir_type_call; + } + + ir_function_signature *callee; +}; + + +/** + * \name Jump-like IR instructions. + * + * These include \c break, \c continue, \c return, and \c discard. + */ +/*@{*/ +class ir_jump : public ir_instruction { +protected: + ir_jump() + { + ir_type = ir_type_unset; + } +}; + +class ir_return : public ir_jump { +public: + ir_return() + : value(NULL) + { + this->ir_type = ir_type_return; + } + + ir_return(ir_rvalue *value) + : value(value) + { + this->ir_type = ir_type_return; + } + + virtual ir_return *clone(void *mem_ctx, struct hash_table *) const; + + virtual ir_return *as_return() + { + return this; + } + + ir_rvalue *get_value() const + { + return value; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *value; +}; + + +/** + * Jump instructions used inside loops + * + * These include \c break and \c continue. The \c break within a loop is + * different from the \c break within a switch-statement. + * + * \sa ir_switch_jump + */ +class ir_loop_jump : public ir_jump { +public: + enum jump_mode { + jump_break, + jump_continue + }; + + ir_loop_jump(jump_mode mode) + { + this->ir_type = ir_type_loop_jump; + this->mode = mode; + this->loop = loop; + } + + virtual ir_loop_jump *clone(void *mem_ctx, struct hash_table *) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + bool is_break() const + { + return mode == jump_break; + } + + bool is_continue() const + { + return mode == jump_continue; + } + + /** Mode selector for the jump instruction. */ + enum jump_mode mode; +private: + /** Loop containing this break instruction. */ + ir_loop *loop; +}; + +/** + * IR instruction representing discard statements. + */ +class ir_discard : public ir_jump { +public: + ir_discard() + { + this->ir_type = ir_type_discard; + this->condition = NULL; + } + + ir_discard(ir_rvalue *cond) + { + this->ir_type = ir_type_discard; + this->condition = cond; + } + + virtual ir_discard *clone(void *mem_ctx, struct hash_table *ht) const; + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *condition; +}; +/*@}*/ + + +/** + * Texture sampling opcodes used in ir_texture + */ +enum ir_texture_opcode { + ir_tex, /**< Regular texture look-up */ + ir_txb, /**< Texture look-up with LOD bias */ + ir_txl, /**< Texture look-up with explicit LOD */ + ir_txd, /**< Texture look-up with partial derivatvies */ + ir_txf /**< Texel fetch with explicit LOD */ +}; + + +/** + * IR instruction to sample a texture + * + * The specific form of the IR instruction depends on the \c mode value + * selected from \c ir_texture_opcodes. In the printed IR, these will + * appear as: + * + * Texel offset + * | Projection divisor + * | | Shadow comparitor + * | | | + * v v v + * (tex (sampler) (coordinate) (0 0 0) (1) ( )) + * (txb (sampler) (coordinate) (0 0 0) (1) ( ) (bias)) + * (txl (sampler) (coordinate) (0 0 0) (1) ( ) (lod)) + * (txd (sampler) (coordinate) (0 0 0) (1) ( ) (dPdx dPdy)) + * (txf (sampler) (coordinate) (0 0 0) (lod)) + */ +class ir_texture : public ir_rvalue { +public: + ir_texture(enum ir_texture_opcode op) + : op(op), projector(NULL), shadow_comparitor(NULL) + { + this->ir_type = ir_type_texture; + } + + virtual ir_texture *clone(void *mem_ctx, struct hash_table *) const; + + virtual ir_constant *constant_expression_value(); + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Return a string representing the ir_texture_opcode. + */ + const char *opcode_string(); + + /** Set the sampler and infer the type. */ + void set_sampler(ir_dereference *sampler); + + /** + * Do a reverse-lookup to translate a string into an ir_texture_opcode. + */ + static ir_texture_opcode get_opcode(const char *); + + enum ir_texture_opcode op; + + /** Sampler to use for the texture access. */ + ir_dereference *sampler; + + /** Texture coordinate to sample */ + ir_rvalue *coordinate; + + /** + * Value used for projective divide. + * + * If there is no projective divide (the common case), this will be + * \c NULL. Optimization passes should check for this to point to a constant + * of 1.0 and replace that with \c NULL. + */ + ir_rvalue *projector; + + /** + * Coordinate used for comparison on shadow look-ups. + * + * If there is no shadow comparison, this will be \c NULL. For the + * \c ir_txf opcode, this *must* be \c NULL. + */ + ir_rvalue *shadow_comparitor; + + /** Explicit texel offsets. */ + signed char offsets[3]; + + union { + ir_rvalue *lod; /**< Floating point LOD */ + ir_rvalue *bias; /**< Floating point LOD bias */ + struct { + ir_rvalue *dPdx; /**< Partial derivative of coordinate wrt X */ + ir_rvalue *dPdy; /**< Partial derivative of coordinate wrt Y */ + } grad; + } lod_info; +}; + + +struct ir_swizzle_mask { + unsigned x:2; + unsigned y:2; + unsigned z:2; + unsigned w:2; + + /** + * Number of components in the swizzle. + */ + unsigned num_components:3; + + /** + * Does the swizzle contain duplicate components? + * + * L-value swizzles cannot contain duplicate components. + */ + unsigned has_duplicates:1; +}; + + +class ir_swizzle : public ir_rvalue { +public: + ir_swizzle(ir_rvalue *, unsigned x, unsigned y, unsigned z, unsigned w, + unsigned count); + + ir_swizzle(ir_rvalue *val, const unsigned *components, unsigned count); + + ir_swizzle(ir_rvalue *val, ir_swizzle_mask mask); + + virtual ir_swizzle *clone(void *mem_ctx, struct hash_table *) const; + + virtual ir_constant *constant_expression_value(); + + virtual ir_swizzle *as_swizzle() + { + return this; + } + + /** + * Construct an ir_swizzle from the textual representation. Can fail. + */ + static ir_swizzle *create(ir_rvalue *, const char *, unsigned vector_length); + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + bool is_lvalue() + { + return val->is_lvalue() && !mask.has_duplicates; + } + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced(); + + ir_rvalue *val; + ir_swizzle_mask mask; + +private: + /** + * Initialize the mask component of a swizzle + * + * This is used by the \c ir_swizzle constructors. + */ + void init_mask(const unsigned *components, unsigned count); +}; + + +class ir_dereference : public ir_rvalue { +public: + virtual ir_dereference *clone(void *mem_ctx, struct hash_table *) const = 0; + + virtual ir_dereference *as_dereference() + { + return this; + } + + bool is_lvalue(); + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() = 0; +}; + + +class ir_dereference_variable : public ir_dereference { +public: + ir_dereference_variable(ir_variable *var); + + virtual ir_dereference_variable *clone(void *mem_ctx, + struct hash_table *) const; + + virtual ir_constant *constant_expression_value(); + + virtual ir_dereference_variable *as_dereference_variable() + { + return this; + } + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() + { + return this->var; + } + + virtual ir_variable *whole_variable_referenced() + { + /* ir_dereference_variable objects always dereference the entire + * variable. However, if this dereference is dereferenced by anything + * else, the complete deferefernce chain is not a whole-variable + * dereference. This method should only be called on the top most + * ir_rvalue in a dereference chain. + */ + return this->var; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Object being dereferenced. + */ + ir_variable *var; +}; + + +class ir_dereference_array : public ir_dereference { +public: + ir_dereference_array(ir_rvalue *value, ir_rvalue *array_index); + + ir_dereference_array(ir_variable *var, ir_rvalue *array_index); + + virtual ir_dereference_array *clone(void *mem_ctx, + struct hash_table *) const; + + virtual ir_constant *constant_expression_value(); + + virtual ir_dereference_array *as_dereference_array() + { + return this; + } + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() + { + return this->array->variable_referenced(); + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *array; + ir_rvalue *array_index; + +private: + void set_array(ir_rvalue *value); +}; + + +class ir_dereference_record : public ir_dereference { +public: + ir_dereference_record(ir_rvalue *value, const char *field); + + ir_dereference_record(ir_variable *var, const char *field); + + virtual ir_dereference_record *clone(void *mem_ctx, + struct hash_table *) const; + + virtual ir_constant *constant_expression_value(); + + /** + * Get the variable that is ultimately referenced by an r-value + */ + virtual ir_variable *variable_referenced() + { + return this->record->variable_referenced(); + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + ir_rvalue *record; + const char *field; +}; + + +/** + * Data stored in an ir_constant + */ +union ir_constant_data { + unsigned u[16]; + int i[16]; + float f[16]; + bool b[16]; +}; + + +class ir_constant : public ir_rvalue { +public: + ir_constant(const struct glsl_type *type, const ir_constant_data *data); + ir_constant(bool b); + ir_constant(unsigned int u); + ir_constant(int i); + ir_constant(float f); + + /** + * Construct an ir_constant from a list of ir_constant values + */ + ir_constant(const struct glsl_type *type, exec_list *values); + + /** + * Construct an ir_constant from a scalar component of another ir_constant + * + * The new \c ir_constant inherits the type of the component from the + * source constant. + * + * \note + * In the case of a matrix constant, the new constant is a scalar, \b not + * a vector. + */ + ir_constant(const ir_constant *c, unsigned i); + + /** + * Return a new ir_constant of the specified type containing all zeros. + */ + static ir_constant *zero(void *mem_ctx, const glsl_type *type); + + virtual ir_constant *clone(void *mem_ctx, struct hash_table *) const; + + virtual ir_constant *constant_expression_value(); + + virtual ir_constant *as_constant() + { + return this; + } + + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + + /** + * Get a particular component of a constant as a specific type + * + * This is useful, for example, to get a value from an integer constant + * as a float or bool. This appears frequently when constructors are + * called with all constant parameters. + */ + /*@{*/ + bool get_bool_component(unsigned i) const; + float get_float_component(unsigned i) const; + int get_int_component(unsigned i) const; + unsigned get_uint_component(unsigned i) const; + /*@}*/ + + ir_constant *get_array_element(unsigned i) const; + + ir_constant *get_record_field(const char *name); + + /** + * Determine whether a constant has the same value as another constant + */ + bool has_value(const ir_constant *) const; + + /** + * Value of the constant. + * + * The field used to back the values supplied by the constant is determined + * by the type associated with the \c ir_instruction. Constants may be + * scalars, vectors, or matrices. + */ + union ir_constant_data value; + + /* Array elements */ + ir_constant **array_elements; + + /* Structure fields */ + exec_list components; + +private: + /** + * Parameterless constructor only used by the clone method + */ + ir_constant(void); +}; + +/*@}*/ + +/** + * Apply a visitor to each IR node in a list + */ +void +visit_exec_list(exec_list *list, ir_visitor *visitor); + +/** + * Validate invariants on each IR node in a list + */ +void validate_ir_tree(exec_list *instructions); + +/** + * Make a clone of each IR instruction in a list + * + * \param in List of IR instructions that are to be cloned + * \param out List to hold the cloned instructions + */ +void +clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in); + +extern void +_mesa_glsl_initialize_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +extern void +_mesa_glsl_initialize_functions(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +extern void +_mesa_glsl_release_functions(void); + +extern void +reparent_ir(exec_list *list, void *mem_ctx); + +struct glsl_symbol_table; + +extern void +import_prototypes(const exec_list *source, exec_list *dest, + struct glsl_symbol_table *symbols, void *mem_ctx); + +extern bool +ir_has_call(ir_instruction *ir); + +extern void +do_set_program_inouts(exec_list *instructions, struct gl_program *prog); + +#endif /* IR_H */ diff --git a/mesalib/src/glsl/ir_algebraic.cpp b/mesalib/src/glsl/ir_algebraic.cpp new file mode 100644 index 000000000..2ed66db47 --- /dev/null +++ b/mesalib/src/glsl/ir_algebraic.cpp @@ -0,0 +1,474 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_algebraic.cpp + * + * Takes advantage of association, commutivity, and other algebraic + * properties to simplify expressions. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +/** + * Visitor class for replacing expressions with ir_constant values. + */ + +class ir_algebraic_visitor : public ir_rvalue_visitor { +public: + ir_algebraic_visitor() + { + this->progress = false; + this->mem_ctx = NULL; + } + + virtual ~ir_algebraic_visitor() + { + } + + ir_rvalue *handle_expression(ir_expression *ir); + void handle_rvalue(ir_rvalue **rvalue); + bool reassociate_constant(ir_expression *ir1, + int const_index, + ir_constant *constant, + ir_expression *ir2); + void reassociate_operands(ir_expression *ir1, + int op1, + ir_expression *ir2, + int op2); + ir_rvalue *swizzle_if_required(ir_expression *expr, + ir_rvalue *operand); + + void *mem_ctx; + + bool progress; +}; + +static bool +is_vec_zero(ir_constant *ir) +{ + int c; + + if (!ir) + return false; + if (!ir->type->is_scalar() && + !ir->type->is_vector()) + return false; + + for (c = 0; c < ir->type->vector_elements; c++) { + switch (ir->type->base_type) { + case GLSL_TYPE_FLOAT: + if (ir->value.f[c] != 0.0) + return false; + break; + case GLSL_TYPE_INT: + if (ir->value.i[c] != 0) + return false; + break; + case GLSL_TYPE_UINT: + if (ir->value.u[c] != 0) + return false; + break; + case GLSL_TYPE_BOOL: + if (ir->value.b[c] != false) + return false; + break; + default: + assert(!"bad base type"); + return false; + } + } + + return true; +} + +static bool +is_vec_one(ir_constant *ir) +{ + int c; + + if (!ir) + return false; + if (!ir->type->is_scalar() && + !ir->type->is_vector()) + return false; + + for (c = 0; c < ir->type->vector_elements; c++) { + switch (ir->type->base_type) { + case GLSL_TYPE_FLOAT: + if (ir->value.f[c] != 1.0) + return false; + break; + case GLSL_TYPE_INT: + if (ir->value.i[c] != 1) + return false; + break; + case GLSL_TYPE_UINT: + if (ir->value.u[c] != 1) + return false; + break; + case GLSL_TYPE_BOOL: + if (ir->value.b[c] != true) + return false; + break; + default: + assert(!"bad base type"); + return false; + } + } + + return true; +} + +static void +update_type(ir_expression *ir) +{ + if (ir->operands[0]->type->is_vector()) + ir->type = ir->operands[0]->type; + else + ir->type = ir->operands[1]->type; +} + +void +ir_algebraic_visitor::reassociate_operands(ir_expression *ir1, + int op1, + ir_expression *ir2, + int op2) +{ + ir_rvalue *temp = ir2->operands[op2]; + ir2->operands[op2] = ir1->operands[op1]; + ir1->operands[op1] = temp; + + /* Update the type of ir2. The type of ir1 won't have changed -- + * base types matched, and at least one of the operands of the 2 + * binops is still a vector if any of them were. + */ + update_type(ir2); + + this->progress = true; +} + +/** + * Reassociates a constant down a tree of adds or multiplies. + * + * Consider (2 * (a * (b * 0.5))). We want to send up with a * b. + */ +bool +ir_algebraic_visitor::reassociate_constant(ir_expression *ir1, int const_index, + ir_constant *constant, + ir_expression *ir2) +{ + if (!ir2 || ir1->operation != ir2->operation) + return false; + + /* Don't want to even think about matrices. */ + if (ir1->operands[0]->type->is_matrix() || + ir1->operands[0]->type->is_matrix() || + ir2->operands[1]->type->is_matrix() || + ir2->operands[1]->type->is_matrix()) + return false; + + ir_constant *ir2_const[2]; + ir2_const[0] = ir2->operands[0]->constant_expression_value(); + ir2_const[1] = ir2->operands[1]->constant_expression_value(); + + if (ir2_const[0] && ir2_const[1]) + return false; + + if (ir2_const[0]) { + reassociate_operands(ir1, const_index, ir2, 1); + return true; + } else if (ir2_const[1]) { + reassociate_operands(ir1, const_index, ir2, 0); + return true; + } + + if (reassociate_constant(ir1, const_index, constant, + ir2->operands[0]->as_expression())) { + update_type(ir2); + return true; + } + + if (reassociate_constant(ir1, const_index, constant, + ir2->operands[1]->as_expression())) { + update_type(ir2); + return true; + } + + return false; +} + +/* When eliminating an expression and just returning one of its operands, + * we may need to swizzle that operand out to a vector if the expression was + * vector type. + */ +ir_rvalue * +ir_algebraic_visitor::swizzle_if_required(ir_expression *expr, + ir_rvalue *operand) +{ + if (expr->type->is_vector() && operand->type->is_scalar()) { + return new(mem_ctx) ir_swizzle(operand, 0, 0, 0, 0, + expr->type->vector_elements); + } else + return operand; +} + +ir_rvalue * +ir_algebraic_visitor::handle_expression(ir_expression *ir) +{ + ir_constant *op_const[2] = {NULL, NULL}; + ir_expression *op_expr[2] = {NULL, NULL}; + ir_expression *temp; + unsigned int i; + + for (i = 0; i < ir->get_num_operands(); i++) { + if (ir->operands[i]->type->is_matrix()) + return ir; + + op_const[i] = ir->operands[i]->constant_expression_value(); + op_expr[i] = ir->operands[i]->as_expression(); + } + + if (this->mem_ctx == NULL) + this->mem_ctx = talloc_parent(ir); + + switch (ir->operation) { + case ir_unop_logic_not: { + enum ir_expression_operation new_op = ir_unop_logic_not; + + if (op_expr[0] == NULL) + break; + + switch (op_expr[0]->operation) { + case ir_binop_less: new_op = ir_binop_gequal; break; + case ir_binop_greater: new_op = ir_binop_lequal; break; + case ir_binop_lequal: new_op = ir_binop_greater; break; + case ir_binop_gequal: new_op = ir_binop_less; break; + case ir_binop_equal: new_op = ir_binop_nequal; break; + case ir_binop_nequal: new_op = ir_binop_equal; break; + case ir_binop_all_equal: new_op = ir_binop_any_nequal; break; + case ir_binop_any_nequal: new_op = ir_binop_all_equal; break; + + default: + /* The default case handler is here to silence a warning from GCC. + */ + break; + } + + if (new_op != ir_unop_logic_not) { + this->progress = true; + return new(mem_ctx) ir_expression(new_op, + ir->type, + op_expr[0]->operands[0], + op_expr[0]->operands[1]); + } + + break; + } + + case ir_binop_add: + if (is_vec_zero(op_const[0])) { + this->progress = true; + return swizzle_if_required(ir, ir->operands[1]); + } + if (is_vec_zero(op_const[1])) { + this->progress = true; + return swizzle_if_required(ir, ir->operands[0]); + } + + /* Reassociate addition of constants so that we can do constant + * folding. + */ + if (op_const[0] && !op_const[1]) + reassociate_constant(ir, 0, op_const[0], + ir->operands[1]->as_expression()); + if (op_const[1] && !op_const[0]) + reassociate_constant(ir, 1, op_const[1], + ir->operands[0]->as_expression()); + break; + + case ir_binop_sub: + if (is_vec_zero(op_const[0])) { + this->progress = true; + temp = new(mem_ctx) ir_expression(ir_unop_neg, + ir->operands[1]->type, + ir->operands[1], + NULL); + return swizzle_if_required(ir, temp); + } + if (is_vec_zero(op_const[1])) { + this->progress = true; + return swizzle_if_required(ir, ir->operands[0]); + } + break; + + case ir_binop_mul: + if (is_vec_one(op_const[0])) { + this->progress = true; + return swizzle_if_required(ir, ir->operands[1]); + } + if (is_vec_one(op_const[1])) { + this->progress = true; + return swizzle_if_required(ir, ir->operands[0]); + } + + if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) { + this->progress = true; + return ir_constant::zero(ir, ir->type); + } + + /* Reassociate multiplication of constants so that we can do + * constant folding. + */ + if (op_const[0] && !op_const[1]) + reassociate_constant(ir, 0, op_const[0], + ir->operands[1]->as_expression()); + if (op_const[1] && !op_const[0]) + reassociate_constant(ir, 1, op_const[1], + ir->operands[0]->as_expression()); + + break; + + case ir_binop_div: + if (is_vec_one(op_const[0]) && ir->type->base_type == GLSL_TYPE_FLOAT) { + this->progress = true; + temp = new(mem_ctx) ir_expression(ir_unop_rcp, + ir->operands[1]->type, + ir->operands[1], + NULL); + return swizzle_if_required(ir, temp); + } + if (is_vec_one(op_const[1])) { + this->progress = true; + return swizzle_if_required(ir, ir->operands[0]); + } + break; + + case ir_binop_logic_and: + /* FINISHME: Also simplify (a && a) to (a). */ + if (is_vec_one(op_const[0])) { + this->progress = true; + return ir->operands[1]; + } else if (is_vec_one(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } else if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) { + this->progress = true; + return ir_constant::zero(mem_ctx, ir->type); + } + break; + + case ir_binop_logic_xor: + /* FINISHME: Also simplify (a ^^ a) to (false). */ + if (is_vec_zero(op_const[0])) { + this->progress = true; + return ir->operands[1]; + } else if (is_vec_zero(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } else if (is_vec_one(op_const[0])) { + this->progress = true; + return new(mem_ctx) ir_expression(ir_unop_logic_not, ir->type, + ir->operands[1], NULL); + } else if (is_vec_one(op_const[1])) { + this->progress = true; + return new(mem_ctx) ir_expression(ir_unop_logic_not, ir->type, + ir->operands[0], NULL); + } + break; + + case ir_binop_logic_or: + /* FINISHME: Also simplify (a || a) to (a). */ + if (is_vec_zero(op_const[0])) { + this->progress = true; + return ir->operands[1]; + } else if (is_vec_zero(op_const[1])) { + this->progress = true; + return ir->operands[0]; + } else if (is_vec_one(op_const[0]) || is_vec_one(op_const[1])) { + ir_constant_data data; + + for (unsigned i = 0; i < 16; i++) + data.b[i] = true; + + this->progress = true; + return new(mem_ctx) ir_constant(ir->type, &data); + } + break; + + case ir_unop_rcp: + if (op_expr[0] && op_expr[0]->operation == ir_unop_rcp) { + this->progress = true; + return op_expr[0]->operands[0]; + } + + /* FINISHME: We should do rcp(rsq(x)) -> sqrt(x) for some + * backends, except that some backends will have done sqrt -> + * rcp(rsq(x)) and we don't want to undo it for them. + */ + + /* As far as we know, all backends are OK with rsq. */ + if (op_expr[0] && op_expr[0]->operation == ir_unop_sqrt) { + this->progress = true; + temp = new(mem_ctx) ir_expression(ir_unop_rsq, + op_expr[0]->operands[0]->type, + op_expr[0]->operands[0], + NULL); + return swizzle_if_required(ir, temp); + } + + break; + + default: + break; + } + + return ir; +} + +void +ir_algebraic_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_expression *expr = (*rvalue)->as_expression(); + if (!expr) + return; + + *rvalue = handle_expression(expr); +} + +bool +do_algebraic(exec_list *instructions) +{ + ir_algebraic_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/ir_basic_block.cpp b/mesalib/src/glsl/ir_basic_block.cpp new file mode 100644 index 000000000..a83382596 --- /dev/null +++ b/mesalib/src/glsl/ir_basic_block.cpp @@ -0,0 +1,149 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_basic_block.cpp + * + * Basic block analysis of instruction streams. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_basic_block.h" +#include "glsl_types.h" + +class ir_has_call_visitor : public ir_hierarchical_visitor { +public: + ir_has_call_visitor() + { + has_call = false; + } + + virtual ir_visitor_status visit_enter(ir_call *ir) + { + (void) ir; + has_call = true; + return visit_stop; + } + + bool has_call; +}; + +bool +ir_has_call(ir_instruction *ir) +{ + ir_has_call_visitor v; + ir->accept(&v); + return v.has_call; +} + +/** + * Calls a user function for every basic block in the instruction stream. + * + * Basic block analysis is pretty easy in our IR thanks to the lack of + * unstructured control flow. We've got: + * + * ir_loop (for () {}, while () {}, do {} while ()) + * ir_loop_jump ( + * ir_if () {} + * ir_return + * ir_call() + * + * Note that the basic blocks returned by this don't encompass all + * operations performed by the program -- for example, if conditions + * don't get returned, nor do the assignments that will be generated + * for ir_call parameters. + */ +void call_for_basic_blocks(exec_list *instructions, + void (*callback)(ir_instruction *first, + ir_instruction *last, + void *data), + void *data) +{ + ir_instruction *leader = NULL; + ir_instruction *last = NULL; + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_if *ir_if; + ir_loop *ir_loop; + ir_function *ir_function; + + if (!leader) + leader = ir; + + if ((ir_if = ir->as_if())) { + callback(leader, ir, data); + leader = NULL; + + call_for_basic_blocks(&ir_if->then_instructions, callback, data); + call_for_basic_blocks(&ir_if->else_instructions, callback, data); + } else if ((ir_loop = ir->as_loop())) { + callback(leader, ir, data); + leader = NULL; + call_for_basic_blocks(&ir_loop->body_instructions, callback, data); + } else if (ir->as_return() || ir->as_call()) { + callback(leader, ir, data); + leader = NULL; + } else if ((ir_function = ir->as_function())) { + /* A function definition doesn't interrupt our basic block + * since execution doesn't go into it. We should process the + * bodies of its signatures for BBs, though. + * + * Note that we miss an opportunity for producing more + * maximal BBs between the instructions that precede main() + * and the body of main(). Perhaps those instructions ought + * to live inside of main(). + */ + foreach_iter(exec_list_iterator, fun_iter, *ir_function) { + ir_function_signature *ir_sig; + + ir_sig = (ir_function_signature *)fun_iter.get(); + + call_for_basic_blocks(&ir_sig->body, callback, data); + } + } else if (ir->as_assignment()) { + /* If there's a call in the expression tree being assigned, + * then that ends the BB too. + * + * The assumption is that any consumer of the basic block + * walker is fine with the fact that the call is somewhere in + * the tree even if portions of the tree may be evaluated + * after the call. + * + * A consumer that has an issue with this could not process + * the last instruction of the basic block. If doing so, + * expression flattener may be useful before using the basic + * block finder to get more maximal basic blocks out. + */ + if (ir_has_call(ir)) { + callback(leader, ir, data); + leader = NULL; + } + } + last = ir; + } + if (leader) { + callback(leader, last, data); + } +} diff --git a/mesalib/src/glsl/ir_basic_block.h b/mesalib/src/glsl/ir_basic_block.h new file mode 100644 index 000000000..dbd678b5c --- /dev/null +++ b/mesalib/src/glsl/ir_basic_block.h @@ -0,0 +1,28 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +void call_for_basic_blocks(exec_list *instructions, + void (*callback)(ir_instruction *first, + ir_instruction *last, + void *data), + void *data); diff --git a/mesalib/src/glsl/ir_clone.cpp b/mesalib/src/glsl/ir_clone.cpp new file mode 100644 index 000000000..18543a35a --- /dev/null +++ b/mesalib/src/glsl/ir_clone.cpp @@ -0,0 +1,405 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <string.h> +#include "ir.h" +#include "glsl_types.h" +extern "C" { +#include "program/hash_table.h" +} + +/** + * Duplicate an IR variable + * + * \note + * This will probably be made \c virtual and moved to the base class + * eventually. + */ +ir_variable * +ir_variable::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_variable *var = new(mem_ctx) ir_variable(this->type, this->name, + (ir_variable_mode) this->mode); + + var->max_array_access = this->max_array_access; + var->read_only = this->read_only; + var->centroid = this->centroid; + var->invariant = this->invariant; + var->interpolation = this->interpolation; + var->array_lvalue = this->array_lvalue; + var->location = this->location; + var->warn_extension = this->warn_extension; + var->origin_upper_left = this->origin_upper_left; + var->pixel_center_integer = this->pixel_center_integer; + + if (this->constant_value) + var->constant_value = this->constant_value->clone(mem_ctx, ht); + + if (ht) { + hash_table_insert(ht, var, (void *)const_cast<ir_variable *>(this)); + } + + return var; +} + +ir_swizzle * +ir_swizzle::clone(void *mem_ctx, struct hash_table *ht) const +{ + return new(mem_ctx) ir_swizzle(this->val->clone(mem_ctx, ht), this->mask); +} + +ir_return * +ir_return::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_rvalue *new_value = NULL; + + if (this->value) + new_value = this->value->clone(mem_ctx, ht); + + return new(mem_ctx) ir_return(new_value); +} + +ir_discard * +ir_discard::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_rvalue *new_condition = NULL; + + if (this->condition != NULL) + new_condition = this->condition->clone(mem_ctx, ht); + + return new(mem_ctx) ir_discard(new_condition); +} + +ir_loop_jump * +ir_loop_jump::clone(void *mem_ctx, struct hash_table *ht) const +{ + (void)ht; + + return new(mem_ctx) ir_loop_jump(this->mode); +} + +ir_if * +ir_if::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_if *new_if = new(mem_ctx) ir_if(this->condition->clone(mem_ctx, ht)); + + foreach_iter(exec_list_iterator, iter, this->then_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + new_if->then_instructions.push_tail(ir->clone(mem_ctx, ht)); + } + + foreach_iter(exec_list_iterator, iter, this->else_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + new_if->else_instructions.push_tail(ir->clone(mem_ctx, ht)); + } + + return new_if; +} + +ir_loop * +ir_loop::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_loop *new_loop = new(mem_ctx) ir_loop(); + + if (this->from) + new_loop->from = this->from->clone(mem_ctx, ht); + if (this->to) + new_loop->to = this->to->clone(mem_ctx, ht); + if (this->increment) + new_loop->increment = this->increment->clone(mem_ctx, ht); + new_loop->counter = counter; + + foreach_iter(exec_list_iterator, iter, this->body_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + new_loop->body_instructions.push_tail(ir->clone(mem_ctx, ht)); + } + + new_loop->cmp = this->cmp; + return new_loop; +} + +ir_call * +ir_call::clone(void *mem_ctx, struct hash_table *ht) const +{ + if (this->type == glsl_type::error_type) + return ir_call::get_error_instruction(mem_ctx); + + exec_list new_parameters; + + foreach_iter(exec_list_iterator, iter, this->actual_parameters) { + ir_instruction *ir = (ir_instruction *)iter.get(); + new_parameters.push_tail(ir->clone(mem_ctx, ht)); + } + + return new(mem_ctx) ir_call(this->callee, &new_parameters); +} + +ir_expression * +ir_expression::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_rvalue *op[2] = {NULL, NULL}; + unsigned int i; + + for (i = 0; i < get_num_operands(); i++) { + op[i] = this->operands[i]->clone(mem_ctx, ht); + } + + return new(mem_ctx) ir_expression(this->operation, this->type, op[0], op[1]); +} + +ir_dereference_variable * +ir_dereference_variable::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_variable *new_var; + + if (ht) { + new_var = (ir_variable *)hash_table_find(ht, this->var); + if (!new_var) + new_var = this->var; + } else { + new_var = this->var; + } + + return new(mem_ctx) ir_dereference_variable(new_var); +} + +ir_dereference_array * +ir_dereference_array::clone(void *mem_ctx, struct hash_table *ht) const +{ + return new(mem_ctx) ir_dereference_array(this->array->clone(mem_ctx, ht), + this->array_index->clone(mem_ctx, + ht)); +} + +ir_dereference_record * +ir_dereference_record::clone(void *mem_ctx, struct hash_table *ht) const +{ + return new(mem_ctx) ir_dereference_record(this->record->clone(mem_ctx, ht), + this->field); +} + +ir_texture * +ir_texture::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_texture *new_tex = new(mem_ctx) ir_texture(this->op); + new_tex->type = this->type; + + new_tex->sampler = this->sampler->clone(mem_ctx, ht); + new_tex->coordinate = this->coordinate->clone(mem_ctx, ht); + if (this->projector) + new_tex->projector = this->projector->clone(mem_ctx, ht); + if (this->shadow_comparitor) { + new_tex->shadow_comparitor = this->shadow_comparitor->clone(mem_ctx, ht); + } + + for (int i = 0; i < 3; i++) + new_tex->offsets[i] = this->offsets[i]; + + switch (this->op) { + case ir_tex: + break; + case ir_txb: + new_tex->lod_info.bias = this->lod_info.bias->clone(mem_ctx, ht); + break; + case ir_txl: + case ir_txf: + new_tex->lod_info.lod = this->lod_info.lod->clone(mem_ctx, ht); + break; + case ir_txd: + new_tex->lod_info.grad.dPdx = this->lod_info.grad.dPdx->clone(mem_ctx, ht); + new_tex->lod_info.grad.dPdy = this->lod_info.grad.dPdy->clone(mem_ctx, ht); + break; + } + + return new_tex; +} + +ir_assignment * +ir_assignment::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_rvalue *new_condition = NULL; + + if (this->condition) + new_condition = this->condition->clone(mem_ctx, ht); + + return new(mem_ctx) ir_assignment(this->lhs->clone(mem_ctx, ht), + this->rhs->clone(mem_ctx, ht), + new_condition, + this->write_mask); +} + +ir_function * +ir_function::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_function *copy = new(mem_ctx) ir_function(this->name); + + foreach_list_const(node, &this->signatures) { + const ir_function_signature *const sig = + (const ir_function_signature *const) node; + + ir_function_signature *sig_copy = sig->clone(mem_ctx, ht); + copy->add_signature(sig_copy); + + if (ht != NULL) + hash_table_insert(ht, sig_copy, + (void *)const_cast<ir_function_signature *>(sig)); + } + + return copy; +} + +ir_function_signature * +ir_function_signature::clone(void *mem_ctx, struct hash_table *ht) const +{ + ir_function_signature *copy = + new(mem_ctx) ir_function_signature(this->return_type); + + copy->is_defined = this->is_defined; + copy->is_builtin = this->is_builtin; + + /* Clone the parameter list. + */ + foreach_list_const(node, &this->parameters) { + const ir_variable *const param = (const ir_variable *) node; + + assert(const_cast<ir_variable *>(param)->as_variable() != NULL); + + ir_variable *const param_copy = param->clone(mem_ctx, ht); + copy->parameters.push_tail(param_copy); + } + + /* Clone the instruction list. + */ + foreach_list_const(node, &this->body) { + const ir_instruction *const inst = (const ir_instruction *) node; + + ir_instruction *const inst_copy = inst->clone(mem_ctx, ht); + copy->body.push_tail(inst_copy); + } + + return copy; +} + +ir_constant * +ir_constant::clone(void *mem_ctx, struct hash_table *ht) const +{ + (void)ht; + + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + return new(mem_ctx) ir_constant(this->type, &this->value); + + case GLSL_TYPE_STRUCT: { + ir_constant *c = new(mem_ctx) ir_constant; + + c->type = this->type; + for (exec_node *node = this->components.head + ; !node->is_tail_sentinel() + ; node = node->next) { + ir_constant *const orig = (ir_constant *) node; + + c->components.push_tail(orig->clone(mem_ctx, NULL)); + } + + return c; + } + + case GLSL_TYPE_ARRAY: { + ir_constant *c = new(mem_ctx) ir_constant; + + c->type = this->type; + c->array_elements = talloc_array(c, ir_constant *, this->type->length); + for (unsigned i = 0; i < this->type->length; i++) { + c->array_elements[i] = this->array_elements[i]->clone(mem_ctx, NULL); + } + return c; + } + + default: + assert(!"Should not get here."); + return NULL; + } +} + + +class fixup_ir_call_visitor : public ir_hierarchical_visitor { +public: + fixup_ir_call_visitor(struct hash_table *ht) + { + this->ht = ht; + } + + virtual ir_visitor_status visit_enter(ir_call *ir) + { + /* Try to find the function signature referenced by the ir_call in the + * table. If it is found, replace it with the value from the table. + */ + ir_function_signature *sig = + (ir_function_signature *) hash_table_find(this->ht, ir->get_callee()); + if (sig != NULL) + ir->set_callee(sig); + + /* Since this may be used before function call parameters are flattened, + * the children also need to be processed. + */ + return visit_continue; + } + +private: + struct hash_table *ht; +}; + + +static void +fixup_function_calls(struct hash_table *ht, exec_list *instructions) +{ + fixup_ir_call_visitor v(ht); + v.run(instructions); +} + + +void +clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in) +{ + struct hash_table *ht = + hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); + + foreach_list_const(node, in) { + const ir_instruction *const original = (ir_instruction *) node; + ir_instruction *copy = original->clone(mem_ctx, ht); + + out->push_tail(copy); + } + + /* Make a pass over the cloned tree to fix up ir_call nodes to point to the + * cloned ir_function_signature nodes. This cannot be done automatically + * during cloning because the ir_call might be a forward reference (i.e., + * the function signature that it references may not have been cloned yet). + */ + fixup_function_calls(ht, out); + + hash_table_dtor(ht); +} diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp new file mode 100644 index 000000000..61a708f6e --- /dev/null +++ b/mesalib/src/glsl/ir_constant_expression.cpp @@ -0,0 +1,1194 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_constant_expression.cpp + * Evaluate and process constant valued expressions + * + * In GLSL, constant valued expressions are used in several places. These + * must be processed and evaluated very early in the compilation process. + * + * * Sizes of arrays + * * Initializers for uniforms + * * Initializers for \c const variables + */ + +#include <math.h> +#include "main/core.h" /* for MAX2, MIN2, CLAMP */ +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" + +static float +dot(ir_constant *op0, ir_constant *op1) +{ + assert(op0->type->is_float() && op1->type->is_float()); + + float result = 0; + for (unsigned c = 0; c < op0->type->components(); c++) + result += op0->value.f[c] * op1->value.f[c]; + + return result; +} + +ir_constant * +ir_expression::constant_expression_value() +{ + ir_constant *op[2] = { NULL, NULL }; + ir_constant_data data; + + memset(&data, 0, sizeof(data)); + + for (unsigned operand = 0; operand < this->get_num_operands(); operand++) { + op[operand] = this->operands[operand]->constant_expression_value(); + if (!op[operand]) + return NULL; + } + + if (op[1] != NULL) + assert(op[0]->type->base_type == op[1]->type->base_type); + + bool op0_scalar = op[0]->type->is_scalar(); + bool op1_scalar = op[1] != NULL && op[1]->type->is_scalar(); + + /* When iterating over a vector or matrix's components, we want to increase + * the loop counter. However, for scalars, we want to stay at 0. + */ + unsigned c0_inc = op0_scalar ? 0 : 1; + unsigned c1_inc = op1_scalar ? 0 : 1; + unsigned components; + if (op1_scalar || !op[1]) { + components = op[0]->type->components(); + } else { + components = op[1]->type->components(); + } + + void *ctx = talloc_parent(this); + + /* Handle array operations here, rather than below. */ + if (op[0]->type->is_array()) { + assert(op[1] != NULL && op[1]->type->is_array()); + switch (this->operation) { + case ir_binop_all_equal: + return new(ctx) ir_constant(op[0]->has_value(op[1])); + case ir_binop_any_nequal: + return new(ctx) ir_constant(!op[0]->has_value(op[1])); + default: + break; + } + return NULL; + } + + switch (this->operation) { + case ir_unop_logic_not: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.b[c] = !op[0]->value.b[c]; + break; + + case ir_unop_f2i: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.i[c] = op[0]->value.f[c]; + } + break; + case ir_unop_i2f: + assert(op[0]->type->base_type == GLSL_TYPE_INT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = op[0]->value.i[c]; + } + break; + case ir_unop_u2f: + assert(op[0]->type->base_type == GLSL_TYPE_UINT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = op[0]->value.u[c]; + } + break; + case ir_unop_b2f: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = op[0]->value.b[c] ? 1.0 : 0.0; + } + break; + case ir_unop_f2b: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.b[c] = bool(op[0]->value.f[c]); + } + break; + case ir_unop_b2i: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.u[c] = op[0]->value.b[c] ? 1 : 0; + } + break; + case ir_unop_i2b: + assert(op[0]->type->is_integer()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.b[c] = bool(op[0]->value.u[c]); + } + break; + + case ir_unop_any: + assert(op[0]->type->is_boolean()); + data.b[0] = false; + for (unsigned c = 0; c < op[0]->type->components(); c++) { + if (op[0]->value.b[c]) + data.b[0] = true; + } + break; + + case ir_unop_trunc: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = truncf(op[0]->value.f[c]); + } + break; + + case ir_unop_ceil: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = ceilf(op[0]->value.f[c]); + } + break; + + case ir_unop_floor: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = floorf(op[0]->value.f[c]); + } + break; + + case ir_unop_fract: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = 0; + break; + case GLSL_TYPE_INT: + data.i[c] = 0; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c] - floor(op[0]->value.f[c]); + break; + default: + assert(0); + } + } + break; + + case ir_unop_sin: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = sinf(op[0]->value.f[c]); + } + break; + + case ir_unop_cos: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = cosf(op[0]->value.f[c]); + } + break; + + case ir_unop_neg: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = -op[0]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = -op[0]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = -op[0]->value.f[c]; + break; + default: + assert(0); + } + } + break; + + case ir_unop_abs: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c]; + if (data.i[c] < 0) + data.i[c] = -data.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = fabs(op[0]->value.f[c]); + break; + default: + assert(0); + } + } + break; + + case ir_unop_sign: + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.i[c] > 0; + break; + case GLSL_TYPE_INT: + data.i[c] = (op[0]->value.i[c] > 0) - (op[0]->value.i[c] < 0); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = float((op[0]->value.f[c] > 0)-(op[0]->value.f[c] < 0)); + break; + default: + assert(0); + } + } + break; + + case ir_unop_rcp: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (this->type->base_type) { + case GLSL_TYPE_UINT: + if (op[0]->value.u[c] != 0.0) + data.u[c] = 1 / op[0]->value.u[c]; + break; + case GLSL_TYPE_INT: + if (op[0]->value.i[c] != 0.0) + data.i[c] = 1 / op[0]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + if (op[0]->value.f[c] != 0.0) + data.f[c] = 1.0 / op[0]->value.f[c]; + break; + default: + assert(0); + } + } + break; + + case ir_unop_rsq: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = 1.0 / sqrtf(op[0]->value.f[c]); + } + break; + + case ir_unop_sqrt: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = sqrtf(op[0]->value.f[c]); + } + break; + + case ir_unop_exp: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = expf(op[0]->value.f[c]); + } + break; + + case ir_unop_exp2: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = exp2f(op[0]->value.f[c]); + } + break; + + case ir_unop_log: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = logf(op[0]->value.f[c]); + } + break; + + case ir_unop_log2: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = log2f(op[0]->value.f[c]); + } + break; + + case ir_unop_dFdx: + case ir_unop_dFdy: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = 0.0; + } + break; + + case ir_binop_pow: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + data.f[c] = powf(op[0]->value.f[c], op[1]->value.f[c]); + } + break; + + case ir_binop_dot: + data.f[0] = dot(op[0], op[1]); + break; + + case ir_binop_min: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = MIN2(op[0]->value.u[c0], op[1]->value.u[c1]); + break; + case GLSL_TYPE_INT: + data.i[c] = MIN2(op[0]->value.i[c0], op[1]->value.i[c1]); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = MIN2(op[0]->value.f[c0], op[1]->value.f[c1]); + break; + default: + assert(0); + } + } + + break; + case ir_binop_max: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = MAX2(op[0]->value.u[c0], op[1]->value.u[c1]); + break; + case GLSL_TYPE_INT: + data.i[c] = MAX2(op[0]->value.i[c0], op[1]->value.i[c1]); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = MAX2(op[0]->value.f[c0], op[1]->value.f[c1]); + break; + default: + assert(0); + } + } + break; + + case ir_binop_cross: + assert(op[0]->type == glsl_type::vec3_type); + assert(op[1]->type == glsl_type::vec3_type); + data.f[0] = (op[0]->value.f[1] * op[1]->value.f[2] - + op[1]->value.f[1] * op[0]->value.f[2]); + data.f[1] = (op[0]->value.f[2] * op[1]->value.f[0] - + op[1]->value.f[2] * op[0]->value.f[0]); + data.f[2] = (op[0]->value.f[0] * op[1]->value.f[1] - + op[1]->value.f[0] * op[0]->value.f[1]); + break; + + case ir_binop_add: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] + op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] + op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] + op[1]->value.f[c1]; + break; + default: + assert(0); + } + } + + break; + case ir_binop_sub: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] - op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] - op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1]; + break; + default: + assert(0); + } + } + + break; + case ir_binop_mul: + /* Check for equal types, or unequal types involving scalars */ + if ((op[0]->type == op[1]->type && !op[0]->type->is_matrix()) + || op0_scalar || op1_scalar) { + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] * op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] * op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] * op[1]->value.f[c1]; + break; + default: + assert(0); + } + } + } else { + assert(op[0]->type->is_matrix() || op[1]->type->is_matrix()); + + /* Multiply an N-by-M matrix with an M-by-P matrix. Since either + * matrix can be a GLSL vector, either N or P can be 1. + * + * For vec*mat, the vector is treated as a row vector. This + * means the vector is a 1-row x M-column matrix. + * + * For mat*vec, the vector is treated as a column vector. Since + * matrix_columns is 1 for vectors, this just works. + */ + const unsigned n = op[0]->type->is_vector() + ? 1 : op[0]->type->vector_elements; + const unsigned m = op[1]->type->vector_elements; + const unsigned p = op[1]->type->matrix_columns; + for (unsigned j = 0; j < p; j++) { + for (unsigned i = 0; i < n; i++) { + for (unsigned k = 0; k < m; k++) { + data.f[i+n*j] += op[0]->value.f[i+n*k]*op[1]->value.f[k+m*j]; + } + } + } + } + + break; + case ir_binop_div: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] / op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] / op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + data.f[c] = op[0]->value.f[c0] / op[1]->value.f[c1]; + break; + default: + assert(0); + } + } + + break; + case ir_binop_mod: + assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar); + for (unsigned c = 0, c0 = 0, c1 = 0; + c < components; + c0 += c0_inc, c1 += c1_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = op[0]->value.u[c0] % op[1]->value.u[c1]; + break; + case GLSL_TYPE_INT: + data.i[c] = op[0]->value.i[c0] % op[1]->value.i[c1]; + break; + case GLSL_TYPE_FLOAT: + /* We don't use fmod because it rounds toward zero; GLSL specifies + * the use of floor. + */ + data.f[c] = op[0]->value.f[c0] - op[1]->value.f[c1] + * floorf(op[0]->value.f[c0] / op[1]->value.f[c1]); + break; + default: + assert(0); + } + } + + break; + + case ir_binop_logic_and: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.b[c] = op[0]->value.b[c] && op[1]->value.b[c]; + break; + case ir_binop_logic_xor: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.b[c] = op[0]->value.b[c] ^ op[1]->value.b[c]; + break; + case ir_binop_logic_or: + assert(op[0]->type->base_type == GLSL_TYPE_BOOL); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.b[c] = op[0]->value.b[c] || op[1]->value.b[c]; + break; + + case ir_binop_less: + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]->value.u[0] < op[1]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.b[0] = op[0]->value.i[0] < op[1]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = op[0]->value.f[0] < op[1]->value.f[0]; + break; + default: + assert(0); + } + break; + case ir_binop_greater: + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]->value.u[0] > op[1]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.b[0] = op[0]->value.i[0] > op[1]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = op[0]->value.f[0] > op[1]->value.f[0]; + break; + default: + assert(0); + } + break; + case ir_binop_lequal: + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]->value.u[0] <= op[1]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.b[0] = op[0]->value.i[0] <= op[1]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = op[0]->value.f[0] <= op[1]->value.f[0]; + break; + default: + assert(0); + } + break; + case ir_binop_gequal: + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[0] = op[0]->value.u[0] >= op[1]->value.u[0]; + break; + case GLSL_TYPE_INT: + data.b[0] = op[0]->value.i[0] >= op[1]->value.i[0]; + break; + case GLSL_TYPE_FLOAT: + data.b[0] = op[0]->value.f[0] >= op[1]->value.f[0]; + break; + default: + assert(0); + } + break; + case ir_binop_equal: + assert(op[0]->type == op[1]->type); + for (unsigned c = 0; c < components; c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] == op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] == op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] == op[1]->value.f[c]; + break; + default: + assert(0); + } + } + break; + case ir_binop_nequal: + assert(op[0]->type != op[1]->type); + for (unsigned c = 0; c < components; c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] != op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] != op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] != op[1]->value.f[c]; + break; + default: + assert(0); + } + } + break; + case ir_binop_all_equal: + data.b[0] = op[0]->has_value(op[1]); + break; + case ir_binop_any_nequal: + data.b[0] = !op[0]->has_value(op[1]); + break; + + default: + /* FINISHME: Should handle all expression types. */ + return NULL; + } + + return new(ctx) ir_constant(this->type, &data); +} + + +ir_constant * +ir_texture::constant_expression_value() +{ + /* texture lookups aren't constant expressions */ + return NULL; +} + + +ir_constant * +ir_swizzle::constant_expression_value() +{ + ir_constant *v = this->val->constant_expression_value(); + + if (v != NULL) { + ir_constant_data data = { { 0 } }; + + const unsigned swiz_idx[4] = { + this->mask.x, this->mask.y, this->mask.z, this->mask.w + }; + + for (unsigned i = 0; i < this->mask.num_components; i++) { + switch (v->type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: data.u[i] = v->value.u[swiz_idx[i]]; break; + case GLSL_TYPE_FLOAT: data.f[i] = v->value.f[swiz_idx[i]]; break; + case GLSL_TYPE_BOOL: data.b[i] = v->value.b[swiz_idx[i]]; break; + default: assert(!"Should not get here."); break; + } + } + + void *ctx = talloc_parent(this); + return new(ctx) ir_constant(this->type, &data); + } + return NULL; +} + + +ir_constant * +ir_dereference_variable::constant_expression_value() +{ + /* This may occur during compile and var->type is glsl_type::error_type */ + if (!var) + return NULL; + + /* The constant_value of a uniform variable is its initializer, + * not the lifetime constant value of the uniform. + */ + if (var->mode == ir_var_uniform) + return NULL; + + if (!var->constant_value) + return NULL; + + return var->constant_value->clone(talloc_parent(var), NULL); +} + + +ir_constant * +ir_dereference_array::constant_expression_value() +{ + ir_constant *array = this->array->constant_expression_value(); + ir_constant *idx = this->array_index->constant_expression_value(); + + if ((array != NULL) && (idx != NULL)) { + void *ctx = talloc_parent(this); + if (array->type->is_matrix()) { + /* Array access of a matrix results in a vector. + */ + const unsigned column = idx->value.u[0]; + + const glsl_type *const column_type = array->type->column_type(); + + /* Offset in the constant matrix to the first element of the column + * to be extracted. + */ + const unsigned mat_idx = column * column_type->vector_elements; + + ir_constant_data data; + + switch (column_type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + for (unsigned i = 0; i < column_type->vector_elements; i++) + data.u[i] = array->value.u[mat_idx + i]; + + break; + + case GLSL_TYPE_FLOAT: + for (unsigned i = 0; i < column_type->vector_elements; i++) + data.f[i] = array->value.f[mat_idx + i]; + + break; + + default: + assert(!"Should not get here."); + break; + } + + return new(ctx) ir_constant(column_type, &data); + } else if (array->type->is_vector()) { + const unsigned component = idx->value.u[0]; + + return new(ctx) ir_constant(array, component); + } else { + const unsigned index = idx->value.u[0]; + return array->get_array_element(index)->clone(ctx, NULL); + } + } + return NULL; +} + + +ir_constant * +ir_dereference_record::constant_expression_value() +{ + ir_constant *v = this->record->constant_expression_value(); + + return (v != NULL) ? v->get_record_field(this->field) : NULL; +} + + +ir_constant * +ir_assignment::constant_expression_value() +{ + /* FINISHME: Handle CEs involving assignment (return RHS) */ + return NULL; +} + + +ir_constant * +ir_constant::constant_expression_value() +{ + return this; +} + + +ir_constant * +ir_call::constant_expression_value() +{ + if (this->type == glsl_type::error_type) + return NULL; + + /* From the GLSL 1.20 spec, page 23: + * "Function calls to user-defined functions (non-built-in functions) + * cannot be used to form constant expressions." + */ + if (!this->callee->is_builtin) + return NULL; + + unsigned num_parameters = 0; + + /* Check if all parameters are constant */ + ir_constant *op[3]; + foreach_list(n, &this->actual_parameters) { + ir_constant *constant = ((ir_rvalue *) n)->constant_expression_value(); + if (constant == NULL) + return NULL; + + op[num_parameters] = constant; + + assert(num_parameters < 3); + num_parameters++; + } + + /* Individual cases below can either: + * - Assign "expr" a new ir_expression to evaluate (for basic opcodes) + * - Fill "data" with appopriate constant data + * - Return an ir_constant directly. + */ + void *mem_ctx = talloc_parent(this); + ir_expression *expr = NULL; + + ir_constant_data data; + memset(&data, 0, sizeof(data)); + + const char *callee = this->callee_name(); + if (strcmp(callee, "abs") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_abs, type, op[0], NULL); + } else if (strcmp(callee, "all") == 0) { + assert(op[0]->type->is_boolean()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + if (!op[0]->value.b[c]) + return new(mem_ctx) ir_constant(false); + } + return new(mem_ctx) ir_constant(true); + } else if (strcmp(callee, "any") == 0) { + assert(op[0]->type->is_boolean()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + if (op[0]->value.b[c]) + return new(mem_ctx) ir_constant(true); + } + return new(mem_ctx) ir_constant(false); + } else if (strcmp(callee, "acos") == 0) { + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = acosf(op[0]->value.f[c]); + } else if (strcmp(callee, "asin") == 0) { + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = asinf(op[0]->value.f[c]); + } else if (strcmp(callee, "atan") == 0) { + assert(op[0]->type->is_float()); + if (num_parameters == 2) { + assert(op[1]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = atan2f(op[0]->value.f[c], op[1]->value.f[c]); + } else { + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = atanf(op[0]->value.f[c]); + } + } else if (strcmp(callee, "dFdx") == 0 || strcmp(callee, "dFdy") == 0) { + return ir_constant::zero(mem_ctx, this->type); + } else if (strcmp(callee, "ceil") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_ceil, type, op[0], NULL); + } else if (strcmp(callee, "clamp") == 0) { + assert(num_parameters == 3); + unsigned c1_inc = op[1]->type->is_scalar() ? 0 : 1; + unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1; + for (unsigned c = 0, c1 = 0, c2 = 0; + c < op[0]->type->components(); + c1 += c1_inc, c2 += c2_inc, c++) { + + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.u[c] = CLAMP(op[0]->value.u[c], op[1]->value.u[c1], + op[2]->value.u[c2]); + break; + case GLSL_TYPE_INT: + data.i[c] = CLAMP(op[0]->value.i[c], op[1]->value.i[c1], + op[2]->value.i[c2]); + break; + case GLSL_TYPE_FLOAT: + data.f[c] = CLAMP(op[0]->value.f[c], op[1]->value.f[c1], + op[2]->value.f[c2]); + break; + default: + assert(!"Should not get here."); + } + } + } else if (strcmp(callee, "cos") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_cos, type, op[0], NULL); + } else if (strcmp(callee, "cosh") == 0) { + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = coshf(op[0]->value.f[c]); + } else if (strcmp(callee, "cross") == 0) { + expr = new(mem_ctx) ir_expression(ir_binop_cross, type, op[0], op[1]); + } else if (strcmp(callee, "degrees") == 0) { + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = 180.0/M_PI * op[0]->value.f[c]; + } else if (strcmp(callee, "distance") == 0) { + assert(op[0]->type->is_float() && op[1]->type->is_float()); + float length_squared = 0.0; + for (unsigned c = 0; c < op[0]->type->components(); c++) { + float t = op[0]->value.f[c] - op[1]->value.f[c]; + length_squared += t * t; + } + return new(mem_ctx) ir_constant(sqrtf(length_squared)); + } else if (strcmp(callee, "dot") == 0) { + return new(mem_ctx) ir_constant(dot(op[0], op[1])); + } else if (strcmp(callee, "equal") == 0) { + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] == op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] == op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] == op[1]->value.f[c]; + break; + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] == op[1]->value.b[c]; + break; + default: + assert(!"Should not get here."); + } + } + } else if (strcmp(callee, "exp") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_exp, type, op[0], NULL); + } else if (strcmp(callee, "exp2") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_exp2, type, op[0], NULL); + } else if (strcmp(callee, "faceforward") == 0) { + if (dot(op[2], op[1]) < 0) + return op[0]; + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = -op[0]->value.f[c]; + } else if (strcmp(callee, "floor") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_floor, type, op[0], NULL); + } else if (strcmp(callee, "fract") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_fract, type, op[0], NULL); + } else if (strcmp(callee, "fwidth") == 0) { + return ir_constant::zero(mem_ctx, this->type); + } else if (strcmp(callee, "greaterThan") == 0) { + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] > op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] > op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] > op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } + } else if (strcmp(callee, "greaterThanEqual") == 0) { + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] >= op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] >= op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] >= op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } + } else if (strcmp(callee, "inversesqrt") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_rsq, type, op[0], NULL); + } else if (strcmp(callee, "length") == 0) { + return new(mem_ctx) ir_constant(sqrtf(dot(op[0], op[0]))); + } else if (strcmp(callee, "lessThan") == 0) { + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] < op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] < op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] < op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } + } else if (strcmp(callee, "lessThanEqual") == 0) { + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] <= op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] <= op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] <= op[1]->value.f[c]; + break; + default: + assert(!"Should not get here."); + } + } + } else if (strcmp(callee, "log") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_log, type, op[0], NULL); + } else if (strcmp(callee, "log2") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_log2, type, op[0], NULL); + } else if (strcmp(callee, "matrixCompMult") == 0) { + assert(op[0]->type->is_float() && op[1]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = op[0]->value.f[c] * op[1]->value.f[c]; + } else if (strcmp(callee, "max") == 0) { + expr = new(mem_ctx) ir_expression(ir_binop_max, type, op[0], op[1]); + } else if (strcmp(callee, "min") == 0) { + expr = new(mem_ctx) ir_expression(ir_binop_min, type, op[0], op[1]); + } else if (strcmp(callee, "mix") == 0) { + assert(op[0]->type->is_float() && op[1]->type->is_float()); + if (op[2]->type->is_float()) { + unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1; + unsigned components = op[0]->type->components(); + for (unsigned c = 0, c2 = 0; c < components; c2 += c2_inc, c++) { + data.f[c] = op[0]->value.f[c] * (1 - op[2]->value.f[c2]) + + op[1]->value.f[c] * op[2]->value.f[c2]; + } + } else { + assert(op[2]->type->is_boolean()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = op[op[2]->value.b[c] ? 1 : 0]->value.f[c]; + } + } else if (strcmp(callee, "mod") == 0) { + expr = new(mem_ctx) ir_expression(ir_binop_mod, type, op[0], op[1]); + } else if (strcmp(callee, "normalize") == 0) { + assert(op[0]->type->is_float()); + float length = sqrtf(dot(op[0], op[0])); + + if (length == 0) + return ir_constant::zero(mem_ctx, this->type); + + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = op[0]->value.f[c] / length; + } else if (strcmp(callee, "not") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_logic_not, type, op[0], NULL); + } else if (strcmp(callee, "notEqual") == 0) { + assert(op[0]->type->is_vector() && op[1] && op[1]->type->is_vector()); + for (unsigned c = 0; c < op[0]->type->components(); c++) { + switch (op[0]->type->base_type) { + case GLSL_TYPE_UINT: + data.b[c] = op[0]->value.u[c] != op[1]->value.u[c]; + break; + case GLSL_TYPE_INT: + data.b[c] = op[0]->value.i[c] != op[1]->value.i[c]; + break; + case GLSL_TYPE_FLOAT: + data.b[c] = op[0]->value.f[c] != op[1]->value.f[c]; + break; + case GLSL_TYPE_BOOL: + data.b[c] = op[0]->value.b[c] != op[1]->value.b[c]; + break; + default: + assert(!"Should not get here."); + } + } + } else if (strcmp(callee, "outerProduct") == 0) { + assert(op[0]->type->is_vector() && op[1]->type->is_vector()); + const unsigned m = op[0]->type->vector_elements; + const unsigned n = op[1]->type->vector_elements; + for (unsigned j = 0; j < n; j++) { + for (unsigned i = 0; i < m; i++) { + data.f[i+m*j] = op[0]->value.f[i] * op[1]->value.f[j]; + } + } + } else if (strcmp(callee, "pow") == 0) { + expr = new(mem_ctx) ir_expression(ir_binop_pow, type, op[0], op[1]); + } else if (strcmp(callee, "radians") == 0) { + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = M_PI/180.0 * op[0]->value.f[c]; + } else if (strcmp(callee, "reflect") == 0) { + assert(op[0]->type->is_float()); + float dot_NI = dot(op[1], op[0]); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = op[0]->value.f[c] - 2 * dot_NI * op[1]->value.f[c]; + } else if (strcmp(callee, "refract") == 0) { + const float eta = op[2]->value.f[0]; + const float dot_NI = dot(op[1], op[0]); + const float k = 1.0 - eta * eta * (1.0 - dot_NI * dot_NI); + if (k < 0.0) { + return ir_constant::zero(mem_ctx, this->type); + } else { + for (unsigned c = 0; c < type->components(); c++) { + data.f[c] = eta * op[0]->value.f[c] - (eta * dot_NI + sqrtf(k)) + * op[1]->value.f[c]; + } + } + } else if (strcmp(callee, "sign") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_sign, type, op[0], NULL); + } else if (strcmp(callee, "sin") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_sin, type, op[0], NULL); + } else if (strcmp(callee, "sinh") == 0) { + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = sinhf(op[0]->value.f[c]); + } else if (strcmp(callee, "smoothstep") == 0) { + assert(num_parameters == 3); + assert(op[1]->type == op[0]->type); + unsigned edge_inc = op[0]->type->is_scalar() ? 0 : 1; + for (unsigned c = 0, e = 0; c < type->components(); e += edge_inc, c++) { + const float edge0 = op[0]->value.f[e]; + const float edge1 = op[1]->value.f[e]; + if (edge0 == edge1) { + data.f[c] = 0.0; /* Avoid a crash - results are undefined anyway */ + } else { + const float numerator = op[2]->value.f[c] - edge0; + const float denominator = edge1 - edge0; + const float t = CLAMP(numerator/denominator, 0, 1); + data.f[c] = t * t * (3 - 2 * t); + } + } + } else if (strcmp(callee, "sqrt") == 0) { + expr = new(mem_ctx) ir_expression(ir_unop_sqrt, type, op[0], NULL); + } else if (strcmp(callee, "step") == 0) { + assert(op[0]->type->is_float() && op[1]->type->is_float()); + /* op[0] (edge) may be either a scalar or a vector */ + const unsigned c0_inc = op[0]->type->is_scalar() ? 0 : 1; + for (unsigned c = 0, c0 = 0; c < type->components(); c0 += c0_inc, c++) + data.f[c] = (op[1]->value.f[c] < op[0]->value.f[c0]) ? 0.0 : 1.0; + } else if (strcmp(callee, "tan") == 0) { + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = tanf(op[0]->value.f[c]); + } else if (strcmp(callee, "tanh") == 0) { + assert(op[0]->type->is_float()); + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = tanhf(op[0]->value.f[c]); + } else if (strcmp(callee, "transpose") == 0) { + assert(op[0]->type->is_matrix()); + const unsigned n = op[0]->type->vector_elements; + const unsigned m = op[0]->type->matrix_columns; + for (unsigned j = 0; j < m; j++) { + for (unsigned i = 0; i < n; i++) { + data.f[m*i+j] += op[0]->value.f[i+n*j]; + } + } + } else { + /* Unsupported builtin - some are not allowed in constant expressions. */ + return NULL; + } + + if (expr != NULL) + return expr->constant_expression_value(); + + return new(mem_ctx) ir_constant(this->type, &data); +} diff --git a/mesalib/src/glsl/ir_constant_folding.cpp b/mesalib/src/glsl/ir_constant_folding.cpp new file mode 100644 index 000000000..554c54fae --- /dev/null +++ b/mesalib/src/glsl/ir_constant_folding.cpp @@ -0,0 +1,147 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_constant_folding.cpp + * Replace constant-valued expressions with references to constant values. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +/** + * Visitor class for replacing expressions with ir_constant values. + */ + +class ir_constant_folding_visitor : public ir_rvalue_visitor { +public: + ir_constant_folding_visitor() + { + this->progress = false; + } + + virtual ~ir_constant_folding_visitor() + { + /* empty */ + } + + virtual ir_visitor_status visit_enter(ir_assignment *ir); + virtual ir_visitor_status visit_enter(ir_call *ir); + + virtual void handle_rvalue(ir_rvalue **rvalue); + + bool progress; +}; + +void +ir_constant_folding_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (*rvalue == NULL || (*rvalue)->ir_type == ir_type_constant) + return; + + /* Note that we do rvalue visitoring on leaving. So if an + * expression has a non-constant operand, no need to go looking + * down it to find if it's constant. This cuts the time of this + * pass down drastically. + */ + ir_expression *expr = (*rvalue)->as_expression(); + if (expr) { + for (unsigned int i = 0; i < expr->get_num_operands(); i++) { + if (!expr->operands[i]->as_constant()) + return; + } + } + + ir_constant *constant = (*rvalue)->constant_expression_value(); + if (constant) { + *rvalue = constant; + this->progress = true; + } else { + (*rvalue)->accept(this); + } +} + +ir_visitor_status +ir_constant_folding_visitor::visit_enter(ir_assignment *ir) +{ + ir->rhs->accept(this); + handle_rvalue(&ir->rhs); + + if (ir->condition) { + ir->condition->accept(this); + handle_rvalue(&ir->condition); + + ir_constant *const_val = ir->condition->as_constant(); + /* If the condition is constant, either remove the condition or + * remove the never-executed assignment. + */ + if (const_val) { + if (const_val->value.b[0]) + ir->condition = NULL; + else + ir->remove(); + this->progress = true; + } + } + + /* Don't descend into the LHS because we want it to stay as a + * variable dereference. FINISHME: We probably should to get array + * indices though. + */ + return visit_continue_with_parent; +} + +ir_visitor_status +ir_constant_folding_visitor::visit_enter(ir_call *ir) +{ + exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param_rval = (ir_rvalue *)iter.get(); + ir_variable *sig_param = (ir_variable *)sig_iter.get(); + + if (sig_param->mode == ir_var_in) { + ir_rvalue *new_param = param_rval; + + handle_rvalue(&new_param); + if (new_param != param_rval) { + param_rval->replace_with(new_param); + } + } + sig_iter.next(); + } + + return visit_continue_with_parent; +} + +bool +do_constant_folding(exec_list *instructions) +{ + ir_constant_folding_visitor constant_folding; + + visit_list_elements(&constant_folding, instructions); + + return constant_folding.progress; +} diff --git a/mesalib/src/glsl/ir_constant_propagation.cpp b/mesalib/src/glsl/ir_constant_propagation.cpp new file mode 100644 index 000000000..5d875b7be --- /dev/null +++ b/mesalib/src/glsl/ir_constant_propagation.cpp @@ -0,0 +1,437 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * constant of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, constant, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above constantright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR CONSTANTRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_constant_propagation.cpp + * + * Tracks assignments of constants to channels of variables, and + * usage of those constant channels with direct usage of the constants. + * + * This can lead to constant folding and algebraic optimizations in + * those later expressions, while causing no increase in instruction + * count (due to constants being generally free to load from a + * constant push buffer or as instruction immediate values) and + * possibly reducing register pressure. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_basic_block.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +class acp_entry : public exec_node +{ +public: + acp_entry(ir_variable *var, unsigned write_mask, ir_constant *constant) + { + assert(var); + assert(constant); + this->var = var; + this->write_mask = write_mask; + this->constant = constant; + } + + ir_variable *var; + ir_constant *constant; + unsigned write_mask; +}; + + +class kill_entry : public exec_node +{ +public: + kill_entry(ir_variable *var, unsigned write_mask) + { + assert(var); + this->var = var; + this->write_mask = write_mask; + } + + ir_variable *var; + unsigned write_mask; +}; + +class ir_constant_propagation_visitor : public ir_rvalue_visitor { +public: + ir_constant_propagation_visitor() + { + progress = false; + mem_ctx = talloc_new(0); + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + } + ~ir_constant_propagation_visitor() + { + talloc_free(mem_ctx); + } + + virtual ir_visitor_status visit_enter(class ir_loop *); + virtual ir_visitor_status visit_enter(class ir_function_signature *); + virtual ir_visitor_status visit_enter(class ir_function *); + virtual ir_visitor_status visit_leave(class ir_assignment *); + virtual ir_visitor_status visit_enter(class ir_call *); + virtual ir_visitor_status visit_enter(class ir_if *); + + void add_constant(ir_assignment *ir); + void kill(ir_variable *ir, unsigned write_mask); + void handle_if_block(exec_list *instructions); + void handle_rvalue(ir_rvalue **rvalue); + + /** List of acp_entry: The available constants to propagate */ + exec_list *acp; + + /** + * List of kill_entry: The masks of variables whose values were + * killed in this block. + */ + exec_list *kills; + + bool progress; + + bool killed_all; + + void *mem_ctx; +}; + + +void +ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (this->in_assignee || !*rvalue) + return; + + const glsl_type *type = (*rvalue)->type; + if (!type->is_scalar() && !type->is_vector()) + return; + + ir_swizzle *swiz = NULL; + ir_dereference_variable *deref = (*rvalue)->as_dereference_variable(); + if (!deref) { + swiz = (*rvalue)->as_swizzle(); + if (!swiz) + return; + + deref = swiz->val->as_dereference_variable(); + if (!deref) + return; + } + + ir_constant_data data; + memset(&data, 0, sizeof(data)); + + for (unsigned int i = 0; i < type->components(); i++) { + int channel; + acp_entry *found = NULL; + + if (swiz) { + switch (i) { + case 0: channel = swiz->mask.x; break; + case 1: channel = swiz->mask.y; break; + case 2: channel = swiz->mask.z; break; + case 3: channel = swiz->mask.w; break; + default: assert(!"shouldn't be reached"); channel = 0; break; + } + } else { + channel = i; + } + + foreach_iter(exec_list_iterator, iter, *this->acp) { + acp_entry *entry = (acp_entry *)iter.get(); + if (entry->var == deref->var && entry->write_mask & (1 << channel)) { + found = entry; + break; + } + } + + if (!found) + return; + + int rhs_channel = 0; + for (int j = 0; j < 4; j++) { + if (j == channel) + break; + if (found->write_mask & (1 << j)) + rhs_channel++; + } + + switch (type->base_type) { + case GLSL_TYPE_FLOAT: + data.f[i] = found->constant->value.f[rhs_channel]; + break; + case GLSL_TYPE_INT: + data.i[i] = found->constant->value.i[rhs_channel]; + break; + case GLSL_TYPE_UINT: + data.u[i] = found->constant->value.u[rhs_channel]; + break; + case GLSL_TYPE_BOOL: + data.b[i] = found->constant->value.b[rhs_channel]; + break; + default: + assert(!"not reached"); + break; + } + } + + *rvalue = new(talloc_parent(deref)) ir_constant(type, &data); + this->progress = true; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_function_signature *ir) +{ + /* Treat entry into a function signature as a completely separate + * block. Any instructions at global scope will be shuffled into + * main() at link time, so they're irrelevant to us. + */ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + visit_list_elements(this, &ir->body); + + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = orig_killed_all; + + return visit_continue_with_parent; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_leave(ir_assignment *ir) +{ + if (this->in_assignee) + return visit_continue; + + kill(ir->lhs->variable_referenced(), ir->write_mask); + + add_constant(ir); + + return visit_continue; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_function *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_call *ir) +{ + /* Do constant propagation on call parameters, but skip any out params */ + exec_list_iterator sig_param_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { + ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); + ir_rvalue *param = (ir_rvalue *)iter.get(); + if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout) { + ir_rvalue *new_param = param; + handle_rvalue(&new_param); + if (new_param != param) + param->replace_with(new_param); + else + param->accept(this); + } + sig_param_iter.next(); + } + + /* Since we're unlinked, we don't (necssarily) know the side effects of + * this call. So kill all copies. + */ + acp->make_empty(); + this->killed_all = true; + + return visit_continue_with_parent; +} + +void +ir_constant_propagation_visitor::handle_if_block(exec_list *instructions) +{ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + /* Populate the initial acp with a constant of the original */ + foreach_iter(exec_list_iterator, iter, *orig_acp) { + acp_entry *a = (acp_entry *)iter.get(); + this->acp->push_tail(new(this->mem_ctx) acp_entry(a->var, a->write_mask, + a->constant)); + } + + visit_list_elements(this, instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + foreach_iter(exec_list_iterator, iter, *new_kills) { + kill_entry *k = (kill_entry *)iter.get(); + kill(k->var, k->write_mask); + } +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_if *ir) +{ + ir->condition->accept(this); + handle_rvalue(&ir->condition); + + handle_if_block(&ir->then_instructions); + handle_if_block(&ir->else_instructions); + + /* handle_if_block() already descended into the children. */ + return visit_continue_with_parent; +} + +ir_visitor_status +ir_constant_propagation_visitor::visit_enter(ir_loop *ir) +{ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + /* FINISHME: For now, the initial acp for loops is totally empty. + * We could go through once, then go through again with the acp + * cloned minus the killed entries after the first run through. + */ + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + visit_list_elements(this, &ir->body_instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + foreach_iter(exec_list_iterator, iter, *new_kills) { + kill_entry *k = (kill_entry *)iter.get(); + kill(k->var, k->write_mask); + } + + /* already descended into the children. */ + return visit_continue_with_parent; +} + +void +ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask) +{ + assert(var != NULL); + + /* We don't track non-vectors. */ + if (!var->type->is_vector() && !var->type->is_scalar()) + return; + + /* Remove any entries currently in the ACP for this kill. */ + foreach_iter(exec_list_iterator, iter, *this->acp) { + acp_entry *entry = (acp_entry *)iter.get(); + + if (entry->var == var) { + entry->write_mask &= ~write_mask; + if (entry->write_mask == 0) + entry->remove(); + } + } + + /* Add this writemask of the variable to the list of killed + * variables in this block. + */ + foreach_iter(exec_list_iterator, iter, *this->kills) { + kill_entry *entry = (kill_entry *)iter.get(); + + if (entry->var == var) { + entry->write_mask |= write_mask; + return; + } + } + /* Not already in the list. Make new entry. */ + this->kills->push_tail(new(this->mem_ctx) kill_entry(var, write_mask)); +} + +/** + * Adds an entry to the available constant list if it's a plain assignment + * of a variable to a variable. + */ +void +ir_constant_propagation_visitor::add_constant(ir_assignment *ir) +{ + acp_entry *entry; + + if (ir->condition) { + ir_constant *condition = ir->condition->as_constant(); + if (!condition || !condition->value.b[0]) + return; + } + + if (!ir->write_mask) + return; + + ir_dereference_variable *deref = ir->lhs->as_dereference_variable(); + ir_constant *constant = ir->rhs->as_constant(); + + if (!deref || !constant) + return; + + /* Only do constant propagation on vectors. Constant matrices, + * arrays, or structures would require more work elsewhere. + */ + if (!deref->var->type->is_vector() && !deref->var->type->is_scalar()) + return; + + entry = new(this->mem_ctx) acp_entry(deref->var, ir->write_mask, constant); + this->acp->push_tail(entry); +} + +/** + * Does a constant propagation pass on the code present in the instruction stream. + */ +bool +do_constant_propagation(exec_list *instructions) +{ + ir_constant_propagation_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/ir_constant_variable.cpp b/mesalib/src/glsl/ir_constant_variable.cpp new file mode 100644 index 000000000..1fb73e765 --- /dev/null +++ b/mesalib/src/glsl/ir_constant_variable.cpp @@ -0,0 +1,198 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_constant_variable.cpp + * + * Marks variables assigned a single constant value over the course + * of the program as constant. + * + * The goal here is to trigger further constant folding and then dead + * code elimination. This is common with vector/matrix constructors + * and calls to builtin functions. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +struct assignment_entry { + exec_node link; + int assignment_count; + ir_variable *var; + ir_constant *constval; + bool our_scope; +}; + +class ir_constant_variable_visitor : public ir_hierarchical_visitor { +public: + virtual ir_visitor_status visit_enter(ir_dereference_variable *); + virtual ir_visitor_status visit(ir_variable *); + virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_call *); + + exec_list list; +}; + +static struct assignment_entry * +get_assignment_entry(ir_variable *var, exec_list *list) +{ + struct assignment_entry *entry; + + foreach_list_typed(struct assignment_entry, entry, link, list) { + if (entry->var == var) + return entry; + } + + entry = (struct assignment_entry *)calloc(1, sizeof(*entry)); + entry->var = var; + list->push_head(&entry->link); + return entry; +} + +ir_visitor_status +ir_constant_variable_visitor::visit(ir_variable *ir) +{ + struct assignment_entry *entry = get_assignment_entry(ir, &this->list); + entry->our_scope = true; + return visit_continue; +} + +/* Skip derefs of variables so that we can detect declarations. */ +ir_visitor_status +ir_constant_variable_visitor::visit_enter(ir_dereference_variable *ir) +{ + (void)ir; + return visit_continue_with_parent; +} + +ir_visitor_status +ir_constant_variable_visitor::visit_enter(ir_assignment *ir) +{ + ir_constant *constval; + struct assignment_entry *entry; + + entry = get_assignment_entry(ir->lhs->variable_referenced(), &this->list); + assert(entry); + entry->assignment_count++; + + /* If it's already constant, don't do the work. */ + if (entry->var->constant_value) + return visit_continue; + + /* OK, now find if we actually have all the right conditions for + * this to be a constant value assigned to the var. + */ + if (ir->condition) { + constval = ir->condition->constant_expression_value(); + if (!constval || !constval->value.b[0]) + return visit_continue; + } + + ir_variable *var = ir->whole_variable_written(); + if (!var) + return visit_continue; + + constval = ir->rhs->constant_expression_value(); + if (!constval) + return visit_continue; + + /* Mark this entry as having a constant assignment (if the + * assignment count doesn't go >1). do_constant_variable will fix + * up the variable with the constant value later. + */ + entry->constval = constval; + + return visit_continue; +} + +ir_visitor_status +ir_constant_variable_visitor::visit_enter(ir_call *ir) +{ + exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param_rval = (ir_rvalue *)iter.get(); + ir_variable *param = (ir_variable *)sig_iter.get(); + + if (param->mode == ir_var_out || + param->mode == ir_var_inout) { + ir_variable *var = param_rval->variable_referenced(); + struct assignment_entry *entry; + + assert(var); + entry = get_assignment_entry(var, &this->list); + entry->assignment_count++; + } + sig_iter.next(); + } + return visit_continue; +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_constant_variable(exec_list *instructions) +{ + bool progress = false; + ir_constant_variable_visitor v; + + v.run(instructions); + + while (!v.list.is_empty()) { + + struct assignment_entry *entry; + entry = exec_node_data(struct assignment_entry, v.list.head, link); + + if (entry->assignment_count == 1 && entry->constval && entry->our_scope) { + entry->var->constant_value = entry->constval; + progress = true; + } + entry->link.remove(); + free(entry); + } + + return progress; +} + +bool +do_constant_variable_unlinked(exec_list *instructions) +{ + bool progress = false; + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_function *f = ir->as_function(); + if (f) { + foreach_iter(exec_list_iterator, sigiter, *f) { + ir_function_signature *sig = + (ir_function_signature *) sigiter.get(); + if (do_constant_variable(&sig->body)) + progress = true; + } + } + } + + return progress; +} diff --git a/mesalib/src/glsl/ir_copy_propagation.cpp b/mesalib/src/glsl/ir_copy_propagation.cpp new file mode 100644 index 000000000..0fe8fa6c4 --- /dev/null +++ b/mesalib/src/glsl/ir_copy_propagation.cpp @@ -0,0 +1,348 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_copy_propagation.cpp + * + * Moves usage of recently-copied variables to the previous copy of + * the variable. + * + * This should reduce the number of MOV instructions in the generated + * programs unless copy propagation is also done on the LIR, and may + * help anyway by triggering other optimizations that live in the HIR. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_basic_block.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +class acp_entry : public exec_node +{ +public: + acp_entry(ir_variable *lhs, ir_variable *rhs) + { + assert(lhs); + assert(rhs); + this->lhs = lhs; + this->rhs = rhs; + } + + ir_variable *lhs; + ir_variable *rhs; +}; + + +class kill_entry : public exec_node +{ +public: + kill_entry(ir_variable *var) + { + assert(var); + this->var = var; + } + + ir_variable *var; +}; + +class ir_copy_propagation_visitor : public ir_hierarchical_visitor { +public: + ir_copy_propagation_visitor() + { + progress = false; + mem_ctx = talloc_new(0); + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + } + ~ir_copy_propagation_visitor() + { + talloc_free(mem_ctx); + } + + virtual ir_visitor_status visit(class ir_dereference_variable *); + virtual ir_visitor_status visit_enter(class ir_loop *); + virtual ir_visitor_status visit_enter(class ir_function_signature *); + virtual ir_visitor_status visit_enter(class ir_function *); + virtual ir_visitor_status visit_leave(class ir_assignment *); + virtual ir_visitor_status visit_enter(class ir_call *); + virtual ir_visitor_status visit_enter(class ir_if *); + + void add_copy(ir_assignment *ir); + void kill(ir_variable *ir); + void handle_if_block(exec_list *instructions); + + /** List of acp_entry: The available copies to propagate */ + exec_list *acp; + /** + * List of kill_entry: The variables whose values were killed in this + * block. + */ + exec_list *kills; + + bool progress; + + bool killed_all; + + void *mem_ctx; +}; + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_function_signature *ir) +{ + /* Treat entry into a function signature as a completely separate + * block. Any instructions at global scope will be shuffled into + * main() at link time, so they're irrelevant to us. + */ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + visit_list_elements(this, &ir->body); + + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = orig_killed_all; + + return visit_continue_with_parent; +} + +ir_visitor_status +ir_copy_propagation_visitor::visit_leave(ir_assignment *ir) +{ + kill(ir->lhs->variable_referenced()); + + add_copy(ir); + + return visit_continue; +} + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_function *ir) +{ + (void) ir; + return visit_continue; +} + +/** + * Replaces dereferences of ACP RHS variables with ACP LHS variables. + * + * This is where the actual copy propagation occurs. Note that the + * rewriting of ir_dereference means that the ir_dereference instance + * must not be shared by multiple IR operations! + */ +ir_visitor_status +ir_copy_propagation_visitor::visit(ir_dereference_variable *ir) +{ + if (this->in_assignee) + return visit_continue; + + ir_variable *var = ir->var; + + foreach_iter(exec_list_iterator, iter, *this->acp) { + acp_entry *entry = (acp_entry *)iter.get(); + + if (var == entry->lhs) { + ir->var = entry->rhs; + this->progress = true; + break; + } + } + + return visit_continue; +} + + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_call *ir) +{ + /* Do copy propagation on call parameters, but skip any out params */ + exec_list_iterator sig_param_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { + ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); + ir_instruction *ir = (ir_instruction *)iter.get(); + if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout) { + ir->accept(this); + } + sig_param_iter.next(); + } + + /* Since we're unlinked, we don't (necssarily) know the side effects of + * this call. So kill all copies. + */ + acp->make_empty(); + this->killed_all = true; + + return visit_continue_with_parent; +} + +void +ir_copy_propagation_visitor::handle_if_block(exec_list *instructions) +{ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + /* Populate the initial acp with a copy of the original */ + foreach_iter(exec_list_iterator, iter, *orig_acp) { + acp_entry *a = (acp_entry *)iter.get(); + this->acp->push_tail(new(this->mem_ctx) acp_entry(a->lhs, a->rhs)); + } + + visit_list_elements(this, instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + foreach_iter(exec_list_iterator, iter, *new_kills) { + kill_entry *k = (kill_entry *)iter.get(); + kill(k->var); + } +} + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_if *ir) +{ + ir->condition->accept(this); + + handle_if_block(&ir->then_instructions); + handle_if_block(&ir->else_instructions); + + /* handle_if_block() already descended into the children. */ + return visit_continue_with_parent; +} + +ir_visitor_status +ir_copy_propagation_visitor::visit_enter(ir_loop *ir) +{ + exec_list *orig_acp = this->acp; + exec_list *orig_kills = this->kills; + bool orig_killed_all = this->killed_all; + + /* FINISHME: For now, the initial acp for loops is totally empty. + * We could go through once, then go through again with the acp + * cloned minus the killed entries after the first run through. + */ + this->acp = new(mem_ctx) exec_list; + this->kills = new(mem_ctx) exec_list; + this->killed_all = false; + + visit_list_elements(this, &ir->body_instructions); + + if (this->killed_all) { + orig_acp->make_empty(); + } + + exec_list *new_kills = this->kills; + this->kills = orig_kills; + this->acp = orig_acp; + this->killed_all = this->killed_all || orig_killed_all; + + foreach_iter(exec_list_iterator, iter, *new_kills) { + kill_entry *k = (kill_entry *)iter.get(); + kill(k->var); + } + + /* already descended into the children. */ + return visit_continue_with_parent; +} + +void +ir_copy_propagation_visitor::kill(ir_variable *var) +{ + assert(var != NULL); + + /* Remove any entries currently in the ACP for this kill. */ + foreach_iter(exec_list_iterator, iter, *acp) { + acp_entry *entry = (acp_entry *)iter.get(); + + if (entry->lhs == var || entry->rhs == var) { + entry->remove(); + } + } + + /* Add the LHS variable to the list of killed variables in this block. + */ + this->kills->push_tail(new(this->mem_ctx) kill_entry(var)); +} + +/** + * Adds an entry to the available copy list if it's a plain assignment + * of a variable to a variable. + */ +void +ir_copy_propagation_visitor::add_copy(ir_assignment *ir) +{ + acp_entry *entry; + + if (ir->condition) { + ir_constant *condition = ir->condition->as_constant(); + if (!condition || !condition->value.b[0]) + return; + } + + ir_variable *lhs_var = ir->whole_variable_written(); + ir_variable *rhs_var = ir->rhs->whole_variable_referenced(); + + if ((lhs_var != NULL) && (rhs_var != NULL)) { + if (lhs_var == rhs_var) { + /* This is a dumb assignment, but we've conveniently noticed + * it here. Removing it now would mess up the loop iteration + * calling us. Just flag it to not execute, and someone else + * will clean up the mess. + */ + ir->condition = new(talloc_parent(ir)) ir_constant(false); + this->progress = true; + } else { + entry = new(this->mem_ctx) acp_entry(lhs_var, rhs_var); + this->acp->push_tail(entry); + } + } +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_copy_propagation(exec_list *instructions) +{ + ir_copy_propagation_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/ir_dead_code.cpp b/mesalib/src/glsl/ir_dead_code.cpp new file mode 100644 index 000000000..5cf5e99ad --- /dev/null +++ b/mesalib/src/glsl/ir_dead_code.cpp @@ -0,0 +1,142 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_dead_code.cpp + * + * Eliminates dead assignments and variable declarations from the code. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_variable_refcount.h" +#include "glsl_types.h" + +static bool debug = false; + +/** + * Do a dead code pass over instructions and everything that instructions + * references. + * + * Note that this will remove assignments to globals, so it is not suitable + * for usage on an unlinked instruction stream. + */ +bool +do_dead_code(exec_list *instructions) +{ + ir_variable_refcount_visitor v; + bool progress = false; + + v.run(instructions); + + foreach_iter(exec_list_iterator, iter, v.variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + + /* Since each assignment is a reference, the refereneced count must be + * greater than or equal to the assignment count. If they are equal, + * then all of the references are assignments, and the variable is + * dead. + * + * Note that if the variable is neither assigned nor referenced, both + * counts will be zero and will be caught by the equality test. + */ + assert(entry->referenced_count >= entry->assigned_count); + + if (debug) { + printf("%s@%p: %d refs, %d assigns, %sdeclared in our scope\n", + entry->var->name, (void *) entry->var, + entry->referenced_count, entry->assigned_count, + entry->declaration ? "" : "not "); + } + + if ((entry->referenced_count > entry->assigned_count) + || !entry->declaration) + continue; + + if (entry->assign) { + /* Remove a single dead assignment to the variable we found. + * Don't do so if it's a shader output, though. + */ + if (entry->var->mode != ir_var_out && + entry->var->mode != ir_var_inout && + !ir_has_call(entry->assign)) { + entry->assign->remove(); + progress = true; + + if (debug) { + printf("Removed assignment to %s@%p\n", + entry->var->name, (void *) entry->var); + } + } + } else { + /* If there are no assignments or references to the variable left, + * then we can remove its declaration. + */ + + /* uniform initializers are precious, and could get used by another + * stage. + */ + if (entry->var->mode == ir_var_uniform && + entry->var->constant_value) + continue; + + entry->var->remove(); + progress = true; + + if (debug) { + printf("Removed declaration of %s@%p\n", + entry->var->name, (void *) entry->var); + } + } + } + + return progress; +} + +/** + * Does a dead code pass on the functions present in the instruction stream. + * + * This is suitable for use while the program is not linked, as it will + * ignore variable declarations (and the assignments to them) for variables + * with global scope. + */ +bool +do_dead_code_unlinked(exec_list *instructions) +{ + bool progress = false; + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_function *f = ir->as_function(); + if (f) { + foreach_iter(exec_list_iterator, sigiter, *f) { + ir_function_signature *sig = + (ir_function_signature *) sigiter.get(); + if (do_dead_code(&sig->body)) + progress = true; + } + } + } + + return progress; +} diff --git a/mesalib/src/glsl/ir_dead_code_local.cpp b/mesalib/src/glsl/ir_dead_code_local.cpp new file mode 100644 index 000000000..4bbedf0ff --- /dev/null +++ b/mesalib/src/glsl/ir_dead_code_local.cpp @@ -0,0 +1,229 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_dead_code_local.cpp + * + * Eliminates local dead assignments from the code. + * + * This operates on basic blocks, tracking assignments and finding if + * they're used before the variable is completely reassigned. + * + * Compare this to ir_dead_code.cpp, which operates globally looking + * for assignments to variables that are never read. + */ + +#include "ir.h" +#include "ir_basic_block.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +static bool debug = false; + +class assignment_entry : public exec_node +{ +public: + assignment_entry(ir_variable *lhs, ir_instruction *ir) + { + assert(lhs); + assert(ir); + this->lhs = lhs; + this->ir = ir; + } + + ir_variable *lhs; + ir_instruction *ir; +}; + +class kill_for_derefs_visitor : public ir_hierarchical_visitor { +public: + kill_for_derefs_visitor(exec_list *assignments) + { + this->assignments = assignments; + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + ir_variable *const var = ir->variable_referenced(); + + foreach_iter(exec_list_iterator, iter, *this->assignments) { + assignment_entry *entry = (assignment_entry *)iter.get(); + + if (entry->lhs == var) { + if (debug) + printf("kill %s\n", entry->lhs->name); + entry->remove(); + } + } + + return visit_continue; + } + +private: + exec_list *assignments; +}; + +class array_index_visit : public ir_hierarchical_visitor { +public: + array_index_visit(ir_hierarchical_visitor *v) + { + this->visitor = v; + } + + virtual ir_visitor_status visit_enter(class ir_dereference_array *ir) + { + ir->array_index->accept(visitor); + return visit_continue; + } + + static void run(ir_instruction *ir, ir_hierarchical_visitor *v) + { + array_index_visit top_visit(v); + ir->accept(& top_visit); + } + + ir_hierarchical_visitor *visitor; +}; + + +/** + * Adds an entry to the available copy list if it's a plain assignment + * of a variable to a variable. + */ +static bool +process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) +{ + ir_variable *var = NULL; + bool progress = false; + kill_for_derefs_visitor v(assignments); + + /* Kill assignment entries for things used to produce this assignment. */ + ir->rhs->accept(&v); + if (ir->condition) { + ir->condition->accept(&v); + } + + /* Kill assignment enties used as array indices. + */ + array_index_visit::run(ir->lhs, &v); + var = ir->lhs->variable_referenced(); + assert(var); + + bool always_assign = true; + if (ir->condition) { + ir_constant *condition = ir->condition->as_constant(); + if (!condition || !condition->value.b[0]) + always_assign = false; + } + + /* Now, check if we did a whole-variable assignment. */ + if (always_assign && (ir->whole_variable_written() != NULL)) { + /* We did a whole-variable assignment. So, any instruction in + * the assignment list with the same LHS is dead. + */ + if (debug) + printf("looking for %s to remove\n", var->name); + foreach_iter(exec_list_iterator, iter, *assignments) { + assignment_entry *entry = (assignment_entry *)iter.get(); + + if (entry->lhs == var) { + if (debug) + printf("removing %s\n", var->name); + entry->ir->remove(); + entry->remove(); + progress = true; + } + } + } + + /* Add this instruction to the assignment list available to be removed. + * But not if the assignment has other side effects. + */ + if (ir_has_call(ir)) + return progress; + + assignment_entry *entry = new(ctx) assignment_entry(var, ir); + assignments->push_tail(entry); + + if (debug) { + printf("add %s\n", var->name); + + printf("current entries\n"); + foreach_iter(exec_list_iterator, iter, *assignments) { + assignment_entry *entry = (assignment_entry *)iter.get(); + + printf(" %s\n", entry->lhs->name); + } + } + + return progress; +} + +static void +dead_code_local_basic_block(ir_instruction *first, + ir_instruction *last, + void *data) +{ + ir_instruction *ir, *ir_next; + /* List of avaialble_copy */ + exec_list assignments; + bool *out_progress = (bool *)data; + bool progress = false; + + void *ctx = talloc_new(NULL); + /* Safe looping, since process_assignment */ + for (ir = first, ir_next = (ir_instruction *)first->next;; + ir = ir_next, ir_next = (ir_instruction *)ir->next) { + ir_assignment *ir_assign = ir->as_assignment(); + + if (debug) { + ir->print(); + printf("\n"); + } + + if (ir_assign) { + progress = process_assignment(ctx, ir_assign, &assignments) || progress; + } else { + kill_for_derefs_visitor kill(&assignments); + ir->accept(&kill); + } + + if (ir == last) + break; + } + *out_progress = progress; + talloc_free(ctx); +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_dead_code_local(exec_list *instructions) +{ + bool progress = false; + + call_for_basic_blocks(instructions, dead_code_local_basic_block, &progress); + + return progress; +} diff --git a/mesalib/src/glsl/ir_dead_functions.cpp b/mesalib/src/glsl/ir_dead_functions.cpp new file mode 100644 index 000000000..26554441d --- /dev/null +++ b/mesalib/src/glsl/ir_dead_functions.cpp @@ -0,0 +1,151 @@ + /* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + /** + * \file ir_dead_functions.cpp + * + * Eliminates unused functions from the linked program. + */ + + #include "ir.h" + #include "ir_visitor.h" + #include "ir_expression_flattening.h" + #include "glsl_types.h" + + class signature_entry : public exec_node + { + public: + signature_entry(ir_function_signature *sig) + { + this->signature = sig; + this->used = false; + } + + ir_function_signature *signature; + bool used; + }; + + class ir_dead_functions_visitor : public ir_hierarchical_visitor { + public: + ir_dead_functions_visitor() + { + this->mem_ctx = talloc_new(NULL); + } + + ~ir_dead_functions_visitor() + { + talloc_free(this->mem_ctx); + } + + virtual ir_visitor_status visit_enter(ir_function_signature *); + virtual ir_visitor_status visit_enter(ir_call *); + + signature_entry *get_signature_entry(ir_function_signature *var); + + bool (*predicate)(ir_instruction *ir); + + /* List of signature_entry */ + exec_list signature_list; + void *mem_ctx; + }; + + + signature_entry * + ir_dead_functions_visitor::get_signature_entry(ir_function_signature *sig) + { + foreach_iter(exec_list_iterator, iter, this->signature_list) { + signature_entry *entry = (signature_entry *)iter.get(); + if (entry->signature == sig) + return entry; + } + + signature_entry *entry = new(mem_ctx) signature_entry(sig); + this->signature_list.push_tail(entry); + return entry; + } + + + ir_visitor_status + ir_dead_functions_visitor::visit_enter(ir_function_signature *ir) + { + signature_entry *entry = this->get_signature_entry(ir); + + if (strcmp(ir->function_name(), "main") == 0) { + entry->used = true; + } + + return visit_continue; + } + + + ir_visitor_status + ir_dead_functions_visitor::visit_enter(ir_call *ir) + { + signature_entry *entry = this->get_signature_entry(ir->get_callee()); + + entry->used = true; + + return visit_continue; +} + +bool +do_dead_functions(exec_list *instructions) +{ + ir_dead_functions_visitor v; + bool progress = false; + + visit_list_elements(&v, instructions); + + /* Now that we've figured out which function signatures are used, remove + * the unused ones, and remove function definitions that have no more + * signatures. + */ + foreach_iter(exec_list_iterator, iter, v.signature_list) { + signature_entry *entry = (signature_entry *)iter.get(); + + if (!entry->used) { + entry->signature->remove(); + progress = true; + } + delete(entry); + } + + /* We don't just do this above when we nuked a signature because of + * const pointers. + */ + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_function *func = ir->as_function(); + + if (func && func->signatures.is_empty()) { + /* At this point (post-linking), the symbol table is no + * longer in use, so not removing the function from the + * symbol table should be OK. + */ + func->remove(); + progress = true; + } + } + + return progress; +} diff --git a/mesalib/src/glsl/ir_div_to_mul_rcp.cpp b/mesalib/src/glsl/ir_div_to_mul_rcp.cpp new file mode 100644 index 000000000..640d5d64f --- /dev/null +++ b/mesalib/src/glsl/ir_div_to_mul_rcp.cpp @@ -0,0 +1,115 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_div_to_mul_rcp.cpp + * + * Breaks an ir_unop_div expression down to op0 * (rcp(op1)). + * + * Many GPUs don't have a divide instruction (945 and 965 included), + * but they do have an RCP instruction to compute an approximate + * reciprocal. By breaking the operation down, constant reciprocals + * can get constant folded. + */ + +#include "ir.h" +#include "glsl_types.h" + +class ir_div_to_mul_rcp_visitor : public ir_hierarchical_visitor { +public: + ir_div_to_mul_rcp_visitor() + { + this->made_progress = false; + } + + ir_visitor_status visit_leave(ir_expression *); + + bool made_progress; +}; + +bool +do_div_to_mul_rcp(exec_list *instructions) +{ + ir_div_to_mul_rcp_visitor v; + + visit_list_elements(&v, instructions); + return v.made_progress; +} + +ir_visitor_status +ir_div_to_mul_rcp_visitor::visit_leave(ir_expression *ir) +{ + if (ir->operation != ir_binop_div) + return visit_continue; + + if (ir->operands[1]->type->base_type != GLSL_TYPE_INT && + ir->operands[1]->type->base_type != GLSL_TYPE_UINT) { + /* New expression for the 1.0 / op1 */ + ir_rvalue *expr; + expr = new(ir) ir_expression(ir_unop_rcp, + ir->operands[1]->type, + ir->operands[1], + NULL); + + /* op0 / op1 -> op0 * (1.0 / op1) */ + ir->operation = ir_binop_mul; + ir->operands[1] = expr; + } else { + /* Be careful with integer division -- we need to do it as a + * float and re-truncate, since rcp(n > 1) of an integer would + * just be 0. + */ + ir_rvalue *op0, *op1; + const struct glsl_type *vec_type; + + vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, + ir->operands[1]->type->vector_elements, + ir->operands[1]->type->matrix_columns); + + if (ir->operands[1]->type->base_type == GLSL_TYPE_INT) + op1 = new(ir) ir_expression(ir_unop_i2f, vec_type, ir->operands[1], NULL); + else + op1 = new(ir) ir_expression(ir_unop_u2f, vec_type, ir->operands[1], NULL); + + op1 = new(ir) ir_expression(ir_unop_rcp, op1->type, op1, NULL); + + vec_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, + ir->operands[0]->type->vector_elements, + ir->operands[0]->type->matrix_columns); + + if (ir->operands[0]->type->base_type == GLSL_TYPE_INT) + op0 = new(ir) ir_expression(ir_unop_i2f, vec_type, ir->operands[0], NULL); + else + op0 = new(ir) ir_expression(ir_unop_u2f, vec_type, ir->operands[0], NULL); + + op0 = new(ir) ir_expression(ir_binop_mul, vec_type, op0, op1); + + ir->operation = ir_unop_f2i; + ir->operands[0] = op0; + ir->operands[1] = NULL; + } + + this->made_progress = true; + + return visit_continue; +} diff --git a/mesalib/src/glsl/ir_explog_to_explog2.cpp b/mesalib/src/glsl/ir_explog_to_explog2.cpp new file mode 100644 index 000000000..78694a202 --- /dev/null +++ b/mesalib/src/glsl/ir_explog_to_explog2.cpp @@ -0,0 +1,85 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_explog_to_explog2.cpp + * + * Many GPUs don't have a base e log or exponent instruction, but they + * do have base 2 versions, so this pass converts exp and log to exp2 + * and log2 operations. + */ + +#include "main/core.h" /* for log2f on MSVC */ +#include "ir.h" +#include "glsl_types.h" + +class ir_explog_to_explog2_visitor : public ir_hierarchical_visitor { +public: + ir_explog_to_explog2_visitor() + { + this->progress = false; + } + + ir_visitor_status visit_leave(ir_expression *); + + bool progress; +}; + +bool +do_explog_to_explog2(exec_list *instructions) +{ + ir_explog_to_explog2_visitor v; + + visit_list_elements(&v, instructions); + return v.progress; +} + +ir_visitor_status +ir_explog_to_explog2_visitor::visit_leave(ir_expression *ir) +{ + if (ir->operation == ir_unop_exp) { + void *mem_ctx = talloc_parent(ir); + ir_constant *log2_e = new(mem_ctx) ir_constant(log2f(M_E)); + + ir->operation = ir_unop_exp2; + ir->operands[0] = new(mem_ctx) ir_expression(ir_binop_mul, + ir->operands[0]->type, + ir->operands[0], + log2_e); + this->progress = true; + } + + if (ir->operation == ir_unop_log) { + void *mem_ctx = talloc_parent(ir); + + ir->operation = ir_binop_mul; + ir->operands[0] = new(mem_ctx) ir_expression(ir_unop_log2, + ir->operands[0]->type, + ir->operands[0], + NULL); + ir->operands[1] = new(mem_ctx) ir_constant(1.0f / log2f(M_E)); + this->progress = true; + } + + return visit_continue; +} diff --git a/mesalib/src/glsl/ir_expression_flattening.cpp b/mesalib/src/glsl/ir_expression_flattening.cpp new file mode 100644 index 000000000..7b1b8dbfe --- /dev/null +++ b/mesalib/src/glsl/ir_expression_flattening.cpp @@ -0,0 +1,92 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_expression_flattening.cpp + * + * Takes the leaves of expression trees and makes them dereferences of + * assignments of the leaves to temporaries, according to a predicate. + * + * This is used for automatic function inlining, where we want to take + * an expression containing a call and move the call out to its own + * assignment so that we can inline it at the appropriate place in the + * instruction stream. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" + +class ir_expression_flattening_visitor : public ir_rvalue_visitor { +public: + ir_expression_flattening_visitor(bool (*predicate)(ir_instruction *ir)) + { + this->predicate = predicate; + } + + virtual ~ir_expression_flattening_visitor() + { + /* empty */ + } + + void handle_rvalue(ir_rvalue **rvalue); + bool (*predicate)(ir_instruction *ir); +}; + +void +do_expression_flattening(exec_list *instructions, + bool (*predicate)(ir_instruction *ir)) +{ + ir_expression_flattening_visitor v(predicate); + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + + ir->accept(&v); + } +} + +void +ir_expression_flattening_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + ir_variable *var; + ir_assignment *assign; + ir_rvalue *ir = *rvalue; + + if (!ir || !this->predicate(ir)) + return; + + void *ctx = talloc_parent(ir); + + var = new(ctx) ir_variable(ir->type, "flattening_tmp", ir_var_temporary); + base_ir->insert_before(var); + + assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var), + ir, + NULL); + base_ir->insert_before(assign); + + *rvalue = new(ctx) ir_dereference_variable(var); +} diff --git a/mesalib/src/glsl/ir_expression_flattening.h b/mesalib/src/glsl/ir_expression_flattening.h new file mode 100644 index 000000000..2eda15900 --- /dev/null +++ b/mesalib/src/glsl/ir_expression_flattening.h @@ -0,0 +1,38 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file ir_expression_flattening.h + * + * Takes the leaves of expression trees and makes them dereferences of + * assignments of the leaves to temporaries, according to a predicate. + * + * This is used for automatic function inlining, where we want to take + * an expression containing a call and move the call out to its own + * assignment so that we can inline it at the appropriate place in the + * instruction stream. + */ + +void do_expression_flattening(exec_list *instructions, + bool (*predicate)(ir_instruction *ir)); diff --git a/mesalib/src/glsl/ir_function.cpp b/mesalib/src/glsl/ir_function.cpp new file mode 100644 index 000000000..dfdec144b --- /dev/null +++ b/mesalib/src/glsl/ir_function.cpp @@ -0,0 +1,227 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glsl_types.h" +#include "ir.h" + +int +type_compare(const glsl_type *a, const glsl_type *b) +{ + /* If the types are the same, they trivially match. + */ + if (a == b) + return 0; + + switch (a->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_BOOL: + /* There is no implicit conversion to or from integer types or bool. + */ + if ((a->is_integer() != b->is_integer()) + || (a->is_boolean() != b->is_boolean())) + return -1; + + /* FALLTHROUGH */ + + case GLSL_TYPE_FLOAT: + if ((a->vector_elements != b->vector_elements) + || (a->matrix_columns != b->matrix_columns)) + return -1; + + return 1; + + case GLSL_TYPE_SAMPLER: + case GLSL_TYPE_STRUCT: + /* Samplers and structures must match exactly. + */ + return -1; + + case GLSL_TYPE_ARRAY: + if ((b->base_type != GLSL_TYPE_ARRAY) + || (a->length != b->length)) + return -1; + + /* From GLSL 1.50 spec, page 27 (page 33 of the PDF): + * "There are no implicit array or structure conversions." + * + * If the comparison of the array element types detects that a conversion + * would be required, the array types do not match. + */ + return (type_compare(a->fields.array, b->fields.array) == 0) ? 0 : -1; + + case GLSL_TYPE_FUNCTION: + case GLSL_TYPE_VOID: + case GLSL_TYPE_ERROR: + default: + /* These are all error conditions. It is invalid for a parameter to + * a function to be declared as error, void, or a function. + */ + return -1; + } + + /* This point should be unreachable. + */ + assert(0); +} + + +static int +parameter_lists_match(const exec_list *list_a, const exec_list *list_b) +{ + const exec_node *node_a = list_a->head; + const exec_node *node_b = list_b->head; + int total_score = 0; + + for (/* empty */ + ; !node_a->is_tail_sentinel() + ; node_a = node_a->next, node_b = node_b->next) { + /* If all of the parameters from the other parameter list have been + * exhausted, the lists have different length and, by definition, + * do not match. + */ + if (node_b->is_tail_sentinel()) + return -1; + + + const ir_variable *const param = (ir_variable *) node_a; + const ir_instruction *const actual = (ir_instruction *) node_b; + + /* Determine whether or not the types match. If the types are an + * exact match, the match score is zero. If the types don't match + * but the actual parameter can be coerced to the type of the declared + * parameter, the match score is one. + */ + int score; + switch ((enum ir_variable_mode)(param->mode)) { + case ir_var_auto: + case ir_var_uniform: + case ir_var_temporary: + /* These are all error conditions. It is invalid for a parameter to + * a function to be declared as auto (not in, out, or inout) or + * as uniform. + */ + assert(0); + return -1; + + case ir_var_in: + score = type_compare(param->type, actual->type); + break; + + case ir_var_out: + score = type_compare(actual->type, param->type); + break; + + case ir_var_inout: + /* Since there are no bi-directional automatic conversions (e.g., + * there is int -> float but no float -> int), inout parameters must + * be exact matches. + */ + score = (type_compare(actual->type, param->type) == 0) ? 0 : -1; + break; + + default: + assert(false); + } + + if (score < 0) + return -1; + + total_score += score; + } + + /* If all of the parameters from the other parameter list have been + * exhausted, the lists have different length and, by definition, do not + * match. + */ + if (!node_b->is_tail_sentinel()) + return -1; + + return total_score; +} + + +ir_function_signature * +ir_function::matching_signature(const exec_list *actual_parameters) +{ + ir_function_signature *match = NULL; + + foreach_iter(exec_list_iterator, iter, signatures) { + ir_function_signature *const sig = + (ir_function_signature *) iter.get(); + + const int score = parameter_lists_match(& sig->parameters, + actual_parameters); + + if (score == 0) + return sig; + + if (score > 0) { + if (match != NULL) + return NULL; + + match = sig; + } + } + + return match; +} + + +static bool +parameter_lists_match_exact(const exec_list *list_a, const exec_list *list_b) +{ + const exec_node *node_a = list_a->head; + const exec_node *node_b = list_b->head; + + for (/* empty */ + ; !node_a->is_tail_sentinel() && !node_b->is_tail_sentinel() + ; node_a = node_a->next, node_b = node_b->next) { + ir_variable *a = (ir_variable *) node_a; + ir_variable *b = (ir_variable *) node_b; + + /* If the types of the parameters do not match, the parameters lists + * are different. + */ + if (a->type != b->type) + return false; + } + + /* Unless both lists are exhausted, they differ in length and, by + * definition, do not match. + */ + return (node_a->is_tail_sentinel() == node_b->is_tail_sentinel()); +} + +ir_function_signature * +ir_function::exact_matching_signature(const exec_list *actual_parameters) +{ + foreach_iter(exec_list_iterator, iter, signatures) { + ir_function_signature *const sig = + (ir_function_signature *) iter.get(); + + if (parameter_lists_match_exact(&sig->parameters, actual_parameters)) + return sig; + } + return NULL; +} diff --git a/mesalib/src/glsl/ir_function_can_inline.cpp b/mesalib/src/glsl/ir_function_can_inline.cpp new file mode 100644 index 000000000..f29f277ef --- /dev/null +++ b/mesalib/src/glsl/ir_function_can_inline.cpp @@ -0,0 +1,74 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_function_can_inline.cpp + * + * Determines if we can inline a function call using ir_function_inlining.cpp. + * + * The primary restriction is that we can't return from the function + * other than as the last instruction. We could potentially work + * around this for some constructs by flattening control flow and + * moving the return to the end, or by using breaks from a do {} while + * (0) loop surrounding the function body. + */ + +#include "ir.h" + +class ir_function_can_inline_visitor : public ir_hierarchical_visitor { +public: + ir_function_can_inline_visitor() + { + this->num_returns = 0; + } + + virtual ir_visitor_status visit_enter(ir_return *); + + int num_returns; +}; + +ir_visitor_status +ir_function_can_inline_visitor::visit_enter(ir_return *ir) +{ + (void) ir; + this->num_returns++; + return visit_continue; +} + +bool +can_inline(ir_call *call) +{ + ir_function_can_inline_visitor v; + const ir_function_signature *callee = call->get_callee(); + + v.run((exec_list *) &callee->body); + + /* If the function is empty (no last instruction) or does not end with a + * return statement, we need to count the implicit return. + */ + ir_instruction *last = (ir_instruction *)callee->body.get_tail(); + if (last == NULL || !last->as_return()) + v.num_returns++; + + return v.num_returns == 1; +} diff --git a/mesalib/src/glsl/ir_function_inlining.cpp b/mesalib/src/glsl/ir_function_inlining.cpp new file mode 100644 index 000000000..874602c84 --- /dev/null +++ b/mesalib/src/glsl/ir_function_inlining.cpp @@ -0,0 +1,417 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_function_inlining.cpp + * + * Replaces calls to functions with the body of the function. + */ + +#include <inttypes.h> +#include "ir.h" +#include "ir_visitor.h" +#include "ir_function_inlining.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" +#include "program/hash_table.h" + +static void +do_sampler_replacement(exec_list *instructions, + ir_variable *sampler, + ir_dereference *deref); + +class ir_function_inlining_visitor : public ir_hierarchical_visitor { +public: + ir_function_inlining_visitor() + { + progress = false; + } + + virtual ~ir_function_inlining_visitor() + { + /* empty */ + } + + virtual ir_visitor_status visit_enter(ir_expression *); + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_return *); + virtual ir_visitor_status visit_enter(ir_texture *); + virtual ir_visitor_status visit_enter(ir_swizzle *); + + bool progress; +}; + + +bool +automatic_inlining_predicate(ir_instruction *ir) +{ + ir_call *call = ir->as_call(); + + if (call && can_inline(call)) + return true; + + return false; +} + +bool +do_function_inlining(exec_list *instructions) +{ + ir_function_inlining_visitor v; + + do_expression_flattening(instructions, automatic_inlining_predicate); + + v.run(instructions); + + return v.progress; +} + +static void +replace_return_with_assignment(ir_instruction *ir, void *data) +{ + void *ctx = talloc_parent(ir); + ir_variable *retval = (ir_variable *)data; + ir_return *ret = ir->as_return(); + + if (ret) { + if (ret->value) { + ir_rvalue *lhs = new(ctx) ir_dereference_variable(retval); + ret->replace_with(new(ctx) ir_assignment(lhs, ret->value, NULL)); + } else { + /* un-valued return has to be the last return, or we shouldn't + * have reached here. (see can_inline()). + */ + assert(ret->next->is_tail_sentinel()); + ret->remove(); + } + } +} + +ir_rvalue * +ir_call::generate_inline(ir_instruction *next_ir) +{ + void *ctx = talloc_parent(this); + ir_variable **parameters; + int num_parameters; + int i; + ir_variable *retval = NULL; + struct hash_table *ht; + + ht = hash_table_ctor(0, hash_table_pointer_hash, hash_table_pointer_compare); + + num_parameters = 0; + foreach_iter(exec_list_iterator, iter_sig, this->callee->parameters) + num_parameters++; + + parameters = new ir_variable *[num_parameters]; + + /* Generate storage for the return value. */ + if (this->callee->return_type) { + retval = new(ctx) ir_variable(this->callee->return_type, "_ret_val", + ir_var_auto); + next_ir->insert_before(retval); + } + + /* Generate the declarations for the parameters to our inlined code, + * and set up the mapping of real function body variables to ours. + */ + i = 0; + exec_list_iterator sig_param_iter = this->callee->parameters.iterator(); + exec_list_iterator param_iter = this->actual_parameters.iterator(); + for (i = 0; i < num_parameters; i++) { + ir_variable *sig_param = (ir_variable *) sig_param_iter.get(); + ir_rvalue *param = (ir_rvalue *) param_iter.get(); + + /* Generate a new variable for the parameter. */ + if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) { + /* For samplers, we want the inlined sampler references + * referencing the passed in sampler variable, since that + * will have the location information, which an assignment of + * a sampler wouldn't. Fix it up below. + */ + parameters[i] = NULL; + } else { + parameters[i] = sig_param->clone(ctx, ht); + parameters[i]->mode = ir_var_auto; + next_ir->insert_before(parameters[i]); + } + + /* Move the actual param into our param variable if it's an 'in' type. */ + if (parameters[i] && (sig_param->mode == ir_var_in || + sig_param->mode == ir_var_inout)) { + ir_assignment *assign; + + assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(parameters[i]), + param, NULL); + next_ir->insert_before(assign); + } + + sig_param_iter.next(); + param_iter.next(); + } + + exec_list new_instructions; + + /* Generate the inlined body of the function to a new list */ + foreach_iter(exec_list_iterator, iter, callee->body) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_instruction *new_ir = ir->clone(ctx, ht); + + new_instructions.push_tail(new_ir); + visit_tree(new_ir, replace_return_with_assignment, retval); + } + + /* If any samplers were passed in, replace any deref of the sampler + * with a deref of the sampler argument. + */ + param_iter = this->actual_parameters.iterator(); + sig_param_iter = this->callee->parameters.iterator(); + for (i = 0; i < num_parameters; i++) { + ir_instruction *const param = (ir_instruction *) param_iter.get(); + ir_variable *sig_param = (ir_variable *) sig_param_iter.get(); + + if (sig_param->type->base_type == GLSL_TYPE_SAMPLER) { + ir_dereference *deref = param->as_dereference(); + + assert(deref); + do_sampler_replacement(&new_instructions, sig_param, deref); + } + param_iter.next(); + sig_param_iter.next(); + } + + /* Now push those new instructions in. */ + foreach_iter(exec_list_iterator, iter, new_instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + next_ir->insert_before(ir); + } + + /* Copy back the value of any 'out' parameters from the function body + * variables to our own. + */ + i = 0; + param_iter = this->actual_parameters.iterator(); + sig_param_iter = this->callee->parameters.iterator(); + for (i = 0; i < num_parameters; i++) { + ir_instruction *const param = (ir_instruction *) param_iter.get(); + const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get(); + + /* Move our param variable into the actual param if it's an 'out' type. */ + if (parameters[i] && (sig_param->mode == ir_var_out || + sig_param->mode == ir_var_inout)) { + ir_assignment *assign; + + assign = new(ctx) ir_assignment(param->clone(ctx, NULL)->as_rvalue(), + new(ctx) ir_dereference_variable(parameters[i]), + NULL); + next_ir->insert_before(assign); + } + + param_iter.next(); + sig_param_iter.next(); + } + + delete [] parameters; + + hash_table_dtor(ht); + + if (retval) + return new(ctx) ir_dereference_variable(retval); + else + return NULL; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_expression *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_return *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_texture *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_swizzle *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_call *ir) +{ + if (can_inline(ir)) { + /* If the call was part of some tree, then it should have been + * flattened out or we shouldn't have seen it because of a + * visit_continue_with_parent in this visitor. + */ + assert(ir == base_ir); + + (void) ir->generate_inline(ir); + ir->remove(); + this->progress = true; + } + + return visit_continue; +} + + +ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_assignment *ir) +{ + ir_call *call = ir->rhs->as_call(); + if (!call || !can_inline(call)) + return visit_continue; + + /* generates the parameter setup, function body, and returns the return + * value of the function + */ + ir_rvalue *rhs = call->generate_inline(ir); + assert(rhs); + + ir->rhs = rhs; + this->progress = true; + + return visit_continue; +} + +/** + * Replaces references to the "sampler" variable with a clone of "deref." + * + * From the spec, samplers can appear in the tree as function + * (non-out) parameters and as the result of array indexing and + * structure field selection. In our builtin implementation, they + * also appear in the sampler field of an ir_tex instruction. + */ + +class ir_sampler_replacement_visitor : public ir_hierarchical_visitor { +public: + ir_sampler_replacement_visitor(ir_variable *sampler, ir_dereference *deref) + { + this->sampler = sampler; + this->deref = deref; + } + + virtual ~ir_sampler_replacement_visitor() + { + } + + virtual ir_visitor_status visit_leave(ir_call *); + virtual ir_visitor_status visit_leave(ir_dereference_array *); + virtual ir_visitor_status visit_leave(ir_dereference_record *); + virtual ir_visitor_status visit_leave(ir_texture *); + + void replace_deref(ir_dereference **deref); + void replace_rvalue(ir_rvalue **rvalue); + + ir_variable *sampler; + ir_dereference *deref; +}; + +void +ir_sampler_replacement_visitor::replace_deref(ir_dereference **deref) +{ + ir_dereference_variable *deref_var = (*deref)->as_dereference_variable(); + if (deref_var && deref_var->var == this->sampler) { + *deref = this->deref->clone(talloc_parent(*deref), NULL); + } +} + +void +ir_sampler_replacement_visitor::replace_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_dereference *deref = (*rvalue)->as_dereference(); + + if (!deref) + return; + + replace_deref(&deref); + *rvalue = deref; +} + +ir_visitor_status +ir_sampler_replacement_visitor::visit_leave(ir_texture *ir) +{ + replace_deref(&ir->sampler); + + return visit_continue; +} + +ir_visitor_status +ir_sampler_replacement_visitor::visit_leave(ir_dereference_array *ir) +{ + replace_rvalue(&ir->array); + return visit_continue; +} + +ir_visitor_status +ir_sampler_replacement_visitor::visit_leave(ir_dereference_record *ir) +{ + replace_rvalue(&ir->record); + return visit_continue; +} + +ir_visitor_status +ir_sampler_replacement_visitor::visit_leave(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = param; + replace_rvalue(&new_param); + + if (new_param != param) { + param->replace_with(new_param); + } + } + return visit_continue; +} + +static void +do_sampler_replacement(exec_list *instructions, + ir_variable *sampler, + ir_dereference *deref) +{ + ir_sampler_replacement_visitor v(sampler, deref); + + visit_list_elements(&v, instructions); +} diff --git a/mesalib/src/glsl/ir_function_inlining.h b/mesalib/src/glsl/ir_function_inlining.h new file mode 100644 index 000000000..6db011bbc --- /dev/null +++ b/mesalib/src/glsl/ir_function_inlining.h @@ -0,0 +1,30 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_function_inlining.h + * + * Replaces calls to functions with the body of the function. + */ + +bool can_inline(ir_call *call); diff --git a/mesalib/src/glsl/ir_hierarchical_visitor.cpp b/mesalib/src/glsl/ir_hierarchical_visitor.cpp new file mode 100644 index 000000000..b5eacd6d2 --- /dev/null +++ b/mesalib/src/glsl/ir_hierarchical_visitor.cpp @@ -0,0 +1,297 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "ir.h" +#include "ir_hierarchical_visitor.h" + +ir_hierarchical_visitor::ir_hierarchical_visitor() +{ + this->base_ir = NULL; + this->callback = NULL; + this->data = NULL; + this->in_assignee = false; +} + +ir_visitor_status +ir_hierarchical_visitor::visit(ir_variable *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit(ir_constant *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit(ir_loop_jump *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit(ir_dereference_variable *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_loop *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_loop *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_function_signature *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_function_signature *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_function *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_function *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_expression *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_expression *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_texture *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_texture *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_swizzle *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_swizzle *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_dereference_array *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_dereference_array *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_dereference_record *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_dereference_record *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_assignment *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_assignment *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_call *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_call *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_return *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_return *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_discard *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_discard *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_if *ir) +{ + if (this->callback != NULL) + this->callback(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_if *ir) +{ + (void) ir; + return visit_continue; +} + +void +ir_hierarchical_visitor::run(exec_list *instructions) +{ + visit_list_elements(this, instructions); +} + + +void +visit_tree(ir_instruction *ir, + void (*callback)(class ir_instruction *ir, void *data), + void *data) +{ + ir_hierarchical_visitor v; + + v.callback = callback; + v.data = data; + + ir->accept(&v); +} diff --git a/mesalib/src/glsl/ir_hierarchical_visitor.h b/mesalib/src/glsl/ir_hierarchical_visitor.h new file mode 100644 index 000000000..dc177f5eb --- /dev/null +++ b/mesalib/src/glsl/ir_hierarchical_visitor.h @@ -0,0 +1,183 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef IR_HIERARCHICAL_VISITOR_H +#define IR_HIERARCHICAL_VISITOR_H + +/** + * Enumeration values returned by visit methods to guide processing + */ +enum ir_visitor_status { + visit_continue, /**< Continue visiting as normal. */ + visit_continue_with_parent, /**< Don't visit siblings, continue w/parent. */ + visit_stop /**< Stop visiting immediately. */ +}; + + +/** + * Base class of hierarchical visitors of IR instruction trees + * + * Hierarchical visitors differ from traditional visitors in a couple of + * important ways. Rather than having a single \c visit method for each + * subclass in the composite, there are three kinds of visit methods. + * Leaf-node classes have a traditional \c visit method. Internal-node + * classes have a \c visit_enter method, which is invoked just before + * processing child nodes, and a \c visit_leave method which is invoked just + * after processing child nodes. + * + * In addition, each visit method and the \c accept methods in the composite + * have a return value which guides the navigation. Any of the visit methods + * can choose to continue visiting the tree as normal (by returning \c + * visit_continue), terminate visiting any further nodes immediately (by + * returning \c visit_stop), or stop visiting sibling nodes (by returning \c + * visit_continue_with_parent). + * + * These two changes combine to allow nagivation of children to be implemented + * in the composite's \c accept method. The \c accept method for a leaf-node + * class will simply call the \c visit method, as usual, and pass its return + * value on. The \c accept method for internal-node classes will call the \c + * visit_enter method, call the \c accpet method of each child node, and, + * finally, call the \c visit_leave method. If any of these return a value + * other that \c visit_continue, the correct action must be taken. + * + * The final benefit is that the hierarchical visitor base class need not be + * abstract. Default implementations of every \c visit, \c visit_enter, and + * \c visit_leave method can be provided. By default each of these methods + * simply returns \c visit_continue. This allows a significant reduction in + * derived class code. + * + * For more information about hierarchical visitors, see: + * + * http://c2.com/cgi/wiki?HierarchicalVisitorPattern + * http://c2.com/cgi/wiki?HierarchicalVisitorDiscussion + */ + +class ir_hierarchical_visitor { +public: + ir_hierarchical_visitor(); + + /** + * \name Visit methods for leaf-node classes + */ + /*@{*/ + virtual ir_visitor_status visit(class ir_variable *); + virtual ir_visitor_status visit(class ir_constant *); + virtual ir_visitor_status visit(class ir_loop_jump *); + + /** + * ir_dereference_variable isn't technically a leaf, but it is treated as a + * leaf here for a couple reasons. By not automatically visiting the one + * child ir_variable node from the ir_dereference_variable, ir_variable + * nodes can always be handled as variable declarations. Code that used + * non-hierarchical visitors had to set an "in a dereference" flag to + * determine how to handle an ir_variable. By forcing the visitor to + * handle the ir_variable within the ir_dereference_variable visitor, this + * kludge can be avoided. + * + * In addition, I can envision no use for having separate enter and leave + * methods. Anything that could be done in the enter and leave methods + * that couldn't just be done in the visit method. + */ + virtual ir_visitor_status visit(class ir_dereference_variable *); + /*@}*/ + + /** + * \name Visit methods for internal-node classes + */ + /*@{*/ + virtual ir_visitor_status visit_enter(class ir_loop *); + virtual ir_visitor_status visit_leave(class ir_loop *); + virtual ir_visitor_status visit_enter(class ir_function_signature *); + virtual ir_visitor_status visit_leave(class ir_function_signature *); + virtual ir_visitor_status visit_enter(class ir_function *); + virtual ir_visitor_status visit_leave(class ir_function *); + virtual ir_visitor_status visit_enter(class ir_expression *); + virtual ir_visitor_status visit_leave(class ir_expression *); + virtual ir_visitor_status visit_enter(class ir_texture *); + virtual ir_visitor_status visit_leave(class ir_texture *); + virtual ir_visitor_status visit_enter(class ir_swizzle *); + virtual ir_visitor_status visit_leave(class ir_swizzle *); + virtual ir_visitor_status visit_enter(class ir_dereference_array *); + virtual ir_visitor_status visit_leave(class ir_dereference_array *); + virtual ir_visitor_status visit_enter(class ir_dereference_record *); + virtual ir_visitor_status visit_leave(class ir_dereference_record *); + virtual ir_visitor_status visit_enter(class ir_assignment *); + virtual ir_visitor_status visit_leave(class ir_assignment *); + virtual ir_visitor_status visit_enter(class ir_call *); + virtual ir_visitor_status visit_leave(class ir_call *); + virtual ir_visitor_status visit_enter(class ir_return *); + virtual ir_visitor_status visit_leave(class ir_return *); + virtual ir_visitor_status visit_enter(class ir_discard *); + virtual ir_visitor_status visit_leave(class ir_discard *); + virtual ir_visitor_status visit_enter(class ir_if *); + virtual ir_visitor_status visit_leave(class ir_if *); + /*@}*/ + + + /** + * Utility function to process a linked list of instructions with a visitor + */ + void run(struct exec_list *instructions); + + /* Some visitors may need to insert new variable declarations and + * assignments for portions of a subtree, which means they need a + * pointer to the current instruction in the stream, not just their + * node in the tree rooted at that instruction. + * + * This is implemented by visit_list_elements -- if the visitor is + * not called by it, nothing good will happen. + */ + class ir_instruction *base_ir; + + /** + * Callback function that is invoked on entry to each node visited. + * + * \warning + * Visitor classes derived from \c ir_hierarchical_visitor \b may \b not + * invoke this function. This can be used, for example, to cause the + * callback to be invoked on every node type execpt one. + */ + void (*callback)(class ir_instruction *ir, void *data); + + /** + * Extra data parameter passed to the per-node callback function + */ + void *data; + + /** + * Currently in the LHS of an assignment? + * + * This is set and cleared by the \c ir_assignment::accept method. + */ + bool in_assignee; +}; + +void visit_tree(ir_instruction *ir, + void (*callback)(class ir_instruction *ir, void *data), + void *data); + +ir_visitor_status visit_list_elements(ir_hierarchical_visitor *v, exec_list *l); + +#endif /* IR_HIERARCHICAL_VISITOR_H */ diff --git a/mesalib/src/glsl/ir_hv_accept.cpp b/mesalib/src/glsl/ir_hv_accept.cpp new file mode 100644 index 000000000..be8b36a7c --- /dev/null +++ b/mesalib/src/glsl/ir_hv_accept.cpp @@ -0,0 +1,378 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "ir.h" + +/** + * \file ir_hv_accept.cpp + * Implementations of all hierarchical visitor accept methods for IR + * instructions. + */ + +/** + * Process a list of nodes using a hierarchical vistor + * + * \warning + * This function will operate correctly if a node being processed is removed + * from the list. However, if nodes are added to the list after the node being + * processed, some of the added nodes may not be processed. + */ +ir_visitor_status +visit_list_elements(ir_hierarchical_visitor *v, exec_list *l) +{ + ir_instruction *prev_base_ir = v->base_ir; + + foreach_list_safe(n, l) { + ir_instruction *const ir = (ir_instruction *) n; + v->base_ir = ir; + ir_visitor_status s = ir->accept(v); + + if (s != visit_continue) + return s; + } + v->base_ir = prev_base_ir; + + return visit_continue; +} + + +ir_visitor_status +ir_variable::accept(ir_hierarchical_visitor *v) +{ + return v->visit(this); +} + + +ir_visitor_status +ir_loop::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = visit_list_elements(v, &this->body_instructions); + if (s == visit_stop) + return s; + + if (s != visit_continue_with_parent) { + if (this->from) { + s = this->from->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + if (this->to) { + s = this->to->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + if (this->increment) { + s = this->increment->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + } + + return v->visit_leave(this); +} + + +ir_visitor_status +ir_loop_jump::accept(ir_hierarchical_visitor *v) +{ + return v->visit(this); +} + + +ir_visitor_status +ir_function_signature::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = visit_list_elements(v, &this->parameters); + if (s == visit_stop) + return s; + + s = visit_list_elements(v, &this->body); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_function::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = visit_list_elements(v, &this->signatures); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_expression::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + for (unsigned i = 0; i < this->get_num_operands(); i++) { + switch (this->operands[i]->accept(v)) { + case visit_continue: + break; + + case visit_continue_with_parent: + // I wish for Java's labeled break-statement here. + goto done; + + case visit_stop: + return s; + } + } + +done: + return v->visit_leave(this); +} + +ir_visitor_status +ir_texture::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->sampler->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->coordinate->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + if (this->projector) { + s = this->projector->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + if (this->shadow_comparitor) { + s = this->shadow_comparitor->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + switch (this->op) { + case ir_tex: + break; + case ir_txb: + s = this->lod_info.bias->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + break; + case ir_txl: + case ir_txf: + s = this->lod_info.lod->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + break; + case ir_txd: + s = this->lod_info.grad.dPdx->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->lod_info.grad.dPdy->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + break; + } + + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_swizzle::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->val->accept(v); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_dereference_variable::accept(ir_hierarchical_visitor *v) +{ + return v->visit(this); +} + + +ir_visitor_status +ir_dereference_array::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + /* The array index is not the target of the assignment, so clear the + * 'in_assignee' flag. Restore it after returning from the array index. + */ + const bool was_in_assignee = v->in_assignee; + v->in_assignee = false; + s = this->array_index->accept(v); + v->in_assignee = was_in_assignee; + + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->array->accept(v); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_dereference_record::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->record->accept(v); + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_assignment::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + v->in_assignee = true; + s = this->lhs->accept(v); + v->in_assignee = false; + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->rhs->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + if (this->condition) + s = this->condition->accept(v); + + return (s == visit_stop) ? s : v->visit_leave(this); +} + + +ir_visitor_status +ir_constant::accept(ir_hierarchical_visitor *v) +{ + return v->visit(this); +} + + +ir_visitor_status +ir_call::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = visit_list_elements(v, &this->actual_parameters); + if (s == visit_stop) + return s; + + return v->visit_leave(this); +} + + +ir_visitor_status +ir_return::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + ir_rvalue *val = this->get_value(); + if (val) { + s = val->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + return v->visit_leave(this); +} + + +ir_visitor_status +ir_discard::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + if (this->condition != NULL) { + s = this->condition->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + } + + return v->visit_leave(this); +} + + +ir_visitor_status +ir_if::accept(ir_hierarchical_visitor *v) +{ + ir_visitor_status s = v->visit_enter(this); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + s = this->condition->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + + if (s != visit_continue_with_parent) { + s = visit_list_elements(v, &this->then_instructions); + if (s == visit_stop) + return s; + } + + if (s != visit_continue_with_parent) { + s = visit_list_elements(v, &this->else_instructions); + if (s == visit_stop) + return s; + } + + return v->visit_leave(this); +} diff --git a/mesalib/src/glsl/ir_if_simplification.cpp b/mesalib/src/glsl/ir_if_simplification.cpp new file mode 100644 index 000000000..021615ebd --- /dev/null +++ b/mesalib/src/glsl/ir_if_simplification.cpp @@ -0,0 +1,84 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_if_simplification.cpp + * + * Moves constant branches of if statements out to the surrounding + * instruction stream. + */ + +#include "ir.h" + +class ir_if_simplification_visitor : public ir_hierarchical_visitor { +public: + ir_if_simplification_visitor() + { + this->made_progress = false; + } + + ir_visitor_status visit_leave(ir_if *); + + bool made_progress; +}; + +bool +do_if_simplification(exec_list *instructions) +{ + ir_if_simplification_visitor v; + + v.run(instructions); + return v.made_progress; +} + + +ir_visitor_status +ir_if_simplification_visitor::visit_leave(ir_if *ir) +{ + /* FINISHME: Ideally there would be a way to note that the condition results + * FINISHME: in a constant before processing both of the other subtrees. + * FINISHME: This can probably be done with some flags, but it would take + * FINISHME: some work to get right. + */ + ir_constant *condition_constant = ir->condition->constant_expression_value(); + if (condition_constant) { + /* Move the contents of the one branch of the conditional + * that matters out. + */ + if (condition_constant->value.b[0]) { + foreach_iter(exec_list_iterator, then_iter, ir->then_instructions) { + ir_instruction *then_ir = (ir_instruction *)then_iter.get(); + ir->insert_before(then_ir); + } + } else { + foreach_iter(exec_list_iterator, else_iter, ir->else_instructions) { + ir_instruction *else_ir = (ir_instruction *)else_iter.get(); + ir->insert_before(else_ir); + } + } + ir->remove(); + this->made_progress = true; + } + + return visit_continue; +} diff --git a/mesalib/src/glsl/ir_if_to_cond_assign.cpp b/mesalib/src/glsl/ir_if_to_cond_assign.cpp new file mode 100644 index 000000000..0b8741394 --- /dev/null +++ b/mesalib/src/glsl/ir_if_to_cond_assign.cpp @@ -0,0 +1,168 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_if_to_cond_assign.cpp + * + * This attempts to flatten all if statements to conditional + * assignments for GPUs that don't do control flow. + * + * It can't handle other control flow being inside of its block, such + * as calls or loops. Hopefully loop unrolling and inlining will take + * care of those. + */ + +#include "glsl_types.h" +#include "ir.h" + +class ir_if_to_cond_assign_visitor : public ir_hierarchical_visitor { +public: + ir_if_to_cond_assign_visitor() + { + this->progress = false; + } + + ir_visitor_status visit_leave(ir_if *); + + bool progress; +}; + +bool +do_if_to_cond_assign(exec_list *instructions) +{ + ir_if_to_cond_assign_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} + +void +check_control_flow(ir_instruction *ir, void *data) +{ + bool *found_control_flow = (bool *)data; + switch (ir->ir_type) { + case ir_type_call: + case ir_type_discard: + case ir_type_loop: + case ir_type_loop_jump: + case ir_type_return: + *found_control_flow = true; + break; + default: + break; + } +} + +void +move_block_to_cond_assign(void *mem_ctx, + ir_if *if_ir, ir_variable *cond_var, bool then) +{ + exec_list *instructions; + + if (then) { + instructions = &if_ir->then_instructions; + } else { + instructions = &if_ir->else_instructions; + } + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + + if (ir->ir_type == ir_type_assignment) { + ir_assignment *assign = (ir_assignment *)ir; + ir_rvalue *cond_expr; + ir_dereference *deref = new(mem_ctx) ir_dereference_variable(cond_var); + + if (then) { + cond_expr = deref; + } else { + cond_expr = new(mem_ctx) ir_expression(ir_unop_logic_not, + glsl_type::bool_type, + deref, + NULL); + } + + if (!assign->condition) { + assign->condition = cond_expr; + } else { + assign->condition = new(mem_ctx) ir_expression(ir_binop_logic_and, + glsl_type::bool_type, + cond_expr, + assign->condition); + } + } + + /* Now, move from the if block to the block surrounding it. */ + ir->remove(); + if_ir->insert_before(ir); + } +} + +ir_visitor_status +ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir) +{ + bool found_control_flow = false; + ir_variable *cond_var; + ir_assignment *assign; + ir_dereference_variable *deref; + + /* Check that both blocks don't contain anything we can't support. */ + foreach_iter(exec_list_iterator, then_iter, ir->then_instructions) { + ir_instruction *then_ir = (ir_instruction *)then_iter.get(); + visit_tree(then_ir, check_control_flow, &found_control_flow); + } + foreach_iter(exec_list_iterator, else_iter, ir->else_instructions) { + ir_instruction *else_ir = (ir_instruction *)else_iter.get(); + visit_tree(else_ir, check_control_flow, &found_control_flow); + } + if (found_control_flow) + return visit_continue; + + void *mem_ctx = talloc_parent(ir); + + /* Store the condition to a variable so the assignment conditions are + * simpler. + */ + cond_var = new(mem_ctx) ir_variable(glsl_type::bool_type, + "if_to_cond_assign_condition", + ir_var_temporary); + ir->insert_before(cond_var); + + deref = new(mem_ctx) ir_dereference_variable(cond_var); + assign = new(mem_ctx) ir_assignment(deref, + ir->condition, NULL); + ir->insert_before(assign); + + /* Now, move all of the instructions out of the if blocks, putting + * conditions on assignments. + */ + move_block_to_cond_assign(mem_ctx, ir, cond_var, true); + move_block_to_cond_assign(mem_ctx, ir, cond_var, false); + + ir->remove(); + + this->progress = true; + + return visit_continue; +} diff --git a/mesalib/src/glsl/ir_import_prototypes.cpp b/mesalib/src/glsl/ir_import_prototypes.cpp new file mode 100644 index 000000000..066137e60 --- /dev/null +++ b/mesalib/src/glsl/ir_import_prototypes.cpp @@ -0,0 +1,138 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_import_prototypes.cpp + * Import function prototypes from one IR tree into another. + * + * \author Ian Romanick + */ +#include <cstdio> +#include "ir.h" +#include "glsl_symbol_table.h" + +/** + * Visitor used to import function prototypes + * + * Normally the \c clone method of either \c ir_function or + * \c ir_function_signature could be used. However, we don't want a complete + * clone of the \c ir_function_signature. We want everything \b except the + * body of the function. + */ +class import_prototype_visitor : public ir_hierarchical_visitor { +public: + /** + */ + import_prototype_visitor(exec_list *list, glsl_symbol_table *symbols, + void *mem_ctx) + { + this->mem_ctx = mem_ctx; + this->list = list; + this->symbols = symbols; + this->function = NULL; + } + + virtual ir_visitor_status visit_enter(ir_function *ir) + { + assert(this->function == NULL); + + this->function = this->symbols->get_function(ir->name); + if (!this->function) { + this->function = new(this->mem_ctx) ir_function(ir->name); + + list->push_tail(this->function); + + /* Add the new function to the symbol table. + */ + this->symbols->add_function(this->function->name, this->function); + } + return visit_continue; + } + + virtual ir_visitor_status visit_leave(ir_function *ir) + { + (void) ir; + assert(this->function != NULL); + + this->function = NULL; + return visit_continue; + } + + ir_visitor_status visit_enter(ir_function_signature *ir) + { + assert(this->function != NULL); + + ir_function_signature *copy = + new(mem_ctx) ir_function_signature(ir->return_type); + + copy->is_defined = false; + copy->is_builtin = ir->is_builtin; + + /* Clone the parameter list, but NOT the body. + */ + foreach_list_const(node, &ir->parameters) { + const ir_variable *const param = (const ir_variable *) node; + + assert(const_cast<ir_variable *>(param)->as_variable() != NULL); + + ir_variable *const param_copy = param->clone(mem_ctx, NULL); + copy->parameters.push_tail(param_copy); + } + + this->function->add_signature(copy); + + /* Do not process child nodes of the ir_function_signature. There can + * never be any nodes inside the ir_function_signature that we care + * about. Instead continue with the next sibling. + */ + return visit_continue_with_parent; + } + +private: + exec_list *list; + ir_function *function; + glsl_symbol_table *symbols; + void *mem_ctx; +}; + + +/** + * Import function prototypes from one IR tree into another + * + * \param source Source instruction stream containing functions whose + * prototypes are to be imported + * \param dest Destination instruction stream where new \c ir_function and + * \c ir_function_signature nodes will be stored + * \param symbols Symbol table where new functions will be stored + * \param mem_ctx talloc memory context used for new allocations + */ +void +import_prototypes(const exec_list *source, exec_list *dest, + glsl_symbol_table *symbols, void *mem_ctx) +{ + import_prototype_visitor v(dest, symbols, mem_ctx); + + /* Making source be const is just extra documentation. + */ + v.run(const_cast<exec_list *>(source)); +} diff --git a/mesalib/src/glsl/ir_lower_jumps.cpp b/mesalib/src/glsl/ir_lower_jumps.cpp new file mode 100644 index 000000000..b69cc1ec3 --- /dev/null +++ b/mesalib/src/glsl/ir_lower_jumps.cpp @@ -0,0 +1,544 @@ +/* + * Copyright © 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_lower_jumps.cpp + */ + +#include "glsl_types.h" +#include <string.h> +#include "ir.h" + +enum jump_strength +{ + strength_none, + strength_always_clears_execute_flag, + strength_continue, + strength_break, + strength_return, + strength_discard +}; + +struct block_record +{ + /* minimum jump strength (of lowered IR, not pre-lowering IR) + * + * If the block ends with a jump, must be the strength of the jump. + * Otherwise, the jump would be dead and have been deleted before) + * + * If the block doesn't end with a jump, it can be different than strength_none if all paths before it lead to some jump + * (e.g. an if with a return in one branch, and a break in the other, while not lowering them) + * Note that identical jumps are usually unified though. + */ + jump_strength min_strength; + + /* can anything clear the execute flag? */ + bool may_clear_execute_flag; + + block_record() + { + this->min_strength = strength_none; + this->may_clear_execute_flag = false; + } +}; + +struct loop_record +{ + ir_function_signature* signature; + ir_loop* loop; + + /* used to avoid lowering the break used to represent lowered breaks */ + unsigned nesting_depth; + bool in_if_at_the_end_of_the_loop; + + bool may_set_return_flag; + + ir_variable* break_flag; + ir_variable* execute_flag; /* cleared to emulate continue */ + + loop_record(ir_function_signature* p_signature = 0, ir_loop* p_loop = 0) + { + this->signature = p_signature; + this->loop = p_loop; + this->nesting_depth = 0; + this->in_if_at_the_end_of_the_loop = false; + this->may_set_return_flag = false; + this->break_flag = 0; + this->execute_flag = 0; + } + + ir_variable* get_execute_flag() + { + /* also supported for the "function loop" */ + if(!this->execute_flag) { + exec_list& list = this->loop ? this->loop->body_instructions : signature->body; + this->execute_flag = new(this->signature) ir_variable(glsl_type::bool_type, "execute_flag", ir_var_temporary); + list.push_head(new(this->signature) ir_assignment(new(this->signature) ir_dereference_variable(execute_flag), new(this->signature) ir_constant(true), 0)); + list.push_head(this->execute_flag); + } + return this->execute_flag; + } + + ir_variable* get_break_flag() + { + assert(this->loop); + if(!this->break_flag) { + this->break_flag = new(this->signature) ir_variable(glsl_type::bool_type, "break_flag", ir_var_temporary); + this->loop->insert_before(this->break_flag); + this->loop->insert_before(new(this->signature) ir_assignment(new(this->signature) ir_dereference_variable(break_flag), new(this->signature) ir_constant(false), 0)); + } + return this->break_flag; + } +}; + +struct function_record +{ + ir_function_signature* signature; + ir_variable* return_flag; /* used to break out of all loops and then jump to the return instruction */ + ir_variable* return_value; + bool is_main; + unsigned nesting_depth; + + function_record(ir_function_signature* p_signature = 0) + { + this->signature = p_signature; + this->return_flag = 0; + this->return_value = 0; + this->nesting_depth = 0; + this->is_main = this->signature && (strcmp(this->signature->function_name(), "main") == 0); + } + + ir_variable* get_return_flag() + { + if(!this->return_flag) { + this->return_flag = new(this->signature) ir_variable(glsl_type::bool_type, "return_flag", ir_var_temporary); + this->signature->body.push_head(new(this->signature) ir_assignment(new(this->signature) ir_dereference_variable(return_flag), new(this->signature) ir_constant(false), 0)); + this->signature->body.push_head(this->return_flag); + } + return this->return_flag; + } + + ir_variable* get_return_value() + { + if(!this->return_value) { + assert(!this->signature->return_type->is_void()); + return_value = new(this->signature) ir_variable(this->signature->return_type, "return_value", ir_var_temporary); + this->signature->body.push_head(this->return_value); + } + return this->return_value; + } +}; + +struct ir_lower_jumps_visitor : public ir_control_flow_visitor { + bool progress; + + struct function_record function; + struct loop_record loop; + struct block_record block; + + bool pull_out_jumps; + bool lower_continue; + bool lower_break; + bool lower_sub_return; + bool lower_main_return; + + ir_lower_jumps_visitor() + { + this->progress = false; + } + + void truncate_after_instruction(exec_node *ir) + { + if (!ir) + return; + + while (!ir->get_next()->is_tail_sentinel()) { + ((ir_instruction *)ir->get_next())->remove(); + this->progress = true; + } + } + + void move_outer_block_inside(ir_instruction *ir, exec_list *inner_block) + { + while (!ir->get_next()->is_tail_sentinel()) { + ir_instruction *move_ir = (ir_instruction *)ir->get_next(); + + move_ir->remove(); + inner_block->push_tail(move_ir); + } + } + + virtual void visit(class ir_loop_jump * ir) + { + truncate_after_instruction(ir); + this->block.min_strength = ir->is_break() ? strength_break : strength_continue; + } + + virtual void visit(class ir_return * ir) + { + truncate_after_instruction(ir); + this->block.min_strength = strength_return; + } + + virtual void visit(class ir_discard * ir) + { + truncate_after_instruction(ir); + this->block.min_strength = strength_discard; + } + + enum jump_strength get_jump_strength(ir_instruction* ir) + { + if(!ir) + return strength_none; + else if(ir->ir_type == ir_type_loop_jump) { + if(((ir_loop_jump*)ir)->is_break()) + return strength_break; + else + return strength_continue; + } else if(ir->ir_type == ir_type_return) + return strength_return; + else if(ir->ir_type == ir_type_discard) + return strength_discard; + else + return strength_none; + } + + bool should_lower_jump(ir_jump* ir) + { + unsigned strength = get_jump_strength(ir); + bool lower; + switch(strength) + { + case strength_none: + lower = false; /* don't change this, code relies on it */ + break; + case strength_continue: + lower = lower_continue; + break; + case strength_break: + assert(this->loop.loop); + /* never lower "canonical break" */ + if(ir->get_next()->is_tail_sentinel() && (this->loop.nesting_depth == 0 + || (this->loop.nesting_depth == 1 && this->loop.in_if_at_the_end_of_the_loop))) + lower = false; + else + lower = lower_break; + break; + case strength_return: + /* never lower return at the end of a this->function */ + if(this->function.nesting_depth == 0 && ir->get_next()->is_tail_sentinel()) + lower = false; + else if (this->function.is_main) + lower = lower_main_return; + else + lower = lower_sub_return; + break; + case strength_discard: + lower = false; /* probably nothing needs this lowered */ + break; + } + return lower; + } + + block_record visit_block(exec_list* list) + { + block_record saved_block = this->block; + this->block = block_record(); + visit_exec_list(list, this); + block_record ret = this->block; + this->block = saved_block; + return ret; + } + + virtual void visit(ir_if *ir) + { + if(this->loop.nesting_depth == 0 && ir->get_next()->is_tail_sentinel()) + this->loop.in_if_at_the_end_of_the_loop = true; + + ++this->function.nesting_depth; + ++this->loop.nesting_depth; + + block_record block_records[2]; + ir_jump* jumps[2]; + + block_records[0] = visit_block(&ir->then_instructions); + block_records[1] = visit_block(&ir->else_instructions); + +retry: /* we get here if we put code after the if inside a branch */ + for(unsigned i = 0; i < 2; ++i) { + exec_list& list = i ? ir->else_instructions : ir->then_instructions; + jumps[i] = 0; + if(!list.is_empty() && get_jump_strength((ir_instruction*)list.get_tail())) + jumps[i] = (ir_jump*)list.get_tail(); + } + + for(;;) { + jump_strength jump_strengths[2]; + + for(unsigned i = 0; i < 2; ++i) { + if(jumps[i]) { + jump_strengths[i] = block_records[i].min_strength; + assert(jump_strengths[i] == get_jump_strength(jumps[i])); + } else + jump_strengths[i] = strength_none; + } + + /* move both jumps out if possible */ + if(pull_out_jumps && jump_strengths[0] == jump_strengths[1]) { + bool unify = true; + if(jump_strengths[0] == strength_continue) + ir->insert_after(new(ir) ir_loop_jump(ir_loop_jump::jump_continue)); + else if(jump_strengths[0] == strength_break) + ir->insert_after(new(ir) ir_loop_jump(ir_loop_jump::jump_break)); + /* FINISHME: unify returns with identical expressions */ + else if(jump_strengths[0] == strength_return && this->function.signature->return_type->is_void()) + ir->insert_after(new(ir) ir_return(NULL)); + /* FINISHME: unify discards */ + else + unify = false; + + if(unify) { + jumps[0]->remove(); + jumps[1]->remove(); + this->progress = true; + + jumps[0] = 0; + jumps[1] = 0; + block_records[0].min_strength = strength_none; + block_records[1].min_strength = strength_none; + break; + } + } + + /* lower a jump: if both need to lowered, start with the strongest one, so that + * we might later unify the lowered version with the other one + */ + bool should_lower[2]; + for(unsigned i = 0; i < 2; ++i) + should_lower[i] = should_lower_jump(jumps[i]); + + int lower; + if(should_lower[1] && should_lower[0]) + lower = jump_strengths[1] > jump_strengths[0]; + else if(should_lower[0]) + lower = 0; + else if(should_lower[1]) + lower = 1; + else + break; + + if(jump_strengths[lower] == strength_return) { + ir_variable* return_flag = this->function.get_return_flag(); + if(!this->function.signature->return_type->is_void()) { + ir_variable* return_value = this->function.get_return_value(); + jumps[lower]->insert_before(new(ir) ir_assignment(new (ir) ir_dereference_variable(return_value), ((ir_return*)jumps[lower])->value, NULL)); + } + jumps[lower]->insert_before(new(ir) ir_assignment(new (ir) ir_dereference_variable(return_flag), new (ir) ir_constant(true), NULL)); + this->loop.may_set_return_flag = true; + if(this->loop.loop) { + ir_loop_jump* lowered = 0; + lowered = new(ir) ir_loop_jump(ir_loop_jump::jump_break); + block_records[lower].min_strength = strength_break; + jumps[lower]->replace_with(lowered); + jumps[lower] = lowered; + } else + goto lower_continue; + this->progress = true; + } else if(jump_strengths[lower] == strength_break) { + /* We can't lower to an actual continue because that would execute the increment. + * + * In the lowered code, we instead put the break check between the this->loop body and the increment, + * which is impossible with a real continue as defined by the GLSL IR currently. + * + * Smarter options (such as undoing the increment) are possible but it's not worth implementing them, + * because if break is lowered, continue is almost surely lowered too. + */ + jumps[lower]->insert_before(new(ir) ir_assignment(new (ir) ir_dereference_variable(this->loop.get_break_flag()), new (ir) ir_constant(true), 0)); + goto lower_continue; + } else if(jump_strengths[lower] == strength_continue) { +lower_continue: + ir_variable* execute_flag = this->loop.get_execute_flag(); + jumps[lower]->replace_with(new(ir) ir_assignment(new (ir) ir_dereference_variable(execute_flag), new (ir) ir_constant(false), 0)); + jumps[lower] = 0; + block_records[lower].min_strength = strength_always_clears_execute_flag; + block_records[lower].may_clear_execute_flag = true; + this->progress = true; + break; + } + } + + /* move out a jump out if possible */ + if(pull_out_jumps) { + int move_out = -1; + if(jumps[0] && block_records[1].min_strength >= strength_continue) + move_out = 0; + else if(jumps[1] && block_records[0].min_strength >= strength_continue) + move_out = 1; + + if(move_out >= 0) + { + jumps[move_out]->remove(); + ir->insert_after(jumps[move_out]); + jumps[move_out] = 0; + block_records[move_out].min_strength = strength_none; + this->progress = true; + } + } + + if(block_records[0].min_strength < block_records[1].min_strength) + this->block.min_strength = block_records[0].min_strength; + else + this->block.min_strength = block_records[1].min_strength; + this->block.may_clear_execute_flag = this->block.may_clear_execute_flag || block_records[0].may_clear_execute_flag || block_records[1].may_clear_execute_flag; + + if(this->block.min_strength) + truncate_after_instruction(ir); + else if(this->block.may_clear_execute_flag) + { + int move_into = -1; + if(block_records[0].min_strength && !block_records[1].may_clear_execute_flag) + move_into = 1; + else if(block_records[1].min_strength && !block_records[0].may_clear_execute_flag) + move_into = 0; + + if(move_into >= 0) { + assert(!block_records[move_into].min_strength && !block_records[move_into].may_clear_execute_flag); /* otherwise, we just truncated */ + + exec_list* list = move_into ? &ir->else_instructions : &ir->then_instructions; + exec_node* next = ir->get_next(); + if(!next->is_tail_sentinel()) { + move_outer_block_inside(ir, list); + + exec_list list; + list.head = next; + block_records[move_into] = visit_block(&list); + + this->progress = true; + goto retry; + } + } else { + ir_instruction* ir_after; + for(ir_after = (ir_instruction*)ir->get_next(); !ir_after->is_tail_sentinel();) + { + ir_if* ir_if = ir_after->as_if(); + if(ir_if && ir_if->else_instructions.is_empty()) { + ir_dereference_variable* ir_if_cond_deref = ir_if->condition->as_dereference_variable(); + if(ir_if_cond_deref && ir_if_cond_deref->var == this->loop.execute_flag) { + ir_instruction* ir_next = (ir_instruction*)ir_after->get_next(); + ir_after->insert_before(&ir_if->then_instructions); + ir_after->remove(); + ir_after = ir_next; + continue; + } + } + ir_after = (ir_instruction*)ir_after->get_next(); + + /* only set this if we find any unprotected instruction */ + this->progress = true; + } + + if(!ir->get_next()->is_tail_sentinel()) { + assert(this->loop.execute_flag); + ir_if* if_execute = new(ir) ir_if(new(ir) ir_dereference_variable(this->loop.execute_flag)); + move_outer_block_inside(ir, &if_execute->then_instructions); + ir->insert_after(if_execute); + } + } + } + --this->loop.nesting_depth; + --this->function.nesting_depth; + } + + virtual void visit(ir_loop *ir) + { + ++this->function.nesting_depth; + loop_record saved_loop = this->loop; + this->loop = loop_record(this->function.signature, ir); + + block_record body = visit_block(&ir->body_instructions); + + if(body.min_strength >= strength_break) { + /* FINISHME: turn the this->loop into an if, or replace it with its body */ + } + + if(this->loop.break_flag) { + ir_if* break_if = new(ir) ir_if(new(ir) ir_dereference_variable(this->loop.break_flag)); + break_if->then_instructions.push_tail(new(ir) ir_loop_jump(ir_loop_jump::jump_break)); + ir->body_instructions.push_tail(break_if); + } + + if(this->loop.may_set_return_flag) { + assert(this->function.return_flag); + ir_if* return_if = new(ir) ir_if(new(ir) ir_dereference_variable(this->function.return_flag)); + return_if->then_instructions.push_tail(new(ir) ir_loop_jump(saved_loop.loop ? ir_loop_jump::jump_break : ir_loop_jump::jump_continue)); + ir->insert_after(return_if); + } + + this->loop = saved_loop; + --this->function.nesting_depth; + } + + virtual void visit(ir_function_signature *ir) + { + /* these are not strictly necessary */ + assert(!this->function.signature); + assert(!this->loop.loop); + + function_record saved_function = this->function; + loop_record saved_loop = this->loop; + this->function = function_record(ir); + this->loop = loop_record(ir); + + assert(!this->loop.loop); + visit_block(&ir->body); + + if(this->function.return_value) + ir->body.push_tail(new(ir) ir_return(new (ir) ir_dereference_variable(this->function.return_value))); + + this->loop = saved_loop; + this->function = saved_function; + } + + virtual void visit(class ir_function * ir) + { + visit_block(&ir->signatures); + } +}; + +bool +do_lower_jumps(exec_list *instructions, bool pull_out_jumps, bool lower_sub_return, bool lower_main_return, bool lower_continue, bool lower_break) +{ + ir_lower_jumps_visitor v; + v.pull_out_jumps = pull_out_jumps; + v.lower_continue = lower_continue; + v.lower_break = lower_break; + v.lower_sub_return = lower_sub_return; + v.lower_main_return = lower_main_return; + + do { + v.progress = false; + visit_exec_list(instructions, &v); + } while (v.progress); + + return v.progress; +} diff --git a/mesalib/src/glsl/ir_mat_op_to_vec.cpp b/mesalib/src/glsl/ir_mat_op_to_vec.cpp new file mode 100644 index 000000000..244fe4892 --- /dev/null +++ b/mesalib/src/glsl/ir_mat_op_to_vec.cpp @@ -0,0 +1,488 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_mat_op_to_vec.cpp + * + * Breaks matrix operation expressions down to a series of vector operations. + * + * Generally this is how we have to codegen matrix operations for a + * GPU, so this gives us the chance to constant fold operations on a + * column or row. + */ + +#include "ir.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" + +class ir_mat_op_to_vec_visitor : public ir_hierarchical_visitor { +public: + ir_mat_op_to_vec_visitor() + { + this->made_progress = false; + this->mem_ctx = NULL; + } + + ir_visitor_status visit_leave(ir_assignment *); + + ir_dereference *get_column(ir_variable *var, int col); + ir_rvalue *get_element(ir_variable *var, int col, int row); + + void do_mul_mat_mat(ir_variable *result_var, + ir_variable *a_var, ir_variable *b_var); + void do_mul_mat_vec(ir_variable *result_var, + ir_variable *a_var, ir_variable *b_var); + void do_mul_vec_mat(ir_variable *result_var, + ir_variable *a_var, ir_variable *b_var); + void do_mul_mat_scalar(ir_variable *result_var, + ir_variable *a_var, ir_variable *b_var); + void do_equal_mat_mat(ir_variable *result_var, ir_variable *a_var, + ir_variable *b_var, bool test_equal); + + void *mem_ctx; + bool made_progress; +}; + +static bool +mat_op_to_vec_predicate(ir_instruction *ir) +{ + ir_expression *expr = ir->as_expression(); + unsigned int i; + + if (!expr) + return false; + + for (i = 0; i < expr->get_num_operands(); i++) { + if (expr->operands[i]->type->is_matrix()) + return true; + } + + return false; +} + +bool +do_mat_op_to_vec(exec_list *instructions) +{ + ir_mat_op_to_vec_visitor v; + + /* Pull out any matrix expression to a separate assignment to a + * temp. This will make our handling of the breakdown to + * operations on the matrix's vector components much easier. + */ + do_expression_flattening(instructions, mat_op_to_vec_predicate); + + visit_list_elements(&v, instructions); + + return v.made_progress; +} + +ir_rvalue * +ir_mat_op_to_vec_visitor::get_element(ir_variable *var, int col, int row) +{ + ir_dereference *deref; + + deref = new(mem_ctx) ir_dereference_variable(var); + + if (var->type->is_matrix()) { + deref = new(mem_ctx) ir_dereference_array(var, + new(mem_ctx) ir_constant(col)); + } else { + assert(col == 0); + } + + return new(mem_ctx) ir_swizzle(deref, row, 0, 0, 0, 1); +} + +ir_dereference * +ir_mat_op_to_vec_visitor::get_column(ir_variable *var, int row) +{ + ir_dereference *deref; + + if (!var->type->is_matrix()) { + deref = new(mem_ctx) ir_dereference_variable(var); + } else { + deref = new(mem_ctx) ir_dereference_variable(var); + deref = new(mem_ctx) ir_dereference_array(deref, + new(mem_ctx) ir_constant(row)); + } + + return deref; +} + +void +ir_mat_op_to_vec_visitor::do_mul_mat_mat(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var) +{ + int b_col, i; + ir_assignment *assign; + ir_expression *expr; + + for (b_col = 0; b_col < b_var->type->matrix_columns; b_col++) { + ir_rvalue *a = get_column(a_var, 0); + ir_rvalue *b = get_element(b_var, b_col, 0); + + /* first column */ + expr = new(mem_ctx) ir_expression(ir_binop_mul, + a->type, + a, + b); + + /* following columns */ + for (i = 1; i < a_var->type->matrix_columns; i++) { + ir_expression *mul_expr; + + a = get_column(a_var, i); + b = get_element(b_var, b_col, i); + + mul_expr = new(mem_ctx) ir_expression(ir_binop_mul, + a->type, + a, + b); + expr = new(mem_ctx) ir_expression(ir_binop_add, + a->type, + expr, + mul_expr); + } + + ir_rvalue *result = get_column(result_var, b_col); + assign = new(mem_ctx) ir_assignment(result, + expr, + NULL); + base_ir->insert_before(assign); + } +} + +void +ir_mat_op_to_vec_visitor::do_mul_mat_vec(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var) +{ + int i; + ir_rvalue *a = get_column(a_var, 0); + ir_rvalue *b = get_element(b_var, 0, 0); + ir_assignment *assign; + ir_expression *expr; + + /* first column */ + expr = new(mem_ctx) ir_expression(ir_binop_mul, + result_var->type, + a, + b); + + /* following columns */ + for (i = 1; i < a_var->type->matrix_columns; i++) { + ir_expression *mul_expr; + + a = get_column(a_var, i); + b = get_element(b_var, 0, i); + + mul_expr = new(mem_ctx) ir_expression(ir_binop_mul, + result_var->type, + a, + b); + expr = new(mem_ctx) ir_expression(ir_binop_add, + result_var->type, + expr, + mul_expr); + } + + ir_rvalue *result = new(mem_ctx) ir_dereference_variable(result_var); + assign = new(mem_ctx) ir_assignment(result, + expr, + NULL); + base_ir->insert_before(assign); +} + +void +ir_mat_op_to_vec_visitor::do_mul_vec_mat(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var) +{ + int i; + + for (i = 0; i < b_var->type->matrix_columns; i++) { + ir_rvalue *a = new(mem_ctx) ir_dereference_variable(a_var); + ir_rvalue *b = get_column(b_var, i); + ir_rvalue *result; + ir_expression *column_expr; + ir_assignment *column_assign; + + result = new(mem_ctx) ir_dereference_variable(result_var); + result = new(mem_ctx) ir_swizzle(result, i, 0, 0, 0, 1); + + column_expr = new(mem_ctx) ir_expression(ir_binop_dot, + result->type, + a, + b); + + column_assign = new(mem_ctx) ir_assignment(result, + column_expr, + NULL); + base_ir->insert_before(column_assign); + } +} + +void +ir_mat_op_to_vec_visitor::do_mul_mat_scalar(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var) +{ + int i; + + for (i = 0; i < a_var->type->matrix_columns; i++) { + ir_rvalue *a = get_column(a_var, i); + ir_rvalue *b = new(mem_ctx) ir_dereference_variable(b_var); + ir_rvalue *result = get_column(result_var, i); + ir_expression *column_expr; + ir_assignment *column_assign; + + column_expr = new(mem_ctx) ir_expression(ir_binop_mul, + result->type, + a, + b); + + column_assign = new(mem_ctx) ir_assignment(result, + column_expr, + NULL); + base_ir->insert_before(column_assign); + } +} + +void +ir_mat_op_to_vec_visitor::do_equal_mat_mat(ir_variable *result_var, + ir_variable *a_var, + ir_variable *b_var, + bool test_equal) +{ + /* This essentially implements the following GLSL: + * + * bool equal(mat4 a, mat4 b) + * { + * return !any(bvec4(a[0] != b[0], + * a[1] != b[1], + * a[2] != b[2], + * a[3] != b[3]); + * } + * + * bool nequal(mat4 a, mat4 b) + * { + * return any(bvec4(a[0] != b[0], + * a[1] != b[1], + * a[2] != b[2], + * a[3] != b[3]); + * } + */ + const unsigned columns = a_var->type->matrix_columns; + const glsl_type *const bvec_type = + glsl_type::get_instance(GLSL_TYPE_BOOL, columns, 1); + + ir_variable *const tmp_bvec = + new(this->mem_ctx) ir_variable(bvec_type, "mat_cmp_bvec", + ir_var_temporary); + this->base_ir->insert_before(tmp_bvec); + + for (unsigned i = 0; i < columns; i++) { + ir_dereference *const op0 = get_column(a_var, i); + ir_dereference *const op1 = get_column(b_var, i); + + ir_expression *const cmp = + new(this->mem_ctx) ir_expression(ir_binop_any_nequal, + glsl_type::bool_type, op0, op1); + + ir_dereference *const lhs = + new(this->mem_ctx) ir_dereference_variable(tmp_bvec); + + ir_assignment *const assign = + new(this->mem_ctx) ir_assignment(lhs, cmp, NULL, (1U << i)); + + this->base_ir->insert_before(assign); + } + + ir_rvalue *const val = + new(this->mem_ctx) ir_dereference_variable(tmp_bvec); + + ir_expression *any = + new(this->mem_ctx) ir_expression(ir_unop_any, glsl_type::bool_type, + val, NULL); + + if (test_equal) + any = new(this->mem_ctx) ir_expression(ir_unop_logic_not, + glsl_type::bool_type, + any, NULL); + + ir_rvalue *const result = + new(this->mem_ctx) ir_dereference_variable(result_var); + + ir_assignment *const assign = + new(mem_ctx) ir_assignment(result, any, NULL); + base_ir->insert_before(assign); +} + +static bool +has_matrix_operand(const ir_expression *expr, unsigned &columns) +{ + for (unsigned i = 0; i < expr->get_num_operands(); i++) { + if (expr->operands[i]->type->is_matrix()) { + columns = expr->operands[i]->type->matrix_columns; + return true; + } + } + + return false; +} + + +ir_visitor_status +ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *orig_assign) +{ + ir_expression *orig_expr = orig_assign->rhs->as_expression(); + unsigned int i, matrix_columns = 1; + ir_variable *op_var[2]; + + if (!orig_expr) + return visit_continue; + + if (!has_matrix_operand(orig_expr, matrix_columns)) + return visit_continue; + + mem_ctx = talloc_parent(orig_assign); + + ir_dereference_variable *lhs_deref = + orig_assign->lhs->as_dereference_variable(); + assert(lhs_deref); + + ir_variable *result_var = lhs_deref->var; + + /* Store the expression operands in temps so we can use them + * multiple times. + */ + for (i = 0; i < orig_expr->get_num_operands(); i++) { + ir_assignment *assign; + + op_var[i] = new(mem_ctx) ir_variable(orig_expr->operands[i]->type, + "mat_op_to_vec", + ir_var_temporary); + base_ir->insert_before(op_var[i]); + + lhs_deref = new(mem_ctx) ir_dereference_variable(op_var[i]); + assign = new(mem_ctx) ir_assignment(lhs_deref, + orig_expr->operands[i], + NULL); + base_ir->insert_before(assign); + } + + /* OK, time to break down this matrix operation. */ + switch (orig_expr->operation) { + case ir_unop_neg: { + const unsigned mask = (1U << result_var->type->vector_elements) - 1; + + /* Apply the operation to each column.*/ + for (i = 0; i < matrix_columns; i++) { + ir_rvalue *op0 = get_column(op_var[0], i); + ir_dereference *result = get_column(result_var, i); + ir_expression *column_expr; + ir_assignment *column_assign; + + column_expr = new(mem_ctx) ir_expression(orig_expr->operation, + result->type, + op0, + NULL); + + column_assign = new(mem_ctx) ir_assignment(result, + column_expr, + NULL, + mask); + assert(column_assign->write_mask != 0); + base_ir->insert_before(column_assign); + } + break; + } + case ir_binop_add: + case ir_binop_sub: + case ir_binop_div: + case ir_binop_mod: { + const unsigned mask = (1U << result_var->type->vector_elements) - 1; + + /* For most operations, the matrix version is just going + * column-wise through and applying the operation to each column + * if available. + */ + for (i = 0; i < matrix_columns; i++) { + ir_rvalue *op0 = get_column(op_var[0], i); + ir_rvalue *op1 = get_column(op_var[1], i); + ir_dereference *result = get_column(result_var, i); + ir_expression *column_expr; + ir_assignment *column_assign; + + column_expr = new(mem_ctx) ir_expression(orig_expr->operation, + result->type, + op0, + op1); + + column_assign = new(mem_ctx) ir_assignment(result, + column_expr, + NULL, + mask); + assert(column_assign->write_mask != 0); + base_ir->insert_before(column_assign); + } + break; + } + case ir_binop_mul: + if (op_var[0]->type->is_matrix()) { + if (op_var[1]->type->is_matrix()) { + do_mul_mat_mat(result_var, op_var[0], op_var[1]); + } else if (op_var[1]->type->is_vector()) { + do_mul_mat_vec(result_var, op_var[0], op_var[1]); + } else { + assert(op_var[1]->type->is_scalar()); + do_mul_mat_scalar(result_var, op_var[0], op_var[1]); + } + } else { + assert(op_var[1]->type->is_matrix()); + if (op_var[0]->type->is_vector()) { + do_mul_vec_mat(result_var, op_var[0], op_var[1]); + } else { + assert(op_var[0]->type->is_scalar()); + do_mul_mat_scalar(result_var, op_var[1], op_var[0]); + } + } + break; + + case ir_binop_all_equal: + case ir_binop_any_nequal: + do_equal_mat_mat(result_var, op_var[1], op_var[0], + (orig_expr->operation == ir_binop_all_equal)); + break; + + default: + printf("FINISHME: Handle matrix operation for %s\n", + orig_expr->operator_string()); + abort(); + } + orig_assign->remove(); + this->made_progress = true; + + return visit_continue; +} diff --git a/mesalib/src/glsl/ir_mod_to_fract.cpp b/mesalib/src/glsl/ir_mod_to_fract.cpp new file mode 100644 index 000000000..c82a1f64f --- /dev/null +++ b/mesalib/src/glsl/ir_mod_to_fract.cpp @@ -0,0 +1,90 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_mod_to_fract.cpp + * + * Breaks an ir_unop_mod expression down to (op1 * fract(op0 / op1)) + * + * Many GPUs don't have a MOD instruction (945 and 965 included), and + * if we have to break it down like this anyway, it gives an + * opportunity to do things like constant fold the (1.0 / op1) easily. + */ + +#include "ir.h" + +class ir_mod_to_fract_visitor : public ir_hierarchical_visitor { +public: + ir_mod_to_fract_visitor() + { + this->made_progress = false; + } + + ir_visitor_status visit_leave(ir_expression *); + + bool made_progress; +}; + +bool +do_mod_to_fract(exec_list *instructions) +{ + ir_mod_to_fract_visitor v; + + visit_list_elements(&v, instructions); + return v.made_progress; +} + +ir_visitor_status +ir_mod_to_fract_visitor::visit_leave(ir_expression *ir) +{ + if (ir->operation != ir_binop_mod) + return visit_continue; + + ir_variable *temp = new(ir) ir_variable(ir->operands[1]->type, "mod_b", + ir_var_temporary); + this->base_ir->insert_before(temp); + + ir_assignment *assign; + ir_rvalue *expr; + + assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(temp), + ir->operands[1], NULL); + this->base_ir->insert_before(assign); + + expr = new(ir) ir_expression(ir_binop_div, + ir->operands[0]->type, + ir->operands[0], + new(ir) ir_dereference_variable(temp)); + + expr = new(ir) ir_expression(ir_unop_fract, + ir->operands[0]->type, + expr, + NULL); + + ir->operation = ir_binop_mul; + ir->operands[0] = new(ir) ir_dereference_variable(temp); + ir->operands[1] = expr; + this->made_progress = true; + + return visit_continue; +} diff --git a/mesalib/src/glsl/ir_noop_swizzle.cpp b/mesalib/src/glsl/ir_noop_swizzle.cpp new file mode 100644 index 000000000..0403dfa4e --- /dev/null +++ b/mesalib/src/glsl/ir_noop_swizzle.cpp @@ -0,0 +1,80 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_noop_swizzle.cpp + * + * If a swizzle doesn't change the order or count of components, then + * remove the swizzle so that other optimization passes see the value + * behind it. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_print_visitor.h" +#include "glsl_types.h" + +class ir_noop_swizzle_visitor : public ir_rvalue_visitor { +public: + ir_noop_swizzle_visitor() + { + this->progress = false; + } + + void handle_rvalue(ir_rvalue **rvalue); + bool progress; +}; + +void +ir_noop_swizzle_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_swizzle *swiz = (*rvalue)->as_swizzle(); + if (!swiz || swiz->type != swiz->val->type) + return; + + int elems = swiz->val->type->vector_elements; + if (swiz->mask.x != 0) + return; + if (elems >= 2 && swiz->mask.y != 1) + return; + if (elems >= 3 && swiz->mask.z != 2) + return; + if (elems >= 4 && swiz->mask.w != 3) + return; + + this->progress = true; + *rvalue = swiz->val; +} + +bool +do_noop_swizzle(exec_list *instructions) +{ + ir_noop_swizzle_visitor v; + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h new file mode 100644 index 000000000..6a37e167f --- /dev/null +++ b/mesalib/src/glsl/ir_optimization.h @@ -0,0 +1,61 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file ir_optimization.h + * + * Prototypes for optimization passes to be called by the compiler and drivers. + */ + +bool do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations); + +bool do_algebraic(exec_list *instructions); +bool do_constant_folding(exec_list *instructions); +bool do_constant_variable(exec_list *instructions); +bool do_constant_variable_unlinked(exec_list *instructions); +bool do_copy_propagation(exec_list *instructions); +bool do_constant_propagation(exec_list *instructions); +bool do_dead_code(exec_list *instructions); +bool do_dead_code_local(exec_list *instructions); +bool do_dead_code_unlinked(exec_list *instructions); +bool do_dead_functions(exec_list *instructions); +bool do_div_to_mul_rcp(exec_list *instructions); +bool do_explog_to_explog2(exec_list *instructions); +bool do_function_inlining(exec_list *instructions); +bool do_lower_jumps(exec_list *instructions, bool pull_out_jumps = true, bool lower_sub_return = true, bool lower_main_return = false, bool lower_continue = false, bool lower_break = false); +bool do_if_simplification(exec_list *instructions); +bool do_if_to_cond_assign(exec_list *instructions); +bool do_mat_op_to_vec(exec_list *instructions); +bool do_mod_to_fract(exec_list *instructions); +bool do_noop_swizzle(exec_list *instructions); +bool do_structure_splitting(exec_list *instructions); +bool do_sub_to_add_neg(exec_list *instructions); +bool do_swizzle_swizzle(exec_list *instructions); +bool do_tree_grafting(exec_list *instructions); +bool do_vec_index_to_cond_assign(exec_list *instructions); +bool do_vec_index_to_swizzle(exec_list *instructions); +bool lower_noise(exec_list *instructions); +bool lower_variable_index_to_cond_assign(exec_list *instructions, + bool lower_input, bool lower_output, bool lower_temp, bool lower_uniform); +bool optimize_redundant_jumps(exec_list *instructions); diff --git a/mesalib/src/glsl/ir_print_visitor.cpp b/mesalib/src/glsl/ir_print_visitor.cpp new file mode 100644 index 000000000..5c19db132 --- /dev/null +++ b/mesalib/src/glsl/ir_print_visitor.cpp @@ -0,0 +1,465 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "ir_print_visitor.h" +#include "glsl_types.h" +#include "glsl_parser_extras.h" + +static void print_type(const glsl_type *t); + +void +ir_instruction::print(void) const +{ + ir_instruction *deconsted = const_cast<ir_instruction *>(this); + + ir_print_visitor v; + deconsted->accept(&v); +} + +void +_mesa_print_ir(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + if (state) { + for (unsigned i = 0; i < state->num_user_structures; i++) { + const glsl_type *const s = state->user_structures[i]; + + printf("(structure (%s) (%s@%p) (%u) (\n", + s->name, s->name, (void *) s, s->length); + + for (unsigned j = 0; j < s->length; j++) { + printf("\t(("); + print_type(s->fields.structure[j].type); + printf(")(%s))\n", s->fields.structure[j].name); + } + + printf(")\n"); + } + } + + printf("(\n"); + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir->print(); + if (ir->ir_type != ir_type_function) + printf("\n"); + } + printf("\n)"); +} + + +void ir_print_visitor::indent(void) +{ + for (int i = 0; i < indentation; i++) + printf(" "); +} + +static void +print_type(const glsl_type *t) +{ + if (t->base_type == GLSL_TYPE_ARRAY) { + printf("(array "); + print_type(t->fields.array); + printf(" %u)", t->length); + } else if ((t->base_type == GLSL_TYPE_STRUCT) + && (strncmp("gl_", t->name, 3) != 0)) { + printf("%s@%p", t->name, (void *) t); + } else { + printf("%s", t->name); + } +} + + +void ir_print_visitor::visit(ir_variable *ir) +{ + printf("(declare "); + + const char *const cent = (ir->centroid) ? "centroid " : ""; + const char *const inv = (ir->invariant) ? "invariant " : ""; + const char *const mode[] = { "", "uniform ", "in ", "out ", "inout ", + "temporary " }; + const char *const interp[] = { "", "flat", "noperspective" }; + + printf("(%s%s%s%s) ", + cent, inv, mode[ir->mode], interp[ir->interpolation]); + + print_type(ir->type); + printf(" %s@%p)", ir->name, (void *) ir); +} + + +void ir_print_visitor::visit(ir_function_signature *ir) +{ + printf("(signature "); + indentation++; + + print_type(ir->return_type); + printf("\n"); + indent(); + + printf("(parameters\n"); + indentation++; + + foreach_iter(exec_list_iterator, iter, ir->parameters) { + ir_variable *const inst = (ir_variable *) iter.get(); + + indent(); + inst->accept(this); + printf("\n"); + } + indentation--; + + indent(); + printf(")\n"); + + indent(); + + printf("(\n"); + indentation++; + + foreach_iter(exec_list_iterator, iter, ir->body) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + indent(); + inst->accept(this); + printf("\n"); + } + indentation--; + indent(); + printf("))\n"); + indentation--; +} + + +void ir_print_visitor::visit(ir_function *ir) +{ + if (!ir->has_user_signature()) + return; + + printf("(function %s\n", ir->name); + indentation++; + foreach_iter(exec_list_iterator, iter, *ir) { + ir_function_signature *const sig = (ir_function_signature *) iter.get(); + + if (sig->is_builtin) + continue; + + indent(); + sig->accept(this); + printf("\n"); + } + indentation--; + indent(); + printf(")\n\n"); +} + + +void ir_print_visitor::visit(ir_expression *ir) +{ + printf("(expression "); + + print_type(ir->type); + + printf(" %s ", ir->operator_string()); + + if (ir->operands[0]) + ir->operands[0]->accept(this); + + if (ir->operands[1]) + ir->operands[1]->accept(this); + printf(") "); +} + + +void ir_print_visitor::visit(ir_texture *ir) +{ + printf("(%s ", ir->opcode_string()); + + ir->sampler->accept(this); + printf(" "); + + ir->coordinate->accept(this); + + printf(" (%d %d %d) ", ir->offsets[0], ir->offsets[1], ir->offsets[2]); + + if (ir->op != ir_txf) { + if (ir->projector) + ir->projector->accept(this); + else + printf("1"); + + if (ir->shadow_comparitor) { + printf(" "); + ir->shadow_comparitor->accept(this); + } else { + printf(" ()"); + } + } + + printf(" "); + switch (ir->op) + { + case ir_tex: + break; + case ir_txb: + ir->lod_info.bias->accept(this); + break; + case ir_txl: + case ir_txf: + ir->lod_info.lod->accept(this); + break; + case ir_txd: + printf("("); + ir->lod_info.grad.dPdx->accept(this); + printf(" "); + ir->lod_info.grad.dPdy->accept(this); + printf(")"); + break; + }; + printf(")"); +} + + +void ir_print_visitor::visit(ir_swizzle *ir) +{ + const unsigned swiz[4] = { + ir->mask.x, + ir->mask.y, + ir->mask.z, + ir->mask.w, + }; + + printf("(swiz "); + for (unsigned i = 0; i < ir->mask.num_components; i++) { + printf("%c", "xyzw"[swiz[i]]); + } + printf(" "); + ir->val->accept(this); + printf(")"); +} + + +void ir_print_visitor::visit(ir_dereference_variable *ir) +{ + ir_variable *var = ir->variable_referenced(); + printf("(var_ref %s@%p) ", var->name, (void *) var); +} + + +void ir_print_visitor::visit(ir_dereference_array *ir) +{ + printf("(array_ref "); + ir->array->accept(this); + ir->array_index->accept(this); + printf(") "); +} + + +void ir_print_visitor::visit(ir_dereference_record *ir) +{ + printf("(record_ref "); + ir->record->accept(this); + printf(" %s) ", ir->field); +} + + +void ir_print_visitor::visit(ir_assignment *ir) +{ + printf("(assign "); + + if (ir->condition) + ir->condition->accept(this); + else + printf("(constant bool (1))"); + + + char mask[5]; + unsigned j = 0; + + for (unsigned i = 0; i < 4; i++) { + if ((ir->write_mask & (1 << i)) != 0) { + mask[j] = "xyzw"[i]; + j++; + } + } + mask[j] = '\0'; + + printf(" (%s) ", mask); + + ir->lhs->accept(this); + + printf(" "); + + ir->rhs->accept(this); + printf(") "); +} + + +void ir_print_visitor::visit(ir_constant *ir) +{ + const glsl_type *const base_type = ir->type->get_base_type(); + + printf("(constant "); + print_type(ir->type); + printf(" ("); + + if (ir->type->is_array()) { + for (unsigned i = 0; i < ir->type->length; i++) + ir->get_array_element(i)->accept(this); + } else { + for (unsigned i = 0; i < ir->type->components(); i++) { + if (i != 0) + printf(" "); + switch (base_type->base_type) { + case GLSL_TYPE_UINT: printf("%u", ir->value.u[i]); break; + case GLSL_TYPE_INT: printf("%d", ir->value.i[i]); break; + case GLSL_TYPE_FLOAT: printf("%f", ir->value.f[i]); break; + case GLSL_TYPE_BOOL: printf("%d", ir->value.b[i]); break; + default: assert(0); + } + } + } + printf(")) "); +} + + +void +ir_print_visitor::visit(ir_call *ir) +{ + printf("(call %s (", ir->callee_name()); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + inst->accept(this); + } + printf("))\n"); +} + + +void +ir_print_visitor::visit(ir_return *ir) +{ + printf("(return"); + + ir_rvalue *const value = ir->get_value(); + if (value) { + printf(" "); + value->accept(this); + } + + printf(")"); +} + + +void +ir_print_visitor::visit(ir_discard *ir) +{ + printf("(discard "); + + if (ir->condition != NULL) { + printf(" "); + ir->condition->accept(this); + } + + printf(")"); +} + + +void +ir_print_visitor::visit(ir_if *ir) +{ + printf("(if "); + ir->condition->accept(this); + + printf("(\n"); + indentation++; + + foreach_iter(exec_list_iterator, iter, ir->then_instructions) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + indent(); + inst->accept(this); + printf("\n"); + } + + indentation--; + indent(); + printf(")\n"); + + indent(); + if (!ir->else_instructions.is_empty()) { + printf("(\n"); + indentation++; + + foreach_iter(exec_list_iterator, iter, ir->else_instructions) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + indent(); + inst->accept(this); + printf("\n"); + } + indentation--; + indent(); + printf("))\n"); + } else { + printf("())\n"); + } +} + + +void +ir_print_visitor::visit(ir_loop *ir) +{ + printf("(loop ("); + if (ir->counter != NULL) + ir->counter->accept(this); + printf(") ("); + if (ir->from != NULL) + ir->from->accept(this); + printf(") ("); + if (ir->to != NULL) + ir->to->accept(this); + printf(") ("); + if (ir->increment != NULL) + ir->increment->accept(this); + printf(") (\n"); + indentation++; + + foreach_iter(exec_list_iterator, iter, ir->body_instructions) { + ir_instruction *const inst = (ir_instruction *) iter.get(); + + indent(); + inst->accept(this); + printf("\n"); + } + indentation--; + indent(); + printf("))\n"); +} + + +void +ir_print_visitor::visit(ir_loop_jump *ir) +{ + printf("%s", ir->is_break() ? "break" : "continue"); +} diff --git a/mesalib/src/glsl/ir_print_visitor.h b/mesalib/src/glsl/ir_print_visitor.h new file mode 100644 index 000000000..4feeb8c18 --- /dev/null +++ b/mesalib/src/glsl/ir_print_visitor.h @@ -0,0 +1,83 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef IR_PRINT_VISITOR_H +#define IR_PRINT_VISITOR_H + +#include "ir.h" +#include "ir_visitor.h" + +extern void _mesa_print_ir(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + +/** + * Abstract base class of visitors of IR instruction trees + */ +class ir_print_visitor : public ir_visitor { +public: + ir_print_visitor() + { + indentation = 0; + } + + virtual ~ir_print_visitor() + { + /* empty */ + } + + void indent(void); + + /** + * \name Visit methods + * + * As typical for the visitor pattern, there must be one \c visit method for + * each concrete subclass of \c ir_instruction. Virtual base classes within + * the hierarchy should not have \c visit methods. + */ + /*@{*/ + virtual void visit(ir_variable *); + virtual void visit(ir_function_signature *); + virtual void visit(ir_function *); + virtual void visit(ir_expression *); + virtual void visit(ir_texture *); + virtual void visit(ir_swizzle *); + virtual void visit(ir_dereference_variable *); + virtual void visit(ir_dereference_array *); + virtual void visit(ir_dereference_record *); + virtual void visit(ir_assignment *); + virtual void visit(ir_constant *); + virtual void visit(ir_call *); + virtual void visit(ir_return *); + virtual void visit(ir_discard *); + virtual void visit(ir_if *); + virtual void visit(ir_loop *); + virtual void visit(ir_loop_jump *); + /*@}*/ + +private: + int indentation; +}; + +#endif /* IR_PRINT_VISITOR_H */ diff --git a/mesalib/src/glsl/ir_reader.cpp b/mesalib/src/glsl/ir_reader.cpp new file mode 100644 index 000000000..a9cbf8ea9 --- /dev/null +++ b/mesalib/src/glsl/ir_reader.cpp @@ -0,0 +1,1146 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <cstdarg> + +extern "C" { +#include <talloc.h> +} + +#include "ir_reader.h" +#include "glsl_parser_extras.h" +#include "glsl_types.h" +#include "s_expression.h" + +const static bool debug = false; + +static void ir_read_error(_mesa_glsl_parse_state *, s_expression *, + const char *fmt, ...); +static const glsl_type *read_type(_mesa_glsl_parse_state *, s_expression *); + +static void scan_for_prototypes(_mesa_glsl_parse_state *, exec_list *, + s_expression *); +static ir_function *read_function(_mesa_glsl_parse_state *, s_list *, + bool skip_body); +static void read_function_sig(_mesa_glsl_parse_state *, ir_function *, + s_list *, bool skip_body); + +static void read_instructions(_mesa_glsl_parse_state *, exec_list *, + s_expression *, ir_loop *); +static ir_instruction *read_instruction(_mesa_glsl_parse_state *, + s_expression *, ir_loop *); +static ir_variable *read_declaration(_mesa_glsl_parse_state *, s_list *); +static ir_if *read_if(_mesa_glsl_parse_state *, s_list *, ir_loop *); +static ir_loop *read_loop(_mesa_glsl_parse_state *st, s_list *list); +static ir_return *read_return(_mesa_glsl_parse_state *, s_list *); + +static ir_rvalue *read_rvalue(_mesa_glsl_parse_state *, s_expression *); +static ir_assignment *read_assignment(_mesa_glsl_parse_state *, s_list *); +static ir_expression *read_expression(_mesa_glsl_parse_state *, s_list *); +static ir_call *read_call(_mesa_glsl_parse_state *, s_list *); +static ir_swizzle *read_swizzle(_mesa_glsl_parse_state *, s_list *); +static ir_constant *read_constant(_mesa_glsl_parse_state *, s_list *); +static ir_texture *read_texture(_mesa_glsl_parse_state *, s_list *); + +static ir_dereference *read_dereference(_mesa_glsl_parse_state *, + s_expression *); +static ir_dereference *read_var_ref(_mesa_glsl_parse_state *, s_list *); +static ir_dereference *read_array_ref(_mesa_glsl_parse_state *, s_list *); +static ir_dereference *read_record_ref(_mesa_glsl_parse_state *, s_list *); + +void +_mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, + const char *src, bool scan_for_protos) +{ + s_expression *expr = s_expression::read_expression(state, src); + if (expr == NULL) { + ir_read_error(state, NULL, "couldn't parse S-Expression."); + return; + } + + if (scan_for_protos) { + scan_for_prototypes(state, instructions, expr); + if (state->error) + return; + } + + read_instructions(state, instructions, expr, NULL); + talloc_free(expr); + + if (debug) + validate_ir_tree(instructions); +} + +static void +ir_read_error(_mesa_glsl_parse_state *state, s_expression *expr, + const char *fmt, ...) +{ + va_list ap; + + state->error = true; + + if (state->current_function != NULL) + state->info_log = talloc_asprintf_append(state->info_log, + "In function %s:\n", + state->current_function->function_name()); + state->info_log = talloc_strdup_append(state->info_log, "error: "); + + va_start(ap, fmt); + state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap); + va_end(ap); + state->info_log = talloc_strdup_append(state->info_log, "\n"); + + if (expr != NULL) { + state->info_log = talloc_strdup_append(state->info_log, + "...in this context:\n "); + expr->print(); + state->info_log = talloc_strdup_append(state->info_log, "\n\n"); + } +} + +static const glsl_type * +read_type(_mesa_glsl_parse_state *st, s_expression *expr) +{ + s_list *list = SX_AS_LIST(expr); + if (list != NULL) { + s_symbol *type_sym = SX_AS_SYMBOL(list->subexpressions.get_head()); + if (type_sym == NULL) { + ir_read_error(st, expr, "expected type (array ...) or (struct ...)"); + return NULL; + } + if (strcmp(type_sym->value(), "array") == 0) { + if (list->length() != 3) { + ir_read_error(st, expr, "expected type (array <type> <int>)"); + return NULL; + } + + // Read base type + s_expression *base_expr = (s_expression*) type_sym->next; + const glsl_type *base_type = read_type(st, base_expr); + if (base_type == NULL) { + ir_read_error(st, NULL, "when reading base type of array"); + return NULL; + } + + // Read array size + s_int *size = SX_AS_INT(base_expr->next); + if (size == NULL) { + ir_read_error(st, expr, "found non-integer array size"); + return NULL; + } + + return glsl_type::get_array_instance(base_type, size->value()); + } else if (strcmp(type_sym->value(), "struct") == 0) { + assert(false); // FINISHME + } else { + ir_read_error(st, expr, "expected (array ...) or (struct ...); " + "found (%s ...)", type_sym->value()); + return NULL; + } + } + + s_symbol *type_sym = SX_AS_SYMBOL(expr); + if (type_sym == NULL) { + ir_read_error(st, expr, "expected <type> (symbol or list)"); + return NULL; + } + + const glsl_type *type = st->symbols->get_type(type_sym->value()); + if (type == NULL) + ir_read_error(st, expr, "invalid type: %s", type_sym->value()); + + return type; +} + + +static void +scan_for_prototypes(_mesa_glsl_parse_state *st, exec_list *instructions, + s_expression *expr) +{ + s_list *list = SX_AS_LIST(expr); + if (list == NULL) { + ir_read_error(st, expr, "Expected (<instruction> ...); found an atom."); + return; + } + + foreach_iter(exec_list_iterator, it, list->subexpressions) { + s_list *sub = SX_AS_LIST(it.get()); + if (sub == NULL) + continue; // not a (function ...); ignore it. + + s_symbol *tag = SX_AS_SYMBOL(sub->subexpressions.get_head()); + if (tag == NULL || strcmp(tag->value(), "function") != 0) + continue; // not a (function ...); ignore it. + + ir_function *f = read_function(st, sub, true); + if (f == NULL) + return; + instructions->push_tail(f); + } +} + +static ir_function * +read_function(_mesa_glsl_parse_state *st, s_list *list, bool skip_body) +{ + void *ctx = st; + bool added = false; + if (list->length() < 3) { + ir_read_error(st, list, "Expected (function <name> (signature ...) ...)"); + return NULL; + } + + s_symbol *name = SX_AS_SYMBOL(list->subexpressions.head->next); + if (name == NULL) { + ir_read_error(st, list, "Expected (function <name> ...)"); + return NULL; + } + + ir_function *f = st->symbols->get_function(name->value()); + if (f == NULL) { + f = new(ctx) ir_function(name->value()); + added = st->symbols->add_function(f->name, f); + assert(added); + } + + exec_list_iterator it = list->subexpressions.iterator(); + it.next(); // skip "function" tag + it.next(); // skip function name + for (/* nothing */; it.has_next(); it.next()) { + s_list *siglist = SX_AS_LIST(it.get()); + if (siglist == NULL) { + ir_read_error(st, list, "Expected (function (signature ...) ...)"); + return NULL; + } + + s_symbol *tag = SX_AS_SYMBOL(siglist->subexpressions.get_head()); + if (tag == NULL || strcmp(tag->value(), "signature") != 0) { + ir_read_error(st, siglist, "Expected (signature ...)"); + return NULL; + } + + read_function_sig(st, f, siglist, skip_body); + } + return added ? f : NULL; +} + +static void +read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list, + bool skip_body) +{ + void *ctx = st; + if (list->length() != 4) { + ir_read_error(st, list, "Expected (signature <type> (parameters ...) " + "(<instruction> ...))"); + return; + } + + s_expression *type_expr = (s_expression*) list->subexpressions.head->next; + const glsl_type *return_type = read_type(st, type_expr); + if (return_type == NULL) + return; + + s_list *paramlist = SX_AS_LIST(type_expr->next); + s_list *body_list = SX_AS_LIST(paramlist->next); + if (paramlist == NULL || body_list == NULL) { + ir_read_error(st, list, "Expected (signature <type> (parameters ...) " + "(<instruction> ...))"); + return; + } + s_symbol *paramtag = SX_AS_SYMBOL(paramlist->subexpressions.get_head()); + if (paramtag == NULL || strcmp(paramtag->value(), "parameters") != 0) { + ir_read_error(st, paramlist, "Expected (parameters ...)"); + return; + } + + // Read the parameters list into a temporary place. + exec_list hir_parameters; + st->symbols->push_scope(); + + exec_list_iterator it = paramlist->subexpressions.iterator(); + for (it.next() /* skip "parameters" */; it.has_next(); it.next()) { + s_list *decl = SX_AS_LIST(it.get()); + ir_variable *var = read_declaration(st, decl); + if (var == NULL) + return; + + hir_parameters.push_tail(var); + } + + ir_function_signature *sig = f->exact_matching_signature(&hir_parameters); + if (sig == NULL && skip_body) { + /* If scanning for prototypes, generate a new signature. */ + sig = new(ctx) ir_function_signature(return_type); + sig->is_builtin = true; + f->add_signature(sig); + } else if (sig != NULL) { + const char *badvar = sig->qualifiers_match(&hir_parameters); + if (badvar != NULL) { + ir_read_error(st, list, "function `%s' parameter `%s' qualifiers " + "don't match prototype", f->name, badvar); + return; + } + + if (sig->return_type != return_type) { + ir_read_error(st, list, "function `%s' return type doesn't " + "match prototype", f->name); + return; + } + } else { + /* No prototype for this body exists - skip it. */ + st->symbols->pop_scope(); + return; + } + assert(sig != NULL); + + sig->replace_parameters(&hir_parameters); + + if (!skip_body && !body_list->subexpressions.is_empty()) { + if (sig->is_defined) { + ir_read_error(st, list, "function %s redefined", f->name); + return; + } + st->current_function = sig; + read_instructions(st, &sig->body, body_list, NULL); + st->current_function = NULL; + sig->is_defined = true; + } + + st->symbols->pop_scope(); +} + +static void +read_instructions(_mesa_glsl_parse_state *st, exec_list *instructions, + s_expression *expr, ir_loop *loop_ctx) +{ + // Read in a list of instructions + s_list *list = SX_AS_LIST(expr); + if (list == NULL) { + ir_read_error(st, expr, "Expected (<instruction> ...); found an atom."); + return; + } + + foreach_iter(exec_list_iterator, it, list->subexpressions) { + s_expression *sub = (s_expression*) it.get(); + ir_instruction *ir = read_instruction(st, sub, loop_ctx); + if (ir != NULL) { + /* Global variable declarations should be moved to the top, before + * any functions that might use them. Functions are added to the + * instruction stream when scanning for prototypes, so without this + * hack, they always appear before variable declarations. + */ + if (st->current_function == NULL && ir->as_variable() != NULL) + instructions->push_head(ir); + else + instructions->push_tail(ir); + } + } +} + + +static ir_instruction * +read_instruction(_mesa_glsl_parse_state *st, s_expression *expr, + ir_loop *loop_ctx) +{ + void *ctx = st; + s_symbol *symbol = SX_AS_SYMBOL(expr); + if (symbol != NULL) { + if (strcmp(symbol->value(), "break") == 0 && loop_ctx != NULL) + return new(ctx) ir_loop_jump(ir_loop_jump::jump_break); + if (strcmp(symbol->value(), "continue") == 0 && loop_ctx != NULL) + return new(ctx) ir_loop_jump(ir_loop_jump::jump_continue); + } + + s_list *list = SX_AS_LIST(expr); + if (list == NULL || list->subexpressions.is_empty()) { + ir_read_error(st, expr, "Invalid instruction.\n"); + return NULL; + } + + s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.get_head()); + if (tag == NULL) { + ir_read_error(st, expr, "expected instruction tag"); + return NULL; + } + + ir_instruction *inst = NULL; + if (strcmp(tag->value(), "declare") == 0) { + inst = read_declaration(st, list); + } else if (strcmp(tag->value(), "assign") == 0) { + inst = read_assignment(st, list); + } else if (strcmp(tag->value(), "if") == 0) { + inst = read_if(st, list, loop_ctx); + } else if (strcmp(tag->value(), "loop") == 0) { + inst = read_loop(st, list); + } else if (strcmp(tag->value(), "return") == 0) { + inst = read_return(st, list); + } else if (strcmp(tag->value(), "function") == 0) { + inst = read_function(st, list, false); + } else { + inst = read_rvalue(st, list); + if (inst == NULL) + ir_read_error(st, NULL, "when reading instruction"); + } + return inst; +} + + +static ir_variable * +read_declaration(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + if (list->length() != 4) { + ir_read_error(st, list, "expected (declare (<qualifiers>) <type> " + "<name>)"); + return NULL; + } + + s_list *quals = SX_AS_LIST(list->subexpressions.head->next); + if (quals == NULL) { + ir_read_error(st, list, "expected a list of variable qualifiers"); + return NULL; + } + + s_expression *type_expr = (s_expression*) quals->next; + const glsl_type *type = read_type(st, type_expr); + if (type == NULL) + return NULL; + + s_symbol *var_name = SX_AS_SYMBOL(type_expr->next); + if (var_name == NULL) { + ir_read_error(st, list, "expected variable name, found non-symbol"); + return NULL; + } + + ir_variable *var = new(ctx) ir_variable(type, var_name->value(), + ir_var_auto); + + foreach_iter(exec_list_iterator, it, quals->subexpressions) { + s_symbol *qualifier = SX_AS_SYMBOL(it.get()); + if (qualifier == NULL) { + ir_read_error(st, list, "qualifier list must contain only symbols"); + delete var; + return NULL; + } + + // FINISHME: Check for duplicate/conflicting qualifiers. + if (strcmp(qualifier->value(), "centroid") == 0) { + var->centroid = 1; + } else if (strcmp(qualifier->value(), "invariant") == 0) { + var->invariant = 1; + } else if (strcmp(qualifier->value(), "uniform") == 0) { + var->mode = ir_var_uniform; + } else if (strcmp(qualifier->value(), "auto") == 0) { + var->mode = ir_var_auto; + } else if (strcmp(qualifier->value(), "in") == 0) { + var->mode = ir_var_in; + } else if (strcmp(qualifier->value(), "out") == 0) { + var->mode = ir_var_out; + } else if (strcmp(qualifier->value(), "inout") == 0) { + var->mode = ir_var_inout; + } else if (strcmp(qualifier->value(), "smooth") == 0) { + var->interpolation = ir_var_smooth; + } else if (strcmp(qualifier->value(), "flat") == 0) { + var->interpolation = ir_var_flat; + } else if (strcmp(qualifier->value(), "noperspective") == 0) { + var->interpolation = ir_var_noperspective; + } else { + ir_read_error(st, list, "unknown qualifier: %s", qualifier->value()); + delete var; + return NULL; + } + } + + // Add the variable to the symbol table + st->symbols->add_variable(var->name, var); + + return var; +} + + +static ir_if * +read_if(_mesa_glsl_parse_state *st, s_list *list, ir_loop *loop_ctx) +{ + void *ctx = st; + if (list->length() != 4) { + ir_read_error(st, list, "expected (if <condition> (<then> ...) " + "(<else> ...))"); + return NULL; + } + + s_expression *cond_expr = (s_expression*) list->subexpressions.head->next; + ir_rvalue *condition = read_rvalue(st, cond_expr); + if (condition == NULL) { + ir_read_error(st, NULL, "when reading condition of (if ...)"); + return NULL; + } + + s_expression *then_expr = (s_expression*) cond_expr->next; + s_expression *else_expr = (s_expression*) then_expr->next; + + ir_if *iff = new(ctx) ir_if(condition); + + read_instructions(st, &iff->then_instructions, then_expr, loop_ctx); + read_instructions(st, &iff->else_instructions, else_expr, loop_ctx); + if (st->error) { + delete iff; + iff = NULL; + } + return iff; +} + + +static ir_loop * +read_loop(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + if (list->length() != 6) { + ir_read_error(st, list, "expected (loop <counter> <from> <to> " + "<increment> <body>)"); + return NULL; + } + + s_expression *count_expr = (s_expression*) list->subexpressions.head->next; + s_expression *from_expr = (s_expression*) count_expr->next; + s_expression *to_expr = (s_expression*) from_expr->next; + s_expression *inc_expr = (s_expression*) to_expr->next; + s_expression *body_expr = (s_expression*) inc_expr->next; + + // FINISHME: actually read the count/from/to fields. + + ir_loop *loop = new(ctx) ir_loop; + read_instructions(st, &loop->body_instructions, body_expr, loop); + if (st->error) { + delete loop; + loop = NULL; + } + return loop; +} + + +static ir_return * +read_return(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + if (list->length() != 2) { + ir_read_error(st, list, "expected (return <rvalue>)"); + return NULL; + } + + s_expression *expr = (s_expression*) list->subexpressions.head->next; + + ir_rvalue *retval = read_rvalue(st, expr); + if (retval == NULL) { + ir_read_error(st, NULL, "when reading return value"); + return NULL; + } + + return new(ctx) ir_return(retval); +} + + +static ir_rvalue * +read_rvalue(_mesa_glsl_parse_state *st, s_expression *expr) +{ + s_list *list = SX_AS_LIST(expr); + if (list == NULL || list->subexpressions.is_empty()) + return NULL; + + s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.get_head()); + if (tag == NULL) { + ir_read_error(st, expr, "expected rvalue tag"); + return NULL; + } + + ir_rvalue *rvalue = read_dereference(st, list); + if (rvalue != NULL || st->error) + return rvalue; + else if (strcmp(tag->value(), "swiz") == 0) { + rvalue = read_swizzle(st, list); + } else if (strcmp(tag->value(), "expression") == 0) { + rvalue = read_expression(st, list); + } else if (strcmp(tag->value(), "call") == 0) { + rvalue = read_call(st, list); + } else if (strcmp(tag->value(), "constant") == 0) { + rvalue = read_constant(st, list); + } else { + rvalue = read_texture(st, list); + if (rvalue == NULL && !st->error) + ir_read_error(st, expr, "unrecognized rvalue tag: %s", tag->value()); + } + + return rvalue; +} + +static ir_assignment * +read_assignment(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + if (list->length() != 5) { + ir_read_error(st, list, "expected (assign <condition> (<write mask>) " + "<lhs> <rhs>)"); + return NULL; + } + + s_expression *cond_expr = (s_expression*) list->subexpressions.head->next; + s_list *mask_list = SX_AS_LIST(cond_expr->next); + s_expression *lhs_expr = (s_expression*) cond_expr->next->next; + s_expression *rhs_expr = (s_expression*) lhs_expr->next; + + ir_rvalue *condition = read_rvalue(st, cond_expr); + if (condition == NULL) { + ir_read_error(st, NULL, "when reading condition of assignment"); + return NULL; + } + + if (mask_list == NULL || mask_list->length() > 1) { + ir_read_error(st, mask_list, "expected () or (<write mask>)"); + return NULL; + } + + unsigned mask = 0; + if (mask_list->length() == 1) { + s_symbol *mask_symbol = SX_AS_SYMBOL(mask_list->subexpressions.head); + if (mask_symbol == NULL) { + ir_read_error(st, list, "expected a write mask; found non-symbol"); + return NULL; + } + + const char *mask_str = mask_symbol->value(); + unsigned mask_length = strlen(mask_str); + if (mask_length > 4) { + ir_read_error(st, list, "invalid write mask: %s", mask_str); + return NULL; + } + + const unsigned idx_map[] = { 3, 0, 1, 2 }; /* w=bit 3, x=0, y=1, z=2 */ + + for (unsigned i = 0; i < mask_length; i++) { + if (mask_str[i] < 'w' || mask_str[i] > 'z') { + ir_read_error(st, list, "write mask contains invalid character: %c", + mask_str[i]); + return NULL; + } + mask |= 1 << idx_map[mask_str[i] - 'w']; + } + } + + ir_dereference *lhs = read_dereference(st, lhs_expr); + if (lhs == NULL) { + ir_read_error(st, NULL, "when reading left-hand side of assignment"); + return NULL; + } + + ir_rvalue *rhs = read_rvalue(st, rhs_expr); + if (rhs == NULL) { + ir_read_error(st, NULL, "when reading right-hand side of assignment"); + return NULL; + } + + if (mask == 0 && (lhs->type->is_vector() || lhs->type->is_scalar())) { + ir_read_error(st, list, "non-zero write mask required."); + return NULL; + } + + return new(ctx) ir_assignment(lhs, rhs, condition, mask); +} + +static ir_call * +read_call(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + if (list->length() != 3) { + ir_read_error(st, list, "expected (call <name> (<param> ...))"); + return NULL; + } + + s_symbol *name = SX_AS_SYMBOL(list->subexpressions.head->next); + s_list *params = SX_AS_LIST(name->next); + if (name == NULL || params == NULL) { + ir_read_error(st, list, "expected (call <name> (<param> ...))"); + return NULL; + } + + exec_list parameters; + + foreach_iter(exec_list_iterator, it, params->subexpressions) { + s_expression *expr = (s_expression*) it.get(); + ir_rvalue *param = read_rvalue(st, expr); + if (param == NULL) { + ir_read_error(st, list, "when reading parameter to function call"); + return NULL; + } + parameters.push_tail(param); + } + + ir_function *f = st->symbols->get_function(name->value()); + if (f == NULL) { + ir_read_error(st, list, "found call to undefined function %s", + name->value()); + return NULL; + } + + ir_function_signature *callee = f->matching_signature(¶meters); + if (callee == NULL) { + ir_read_error(st, list, "couldn't find matching signature for function " + "%s", name->value()); + return NULL; + } + + return new(ctx) ir_call(callee, ¶meters); +} + +static ir_expression * +read_expression(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + const unsigned list_length = list->length(); + if (list_length < 4) { + ir_read_error(st, list, "expected (expression <type> <operator> " + "<operand> [<operand>])"); + return NULL; + } + + s_expression *type_expr = (s_expression*) list->subexpressions.head->next; + const glsl_type *type = read_type(st, type_expr); + if (type == NULL) + return NULL; + + /* Read the operator */ + s_symbol *op_sym = SX_AS_SYMBOL(type_expr->next); + if (op_sym == NULL) { + ir_read_error(st, list, "expected operator, found non-symbol"); + return NULL; + } + + ir_expression_operation op = ir_expression::get_operator(op_sym->value()); + if (op == (ir_expression_operation) -1) { + ir_read_error(st, list, "invalid operator: %s", op_sym->value()); + return NULL; + } + + /* Now that we know the operator, check for the right number of operands */ + if (ir_expression::get_num_operands(op) == 2) { + if (list_length != 5) { + ir_read_error(st, list, "expected (expression <type> %s <operand> " + " <operand>)", op_sym->value()); + return NULL; + } + } else { + if (list_length != 4) { + ir_read_error(st, list, "expected (expression <type> %s <operand>)", + op_sym->value()); + return NULL; + } + } + + s_expression *exp1 = (s_expression*) (op_sym->next); + ir_rvalue *arg1 = read_rvalue(st, exp1); + if (arg1 == NULL) { + ir_read_error(st, NULL, "when reading first operand of %s", + op_sym->value()); + return NULL; + } + + ir_rvalue *arg2 = NULL; + if (ir_expression::get_num_operands(op) == 2) { + s_expression *exp2 = (s_expression*) (exp1->next); + arg2 = read_rvalue(st, exp2); + if (arg2 == NULL) { + ir_read_error(st, NULL, "when reading second operand of %s", + op_sym->value()); + return NULL; + } + } + + return new(ctx) ir_expression(op, type, arg1, arg2); +} + +static ir_swizzle * +read_swizzle(_mesa_glsl_parse_state *st, s_list *list) +{ + if (list->length() != 3) { + ir_read_error(st, list, "expected (swiz <swizzle> <rvalue>)"); + return NULL; + } + + s_symbol *swiz = SX_AS_SYMBOL(list->subexpressions.head->next); + if (swiz == NULL) { + ir_read_error(st, list, "expected a valid swizzle; found non-symbol"); + return NULL; + } + + if (strlen(swiz->value()) > 4) { + ir_read_error(st, list, "expected a valid swizzle; found %s", + swiz->value()); + return NULL; + } + + s_expression *sub = (s_expression*) swiz->next; + if (sub == NULL) { + ir_read_error(st, list, "expected rvalue: (swizzle %s <rvalue>)", + swiz->value()); + return NULL; + } + + ir_rvalue *rvalue = read_rvalue(st, sub); + if (rvalue == NULL) + return NULL; + + ir_swizzle *ir = ir_swizzle::create(rvalue, swiz->value(), + rvalue->type->vector_elements); + if (ir == NULL) + ir_read_error(st, list, "invalid swizzle"); + + return ir; +} + +static ir_constant * +read_constant(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + if (list->length() != 3) { + ir_read_error(st, list, "expected (constant <type> (...))"); + return NULL; + } + + s_expression *type_expr = (s_expression*) list->subexpressions.head->next; + const glsl_type *type = read_type(st, type_expr); + if (type == NULL) + return NULL; + + s_list *values = SX_AS_LIST(type_expr->next); + if (values == NULL) { + ir_read_error(st, list, "expected (constant <type> (...))"); + return NULL; + } + + if (type->is_array()) { + const unsigned elements_supplied = values->length(); + if (elements_supplied != type->length) { + ir_read_error(st, values, "expected exactly %u array elements, " + "given %u", type->length, elements_supplied); + return NULL; + } + + exec_list elements; + foreach_iter(exec_list_iterator, it, values->subexpressions) { + s_expression *expr = (s_expression *) it.get(); + s_list *elt = SX_AS_LIST(expr); + if (elt == NULL) { + ir_read_error(st, expr, "expected (constant ...) array element"); + return NULL; + } + + ir_constant *ir_elt = read_constant(st, elt); + if (ir_elt == NULL) + return NULL; + elements.push_tail(ir_elt); + } + return new(ctx) ir_constant(type, &elements); + } + + const glsl_type *const base_type = type->get_base_type(); + + ir_constant_data data = { { 0 } }; + + // Read in list of values (at most 16). + int k = 0; + foreach_iter(exec_list_iterator, it, values->subexpressions) { + if (k >= 16) { + ir_read_error(st, values, "expected at most 16 numbers"); + return NULL; + } + + s_expression *expr = (s_expression*) it.get(); + + if (base_type->base_type == GLSL_TYPE_FLOAT) { + s_number *value = SX_AS_NUMBER(expr); + if (value == NULL) { + ir_read_error(st, values, "expected numbers"); + return NULL; + } + data.f[k] = value->fvalue(); + } else { + s_int *value = SX_AS_INT(expr); + if (value == NULL) { + ir_read_error(st, values, "expected integers"); + return NULL; + } + + switch (base_type->base_type) { + case GLSL_TYPE_UINT: { + data.u[k] = value->value(); + break; + } + case GLSL_TYPE_INT: { + data.i[k] = value->value(); + break; + } + case GLSL_TYPE_BOOL: { + data.b[k] = value->value(); + break; + } + default: + ir_read_error(st, values, "unsupported constant type"); + return NULL; + } + } + ++k; + } + + return new(ctx) ir_constant(type, &data); +} + +static ir_dereference * +read_dereference(_mesa_glsl_parse_state *st, s_expression *expr) +{ + s_list *list = SX_AS_LIST(expr); + if (list == NULL || list->subexpressions.is_empty()) + return NULL; + + s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.head); + assert(tag != NULL); + + if (strcmp(tag->value(), "var_ref") == 0) + return read_var_ref(st, list); + if (strcmp(tag->value(), "array_ref") == 0) + return read_array_ref(st, list); + if (strcmp(tag->value(), "record_ref") == 0) + return read_record_ref(st, list); + return NULL; +} + +static ir_dereference * +read_var_ref(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + if (list->length() != 2) { + ir_read_error(st, list, "expected (var_ref <variable name>)"); + return NULL; + } + s_symbol *var_name = SX_AS_SYMBOL(list->subexpressions.head->next); + if (var_name == NULL) { + ir_read_error(st, list, "expected (var_ref <variable name>)"); + return NULL; + } + + ir_variable *var = st->symbols->get_variable(var_name->value()); + if (var == NULL) { + ir_read_error(st, list, "undeclared variable: %s", var_name->value()); + return NULL; + } + + return new(ctx) ir_dereference_variable(var); +} + +static ir_dereference * +read_array_ref(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + if (list->length() != 3) { + ir_read_error(st, list, "expected (array_ref <rvalue> <index>)"); + return NULL; + } + + s_expression *subj_expr = (s_expression*) list->subexpressions.head->next; + ir_rvalue *subject = read_rvalue(st, subj_expr); + if (subject == NULL) { + ir_read_error(st, NULL, "when reading the subject of an array_ref"); + return NULL; + } + + s_expression *idx_expr = (s_expression*) subj_expr->next; + ir_rvalue *idx = read_rvalue(st, idx_expr); + return new(ctx) ir_dereference_array(subject, idx); +} + +static ir_dereference * +read_record_ref(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + if (list->length() != 3) { + ir_read_error(st, list, "expected (record_ref <rvalue> <field>)"); + return NULL; + } + + s_expression *subj_expr = (s_expression*) list->subexpressions.head->next; + ir_rvalue *subject = read_rvalue(st, subj_expr); + if (subject == NULL) { + ir_read_error(st, NULL, "when reading the subject of a record_ref"); + return NULL; + } + + s_symbol *field = SX_AS_SYMBOL(subj_expr->next); + if (field == NULL) { + ir_read_error(st, list, "expected (record_ref ... <field name>)"); + return NULL; + } + return new(ctx) ir_dereference_record(subject, field->value()); +} + +static bool +valid_texture_list_length(ir_texture_opcode op, s_list *list) +{ + unsigned required_length = 7; + if (op == ir_txf) + required_length = 5; + else if (op == ir_tex) + required_length = 6; + + return list->length() == required_length; +} + +static ir_texture * +read_texture(_mesa_glsl_parse_state *st, s_list *list) +{ + void *ctx = st; + s_symbol *tag = SX_AS_SYMBOL(list->subexpressions.head); + assert(tag != NULL); + + ir_texture_opcode op = ir_texture::get_opcode(tag->value()); + if (op == (ir_texture_opcode) -1) + return NULL; + + if (!valid_texture_list_length(op, list)) { + ir_read_error(st, NULL, "invalid list size in (%s ...)", tag->value()); + return NULL; + } + + ir_texture *tex = new(ctx) ir_texture(op); + + // Read sampler (must be a deref) + s_expression *sampler_expr = (s_expression *) tag->next; + ir_dereference *sampler = read_dereference(st, sampler_expr); + if (sampler == NULL) { + ir_read_error(st, NULL, "when reading sampler in (%s ...)", tag->value()); + return NULL; + } + tex->set_sampler(sampler); + + // Read coordinate (any rvalue) + s_expression *coordinate_expr = (s_expression *) sampler_expr->next; + tex->coordinate = read_rvalue(st, coordinate_expr); + if (tex->coordinate == NULL) { + ir_read_error(st, NULL, "when reading coordinate in (%s ...)", + tag->value()); + return NULL; + } + + // Read texel offset, i.e. (0 0 0) + s_list *offset_list = SX_AS_LIST(coordinate_expr->next); + if (offset_list == NULL || offset_list->length() != 3) { + ir_read_error(st, offset_list, "expected (<int> <int> <int>)"); + return NULL; + } + s_int *offset_x = SX_AS_INT(offset_list->subexpressions.head); + s_int *offset_y = SX_AS_INT(offset_x->next); + s_int *offset_z = SX_AS_INT(offset_y->next); + if (offset_x == NULL || offset_y == NULL || offset_z == NULL) { + ir_read_error(st, offset_list, "expected (<int> <int> <int>)"); + return NULL; + } + tex->offsets[0] = offset_x->value(); + tex->offsets[1] = offset_y->value(); + tex->offsets[2] = offset_z->value(); + + if (op == ir_txf) { + s_expression *lod_expr = (s_expression *) offset_list->next; + tex->lod_info.lod = read_rvalue(st, lod_expr); + if (tex->lod_info.lod == NULL) { + ir_read_error(st, NULL, "when reading LOD in (txf ...)"); + return NULL; + } + } else { + s_expression *proj_expr = (s_expression *) offset_list->next; + s_int *proj_as_int = SX_AS_INT(proj_expr); + if (proj_as_int && proj_as_int->value() == 1) { + tex->projector = NULL; + } else { + tex->projector = read_rvalue(st, proj_expr); + if (tex->projector == NULL) { + ir_read_error(st, NULL, "when reading projective divide in (%s ..)", + tag->value()); + return NULL; + } + } + + s_list *shadow_list = SX_AS_LIST(proj_expr->next); + if (shadow_list == NULL) { + ir_read_error(st, NULL, "shadow comparitor must be a list"); + return NULL; + } + if (shadow_list->subexpressions.is_empty()) { + tex->shadow_comparitor= NULL; + } else { + tex->shadow_comparitor = read_rvalue(st, shadow_list); + if (tex->shadow_comparitor == NULL) { + ir_read_error(st, NULL, "when reading shadow comparitor in (%s ..)", + tag->value()); + return NULL; + } + } + s_expression *lod_expr = (s_expression *) shadow_list->next; + + switch (op) { + case ir_txb: + tex->lod_info.bias = read_rvalue(st, lod_expr); + if (tex->lod_info.bias == NULL) { + ir_read_error(st, NULL, "when reading LOD bias in (txb ...)"); + return NULL; + } + break; + case ir_txl: + tex->lod_info.lod = read_rvalue(st, lod_expr); + if (tex->lod_info.lod == NULL) { + ir_read_error(st, NULL, "when reading LOD in (txl ...)"); + return NULL; + } + break; + case ir_txd: { + s_list *lod_list = SX_AS_LIST(lod_expr); + if (lod_list->length() != 2) { + ir_read_error(st, lod_expr, "expected (dPdx dPdy) in (txd ...)"); + return NULL; + } + s_expression *dx_expr = (s_expression *) lod_list->subexpressions.head; + s_expression *dy_expr = (s_expression *) dx_expr->next; + + tex->lod_info.grad.dPdx = read_rvalue(st, dx_expr); + if (tex->lod_info.grad.dPdx == NULL) { + ir_read_error(st, NULL, "when reading dPdx in (txd ...)"); + return NULL; + } + tex->lod_info.grad.dPdy = read_rvalue(st, dy_expr); + if (tex->lod_info.grad.dPdy == NULL) { + ir_read_error(st, NULL, "when reading dPdy in (txd ...)"); + return NULL; + } + break; + } + default: + // tex doesn't have any extra parameters and txf was handled earlier. + break; + }; + } + return tex; +} diff --git a/mesalib/src/glsl/ir_reader.h b/mesalib/src/glsl/ir_reader.h new file mode 100644 index 000000000..aef2ca23b --- /dev/null +++ b/mesalib/src/glsl/ir_reader.h @@ -0,0 +1,34 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef IR_READER_H +#define IR_READER_H + +#include "ir.h" + +void _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions, + const char *src, bool scan_for_prototypes); + +#endif /* IR_READER_H */ diff --git a/mesalib/src/glsl/ir_rvalue_visitor.cpp b/mesalib/src/glsl/ir_rvalue_visitor.cpp new file mode 100644 index 000000000..773bfcfa3 --- /dev/null +++ b/mesalib/src/glsl/ir_rvalue_visitor.cpp @@ -0,0 +1,141 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_rvalue_visitor.cpp + * + * Generic class to implement the common pattern we have of wanting to + * visit each ir_rvalue * and possibly change that node to a different + * class. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "ir_print_visitor.h" +#include "glsl_types.h" + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_expression *ir) +{ + unsigned int operand; + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + handle_rvalue(&ir->operands[operand]); + } + + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_texture *ir) +{ + handle_rvalue(&ir->coordinate); + handle_rvalue(&ir->projector); + handle_rvalue(&ir->shadow_comparitor); + + switch (ir->op) { + case ir_tex: + break; + case ir_txb: + handle_rvalue(&ir->lod_info.bias); + break; + case ir_txf: + case ir_txl: + handle_rvalue(&ir->lod_info.lod); + break; + case ir_txd: + handle_rvalue(&ir->lod_info.grad.dPdx); + handle_rvalue(&ir->lod_info.grad.dPdy); + break; + } + + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_swizzle *ir) +{ + handle_rvalue(&ir->val); + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_dereference_array *ir) +{ + /* The array index is not the target of the assignment, so clear the + * 'in_assignee' flag. Restore it after returning from the array index. + */ + const bool was_in_assignee = this->in_assignee; + this->in_assignee = false; + handle_rvalue(&ir->array_index); + this->in_assignee = was_in_assignee; + + handle_rvalue(&ir->array); + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_dereference_record *ir) +{ + handle_rvalue(&ir->record); + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_assignment *ir) +{ + handle_rvalue(&ir->rhs); + handle_rvalue(&ir->condition); + + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = param; + handle_rvalue(&new_param); + + if (new_param != param) { + param->replace_with(new_param); + } + } + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_return *ir) +{ + handle_rvalue(&ir->value);; + return visit_continue; +} + +ir_visitor_status +ir_rvalue_visitor::visit_leave(ir_if *ir) +{ + handle_rvalue(&ir->condition); + return visit_continue; +} diff --git a/mesalib/src/glsl/ir_rvalue_visitor.h b/mesalib/src/glsl/ir_rvalue_visitor.h new file mode 100644 index 000000000..31a56beb9 --- /dev/null +++ b/mesalib/src/glsl/ir_rvalue_visitor.h @@ -0,0 +1,47 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_rvalue_visitor.h + * + * Generic class to implement the common pattern we have of wanting to + * visit each ir_rvalue * and possibly change that node to a different + * class. Just implement handle_rvalue() and you will be called with + * a pointer to each rvalue in the tree. + */ + +class ir_rvalue_visitor : public ir_hierarchical_visitor { +public: + + virtual ir_visitor_status visit_leave(ir_assignment *); + virtual ir_visitor_status visit_leave(ir_call *); + virtual ir_visitor_status visit_leave(ir_dereference_array *); + virtual ir_visitor_status visit_leave(ir_dereference_record *); + virtual ir_visitor_status visit_leave(ir_expression *); + virtual ir_visitor_status visit_leave(ir_if *); + virtual ir_visitor_status visit_leave(ir_return *); + virtual ir_visitor_status visit_leave(ir_swizzle *); + virtual ir_visitor_status visit_leave(ir_texture *); + + virtual void handle_rvalue(ir_rvalue **rvalue) = 0; +}; diff --git a/mesalib/src/glsl/ir_set_program_inouts.cpp b/mesalib/src/glsl/ir_set_program_inouts.cpp new file mode 100644 index 000000000..b3f1cc0d8 --- /dev/null +++ b/mesalib/src/glsl/ir_set_program_inouts.cpp @@ -0,0 +1,167 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_set_program_inouts.cpp + * + * Sets the InputsRead and OutputsWritten of Mesa programs. + * + * Mesa programs (gl_program, not gl_shader_program) have a set of + * flags indicating which varyings are read and written. Computing + * which are actually read from some sort of backend code can be + * tricky when variable array indexing involved. So this pass + * provides support for setting InputsRead and OutputsWritten right + * from the GLSL IR. + */ + +extern "C" { +#include "main/core.h" /* for struct gl_program */ +#include "program/hash_table.h" +} +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" + +class ir_set_program_inouts_visitor : public ir_hierarchical_visitor { +public: + ir_set_program_inouts_visitor(struct gl_program *prog) + { + this->prog = prog; + this->ht = hash_table_ctor(0, + hash_table_pointer_hash, + hash_table_pointer_compare); + } + ~ir_set_program_inouts_visitor() + { + hash_table_dtor(this->ht); + } + + virtual ir_visitor_status visit_enter(ir_dereference_array *); + virtual ir_visitor_status visit_enter(ir_function_signature *); + virtual ir_visitor_status visit(ir_dereference_variable *); + virtual ir_visitor_status visit(ir_variable *); + + struct gl_program *prog; + struct hash_table *ht; +}; + +static void +mark(struct gl_program *prog, ir_variable *var, int index) +{ + /* As of GLSL 1.20, varyings can only be floats, floating-point + * vectors or matrices, or arrays of them. For Mesa programs using + * InputsRead/OutputsWritten, everything but matrices uses one + * slot, while matrices use a slot per column. Presumably + * something doing a more clever packing would use something other + * than InputsRead/OutputsWritten. + */ + const glsl_type *element_type; + int element_size; + + if (var->type->is_array()) + element_type = var->type->fields.array; + else + element_type = var->type; + + if (element_type->is_matrix()) + element_size = element_type->matrix_columns; + else + element_size = 1; + + index *= element_size; + for (int i = 0; i < element_size; i++) { + if (var->mode == ir_var_in) + prog->InputsRead |= BITFIELD64_BIT(var->location + index + i); + else + prog->OutputsWritten |= BITFIELD64_BIT(var->location + index + i); + } +} + +/* Default handler: Mark all the locations in the variable as used. */ +ir_visitor_status +ir_set_program_inouts_visitor::visit(ir_dereference_variable *ir) +{ + if (hash_table_find(this->ht, ir->var) == NULL) + return visit_continue; + + if (ir->type->is_array()) { + for (unsigned int i = 0; i < ir->type->length; i++) { + mark(this->prog, ir->var, i); + } + } else { + mark(this->prog, ir->var, 0); + } + + return visit_continue; +} + +ir_visitor_status +ir_set_program_inouts_visitor::visit_enter(ir_dereference_array *ir) +{ + ir_dereference_variable *deref_var; + ir_constant *index = ir->array_index->as_constant(); + deref_var = ir->array->as_dereference_variable(); + ir_variable *var = NULL; + + /* Check that we're dereferencing a shader in or out */ + if (deref_var) + var = (ir_variable *)hash_table_find(this->ht, deref_var->var); + + if (index && var) { + mark(this->prog, var, index->value.i[0]); + return visit_continue_with_parent; + } + + return visit_continue; +} + +ir_visitor_status +ir_set_program_inouts_visitor::visit(ir_variable *ir) +{ + if (ir->mode == ir_var_in || + ir->mode == ir_var_out) { + hash_table_insert(this->ht, ir, ir); + } + + return visit_continue; +} + +ir_visitor_status +ir_set_program_inouts_visitor::visit_enter(ir_function_signature *ir) +{ + /* We don't want to descend into the function parameters and + * consider them as shader inputs or outputs. + */ + visit_list_elements(this, &ir->body); + return visit_continue_with_parent; +} + +void +do_set_program_inouts(exec_list *instructions, struct gl_program *prog) +{ + ir_set_program_inouts_visitor v(prog); + + prog->InputsRead = 0; + prog->OutputsWritten = 0; + visit_list_elements(&v, instructions); +} diff --git a/mesalib/src/glsl/ir_structure_splitting.cpp b/mesalib/src/glsl/ir_structure_splitting.cpp new file mode 100644 index 000000000..ff3ec936e --- /dev/null +++ b/mesalib/src/glsl/ir_structure_splitting.cpp @@ -0,0 +1,361 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_structure_splitting.cpp + * + * If a structure is only ever referenced by its components, then + * split those components out to individual variables so they can be + * handled normally by other optimization passes. + * + * This skips structures like uniforms, which need to be accessible as + * structures for their access by the GL. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_print_visitor.h" +#include "ir_rvalue_visitor.h" +#include "glsl_types.h" + +static bool debug = false; + +// XXX using variable_entry2 here to avoid collision (MSVC multiply-defined +// function) with the variable_entry class seen in ir_variable_refcount.h +// Perhaps we can use the one in ir_variable_refcount.h and make this class +// here go away? +class variable_entry2 : public exec_node +{ +public: + variable_entry2(ir_variable *var) + { + this->var = var; + this->whole_structure_access = 0; + this->declaration = false; + this->components = NULL; + this->mem_ctx = NULL; + } + + ir_variable *var; /* The key: the variable's pointer. */ + + /** Number of times the variable is referenced, including assignments. */ + unsigned whole_structure_access; + + bool declaration; /* If the variable had a decl in the instruction stream */ + + ir_variable **components; + + /** talloc_parent(this->var) -- the shader's talloc context. */ + void *mem_ctx; +}; + + +class ir_structure_reference_visitor : public ir_hierarchical_visitor { +public: + ir_structure_reference_visitor(void) + { + this->mem_ctx = talloc_new(NULL); + this->variable_list.make_empty(); + } + + ~ir_structure_reference_visitor(void) + { + talloc_free(mem_ctx); + } + + virtual ir_visitor_status visit(ir_variable *); + virtual ir_visitor_status visit(ir_dereference_variable *); + virtual ir_visitor_status visit_enter(ir_dereference_record *); + virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_function_signature *); + + variable_entry2 *get_variable_entry2(ir_variable *var); + + /* List of variable_entry */ + exec_list variable_list; + + void *mem_ctx; +}; + +variable_entry2 * +ir_structure_reference_visitor::get_variable_entry2(ir_variable *var) +{ + assert(var); + + if (!var->type->is_record() || var->mode == ir_var_uniform) + return NULL; + + foreach_iter(exec_list_iterator, iter, this->variable_list) { + variable_entry2 *entry = (variable_entry2 *)iter.get(); + if (entry->var == var) + return entry; + } + + variable_entry2 *entry = new(mem_ctx) variable_entry2(var); + this->variable_list.push_tail(entry); + return entry; +} + + +ir_visitor_status +ir_structure_reference_visitor::visit(ir_variable *ir) +{ + variable_entry2 *entry = this->get_variable_entry2(ir); + + if (entry) + entry->declaration = true; + + return visit_continue; +} + +ir_visitor_status +ir_structure_reference_visitor::visit(ir_dereference_variable *ir) +{ + ir_variable *const var = ir->variable_referenced(); + variable_entry2 *entry = this->get_variable_entry2(var); + + if (entry) + entry->whole_structure_access++; + + return visit_continue; +} + +ir_visitor_status +ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir) +{ + (void) ir; + /* Don't descend into the ir_dereference_variable below. */ + return visit_continue_with_parent; +} + +ir_visitor_status +ir_structure_reference_visitor::visit_enter(ir_assignment *ir) +{ + if (ir->lhs->as_dereference_variable() && + ir->rhs->as_dereference_variable() && + !ir->condition) { + /* We'll split copies of a structure to copies of components, so don't + * descend to the ir_dereference_variables. + */ + return visit_continue_with_parent; + } + return visit_continue; +} + +ir_visitor_status +ir_structure_reference_visitor::visit_enter(ir_function_signature *ir) +{ + /* We don't want to descend into the function parameters and + * dead-code eliminate them, so just accept the body here. + */ + visit_list_elements(this, &ir->body); + return visit_continue_with_parent; +} + +class ir_structure_splitting_visitor : public ir_rvalue_visitor { +public: + ir_structure_splitting_visitor(exec_list *vars) + { + this->variable_list = vars; + } + + virtual ~ir_structure_splitting_visitor() + { + } + + virtual ir_visitor_status visit_leave(ir_assignment *); + + void split_deref(ir_dereference **deref); + void handle_rvalue(ir_rvalue **rvalue); + variable_entry2 *get_splitting_entry(ir_variable *var); + + exec_list *variable_list; + void *mem_ctx; +}; + +variable_entry2 * +ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var) +{ + assert(var); + + if (!var->type->is_record()) + return NULL; + + foreach_iter(exec_list_iterator, iter, *this->variable_list) { + variable_entry2 *entry = (variable_entry2 *)iter.get(); + if (entry->var == var) { + return entry; + } + } + + return NULL; +} + +void +ir_structure_splitting_visitor::split_deref(ir_dereference **deref) +{ + if ((*deref)->ir_type != ir_type_dereference_record) + return; + + ir_dereference_record *deref_record = (ir_dereference_record *)*deref; + ir_dereference_variable *deref_var = deref_record->record->as_dereference_variable(); + if (!deref_var) + return; + + variable_entry2 *entry = get_splitting_entry(deref_var->var); + if (!entry) + return; + + unsigned int i; + for (i = 0; i < entry->var->type->length; i++) { + if (strcmp(deref_record->field, + entry->var->type->fields.structure[i].name) == 0) + break; + } + assert(i != entry->var->type->length); + + *deref = new(entry->mem_ctx) ir_dereference_variable(entry->components[i]); +} + +void +ir_structure_splitting_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_dereference *deref = (*rvalue)->as_dereference(); + + if (!deref) + return; + + split_deref(&deref); + *rvalue = deref; +} + +ir_visitor_status +ir_structure_splitting_visitor::visit_leave(ir_assignment *ir) +{ + ir_dereference_variable *lhs_deref = ir->lhs->as_dereference_variable(); + ir_dereference_variable *rhs_deref = ir->rhs->as_dereference_variable(); + variable_entry2 *lhs_entry = lhs_deref ? get_splitting_entry(lhs_deref->var) : NULL; + variable_entry2 *rhs_entry = rhs_deref ? get_splitting_entry(rhs_deref->var) : NULL; + const glsl_type *type = ir->rhs->type; + + if ((lhs_entry || rhs_entry) && !ir->condition) { + for (unsigned int i = 0; i < type->length; i++) { + ir_dereference *new_lhs, *new_rhs; + void *mem_ctx = lhs_entry ? lhs_entry->mem_ctx : rhs_entry->mem_ctx; + + if (lhs_entry) { + new_lhs = new(mem_ctx) ir_dereference_variable(lhs_entry->components[i]); + } else { + new_lhs = new(mem_ctx) + ir_dereference_record(ir->lhs->clone(mem_ctx, NULL), + type->fields.structure[i].name); + } + + if (rhs_entry) { + new_rhs = new(mem_ctx) ir_dereference_variable(rhs_entry->components[i]); + } else { + new_rhs = new(mem_ctx) + ir_dereference_record(ir->rhs->clone(mem_ctx, NULL), + type->fields.structure[i].name); + } + + ir->insert_before(new(mem_ctx) ir_assignment(new_lhs, + new_rhs, + NULL)); + } + ir->remove(); + } else { + handle_rvalue(&ir->rhs); + split_deref(&ir->lhs); + } + + handle_rvalue(&ir->condition); + + return visit_continue; +} + +bool +do_structure_splitting(exec_list *instructions) +{ + ir_structure_reference_visitor refs; + + visit_list_elements(&refs, instructions); + + /* Trim out variables we can't split. */ + foreach_iter(exec_list_iterator, iter, refs.variable_list) { + variable_entry2 *entry = (variable_entry2 *)iter.get(); + + if (debug) { + printf("structure %s@%p: decl %d, whole_access %d\n", + entry->var->name, (void *) entry->var, entry->declaration, + entry->whole_structure_access); + } + + if (!entry->declaration || entry->whole_structure_access) { + entry->remove(); + } + } + + if (refs.variable_list.is_empty()) + return false; + + void *mem_ctx = talloc_new(NULL); + + /* Replace the decls of the structures to be split with their split + * components. + */ + foreach_iter(exec_list_iterator, iter, refs.variable_list) { + variable_entry2 *entry = (variable_entry2 *)iter.get(); + const struct glsl_type *type = entry->var->type; + + entry->mem_ctx = talloc_parent(entry->var); + + entry->components = talloc_array(mem_ctx, + ir_variable *, + type->length); + + for (unsigned int i = 0; i < entry->var->type->length; i++) { + const char *name = talloc_asprintf(mem_ctx, "%s_%s", + entry->var->name, + type->fields.structure[i].name); + + entry->components[i] = + new(entry->mem_ctx) ir_variable(type->fields.structure[i].type, + name, + ir_var_temporary); + entry->var->insert_before(entry->components[i]); + } + + entry->var->remove(); + } + + ir_structure_splitting_visitor split(&refs.variable_list); + visit_list_elements(&split, instructions); + + talloc_free(mem_ctx); + + return true; +} diff --git a/mesalib/src/glsl/ir_sub_to_add_neg.cpp b/mesalib/src/glsl/ir_sub_to_add_neg.cpp new file mode 100644 index 000000000..7ed8c1495 --- /dev/null +++ b/mesalib/src/glsl/ir_sub_to_add_neg.cpp @@ -0,0 +1,76 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_sub_to_add_neg.cpp + * + * Breaks an ir_binop_sub expression down to add(op0, neg(op1)) + * + * This simplifies expression reassociation, and for many backends + * there is no subtract operation separate from adding the negation. + * For backends with native subtract operations, they will probably + * want to recognize add(op0, neg(op1)) or the other way around to + * produce a subtract anyway. + */ + +#include "ir.h" + +class ir_sub_to_add_neg_visitor : public ir_hierarchical_visitor { +public: + ir_sub_to_add_neg_visitor() + { + this->progress = false; + } + + ir_visitor_status visit_leave(ir_expression *); + + bool progress; +}; + +bool +do_sub_to_add_neg(exec_list *instructions) +{ + ir_sub_to_add_neg_visitor v; + + visit_list_elements(&v, instructions); + return v.progress; +} + +ir_visitor_status +ir_sub_to_add_neg_visitor::visit_leave(ir_expression *ir) +{ + if (ir->operation != ir_binop_sub) + return visit_continue; + + void *mem_ctx = talloc_parent(ir); + + ir->operation = ir_binop_add; + ir->operands[1] = new(mem_ctx) ir_expression(ir_unop_neg, + ir->operands[1]->type, + ir->operands[1], + NULL); + + this->progress = true; + + return visit_continue; +} diff --git a/mesalib/src/glsl/ir_swizzle_swizzle.cpp b/mesalib/src/glsl/ir_swizzle_swizzle.cpp new file mode 100644 index 000000000..0ffb4fa31 --- /dev/null +++ b/mesalib/src/glsl/ir_swizzle_swizzle.cpp @@ -0,0 +1,93 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_swizzle_swizzle.cpp + * + * Eliminates the second swizzle in a swizzle chain. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +class ir_swizzle_swizzle_visitor : public ir_hierarchical_visitor { +public: + ir_swizzle_swizzle_visitor() + { + progress = false; + } + + virtual ir_visitor_status visit_enter(ir_swizzle *); + + bool progress; +}; + +ir_visitor_status +ir_swizzle_swizzle_visitor::visit_enter(ir_swizzle *ir) +{ + int mask2[4]; + + ir_swizzle *swiz2 = ir->val->as_swizzle(); + if (!swiz2) + return visit_continue; + + memset(&mask2, 0, sizeof(mask2)); + if (swiz2->mask.num_components >= 1) + mask2[0] = swiz2->mask.x; + if (swiz2->mask.num_components >= 2) + mask2[1] = swiz2->mask.y; + if (swiz2->mask.num_components >= 3) + mask2[2] = swiz2->mask.z; + if (swiz2->mask.num_components >= 4) + mask2[3] = swiz2->mask.w; + + if (ir->mask.num_components >= 1) + ir->mask.x = mask2[ir->mask.x]; + if (ir->mask.num_components >= 2) + ir->mask.y = mask2[ir->mask.y]; + if (ir->mask.num_components >= 3) + ir->mask.z = mask2[ir->mask.z]; + if (ir->mask.num_components >= 4) + ir->mask.w = mask2[ir->mask.w]; + + ir->val = swiz2->val; + + this->progress = true; + + return visit_continue; +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_swizzle_swizzle(exec_list *instructions) +{ + ir_swizzle_swizzle_visitor v; + + v.run(instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/ir_tree_grafting.cpp b/mesalib/src/glsl/ir_tree_grafting.cpp new file mode 100644 index 000000000..9b569b828 --- /dev/null +++ b/mesalib/src/glsl/ir_tree_grafting.cpp @@ -0,0 +1,367 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_tree_grafting.cpp + * + * Takes assignments to variables that are dereferenced only once and + * pastes the RHS expression into where the variable is dereferenced. + * + * In the process of various operations like function inlining and + * tertiary op handling, we'll end up with our expression trees having + * been chopped up into a series of assignments of short expressions + * to temps. Other passes like ir_algebraic.cpp would prefer to see + * the deepest expression trees they can to try to optimize them. + * + * This is a lot like copy propagaton. In comparison, copy + * propagation only acts on plain copies, not arbitrary expressions on + * the RHS. Generally, we wouldn't want to go pasting some + * complicated expression everywhere it got used, though, so we don't + * handle expressions in that pass. + * + * The hard part is making sure we don't move an expression across + * some other assignments that would change the value of the + * expression. So we split this into two passes: First, find the + * variables in our scope which are written to once and read once, and + * then go through basic blocks seeing if we find an opportunity to + * move those expressions safely. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_variable_refcount.h" +#include "ir_basic_block.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +static bool debug = false; + +class ir_tree_grafting_visitor : public ir_hierarchical_visitor { +public: + ir_tree_grafting_visitor(ir_assignment *graft_assign, + ir_variable *graft_var) + { + this->progress = false; + this->graft_assign = graft_assign; + this->graft_var = graft_var; + } + + virtual ir_visitor_status visit_leave(class ir_assignment *); + virtual ir_visitor_status visit_enter(class ir_call *); + virtual ir_visitor_status visit_enter(class ir_expression *); + virtual ir_visitor_status visit_enter(class ir_function *); + virtual ir_visitor_status visit_enter(class ir_function_signature *); + virtual ir_visitor_status visit_enter(class ir_if *); + virtual ir_visitor_status visit_enter(class ir_loop *); + virtual ir_visitor_status visit_enter(class ir_swizzle *); + virtual ir_visitor_status visit_enter(class ir_texture *); + + bool do_graft(ir_rvalue **rvalue); + + bool progress; + ir_variable *graft_var; + ir_assignment *graft_assign; +}; + +struct find_deref_info { + ir_variable *var; + bool found; +}; + +void +dereferences_variable_callback(ir_instruction *ir, void *data) +{ + struct find_deref_info *info = (struct find_deref_info *)data; + ir_dereference_variable *deref = ir->as_dereference_variable(); + + if (deref && deref->var == info->var) + info->found = true; +} + +static bool +dereferences_variable(ir_instruction *ir, ir_variable *var) +{ + struct find_deref_info info; + + info.var = var; + info.found = false; + + visit_tree(ir, dereferences_variable_callback, &info); + + return info.found; +} + +bool +ir_tree_grafting_visitor::do_graft(ir_rvalue **rvalue) +{ + if (!*rvalue) + return false; + + ir_dereference_variable *deref = (*rvalue)->as_dereference_variable(); + + if (!deref || deref->var != this->graft_var) + return false; + + if (debug) { + printf("GRAFTING:\n"); + this->graft_assign->print(); + printf("\n"); + printf("TO:\n"); + (*rvalue)->print(); + printf("\n"); + } + + this->graft_assign->remove(); + *rvalue = this->graft_assign->rhs; + + this->progress = true; + return true; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_loop *ir) +{ + (void)ir; + /* Do not traverse into the body of the loop since that is a + * different basic block. + */ + return visit_stop; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_leave(ir_assignment *ir) +{ + if (do_graft(&ir->rhs) || + do_graft(&ir->condition)) + return visit_stop; + + /* If this assignment updates a variable used in the assignment + * we're trying to graft, then we're done. + */ + if (dereferences_variable(this->graft_assign->rhs, + ir->lhs->variable_referenced())) { + if (debug) { + printf("graft killed by: "); + ir->print(); + printf("\n"); + } + return visit_stop; + } + + return visit_continue; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_function *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_function_signature *ir) +{ + (void)ir; + return visit_continue_with_parent; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_call *ir) +{ + exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + /* Reminder: iterating ir_call iterates its parameters. */ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_variable *sig_param = (ir_variable *)sig_iter.get(); + ir_rvalue *ir = (ir_rvalue *)iter.get(); + ir_rvalue *new_ir = ir; + + if (sig_param->mode != ir_var_in) + continue; + + if (do_graft(&new_ir)) { + ir->replace_with(new_ir); + return visit_stop; + } + sig_iter.next(); + } + + return visit_continue; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_expression *ir) +{ + for (unsigned int i = 0; i < ir->get_num_operands(); i++) { + if (do_graft(&ir->operands[i])) + return visit_stop; + } + + return visit_continue; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_if *ir) +{ + if (do_graft(&ir->condition)) + return visit_stop; + + /* Do not traverse into the body of the if-statement since that is a + * different basic block. + */ + return visit_continue_with_parent; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_swizzle *ir) +{ + if (do_graft(&ir->val)) + return visit_stop; + + return visit_continue; +} + +ir_visitor_status +ir_tree_grafting_visitor::visit_enter(ir_texture *ir) +{ + if (do_graft(&ir->coordinate) || + do_graft(&ir->projector) || + do_graft(&ir->shadow_comparitor)) + return visit_stop; + + switch (ir->op) { + case ir_tex: + break; + case ir_txb: + if (do_graft(&ir->lod_info.bias)) + return visit_stop; + break; + case ir_txf: + case ir_txl: + if (do_graft(&ir->lod_info.lod)) + return visit_stop; + break; + case ir_txd: + if (do_graft(&ir->lod_info.grad.dPdx) || + do_graft(&ir->lod_info.grad.dPdy)) + return visit_stop; + break; + } + + return visit_continue; +} + +struct tree_grafting_info { + ir_variable_refcount_visitor *refs; + bool progress; +}; + +static bool +try_tree_grafting(ir_assignment *start, + ir_variable *lhs_var, + ir_instruction *bb_last) +{ + ir_tree_grafting_visitor v(start, lhs_var); + + if (debug) { + printf("trying to graft: "); + lhs_var->print(); + printf("\n"); + } + + for (ir_instruction *ir = (ir_instruction *)start->next; + ir != bb_last->next; + ir = (ir_instruction *)ir->next) { + + if (debug) { + printf("- "); + ir->print(); + printf("\n"); + } + + ir_visitor_status s = ir->accept(&v); + if (s == visit_stop) + return v.progress; + } + + return false; +} + +static void +tree_grafting_basic_block(ir_instruction *bb_first, + ir_instruction *bb_last, + void *data) +{ + struct tree_grafting_info *info = (struct tree_grafting_info *)data; + ir_instruction *ir, *next; + + for (ir = bb_first, next = (ir_instruction *)ir->next; + ir != bb_last->next; + ir = next, next = (ir_instruction *)ir->next) { + ir_assignment *assign = ir->as_assignment(); + + if (!assign) + continue; + + ir_variable *lhs_var = assign->whole_variable_written(); + if (!lhs_var) + continue; + + if (lhs_var->mode == ir_var_out || + lhs_var->mode == ir_var_inout) + continue; + + variable_entry *entry = info->refs->get_variable_entry(lhs_var); + + if (!entry->declaration || + entry->assigned_count != 1 || + entry->referenced_count != 2) + continue; + + assert(assign == entry->assign); + + /* Found a possibly graftable assignment. Now, walk through the + * rest of the BB seeing if the deref is here, and if nothing interfered with + * pasting its expression's values in between. + */ + info->progress |= try_tree_grafting(assign, lhs_var, bb_last); + } +} + +/** + * Does a copy propagation pass on the code present in the instruction stream. + */ +bool +do_tree_grafting(exec_list *instructions) +{ + ir_variable_refcount_visitor refs; + struct tree_grafting_info info; + + info.progress = false; + info.refs = &refs; + + visit_list_elements(info.refs, instructions); + + call_for_basic_blocks(instructions, tree_grafting_basic_block, &info); + + return info.progress; +} diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp new file mode 100644 index 000000000..e35514aa6 --- /dev/null +++ b/mesalib/src/glsl/ir_validate.cpp @@ -0,0 +1,452 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_validate.cpp + * + * Attempts to verify that various invariants of the IR tree are true. + * + * In particular, at the moment it makes sure that no single + * ir_instruction node except for ir_variable appears multiple times + * in the ir tree. ir_variable does appear multiple times: Once as a + * declaration in an exec_list, and multiple times as the endpoint of + * a dereference chain. + */ + +#include <inttypes.h> +#include "ir.h" +#include "ir_hierarchical_visitor.h" +#include "program/hash_table.h" +#include "glsl_types.h" + +class ir_validate : public ir_hierarchical_visitor { +public: + ir_validate() + { + this->ht = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); + + this->current_function = NULL; + + this->callback = ir_validate::validate_ir; + this->data = ht; + } + + ~ir_validate() + { + hash_table_dtor(this->ht); + } + + virtual ir_visitor_status visit(ir_variable *v); + virtual ir_visitor_status visit(ir_dereference_variable *ir); + virtual ir_visitor_status visit(ir_if *ir); + + virtual ir_visitor_status visit_leave(ir_loop *ir); + virtual ir_visitor_status visit_enter(ir_function *ir); + virtual ir_visitor_status visit_leave(ir_function *ir); + virtual ir_visitor_status visit_enter(ir_function_signature *ir); + + virtual ir_visitor_status visit_leave(ir_expression *ir); + + virtual ir_visitor_status visit_enter(ir_assignment *ir); + + static void validate_ir(ir_instruction *ir, void *data); + + ir_function *current_function; + + struct hash_table *ht; +}; + + +ir_visitor_status +ir_validate::visit(ir_dereference_variable *ir) +{ + if ((ir->var == NULL) || (ir->var->as_variable() == NULL)) { + printf("ir_dereference_variable @ %p does not specify a variable %p\n", + (void *) ir, (void *) ir->var); + abort(); + } + + if (hash_table_find(ht, ir->var) == NULL) { + printf("ir_dereference_variable @ %p specifies undeclared variable " + "`%s' @ %p\n", + (void *) ir, ir->var->name, (void *) ir->var); + abort(); + } + + this->validate_ir(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_validate::visit(ir_if *ir) +{ + if (ir->condition->type != glsl_type::bool_type) { + printf("ir_if condition %s type instead of bool.\n", + ir->condition->type->name); + ir->print(); + printf("\n"); + abort(); + } + + return visit_continue; +} + + +ir_visitor_status +ir_validate::visit_leave(ir_loop *ir) +{ + if (ir->counter != NULL) { + if ((ir->from == NULL) || (ir->from == NULL) || (ir->increment == NULL)) { + printf("ir_loop has invalid loop controls:\n" + " counter: %p\n" + " from: %p\n" + " to: %p\n" + " increment: %p\n", + (void *) ir->counter, (void *) ir->from, (void *) ir->to, + (void *) ir->increment); + abort(); + } + + if ((ir->cmp < ir_binop_less) || (ir->cmp > ir_binop_nequal)) { + printf("ir_loop has invalid comparitor %d\n", ir->cmp); + abort(); + } + } else { + if ((ir->from != NULL) || (ir->from != NULL) || (ir->increment != NULL)) { + printf("ir_loop has invalid loop controls:\n" + " counter: %p\n" + " from: %p\n" + " to: %p\n" + " increment: %p\n", + (void *) ir->counter, (void *) ir->from, (void *) ir->to, + (void *) ir->increment); + abort(); + } + } + + return visit_continue; +} + + +ir_visitor_status +ir_validate::visit_enter(ir_function *ir) +{ + /* Function definitions cannot be nested. + */ + if (this->current_function != NULL) { + printf("Function definition nested inside another function " + "definition:\n"); + printf("%s %p inside %s %p\n", + ir->name, (void *) ir, + this->current_function->name, (void *) this->current_function); + abort(); + } + + /* Store the current function hierarchy being traversed. This is used + * by the function signature visitor to ensure that the signatures are + * linked with the correct functions. + */ + this->current_function = ir; + + this->validate_ir(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_validate::visit_leave(ir_function *ir) +{ + assert(talloc_parent(ir->name) == ir); + + this->current_function = NULL; + return visit_continue; +} + +ir_visitor_status +ir_validate::visit_enter(ir_function_signature *ir) +{ + if (this->current_function != ir->function()) { + printf("Function signature nested inside wrong function " + "definition:\n"); + printf("%p inside %s %p instead of %s %p\n", + (void *) ir, + this->current_function->name, (void *) this->current_function, + ir->function_name(), (void *) ir->function()); + abort(); + } + + this->validate_ir(ir, this->data); + + return visit_continue; +} + +ir_visitor_status +ir_validate::visit_leave(ir_expression *ir) +{ + switch (ir->operation) { + case ir_unop_bit_not: + assert(ir->operands[0]->type == ir->type); + break; + case ir_unop_logic_not: + assert(ir->type->base_type == GLSL_TYPE_BOOL); + assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); + break; + + case ir_unop_neg: + case ir_unop_abs: + case ir_unop_sign: + case ir_unop_rcp: + case ir_unop_rsq: + case ir_unop_sqrt: + assert(ir->type == ir->operands[0]->type); + break; + + case ir_unop_exp: + case ir_unop_log: + case ir_unop_exp2: + case ir_unop_log2: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type == ir->operands[0]->type); + break; + + case ir_unop_f2i: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; + case ir_unop_i2f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + case ir_unop_f2b: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_BOOL); + break; + case ir_unop_b2f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + case ir_unop_i2b: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_INT); + assert(ir->type->base_type == GLSL_TYPE_BOOL); + break; + case ir_unop_b2i: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); + assert(ir->type->base_type == GLSL_TYPE_INT); + break; + case ir_unop_u2f: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_UINT); + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + break; + + case ir_unop_any: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL); + assert(ir->type == glsl_type::bool_type); + break; + + case ir_unop_trunc: + case ir_unop_ceil: + case ir_unop_floor: + case ir_unop_fract: + case ir_unop_sin: + case ir_unop_cos: + case ir_unop_dFdx: + case ir_unop_dFdy: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->operands[0]->type == ir->type); + break; + + case ir_unop_noise: + /* XXX what can we assert here? */ + break; + + case ir_binop_add: + case ir_binop_sub: + case ir_binop_mul: + case ir_binop_div: + case ir_binop_mod: + case ir_binop_min: + case ir_binop_max: + case ir_binop_pow: + if (ir->operands[0]->type->is_scalar()) + assert(ir->operands[1]->type == ir->type); + else if (ir->operands[1]->type->is_scalar()) + assert(ir->operands[0]->type == ir->type); + else if (ir->operands[0]->type->is_vector() && + ir->operands[1]->type->is_vector()) { + assert(ir->operands[0]->type == ir->operands[1]->type); + assert(ir->operands[0]->type == ir->type); + } + break; + + case ir_binop_less: + case ir_binop_greater: + case ir_binop_lequal: + case ir_binop_gequal: + case ir_binop_equal: + case ir_binop_nequal: + /* The semantics of the IR operators differ from the GLSL <, >, <=, >=, + * ==, and != operators. The IR operators perform a component-wise + * comparison on scalar or vector types and return a boolean scalar or + * vector type of the same size. + */ + assert(ir->type->base_type == GLSL_TYPE_BOOL); + assert(ir->operands[0]->type == ir->operands[1]->type); + assert(ir->operands[0]->type->is_vector() + || ir->operands[0]->type->is_scalar()); + assert(ir->operands[0]->type->vector_elements + == ir->type->vector_elements); + break; + + case ir_binop_all_equal: + case ir_binop_any_nequal: + /* GLSL == and != operate on scalars, vectors, matrices and arrays, and + * return a scalar boolean. The IR matches that. + */ + assert(ir->type == glsl_type::bool_type); + assert(ir->operands[0]->type == ir->operands[1]->type); + break; + + case ir_binop_lshift: + case ir_binop_rshift: + case ir_binop_bit_and: + case ir_binop_bit_xor: + case ir_binop_bit_or: + assert(ir->operands[0]->type == ir->operands[1]->type); + assert(ir->type == ir->operands[0]->type); + assert(ir->type->base_type == GLSL_TYPE_INT || + ir->type->base_type == GLSL_TYPE_UINT); + break; + + case ir_binop_logic_and: + case ir_binop_logic_xor: + case ir_binop_logic_or: + assert(ir->type == glsl_type::bool_type); + assert(ir->operands[0]->type == glsl_type::bool_type); + assert(ir->operands[1]->type == glsl_type::bool_type); + break; + + case ir_binop_dot: + assert(ir->type == glsl_type::float_type); + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->operands[0]->type->is_vector()); + assert(ir->operands[0]->type == ir->operands[1]->type); + break; + + case ir_binop_cross: + assert(ir->operands[0]->type == glsl_type::vec3_type); + assert(ir->operands[1]->type == glsl_type::vec3_type); + assert(ir->type == glsl_type::vec3_type); + break; + } + + return visit_continue; +} + +ir_visitor_status +ir_validate::visit(ir_variable *ir) +{ + /* An ir_variable is the one thing that can (and will) appear multiple times + * in an IR tree. It is added to the hashtable so that it can be used + * in the ir_dereference_variable handler to ensure that a variable is + * declared before it is dereferenced. + */ + if (ir->name) + assert(talloc_parent(ir->name) == ir); + + hash_table_insert(ht, ir, ir); + return visit_continue; +} + +ir_visitor_status +ir_validate::visit_enter(ir_assignment *ir) +{ + const ir_dereference *const lhs = ir->lhs; + if (lhs->type->is_scalar() || lhs->type->is_vector()) { + if (ir->write_mask == 0) { + printf("Assignment LHS is %s, but write mask is 0:\n", + lhs->type->is_scalar() ? "scalar" : "vector"); + ir->print(); + abort(); + } + + int lhs_components = 0; + for (int i = 0; i < 4; i++) { + if (ir->write_mask & (1 << i)) + lhs_components++; + } + + if (lhs_components != ir->rhs->type->vector_elements) { + printf("Assignment count of LHS write mask channels enabled not\n" + "matching RHS vector size (%d LHS, %d RHS).\n", + lhs_components, ir->rhs->type->vector_elements); + ir->print(); + abort(); + } + } + + this->validate_ir(ir, this->data); + + return visit_continue; +} + +void +ir_validate::validate_ir(ir_instruction *ir, void *data) +{ + struct hash_table *ht = (struct hash_table *) data; + + if (hash_table_find(ht, ir)) { + printf("Instruction node present twice in ir tree:\n"); + ir->print(); + printf("\n"); + abort(); + } + hash_table_insert(ht, ir, ir); +} + +void +check_node_type(ir_instruction *ir, void *data) +{ + (void) data; + + if (ir->ir_type <= ir_type_unset || ir->ir_type >= ir_type_max) { + printf("Instruction node with unset type\n"); + ir->print(); printf("\n"); + } + assert(ir->type != glsl_type::error_type); +} + +void +validate_ir_tree(exec_list *instructions) +{ + ir_validate v; + + v.run(instructions); + + foreach_iter(exec_list_iterator, iter, *instructions) { + ir_instruction *ir = (ir_instruction *)iter.get(); + + visit_tree(ir, check_node_type, NULL); + } +} diff --git a/mesalib/src/glsl/ir_variable.cpp b/mesalib/src/glsl/ir_variable.cpp new file mode 100644 index 000000000..1eff740ef --- /dev/null +++ b/mesalib/src/glsl/ir_variable.cpp @@ -0,0 +1,493 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "ir.h" +#include "glsl_parser_extras.h" +#include "glsl_symbol_table.h" +#include "builtin_variables.h" + +static void generate_ARB_draw_buffers_variables(exec_list *, + struct _mesa_glsl_parse_state *, + bool, _mesa_glsl_parser_targets); + +static ir_variable * +add_variable(const char *name, enum ir_variable_mode mode, int slot, + const glsl_type *type, exec_list *instructions, + glsl_symbol_table *symtab) +{ + ir_variable *var = new(symtab) ir_variable(type, name, mode); + + switch (var->mode) { + case ir_var_auto: + case ir_var_in: + case ir_var_uniform: + var->read_only = true; + break; + case ir_var_inout: + case ir_var_out: + break; + default: + assert(0); + break; + } + + var->location = slot; + + /* Once the variable is created an initialized, add it to the symbol table + * and add the declaration to the IR stream. + */ + instructions->push_tail(var); + + symtab->add_variable(var->name, var); + return var; +} + +static ir_variable * +add_uniform(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + const char *name, const glsl_type *type) +{ + return add_variable(name, ir_var_uniform, -1, type, instructions, + state->symbols); +} + +static void +add_builtin_variable(const builtin_variable *proto, exec_list *instructions, + glsl_symbol_table *symtab) +{ + /* Create a new variable declaration from the description supplied by + * the caller. + */ + const glsl_type *const type = symtab->get_type(proto->type); + + assert(type != NULL); + + add_variable(proto->name, proto->mode, proto->slot, type, instructions, + symtab); +} + +static void +add_builtin_constant(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + const char *name, int value) +{ + ir_variable *const var = add_variable(name, ir_var_auto, + -1, glsl_type::int_type, + instructions, state->symbols); + var->constant_value = new(var) ir_constant(value); +} + +/* Several constants in GLSL ES have different names than normal desktop GLSL. + * Therefore, this function should only be called on the ES path. + */ +static void +generate_100ES_uniforms(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + add_builtin_constant(instructions, state, "gl_MaxVertexAttribs", + state->Const.MaxVertexAttribs); + add_builtin_constant(instructions, state, "gl_MaxVertexUniformVectors", + state->Const.MaxVertexUniformComponents); + add_builtin_constant(instructions, state, "gl_MaxVaryingVectors", + state->Const.MaxVaryingFloats / 4); + add_builtin_constant(instructions, state, "gl_MaxVertexTextureImageUnits", + state->Const.MaxVertexTextureImageUnits); + add_builtin_constant(instructions, state, "gl_MaxCombinedTextureImageUnits", + state->Const.MaxCombinedTextureImageUnits); + add_builtin_constant(instructions, state, "gl_MaxTextureImageUnits", + state->Const.MaxTextureImageUnits); + add_builtin_constant(instructions, state, "gl_MaxFragmentUniformVectors", + state->Const.MaxFragmentUniformComponents); + + add_uniform(instructions, state, "gl_DepthRange", + state->symbols->get_type("gl_DepthRangeParameters")); +} + +static void +generate_110_uniforms(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + for (unsigned i = 0 + ; i < Elements(builtin_110_deprecated_uniforms) + ; i++) { + add_builtin_variable(& builtin_110_deprecated_uniforms[i], + instructions, state->symbols); + } + + add_builtin_constant(instructions, state, "gl_MaxLights", + state->Const.MaxLights); + add_builtin_constant(instructions, state, "gl_MaxClipPlanes", + state->Const.MaxClipPlanes); + add_builtin_constant(instructions, state, "gl_MaxTextureUnits", + state->Const.MaxTextureUnits); + add_builtin_constant(instructions, state, "gl_MaxTextureCoords", + state->Const.MaxTextureCoords); + add_builtin_constant(instructions, state, "gl_MaxVertexAttribs", + state->Const.MaxVertexAttribs); + add_builtin_constant(instructions, state, "gl_MaxVertexUniformComponents", + state->Const.MaxVertexUniformComponents); + add_builtin_constant(instructions, state, "gl_MaxVaryingFloats", + state->Const.MaxVaryingFloats); + add_builtin_constant(instructions, state, "gl_MaxVertexTextureImageUnits", + state->Const.MaxVertexTextureImageUnits); + add_builtin_constant(instructions, state, "gl_MaxCombinedTextureImageUnits", + state->Const.MaxCombinedTextureImageUnits); + add_builtin_constant(instructions, state, "gl_MaxTextureImageUnits", + state->Const.MaxTextureImageUnits); + add_builtin_constant(instructions, state, "gl_MaxFragmentUniformComponents", + state->Const.MaxFragmentUniformComponents); + + const glsl_type *const mat4_array_type = + glsl_type::get_array_instance(glsl_type::mat4_type, + state->Const.MaxTextureCoords); + + add_uniform(instructions, state, "gl_TextureMatrix", mat4_array_type); + add_uniform(instructions, state, "gl_TextureMatrixInverse", mat4_array_type); + add_uniform(instructions, state, "gl_TextureMatrixTranspose", mat4_array_type); + add_uniform(instructions, state, "gl_TextureMatrixInverseTranspose", mat4_array_type); + + add_uniform(instructions, state, "gl_DepthRange", + state->symbols->get_type("gl_DepthRangeParameters")); + + add_uniform(instructions, state, "gl_ClipPlane", + glsl_type::get_array_instance(glsl_type::vec4_type, + state->Const.MaxClipPlanes)); + add_uniform(instructions, state, "gl_Point", + state->symbols->get_type("gl_PointParameters")); + + const glsl_type *const material_parameters_type = + state->symbols->get_type("gl_MaterialParameters"); + add_uniform(instructions, state, "gl_FrontMaterial", material_parameters_type); + add_uniform(instructions, state, "gl_BackMaterial", material_parameters_type); + + const glsl_type *const light_source_array_type = + glsl_type::get_array_instance(state->symbols->get_type("gl_LightSourceParameters"), state->Const.MaxLights); + + add_uniform(instructions, state, "gl_LightSource", light_source_array_type); + + const glsl_type *const light_model_products_type = + state->symbols->get_type("gl_LightModelProducts"); + add_uniform(instructions, state, "gl_FrontLightModelProduct", + light_model_products_type); + add_uniform(instructions, state, "gl_BackLightModelProduct", + light_model_products_type); + + const glsl_type *const light_products_type = + glsl_type::get_array_instance(state->symbols->get_type("gl_LightProducts"), + state->Const.MaxLights); + add_uniform(instructions, state, "gl_FrontLightProduct", light_products_type); + add_uniform(instructions, state, "gl_BackLightProduct", light_products_type); + + add_uniform(instructions, state, "gl_TextureEnvColor", + glsl_type::get_array_instance(glsl_type::vec4_type, + state->Const.MaxTextureUnits)); + + const glsl_type *const texcoords_vec4 = + glsl_type::get_array_instance(glsl_type::vec4_type, + state->Const.MaxTextureCoords); + add_uniform(instructions, state, "gl_EyePlaneS", texcoords_vec4); + add_uniform(instructions, state, "gl_EyePlaneT", texcoords_vec4); + add_uniform(instructions, state, "gl_EyePlaneR", texcoords_vec4); + add_uniform(instructions, state, "gl_EyePlaneQ", texcoords_vec4); + add_uniform(instructions, state, "gl_ObjectPlaneS", texcoords_vec4); + add_uniform(instructions, state, "gl_ObjectPlaneT", texcoords_vec4); + add_uniform(instructions, state, "gl_ObjectPlaneR", texcoords_vec4); + add_uniform(instructions, state, "gl_ObjectPlaneQ", texcoords_vec4); + + add_uniform(instructions, state, "gl_Fog", + state->symbols->get_type("gl_FogParameters")); +} + +/* This function should only be called for ES, not desktop GL. */ +static void +generate_100ES_vs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) { + add_builtin_variable(& builtin_core_vs_variables[i], + instructions, state->symbols); + } + + generate_100ES_uniforms(instructions, state); + + generate_ARB_draw_buffers_variables(instructions, state, false, + vertex_shader); +} + + +static void +generate_110_vs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) { + add_builtin_variable(& builtin_core_vs_variables[i], + instructions, state->symbols); + } + + for (unsigned i = 0 + ; i < Elements(builtin_110_deprecated_vs_variables) + ; i++) { + add_builtin_variable(& builtin_110_deprecated_vs_variables[i], + instructions, state->symbols); + } + generate_110_uniforms(instructions, state); + + /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: + * + * "As with all arrays, indices used to subscript gl_TexCoord must + * either be an integral constant expressions, or this array must be + * re-declared by the shader with a size. The size can be at most + * gl_MaxTextureCoords. Using indexes close to 0 may aid the + * implementation in preserving varying resources." + */ + const glsl_type *const vec4_array_type = + glsl_type::get_array_instance(glsl_type::vec4_type, 0); + + add_variable("gl_TexCoord", ir_var_out, VERT_RESULT_TEX0, vec4_array_type, + instructions, state->symbols); + + generate_ARB_draw_buffers_variables(instructions, state, false, + vertex_shader); +} + + +static void +generate_120_vs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + /* GLSL version 1.20 did not add any built-in variables in the vertex + * shader. + */ + generate_110_vs_variables(instructions, state); +} + + +static void +generate_130_vs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + generate_120_vs_variables(instructions, state); + + for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) { + add_builtin_variable(& builtin_130_vs_variables[i], + instructions, state->symbols); + } + + const glsl_type *const clip_distance_array_type = + glsl_type::get_array_instance(glsl_type::float_type, + state->Const.MaxClipPlanes); + + /* FINISHME: gl_ClipDistance needs a real location assigned. */ + add_variable("gl_ClipDistance", ir_var_out, -1, clip_distance_array_type, + instructions, state->symbols); + +} + + +static void +initialize_vs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + + switch (state->language_version) { + case 100: + generate_100ES_vs_variables(instructions, state); + break; + case 110: + generate_110_vs_variables(instructions, state); + break; + case 120: + generate_120_vs_variables(instructions, state); + break; + case 130: + generate_130_vs_variables(instructions, state); + break; + } +} + +/* This function should only be called for ES, not desktop GL. */ +static void +generate_100ES_fs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) { + add_builtin_variable(& builtin_core_fs_variables[i], + instructions, state->symbols); + } + + for (unsigned i = 0; i < Elements(builtin_100ES_fs_variables); i++) { + add_builtin_variable(& builtin_100ES_fs_variables[i], + instructions, state->symbols); + } + + generate_100ES_uniforms(instructions, state); + + generate_ARB_draw_buffers_variables(instructions, state, false, + fragment_shader); +} + +static void +generate_110_fs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) { + add_builtin_variable(& builtin_core_fs_variables[i], + instructions, state->symbols); + } + + for (unsigned i = 0; i < Elements(builtin_110_fs_variables); i++) { + add_builtin_variable(& builtin_110_fs_variables[i], + instructions, state->symbols); + } + + for (unsigned i = 0 + ; i < Elements(builtin_110_deprecated_fs_variables) + ; i++) { + add_builtin_variable(& builtin_110_deprecated_fs_variables[i], + instructions, state->symbols); + } + generate_110_uniforms(instructions, state); + + /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: + * + * "As with all arrays, indices used to subscript gl_TexCoord must + * either be an integral constant expressions, or this array must be + * re-declared by the shader with a size. The size can be at most + * gl_MaxTextureCoords. Using indexes close to 0 may aid the + * implementation in preserving varying resources." + */ + const glsl_type *const vec4_array_type = + glsl_type::get_array_instance(glsl_type::vec4_type, 0); + + add_variable("gl_TexCoord", ir_var_in, FRAG_ATTRIB_TEX0, vec4_array_type, + instructions, state->symbols); + + generate_ARB_draw_buffers_variables(instructions, state, false, + fragment_shader); +} + + +static void +generate_ARB_draw_buffers_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool warn, _mesa_glsl_parser_targets target) +{ + /* gl_MaxDrawBuffers is available in all shader stages. + */ + ir_variable *const mdb = + add_variable("gl_MaxDrawBuffers", ir_var_auto, -1, + glsl_type::int_type, instructions, state->symbols); + + if (warn) + mdb->warn_extension = "GL_ARB_draw_buffers"; + + mdb->constant_value = new(mdb) + ir_constant(int(state->Const.MaxDrawBuffers)); + + + /* gl_FragData is only available in the fragment shader. + */ + if (target == fragment_shader) { + const glsl_type *const vec4_array_type = + glsl_type::get_array_instance(glsl_type::vec4_type, + state->Const.MaxDrawBuffers); + + ir_variable *const fd = + add_variable("gl_FragData", ir_var_out, FRAG_RESULT_DATA0, + vec4_array_type, instructions, state->symbols); + + if (warn) + fd->warn_extension = "GL_ARB_draw_buffers"; + } +} + + +static void +generate_120_fs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + generate_110_fs_variables(instructions, state); + + for (unsigned i = 0 + ; i < Elements(builtin_120_fs_variables) + ; i++) { + add_builtin_variable(& builtin_120_fs_variables[i], + instructions, state->symbols); + } +} + +static void +generate_130_fs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + generate_120_fs_variables(instructions, state); + + const glsl_type *const clip_distance_array_type = + glsl_type::get_array_instance(glsl_type::float_type, + state->Const.MaxClipPlanes); + + /* FINISHME: gl_ClipDistance needs a real location assigned. */ + add_variable("gl_ClipDistance", ir_var_in, -1, clip_distance_array_type, + instructions, state->symbols); +} + +static void +initialize_fs_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + + switch (state->language_version) { + case 100: + generate_100ES_fs_variables(instructions, state); + break; + case 110: + generate_110_fs_variables(instructions, state); + break; + case 120: + generate_120_fs_variables(instructions, state); + break; + case 130: + generate_130_fs_variables(instructions, state); + break; + } +} + +void +_mesa_glsl_initialize_variables(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + switch (state->target) { + case vertex_shader: + initialize_vs_variables(instructions, state); + break; + case geometry_shader: + break; + case fragment_shader: + initialize_fs_variables(instructions, state); + break; + case ir_shader: + fprintf(stderr, "ir reader has no builtin variables"); + exit(1); + break; + } +} diff --git a/mesalib/src/glsl/ir_variable_refcount.cpp b/mesalib/src/glsl/ir_variable_refcount.cpp new file mode 100644 index 000000000..7d39abb36 --- /dev/null +++ b/mesalib/src/glsl/ir_variable_refcount.cpp @@ -0,0 +1,113 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_variable_refcount.cpp + * + * Provides a visitor which produces a list of variables referenced, + * how many times they were referenced and assigned, and whether they + * were defined in the scope. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_variable_refcount.h" +#include "glsl_types.h" + + +// constructor +variable_entry::variable_entry(ir_variable *var) +{ + this->var = var; + assign = NULL; + assigned_count = 0; + declaration = false; + referenced_count = 0; +} + + +variable_entry * +ir_variable_refcount_visitor::get_variable_entry(ir_variable *var) +{ + assert(var); + foreach_iter(exec_list_iterator, iter, this->variable_list) { + variable_entry *entry = (variable_entry *)iter.get(); + if (entry->var == var) + return entry; + } + + variable_entry *entry = new(mem_ctx) variable_entry(var); + assert(entry->referenced_count == 0); + this->variable_list.push_tail(entry); + return entry; +} + + +ir_visitor_status +ir_variable_refcount_visitor::visit(ir_variable *ir) +{ + variable_entry *entry = this->get_variable_entry(ir); + if (entry) + entry->declaration = true; + + return visit_continue; +} + + +ir_visitor_status +ir_variable_refcount_visitor::visit(ir_dereference_variable *ir) +{ + ir_variable *const var = ir->variable_referenced(); + variable_entry *entry = this->get_variable_entry(var); + + if (entry) + entry->referenced_count++; + + return visit_continue; +} + + +ir_visitor_status +ir_variable_refcount_visitor::visit_enter(ir_function_signature *ir) +{ + /* We don't want to descend into the function parameters and + * dead-code eliminate them, so just accept the body here. + */ + visit_list_elements(this, &ir->body); + return visit_continue_with_parent; +} + + +ir_visitor_status +ir_variable_refcount_visitor::visit_leave(ir_assignment *ir) +{ + variable_entry *entry; + entry = this->get_variable_entry(ir->lhs->variable_referenced()); + if (entry) { + entry->assigned_count++; + if (entry->assign == NULL) + entry->assign = ir; + } + + return visit_continue; +} diff --git a/mesalib/src/glsl/ir_variable_refcount.h b/mesalib/src/glsl/ir_variable_refcount.h new file mode 100644 index 000000000..8b43bad71 --- /dev/null +++ b/mesalib/src/glsl/ir_variable_refcount.h @@ -0,0 +1,78 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_variable_refcount.h + * + * Provides a visitor which produces a list of variables referenced, + * how many times they were referenced and assigned, and whether they + * were defined in the scope. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "glsl_types.h" + +class variable_entry : public exec_node +{ +public: + variable_entry(ir_variable *var); + + ir_variable *var; /* The key: the variable's pointer. */ + ir_assignment *assign; /* An assignment to the variable, if any */ + + /** Number of times the variable is referenced, including assignments. */ + unsigned referenced_count; + + /** Number of times the variable is assigned. */ + unsigned assigned_count; + + bool declaration; /* If the variable had a decl in the instruction stream */ +}; + +class ir_variable_refcount_visitor : public ir_hierarchical_visitor { +public: + ir_variable_refcount_visitor(void) + { + this->mem_ctx = talloc_new(NULL); + this->variable_list.make_empty(); + } + + ~ir_variable_refcount_visitor(void) + { + talloc_free(this->mem_ctx); + } + + virtual ir_visitor_status visit(ir_variable *); + virtual ir_visitor_status visit(ir_dereference_variable *); + + virtual ir_visitor_status visit_enter(ir_function_signature *); + virtual ir_visitor_status visit_leave(ir_assignment *); + + variable_entry *get_variable_entry(ir_variable *var); + + /* List of variable_entry */ + exec_list variable_list; + + void *mem_ctx; +}; diff --git a/mesalib/src/glsl/ir_vec_index_to_cond_assign.cpp b/mesalib/src/glsl/ir_vec_index_to_cond_assign.cpp new file mode 100644 index 000000000..cd8dedf2f --- /dev/null +++ b/mesalib/src/glsl/ir_vec_index_to_cond_assign.cpp @@ -0,0 +1,258 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_vec_index_to_cond_assign.cpp + * + * Turns indexing into vector types to a series of conditional moves + * of each channel's swizzle into a temporary. + * + * Most GPUs don't have a native way to do this operation, and this + * works around that. For drivers using both this pass and + * ir_vec_index_to_swizzle, there's a risk that this pass will happen + * before sufficient constant folding to find that the array index is + * constant. However, we hope that other optimization passes, + * particularly constant folding of assignment conditions and copy + * propagation, will result in the same code in the end. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +/** + * Visitor class for replacing expressions with ir_constant values. + */ + +class ir_vec_index_to_cond_assign_visitor : public ir_hierarchical_visitor { +public: + ir_vec_index_to_cond_assign_visitor() + { + progress = false; + } + + ir_rvalue *convert_vec_index_to_cond_assign(ir_rvalue *val); + + virtual ir_visitor_status visit_enter(ir_expression *); + virtual ir_visitor_status visit_enter(ir_swizzle *); + virtual ir_visitor_status visit_leave(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_return *); + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_if *); + + bool progress; +}; + +ir_rvalue * +ir_vec_index_to_cond_assign_visitor::convert_vec_index_to_cond_assign(ir_rvalue *ir) +{ + ir_dereference_array *orig_deref = ir->as_dereference_array(); + ir_assignment *assign; + ir_variable *index, *var; + ir_dereference *deref; + ir_expression *condition; + ir_swizzle *swizzle; + int i; + + if (!orig_deref) + return ir; + + if (orig_deref->array->type->is_matrix() || + orig_deref->array->type->is_array()) + return ir; + + void *mem_ctx = talloc_parent(ir); + + assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); + + /* Store the index to a temporary to avoid reusing its tree. */ + index = new(base_ir) ir_variable(glsl_type::int_type, + "vec_index_tmp_i", + ir_var_temporary); + base_ir->insert_before(index); + deref = new(base_ir) ir_dereference_variable(index); + assign = new(base_ir) ir_assignment(deref, orig_deref->array_index, NULL); + base_ir->insert_before(assign); + + /* Temporary where we store whichever value we swizzle out. */ + var = new(base_ir) ir_variable(ir->type, "vec_index_tmp_v", + ir_var_temporary); + base_ir->insert_before(var); + + /* Generate a conditional move of each vector element to the temp. */ + for (i = 0; i < orig_deref->array->type->vector_elements; i++) { + deref = new(base_ir) ir_dereference_variable(index); + condition = new(base_ir) ir_expression(ir_binop_equal, + glsl_type::bool_type, + deref, + new(base_ir) ir_constant(i)); + + /* Just clone the rest of the deref chain when trying to get at the + * underlying variable. + */ + swizzle = new(base_ir) ir_swizzle(orig_deref->array->clone(mem_ctx, NULL), + i, 0, 0, 0, 1); + + deref = new(base_ir) ir_dereference_variable(var); + assign = new(base_ir) ir_assignment(deref, swizzle, condition); + base_ir->insert_before(assign); + } + + this->progress = true; + return new(base_ir) ir_dereference_variable(var); +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_expression *ir) +{ + unsigned int i; + + for (i = 0; i < ir->get_num_operands(); i++) { + ir->operands[i] = convert_vec_index_to_cond_assign(ir->operands[i]); + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_swizzle *ir) +{ + /* Can't be hit from normal GLSL, since you can't swizzle a scalar (which + * the result of indexing a vector is. But maybe at some point we'll end up + * using swizzling of scalars for vector construction. + */ + ir->val = convert_vec_index_to_cond_assign(ir->val); + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_leave(ir_assignment *ir) +{ + ir_variable *index, *var; + ir_dereference_variable *deref; + ir_assignment *assign; + int i; + + ir->rhs = convert_vec_index_to_cond_assign(ir->rhs); + if (ir->condition) + ir->condition = convert_vec_index_to_cond_assign(ir->condition); + + /* Last, handle the LHS */ + ir_dereference_array *orig_deref = ir->lhs->as_dereference_array(); + + if (!orig_deref || + orig_deref->array->type->is_matrix() || + orig_deref->array->type->is_array()) + return visit_continue; + + void *mem_ctx = talloc_parent(ir); + + assert(orig_deref->array_index->type->base_type == GLSL_TYPE_INT); + + /* Store the index to a temporary to avoid reusing its tree. */ + index = new(ir) ir_variable(glsl_type::int_type, "vec_index_tmp_i", + ir_var_temporary); + ir->insert_before(index); + deref = new(ir) ir_dereference_variable(index); + assign = new(ir) ir_assignment(deref, orig_deref->array_index, NULL); + ir->insert_before(assign); + + /* Store the RHS to a temporary to avoid reusing its tree. */ + var = new(ir) ir_variable(ir->rhs->type, "vec_index_tmp_v", + ir_var_temporary); + ir->insert_before(var); + deref = new(ir) ir_dereference_variable(var); + assign = new(ir) ir_assignment(deref, ir->rhs, NULL); + ir->insert_before(assign); + + /* Generate a conditional move of each vector element to the temp. */ + for (i = 0; i < orig_deref->array->type->vector_elements; i++) { + ir_rvalue *condition, *swizzle; + + deref = new(ir) ir_dereference_variable(index); + condition = new(ir) ir_expression(ir_binop_equal, + glsl_type::bool_type, + deref, + new(ir) ir_constant(i)); + + /* Just clone the rest of the deref chain when trying to get at the + * underlying variable. + */ + swizzle = new(ir) ir_swizzle(orig_deref->array->clone(mem_ctx, NULL), + i, 0, 0, 0, 1); + + deref = new(ir) ir_dereference_variable(var); + assign = new(ir) ir_assignment(swizzle, deref, condition); + ir->insert_before(assign); + } + ir->remove(); + + this->progress = true; + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = convert_vec_index_to_cond_assign(param); + + if (new_param != param) { + param->replace_with(new_param); + } + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_return *ir) +{ + if (ir->value) { + ir->value = convert_vec_index_to_cond_assign(ir->value); + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_cond_assign_visitor::visit_enter(ir_if *ir) +{ + ir->condition = convert_vec_index_to_cond_assign(ir->condition); + + return visit_continue; +} + +bool +do_vec_index_to_cond_assign(exec_list *instructions) +{ + ir_vec_index_to_cond_assign_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/ir_vec_index_to_swizzle.cpp b/mesalib/src/glsl/ir_vec_index_to_swizzle.cpp new file mode 100644 index 000000000..969dc8f94 --- /dev/null +++ b/mesalib/src/glsl/ir_vec_index_to_swizzle.cpp @@ -0,0 +1,157 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_vec_index_to_swizzle.cpp + * + * Turns constant indexing into vector types to swizzles. This will + * let other swizzle-aware optimization passes catch these constructs, + * and codegen backends not have to worry about this case. + */ + +#include "ir.h" +#include "ir_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" + +/** + * Visitor class for replacing expressions with ir_constant values. + */ + +class ir_vec_index_to_swizzle_visitor : public ir_hierarchical_visitor { +public: + ir_vec_index_to_swizzle_visitor() + { + progress = false; + } + + ir_rvalue *convert_vec_index_to_swizzle(ir_rvalue *val); + + virtual ir_visitor_status visit_enter(ir_expression *); + virtual ir_visitor_status visit_enter(ir_swizzle *); + virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_return *); + virtual ir_visitor_status visit_enter(ir_call *); + virtual ir_visitor_status visit_enter(ir_if *); + + bool progress; +}; + +ir_rvalue * +ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir) +{ + ir_dereference_array *deref = ir->as_dereference_array(); + ir_constant *ir_constant; + + if (!deref) + return ir; + + if (deref->array->type->is_matrix() || deref->array->type->is_array()) + return ir; + + assert(deref->array_index->type->base_type == GLSL_TYPE_INT); + ir_constant = deref->array_index->constant_expression_value(); + if (!ir_constant) + return ir; + + void *ctx = talloc_parent(ir); + this->progress = true; + return new(ctx) ir_swizzle(deref->array, + ir_constant->value.i[0], 0, 0, 0, 1); +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_expression *ir) +{ + unsigned int i; + + for (i = 0; i < ir->get_num_operands(); i++) { + ir->operands[i] = convert_vec_index_to_swizzle(ir->operands[i]); + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_swizzle *ir) +{ + /* Can't be hit from normal GLSL, since you can't swizzle a scalar (which + * the result of indexing a vector is. But maybe at some point we'll end up + * using swizzling of scalars for vector construction. + */ + ir->val = convert_vec_index_to_swizzle(ir->val); + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_assignment *ir) +{ + ir->set_lhs(convert_vec_index_to_swizzle(ir->lhs)); + ir->rhs = convert_vec_index_to_swizzle(ir->rhs); + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_call *ir) +{ + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param = (ir_rvalue *)iter.get(); + ir_rvalue *new_param = convert_vec_index_to_swizzle(param); + + if (new_param != param) { + param->replace_with(new_param); + } + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_return *ir) +{ + if (ir->value) { + ir->value = convert_vec_index_to_swizzle(ir->value); + } + + return visit_continue; +} + +ir_visitor_status +ir_vec_index_to_swizzle_visitor::visit_enter(ir_if *ir) +{ + ir->condition = convert_vec_index_to_swizzle(ir->condition); + + return visit_continue; +} + +bool +do_vec_index_to_swizzle(exec_list *instructions) +{ + ir_vec_index_to_swizzle_visitor v; + + v.run(instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/ir_visitor.h b/mesalib/src/glsl/ir_visitor.h new file mode 100644 index 000000000..7dd35fe1d --- /dev/null +++ b/mesalib/src/glsl/ir_visitor.h @@ -0,0 +1,84 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef IR_VISITOR_H +#define IR_VISITOR_H + +/** + * Abstract base class of visitors of IR instruction trees + */ +class ir_visitor { +public: + virtual ~ir_visitor() + { + /* empty */ + } + + /** + * \name Visit methods + * + * As typical for the visitor pattern, there must be one \c visit method for + * each concrete subclass of \c ir_instruction. Virtual base classes within + * the hierarchy should not have \c visit methods. + */ + /*@{*/ + virtual void visit(class ir_variable *) = 0; + virtual void visit(class ir_function_signature *) = 0; + virtual void visit(class ir_function *) = 0; + virtual void visit(class ir_expression *) = 0; + virtual void visit(class ir_texture *) = 0; + virtual void visit(class ir_swizzle *) = 0; + virtual void visit(class ir_dereference_variable *) = 0; + virtual void visit(class ir_dereference_array *) = 0; + virtual void visit(class ir_dereference_record *) = 0; + virtual void visit(class ir_assignment *) = 0; + virtual void visit(class ir_constant *) = 0; + virtual void visit(class ir_call *) = 0; + virtual void visit(class ir_return *) = 0; + virtual void visit(class ir_discard *) = 0; + virtual void visit(class ir_if *) = 0; + virtual void visit(class ir_loop *) = 0; + virtual void visit(class ir_loop_jump *) = 0; + /*@}*/ +}; + +/* NOTE: function calls may never return due to discards inside them + * This is usually not an issue, but if it is, keep it in mind + */ +class ir_control_flow_visitor : public ir_visitor { +public: + virtual void visit(class ir_variable *) {} + virtual void visit(class ir_expression *) {} + virtual void visit(class ir_texture *) {} + virtual void visit(class ir_swizzle *) {} + virtual void visit(class ir_dereference_variable *) {} + virtual void visit(class ir_dereference_array *) {} + virtual void visit(class ir_dereference_record *) {} + virtual void visit(class ir_assignment *) {} + virtual void visit(class ir_constant *) {} + virtual void visit(class ir_call *) {} +}; + +#endif /* IR_VISITOR_H */ diff --git a/mesalib/src/glsl/link_functions.cpp b/mesalib/src/glsl/link_functions.cpp new file mode 100644 index 000000000..78c8b48cf --- /dev/null +++ b/mesalib/src/glsl/link_functions.cpp @@ -0,0 +1,262 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <cstdlib> +#include <cstdio> +#include <cstdarg> + +extern "C" { +#include <talloc.h> +} + +#include "main/core.h" +#include "glsl_symbol_table.h" +#include "glsl_parser_extras.h" +#include "ir.h" +#include "program.h" +#include "program/hash_table.h" +#include "linker.h" + +static ir_function_signature * +find_matching_signature(const char *name, const exec_list *actual_parameters, + gl_shader **shader_list, unsigned num_shaders); + +class call_link_visitor : public ir_hierarchical_visitor { +public: + call_link_visitor(gl_shader_program *prog, gl_shader *linked, + gl_shader **shader_list, unsigned num_shaders) + { + this->prog = prog; + this->shader_list = shader_list; + this->num_shaders = num_shaders; + this->success = true; + this->linked = linked; + + this->locals = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); + } + + ~call_link_visitor() + { + hash_table_dtor(this->locals); + } + + virtual ir_visitor_status visit(ir_variable *ir) + { + hash_table_insert(locals, ir, ir); + return visit_continue; + } + + virtual ir_visitor_status visit_enter(ir_call *ir) + { + /* If ir is an ir_call from a function that was imported from another + * shader callee will point to an ir_function_signature in the original + * shader. In this case the function signature MUST NOT BE MODIFIED. + * Doing so will modify the original shader. This may prevent that + * shader from being linkable in other programs. + */ + const ir_function_signature *const callee = ir->get_callee(); + assert(callee != NULL); + const char *const name = callee->function_name(); + + /* Determine if the requested function signature already exists in the + * final linked shader. If it does, use it as the target of the call. + */ + ir_function_signature *sig = + find_matching_signature(name, &callee->parameters, &linked, 1); + if (sig != NULL) { + ir->set_callee(sig); + return visit_continue; + } + + /* Try to find the signature in one of the other shaders that is being + * linked. If it's not found there, return an error. + */ + sig = find_matching_signature(name, &ir->actual_parameters, shader_list, + num_shaders); + if (sig == NULL) { + /* FINISHME: Log the full signature of unresolved function. + */ + linker_error_printf(this->prog, "unresolved reference to function " + "`%s'\n", name); + this->success = false; + return visit_stop; + } + + /* Find the prototype information in the linked shader. Generate any + * details that may be missing. + */ + ir_function *f = linked->symbols->get_function(name); + if (f == NULL) + f = new(linked) ir_function(name); + + ir_function_signature *linked_sig = + f->exact_matching_signature(&callee->parameters); + if (linked_sig == NULL) { + linked_sig = new(linked) ir_function_signature(callee->return_type); + f->add_signature(linked_sig); + } + + /* At this point linked_sig and called may be the same. If ir is an + * ir_call from linked then linked_sig and callee will be + * ir_function_signatures that have no definitions (is_defined is false). + */ + assert(!linked_sig->is_defined); + assert(linked_sig->body.is_empty()); + + /* Create an in-place clone of the function definition. This multistep + * process introduces some complexity here, but it has some advantages. + * The parameter list and the and function body are cloned separately. + * The clone of the parameter list is used to prime the hashtable used + * to replace variable references in the cloned body. + * + * The big advantage is that the ir_function_signature does not change. + * This means that we don't have to process the rest of the IR tree to + * patch ir_call nodes. In addition, there is no way to remove or + * replace signature stored in a function. One could easily be added, + * but this avoids the need. + */ + struct hash_table *ht = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); + exec_list formal_parameters; + foreach_list_const(node, &sig->parameters) { + const ir_instruction *const original = (ir_instruction *) node; + assert(const_cast<ir_instruction *>(original)->as_variable()); + + ir_instruction *copy = original->clone(linked, ht); + formal_parameters.push_tail(copy); + } + + linked_sig->replace_parameters(&formal_parameters); + + foreach_list_const(node, &sig->body) { + const ir_instruction *const original = (ir_instruction *) node; + + ir_instruction *copy = original->clone(linked, ht); + linked_sig->body.push_tail(copy); + } + + linked_sig->is_defined = true; + hash_table_dtor(ht); + + /* Patch references inside the function to things outside the function + * (i.e., function calls and global variables). + */ + linked_sig->accept(this); + + ir->set_callee(linked_sig); + + return visit_continue; + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + if (hash_table_find(locals, ir->var) == NULL) { + /* The non-function variable must be a global, so try to find the + * variable in the shader's symbol table. If the variable is not + * found, then it's a global that *MUST* be defined in the original + * shader. + */ + ir_variable *var = linked->symbols->get_variable(ir->var->name); + if (var == NULL) { + /* Clone the ir_variable that the dereference already has and add + * it to the linked shader. + */ + var = ir->var->clone(linked, NULL); + linked->symbols->add_variable(var->name, var); + linked->ir->push_head(var); + } + + ir->var = var; + } + + return visit_continue; + } + + /** Was function linking successful? */ + bool success; + +private: + /** + * Shader program being linked + * + * This is only used for logging error messages. + */ + gl_shader_program *prog; + + /** List of shaders available for linking. */ + gl_shader **shader_list; + + /** Number of shaders available for linking. */ + unsigned num_shaders; + + /** + * Final linked shader + * + * This is used two ways. It is used to find global variables in the + * linked shader that are accessed by the function. It is also used to add + * global variables from the shader where the function originated. + */ + gl_shader *linked; + + /** + * Table of variables local to the function. + */ + hash_table *locals; +}; + + +/** + * Searches a list of shaders for a particular function definition + */ +ir_function_signature * +find_matching_signature(const char *name, const exec_list *actual_parameters, + gl_shader **shader_list, unsigned num_shaders) +{ + for (unsigned i = 0; i < num_shaders; i++) { + ir_function *const f = shader_list[i]->symbols->get_function(name); + + if (f == NULL) + continue; + + ir_function_signature *sig = f->matching_signature(actual_parameters); + + if ((sig == NULL) || !sig->is_defined) + continue; + + return sig; + } + + return NULL; +} + + +bool +link_function_calls(gl_shader_program *prog, gl_shader *main, + gl_shader **shader_list, unsigned num_shaders) +{ + call_link_visitor v(prog, main, shader_list, num_shaders); + + v.run(main->ir); + return v.success; +} diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp new file mode 100644 index 000000000..4bb4e2a99 --- /dev/null +++ b/mesalib/src/glsl/linker.cpp @@ -0,0 +1,1505 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file linker.cpp + * GLSL linker implementation + * + * Given a set of shaders that are to be linked to generate a final program, + * there are three distinct stages. + * + * In the first stage shaders are partitioned into groups based on the shader + * type. All shaders of a particular type (e.g., vertex shaders) are linked + * together. + * + * - Undefined references in each shader are resolve to definitions in + * another shader. + * - Types and qualifiers of uniforms, outputs, and global variables defined + * in multiple shaders with the same name are verified to be the same. + * - Initializers for uniforms and global variables defined + * in multiple shaders with the same name are verified to be the same. + * + * The result, in the terminology of the GLSL spec, is a set of shader + * executables for each processing unit. + * + * After the first stage is complete, a series of semantic checks are performed + * on each of the shader executables. + * + * - Each shader executable must define a \c main function. + * - Each vertex shader executable must write to \c gl_Position. + * - Each fragment shader executable must write to either \c gl_FragData or + * \c gl_FragColor. + * + * In the final stage individual shader executables are linked to create a + * complete exectuable. + * + * - Types of uniforms defined in multiple shader stages with the same name + * are verified to be the same. + * - Initializers for uniforms defined in multiple shader stages with the + * same name are verified to be the same. + * - Types and qualifiers of outputs defined in one stage are verified to + * be the same as the types and qualifiers of inputs defined with the same + * name in a later stage. + * + * \author Ian Romanick <ian.d.romanick@intel.com> + */ +#include <cstdlib> +#include <cstdio> +#include <cstdarg> +#include <climits> + +extern "C" { +#include <talloc.h> +} + +#include "main/core.h" +#include "glsl_symbol_table.h" +#include "ir.h" +#include "program.h" +#include "program/hash_table.h" +#include "linker.h" +#include "ir_optimization.h" + +/** + * Visitor that determines whether or not a variable is ever written. + */ +class find_assignment_visitor : public ir_hierarchical_visitor { +public: + find_assignment_visitor(const char *name) + : name(name), found(false) + { + /* empty */ + } + + virtual ir_visitor_status visit_enter(ir_assignment *ir) + { + ir_variable *const var = ir->lhs->variable_referenced(); + + if (strcmp(name, var->name) == 0) { + found = true; + return visit_stop; + } + + return visit_continue_with_parent; + } + + virtual ir_visitor_status visit_enter(ir_call *ir) + { + exec_list_iterator sig_iter = ir->get_callee()->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param_rval = (ir_rvalue *)iter.get(); + ir_variable *sig_param = (ir_variable *)sig_iter.get(); + + if (sig_param->mode == ir_var_out || + sig_param->mode == ir_var_inout) { + ir_variable *var = param_rval->variable_referenced(); + if (var && strcmp(name, var->name) == 0) { + found = true; + return visit_stop; + } + } + sig_iter.next(); + } + + return visit_continue_with_parent; + } + + bool variable_found() + { + return found; + } + +private: + const char *name; /**< Find writes to a variable with this name. */ + bool found; /**< Was a write to the variable found? */ +}; + + +/** + * Visitor that determines whether or not a variable is ever read. + */ +class find_deref_visitor : public ir_hierarchical_visitor { +public: + find_deref_visitor(const char *name) + : name(name), found(false) + { + /* empty */ + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + if (strcmp(this->name, ir->var->name) == 0) { + this->found = true; + return visit_stop; + } + + return visit_continue; + } + + bool variable_found() const + { + return this->found; + } + +private: + const char *name; /**< Find writes to a variable with this name. */ + bool found; /**< Was a write to the variable found? */ +}; + + +void +linker_error_printf(gl_shader_program *prog, const char *fmt, ...) +{ + va_list ap; + + prog->InfoLog = talloc_strdup_append(prog->InfoLog, "error: "); + va_start(ap, fmt); + prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, ap); + va_end(ap); +} + + +void +invalidate_variable_locations(gl_shader *sh, enum ir_variable_mode mode, + int generic_base) +{ + foreach_list(node, sh->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != (unsigned) mode)) + continue; + + /* Only assign locations for generic attributes / varyings / etc. + */ + if (var->location >= generic_base) + var->location = -1; + } +} + + +/** + * Determine the number of attribute slots required for a particular type + * + * This code is here because it implements the language rules of a specific + * GLSL version. Since it's a property of the language and not a property of + * types in general, it doesn't really belong in glsl_type. + */ +unsigned +count_attribute_slots(const glsl_type *t) +{ + /* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec: + * + * "A scalar input counts the same amount against this limit as a vec4, + * so applications may want to consider packing groups of four + * unrelated float inputs together into a vector to better utilize the + * capabilities of the underlying hardware. A matrix input will use up + * multiple locations. The number of locations used will equal the + * number of columns in the matrix." + * + * The spec does not explicitly say how arrays are counted. However, it + * should be safe to assume the total number of slots consumed by an array + * is the number of entries in the array multiplied by the number of slots + * consumed by a single element of the array. + */ + + if (t->is_array()) + return t->array_size() * count_attribute_slots(t->element_type()); + + if (t->is_matrix()) + return t->matrix_columns; + + return 1; +} + + +/** + * Verify that a vertex shader executable meets all semantic requirements + * + * \param shader Vertex shader executable to be verified + */ +bool +validate_vertex_shader_executable(struct gl_shader_program *prog, + struct gl_shader *shader) +{ + if (shader == NULL) + return true; + + find_assignment_visitor find("gl_Position"); + find.run(shader->ir); + if (!find.variable_found()) { + linker_error_printf(prog, + "vertex shader does not write to `gl_Position'\n"); + return false; + } + + return true; +} + + +/** + * Verify that a fragment shader executable meets all semantic requirements + * + * \param shader Fragment shader executable to be verified + */ +bool +validate_fragment_shader_executable(struct gl_shader_program *prog, + struct gl_shader *shader) +{ + if (shader == NULL) + return true; + + find_assignment_visitor frag_color("gl_FragColor"); + find_assignment_visitor frag_data("gl_FragData"); + + frag_color.run(shader->ir); + frag_data.run(shader->ir); + + if (frag_color.variable_found() && frag_data.variable_found()) { + linker_error_printf(prog, "fragment shader writes to both " + "`gl_FragColor' and `gl_FragData'\n"); + return false; + } + + return true; +} + + +/** + * Generate a string describing the mode of a variable + */ +static const char * +mode_string(const ir_variable *var) +{ + switch (var->mode) { + case ir_var_auto: + return (var->read_only) ? "global constant" : "global variable"; + + case ir_var_uniform: return "uniform"; + case ir_var_in: return "shader input"; + case ir_var_out: return "shader output"; + case ir_var_inout: return "shader inout"; + + case ir_var_temporary: + default: + assert(!"Should not get here."); + return "invalid variable"; + } +} + + +/** + * Perform validation of global variables used across multiple shaders + */ +bool +cross_validate_globals(struct gl_shader_program *prog, + struct gl_shader **shader_list, + unsigned num_shaders, + bool uniforms_only) +{ + /* Examine all of the uniforms in all of the shaders and cross validate + * them. + */ + glsl_symbol_table variables; + for (unsigned i = 0; i < num_shaders; i++) { + foreach_list(node, shader_list[i]->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if (var == NULL) + continue; + + if (uniforms_only && (var->mode != ir_var_uniform)) + continue; + + /* Don't cross validate temporaries that are at global scope. These + * will eventually get pulled into the shaders 'main'. + */ + if (var->mode == ir_var_temporary) + continue; + + /* If a global with this name has already been seen, verify that the + * new instance has the same type. In addition, if the globals have + * initializers, the values of the initializers must be the same. + */ + ir_variable *const existing = variables.get_variable(var->name); + if (existing != NULL) { + if (var->type != existing->type) { + /* Consider the types to be "the same" if both types are arrays + * of the same type and one of the arrays is implicitly sized. + * In addition, set the type of the linked variable to the + * explicitly sized array. + */ + if (var->type->is_array() + && existing->type->is_array() + && (var->type->fields.array == existing->type->fields.array) + && ((var->type->length == 0) + || (existing->type->length == 0))) { + if (existing->type->length == 0) + existing->type = var->type; + } else { + linker_error_printf(prog, "%s `%s' declared as type " + "`%s' and type `%s'\n", + mode_string(var), + var->name, var->type->name, + existing->type->name); + return false; + } + } + + /* FINISHME: Handle non-constant initializers. + */ + if (var->constant_value != NULL) { + if (existing->constant_value != NULL) { + if (!var->constant_value->has_value(existing->constant_value)) { + linker_error_printf(prog, "initializers for %s " + "`%s' have differing values\n", + mode_string(var), var->name); + return false; + } + } else + /* If the first-seen instance of a particular uniform did not + * have an initializer but a later instance does, copy the + * initializer to the version stored in the symbol table. + */ + /* FINISHME: This is wrong. The constant_value field should + * FINISHME: not be modified! Imagine a case where a shader + * FINISHME: without an initializer is linked in two different + * FINISHME: programs with shaders that have differing + * FINISHME: initializers. Linking with the first will + * FINISHME: modify the shader, and linking with the second + * FINISHME: will fail. + */ + existing->constant_value = + var->constant_value->clone(talloc_parent(existing), NULL); + } + } else + variables.add_variable(var->name, var); + } + } + + return true; +} + + +/** + * Perform validation of uniforms used across multiple shader stages + */ +bool +cross_validate_uniforms(struct gl_shader_program *prog) +{ + return cross_validate_globals(prog, prog->_LinkedShaders, + prog->_NumLinkedShaders, true); +} + + +/** + * Validate that outputs from one stage match inputs of another + */ +bool +cross_validate_outputs_to_inputs(struct gl_shader_program *prog, + gl_shader *producer, gl_shader *consumer) +{ + glsl_symbol_table parameters; + /* FINISHME: Figure these out dynamically. */ + const char *const producer_stage = "vertex"; + const char *const consumer_stage = "fragment"; + + /* Find all shader outputs in the "producer" stage. + */ + foreach_list(node, producer->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + /* FINISHME: For geometry shaders, this should also look for inout + * FINISHME: variables. + */ + if ((var == NULL) || (var->mode != ir_var_out)) + continue; + + parameters.add_variable(var->name, var); + } + + + /* Find all shader inputs in the "consumer" stage. Any variables that have + * matching outputs already in the symbol table must have the same type and + * qualifiers. + */ + foreach_list(node, consumer->ir) { + ir_variable *const input = ((ir_instruction *) node)->as_variable(); + + /* FINISHME: For geometry shaders, this should also look for inout + * FINISHME: variables. + */ + if ((input == NULL) || (input->mode != ir_var_in)) + continue; + + ir_variable *const output = parameters.get_variable(input->name); + if (output != NULL) { + /* Check that the types match between stages. + */ + if (input->type != output->type) { + linker_error_printf(prog, + "%s shader output `%s' declared as " + "type `%s', but %s shader input declared " + "as type `%s'\n", + producer_stage, output->name, + output->type->name, + consumer_stage, input->type->name); + return false; + } + + /* Check that all of the qualifiers match between stages. + */ + if (input->centroid != output->centroid) { + linker_error_printf(prog, + "%s shader output `%s' %s centroid qualifier, " + "but %s shader input %s centroid qualifier\n", + producer_stage, + output->name, + (output->centroid) ? "has" : "lacks", + consumer_stage, + (input->centroid) ? "has" : "lacks"); + return false; + } + + if (input->invariant != output->invariant) { + linker_error_printf(prog, + "%s shader output `%s' %s invariant qualifier, " + "but %s shader input %s invariant qualifier\n", + producer_stage, + output->name, + (output->invariant) ? "has" : "lacks", + consumer_stage, + (input->invariant) ? "has" : "lacks"); + return false; + } + + if (input->interpolation != output->interpolation) { + linker_error_printf(prog, + "%s shader output `%s' specifies %s " + "interpolation qualifier, " + "but %s shader input specifies %s " + "interpolation qualifier\n", + producer_stage, + output->name, + output->interpolation_string(), + consumer_stage, + input->interpolation_string()); + return false; + } + } + } + + return true; +} + + +/** + * Populates a shaders symbol table with all global declarations + */ +static void +populate_symbol_table(gl_shader *sh) +{ + sh->symbols = new(sh) glsl_symbol_table; + + foreach_list(node, sh->ir) { + ir_instruction *const inst = (ir_instruction *) node; + ir_variable *var; + ir_function *func; + + if ((func = inst->as_function()) != NULL) { + sh->symbols->add_function(func->name, func); + } else if ((var = inst->as_variable()) != NULL) { + sh->symbols->add_variable(var->name, var); + } + } +} + + +/** + * Remap variables referenced in an instruction tree + * + * This is used when instruction trees are cloned from one shader and placed in + * another. These trees will contain references to \c ir_variable nodes that + * do not exist in the target shader. This function finds these \c ir_variable + * references and replaces the references with matching variables in the target + * shader. + * + * If there is no matching variable in the target shader, a clone of the + * \c ir_variable is made and added to the target shader. The new variable is + * added to \b both the instruction stream and the symbol table. + * + * \param inst IR tree that is to be processed. + * \param symbols Symbol table containing global scope symbols in the + * linked shader. + * \param instructions Instruction stream where new variable declarations + * should be added. + */ +void +remap_variables(ir_instruction *inst, struct gl_shader *target, + hash_table *temps) +{ + class remap_visitor : public ir_hierarchical_visitor { + public: + remap_visitor(struct gl_shader *target, + hash_table *temps) + { + this->target = target; + this->symbols = target->symbols; + this->instructions = target->ir; + this->temps = temps; + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + if (ir->var->mode == ir_var_temporary) { + ir_variable *var = (ir_variable *) hash_table_find(temps, ir->var); + + assert(var != NULL); + ir->var = var; + return visit_continue; + } + + ir_variable *const existing = + this->symbols->get_variable(ir->var->name); + if (existing != NULL) + ir->var = existing; + else { + ir_variable *copy = ir->var->clone(this->target, NULL); + + this->symbols->add_variable(copy->name, copy); + this->instructions->push_head(copy); + ir->var = copy; + } + + return visit_continue; + } + + private: + struct gl_shader *target; + glsl_symbol_table *symbols; + exec_list *instructions; + hash_table *temps; + }; + + remap_visitor v(target, temps); + + inst->accept(&v); +} + + +/** + * Move non-declarations from one instruction stream to another + * + * The intended usage pattern of this function is to pass the pointer to the + * head sentinel of a list (i.e., a pointer to the list cast to an \c exec_node + * pointer) for \c last and \c false for \c make_copies on the first + * call. Successive calls pass the return value of the previous call for + * \c last and \c true for \c make_copies. + * + * \param instructions Source instruction stream + * \param last Instruction after which new instructions should be + * inserted in the target instruction stream + * \param make_copies Flag selecting whether instructions in \c instructions + * should be copied (via \c ir_instruction::clone) into the + * target list or moved. + * + * \return + * The new "last" instruction in the target instruction stream. This pointer + * is suitable for use as the \c last parameter of a later call to this + * function. + */ +exec_node * +move_non_declarations(exec_list *instructions, exec_node *last, + bool make_copies, gl_shader *target) +{ + hash_table *temps = NULL; + + if (make_copies) + temps = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); + + foreach_list_safe(node, instructions) { + ir_instruction *inst = (ir_instruction *) node; + + if (inst->as_function()) + continue; + + ir_variable *var = inst->as_variable(); + if ((var != NULL) && (var->mode != ir_var_temporary)) + continue; + + assert(inst->as_assignment() + || ((var != NULL) && (var->mode == ir_var_temporary))); + + if (make_copies) { + inst = inst->clone(target, NULL); + + if (var != NULL) + hash_table_insert(temps, inst, var); + else + remap_variables(inst, target, temps); + } else { + inst->remove(); + } + + last->insert_after(inst); + last = inst; + } + + if (make_copies) + hash_table_dtor(temps); + + return last; +} + +/** + * Get the function signature for main from a shader + */ +static ir_function_signature * +get_main_function_signature(gl_shader *sh) +{ + ir_function *const f = sh->symbols->get_function("main"); + if (f != NULL) { + exec_list void_parameters; + + /* Look for the 'void main()' signature and ensure that it's defined. + * This keeps the linker from accidentally pick a shader that just + * contains a prototype for main. + * + * We don't have to check for multiple definitions of main (in multiple + * shaders) because that would have already been caught above. + */ + ir_function_signature *sig = f->matching_signature(&void_parameters); + if ((sig != NULL) && sig->is_defined) { + return sig; + } + } + + return NULL; +} + + +/** + * Combine a group of shaders for a single stage to generate a linked shader + * + * \note + * If this function is supplied a single shader, it is cloned, and the new + * shader is returned. + */ +static struct gl_shader * +link_intrastage_shaders(GLcontext *ctx, + struct gl_shader_program *prog, + struct gl_shader **shader_list, + unsigned num_shaders) +{ + /* Check that global variables defined in multiple shaders are consistent. + */ + if (!cross_validate_globals(prog, shader_list, num_shaders, false)) + return NULL; + + /* Check that there is only a single definition of each function signature + * across all shaders. + */ + for (unsigned i = 0; i < (num_shaders - 1); i++) { + foreach_list(node, shader_list[i]->ir) { + ir_function *const f = ((ir_instruction *) node)->as_function(); + + if (f == NULL) + continue; + + for (unsigned j = i + 1; j < num_shaders; j++) { + ir_function *const other = + shader_list[j]->symbols->get_function(f->name); + + /* If the other shader has no function (and therefore no function + * signatures) with the same name, skip to the next shader. + */ + if (other == NULL) + continue; + + foreach_iter (exec_list_iterator, iter, *f) { + ir_function_signature *sig = + (ir_function_signature *) iter.get(); + + if (!sig->is_defined || sig->is_builtin) + continue; + + ir_function_signature *other_sig = + other->exact_matching_signature(& sig->parameters); + + if ((other_sig != NULL) && other_sig->is_defined + && !other_sig->is_builtin) { + linker_error_printf(prog, + "function `%s' is multiply defined", + f->name); + return NULL; + } + } + } + } + } + + /* Find the shader that defines main, and make a clone of it. + * + * Starting with the clone, search for undefined references. If one is + * found, find the shader that defines it. Clone the reference and add + * it to the shader. Repeat until there are no undefined references or + * until a reference cannot be resolved. + */ + gl_shader *main = NULL; + for (unsigned i = 0; i < num_shaders; i++) { + if (get_main_function_signature(shader_list[i]) != NULL) { + main = shader_list[i]; + break; + } + } + + if (main == NULL) { + linker_error_printf(prog, "%s shader lacks `main'\n", + (shader_list[0]->Type == GL_VERTEX_SHADER) + ? "vertex" : "fragment"); + return NULL; + } + + gl_shader *const linked = ctx->Driver.NewShader(NULL, 0, main->Type); + linked->ir = new(linked) exec_list; + clone_ir_list(linked, linked->ir, main->ir); + + populate_symbol_table(linked); + + /* The a pointer to the main function in the final linked shader (i.e., the + * copy of the original shader that contained the main function). + */ + ir_function_signature *const main_sig = get_main_function_signature(linked); + + /* Move any instructions other than variable declarations or function + * declarations into main. + */ + exec_node *insertion_point = + move_non_declarations(linked->ir, (exec_node *) &main_sig->body, false, + linked); + + for (unsigned i = 0; i < num_shaders; i++) { + if (shader_list[i] == main) + continue; + + insertion_point = move_non_declarations(shader_list[i]->ir, + insertion_point, true, linked); + } + + /* Resolve initializers for global variables in the linked shader. + */ + unsigned num_linking_shaders = num_shaders; + for (unsigned i = 0; i < num_shaders; i++) + num_linking_shaders += shader_list[i]->num_builtins_to_link; + + gl_shader **linking_shaders = + (gl_shader **) calloc(num_linking_shaders, sizeof(gl_shader *)); + + memcpy(linking_shaders, shader_list, + sizeof(linking_shaders[0]) * num_shaders); + + unsigned idx = num_shaders; + for (unsigned i = 0; i < num_shaders; i++) { + memcpy(&linking_shaders[idx], shader_list[i]->builtins_to_link, + sizeof(linking_shaders[0]) * shader_list[i]->num_builtins_to_link); + idx += shader_list[i]->num_builtins_to_link; + } + + assert(idx == num_linking_shaders); + + link_function_calls(prog, linked, linking_shaders, num_linking_shaders); + + free(linking_shaders); + + return linked; +} + + +struct uniform_node { + exec_node link; + struct gl_uniform *u; + unsigned slots; +}; + +/** + * Update the sizes of linked shader uniform arrays to the maximum + * array index used. + * + * From page 81 (page 95 of the PDF) of the OpenGL 2.1 spec: + * + * If one or more elements of an array are active, + * GetActiveUniform will return the name of the array in name, + * subject to the restrictions listed above. The type of the array + * is returned in type. The size parameter contains the highest + * array element index used, plus one. The compiler or linker + * determines the highest index used. There will be only one + * active uniform reported by the GL per uniform array. + + */ +static void +update_array_sizes(struct gl_shader_program *prog) +{ + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + foreach_list(node, prog->_LinkedShaders[i]->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_uniform && + var->mode != ir_var_in && + var->mode != ir_var_out) || + !var->type->is_array()) + continue; + + unsigned int size = var->max_array_access; + for (unsigned j = 0; j < prog->_NumLinkedShaders; j++) { + foreach_list(node2, prog->_LinkedShaders[j]->ir) { + ir_variable *other_var = ((ir_instruction *) node2)->as_variable(); + if (!other_var) + continue; + + if (strcmp(var->name, other_var->name) == 0 && + other_var->max_array_access > size) { + size = other_var->max_array_access; + } + } + } + + if (size + 1 != var->type->fields.array->length) { + var->type = glsl_type::get_array_instance(var->type->fields.array, + size + 1); + /* FINISHME: We should update the types of array + * dereferences of this variable now. + */ + } + } + } +} + +static void +add_uniform(void *mem_ctx, exec_list *uniforms, struct hash_table *ht, + const char *name, const glsl_type *type, GLenum shader_type, + unsigned *next_shader_pos, unsigned *total_uniforms) +{ + if (type->is_record()) { + for (unsigned int i = 0; i < type->length; i++) { + const glsl_type *field_type = type->fields.structure[i].type; + char *field_name = talloc_asprintf(mem_ctx, "%s.%s", name, + type->fields.structure[i].name); + + add_uniform(mem_ctx, uniforms, ht, field_name, field_type, + shader_type, next_shader_pos, total_uniforms); + } + } else { + uniform_node *n = (uniform_node *) hash_table_find(ht, name); + unsigned int vec4_slots; + const glsl_type *array_elem_type = NULL; + + if (type->is_array()) { + array_elem_type = type->fields.array; + /* Array of structures. */ + if (array_elem_type->is_record()) { + for (unsigned int i = 0; i < type->length; i++) { + char *elem_name = talloc_asprintf(mem_ctx, "%s[%d]", name, i); + add_uniform(mem_ctx, uniforms, ht, elem_name, array_elem_type, + shader_type, next_shader_pos, total_uniforms); + } + return; + } + } + + /* Fix the storage size of samplers at 1 vec4 each. Be sure to pad out + * vectors to vec4 slots. + */ + if (type->is_array()) { + if (array_elem_type->is_sampler()) + vec4_slots = type->length; + else + vec4_slots = type->length * array_elem_type->matrix_columns; + } else if (type->is_sampler()) { + vec4_slots = 1; + } else { + vec4_slots = type->matrix_columns; + } + + if (n == NULL) { + n = (uniform_node *) calloc(1, sizeof(struct uniform_node)); + n->u = (gl_uniform *) calloc(1, sizeof(struct gl_uniform)); + n->slots = vec4_slots; + + n->u->Name = strdup(name); + n->u->Type = type; + n->u->VertPos = -1; + n->u->FragPos = -1; + n->u->GeomPos = -1; + (*total_uniforms)++; + + hash_table_insert(ht, n, name); + uniforms->push_tail(& n->link); + } + + switch (shader_type) { + case GL_VERTEX_SHADER: + n->u->VertPos = *next_shader_pos; + break; + case GL_FRAGMENT_SHADER: + n->u->FragPos = *next_shader_pos; + break; + case GL_GEOMETRY_SHADER: + n->u->GeomPos = *next_shader_pos; + break; + } + + (*next_shader_pos) += vec4_slots; + } +} + +void +assign_uniform_locations(struct gl_shader_program *prog) +{ + /* */ + exec_list uniforms; + unsigned total_uniforms = 0; + hash_table *ht = hash_table_ctor(32, hash_table_string_hash, + hash_table_string_compare); + void *mem_ctx = talloc_new(NULL); + + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + unsigned next_position = 0; + + foreach_list(node, prog->_LinkedShaders[i]->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_uniform)) + continue; + + if (strncmp(var->name, "gl_", 3) == 0) { + /* At the moment, we don't allocate uniform locations for + * builtin uniforms. It's permitted by spec, and we'll + * likely switch to doing that at some point, but not yet. + */ + continue; + } + + var->location = next_position; + add_uniform(mem_ctx, &uniforms, ht, var->name, var->type, + prog->_LinkedShaders[i]->Type, + &next_position, &total_uniforms); + } + } + + talloc_free(mem_ctx); + + gl_uniform_list *ul = (gl_uniform_list *) + calloc(1, sizeof(gl_uniform_list)); + + ul->Size = total_uniforms; + ul->NumUniforms = total_uniforms; + ul->Uniforms = (gl_uniform *) calloc(total_uniforms, sizeof(gl_uniform)); + + unsigned idx = 0; + uniform_node *next; + for (uniform_node *node = (uniform_node *) uniforms.head + ; node->link.next != NULL + ; node = next) { + next = (uniform_node *) node->link.next; + + node->link.remove(); + memcpy(&ul->Uniforms[idx], node->u, sizeof(gl_uniform)); + idx++; + + free(node->u); + free(node); + } + + hash_table_dtor(ht); + + prog->Uniforms = ul; +} + + +/** + * Find a contiguous set of available bits in a bitmask + * + * \param used_mask Bits representing used (1) and unused (0) locations + * \param needed_count Number of contiguous bits needed. + * + * \return + * Base location of the available bits on success or -1 on failure. + */ +int +find_available_slots(unsigned used_mask, unsigned needed_count) +{ + unsigned needed_mask = (1 << needed_count) - 1; + const int max_bit_to_test = (8 * sizeof(used_mask)) - needed_count; + + /* The comparison to 32 is redundant, but without it GCC emits "warning: + * cannot optimize possibly infinite loops" for the loop below. + */ + if ((needed_count == 0) || (max_bit_to_test < 0) || (max_bit_to_test > 32)) + return -1; + + for (int i = 0; i <= max_bit_to_test; i++) { + if ((needed_mask & ~used_mask) == needed_mask) + return i; + + needed_mask <<= 1; + } + + return -1; +} + + +bool +assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index) +{ + /* Mark invalid attribute locations as being used. + */ + unsigned used_locations = (max_attribute_index >= 32) + ? ~0 : ~((1 << max_attribute_index) - 1); + + gl_shader *const sh = prog->_LinkedShaders[0]; + assert(sh->Type == GL_VERTEX_SHADER); + + /* Operate in a total of four passes. + * + * 1. Invalidate the location assignments for all vertex shader inputs. + * + * 2. Assign locations for inputs that have user-defined (via + * glBindVertexAttribLocation) locatoins. + * + * 3. Sort the attributes without assigned locations by number of slots + * required in decreasing order. Fragmentation caused by attribute + * locations assigned by the application may prevent large attributes + * from having enough contiguous space. + * + * 4. Assign locations to any inputs without assigned locations. + */ + + invalidate_variable_locations(sh, ir_var_in, VERT_ATTRIB_GENERIC0); + + if (prog->Attributes != NULL) { + for (unsigned i = 0; i < prog->Attributes->NumParameters; i++) { + ir_variable *const var = + sh->symbols->get_variable(prog->Attributes->Parameters[i].Name); + + /* Note: attributes that occupy multiple slots, such as arrays or + * matrices, may appear in the attrib array multiple times. + */ + if ((var == NULL) || (var->location != -1)) + continue; + + /* From page 61 of the OpenGL 4.0 spec: + * + * "LinkProgram will fail if the attribute bindings assigned by + * BindAttribLocation do not leave not enough space to assign a + * location for an active matrix attribute or an active attribute + * array, both of which require multiple contiguous generic + * attributes." + * + * Previous versions of the spec contain similar language but omit the + * bit about attribute arrays. + * + * Page 61 of the OpenGL 4.0 spec also says: + * + * "It is possible for an application to bind more than one + * attribute name to the same location. This is referred to as + * aliasing. This will only work if only one of the aliased + * attributes is active in the executable program, or if no path + * through the shader consumes more than one attribute of a set + * of attributes aliased to the same location. A link error can + * occur if the linker determines that every path through the + * shader consumes multiple aliased attributes, but + * implementations are not required to generate an error in this + * case." + * + * These two paragraphs are either somewhat contradictory, or I don't + * fully understand one or both of them. + */ + /* FINISHME: The code as currently written does not support attribute + * FINISHME: location aliasing (see comment above). + */ + const int attr = prog->Attributes->Parameters[i].StateIndexes[0]; + const unsigned slots = count_attribute_slots(var->type); + + /* Mask representing the contiguous slots that will be used by this + * attribute. + */ + const unsigned use_mask = (1 << slots) - 1; + + /* Generate a link error if the set of bits requested for this + * attribute overlaps any previously allocated bits. + */ + if ((~(use_mask << attr) & used_locations) != used_locations) { + linker_error_printf(prog, + "insufficient contiguous attribute locations " + "available for vertex shader input `%s'", + var->name); + return false; + } + + var->location = VERT_ATTRIB_GENERIC0 + attr; + used_locations |= (use_mask << attr); + } + } + + /* Temporary storage for the set of attributes that need locations assigned. + */ + struct temp_attr { + unsigned slots; + ir_variable *var; + + /* Used below in the call to qsort. */ + static int compare(const void *a, const void *b) + { + const temp_attr *const l = (const temp_attr *) a; + const temp_attr *const r = (const temp_attr *) b; + + /* Reversed because we want a descending order sort below. */ + return r->slots - l->slots; + } + } to_assign[16]; + + unsigned num_attr = 0; + + foreach_list(node, sh->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_in)) + continue; + + /* The location was explicitly assigned, nothing to do here. + */ + if (var->location != -1) + continue; + + to_assign[num_attr].slots = count_attribute_slots(var->type); + to_assign[num_attr].var = var; + num_attr++; + } + + /* If all of the attributes were assigned locations by the application (or + * are built-in attributes with fixed locations), return early. This should + * be the common case. + */ + if (num_attr == 0) + return true; + + qsort(to_assign, num_attr, sizeof(to_assign[0]), temp_attr::compare); + + /* VERT_ATTRIB_GENERIC0 is a psdueo-alias for VERT_ATTRIB_POS. It can only + * be explicitly assigned by via glBindAttribLocation. Mark it as reserved + * to prevent it from being automatically allocated below. + */ + find_deref_visitor find("gl_Vertex"); + find.run(sh->ir); + if (find.variable_found()) + used_locations |= (1 << 0); + + for (unsigned i = 0; i < num_attr; i++) { + /* Mask representing the contiguous slots that will be used by this + * attribute. + */ + const unsigned use_mask = (1 << to_assign[i].slots) - 1; + + int location = find_available_slots(used_locations, to_assign[i].slots); + + if (location < 0) { + linker_error_printf(prog, + "insufficient contiguous attribute locations " + "available for vertex shader input `%s'", + to_assign[i].var->name); + return false; + } + + to_assign[i].var->location = VERT_ATTRIB_GENERIC0 + location; + used_locations |= (use_mask << location); + } + + return true; +} + + +/** + * Demote shader outputs that are not read to being just plain global variables + */ +void +demote_unread_shader_outputs(gl_shader *sh) +{ + foreach_list(node, sh->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_out)) + continue; + + /* An 'out' variable is only really a shader output if its value is read + * by the following stage. + */ + if (var->location == -1) { + var->mode = ir_var_auto; + } + } +} + + +void +assign_varying_locations(struct gl_shader_program *prog, + gl_shader *producer, gl_shader *consumer) +{ + /* FINISHME: Set dynamically when geometry shader support is added. */ + unsigned output_index = VERT_RESULT_VAR0; + unsigned input_index = FRAG_ATTRIB_VAR0; + + /* Operate in a total of three passes. + * + * 1. Assign locations for any matching inputs and outputs. + * + * 2. Mark output variables in the producer that do not have locations as + * not being outputs. This lets the optimizer eliminate them. + * + * 3. Mark input variables in the consumer that do not have locations as + * not being inputs. This lets the optimizer eliminate them. + */ + + invalidate_variable_locations(producer, ir_var_out, VERT_RESULT_VAR0); + invalidate_variable_locations(consumer, ir_var_in, FRAG_ATTRIB_VAR0); + + foreach_list(node, producer->ir) { + ir_variable *const output_var = ((ir_instruction *) node)->as_variable(); + + if ((output_var == NULL) || (output_var->mode != ir_var_out) + || (output_var->location != -1)) + continue; + + ir_variable *const input_var = + consumer->symbols->get_variable(output_var->name); + + if ((input_var == NULL) || (input_var->mode != ir_var_in)) + continue; + + assert(input_var->location == -1); + + output_var->location = output_index; + input_var->location = input_index; + + /* FINISHME: Support for "varying" records in GLSL 1.50. */ + assert(!output_var->type->is_record()); + + if (output_var->type->is_array()) { + const unsigned slots = output_var->type->length + * output_var->type->fields.array->matrix_columns; + + output_index += slots; + input_index += slots; + } else { + const unsigned slots = output_var->type->matrix_columns; + + output_index += slots; + input_index += slots; + } + } + + demote_unread_shader_outputs(producer); + + foreach_list(node, consumer->ir) { + ir_variable *const var = ((ir_instruction *) node)->as_variable(); + + if ((var == NULL) || (var->mode != ir_var_in)) + continue; + + if (var->location == -1) { + if (prog->Version <= 120) { + /* On page 25 (page 31 of the PDF) of the GLSL 1.20 spec: + * + * Only those varying variables used (i.e. read) in + * the fragment shader executable must be written to + * by the vertex shader executable; declaring + * superfluous varying variables in a vertex shader is + * permissible. + * + * We interpret this text as meaning that the VS must + * write the variable for the FS to read it. See + * "glsl1-varying read but not written" in piglit. + */ + + linker_error_printf(prog, "fragment shader varying %s not written " + "by vertex shader\n.", var->name); + prog->LinkStatus = false; + } + + /* An 'in' variable is only really a shader input if its + * value is written by the previous stage. + */ + var->mode = ir_var_auto; + } + } +} + + +void +link_shaders(GLcontext *ctx, struct gl_shader_program *prog) +{ + prog->LinkStatus = false; + prog->Validated = false; + prog->_Used = false; + + if (prog->InfoLog != NULL) + talloc_free(prog->InfoLog); + + prog->InfoLog = talloc_strdup(NULL, ""); + + /* Separate the shaders into groups based on their type. + */ + struct gl_shader **vert_shader_list; + unsigned num_vert_shaders = 0; + struct gl_shader **frag_shader_list; + unsigned num_frag_shaders = 0; + + vert_shader_list = (struct gl_shader **) + calloc(2 * prog->NumShaders, sizeof(struct gl_shader *)); + frag_shader_list = &vert_shader_list[prog->NumShaders]; + + unsigned min_version = UINT_MAX; + unsigned max_version = 0; + for (unsigned i = 0; i < prog->NumShaders; i++) { + min_version = MIN2(min_version, prog->Shaders[i]->Version); + max_version = MAX2(max_version, prog->Shaders[i]->Version); + + switch (prog->Shaders[i]->Type) { + case GL_VERTEX_SHADER: + vert_shader_list[num_vert_shaders] = prog->Shaders[i]; + num_vert_shaders++; + break; + case GL_FRAGMENT_SHADER: + frag_shader_list[num_frag_shaders] = prog->Shaders[i]; + num_frag_shaders++; + break; + case GL_GEOMETRY_SHADER: + /* FINISHME: Support geometry shaders. */ + assert(prog->Shaders[i]->Type != GL_GEOMETRY_SHADER); + break; + } + } + + /* Previous to GLSL version 1.30, different compilation units could mix and + * match shading language versions. With GLSL 1.30 and later, the versions + * of all shaders must match. + */ + assert(min_version >= 100); + assert(max_version <= 130); + if ((max_version >= 130 || min_version == 100) + && min_version != max_version) { + linker_error_printf(prog, "all shaders must use same shading " + "language version\n"); + goto done; + } + + prog->Version = max_version; + + for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) { + ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]); + } + + /* Link all shaders for a particular stage and validate the result. + */ + prog->_NumLinkedShaders = 0; + if (num_vert_shaders > 0) { + gl_shader *const sh = + link_intrastage_shaders(ctx, prog, vert_shader_list, num_vert_shaders); + + if (sh == NULL) + goto done; + + if (!validate_vertex_shader_executable(prog, sh)) + goto done; + + prog->_LinkedShaders[prog->_NumLinkedShaders] = sh; + prog->_NumLinkedShaders++; + } + + if (num_frag_shaders > 0) { + gl_shader *const sh = + link_intrastage_shaders(ctx, prog, frag_shader_list, num_frag_shaders); + + if (sh == NULL) + goto done; + + if (!validate_fragment_shader_executable(prog, sh)) + goto done; + + prog->_LinkedShaders[prog->_NumLinkedShaders] = sh; + prog->_NumLinkedShaders++; + } + + /* Here begins the inter-stage linking phase. Some initial validation is + * performed, then locations are assigned for uniforms, attributes, and + * varyings. + */ + if (cross_validate_uniforms(prog)) { + /* Validate the inputs of each stage with the output of the preceeding + * stage. + */ + for (unsigned i = 1; i < prog->_NumLinkedShaders; i++) { + if (!cross_validate_outputs_to_inputs(prog, + prog->_LinkedShaders[i - 1], + prog->_LinkedShaders[i])) + goto done; + } + + prog->LinkStatus = true; + } + + /* Do common optimization before assigning storage for attributes, + * uniforms, and varyings. Later optimization could possibly make + * some of that unused. + */ + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, 32)) + ; + } + + update_array_sizes(prog); + + assign_uniform_locations(prog); + + if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) { + /* FINISHME: The value of the max_attribute_index parameter is + * FINISHME: implementation dependent based on the value of + * FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be + * FINISHME: at least 16, so hardcode 16 for now. + */ + if (!assign_attribute_locations(prog, 16)) + goto done; + + if (prog->_NumLinkedShaders == 1) + demote_unread_shader_outputs(prog->_LinkedShaders[0]); + } + + for (unsigned i = 1; i < prog->_NumLinkedShaders; i++) + assign_varying_locations(prog, + prog->_LinkedShaders[i - 1], + prog->_LinkedShaders[i]); + + /* FINISHME: Assign fragment shader output locations. */ + +done: + free(vert_shader_list); +} diff --git a/mesalib/src/glsl/linker.h b/mesalib/src/glsl/linker.h new file mode 100644 index 000000000..a8ce16a7e --- /dev/null +++ b/mesalib/src/glsl/linker.h @@ -0,0 +1,35 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef GLSL_LINKER_H +#define GLSL_LINKER_H + +extern void +linker_error_printf(gl_shader_program *prog, const char *fmt, ...); + +extern bool +link_function_calls(gl_shader_program *prog, gl_shader *main, + gl_shader **shader_list, unsigned num_shaders); + +#endif /* GLSL_LINKER_H */ diff --git a/mesalib/src/glsl/list.h b/mesalib/src/glsl/list.h new file mode 100644 index 000000000..9c39855ad --- /dev/null +++ b/mesalib/src/glsl/list.h @@ -0,0 +1,513 @@ +/* + * Copyright © 2008, 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file list.h + * \brief Doubly-linked list abstract container type. + * + * Each doubly-linked list has a sentinel head and tail node. These nodes + * contain no data. The head sentinel can be identified by its \c prev + * pointer being \c NULL. The tail sentinel can be identified by its + * \c next pointer being \c NULL. + * + * A list is empty if either the head sentinel's \c next pointer points to the + * tail sentinel or the tail sentinel's \c prev poiner points to the head + * sentinel. + * + * Instead of tracking two separate \c node structures and a \c list structure + * that points to them, the sentinel nodes are in a single structure. Noting + * that each sentinel node always has one \c NULL pointer, the \c NULL + * pointers occupy the same memory location. In the \c list structure + * contains a the following: + * + * - A \c head pointer that represents the \c next pointer of the + * head sentinel node. + * - A \c tail pointer that represents the \c prev pointer of the head + * sentinel node and the \c next pointer of the tail sentinel node. This + * pointer is \b always \c NULL. + * - A \c tail_prev pointer that represents the \c prev pointer of the + * tail sentinel node. + * + * Therefore, if \c head->next is \c NULL or \c tail_prev->prev is \c NULL, + * the list is empty. + * + * To anyone familiar with "exec lists" on the Amiga, this structure should + * be immediately recognizable. See the following link for the original Amiga + * operating system documentation on the subject. + * + * http://www.natami.net/dev/Libraries_Manual_guide/node02D7.html + * + * \author Ian Romanick <ian.d.romanick@intel.com> + */ + +#pragma once +#ifndef LIST_CONTAINER_H +#define LIST_CONTAINER_H + +#ifndef __cplusplus +#include <stddef.h> +#include <talloc.h> +#else +extern "C" { +#include <talloc.h> +} +#endif + +#include <assert.h> + +struct exec_node { + struct exec_node *next; + struct exec_node *prev; + +#ifdef __cplusplus + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *node; + + node = talloc_size(ctx, size); + assert(node != NULL); + + return node; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *node, void *ctx) + { + talloc_free(node); + } + static void operator delete(void *node) + { + talloc_free(node); + } + + exec_node() : next(NULL), prev(NULL) + { + /* empty */ + } + + const exec_node *get_next() const + { + return next; + } + + exec_node *get_next() + { + return next; + } + + const exec_node *get_prev() const + { + return prev; + } + + exec_node *get_prev() + { + return prev; + } + + void remove() + { + next->prev = prev; + prev->next = next; + next = NULL; + prev = NULL; + } + + /** + * Link a node with itself + * + * This creates a sort of degenerate list that is occasionally useful. + */ + void self_link() + { + next = this; + prev = this; + } + + /** + * Insert a node in the list after the current node + */ + void insert_after(exec_node *after) + { + after->next = this->next; + after->prev = this; + + this->next->prev = after; + this->next = after; + } + /** + * Insert a node in the list before the current node + */ + void insert_before(exec_node *before) + { + before->next = this; + before->prev = this->prev; + + this->prev->next = before; + this->prev = before; + } + + /** + * Insert another list in the list before the current node + */ + void insert_before(struct exec_list *before); + + /** + * Replace the current node with the given node. + */ + void replace_with(exec_node *replacement) + { + replacement->prev = this->prev; + replacement->next = this->next; + + this->prev->next = replacement; + this->next->prev = replacement; + } + + /** + * Is this the sentinel at the tail of the list? + */ + bool is_tail_sentinel() const + { + return this->next == NULL; + } + + /** + * Is this the sentinel at the head of the list? + */ + bool is_head_sentinel() const + { + return this->prev == NULL; + } +#endif +}; + + +#ifdef __cplusplus +/* This macro will not work correctly if `t' uses virtual inheritance. If you + * are using virtual inheritance, you deserve a slow and painful death. Enjoy! + */ +#define exec_list_offsetof(t, f, p) \ + (((char *) &((t *) p)->f) - ((char *) p)) +#else +#define exec_list_offsetof(t, f, p) offsetof(t, f) +#endif + +/** + * Get a pointer to the structure containing an exec_node + * + * Given a pointer to an \c exec_node embedded in a structure, get a pointer to + * the containing structure. + * + * \param type Base type of the structure containing the node + * \param node Pointer to the \c exec_node + * \param field Name of the field in \c type that is the embedded \c exec_node + */ +#define exec_node_data(type, node, field) \ + ((type *) (((char *) node) - exec_list_offsetof(type, field, node))) + +#ifdef __cplusplus +struct exec_node; + +class iterator { +public: + void next() + { + } + + void *get() + { + return NULL; + } + + bool has_next() const + { + return false; + } +}; + +class exec_list_iterator : public iterator { +public: + exec_list_iterator(exec_node *n) : node(n), _next(n->next) + { + /* empty */ + } + + void next() + { + node = _next; + _next = node->next; + } + + void remove() + { + node->remove(); + } + + exec_node *get() + { + return node; + } + + bool has_next() const + { + return _next != NULL; + } + +private: + exec_node *node; + exec_node *_next; +}; + +#define foreach_iter(iter_type, iter, container) \ + for (iter_type iter = (container) . iterator(); iter.has_next(); iter.next()) +#endif + + +struct exec_list { + struct exec_node *head; + struct exec_node *tail; + struct exec_node *tail_pred; + +#ifdef __cplusplus + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *node; + + node = talloc_size(ctx, size); + assert(node != NULL); + + return node; + } + + /* If the user *does* call delete, that's OK, we will just + * talloc_free in that case. */ + static void operator delete(void *node, void *ctx) + { + talloc_free(node); + } + static void operator delete(void *node) + { + talloc_free(node); + } + + exec_list() + { + make_empty(); + } + + void make_empty() + { + head = (exec_node *) & tail; + tail = NULL; + tail_pred = (exec_node *) & head; + } + + bool is_empty() const + { + /* There are three ways to test whether a list is empty or not. + * + * - Check to see if the \c head points to the \c tail. + * - Check to see if the \c tail_pred points to the \c head. + * - Check to see if the \c head is the sentinel node by test whether its + * \c next pointer is \c NULL. + * + * The first two methods tend to generate better code on modern systems + * because they save a pointer dereference. + */ + return head == (exec_node *) &tail; + } + + const exec_node *get_head() const + { + return !is_empty() ? head : NULL; + } + + exec_node *get_head() + { + return !is_empty() ? head : NULL; + } + + const exec_node *get_tail() const + { + return !is_empty() ? tail_pred : NULL; + } + + exec_node *get_tail() + { + return !is_empty() ? tail_pred : NULL; + } + + void push_head(exec_node *n) + { + n->next = head; + n->prev = (exec_node *) &head; + + n->next->prev = n; + head = n; + } + + void push_tail(exec_node *n) + { + n->next = (exec_node *) &tail; + n->prev = tail_pred; + + n->prev->next = n; + tail_pred = n; + } + + void push_degenerate_list_at_head(exec_node *n) + { + assert(n->prev->next == n); + + n->prev->next = head; + head->prev = n->prev; + n->prev = (exec_node *) &head; + head = n; + } + + /** + * Remove the first node from a list and return it + * + * \return + * The first node in the list or \c NULL if the list is empty. + * + * \sa exec_list::get_head + */ + exec_node *pop_head() + { + exec_node *const n = this->get_head(); + if (n != NULL) + n->remove(); + + return n; + } + + /** + * Move all of the nodes from this list to the target list + */ + void move_nodes_to(exec_list *target) + { + if (is_empty()) { + target->make_empty(); + } else { + target->head = head; + target->tail = NULL; + target->tail_pred = tail_pred; + + target->head->prev = (exec_node *) &target->head; + target->tail_pred->next = (exec_node *) &target->tail; + + make_empty(); + } + } + + /** + * Append all nodes from the source list to the target list + */ + void + append_list(exec_list *source) + { + if (source->is_empty()) + return; + + /* Link the first node of the source with the last node of the target list. + */ + this->tail_pred->next = source->head; + source->head->prev = this->tail_pred; + + /* Make the tail of the source list be the tail of the target list. + */ + this->tail_pred = source->tail_pred; + this->tail_pred->next = (exec_node *) &this->tail; + + /* Make the source list empty for good measure. + */ + source->make_empty(); + } + + exec_list_iterator iterator() + { + return exec_list_iterator(head); + } + + exec_list_iterator iterator() const + { + return exec_list_iterator((exec_node *) head); + } +#endif +}; + + +#ifdef __cplusplus +inline void exec_node::insert_before(exec_list *before) +{ + if (before->is_empty()) + return; + + before->tail_pred->next = this; + before->head->prev = this->prev; + + this->prev->next = before->head; + this->prev = before->tail_pred; + + before->make_empty(); +} +#endif + +/** + * This version is safe even if the current node is removed. + */ +#define foreach_list_safe(__node, __list) \ + for (exec_node * __node = (__list)->head, * __next = __node->next \ + ; __next != NULL \ + ; __node = __next, __next = __next->next) + +#define foreach_list(__node, __list) \ + for (exec_node * __node = (__list)->head \ + ; (__node)->next != NULL \ + ; (__node) = (__node)->next) + +#define foreach_list_const(__node, __list) \ + for (const exec_node * __node = (__list)->head \ + ; (__node)->next != NULL \ + ; (__node) = (__node)->next) + +#define foreach_list_typed(__type, __node, __field, __list) \ + for (__type * __node = \ + exec_node_data(__type, (__list)->head, __field); \ + (__node)->__field.next != NULL; \ + (__node) = exec_node_data(__type, (__node)->__field.next, __field)) + +#define foreach_list_typed_const(__type, __node, __field, __list) \ + for (const __type * __node = \ + exec_node_data(__type, (__list)->head, __field); \ + (__node)->__field.next != NULL; \ + (__node) = exec_node_data(__type, (__node)->__field.next, __field)) + +#endif /* LIST_CONTAINER_H */ diff --git a/mesalib/src/glsl/loop_analysis.cpp b/mesalib/src/glsl/loop_analysis.cpp new file mode 100644 index 000000000..91e34da0e --- /dev/null +++ b/mesalib/src/glsl/loop_analysis.cpp @@ -0,0 +1,496 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glsl_types.h" +#include "loop_analysis.h" +#include "ir_hierarchical_visitor.h" + +static bool is_loop_terminator(ir_if *ir); + +static bool all_expression_operands_are_loop_constant(ir_rvalue *, + hash_table *); + +static ir_rvalue *get_basic_induction_increment(ir_assignment *, hash_table *); + + +loop_state::loop_state() +{ + this->ht = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); + this->mem_ctx = talloc_init("loop state"); +} + + +loop_state::~loop_state() +{ + hash_table_dtor(this->ht); +} + + +loop_variable_state * +loop_state::insert(ir_loop *ir) +{ + loop_variable_state *ls = new(this->mem_ctx) loop_variable_state; + hash_table_insert(this->ht, ls, ir); + + return ls; +} + + +loop_variable_state * +loop_state::get(const ir_loop *ir) +{ + return (loop_variable_state *) hash_table_find(this->ht, ir); +} + + +loop_variable * +loop_variable_state::get(const ir_variable *ir) +{ + return (loop_variable *) hash_table_find(this->var_hash, ir); +} + + +loop_variable * +loop_variable_state::insert(ir_variable *var) +{ + void *mem_ctx = talloc_parent(this); + loop_variable *lv = talloc_zero(mem_ctx, loop_variable); + + lv->var = var; + + hash_table_insert(this->var_hash, lv, lv->var); + this->variables.push_tail(lv); + + return lv; +} + + +loop_terminator * +loop_variable_state::insert(ir_if *if_stmt) +{ + void *mem_ctx = talloc_parent(this); + loop_terminator *t = talloc_zero(mem_ctx, loop_terminator); + + t->ir = if_stmt; + this->terminators.push_tail(t); + + return t; +} + + +class loop_analysis : public ir_hierarchical_visitor { +public: + loop_analysis(); + + virtual ir_visitor_status visit(ir_loop_jump *); + virtual ir_visitor_status visit(ir_dereference_variable *); + + virtual ir_visitor_status visit_enter(ir_loop *); + virtual ir_visitor_status visit_leave(ir_loop *); + virtual ir_visitor_status visit_enter(ir_assignment *); + virtual ir_visitor_status visit_leave(ir_assignment *); + virtual ir_visitor_status visit_enter(ir_if *); + virtual ir_visitor_status visit_leave(ir_if *); + + loop_state *loops; + + int if_statement_depth; + + ir_assignment *current_assignment; + + exec_list state; +}; + + +loop_analysis::loop_analysis() +{ + this->loops = new loop_state; + + this->if_statement_depth = 0; + this->current_assignment = NULL; +} + + +ir_visitor_status +loop_analysis::visit(ir_loop_jump *ir) +{ + (void) ir; + + assert(!this->state.is_empty()); + + loop_variable_state *const ls = + (loop_variable_state *) this->state.get_head(); + + ls->num_loop_jumps++; + + return visit_continue; +} + + +ir_visitor_status +loop_analysis::visit(ir_dereference_variable *ir) +{ + /* If we're not somewhere inside a loop, there's nothing to do. + */ + if (this->state.is_empty()) + return visit_continue; + + loop_variable_state *const ls = + (loop_variable_state *) this->state.get_head(); + + ir_variable *var = ir->variable_referenced(); + loop_variable *lv = ls->get(var); + + if (lv == NULL) { + lv = ls->insert(var); + lv->read_before_write = !this->in_assignee; + } + + if (this->in_assignee) { + assert(this->current_assignment != NULL); + + lv->conditional_assignment = (this->if_statement_depth > 0) + || (this->current_assignment->condition != NULL); + + if (lv->first_assignment == NULL) { + assert(lv->num_assignments == 0); + + lv->first_assignment = this->current_assignment; + } + + lv->num_assignments++; + } else if (lv->first_assignment == this->current_assignment) { + /* This catches the case where the variable is used in the RHS of an + * assignment where it is also in the LHS. + */ + lv->read_before_write = true; + } + + return visit_continue; +} + +ir_visitor_status +loop_analysis::visit_enter(ir_loop *ir) +{ + loop_variable_state *ls = this->loops->insert(ir); + this->state.push_head(ls); + + return visit_continue; +} + +ir_visitor_status +loop_analysis::visit_leave(ir_loop *ir) +{ + loop_variable_state *const ls = + (loop_variable_state *) this->state.pop_head(); + + + foreach_list(node, &ir->body_instructions) { + /* Skip over declarations at the start of a loop. + */ + if (((ir_instruction *) node)->as_variable()) + continue; + + ir_if *if_stmt = ((ir_instruction *) node)->as_if(); + + if ((if_stmt != NULL) && is_loop_terminator(if_stmt)) + ls->insert(if_stmt); + else + break; + } + + + foreach_list_safe(node, &ls->variables) { + loop_variable *lv = (loop_variable *) node; + + /* Move variables that are already marked as being loop constant to + * a separate list. These trivially don't need to be tested. + */ + if (lv->is_loop_constant()) { + lv->remove(); + ls->constants.push_tail(lv); + } + } + + /* Each variable assigned in the loop that isn't already marked as being loop + * constant might still be loop constant. The requirements at this point + * are: + * + * - Variable is written before it is read. + * + * - Only one assignment to the variable. + * + * - All operands on the RHS of the assignment are also loop constants. + * + * The last requirement is the reason for the progress loop. A variable + * marked as a loop constant on one pass may allow other variables to be + * marked as loop constant on following passes. + */ + bool progress; + do { + progress = false; + + foreach_list_safe(node, &ls->variables) { + loop_variable *lv = (loop_variable *) node; + + if (lv->conditional_assignment || (lv->num_assignments > 1)) + continue; + + /* Process the RHS of the assignment. If all of the variables + * accessed there are loop constants, then add this + */ + ir_rvalue *const rhs = lv->first_assignment->rhs; + if (all_expression_operands_are_loop_constant(rhs, ls->var_hash)) { + lv->rhs_clean = true; + + if (lv->is_loop_constant()) { + progress = true; + + lv->remove(); + ls->constants.push_tail(lv); + } + } + } + } while (progress); + + /* The remaining variables that are not loop invariant might be loop + * induction variables. + */ + foreach_list_safe(node, &ls->variables) { + loop_variable *lv = (loop_variable *) node; + + /* If there is more than one assignment to a variable, it cannot be a + * loop induction variable. This isn't strictly true, but this is a + * very simple induction variable detector, and it can't handle more + * complex cases. + */ + if (lv->num_assignments > 1) + continue; + + /* All of the variables with zero assignments in the loop are loop + * invariant, and they should have already been filtered out. + */ + assert(lv->num_assignments == 1); + assert(lv->first_assignment != NULL); + + /* The assignmnet to the variable in the loop must be unconditional. + */ + if (lv->conditional_assignment) + continue; + + /* Basic loop induction variables have a single assignment in the loop + * that has the form 'VAR = VAR + i' or 'VAR = VAR - i' where i is a + * loop invariant. + */ + ir_rvalue *const inc = + get_basic_induction_increment(lv->first_assignment, ls->var_hash); + if (inc != NULL) { + lv->iv_scale = NULL; + lv->biv = lv->var; + lv->increment = inc; + + lv->remove(); + ls->induction_variables.push_tail(lv); + } + } + + return visit_continue; +} + +ir_visitor_status +loop_analysis::visit_enter(ir_if *ir) +{ + (void) ir; + + if (!this->state.is_empty()) + this->if_statement_depth++; + + return visit_continue; +} + +ir_visitor_status +loop_analysis::visit_leave(ir_if *ir) +{ + (void) ir; + + if (!this->state.is_empty()) + this->if_statement_depth--; + + return visit_continue; +} + +ir_visitor_status +loop_analysis::visit_enter(ir_assignment *ir) +{ + /* If we're not somewhere inside a loop, there's nothing to do. + */ + if (this->state.is_empty()) + return visit_continue_with_parent; + + this->current_assignment = ir; + + return visit_continue; +} + +ir_visitor_status +loop_analysis::visit_leave(ir_assignment *ir) +{ + /* Since the visit_enter exits with visit_continue_with_parent for this + * case, the loop state stack should never be empty here. + */ + assert(!this->state.is_empty()); + + assert(this->current_assignment == ir); + this->current_assignment = NULL; + + return visit_continue; +} + + +class examine_rhs : public ir_hierarchical_visitor { +public: + examine_rhs(hash_table *loop_variables) + { + this->only_uses_loop_constants = true; + this->loop_variables = loop_variables; + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + loop_variable *lv = + (loop_variable *) hash_table_find(this->loop_variables, ir->var); + + assert(lv != NULL); + + if (lv->is_loop_constant()) { + return visit_continue; + } else { + this->only_uses_loop_constants = false; + return visit_stop; + } + } + + hash_table *loop_variables; + bool only_uses_loop_constants; +}; + + +bool +all_expression_operands_are_loop_constant(ir_rvalue *ir, hash_table *variables) +{ + examine_rhs v(variables); + + ir->accept(&v); + + return v.only_uses_loop_constants; +} + + +ir_rvalue * +get_basic_induction_increment(ir_assignment *ir, hash_table *var_hash) +{ + /* The RHS must be a binary expression. + */ + ir_expression *const rhs = ir->rhs->as_expression(); + if ((rhs == NULL) + || ((rhs->operation != ir_binop_add) + && (rhs->operation != ir_binop_sub))) + return NULL; + + /* One of the of operands of the expression must be the variable assigned. + * If the operation is subtraction, the variable in question must be the + * "left" operand. + */ + ir_variable *const var = ir->lhs->variable_referenced(); + + ir_variable *const op0 = rhs->operands[0]->variable_referenced(); + ir_variable *const op1 = rhs->operands[1]->variable_referenced(); + + if (((op0 != var) && (op1 != var)) + || ((op1 == var) && (rhs->operation == ir_binop_sub))) + return NULL; + + ir_rvalue *inc = (op0 == var) ? rhs->operands[1] : rhs->operands[0]; + + if (inc->as_constant() == NULL) { + ir_variable *const inc_var = inc->variable_referenced(); + if (inc_var != NULL) { + loop_variable *lv = + (loop_variable *) hash_table_find(var_hash, inc_var); + + if (!lv->is_loop_constant()) + inc = NULL; + } else + inc = NULL; + } + + if ((inc != NULL) && (rhs->operation == ir_binop_sub)) { + void *mem_ctx = talloc_parent(ir); + + inc = new(mem_ctx) ir_expression(ir_unop_neg, + inc->type, + inc->clone(mem_ctx, NULL), + NULL); + } + + return inc; +} + + +/** + * Detect whether an if-statement is a loop terminating condition + * + * Detects if-statements of the form + * + * (if (expression bool ...) (break)) + */ +bool +is_loop_terminator(ir_if *ir) +{ + if (!ir->else_instructions.is_empty()) + return false; + + ir_instruction *const inst = + (ir_instruction *) ir->then_instructions.get_head(); + assert(inst != NULL); + + if (inst->ir_type != ir_type_loop_jump) + return false; + + ir_loop_jump *const jump = (ir_loop_jump *) inst; + if (jump->mode != ir_loop_jump::jump_break) + return false; + + return true; +} + + +loop_state * +analyze_loop_variables(exec_list *instructions) +{ + loop_analysis v; + + v.run(instructions); + return v.loops; +} diff --git a/mesalib/src/glsl/loop_analysis.h b/mesalib/src/glsl/loop_analysis.h new file mode 100644 index 000000000..7b0511fbb --- /dev/null +++ b/mesalib/src/glsl/loop_analysis.h @@ -0,0 +1,230 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef LOOP_ANALYSIS_H +#define LOOP_ANALYSIS_H + +#include "ir.h" +#include "program/hash_table.h" + +/** + * Analyze and classify all variables used in all loops in the instruction list + */ +extern class loop_state * +analyze_loop_variables(exec_list *instructions); + + +/** + * Fill in loop control fields + * + * Based on analysis of loop variables, this function tries to remove sequences + * in the loop of the form + * + * (if (expression bool ...) (break)) + * + * and fill in the \c ir_loop::from, \c ir_loop::to, and \c ir_loop::counter + * fields of the \c ir_loop. + * + * In this process, some conditional break-statements may be eliminated + * altogether. For example, if it is provable that one loop exit condition will + * always be satisfied before another, the unnecessary exit condition will be + * removed. + */ +extern bool +set_loop_controls(exec_list *instructions, loop_state *ls); + + +extern bool +unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations); + + +/** + * Tracking for all variables used in a loop + */ +class loop_variable_state : public exec_node { +public: + class loop_variable *get(const ir_variable *); + class loop_variable *insert(ir_variable *); + class loop_terminator *insert(ir_if *); + + + /** + * Loop whose variable state is being tracked by this structure + */ + ir_loop *loop; + + /** + * Variables that have not yet been classified + */ + exec_list variables; + + /** + * Variables whose values are constant within the body of the loop + * + * This list contains \c loop_variable objects. + */ + exec_list constants; + + /** + * Induction variables for this loop + * + * This list contains \c loop_variable objects. + */ + exec_list induction_variables; + + /** + * Simple if-statements that lead to the termination of the loop + * + * This list contains \c loop_terminator objects. + * + * \sa is_loop_terminator + */ + exec_list terminators; + + /** + * Hash table containing all variables accessed in this loop + */ + hash_table *var_hash; + + /** + * Maximum number of loop iterations. + * + * If this value is negative, then the loop may be infinite. This actually + * means that analysis was unable to determine an upper bound on the number + * of loop iterations. + */ + int max_iterations; + + /** + * Number of ir_loop_jump instructions that operate on this loop + */ + unsigned num_loop_jumps; + + loop_variable_state() + { + this->max_iterations = -1; + this->num_loop_jumps = 0; + this->var_hash = hash_table_ctor(0, hash_table_pointer_hash, + hash_table_pointer_compare); + } + + ~loop_variable_state() + { + hash_table_dtor(this->var_hash); + } +}; + + +class loop_variable : public exec_node { +public: + /** The variable in question. */ + ir_variable *var; + + /** Is the variable read in the loop before it is written? */ + bool read_before_write; + + /** Are all variables in the RHS of the assignment loop constants? */ + bool rhs_clean; + + /** Is there an assignment to the variable that is conditional? */ + bool conditional_assignment; + + /** Reference to the first assignment to the variable in the loop body. */ + ir_assignment *first_assignment; + + /** Number of assignments to the variable in the loop body. */ + unsigned num_assignments; + + /** + * Increment values for loop induction variables + * + * Loop induction variables have a single increment of the form + * \c b * \c biv + \c c, where \c b and \c c are loop constants and \c i + * is a basic loop induction variable. + * + * If \c iv_scale is \c NULL, 1 is used. If \c biv is the same as \c var, + * then \c var is a basic loop induction variable. + */ + /*@{*/ + ir_rvalue *iv_scale; + ir_variable *biv; + ir_rvalue *increment; + /*@}*/ + + + inline bool is_loop_constant() const + { + const bool is_const = (this->num_assignments == 0) + || ((this->num_assignments == 1) + && !this->conditional_assignment + && !this->read_before_write + && this->rhs_clean); + + /* If the RHS of *the* assignment is clean, then there must be exactly + * one assignment of the variable. + */ + assert((this->rhs_clean && (this->num_assignments == 1)) + || !this->rhs_clean); + + /* Variables that are marked read-only *MUST* be loop constant. + */ + assert(!this->var->read_only || (this->var->read_only && is_const)); + + return is_const; + } +}; + + +class loop_terminator : public exec_node { +public: + ir_if *ir; +}; + + +class loop_state { +public: + ~loop_state(); + + /** + * Get the loop variable state data for a particular loop + */ + loop_variable_state *get(const ir_loop *); + + loop_variable_state *insert(ir_loop *ir); + +private: + loop_state(); + + /** + * Hash table containing all loops that have been analyzed. + */ + hash_table *ht; + + void *mem_ctx; + + friend class loop_analysis; +}; + +#endif /* LOOP_ANALYSIS_H */ diff --git a/mesalib/src/glsl/loop_controls.cpp b/mesalib/src/glsl/loop_controls.cpp new file mode 100644 index 000000000..2ef3d3052 --- /dev/null +++ b/mesalib/src/glsl/loop_controls.cpp @@ -0,0 +1,301 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <climits> +#include "main/compiler.h" +#include "glsl_types.h" +#include "loop_analysis.h" +#include "ir_hierarchical_visitor.h" + +/** + * Find an initializer of a variable outside a loop + * + * Works backwards from the loop to find the pre-loop value of the variable. + * This is used, for example, to find the initial value of loop induction + * variables. + * + * \param loop Loop where \c var is an induction variable + * \param var Variable whose initializer is to be found + * + * \return + * The \c ir_rvalue assigned to the variable outside the loop. May return + * \c NULL if no initializer can be found. + */ +ir_rvalue * +find_initial_value(ir_loop *loop, ir_variable *var) +{ + for (exec_node *node = loop->prev; + !node->is_head_sentinel(); + node = node->prev) { + ir_instruction *ir = (ir_instruction *) node; + + switch (ir->ir_type) { + case ir_type_call: + case ir_type_loop: + case ir_type_loop_jump: + case ir_type_return: + case ir_type_if: + return NULL; + + case ir_type_function: + case ir_type_function_signature: + assert(!"Should not get here."); + return NULL; + + case ir_type_assignment: { + ir_assignment *assign = ir->as_assignment(); + ir_variable *assignee = assign->lhs->whole_variable_referenced(); + + if (assignee == var) + return (assign->condition != NULL) ? NULL : assign->rhs; + + break; + } + + default: + break; + } + } + + return NULL; +} + + +int +calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment, + enum ir_expression_operation op) +{ + void *mem_ctx = talloc_init("%s", __func__); + + ir_expression *const sub = + new(mem_ctx) ir_expression(ir_binop_sub, from->type, to, from); + + ir_expression *const div = + new(mem_ctx) ir_expression(ir_binop_div, sub->type, sub, increment); + + ir_constant *iter = div->constant_expression_value(); + + if (iter == NULL) + return -1; + + if (!iter->type->is_integer()) { + ir_rvalue *cast = + new(mem_ctx) ir_expression(ir_unop_f2i, glsl_type::int_type, iter, + NULL); + + iter = cast->constant_expression_value(); + } + + int iter_value = iter->get_int_component(0); + + /* Make sure that the calculated number of iterations satisfies the exit + * condition. This is needed to catch off-by-one errors and some types of + * ill-formed loops. For example, we need to detect that the following + * loop does not have a maximum iteration count. + * + * for (float x = 0.0; x != 0.9; x += 0.2) + * ; + */ + const int bias[] = { -1, 0, 1 }; + bool valid_loop = false; + + for (unsigned i = 0; i < Elements(bias); i++) { + iter = (increment->type->is_integer()) + ? new(mem_ctx) ir_constant(iter_value + bias[i]) + : new(mem_ctx) ir_constant(float(iter_value + bias[i])); + + ir_expression *const mul = + new(mem_ctx) ir_expression(ir_binop_mul, increment->type, iter, + increment); + + ir_expression *const add = + new(mem_ctx) ir_expression(ir_binop_add, mul->type, mul, from); + + ir_expression *const cmp = + new(mem_ctx) ir_expression(op, glsl_type::bool_type, add, to); + + ir_constant *const cmp_result = cmp->constant_expression_value(); + + assert(cmp_result != NULL); + if (cmp_result->get_bool_component(0)) { + iter_value += bias[i]; + valid_loop = true; + break; + } + } + + talloc_free(mem_ctx); + return (valid_loop) ? iter_value : -1; +} + + +class loop_control_visitor : public ir_hierarchical_visitor { +public: + loop_control_visitor(loop_state *state) + { + this->state = state; + this->progress = false; + } + + virtual ir_visitor_status visit_leave(ir_loop *ir); + + loop_state *state; + + bool progress; +}; + + +ir_visitor_status +loop_control_visitor::visit_leave(ir_loop *ir) +{ + loop_variable_state *const ls = this->state->get(ir); + + /* If we've entered a loop that hasn't been analyzed, something really, + * really bad has happened. + */ + if (ls == NULL) { + assert(ls != NULL); + return visit_continue; + } + + /* Search the loop terminating conditions for one of the form 'i < c' where + * i is a loop induction variable, c is a constant, and < is any relative + * operator. + */ + int max_iterations = ls->max_iterations; + + if(ir->from && ir->to && ir->increment) + max_iterations = calculate_iterations(ir->from, ir->to, ir->increment, (ir_expression_operation)ir->cmp); + + if(max_iterations < 0) + max_iterations = INT_MAX; + + foreach_list(node, &ls->terminators) { + loop_terminator *t = (loop_terminator *) node; + ir_if *if_stmt = t->ir; + + /* If-statements can be either 'if (expr)' or 'if (deref)'. We only care + * about the former here. + */ + ir_expression *cond = if_stmt->condition->as_expression(); + if (cond == NULL) + continue; + + switch (cond->operation) { + case ir_binop_less: + case ir_binop_greater: + case ir_binop_lequal: + case ir_binop_gequal: { + /* The expressions that we care about will either be of the form + * 'counter < limit' or 'limit < counter'. Figure out which is + * which. + */ + ir_rvalue *counter = cond->operands[0]->as_dereference_variable(); + ir_constant *limit = cond->operands[1]->as_constant(); + enum ir_expression_operation cmp = cond->operation; + + if (limit == NULL) { + counter = cond->operands[1]->as_dereference_variable(); + limit = cond->operands[0]->as_constant(); + + switch (cmp) { + case ir_binop_less: cmp = ir_binop_gequal; break; + case ir_binop_greater: cmp = ir_binop_lequal; break; + case ir_binop_lequal: cmp = ir_binop_greater; break; + case ir_binop_gequal: cmp = ir_binop_less; break; + default: assert(!"Should not get here."); + } + } + + if ((counter == NULL) || (limit == NULL)) + break; + + ir_variable *var = counter->variable_referenced(); + + ir_rvalue *init = find_initial_value(ir, var); + + foreach_list(iv_node, &ls->induction_variables) { + loop_variable *lv = (loop_variable *) iv_node; + + if (lv->var == var) { + const int iterations = calculate_iterations(init, limit, + lv->increment, + cmp); + if (iterations >= 0) { + /* If the new iteration count is lower than the previously + * believed iteration count, update the loop control values. + */ + if (iterations < max_iterations) { + ir->from = init->clone(ir, NULL); + ir->to = limit->clone(ir, NULL); + ir->increment = lv->increment->clone(ir, NULL); + ir->counter = lv->var; + ir->cmp = cmp; + + max_iterations = iterations; + } + + /* Remove the conditional break statement. The loop + * controls are now set such that the exit condition will be + * satisfied. + */ + if_stmt->remove(); + + assert(ls->num_loop_jumps > 0); + ls->num_loop_jumps--; + + this->progress = true; + } + + break; + } + } + break; + } + + default: + break; + } + } + + /* If we have proven the one of the loop exit conditions is satisifed before + * running the loop once, remove the loop. + */ + if (max_iterations == 0) + ir->remove(); + else + ls->max_iterations = max_iterations; + + return visit_continue; +} + + +bool +set_loop_controls(exec_list *instructions, loop_state *ls) +{ + loop_control_visitor v(ls); + + v.run(instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/loop_unroll.cpp b/mesalib/src/glsl/loop_unroll.cpp new file mode 100644 index 000000000..90797bde3 --- /dev/null +++ b/mesalib/src/glsl/loop_unroll.cpp @@ -0,0 +1,187 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glsl_types.h" +#include "loop_analysis.h" +#include "ir_hierarchical_visitor.h" + +class loop_unroll_visitor : public ir_hierarchical_visitor { +public: + loop_unroll_visitor(loop_state *state, unsigned max_iterations) + { + this->state = state; + this->progress = false; + this->max_iterations = max_iterations; + } + + virtual ir_visitor_status visit_leave(ir_loop *ir); + + loop_state *state; + + bool progress; + unsigned max_iterations; +}; + + +ir_visitor_status +loop_unroll_visitor::visit_leave(ir_loop *ir) +{ + loop_variable_state *const ls = this->state->get(ir); + int iterations; + + /* If we've entered a loop that hasn't been analyzed, something really, + * really bad has happened. + */ + if (ls == NULL) { + assert(ls != NULL); + return visit_continue; + } + + iterations = ls->max_iterations; + + /* Don't try to unroll loops where the number of iterations is not known + * at compile-time. + */ + if (iterations < 0) + return visit_continue; + + /* Don't try to unroll loops that have zillions of iterations either. + */ + if (iterations > max_iterations) + return visit_continue; + + if (ls->num_loop_jumps > 1) + return visit_continue; + else if (ls->num_loop_jumps) { + /* recognize loops in the form produced by ir_lower_jumps */ + ir_instruction *last_ir = + ((ir_instruction*)ir->body_instructions.get_tail()); + + assert(last_ir != NULL); + + ir_if *last_if = last_ir->as_if(); + if (last_if) { + bool continue_from_then_branch; + + /* Determine which if-statement branch, if any, ends with a break. + * The branch that did *not* have the break will get a temporary + * continue inserted in each iteration of the loop unroll. + * + * Note that since ls->num_loop_jumps is <= 1, it is impossible for + * both branches to end with a break. + */ + ir_instruction *last = + (ir_instruction *) last_if->then_instructions.get_tail(); + + if (last && last->ir_type == ir_type_loop_jump + && ((ir_loop_jump*) last)->is_break()) { + continue_from_then_branch = false; + } else { + last = (ir_instruction *) last_if->then_instructions.get_tail(); + + if (last && last->ir_type == ir_type_loop_jump + && ((ir_loop_jump*) last)->is_break()) + continue_from_then_branch = true; + else + /* Bail out if neither if-statement branch ends with a break. + */ + return visit_continue; + } + + /* Remove the break from the if-statement. + */ + last->remove(); + + void *const mem_ctx = talloc_parent(ir); + ir_instruction *ir_to_replace = ir; + + for (int i = 0; i < iterations; i++) { + exec_list copy_list; + + copy_list.make_empty(); + clone_ir_list(mem_ctx, ©_list, &ir->body_instructions); + + last_if = ((ir_instruction*)copy_list.get_tail())->as_if(); + assert(last_if); + + ir_to_replace->insert_before(©_list); + ir_to_replace->remove(); + + /* placeholder that will be removed in the next iteration */ + ir_to_replace = + new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_continue); + + exec_list *const list = (continue_from_then_branch) + ? &last_if->then_instructions : &last_if->else_instructions; + + list->push_tail(ir_to_replace); + } + + ir_to_replace->remove(); + + this->progress = true; + return visit_continue; + } else if (last_ir->ir_type == ir_type_loop_jump + && ((ir_loop_jump *)last_ir)->is_break()) { + /* If the only loop-jump is a break at the end of the loop, the loop + * will execute exactly once. Remove the break, set the iteration + * count, and fall through to the normal unroller. + */ + last_ir->remove(); + iterations = 1; + + this->progress = true; + } else + return visit_continue; + } + + void *const mem_ctx = talloc_parent(ir); + + for (int i = 0; i < iterations; i++) { + exec_list copy_list; + + copy_list.make_empty(); + clone_ir_list(mem_ctx, ©_list, &ir->body_instructions); + + ir->insert_before(©_list); + } + + /* The loop has been replaced by the unrolled copies. Remove the original + * loop from the IR sequence. + */ + ir->remove(); + + this->progress = true; + return visit_continue; +} + + +bool +unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations) +{ + loop_unroll_visitor v(ls, max_iterations); + + v.run(instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/lower_noise.cpp b/mesalib/src/glsl/lower_noise.cpp new file mode 100644 index 000000000..cb32d2834 --- /dev/null +++ b/mesalib/src/glsl/lower_noise.cpp @@ -0,0 +1,71 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file lower_noise.cpp + * IR lower pass to remove noise opcodes. + * + * \author Ian Romanick <ian.d.romanick@intel.com> + */ + +#include "ir.h" +#include "ir_rvalue_visitor.h" + +class lower_noise_visitor : public ir_rvalue_visitor { +public: + lower_noise_visitor() : progress(false) + { + /* empty */ + } + + void handle_rvalue(ir_rvalue **rvalue) + { + if (!*rvalue) + return; + + ir_expression *expr = (*rvalue)->as_expression(); + if (!expr) + return; + + /* In the future, ir_unop_noise may be replaced by a call to a function + * that implements noise. No hardware has a noise instruction. + */ + if (expr->operation == ir_unop_noise) { + *rvalue = ir_constant::zero(talloc_parent(expr), expr->type); + this->progress = true; + } + } + + bool progress; +}; + + +bool +lower_noise(exec_list *instructions) +{ + lower_noise_visitor v; + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/lower_variable_index_to_cond_assign.cpp b/mesalib/src/glsl/lower_variable_index_to_cond_assign.cpp new file mode 100644 index 000000000..5f0dd7311 --- /dev/null +++ b/mesalib/src/glsl/lower_variable_index_to_cond_assign.cpp @@ -0,0 +1,358 @@ +/* + * Copyright © 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file lower_variable_index_to_cond_assign.cpp + * + * Turns non-constant indexing into array types to a series of + * conditional moves of each element into a temporary. + * + * Pre-DX10 GPUs often don't have a native way to do this operation, + * and this works around that. + */ + +#include "ir.h" +#include "ir_rvalue_visitor.h" +#include "ir_optimization.h" +#include "glsl_types.h" +#include "main/macros.h" + +struct assignment_generator +{ + ir_instruction* base_ir; + ir_rvalue* array; + bool is_write; + ir_variable* var; + + assignment_generator() + { + } + + void generate(unsigned i, ir_rvalue* condition, exec_list *list) const + { + /* Just clone the rest of the deref chain when trying to get at the + * underlying variable. + */ + void *mem_ctx = talloc_parent(base_ir); + ir_rvalue *element = + new(mem_ctx) ir_dereference_array(this->array->clone(mem_ctx, NULL), + new(mem_ctx) ir_constant(i)); + ir_rvalue *variable = new(mem_ctx) ir_dereference_variable(this->var); + + ir_assignment *assignment = (is_write) + ? new(mem_ctx) ir_assignment(element, variable, condition) + : new(mem_ctx) ir_assignment(variable, element, condition); + + list->push_tail(assignment); + } +}; + +struct switch_generator +{ + /* make TFunction a template parameter if you need to use other generators */ + typedef assignment_generator TFunction; + const TFunction& generator; + + ir_variable* index; + unsigned linear_sequence_max_length; + unsigned condition_components; + + void *mem_ctx; + + switch_generator(const TFunction& generator, ir_variable *index, + unsigned linear_sequence_max_length, + unsigned condition_components) + : generator(generator), index(index), + linear_sequence_max_length(linear_sequence_max_length), + condition_components(condition_components) + { + this->mem_ctx = talloc_parent(index); + } + + void linear_sequence(unsigned begin, unsigned end, exec_list *list) + { + if (begin == end) + return; + + /* If the array access is a read, read the first element of this subregion + * unconditionally. The remaining tests will possibly overwrite this + * value with one of the other array elements. + * + * This optimization cannot be done for writes because it will cause the + * first element of the subregion to be written possibly *in addition* to + * one of the other elements. + */ + unsigned first; + if (!this->generator.is_write) { + this->generator.generate(begin, 0, list); + first = begin + 1; + } else { + first = begin; + } + + for (unsigned i = first; i < end; i += 4) { + const unsigned comps = MIN2(condition_components, end - i); + + ir_rvalue *broadcast_index = + new(this->mem_ctx) ir_dereference_variable(index); + + if (comps) { + const ir_swizzle_mask m = { 0, 0, 0, 0, comps, false }; + broadcast_index = new(this->mem_ctx) ir_swizzle(broadcast_index, m); + } + + /* Compare the desired index value with the next block of four indices. + */ + ir_constant_data test_indices_data; + memset(&test_indices_data, 0, sizeof(test_indices_data)); + test_indices_data.i[0] = i; + test_indices_data.i[1] = i + 1; + test_indices_data.i[2] = i + 2; + test_indices_data.i[3] = i + 3; + ir_constant *const test_indices = + new(this->mem_ctx) ir_constant(broadcast_index->type, + &test_indices_data); + + ir_rvalue *const condition_val = + new(this->mem_ctx) ir_expression(ir_binop_equal, + &glsl_type::bool_type[comps - 1], + broadcast_index, + test_indices); + + ir_variable *const condition = + new(this->mem_ctx) ir_variable(condition_val->type, + "dereference_array_condition", + ir_var_temporary); + list->push_tail(condition); + + ir_rvalue *const cond_deref = + new(this->mem_ctx) ir_dereference_variable(condition); + list->push_tail(new(this->mem_ctx) ir_assignment(cond_deref, + condition_val, 0)); + + if (comps == 1) { + ir_rvalue *const cond_deref = + new(this->mem_ctx) ir_dereference_variable(condition); + + this->generator.generate(i, cond_deref, list); + } else { + for (unsigned j = 0; j < comps; j++) { + ir_rvalue *const cond_deref = + new(this->mem_ctx) ir_dereference_variable(condition); + ir_rvalue *const cond_swiz = + new(this->mem_ctx) ir_swizzle(cond_deref, j, 0, 0, 0, 1); + + this->generator.generate(i + j, cond_swiz, list); + } + } + } + } + + void bisect(unsigned begin, unsigned end, exec_list *list) + { + unsigned middle = (begin + end) >> 1; + + assert(index->type->is_integer()); + + ir_constant *const middle_c = (index->type->base_type == GLSL_TYPE_UINT) + ? new(this->mem_ctx) ir_constant((unsigned)middle) + : new(this->mem_ctx) ir_constant((int)middle); + + + ir_dereference_variable *deref = + new(this->mem_ctx) ir_dereference_variable(this->index); + + ir_expression *less = + new(this->mem_ctx) ir_expression(ir_binop_less, glsl_type::bool_type, + deref, middle_c); + + ir_if *if_less = new(this->mem_ctx) ir_if(less); + + generate(begin, middle, &if_less->then_instructions); + generate(middle, end, &if_less->else_instructions); + + list->push_tail(if_less); + } + + void generate(unsigned begin, unsigned end, exec_list *list) + { + unsigned length = end - begin; + if (length <= this->linear_sequence_max_length) + return linear_sequence(begin, end, list); + else + return bisect(begin, end, list); + } +}; + +/** + * Visitor class for replacing expressions with ir_constant values. + */ + +class variable_index_to_cond_assign_visitor : public ir_rvalue_visitor { +public: + variable_index_to_cond_assign_visitor(bool lower_input, + bool lower_output, + bool lower_temp, + bool lower_uniform) + { + this->progress = false; + this->lower_inputs = lower_input; + this->lower_outputs = lower_output; + this->lower_temps = lower_temp; + this->lower_uniforms = lower_uniform; + } + + bool progress; + bool lower_inputs; + bool lower_outputs; + bool lower_temps; + bool lower_uniforms; + + bool is_array_or_matrix(const ir_instruction *ir) const + { + return (ir->type->is_array() || ir->type->is_matrix()); + } + + bool needs_lowering(ir_dereference_array *deref) const + { + if (deref == NULL || deref->array_index->as_constant() + || !is_array_or_matrix(deref->array)) + return false; + + if (deref->array->ir_type == ir_type_constant) + return this->lower_temps; + + const ir_variable *const var = deref->array->variable_referenced(); + switch (var->mode) { + case ir_var_auto: + case ir_var_temporary: + return this->lower_temps; + case ir_var_uniform: + return this->lower_uniforms; + case ir_var_in: + return (var->location == -1) ? this->lower_temps : this->lower_inputs; + case ir_var_out: + return (var->location == -1) ? this->lower_temps : this->lower_outputs; + case ir_var_inout: + return this->lower_temps; + } + + assert(!"Should not get here."); + return false; + } + + ir_variable *convert_dereference_array(ir_dereference_array *orig_deref, + ir_rvalue* value) + { + assert(is_array_or_matrix(orig_deref->array)); + + const unsigned length = (orig_deref->array->type->is_array()) + ? orig_deref->array->type->length + : orig_deref->array->type->matrix_columns; + + void *const mem_ctx = talloc_parent(base_ir); + ir_variable *var = + new(mem_ctx) ir_variable(orig_deref->type, "dereference_array_value", + ir_var_temporary); + base_ir->insert_before(var); + + if (value) { + ir_dereference *lhs = new(mem_ctx) ir_dereference_variable(var); + ir_assignment *assign = new(mem_ctx) ir_assignment(lhs, value, NULL); + + base_ir->insert_before(assign); + } + + /* Store the index to a temporary to avoid reusing its tree. */ + ir_variable *index = + new(mem_ctx) ir_variable(orig_deref->array_index->type, + "dereference_array_index", ir_var_temporary); + base_ir->insert_before(index); + + ir_dereference *lhs = new(mem_ctx) ir_dereference_variable(index); + ir_assignment *assign = + new(mem_ctx) ir_assignment(lhs, orig_deref->array_index, NULL); + base_ir->insert_before(assign); + + assignment_generator ag; + ag.array = orig_deref->array; + ag.base_ir = base_ir; + ag.var = var; + ag.is_write = !!value; + + switch_generator sg(ag, index, 4, 4); + + exec_list list; + sg.generate(0, length, &list); + base_ir->insert_before(&list); + + return var; + } + + virtual void handle_rvalue(ir_rvalue **pir) + { + if (!*pir) + return; + + ir_dereference_array* orig_deref = (*pir)->as_dereference_array(); + if (needs_lowering(orig_deref)) { + ir_variable* var = convert_dereference_array(orig_deref, 0); + assert(var); + *pir = new(talloc_parent(base_ir)) ir_dereference_variable(var); + this->progress = true; + } + } + + ir_visitor_status + visit_leave(ir_assignment *ir) + { + ir_rvalue_visitor::visit_leave(ir); + + ir_dereference_array *orig_deref = ir->lhs->as_dereference_array(); + + if (needs_lowering(orig_deref)) { + convert_dereference_array(orig_deref, ir->rhs); + ir->remove(); + this->progress = true; + } + + return visit_continue; + } +}; + +bool +lower_variable_index_to_cond_assign(exec_list *instructions, + bool lower_input, + bool lower_output, + bool lower_temp, + bool lower_uniform) +{ + variable_index_to_cond_assign_visitor v(lower_input, + lower_output, + lower_temp, + lower_uniform); + + visit_list_elements(&v, instructions); + + return v.progress; +} diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp new file mode 100644 index 000000000..b51b2405c --- /dev/null +++ b/mesalib/src/glsl/main.cpp @@ -0,0 +1,342 @@ +/* + * Copyright © 2008, 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +#include <cstdlib> +#include <cstdio> +#include <io.h> + +#ifdef _MSC_VER +#define __STDC__ 1 +#include <getopt.h> +typedef size_t ssize_t; +#define open _open +#define read _read +#define fstat _fstat +#define stat _stat +#define close _close +#define O_RDONLY _O_RDONLY +#endif + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> + +#include "ast.h" +#include "glsl_parser_extras.h" +#include "glsl_parser.h" +#include "ir_optimization.h" +#include "ir_print_visitor.h" +#include "program.h" +#include "loop_analysis.h" + +extern "C" struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); + +/* Copied from shader_api.c for the stand-alone compiler. + */ +struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) +{ + struct gl_shader *shader; + + (void) ctx; + + assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER); + shader = talloc_zero(NULL, struct gl_shader); + if (shader) { + shader->Type = type; + shader->Name = name; + shader->RefCount = 1; + } + return shader; +} + +static void +initialize_context(GLcontext *ctx, gl_api api) +{ + memset(ctx, 0, sizeof(*ctx)); + + ctx->API = api; + + ctx->Extensions.ARB_draw_buffers = GL_TRUE; + ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE; + ctx->Extensions.EXT_texture_array = GL_TRUE; + ctx->Extensions.NV_texture_rectangle = GL_TRUE; + + /* 1.10 minimums. */ + ctx->Const.MaxLights = 8; + ctx->Const.MaxClipPlanes = 8; + ctx->Const.MaxTextureUnits = 2; + + /* More than the 1.10 minimum to appease parser tests taken from + * apps that (hopefully) already checked the number of coords. + */ + ctx->Const.MaxTextureCoordUnits = 4; + + ctx->Const.VertexProgram.MaxAttribs = 16; + ctx->Const.VertexProgram.MaxUniformComponents = 512; + ctx->Const.MaxVarying = 8; + ctx->Const.MaxVertexTextureImageUnits = 0; + ctx->Const.MaxCombinedTextureImageUnits = 2; + ctx->Const.MaxTextureImageUnits = 2; + ctx->Const.FragmentProgram.MaxUniformComponents = 64; + + ctx->Const.MaxDrawBuffers = 2; + + ctx->Driver.NewShader = _mesa_new_shader; +} + +/* Returned string will have 'ctx' as its talloc owner. */ +static char * +load_text_file(void *ctx, const char *file_name) +{ + char *text = NULL; + struct stat st; + ssize_t total_read = 0; + int fd = open(file_name, O_RDONLY); + + if (fd < 0) { + return NULL; + } + + if (fstat(fd, & st) == 0) { + text = (char *) talloc_size(ctx, st.st_size + 1); + if (text != NULL) { + do { + ssize_t bytes = read(fd, text + total_read, + st.st_size - total_read); + if (bytes < 0) { + free(text); + text = NULL; + break; + } + + if (bytes == 0) { + break; + } + + total_read += bytes; + } while (total_read < st.st_size); + + text[total_read] = '\0'; + } + } + + close(fd); + + return text; +} + + +void +usage_fail(const char *name) +{ + printf("%s <filename.frag|filename.vert>\n", name); + exit(EXIT_FAILURE); +} + + +int glsl_es = 0; +int dump_ast = 0; +int dump_hir = 0; +int dump_lir = 0; +int do_link = 0; + +const struct option compiler_opts[] = { + { "glsl-es", 0, &glsl_es, 1 }, + { "dump-ast", 0, &dump_ast, 1 }, + { "dump-hir", 0, &dump_hir, 1 }, + { "dump-lir", 0, &dump_lir, 1 }, + { "link", 0, &do_link, 1 }, + { NULL, 0, NULL, 0 } +}; + +void +compile_shader(GLcontext *ctx, struct gl_shader *shader) +{ + struct _mesa_glsl_parse_state *state = + new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader); + + const char *source = shader->Source; + state->error = preprocess(state, &source, &state->info_log, + state->extensions, ctx->API); + + if (!state->error) { + _mesa_glsl_lexer_ctor(state, source); + _mesa_glsl_parse(state); + _mesa_glsl_lexer_dtor(state); + } + + if (dump_ast) { + foreach_list_const(n, &state->translation_unit) { + ast_node *ast = exec_node_data(ast_node, n, link); + ast->print(); + } + printf("\n\n"); + } + + shader->ir = new(shader) exec_list; + if (!state->error && !state->translation_unit.is_empty()) + _mesa_ast_to_hir(shader->ir, state); + + /* Print out the unoptimized IR. */ + if (!state->error && dump_hir) { + validate_ir_tree(shader->ir); + _mesa_print_ir(shader->ir, state); + } + + /* Optimization passes */ + if (!state->error && !shader->ir->is_empty()) { + bool progress; + do { + progress = false; + + progress = do_function_inlining(shader->ir) || progress; + progress = do_if_simplification(shader->ir) || progress; + progress = do_copy_propagation(shader->ir) || progress; + progress = do_dead_code_local(shader->ir) || progress; + progress = do_dead_code_unlinked(shader->ir) || progress; + progress = do_tree_grafting(shader->ir) || progress; + progress = do_constant_propagation(shader->ir) || progress; + progress = do_constant_variable_unlinked(shader->ir) || progress; + progress = do_constant_folding(shader->ir) || progress; + progress = do_algebraic(shader->ir) || progress; + progress = do_vec_index_to_swizzle(shader->ir) || progress; + progress = do_vec_index_to_cond_assign(shader->ir) || progress; + progress = do_swizzle_swizzle(shader->ir) || progress; + + loop_state *ls = analyze_loop_variables(shader->ir); + progress = set_loop_controls(shader->ir, ls) || progress; + progress = unroll_loops(shader->ir, ls, 32) || progress; + delete ls; + } while (progress); + + validate_ir_tree(shader->ir); + } + + + /* Print out the resulting IR */ + if (!state->error && dump_lir) { + _mesa_print_ir(shader->ir, state); + } + + shader->symbols = state->symbols; + shader->CompileStatus = !state->error; + shader->Version = state->language_version; + memcpy(shader->builtins_to_link, state->builtins_to_link, + sizeof(shader->builtins_to_link[0]) * state->num_builtins_to_link); + shader->num_builtins_to_link = state->num_builtins_to_link; + + if (shader->InfoLog) + talloc_free(shader->InfoLog); + + shader->InfoLog = state->info_log; + + /* Retain any live IR, but trash the rest. */ + reparent_ir(shader->ir, shader); + + talloc_free(state); + + return; +} + +int +main(int argc, char **argv) +{ + int status = EXIT_SUCCESS; + GLcontext local_ctx; + GLcontext *ctx = &local_ctx; + + int c; + int idx = 0; + while ((c = getopt_long(argc, argv, "", compiler_opts, &idx)) != -1) + /* empty */ ; + + + if (argc <= optind) + usage_fail(argv[0]); + + initialize_context(ctx, (glsl_es) ? API_OPENGLES2 : API_OPENGL); + + struct gl_shader_program *whole_program; + + whole_program = talloc_zero (NULL, struct gl_shader_program); + assert(whole_program != NULL); + + for (/* empty */; argc > optind; optind++) { + whole_program->Shaders = (struct gl_shader **) + talloc_realloc(whole_program, whole_program->Shaders, + struct gl_shader *, whole_program->NumShaders + 1); + assert(whole_program->Shaders != NULL); + + struct gl_shader *shader = talloc_zero(whole_program, gl_shader); + + whole_program->Shaders[whole_program->NumShaders] = shader; + whole_program->NumShaders++; + + const unsigned len = strlen(argv[optind]); + if (len < 6) + usage_fail(argv[0]); + + const char *const ext = & argv[optind][len - 5]; + if (strncmp(".vert", ext, 5) == 0) + shader->Type = GL_VERTEX_SHADER; + else if (strncmp(".geom", ext, 5) == 0) + shader->Type = GL_GEOMETRY_SHADER; + else if (strncmp(".frag", ext, 5) == 0) + shader->Type = GL_FRAGMENT_SHADER; + else + usage_fail(argv[0]); + + shader->Source = load_text_file(whole_program, argv[optind]); + if (shader->Source == NULL) { + printf("File \"%s\" does not exist.\n", argv[optind]); + exit(EXIT_FAILURE); + } + + compile_shader(ctx, shader); + + if (!shader->CompileStatus) { + printf("Info log for %s:\n%s\n", argv[optind], shader->InfoLog); + status = EXIT_FAILURE; + break; + } + } + + if ((status == EXIT_SUCCESS) && do_link) { + link_shaders(ctx, whole_program); + status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE; + + if (strlen(whole_program->InfoLog) > 0) + printf("Info log for linking:\n%s\n", whole_program->InfoLog); + } + + for (unsigned i = 0; i < whole_program->_NumLinkedShaders; i++) + talloc_free(whole_program->_LinkedShaders[i]); + + talloc_free(whole_program); + _mesa_glsl_release_types(); + _mesa_glsl_release_functions(); + + return status; +} diff --git a/mesalib/src/glsl/opt_redundant_jumps.cpp b/mesalib/src/glsl/opt_redundant_jumps.cpp new file mode 100644 index 000000000..edf4bb6c2 --- /dev/null +++ b/mesalib/src/glsl/opt_redundant_jumps.cpp @@ -0,0 +1,111 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file opt_redundant_jumps.cpp + * Remove certain types of redundant jumps + */ + +#include "ir.h" + +class redundant_jumps_visitor : public ir_hierarchical_visitor { +public: + redundant_jumps_visitor() + { + this->progress = false; + } + + virtual ir_visitor_status visit_leave(ir_if *); + virtual ir_visitor_status visit_leave(ir_loop *); + + bool progress; +}; + + +ir_visitor_status +redundant_jumps_visitor::visit_leave(ir_if *ir) +{ + /* If the last instruction in both branches is a 'break' or a 'continue', + * pull it out of the branches and insert it after the if-statment. Note + * that both must be the same type (either 'break' or 'continue'). + */ + ir_instruction *const last_then = + (ir_instruction *) ir->then_instructions.get_tail(); + ir_instruction *const last_else = + (ir_instruction *) ir->else_instructions.get_tail(); + + if ((last_then == NULL) || (last_else == NULL)) + return visit_continue; + + if ((last_then->ir_type != ir_type_loop_jump) + || (last_else->ir_type != ir_type_loop_jump)) + return visit_continue; + + ir_loop_jump *const then_jump = (ir_loop_jump *) last_then; + ir_loop_jump *const else_jump = (ir_loop_jump *) last_else; + + if (then_jump->mode != else_jump->mode) + return visit_continue; + + then_jump->remove(); + else_jump->remove(); + this->progress = true; + + ir->insert_after(then_jump); + + /* If both branchs of the if-statement are now empty, remove the + * if-statement. + */ + if (ir->then_instructions.is_empty() && ir->else_instructions.is_empty()) + ir->remove(); + + return visit_continue; +} + + +ir_visitor_status +redundant_jumps_visitor::visit_leave(ir_loop *ir) +{ + /* If the last instruction of a loop body is a 'continue', remove it. + */ + ir_instruction *const last = + (ir_instruction *) ir->body_instructions.get_tail(); + + if (last && (last->ir_type == ir_type_loop_jump) + && (((ir_loop_jump *) last)->mode == ir_loop_jump::jump_continue)) { + last->remove(); + this->progress = true; + } + + return visit_continue; +} + + +bool +optimize_redundant_jumps(exec_list *instructions) +{ + redundant_jumps_visitor v; + + v.run(instructions); + return v.progress; +} diff --git a/mesalib/src/glsl/pp/Makefile b/mesalib/src/glsl/pp/Makefile deleted file mode 100644 index fda1c4202..000000000 --- a/mesalib/src/glsl/pp/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -#src/glsl/pp/Makefile - -TOP = ../../.. - -include $(TOP)/configs/current - -LIBNAME = glslpp - -C_SOURCES = \ - sl_pp_context.c \ - sl_pp_define.c \ - sl_pp_dict.c \ - sl_pp_error.c \ - sl_pp_expression.c \ - sl_pp_extension.c \ - sl_pp_if.c \ - sl_pp_line.c \ - sl_pp_macro.c \ - sl_pp_pragma.c \ - sl_pp_process.c \ - sl_pp_purify.c \ - sl_pp_token.c \ - sl_pp_token_util.c \ - sl_pp_version.c - -include ../Makefile.template - diff --git a/mesalib/src/glsl/pp/sl_pp_context.c b/mesalib/src/glsl/pp/sl_pp_context.c deleted file mode 100644 index 74a9bdddf..000000000 --- a/mesalib/src/glsl/pp/sl_pp_context.c +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_public.h" -#include "sl_pp_context.h" - - -struct sl_pp_context * -sl_pp_context_create(const char *input, - const struct sl_pp_purify_options *options) -{ - struct sl_pp_context *context; - - context = calloc(1, sizeof(struct sl_pp_context)); - if (!context) { - return NULL; - } - - if (sl_pp_dict_init(context)) { - sl_pp_context_destroy(context); - return NULL; - } - - context->getc_buf_capacity = 64; - context->getc_buf = malloc(context->getc_buf_capacity * sizeof(char)); - if (!context->getc_buf) { - sl_pp_context_destroy(context); - return NULL; - } - - if (sl_pp_token_buffer_init(&context->tokens, context)) { - sl_pp_context_destroy(context); - return NULL; - } - - context->macro_tail = &context->macro; - context->if_ptr = SL_PP_MAX_IF_NESTING; - context->if_value = 1; - memset(context->error_msg, 0, sizeof(context->error_msg)); - context->error_line = 1; - context->line = 1; - context->file = 0; - - sl_pp_purify_state_init(&context->pure, input, options); - - memset(&context->process_state, 0, sizeof(context->process_state)); - - return context; -} - -void -sl_pp_context_destroy(struct sl_pp_context *context) -{ - if (context) { - free(context->cstr_pool); - sl_pp_macro_free(context->macro); - free(context->getc_buf); - sl_pp_token_buffer_destroy(&context->tokens); - free(context->process_state.out); - free(context); - } -} - -const char * -sl_pp_context_error_message(const struct sl_pp_context *context) -{ - return context->error_msg; -} - -void -sl_pp_context_error_position(const struct sl_pp_context *context, - unsigned int *file, - unsigned int *line) -{ - if (file) { - *file = 0; - } - if (line) { - *line = context->error_line; - } -} - -int -sl_pp_context_add_predefined(struct sl_pp_context *context, - const char *name, - const char *value) -{ - struct sl_pp_predefined pre; - - if (context->num_predefined == SL_PP_MAX_PREDEFINED) { - return -1; - } - - pre.name = sl_pp_context_add_unique_str(context, name); - if (pre.name == -1) { - return -1; - } - - pre.value = sl_pp_context_add_unique_str(context, value); - if (pre.value == -1) { - return -1; - } - - context->predefined[context->num_predefined++] = pre; - return 0; -} - -int -sl_pp_context_add_unique_str(struct sl_pp_context *context, - const char *str) -{ - unsigned int size; - unsigned int offset = 0; - - size = strlen(str) + 1; - - /* Find out if this is a unique string. */ - while (offset < context->cstr_pool_len) { - const char *str2; - unsigned int size2; - - str2 = &context->cstr_pool[offset]; - size2 = strlen(str2) + 1; - if (size == size2 && !memcmp(str, str2, size - 1)) { - return offset; - } - - offset += size2; - } - - if (context->cstr_pool_len + size > context->cstr_pool_max) { - context->cstr_pool_max = (context->cstr_pool_len + size + 0xffff) & ~0xffff; - context->cstr_pool = realloc(context->cstr_pool, context->cstr_pool_max); - } - - if (!context->cstr_pool) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - offset = context->cstr_pool_len; - memcpy(&context->cstr_pool[offset], str, size); - context->cstr_pool_len += size; - - return offset; -} - -const char * -sl_pp_context_cstr(const struct sl_pp_context *context, - int offset) -{ - if (offset == -1) { - return NULL; - } - return &context->cstr_pool[offset]; -} diff --git a/mesalib/src/glsl/pp/sl_pp_context.h b/mesalib/src/glsl/pp/sl_pp_context.h deleted file mode 100644 index 8abb9708b..000000000 --- a/mesalib/src/glsl/pp/sl_pp_context.h +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_PP_CONTEXT_H -#define SL_PP_CONTEXT_H - -#include "sl_pp_dict.h" -#include "sl_pp_macro.h" -#include "sl_pp_process.h" -#include "sl_pp_purify.h" -#include "sl_pp_token_util.h" - - -#define SL_PP_MAX_IF_NESTING 64 - -#define SL_PP_MAX_ERROR_MSG 1024 - -#define SL_PP_MAX_EXTENSIONS 16 - -#define SL_PP_MAX_PREDEFINED 16 - -struct sl_pp_extension { - int name; /*< GL_VENDOR_extension_name */ -}; - -struct sl_pp_predefined { - int name; - int value; -}; - -union sl_pp_if_state { - struct { - unsigned int condition:1; - unsigned int went_thru_else:1; - unsigned int had_true_cond:1; - } u; - unsigned int value; -}; - -struct sl_pp_context { - char *cstr_pool; - unsigned int cstr_pool_max; - unsigned int cstr_pool_len; - struct sl_pp_dict dict; - - struct sl_pp_macro *macro; - struct sl_pp_macro **macro_tail; - - struct sl_pp_extension extensions[SL_PP_MAX_EXTENSIONS]; - unsigned int num_extensions; - - struct sl_pp_predefined predefined[SL_PP_MAX_PREDEFINED]; - unsigned int num_predefined; - - union sl_pp_if_state if_stack[SL_PP_MAX_IF_NESTING]; - unsigned int if_ptr; - unsigned int if_value; - - char error_msg[SL_PP_MAX_ERROR_MSG]; - unsigned int error_line; - - unsigned int line; - unsigned int file; - - struct sl_pp_purify_state pure; - - char *getc_buf; - unsigned int getc_buf_size; - unsigned int getc_buf_capacity; - - struct sl_pp_token_buffer tokens; - - struct sl_pp_process_state process_state; -}; - -#endif /* SL_PP_CONTEXT_H */ diff --git a/mesalib/src/glsl/pp/sl_pp_define.c b/mesalib/src/glsl/pp/sl_pp_define.c deleted file mode 100644 index 808a6a0d4..000000000 --- a/mesalib/src/glsl/pp/sl_pp_define.c +++ /dev/null @@ -1,238 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_context.h" -#include "sl_pp_process.h" -#include "sl_pp_public.h" - - -static void -skip_whitespace(const struct sl_pp_token_info *input, - unsigned int *first, - unsigned int last) -{ - while (*first < last && input[*first].token == SL_PP_WHITESPACE) { - (*first)++; - } -} - - -static int -_parse_formal_args(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int *first, - unsigned int last, - struct sl_pp_macro *macro) -{ - struct sl_pp_macro_formal_arg **arg; - - macro->num_args = 0; - - skip_whitespace(input, first, last); - if (*first < last) { - if (input[*first].token == SL_PP_RPAREN) { - (*first)++; - return 0; - } - } else { - strcpy(context->error_msg, "expected either macro formal argument or `)'"); - return -1; - } - - arg = ¯o->arg; - - for (;;) { - if (*first < last && input[*first].token != SL_PP_IDENTIFIER) { - strcpy(context->error_msg, "expected macro formal argument"); - return -1; - } - - *arg = malloc(sizeof(struct sl_pp_macro_formal_arg)); - if (!*arg) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - (**arg).name = input[*first].data.identifier; - (*first)++; - - (**arg).next = NULL; - arg = &(**arg).next; - - macro->num_args++; - - skip_whitespace(input, first, last); - if (*first < last) { - if (input[*first].token == SL_PP_COMMA) { - (*first)++; - skip_whitespace(input, first, last); - } else if (input[*first].token == SL_PP_RPAREN) { - (*first)++; - return 0; - } else { - strcpy(context->error_msg, "expected either `,' or `)'"); - return -1; - } - } else { - strcpy(context->error_msg, "expected either `,' or `)'"); - return -1; - } - } - - /* Should not gete here. */ -} - - -int -sl_pp_process_define(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - int macro_name = -1; - struct sl_pp_macro *macro; - unsigned int i; - unsigned int body_len; - unsigned int j; - - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - macro_name = input[first].data.identifier; - first++; - } - if (macro_name == -1) { - strcpy(context->error_msg, "expected macro name"); - return -1; - } - - /* Check for reserved macro names */ - { - const char *name = sl_pp_context_cstr(context, macro_name); - - if (strstr(name, "__")) { - strcpy(context->error_msg, "macro names containing `__' are reserved"); - return 1; - } - if (name[0] == 'G' && name[1] == 'L' && name[2] == '_') { - strcpy(context->error_msg, "macro names prefixed with `GL_' are reserved"); - return 1; - } - } - - for (macro = context->macro; macro; macro = macro->next) { - if (macro->name == macro_name) { - break; - } - } - - if (!macro) { - macro = sl_pp_macro_new(); - if (!macro) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - *context->macro_tail = macro; - context->macro_tail = ¯o->next; - } else { - sl_pp_macro_reset(macro); - } - - macro->name = macro_name; - - /* - * If there is no whitespace between macro name and left paren, a macro - * formal argument list follows. This is the only place where the presence - * of a whitespace matters and it's the only reason why we are dealing - * with whitespace at this level. - */ - if (first < last && input[first].token == SL_PP_LPAREN) { - first++; - if (_parse_formal_args(context, input, &first, last, macro)) { - return -1; - } - } - - /* Calculate body size, trim out whitespace, make room for EOF. */ - body_len = 1; - for (i = first; i < last; i++) { - if (input[i].token != SL_PP_WHITESPACE) { - body_len++; - } - } - - macro->body = malloc(sizeof(struct sl_pp_token_info) * body_len); - if (!macro->body) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - for (j = 0, i = first; i < last; i++) { - if (input[i].token != SL_PP_WHITESPACE) { - macro->body[j++] = input[i]; - } - } - macro->body[j++].token = SL_PP_EOF; - - return 0; -} - - -int -sl_pp_process_undef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - int macro_name = -1; - struct sl_pp_macro **pmacro; - struct sl_pp_macro *macro; - - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - macro_name = input[first].data.identifier; - } - if (macro_name == -1) { - return 0; - } - - for (pmacro = &context->macro; *pmacro; pmacro = &(**pmacro).next) { - if ((**pmacro).name == macro_name) { - break; - } - } - if (!*pmacro) { - return 0; - } - - macro = *pmacro; - *pmacro = macro->next; - macro->next = NULL; - sl_pp_macro_free(macro); - - return 0; -} diff --git a/mesalib/src/glsl/pp/sl_pp_dict.c b/mesalib/src/glsl/pp/sl_pp_dict.c deleted file mode 100644 index 062139e6a..000000000 --- a/mesalib/src/glsl/pp/sl_pp_dict.c +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "sl_pp_public.h" -#include "sl_pp_context.h" -#include "sl_pp_dict.h" - - -#define ADD_NAME_STR(CTX, NAME, STR)\ - do {\ - (CTX)->dict.NAME = sl_pp_context_add_unique_str((CTX), (STR));\ - if ((CTX)->dict.NAME == -1) {\ - return -1;\ - }\ - } while (0) - -#define ADD_NAME(CTX, NAME) ADD_NAME_STR(CTX, NAME, #NAME) - - -int -sl_pp_dict_init(struct sl_pp_context *context) -{ - ADD_NAME(context, all); - - ADD_NAME(context, require); - ADD_NAME(context, enable); - ADD_NAME(context, warn); - ADD_NAME(context, disable); - - ADD_NAME(context, defined); - - ADD_NAME_STR(context, ___LINE__, "__LINE__"); - ADD_NAME_STR(context, ___FILE__, "__FILE__"); - ADD_NAME_STR(context, ___VERSION__, "__VERSION__"); - - ADD_NAME(context, optimize); - ADD_NAME(context, debug); - - ADD_NAME(context, off); - ADD_NAME(context, on); - - ADD_NAME(context, define); - ADD_NAME(context, elif); - ADD_NAME_STR(context, _else, "else"); - ADD_NAME(context, endif); - ADD_NAME(context, error); - ADD_NAME(context, extension); - ADD_NAME_STR(context, _if, "if"); - ADD_NAME(context, ifdef); - ADD_NAME(context, ifndef); - ADD_NAME(context, line); - ADD_NAME(context, pragma); - ADD_NAME(context, undef); - - ADD_NAME(context, version); - - ADD_NAME_STR(context, _0, "0"); - ADD_NAME_STR(context, _1, "1"); - - return 0; -} diff --git a/mesalib/src/glsl/pp/sl_pp_dict.h b/mesalib/src/glsl/pp/sl_pp_dict.h deleted file mode 100644 index 875217bd3..000000000 --- a/mesalib/src/glsl/pp/sl_pp_dict.h +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_PP_DICT_H -#define SL_PP_DICT_H - - -struct sl_pp_context; - -struct sl_pp_dict { - int all; - - int require; - int enable; - int warn; - int disable; - - int defined; - - int ___LINE__; - int ___FILE__; - int ___VERSION__; - - int optimize; - int debug; - - int off; - int on; - - int define; - int elif; - int _else; - int endif; - int error; - int extension; - int _if; - int ifdef; - int ifndef; - int line; - int pragma; - int undef; - - int version; - - int _0; - int _1; -}; - - -int -sl_pp_dict_init(struct sl_pp_context *context); - -#endif /* SL_PP_DICT_H */ diff --git a/mesalib/src/glsl/pp/sl_pp_error.c b/mesalib/src/glsl/pp/sl_pp_error.c deleted file mode 100644 index b628e37ce..000000000 --- a/mesalib/src/glsl/pp/sl_pp_error.c +++ /dev/null @@ -1,270 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_context.h" -#include "sl_pp_process.h" -#include "sl_pp_public.h" - - -void -sl_pp_process_error(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - unsigned int out_len = 0; - unsigned int i; - - for (i = first; i < last; i++) { - const char *s = NULL; - char buf[2]; - - switch (input[i].token) { - case SL_PP_WHITESPACE: - s = " "; - break; - - case SL_PP_NEWLINE: - s = "\n"; - break; - - case SL_PP_HASH: - s = "#"; - break; - - case SL_PP_COMMA: - s = ","; - break; - - case SL_PP_SEMICOLON: - s = ";"; - break; - - case SL_PP_LBRACE: - s = "{"; - break; - - case SL_PP_RBRACE: - s = "}"; - break; - - case SL_PP_LPAREN: - s = "("; - break; - - case SL_PP_RPAREN: - s = ")"; - break; - - case SL_PP_LBRACKET: - s = "["; - break; - - case SL_PP_RBRACKET: - s = "]"; - break; - - case SL_PP_DOT: - s = "."; - break; - - case SL_PP_INCREMENT: - s = "++"; - break; - - case SL_PP_ADDASSIGN: - s = "+="; - break; - - case SL_PP_PLUS: - s = "+"; - break; - - case SL_PP_DECREMENT: - s = "--"; - break; - - case SL_PP_SUBASSIGN: - s = "-="; - break; - - case SL_PP_MINUS: - s = "-"; - break; - - case SL_PP_BITNOT: - s = "~"; - break; - - case SL_PP_NOTEQUAL: - s = "!="; - break; - - case SL_PP_NOT: - s = "!"; - break; - - case SL_PP_MULASSIGN: - s = "*="; - break; - - case SL_PP_STAR: - s = "*"; - break; - - case SL_PP_DIVASSIGN: - s = "/="; - break; - - case SL_PP_SLASH: - s = "/"; - break; - - case SL_PP_MODASSIGN: - s = "%="; - break; - - case SL_PP_MODULO: - s = "%"; - break; - - case SL_PP_LSHIFTASSIGN: - s = "<<="; - break; - - case SL_PP_LSHIFT: - s = "<<"; - break; - - case SL_PP_LESSEQUAL: - s = "<="; - break; - - case SL_PP_LESS: - s = "<"; - break; - - case SL_PP_RSHIFTASSIGN: - s = ">>="; - break; - - case SL_PP_RSHIFT: - s = ">>"; - break; - - case SL_PP_GREATEREQUAL: - s = ">="; - break; - - case SL_PP_GREATER: - s = ">"; - break; - - case SL_PP_EQUAL: - s = "=="; - break; - - case SL_PP_ASSIGN: - s = "="; - break; - - case SL_PP_AND: - s = "&&"; - break; - - case SL_PP_BITANDASSIGN: - s = "&="; - break; - - case SL_PP_BITAND: - s = "&"; - break; - - case SL_PP_XOR: - s = "^^"; - break; - - case SL_PP_BITXORASSIGN: - s = "^="; - break; - - case SL_PP_BITXOR: - s = "^"; - break; - - case SL_PP_OR: - s = "||"; - break; - - case SL_PP_BITORASSIGN: - s = "|="; - break; - - case SL_PP_BITOR: - s = "|"; - break; - - case SL_PP_QUESTION: - s = "?"; - break; - - case SL_PP_COLON: - s = ":"; - break; - - case SL_PP_IDENTIFIER: - s = sl_pp_context_cstr(context, input[i].data.identifier); - break; - - case SL_PP_UINT: - s = sl_pp_context_cstr(context, input[i].data._uint); - break; - - case SL_PP_FLOAT: - s = sl_pp_context_cstr(context, input[i].data._float); - break; - - case SL_PP_OTHER: - buf[0] = input[i].data.other; - buf[1] = '\0'; - s = buf; - break; - - default: - strcpy(context->error_msg, "internal error"); - return; - } - - while (*s != '\0' && out_len < sizeof(context->error_msg) - 1) { - context->error_msg[out_len++] = *s++; - } - } - - context->error_msg[out_len] = '\0'; -} diff --git a/mesalib/src/glsl/pp/sl_pp_expression.c b/mesalib/src/glsl/pp/sl_pp_expression.c deleted file mode 100644 index ec904787d..000000000 --- a/mesalib/src/glsl/pp/sl_pp_expression.c +++ /dev/null @@ -1,411 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_expression.h" -#include "sl_pp_public.h" - - -struct parse_context { - struct sl_pp_context *context; - const struct sl_pp_token_info *input; -}; - -static int -_parse_or(struct parse_context *ctx, - int *result); - -static int -_parse_primary(struct parse_context *ctx, - int *result) -{ - if (ctx->input->token == SL_PP_UINT) { - *result = atoi(sl_pp_context_cstr(ctx->context, ctx->input->data._uint)); - ctx->input++; - } else { - if (ctx->input->token != SL_PP_LPAREN) { - strcpy(ctx->context->error_msg, "expected `('"); - return -1; - } - ctx->input++; - if (_parse_or(ctx, result)) { - return -1; - } - if (ctx->input->token != SL_PP_RPAREN) { - strcpy(ctx->context->error_msg, "expected `)'"); - return -1; - } - ctx->input++; - } - return 0; -} - -static int -_parse_unary(struct parse_context *ctx, - int *result) -{ - if (!_parse_primary(ctx, result)) { - return 0; - } - - switch (ctx->input->token) { - case SL_PP_PLUS: - ctx->input++; - if (_parse_unary(ctx, result)) { - return -1; - } - *result = +*result; - break; - - case SL_PP_MINUS: - ctx->input++; - if (_parse_unary(ctx, result)) { - return -1; - } - *result = -*result; - break; - - case SL_PP_NOT: - ctx->input++; - if (_parse_unary(ctx, result)) { - return -1; - } - *result = !*result; - break; - - case SL_PP_BITNOT: - ctx->input++; - if (_parse_unary(ctx, result)) { - return -1; - } - *result = ~*result; - break; - - default: - return -1; - } - - return 0; -} - -static int -_parse_multiplicative(struct parse_context *ctx, - int *result) -{ - if (_parse_unary(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_STAR: - ctx->input++; - if (_parse_unary(ctx, &right)) { - return -1; - } - *result = *result * right; - break; - - case SL_PP_SLASH: - ctx->input++; - if (_parse_unary(ctx, &right)) { - return -1; - } - *result = *result / right; - break; - - case SL_PP_MODULO: - ctx->input++; - if (_parse_unary(ctx, &right)) { - return -1; - } - *result = *result % right; - break; - - default: - return 0; - } - } -} - -static int -_parse_additive(struct parse_context *ctx, - int *result) -{ - if (_parse_multiplicative(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_PLUS: - ctx->input++; - if (_parse_multiplicative(ctx, &right)) { - return -1; - } - *result = *result + right; - break; - - case SL_PP_MINUS: - ctx->input++; - if (_parse_multiplicative(ctx, &right)) { - return -1; - } - *result = *result - right; - break; - - default: - return 0; - } - } -} - -static int -_parse_shift(struct parse_context *ctx, - int *result) -{ - if (_parse_additive(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_LSHIFT: - ctx->input++; - if (_parse_additive(ctx, &right)) { - return -1; - } - *result = *result << right; - break; - - case SL_PP_RSHIFT: - ctx->input++; - if (_parse_additive(ctx, &right)) { - return -1; - } - *result = *result >> right; - break; - - default: - return 0; - } - } -} - -static int -_parse_relational(struct parse_context *ctx, - int *result) -{ - if (_parse_shift(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_LESSEQUAL: - ctx->input++; - if (_parse_shift(ctx, &right)) { - return -1; - } - *result = *result <= right; - break; - - case SL_PP_GREATEREQUAL: - ctx->input++; - if (_parse_shift(ctx, &right)) { - return -1; - } - *result = *result >= right; - break; - - case SL_PP_LESS: - ctx->input++; - if (_parse_shift(ctx, &right)) { - return -1; - } - *result = *result < right; - break; - - case SL_PP_GREATER: - ctx->input++; - if (_parse_shift(ctx, &right)) { - return -1; - } - *result = *result > right; - break; - - default: - return 0; - } - } -} - -static int -_parse_equality(struct parse_context *ctx, - int *result) -{ - if (_parse_relational(ctx, result)) { - return -1; - } - for (;;) { - int right; - - switch (ctx->input->token) { - case SL_PP_EQUAL: - ctx->input++; - if (_parse_relational(ctx, &right)) { - return -1; - } - *result = *result == right; - break; - - case SL_PP_NOTEQUAL: - ctx->input++; - if (_parse_relational(ctx, &right)) { - return -1; - } - *result = *result != right; - break; - - default: - return 0; - } - } -} - -static int -_parse_bitand(struct parse_context *ctx, - int *result) -{ - if (_parse_equality(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_BITAND) { - int right; - - ctx->input++; - if (_parse_equality(ctx, &right)) { - return -1; - } - *result = *result & right; - } - return 0; -} - -static int -_parse_xor(struct parse_context *ctx, - int *result) -{ - if (_parse_bitand(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_XOR) { - int right; - - ctx->input++; - if (_parse_bitand(ctx, &right)) { - return -1; - } - *result = *result ^ right; - } - return 0; -} - -static int -_parse_bitor(struct parse_context *ctx, - int *result) -{ - if (_parse_xor(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_BITOR) { - int right; - - ctx->input++; - if (_parse_xor(ctx, &right)) { - return -1; - } - *result = *result | right; - } - return 0; -} - -static int -_parse_and(struct parse_context *ctx, - int *result) -{ - if (_parse_bitor(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_AND) { - int right; - - ctx->input++; - if (_parse_bitor(ctx, &right)) { - return -1; - } - *result = *result && right; - } - return 0; -} - -static int -_parse_or(struct parse_context *ctx, - int *result) -{ - if (_parse_and(ctx, result)) { - return -1; - } - while (ctx->input->token == SL_PP_OR) { - int right; - - ctx->input++; - if (_parse_and(ctx, &right)) { - return -1; - } - *result = *result || right; - } - return 0; -} - -int -sl_pp_execute_expression(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - int *result) -{ - struct parse_context ctx; - - ctx.context = context; - ctx.input = input; - - return _parse_or(&ctx, result); -} diff --git a/mesalib/src/glsl/pp/sl_pp_expression.h b/mesalib/src/glsl/pp/sl_pp_expression.h deleted file mode 100644 index 377d5b4cb..000000000 --- a/mesalib/src/glsl/pp/sl_pp_expression.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_PP_EXPRESSION_H -#define SL_PP_EXPRESSION_H - -#include "sl_pp_context.h" -#include "sl_pp_token.h" - - -int -sl_pp_execute_expression(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - int *result); - -#endif /* SL_PP_EXPRESSION_H */ diff --git a/mesalib/src/glsl/pp/sl_pp_extension.c b/mesalib/src/glsl/pp/sl_pp_extension.c deleted file mode 100644 index d119677c2..000000000 --- a/mesalib/src/glsl/pp/sl_pp_extension.c +++ /dev/null @@ -1,178 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_context.h" -#include "sl_pp_process.h" -#include "sl_pp_public.h" - - -/** - * Declare an extension to the preprocessor. This tells the preprocessor - * which extensions are supported by Mesa. - * The shader still needs to have a "#extension name: behavior" line to enable - * the extension. - */ -int -sl_pp_context_add_extension(struct sl_pp_context *context, - const char *name) -{ - struct sl_pp_extension ext; - - if (context->num_extensions == SL_PP_MAX_EXTENSIONS) { - return -1; - } - - ext.name = sl_pp_context_add_unique_str(context, name); - if (ext.name == -1) { - return -1; - } - - context->extensions[context->num_extensions++] = ext; - - assert(context->num_extensions <= sizeof(context->extensions)); - - return 0; -} - - -/** - * Process a "#extension name: behavior" directive. - */ -int -sl_pp_process_extension(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last, - struct sl_pp_process_state *state) -{ - int extension_name = -1; - int behavior = -1; - struct sl_pp_token_info out; - - /* Grab the extension name. */ - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - extension_name = input[first].data.identifier; - first++; - } - if (extension_name == -1) { - strcpy(context->error_msg, "expected identifier after `#extension'"); - return -1; - } - - /* Make sure the extension is supported. */ - if (extension_name == context->dict.all) { - out.data.extension = extension_name; - } else { - unsigned int i; - - out.data.extension = -1; - for (i = 0; i < context->num_extensions; i++) { - if (extension_name == context->extensions[i].name) { - out.data.extension = extension_name; - break; - } - } - } - - /* Grab the colon separating the extension name and behavior. */ - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - if (first < last && input[first].token == SL_PP_COLON) { - first++; - } else { - strcpy(context->error_msg, "expected `:' after extension name"); - return -1; - } - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - - /* Grab the behavior name. */ - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - behavior = input[first].data.identifier; - first++; - } - if (behavior == -1) { - strcpy(context->error_msg, "expected identifier after `:'"); - return -1; - } - - if (behavior == context->dict.require) { - if (out.data.extension == -1) { - strcpy(context->error_msg, "the required extension is not supported"); - return -1; - } - if (out.data.extension == context->dict.all) { - strcpy(context->error_msg, "invalid behavior for `all' extension: `require'"); - return -1; - } - out.token = SL_PP_EXTENSION_REQUIRE; - } else if (behavior == context->dict.enable) { - if (out.data.extension == -1) { - /* Warning: the extension cannot be enabled. */ - return 0; - } - if (out.data.extension == context->dict.all) { - strcpy(context->error_msg, "invalid behavior for `all' extension: `enable'"); - return -1; - } - out.token = SL_PP_EXTENSION_ENABLE; - } else if (behavior == context->dict.warn) { - if (out.data.extension == -1) { - /* Warning: the extension is not supported. */ - return 0; - } - out.token = SL_PP_EXTENSION_WARN; - } else if (behavior == context->dict.disable) { - if (out.data.extension == -1) { - /* Warning: the extension is not supported. */ - return 0; - } - out.token = SL_PP_EXTENSION_DISABLE; - } else { - strcpy(context->error_msg, "unrecognised behavior name"); - return -1; - } - - /* Grab the end of line. */ - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - if (first < last) { - strcpy(context->error_msg, "expected end of line after behavior name"); - return -1; - } - - if (sl_pp_process_out(state, &out)) { - return -1; - } - - return 0; -} diff --git a/mesalib/src/glsl/pp/sl_pp_if.c b/mesalib/src/glsl/pp/sl_pp_if.c deleted file mode 100644 index 25cb7a3ca..000000000 --- a/mesalib/src/glsl/pp/sl_pp_if.c +++ /dev/null @@ -1,340 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_expression.h" -#include "sl_pp_process.h" - - -static int -_macro_is_defined(struct sl_pp_context *context, - int macro_name) -{ - unsigned int i; - struct sl_pp_macro *macro; - - for (i = 0; i < context->num_extensions; i++) { - if (macro_name == context->extensions[i].name) { - return 1; - } - } - - for (macro = context->macro; macro; macro = macro->next) { - if (macro_name == macro->name) { - return 1; - } - } - - return 0; -} - -static int -_parse_defined(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer, - struct sl_pp_process_state *state) -{ - struct sl_pp_token_info input; - int parens = 0; - int defined; - struct sl_pp_token_info result; - - if (sl_pp_token_buffer_skip_white(buffer, &input)) { - return -1; - } - - if (input.token == SL_PP_LPAREN) { - if (sl_pp_token_buffer_skip_white(buffer, &input)) { - return -1; - } - parens = 1; - } - - if (input.token != SL_PP_IDENTIFIER) { - strcpy(context->error_msg, "expected an identifier"); - return -1; - } - - defined = _macro_is_defined(context, input.data.identifier); - - if (parens) { - if (sl_pp_token_buffer_skip_white(buffer, &input)) { - return -1; - } - if (input.token != SL_PP_RPAREN) { - strcpy(context->error_msg, "expected `)'"); - return -1; - } - } - - result.token = SL_PP_UINT; - result.data._uint = (defined ? context->dict._1 : context->dict._0); - - if (sl_pp_process_out(state, &result)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - return 0; -} - -static unsigned int -_evaluate_if_stack(struct sl_pp_context *context) -{ - unsigned int i; - - for (i = context->if_ptr; i < SL_PP_MAX_IF_NESTING; i++) { - if (!context->if_stack[i].u.condition) { - return 0; - } - } - return 1; -} - -static int -_parse_if(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer) -{ - struct sl_pp_process_state state; - int found_end = 0; - struct sl_pp_token_info eof; - int result; - - if (!context->if_ptr) { - strcpy(context->error_msg, "`#if' nesting too deep"); - return -1; - } - - memset(&state, 0, sizeof(state)); - while (!found_end) { - struct sl_pp_token_info input; - - sl_pp_token_buffer_get(buffer, &input); - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_IDENTIFIER: - if (input.data.identifier == context->dict.defined) { - if (_parse_defined(context, buffer, &state)) { - free(state.out); - return -1; - } - } else { - sl_pp_token_buffer_unget(buffer, &input); - if (sl_pp_macro_expand(context, buffer, NULL, &state, sl_pp_macro_expand_unknown_to_0)) { - free(state.out); - return -1; - } - } - break; - - case SL_PP_NEWLINE: - case SL_PP_EOF: - found_end = 1; - break; - - default: - if (sl_pp_process_out(&state, &input)) { - strcpy(context->error_msg, "out of memory"); - free(state.out); - return -1; - } - } - } - - eof.token = SL_PP_EOF; - if (sl_pp_process_out(&state, &eof)) { - strcpy(context->error_msg, "out of memory"); - free(state.out); - return -1; - } - - if (sl_pp_execute_expression(context, state.out, &result)) { - free(state.out); - return -1; - } - - free(state.out); - - context->if_ptr--; - context->if_stack[context->if_ptr].value = 0; - context->if_stack[context->if_ptr].u.condition = result ? 1 : 0; - context->if_value = _evaluate_if_stack(context); - - return 0; -} - -static int -_parse_else(struct sl_pp_context *context) -{ - union sl_pp_if_state *state = &context->if_stack[context->if_ptr]; - - if (context->if_ptr == SL_PP_MAX_IF_NESTING) { - strcpy(context->error_msg, "no matching `#if'"); - return -1; - } - - if (state->u.went_thru_else) { - strcpy(context->error_msg, "no matching `#if'"); - return -1; - } - - /* Once we had a true condition, the subsequent #elifs should always be false. */ - state->u.had_true_cond |= state->u.condition; - - /* Update current condition value and mark that we are in the #else block. */ - state->u.condition = !(state->u.had_true_cond | state->u.condition); - state->u.went_thru_else = 1; - context->if_value = _evaluate_if_stack(context); - - return 0; -} - -int -sl_pp_process_if(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer) -{ - return _parse_if(context, buffer); -} - -int -sl_pp_process_ifdef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - unsigned int i; - - if (!context->if_ptr) { - strcpy(context->error_msg, "`#if' nesting too deep"); - return -1; - } - - for (i = first; i < last; i++) { - switch (input[i].token) { - case SL_PP_IDENTIFIER: - context->if_ptr--; - context->if_stack[context->if_ptr].value = 0; - context->if_stack[context->if_ptr].u.condition = _macro_is_defined(context, input[i].data.identifier); - context->if_value = _evaluate_if_stack(context); - return 0; - - case SL_PP_WHITESPACE: - break; - - default: - strcpy(context->error_msg, "expected an identifier"); - return -1; - } - } - - strcpy(context->error_msg, "expected an identifier"); - return -1; -} - -int -sl_pp_process_ifndef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - unsigned int i; - - if (!context->if_ptr) { - strcpy(context->error_msg, "`#if' nesting too deep"); - return -1; - } - - for (i = first; i < last; i++) { - switch (input[i].token) { - case SL_PP_IDENTIFIER: - context->if_ptr--; - context->if_stack[context->if_ptr].value = 0; - context->if_stack[context->if_ptr].u.condition = !_macro_is_defined(context, input[i].data.identifier); - context->if_value = _evaluate_if_stack(context); - return 0; - - case SL_PP_WHITESPACE: - break; - - default: - strcpy(context->error_msg, "expected an identifier"); - return -1; - } - } - - strcpy(context->error_msg, "expected an identifier"); - return -1; -} - -int -sl_pp_process_elif(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer) -{ - if (_parse_else(context)) { - return -1; - } - - if (context->if_stack[context->if_ptr].u.condition) { - context->if_ptr++; - if (_parse_if(context, buffer)) { - return -1; - } - } - - /* We are still in the #if block. */ - context->if_stack[context->if_ptr].u.went_thru_else = 0; - - return 0; -} - -int -sl_pp_process_else(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - return _parse_else(context); -} - -int -sl_pp_process_endif(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last) -{ - if (context->if_ptr == SL_PP_MAX_IF_NESTING) { - strcpy(context->error_msg, "no matching `#if'"); - return -1; - } - - context->if_ptr++; - context->if_value = _evaluate_if_stack(context); - - return 0; -} diff --git a/mesalib/src/glsl/pp/sl_pp_line.c b/mesalib/src/glsl/pp/sl_pp_line.c deleted file mode 100644 index 6f7e9eb56..000000000 --- a/mesalib/src/glsl/pp/sl_pp_line.c +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_context.h" -#include "sl_pp_public.h" -#include "sl_pp_process.h" - - -int -sl_pp_process_line(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer, - struct sl_pp_process_state *pstate) -{ - struct sl_pp_process_state state; - int found_end = 0; - int line_number = -1; - int file_number = -1; - unsigned int line; - unsigned int file; - - memset(&state, 0, sizeof(state)); - while (!found_end) { - struct sl_pp_token_info input; - - sl_pp_token_buffer_get(buffer, &input); - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_IDENTIFIER: - sl_pp_token_buffer_unget(buffer, &input); - if (sl_pp_macro_expand(context, buffer, NULL, &state, sl_pp_macro_expand_normal)) { - free(state.out); - return -1; - } - break; - - case SL_PP_NEWLINE: - case SL_PP_EOF: - found_end = 1; - break; - - default: - if (sl_pp_process_out(&state, &input)) { - strcpy(context->error_msg, "out of memory"); - free(state.out); - return -1; - } - } - } - - if (state.out_len > 0 && state.out[0].token == SL_PP_UINT) { - line_number = state.out[0].data._uint; - } else { - strcpy(context->error_msg, "expected a number after `#line'"); - free(state.out); - return -1; - } - - if (state.out_len > 1) { - if (state.out[1].token == SL_PP_UINT) { - file_number = state.out[1].data._uint; - } else { - strcpy(context->error_msg, "expected a number after line number"); - free(state.out); - return -1; - } - - if (state.out_len > 2) { - strcpy(context->error_msg, "expected an end of line after file number"); - free(state.out); - return -1; - } - } - - free(state.out); - - line = atoi(sl_pp_context_cstr(context, line_number)); - if (file_number != -1) { - file = atoi(sl_pp_context_cstr(context, file_number)); - } else { - file = context->file; - } - - if (context->line != line || context->file != file) { - struct sl_pp_token_info ti; - - ti.token = SL_PP_LINE; - ti.data.line.lineno = line; - ti.data.line.fileno = file; - if (sl_pp_process_out(pstate, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - context->line = line; - context->file = file; - } - - return 0; -} diff --git a/mesalib/src/glsl/pp/sl_pp_macro.c b/mesalib/src/glsl/pp/sl_pp_macro.c deleted file mode 100644 index 9f520b8fc..000000000 --- a/mesalib/src/glsl/pp/sl_pp_macro.c +++ /dev/null @@ -1,414 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include "sl_pp_context.h" -#include "sl_pp_public.h" -#include "sl_pp_macro.h" -#include "sl_pp_process.h" - - -static void -_macro_init(struct sl_pp_macro *macro) -{ - macro->name = -1; - macro->num_args = -1; - macro->arg = NULL; - macro->body = NULL; -} - -struct sl_pp_macro * -sl_pp_macro_new(void) -{ - struct sl_pp_macro *macro; - - macro = calloc(1, sizeof(struct sl_pp_macro)); - if (macro) { - _macro_init(macro); - } - return macro; -} - -static void -_macro_destroy(struct sl_pp_macro *macro) -{ - struct sl_pp_macro_formal_arg *arg = macro->arg; - - while (arg) { - struct sl_pp_macro_formal_arg *next_arg = arg->next; - - free(arg); - arg = next_arg; - } - - free(macro->body); -} - -void -sl_pp_macro_free(struct sl_pp_macro *macro) -{ - while (macro) { - struct sl_pp_macro *next_macro = macro->next; - - _macro_destroy(macro); - free(macro); - macro = next_macro; - } -} - -void -sl_pp_macro_reset(struct sl_pp_macro *macro) -{ - _macro_destroy(macro); - _macro_init(macro); -} - -static int -_out_number(struct sl_pp_context *context, - struct sl_pp_process_state *state, - unsigned int number) -{ - char buf[32]; - struct sl_pp_token_info ti; - - sprintf(buf, "%u", number); - - ti.token = SL_PP_UINT; - ti.data._uint = sl_pp_context_add_unique_str(context, buf); - if (sl_pp_process_out(state, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - return 0; -} - -int -sl_pp_macro_expand(struct sl_pp_context *context, - struct sl_pp_token_buffer *tokens, - struct sl_pp_macro *local, - struct sl_pp_process_state *state, - enum sl_pp_macro_expand_behaviour behaviour) -{ - int mute = (behaviour == sl_pp_macro_expand_mute); - struct sl_pp_token_info input; - int macro_name; - struct sl_pp_macro *macro = NULL; - struct sl_pp_macro *actual_arg = NULL; - unsigned int j; - - if (sl_pp_token_buffer_get(tokens, &input)) { - return -1; - } - - if (input.token != SL_PP_IDENTIFIER) { - strcpy(context->error_msg, "expected an identifier"); - return -1; - } - - macro_name = input.data.identifier; - - /* First look for predefined macros. - */ - - if (macro_name == context->dict.___LINE__) { - if (!mute && _out_number(context, state, context->line)) { - return -1; - } - return 0; - } - if (macro_name == context->dict.___FILE__) { - if (!mute && _out_number(context, state, context->file)) { - return -1; - } - return 0; - } - if (macro_name == context->dict.___VERSION__) { - if (!mute && _out_number(context, state, 110)) { - return -1; - } - return 0; - } - - for (j = 0; j < context->num_predefined; j++) { - if (macro_name == context->predefined[j].name) { - if (!mute) { - struct sl_pp_token_info ti; - - ti.token = SL_PP_UINT; - ti.data._uint = context->predefined[j].value; - if (sl_pp_process_out(state, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } - return 0; - } - } - - /* Replace extension names with 1. - */ - for (j = 0; j < context->num_extensions; j++) { - if (macro_name == context->extensions[j].name) { - if (!mute && _out_number(context, state, 1)) { - return -1; - } - return 0; - } - } - - if (local) { - for (macro = local; macro; macro = macro->next) { - if (macro->name == macro_name) { - break; - } - } - } - - if (!macro) { - for (macro = context->macro; macro; macro = macro->next) { - if (macro->name == macro_name) { - break; - } - } - } - - if (!macro) { - if (behaviour == sl_pp_macro_expand_unknown_to_0) { - if (_out_number(context, state, 0)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } else if (!mute) { - if (sl_pp_process_out(state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } - return 0; - } - - if (macro->num_args >= 0) { - if (sl_pp_token_buffer_skip_white(tokens, &input)) { - return -1; - } - if (input.token != SL_PP_LPAREN) { - strcpy(context->error_msg, "expected `('"); - return -1; - } - if (sl_pp_token_buffer_skip_white(tokens, &input)) { - return -1; - } - sl_pp_token_buffer_unget(tokens, &input); - } - - if (macro->num_args > 0) { - struct sl_pp_macro_formal_arg *formal_arg = macro->arg; - struct sl_pp_macro **pmacro = &actual_arg; - - for (j = 0; j < (unsigned int)macro->num_args; j++) { - struct sl_pp_process_state arg_state; - int done = 0; - unsigned int paren_nesting = 0; - struct sl_pp_token_info eof; - - memset(&arg_state, 0, sizeof(arg_state)); - - while (!done) { - if (sl_pp_token_buffer_get(tokens, &input)) { - goto fail_arg; - } - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_COMMA: - if (!paren_nesting) { - if (j < (unsigned int)macro->num_args - 1) { - done = 1; - } else { - strcpy(context->error_msg, "too many actual macro arguments"); - goto fail_arg; - } - } else { - if (sl_pp_process_out(&arg_state, &input)) { - strcpy(context->error_msg, "out of memory"); - goto fail_arg; - } - } - break; - - case SL_PP_LPAREN: - paren_nesting++; - if (sl_pp_process_out(&arg_state, &input)) { - goto oom_arg; - } - break; - - case SL_PP_RPAREN: - if (!paren_nesting) { - if (j == (unsigned int)macro->num_args - 1) { - done = 1; - } else { - strcpy(context->error_msg, "too few actual macro arguments"); - goto fail_arg; - } - } else { - paren_nesting--; - if (sl_pp_process_out(&arg_state, &input)) { - goto oom_arg; - } - } - break; - - case SL_PP_IDENTIFIER: - sl_pp_token_buffer_unget(tokens, &input); - if (sl_pp_macro_expand(context, tokens, local, &arg_state, sl_pp_macro_expand_normal)) { - goto fail_arg; - } - break; - - case SL_PP_EOF: - strcpy(context->error_msg, "too few actual macro arguments"); - goto fail_arg; - - default: - if (sl_pp_process_out(&arg_state, &input)) { - goto oom_arg; - } - } - } - - eof.token = SL_PP_EOF; - if (sl_pp_process_out(&arg_state, &eof)) { - goto oom_arg; - } - - *pmacro = sl_pp_macro_new(); - if (!*pmacro) { - goto oom_arg; - } - - (**pmacro).name = formal_arg->name; - (**pmacro).body = arg_state.out; - - formal_arg = formal_arg->next; - pmacro = &(**pmacro).next; - - continue; - -oom_arg: - strcpy(context->error_msg, "out of memory"); -fail_arg: - free(arg_state.out); - goto fail; - } - } - - /* Right paren for non-empty argument list has already been eaten. */ - if (macro->num_args == 0) { - if (sl_pp_token_buffer_skip_white(tokens, &input)) { - goto fail; - } - if (input.token != SL_PP_RPAREN) { - strcpy(context->error_msg, "expected `)'"); - goto fail; - } - } - - /* XXX: This is all wrong, we should be ungetting all tokens - * back to the main token buffer. - */ - { - struct sl_pp_token_buffer buffer; - - /* Seek to the end. - */ - for (j = 0; macro->body[j].token != SL_PP_EOF; j++) { - } - j++; - - /* Create a context-less token buffer since we are not going to underrun - * its internal buffer. - */ - if (sl_pp_token_buffer_init(&buffer, NULL)) { - strcpy(context->error_msg, "out of memory"); - goto fail; - } - - /* Unget the tokens in reverse order so later they will be fetched correctly. - */ - for (; j > 0; j--) { - sl_pp_token_buffer_unget(&buffer, ¯o->body[j - 1]); - } - - /* Expand. - */ - for (;;) { - struct sl_pp_token_info input; - - sl_pp_token_buffer_get(&buffer, &input); - switch (input.token) { - case SL_PP_NEWLINE: - if (sl_pp_process_out(state, &input)) { - strcpy(context->error_msg, "out of memory"); - sl_pp_token_buffer_destroy(&buffer); - goto fail; - } - break; - - case SL_PP_IDENTIFIER: - sl_pp_token_buffer_unget(&buffer, &input); - if (sl_pp_macro_expand(context, &buffer, actual_arg, state, behaviour)) { - sl_pp_token_buffer_destroy(&buffer); - goto fail; - } - break; - - case SL_PP_EOF: - sl_pp_token_buffer_destroy(&buffer); - sl_pp_macro_free(actual_arg); - return 0; - - default: - if (!mute) { - if (sl_pp_process_out(state, &input)) { - strcpy(context->error_msg, "out of memory"); - sl_pp_token_buffer_destroy(&buffer); - goto fail; - } - } - } - } - } - -fail: - sl_pp_macro_free(actual_arg); - return -1; -} diff --git a/mesalib/src/glsl/pp/sl_pp_macro.h b/mesalib/src/glsl/pp/sl_pp_macro.h deleted file mode 100644 index 1d2106810..000000000 --- a/mesalib/src/glsl/pp/sl_pp_macro.h +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_PP_MACRO_H -#define SL_PP_MACRO_H - -#include "sl_pp_token.h" - - -struct sl_pp_context; -struct sl_pp_process_state; -struct sl_pp_token_buffer; - -struct sl_pp_macro_formal_arg { - int name; - struct sl_pp_macro_formal_arg *next; -}; - -struct sl_pp_macro { - int name; - int num_args; /* -1 means no args, 0 means `()' */ - struct sl_pp_macro_formal_arg *arg; - struct sl_pp_token_info *body; - struct sl_pp_macro *next; -}; - -struct sl_pp_macro * -sl_pp_macro_new(void); - -void -sl_pp_macro_free(struct sl_pp_macro *macro); - -void -sl_pp_macro_reset(struct sl_pp_macro *macro); - -enum sl_pp_macro_expand_behaviour { - sl_pp_macro_expand_normal, - sl_pp_macro_expand_mute, - sl_pp_macro_expand_unknown_to_0 -}; - -int -sl_pp_macro_expand(struct sl_pp_context *context, - struct sl_pp_token_buffer *tokens, - struct sl_pp_macro *local, - struct sl_pp_process_state *state, - enum sl_pp_macro_expand_behaviour behaviour); - -#endif /* SL_PP_MACRO_H */ diff --git a/mesalib/src/glsl/pp/sl_pp_pragma.c b/mesalib/src/glsl/pp/sl_pp_pragma.c deleted file mode 100644 index caf4c63f6..000000000 --- a/mesalib/src/glsl/pp/sl_pp_pragma.c +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_context.h" -#include "sl_pp_process.h" - - -int -sl_pp_process_pragma(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last, - struct sl_pp_process_state *state) -{ - int pragma_name = -1; - struct sl_pp_token_info out; - int arg_name = -1; - - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - pragma_name = input[first].data.identifier; - first++; - } - if (pragma_name == -1) { - return 0; - } - - if (pragma_name == context->dict.optimize) { - out.token = SL_PP_PRAGMA_OPTIMIZE; - } else if (pragma_name == context->dict.debug) { - out.token = SL_PP_PRAGMA_DEBUG; - } else { - return 0; - } - - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - - if (first < last && input[first].token == SL_PP_LPAREN) { - first++; - } else { - return 0; - } - - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - - if (first < last && input[first].token == SL_PP_IDENTIFIER) { - arg_name = input[first].data.identifier; - first++; - } - if (arg_name == -1) { - return 0; - } - - if (arg_name == context->dict.off) { - out.data.pragma = 0; - } else if (arg_name == context->dict.on) { - out.data.pragma = 1; - } else { - return 0; - } - - while (first < last && input[first].token == SL_PP_WHITESPACE) { - first++; - } - - if (first < last && input[first].token == SL_PP_RPAREN) { - first++; - } else { - return 0; - } - - /* Ignore the tokens that follow. */ - - if (sl_pp_process_out(state, &out)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - return 0; -} diff --git a/mesalib/src/glsl/pp/sl_pp_process.c b/mesalib/src/glsl/pp/sl_pp_process.c deleted file mode 100644 index 315ad9bf1..000000000 --- a/mesalib/src/glsl/pp/sl_pp_process.c +++ /dev/null @@ -1,328 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_context.h" -#include "sl_pp_process.h" -#include "sl_pp_public.h" - - -int -sl_pp_process_out(struct sl_pp_process_state *state, - const struct sl_pp_token_info *token) -{ - if (state->out_len >= state->out_max) { - unsigned int new_max = state->out_max; - - if (new_max < 0x100) { - new_max = 0x100; - } else if (new_max < 0x10000) { - new_max *= 2; - } else { - new_max += 0x10000; - } - - state->out = realloc(state->out, new_max * sizeof(struct sl_pp_token_info)); - if (!state->out) { - return -1; - } - state->out_max = new_max; - } - - state->out[state->out_len++] = *token; - return 0; -} - -int -sl_pp_process_get(struct sl_pp_context *context, - struct sl_pp_token_info *output) -{ - if (!context->process_state.out) { - if (context->line > 1) { - struct sl_pp_token_info ti; - - ti.token = SL_PP_LINE; - ti.data.line.lineno = context->line - 1; - ti.data.line.fileno = context->file; - if (sl_pp_process_out(&context->process_state, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - - ti.token = SL_PP_NEWLINE; - if (sl_pp_process_out(&context->process_state, &ti)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } - } - - for (;;) { - struct sl_pp_token_info input; - int found_eof = 0; - - if (context->process_state.out_len) { - assert(context->process_state.out); - *output = context->process_state.out[0]; - - if (context->process_state.out_len > 1) { - unsigned int i; - - for (i = 1; i < context->process_state.out_len; i++) { - context->process_state.out[i - 1] = context->process_state.out[i]; - } - } - context->process_state.out_len--; - - return 0; - } - - if (sl_pp_token_buffer_skip_white(&context->tokens, &input)) { - return -1; - } - if (input.token == SL_PP_HASH) { - if (sl_pp_token_buffer_skip_white(&context->tokens, &input)) { - return -1; - } - switch (input.token) { - case SL_PP_IDENTIFIER: - { - int name; - int found_eol = 0; - struct sl_pp_token_info endof; - struct sl_pp_token_peek peek; - int result = 0; - - /* Directive name. */ - name = input.data.identifier; - - if (sl_pp_token_buffer_skip_white(&context->tokens, &input)) { - return -1; - } - sl_pp_token_buffer_unget(&context->tokens, &input); - - if (sl_pp_token_peek_init(&peek, &context->tokens)) { - return -1; - } - - while (!found_eol) { - if (sl_pp_token_peek_get(&peek, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - switch (input.token) { - case SL_PP_NEWLINE: - /* Preserve newline just for the sake of line numbering. */ - endof = input; - found_eol = 1; - break; - - case SL_PP_EOF: - endof = input; - found_eof = 1; - found_eol = 1; - break; - - default: - break; - } - } - - if (name == context->dict._if) { - struct sl_pp_token_buffer buffer; - - result = sl_pp_token_peek_to_buffer(&peek, &buffer); - if (result == 0) { - result = sl_pp_process_if(context, &buffer); - sl_pp_token_buffer_destroy(&buffer); - } - } else if (name == context->dict.ifdef) { - result = sl_pp_process_ifdef(context, peek.tokens, 0, peek.size - 1); - } else if (name == context->dict.ifndef) { - result = sl_pp_process_ifndef(context, peek.tokens, 0, peek.size - 1); - } else if (name == context->dict.elif) { - struct sl_pp_token_buffer buffer; - - result = sl_pp_token_peek_to_buffer(&peek, &buffer); - if (result == 0) { - result = sl_pp_process_elif(context, &buffer); - sl_pp_token_buffer_destroy(&buffer); - } - } else if (name == context->dict._else) { - result = sl_pp_process_else(context, peek.tokens, 0, peek.size - 1); - } else if (name == context->dict.endif) { - result = sl_pp_process_endif(context, peek.tokens, 0, peek.size - 1); - } else if (context->if_value) { - if (name == context->dict.define) { - result = sl_pp_process_define(context, peek.tokens, 0, peek.size - 1); - } else if (name == context->dict.error) { - sl_pp_process_error(context, peek.tokens, 0, peek.size - 1); - result = -1; - } else if (name == context->dict.extension) { - result = sl_pp_process_extension(context, peek.tokens, 0, peek.size - 1, &context->process_state); - } else if (name == context->dict.line) { - struct sl_pp_token_buffer buffer; - - result = sl_pp_token_peek_to_buffer(&peek, &buffer); - if (result == 0) { - result = sl_pp_process_line(context, &buffer, &context->process_state); - sl_pp_token_buffer_destroy(&buffer); - } - } else if (name == context->dict.pragma) { - result = sl_pp_process_pragma(context, peek.tokens, 0, peek.size - 1, &context->process_state); - } else if (name == context->dict.undef) { - result = sl_pp_process_undef(context, peek.tokens, 0, peek.size - 1); - } else { - strcpy(context->error_msg, "unrecognised directive name"); - result = -1; - } - } - - sl_pp_token_peek_commit(&peek); - sl_pp_token_peek_destroy(&peek); - - if (result) { - return result; - } - - if (sl_pp_process_out(&context->process_state, &endof)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - context->line++; - } - break; - - case SL_PP_NEWLINE: - /* Empty directive. */ - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - context->line++; - break; - - case SL_PP_EOF: - /* Empty directive. */ - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - found_eof = 1; - break; - - default: - strcpy(context->error_msg, "expected a directive name"); - return -1; - } - } else { - int found_eol = 0; - - sl_pp_token_buffer_unget(&context->tokens, &input); - - while (!found_eol) { - if (sl_pp_token_buffer_get(&context->tokens, &input)) { - return -1; - } - - switch (input.token) { - case SL_PP_WHITESPACE: - /* Drop whitespace all together at this point. */ - break; - - case SL_PP_NEWLINE: - /* Preserve newline just for the sake of line numbering. */ - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - context->line++; - found_eol = 1; - break; - - case SL_PP_EOF: - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - found_eof = 1; - found_eol = 1; - break; - - case SL_PP_IDENTIFIER: - sl_pp_token_buffer_unget(&context->tokens, &input); - if (sl_pp_macro_expand(context, &context->tokens, NULL, &context->process_state, - context->if_value ? sl_pp_macro_expand_normal : sl_pp_macro_expand_mute)) { - return -1; - } - break; - - default: - if (context->if_value) { - if (sl_pp_process_out(&context->process_state, &input)) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - } - } - } - } - - if (found_eof) { - if (context->if_ptr != SL_PP_MAX_IF_NESTING) { - strcpy(context->error_msg, "expected `#endif' directive"); - return -1; - } - } - } -} - -int -sl_pp_process(struct sl_pp_context *context, - struct sl_pp_token_info **output) -{ - struct sl_pp_process_state state; - - memset(&state, 0, sizeof(state)); - for (;;) { - struct sl_pp_token_info input; - - if (sl_pp_process_get(context, &input)) { - free(state.out); - return -1; - } - if (sl_pp_process_out(&state, &input)) { - free(state.out); - return -1; - } - if (input.token == SL_PP_EOF) { - *output = state.out; - return 0; - } - } -} diff --git a/mesalib/src/glsl/pp/sl_pp_process.h b/mesalib/src/glsl/pp/sl_pp_process.h deleted file mode 100644 index fe6ff0d46..000000000 --- a/mesalib/src/glsl/pp/sl_pp_process.h +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_PP_PROCESS_H -#define SL_PP_PROCESS_H - -#include "sl_pp_macro.h" -#include "sl_pp_token.h" - - -struct sl_pp_context; - -struct sl_pp_process_state { - struct sl_pp_token_info *out; - unsigned int out_len; - unsigned int out_max; -}; - -int -sl_pp_process_define(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_undef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_if(struct sl_pp_context *context, - struct sl_pp_token_buffer *input); - -int -sl_pp_process_ifdef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_ifndef(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_elif(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer); - -int -sl_pp_process_else(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_endif(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -void -sl_pp_process_error(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last); - -int -sl_pp_process_pragma(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last, - struct sl_pp_process_state *state); - -int -sl_pp_process_extension(struct sl_pp_context *context, - const struct sl_pp_token_info *input, - unsigned int first, - unsigned int last, - struct sl_pp_process_state *state); - -int -sl_pp_process_line(struct sl_pp_context *context, - struct sl_pp_token_buffer *buffer, - struct sl_pp_process_state *state); - -int -sl_pp_process_out(struct sl_pp_process_state *state, - const struct sl_pp_token_info *token); - -#endif /* SL_PP_PROCESS_H */ diff --git a/mesalib/src/glsl/pp/sl_pp_public.h b/mesalib/src/glsl/pp/sl_pp_public.h deleted file mode 100644 index ca6f72254..000000000 --- a/mesalib/src/glsl/pp/sl_pp_public.h +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_PP_PUBLIC_H -#define SL_PP_PUBLIC_H - - -struct sl_pp_context; - - -#include "sl_pp_purify.h" -#include "sl_pp_token.h" - - -struct sl_pp_context * -sl_pp_context_create(const char *input, - const struct sl_pp_purify_options *options); - -void -sl_pp_context_destroy(struct sl_pp_context *context); - -const char * -sl_pp_context_error_message(const struct sl_pp_context *context); - -void -sl_pp_context_error_position(const struct sl_pp_context *context, - unsigned int *file, - unsigned int *line); - -int -sl_pp_context_add_extension(struct sl_pp_context *context, - const char *name); - -int -sl_pp_context_add_predefined(struct sl_pp_context *context, - const char *name, - const char *value); - -int -sl_pp_context_add_unique_str(struct sl_pp_context *context, - const char *str); - -const char * -sl_pp_context_cstr(const struct sl_pp_context *context, - int offset); - -int -sl_pp_version(struct sl_pp_context *context, - unsigned int *version); - -int -sl_pp_process_get(struct sl_pp_context *context, - struct sl_pp_token_info *output); - -int -sl_pp_process(struct sl_pp_context *context, - struct sl_pp_token_info **output); - -#endif /* SL_PP_PUBLIC_H */ diff --git a/mesalib/src/glsl/pp/sl_pp_purify.c b/mesalib/src/glsl/pp/sl_pp_purify.c deleted file mode 100644 index acc000cf3..000000000 --- a/mesalib/src/glsl/pp/sl_pp_purify.c +++ /dev/null @@ -1,302 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <stdarg.h> -#include <stdio.h> -#include "sl_pp_purify.h" - - -/* - * Preprocessor purifier performs the following tasks. - * - Convert all variants of newlines into a Unix newline. - * - Merge continued lines into a single long line. - * - Remove line comments and replace block comments with whitespace. - */ - - -static unsigned int -_purify_newline(const char *input, - char *out, - unsigned int *current_line) -{ - if (input[0] == '\n') { - *out = '\n'; - (*current_line)++; - if (input[1] == '\r') { - /* - * The GLSL spec is not explicit about whether this - * combination is a valid newline or not. - * Let's assume it is acceptable. - */ - return 2; - } - return 1; - } - if (input[0] == '\r') { - *out = '\n'; - (*current_line)++; - if (input[1] == '\n') { - return 2; - } - return 1; - } - *out = input[0]; - return 1; -} - - -static unsigned int -_purify_backslash(const char *input, - char *out, - unsigned int *current_line) -{ - unsigned int eaten = 0; - - for (;;) { - if (input[0] == '\\') { - char next; - unsigned int next_eaten; - unsigned int next_line = *current_line; - - eaten++; - input++; - - next_eaten = _purify_newline(input, &next, &next_line); - if (next == '\n') { - /* - * If this is really a line continuation sequence, eat - * it and do not exit the loop. - */ - eaten += next_eaten; - input += next_eaten; - *current_line = next_line; - } else { - /* - * It is an error to put anything between a backslash - * and a newline and still expect it to behave like a line - * continuation sequence. - * Even if it is an innocent whitespace. - */ - *out = '\\'; - break; - } - } else { - eaten += _purify_newline(input, out, current_line); - break; - } - } - return eaten; -} - - -static void -_report_error(char *buf, - unsigned int cbbuf, - const char *msg, - ...) -{ - va_list args; - - va_start(args, msg); - vsnprintf(buf, cbbuf, msg, args); - va_end(args); -} - - -void -sl_pp_purify_state_init(struct sl_pp_purify_state *state, - const char *input, - const struct sl_pp_purify_options *options) -{ - state->options = *options; - state->input = input; - state->current_line = 1; - state->inside_c_comment = 0; -} - - -static unsigned int -_purify_comment(struct sl_pp_purify_state *state, - char *output, - unsigned int *current_line, - char *errormsg, - unsigned int cberrormsg) -{ - for (;;) { - unsigned int eaten; - char next; - - eaten = _purify_backslash(state->input, &next, current_line); - state->input += eaten; - while (next == '*') { - eaten = _purify_backslash(state->input, &next, current_line); - state->input += eaten; - if (next == '/') { - *output = ' '; - state->inside_c_comment = 0; - return 1; - } - } - if (next == '\n') { - *output = '\n'; - state->inside_c_comment = 1; - return 1; - } - if (next == '\0') { - _report_error(errormsg, cberrormsg, "expected `*/' but end of translation unit found"); - return 0; - } - } -} - - -unsigned int -sl_pp_purify_getc(struct sl_pp_purify_state *state, - char *output, - unsigned int *current_line, - char *errormsg, - unsigned int cberrormsg) -{ - unsigned int eaten; - - if (state->inside_c_comment) { - return _purify_comment(state, output, current_line, errormsg, cberrormsg); - } - - eaten = _purify_backslash(state->input, output, current_line); - state->input += eaten; - if (*output == '/') { - char next; - unsigned int next_line = *current_line; - - eaten = _purify_backslash(state->input, &next, &next_line); - if (next == '/') { - state->input += eaten; - *current_line = next_line; - - /* Replace a line comment with either a newline or nil. */ - for (;;) { - eaten = _purify_backslash(state->input, &next, current_line); - state->input += eaten; - if (next == '\n' || next == '\0') { - *output = next; - return eaten; - } - } - } else if (next == '*') { - state->input += eaten; - *current_line = next_line; - - return _purify_comment(state, output, current_line, errormsg, cberrormsg); - } - } - return eaten; -} - - -struct out_buf { - char *out; - unsigned int len; - unsigned int capacity; - unsigned int current_line; - char *errormsg; - unsigned int cberrormsg; -}; - - -static int -_out_buf_putc(struct out_buf *obuf, - char c) -{ - if (obuf->len >= obuf->capacity) { - unsigned int new_max = obuf->capacity; - - if (new_max < 0x100) { - new_max = 0x100; - } else if (new_max < 0x10000) { - new_max *= 2; - } else { - new_max += 0x10000; - } - - obuf->out = realloc(obuf->out, new_max); - if (!obuf->out) { - _report_error(obuf->errormsg, obuf->cberrormsg, "out of memory"); - return -1; - } - obuf->capacity = new_max; - } - - obuf->out[obuf->len++] = c; - - return 0; -} - - -int -sl_pp_purify(const char *input, - const struct sl_pp_purify_options *options, - char **output, - char *errormsg, - unsigned int cberrormsg, - unsigned int *errorline) -{ - struct out_buf obuf; - struct sl_pp_purify_state state; - - obuf.out = NULL; - obuf.len = 0; - obuf.capacity = 0; - obuf.current_line = 1; - obuf.errormsg = errormsg; - obuf.cberrormsg = cberrormsg; - - sl_pp_purify_state_init(&state, input, options); - - for (;;) { - unsigned int eaten; - char c; - - eaten = sl_pp_purify_getc(&state, &c, &obuf.current_line, errormsg, cberrormsg); - if (!eaten) { - *errorline = obuf.current_line; - return -1; - } - if (_out_buf_putc(&obuf, c)) { - *errorline = obuf.current_line; - return -1; - } - - if (c == '\0') { - break; - } - } - - *output = obuf.out; - return 0; -} diff --git a/mesalib/src/glsl/pp/sl_pp_purify.h b/mesalib/src/glsl/pp/sl_pp_purify.h deleted file mode 100644 index c0f55cbfd..000000000 --- a/mesalib/src/glsl/pp/sl_pp_purify.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_PP_PURIFY_H -#define SL_PP_PURIFY_H - -struct sl_pp_purify_options { - unsigned int preserve_columns:1; - unsigned int tab_width:4; -}; - -int -sl_pp_purify(const char *input, - const struct sl_pp_purify_options *options, - char **output, - char *errormsg, - unsigned int cberrormsg, - unsigned int *errorline); - -struct sl_pp_purify_state { - struct sl_pp_purify_options options; - const char *input; - unsigned int current_line; - unsigned int inside_c_comment:1; -}; - -void -sl_pp_purify_state_init(struct sl_pp_purify_state *state, - const char *input, - const struct sl_pp_purify_options *options); - -unsigned int -sl_pp_purify_getc(struct sl_pp_purify_state *state, - char *output, - unsigned int *current_line, - char *errormsg, - unsigned int cberrormsg); - -#endif /* SL_PP_PURIFY_H */ diff --git a/mesalib/src/glsl/pp/sl_pp_token.c b/mesalib/src/glsl/pp/sl_pp_token.c deleted file mode 100644 index a70897870..000000000 --- a/mesalib/src/glsl/pp/sl_pp_token.c +++ /dev/null @@ -1,854 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <assert.h> -#include <stdlib.h> -#include <string.h> -#include "sl_pp_public.h" -#include "sl_pp_context.h" -#include "sl_pp_token.h" - - -#define PURE_ERROR 256 - -static int -_pure_getc(struct sl_pp_context *context) -{ - char c; - - if (context->getc_buf_size) { - return context->getc_buf[--context->getc_buf_size]; - } - - if (sl_pp_purify_getc(&context->pure, &c, &context->error_line, context->error_msg, sizeof(context->error_msg)) == 0) { - return PURE_ERROR; - } - return c; -} - - -static void -_pure_ungetc(struct sl_pp_context *context, - int c) -{ - assert(c != PURE_ERROR); - - if (context->getc_buf_size == context->getc_buf_capacity) { - context->getc_buf_capacity += 64; - context->getc_buf = realloc(context->getc_buf, context->getc_buf_capacity * sizeof(char)); - assert(context->getc_buf); - } - - context->getc_buf[context->getc_buf_size++] = (char)c; -} - - -struct lookahead_state { - char buf[256]; - unsigned int pos; - struct sl_pp_context *context; -}; - - -static void -_lookahead_init(struct lookahead_state *lookahead, - struct sl_pp_context *context) -{ - lookahead->pos = 0; - lookahead->context = context; -} - - -static unsigned int -_lookahead_tell(const struct lookahead_state *lookahead) -{ - return lookahead->pos; -} - - -static const void * -_lookahead_buf(const struct lookahead_state *lookahead) -{ - return lookahead->buf; -} - - -static void -_lookahead_revert(struct lookahead_state *lookahead, - unsigned int pos) -{ - assert(pos <= lookahead->pos); - - while (lookahead->pos > pos) { - _pure_ungetc(lookahead->context, lookahead->buf[--lookahead->pos]); - } -} - - -static int -_lookahead_getc(struct lookahead_state *lookahead) -{ - int c; - - assert(lookahead->pos < sizeof(lookahead->buf) / sizeof(lookahead->buf[0])); - - c = _pure_getc(lookahead->context); - if (c != PURE_ERROR) { - lookahead->buf[lookahead->pos++] = (char)c; - } - return c; -} - - -static int -_is_identifier_char(char c) -{ - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_'; -} - - -static int -_tokenise_identifier(struct sl_pp_context *context, - struct sl_pp_token_info *out) -{ - int c; - char identifier[256]; /* XXX: Remove this artifical limit. */ - unsigned int i = 0; - - out->token = SL_PP_IDENTIFIER; - out->data.identifier = -1; - - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - identifier[i++] = (char)c; - for (;;) { - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - - if (_is_identifier_char((char)c)) { - if (i >= sizeof(identifier) / sizeof(char) - 1) { - strcpy(context->error_msg, "out of memory"); - _pure_ungetc(context, c); - while (i) { - _pure_ungetc(context, identifier[--i]); - } - return -1; - } - identifier[i++] = (char)c; - } else { - _pure_ungetc(context, c); - break; - } - } - identifier[i] = '\0'; - - out->data.identifier = sl_pp_context_add_unique_str(context, identifier); - if (out->data.identifier == -1) { - while (i) { - _pure_ungetc(context, identifier[--i]); - } - return -1; - } - - return 0; -} - - -/* - * Return the number of consecutive decimal digits in the input stream. - */ -static unsigned int -_parse_float_digits(struct lookahead_state *lookahead) -{ - unsigned int eaten; - - for (eaten = 0;; eaten++) { - unsigned int pos = _lookahead_tell(lookahead); - char c = _lookahead_getc(lookahead); - - if (c < '0' || c > '9') { - _lookahead_revert(lookahead, pos); - break; - } - } - return eaten; -} - - -/* - * Try to match one of the following patterns for the fractional part - * of a floating point number. - * - * digits . [digits] - * . digits - * - * Return 0 if the pattern could not be matched, otherwise the number - * of eaten characters from the input stream. - */ -static unsigned int -_parse_float_frac(struct lookahead_state *lookahead) -{ - unsigned int pos; - int c; - unsigned int eaten; - - pos = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c == '.') { - eaten = _parse_float_digits(lookahead); - if (eaten) { - return eaten + 1; - } - _lookahead_revert(lookahead, pos); - return 0; - } - - _lookahead_revert(lookahead, pos); - eaten = _parse_float_digits(lookahead); - if (eaten) { - c = _lookahead_getc(lookahead); - if (c == '.') { - return eaten + 1 + _parse_float_digits(lookahead); - } - } - - _lookahead_revert(lookahead, pos); - return 0; -} - - -/* - * Try to match the following pattern for the exponential part - * of a floating point number. - * - * (e|E) [(+|-)] digits - * - * Return 0 if the pattern could not be matched, otherwise the number - * of eaten characters from the input stream. - */ -static unsigned int -_parse_float_exp(struct lookahead_state *lookahead) -{ - unsigned int pos, pos2; - int c; - unsigned int eaten, digits; - - pos = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c != 'e' && c != 'E') { - _lookahead_revert(lookahead, pos); - return 0; - } - - pos2 = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c == '-' || c == '+') { - eaten = 2; - } else { - _lookahead_revert(lookahead, pos2); - eaten = 1; - } - - digits = _parse_float_digits(lookahead); - if (!digits) { - _lookahead_revert(lookahead, pos); - return 0; - } - - return eaten + digits; -} - - -/* - * Try to match one of the following patterns for a floating point number. - * - * fract [exp] [(f|F)] - * digits exp [(f|F)] - * - * Return 0 if the pattern could not be matched, otherwise the number - * of eaten characters from the input stream. - */ -static unsigned int -_parse_float(struct lookahead_state *lookahead) -{ - unsigned int eaten; - - eaten = _parse_float_frac(lookahead); - if (eaten) { - unsigned int pos; - int c; - - eaten += _parse_float_exp(lookahead); - - pos = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c == 'f' || c == 'F') { - eaten++; - } else { - _lookahead_revert(lookahead, pos); - } - - return eaten; - } - - eaten = _parse_float_digits(lookahead); - if (eaten) { - unsigned int exponent; - - exponent = _parse_float_exp(lookahead); - if (exponent) { - unsigned int pos; - int c; - - eaten += exponent; - - pos = _lookahead_tell(lookahead); - c = _lookahead_getc(lookahead); - if (c == 'f' || c == 'F') { - eaten++; - } else { - _lookahead_revert(lookahead, pos); - } - - return eaten; - } - } - - _lookahead_revert(lookahead, 0); - return 0; -} - - -static unsigned int -_parse_hex(struct lookahead_state *lookahead) -{ - int c; - unsigned int n; - - c = _lookahead_getc(lookahead); - if (c != '0') { - _lookahead_revert(lookahead, 0); - return 0; - } - - c = _lookahead_getc(lookahead); - if (c != 'x' && c != 'X') { - _lookahead_revert(lookahead, 0); - return 0; - } - - for (n = 2;;) { - unsigned int pos = _lookahead_tell(lookahead); - - c = _lookahead_getc(lookahead); - if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) { - n++; - } else { - _lookahead_revert(lookahead, pos); - break; - } - } - - if (n > 2) { - return n; - } - - _lookahead_revert(lookahead, 0); - return 0; -} - - -static unsigned int -_parse_oct(struct lookahead_state *lookahead) -{ - int c; - unsigned int n; - - c = _lookahead_getc(lookahead); - if (c != '0') { - _lookahead_revert(lookahead, 0); - return 0; - } - - for (n = 1;;) { - unsigned int pos = _lookahead_tell(lookahead); - - c = _lookahead_getc(lookahead); - if ((c >= '0' && c <= '7')) { - n++; - } else { - _lookahead_revert(lookahead, pos); - break; - } - } - - return n; -} - - -static unsigned int -_parse_dec(struct lookahead_state *lookahead) -{ - unsigned int n = 0; - - for (;;) { - unsigned int pos = _lookahead_tell(lookahead); - int c = _lookahead_getc(lookahead); - - if ((c >= '0' && c <= '9')) { - n++; - } else { - _lookahead_revert(lookahead, pos); - break; - } - } - - return n; -} - - -static int -_tokenise_number(struct sl_pp_context *context, - struct sl_pp_token_info *out) -{ - struct lookahead_state lookahead; - unsigned int eaten; - unsigned int is_float = 0; - unsigned int pos; - int c; - char number[256]; /* XXX: Remove this artifical limit. */ - - _lookahead_init(&lookahead, context); - - eaten = _parse_float(&lookahead); - if (!eaten) { - eaten = _parse_hex(&lookahead); - if (!eaten) { - eaten = _parse_oct(&lookahead); - if (!eaten) { - eaten = _parse_dec(&lookahead); - } - } - } else { - is_float = 1; - } - - if (!eaten) { - strcpy(context->error_msg, "expected a number"); - return -1; - } - - pos = _lookahead_tell(&lookahead); - c = _lookahead_getc(&lookahead); - _lookahead_revert(&lookahead, pos); - - if (_is_identifier_char(c)) { - strcpy(context->error_msg, "expected a number"); - _lookahead_revert(&lookahead, 0); - return -1; - } - - if (eaten > sizeof(number) - 1) { - strcpy(context->error_msg, "out of memory"); - _lookahead_revert(&lookahead, 0); - return -1; - } - - assert(_lookahead_tell(&lookahead) == eaten); - - memcpy(number, _lookahead_buf(&lookahead), eaten); - number[eaten] = '\0'; - - if (is_float) { - out->token = SL_PP_FLOAT; - out->data._float = sl_pp_context_add_unique_str(context, number); - if (out->data._float == -1) { - _lookahead_revert(&lookahead, 0); - return -1; - } - } else { - out->token = SL_PP_UINT; - out->data._uint = sl_pp_context_add_unique_str(context, number); - if (out->data._uint == -1) { - _lookahead_revert(&lookahead, 0); - return -1; - } - } - - return 0; -} - - -int -sl_pp_token_get(struct sl_pp_context *context, - struct sl_pp_token_info *out) -{ - int c = _pure_getc(context); - - switch (c) { - case ' ': - case '\t': - out->token = SL_PP_WHITESPACE; - break; - - case '\n': - out->token = SL_PP_NEWLINE; - break; - - case '#': - out->token = SL_PP_HASH; - break; - - case ',': - out->token = SL_PP_COMMA; - break; - - case ';': - out->token = SL_PP_SEMICOLON; - break; - - case '{': - out->token = SL_PP_LBRACE; - break; - - case '}': - out->token = SL_PP_RBRACE; - break; - - case '(': - out->token = SL_PP_LPAREN; - break; - - case ')': - out->token = SL_PP_RPAREN; - break; - - case '[': - out->token = SL_PP_LBRACKET; - break; - - case ']': - out->token = SL_PP_RBRACKET; - break; - - case '.': - { - int c2 = _pure_getc(context); - - if (c2 == PURE_ERROR) { - return -1; - } - if (c2 >= '0' && c2 <= '9') { - _pure_ungetc(context, c2); - _pure_ungetc(context, c); - if (_tokenise_number(context, out)) { - return -1; - } - } else { - _pure_ungetc(context, c2); - out->token = SL_PP_DOT; - } - } - break; - - case '+': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '+') { - out->token = SL_PP_INCREMENT; - } else if (c == '=') { - out->token = SL_PP_ADDASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_PLUS; - } - break; - - case '-': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '-') { - out->token = SL_PP_DECREMENT; - } else if (c == '=') { - out->token = SL_PP_SUBASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_MINUS; - } - break; - - case '~': - out->token = SL_PP_BITNOT; - break; - - case '!': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_NOTEQUAL; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_NOT; - } - break; - - case '*': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_MULASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_STAR; - } - break; - - case '/': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_DIVASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_SLASH; - } - break; - - case '%': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_MODASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_MODULO; - } - break; - - case '<': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '<') { - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_LSHIFTASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_LSHIFT; - } - } else if (c == '=') { - out->token = SL_PP_LESSEQUAL; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_LESS; - } - break; - - case '>': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '>') { - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_RSHIFTASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_RSHIFT; - } - } else if (c == '=') { - out->token = SL_PP_GREATEREQUAL; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_GREATER; - } - break; - - case '=': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '=') { - out->token = SL_PP_EQUAL; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_ASSIGN; - } - break; - - case '&': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '&') { - out->token = SL_PP_AND; - } else if (c == '=') { - out->token = SL_PP_BITANDASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_BITAND; - } - break; - - case '^': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '^') { - out->token = SL_PP_XOR; - } else if (c == '=') { - out->token = SL_PP_BITXORASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_BITXOR; - } - break; - - case '|': - c = _pure_getc(context); - if (c == PURE_ERROR) { - return -1; - } - if (c == '|') { - out->token = SL_PP_OR; - } else if (c == '=') { - out->token = SL_PP_BITORASSIGN; - } else { - _pure_ungetc(context, c); - out->token = SL_PP_BITOR; - } - break; - - case '?': - out->token = SL_PP_QUESTION; - break; - - case ':': - out->token = SL_PP_COLON; - break; - - case '\0': - out->token = SL_PP_EOF; - break; - - case PURE_ERROR: - return -1; - - default: - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_') { - _pure_ungetc(context, c); - if (_tokenise_identifier(context, out)) { - return -1; - } - } else if (c >= '0' && c <= '9') { - _pure_ungetc(context, c); - if (_tokenise_number(context, out)) { - return -1; - } - } else { - out->data.other = c; - out->token = SL_PP_OTHER; - } - } - - return 0; -} - - -int -sl_pp_tokenise(struct sl_pp_context *context, - struct sl_pp_token_info **output) -{ - struct sl_pp_token_info *out = NULL; - unsigned int out_len = 0; - unsigned int out_max = 0; - - for (;;) { - struct sl_pp_token_info info; - - if (sl_pp_token_buffer_get(&context->tokens, &info)) { - free(out); - return -1; - } - - if (out_len >= out_max) { - unsigned int new_max = out_max; - - if (new_max < 0x100) { - new_max = 0x100; - } else if (new_max < 0x10000) { - new_max *= 2; - } else { - new_max += 0x10000; - } - - out = realloc(out, new_max * sizeof(struct sl_pp_token_info)); - if (!out) { - strcpy(context->error_msg, "out of memory"); - return -1; - } - out_max = new_max; - } - - out[out_len++] = info; - - if (info.token == SL_PP_EOF) { - break; - } - } - - *output = out; - return 0; -} diff --git a/mesalib/src/glsl/pp/sl_pp_token.h b/mesalib/src/glsl/pp/sl_pp_token.h deleted file mode 100644 index a12b19340..000000000 --- a/mesalib/src/glsl/pp/sl_pp_token.h +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_PP_TOKEN_H -#define SL_PP_TOKEN_H - - -struct sl_pp_context; - -enum sl_pp_token { - SL_PP_WHITESPACE, - SL_PP_NEWLINE, - SL_PP_HASH, /* # */ - - SL_PP_COMMA, /* , */ - SL_PP_SEMICOLON, /* ; */ - SL_PP_LBRACE, /* { */ - SL_PP_RBRACE, /* } */ - SL_PP_LPAREN, /* ( */ - SL_PP_RPAREN, /* ) */ - SL_PP_LBRACKET, /* [ */ - SL_PP_RBRACKET, /* ] */ - SL_PP_DOT, /* . */ - SL_PP_INCREMENT, /* ++ */ - SL_PP_ADDASSIGN, /* += */ - SL_PP_PLUS, /* + */ - SL_PP_DECREMENT, /* -- */ - SL_PP_SUBASSIGN, /* -= */ - SL_PP_MINUS, /* - */ - SL_PP_BITNOT, /* ~ */ - SL_PP_NOTEQUAL, /* != */ - SL_PP_NOT, /* ! */ - SL_PP_MULASSIGN, /* *= */ - SL_PP_STAR, /* * */ - SL_PP_DIVASSIGN, /* /= */ - SL_PP_SLASH, /* / */ - SL_PP_MODASSIGN, /* %= */ - SL_PP_MODULO, /* % */ - SL_PP_LSHIFTASSIGN, /* <<= */ - SL_PP_LSHIFT, /* << */ - SL_PP_LESSEQUAL, /* <= */ - SL_PP_LESS, /* < */ - SL_PP_RSHIFTASSIGN, /* >>= */ - SL_PP_RSHIFT, /* >> */ - SL_PP_GREATEREQUAL, /* >= */ - SL_PP_GREATER, /* > */ - SL_PP_EQUAL, /* == */ - SL_PP_ASSIGN, /* = */ - SL_PP_AND, /* && */ - SL_PP_BITANDASSIGN, /* &= */ - SL_PP_BITAND, /* & */ - SL_PP_XOR, /* ^^ */ - SL_PP_BITXORASSIGN, /* ^= */ - SL_PP_BITXOR, /* ^ */ - SL_PP_OR, /* || */ - SL_PP_BITORASSIGN, /* |= */ - SL_PP_BITOR, /* | */ - SL_PP_QUESTION, /* ? */ - SL_PP_COLON, /* : */ - - SL_PP_IDENTIFIER, - - SL_PP_UINT, - SL_PP_FLOAT, - - SL_PP_OTHER, - - SL_PP_PRAGMA_OPTIMIZE, - SL_PP_PRAGMA_DEBUG, - - SL_PP_EXTENSION_REQUIRE, - SL_PP_EXTENSION_ENABLE, - SL_PP_EXTENSION_WARN, - SL_PP_EXTENSION_DISABLE, - - SL_PP_LINE, - - SL_PP_EOF -}; - -union sl_pp_token_data { - int identifier; - int _uint; - int _float; - char other; - int pragma; - int extension; - struct { - unsigned int lineno: 24; - unsigned int fileno: 8; - } line; -}; - -struct sl_pp_token_info { - enum sl_pp_token token; - union sl_pp_token_data data; -}; - -struct sl_pp_purify_options; - -int -sl_pp_token_get(struct sl_pp_context *context, - struct sl_pp_token_info *out); - -int -sl_pp_tokenise(struct sl_pp_context *context, - struct sl_pp_token_info **output); - -#endif /* SL_PP_TOKEN_H */ diff --git a/mesalib/src/glsl/pp/sl_pp_token_util.c b/mesalib/src/glsl/pp/sl_pp_token_util.c deleted file mode 100644 index c85263d9a..000000000 --- a/mesalib/src/glsl/pp/sl_pp_token_util.c +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <assert.h> -#include <stdlib.h> -#include "sl_pp_token_util.h" - - -int -sl_pp_token_buffer_init(struct sl_pp_token_buffer *buffer, - struct sl_pp_context *context) -{ - buffer->context = context; - buffer->size = 0; - buffer->capacity = 64; - buffer->tokens = malloc(buffer->capacity * sizeof(struct sl_pp_token_info)); - if (!buffer->tokens) { - return -1; - } - return 0; -} - -void -sl_pp_token_buffer_destroy(struct sl_pp_token_buffer *buffer) -{ - free(buffer->tokens); -} - -int -sl_pp_token_buffer_get(struct sl_pp_token_buffer *buffer, - struct sl_pp_token_info *out) -{ - /* Pop from stack first if not empty. */ - if (buffer->size) { - *out = buffer->tokens[--buffer->size]; - return 0; - } - - assert(buffer->context); - return sl_pp_token_get(buffer->context, out); -} - -void -sl_pp_token_buffer_unget(struct sl_pp_token_buffer *buffer, - const struct sl_pp_token_info *in) -{ - /* Resize if needed. */ - if (buffer->size == buffer->capacity) { - buffer->capacity += 64; - buffer->tokens = realloc(buffer->tokens, - buffer->capacity * sizeof(struct sl_pp_token_info)); - assert(buffer->tokens); - } - - /* Push token on stack. */ - buffer->tokens[buffer->size++] = *in; -} - -int -sl_pp_token_buffer_skip_white(struct sl_pp_token_buffer *buffer, - struct sl_pp_token_info *out) -{ - if (sl_pp_token_buffer_get(buffer, out)) { - return -1; - } - - while (out->token == SL_PP_WHITESPACE) { - if (sl_pp_token_buffer_get(buffer, out)) { - return -1; - } - } - - return 0; -} - - - -int -sl_pp_token_peek_init(struct sl_pp_token_peek *peek, - struct sl_pp_token_buffer *buffer) -{ - peek->buffer = buffer; - peek->size = 0; - peek->capacity = 64; - peek->tokens = malloc(peek->capacity * sizeof(struct sl_pp_token_info)); - if (!peek->tokens) { - return -1; - } - return 0; -} - -void -sl_pp_token_peek_destroy(struct sl_pp_token_peek *peek) -{ - /* Abort. */ - while (peek->size) { - sl_pp_token_buffer_unget(peek->buffer, &peek->tokens[--peek->size]); - } - free(peek->tokens); -} - -int -sl_pp_token_peek_get(struct sl_pp_token_peek *peek, - struct sl_pp_token_info *out) -{ - /* Get token from buffer. */ - if (sl_pp_token_buffer_get(peek->buffer, out)) { - return -1; - } - - /* Save it. */ - if (peek->size == peek->capacity) { - peek->capacity += 64; - peek->tokens = realloc(peek->tokens, - peek->capacity * sizeof(struct sl_pp_token_info)); - assert(peek->tokens); - } - peek->tokens[peek->size++] = *out; - return 0; -} - -void -sl_pp_token_peek_commit(struct sl_pp_token_peek *peek) -{ - peek->size = 0; -} - -int -sl_pp_token_peek_to_buffer(const struct sl_pp_token_peek *peek, - struct sl_pp_token_buffer *buffer) -{ - unsigned int i; - - if (sl_pp_token_buffer_init(buffer, NULL)) { - return -1; - } - for (i = peek->size; i > 0; i--) { - sl_pp_token_buffer_unget(buffer, &peek->tokens[i - 1]); - } - return 0; -} - -int -sl_pp_token_peek_skip_white(struct sl_pp_token_peek *peek, - struct sl_pp_token_info *out) -{ - if (sl_pp_token_peek_get(peek, out)) { - return -1; - } - - while (out->token == SL_PP_WHITESPACE) { - if (sl_pp_token_peek_get(peek, out)) { - return -1; - } - } - - return 0; -} diff --git a/mesalib/src/glsl/pp/sl_pp_token_util.h b/mesalib/src/glsl/pp/sl_pp_token_util.h deleted file mode 100644 index 2a668ad0a..000000000 --- a/mesalib/src/glsl/pp/sl_pp_token_util.h +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef SL_PP_TOKEN_UTIL_H -#define SL_PP_TOKEN_UTIL_H - -#include <assert.h> -#include <stdlib.h> -#include "sl_pp_token.h" - - -struct sl_pp_context; - -/* - * A token buffer allows one to get and unget a token - * from a preprocessor context. - */ -struct sl_pp_token_buffer { - struct sl_pp_context *context; - unsigned int size; - unsigned int capacity; - struct sl_pp_token_info *tokens; -}; - -int -sl_pp_token_buffer_init(struct sl_pp_token_buffer *buffer, - struct sl_pp_context *context); - -void -sl_pp_token_buffer_destroy(struct sl_pp_token_buffer *buffer); - -int -sl_pp_token_buffer_get(struct sl_pp_token_buffer *buffer, - struct sl_pp_token_info *out); - -void -sl_pp_token_buffer_unget(struct sl_pp_token_buffer *buffer, - const struct sl_pp_token_info *in); - -int -sl_pp_token_buffer_skip_white(struct sl_pp_token_buffer *buffer, - struct sl_pp_token_info *out); - - -/* - * A token peek allows one to get a number of tokens from a buffer - * and then either commit the operation or abort it, - * effectively ungetting the peeked tokens. - */ -struct sl_pp_token_peek { - struct sl_pp_token_buffer *buffer; - unsigned int size; - unsigned int capacity; - struct sl_pp_token_info *tokens; -}; - -int -sl_pp_token_peek_init(struct sl_pp_token_peek *peek, - struct sl_pp_token_buffer *buffer); - -void -sl_pp_token_peek_destroy(struct sl_pp_token_peek *peek); - -int -sl_pp_token_peek_get(struct sl_pp_token_peek *peek, - struct sl_pp_token_info *out); - -void -sl_pp_token_peek_commit(struct sl_pp_token_peek *peek); - -int -sl_pp_token_peek_to_buffer(const struct sl_pp_token_peek *peek, - struct sl_pp_token_buffer *buffer); - -int -sl_pp_token_peek_skip_white(struct sl_pp_token_peek *peek, - struct sl_pp_token_info *out); - -#endif /* SL_PP_TOKEN_UTIL_H */ diff --git a/mesalib/src/glsl/pp/sl_pp_version.c b/mesalib/src/glsl/pp/sl_pp_version.c deleted file mode 100644 index 3c995b775..000000000 --- a/mesalib/src/glsl/pp/sl_pp_version.c +++ /dev/null @@ -1,161 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include "sl_pp_public.h" -#include "sl_pp_context.h" - - -int -sl_pp_version(struct sl_pp_context *context, - unsigned int *version) -{ - struct sl_pp_token_peek peek; - unsigned int line = context->line; - - /* Default values if `#version' is not present. */ - *version = 110; - - if (sl_pp_token_peek_init(&peek, &context->tokens)) { - return -1; - } - - /* There can be multiple `#version' directives present. - * Accept the value of the last one. - */ - for (;;) { - struct sl_pp_token_info input; - int found_hash = 0; - int found_version = 0; - int found_number = 0; - int found_end = 0; - - /* Skip whitespace and newlines and seek for hash. */ - while (!found_hash) { - if (sl_pp_token_peek_get(&peek, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - - switch (input.token) { - case SL_PP_NEWLINE: - line++; - break; - - case SL_PP_WHITESPACE: - break; - - case SL_PP_HASH: - found_hash = 1; - break; - - default: - sl_pp_token_peek_destroy(&peek); - return 0; - } - } - - /* Skip whitespace and seek for `version'. */ - while (!found_version) { - if (sl_pp_token_peek_get(&peek, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_IDENTIFIER: - if (input.data.identifier != context->dict.version) { - sl_pp_token_peek_destroy(&peek); - return 0; - } - found_version = 1; - break; - - default: - sl_pp_token_peek_destroy(&peek); - return 0; - } - } - - sl_pp_token_peek_commit(&peek); - - /* Skip whitespace and seek for version number. */ - while (!found_number) { - if (sl_pp_token_buffer_get(&context->tokens, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_UINT: - *version = atoi(sl_pp_context_cstr(context, input.data._uint)); - found_number = 1; - break; - - default: - strcpy(context->error_msg, "expected version number after `#version'"); - sl_pp_token_peek_destroy(&peek); - return -1; - } - } - - /* Skip whitespace and seek for either newline or eof. */ - while (!found_end) { - if (sl_pp_token_buffer_get(&context->tokens, &input)) { - sl_pp_token_peek_destroy(&peek); - return -1; - } - - switch (input.token) { - case SL_PP_WHITESPACE: - break; - - case SL_PP_NEWLINE: - line++; - /* pass thru */ - case SL_PP_EOF: - context->line = line; - found_end = 1; - break; - - default: - strcpy(context->error_msg, "expected end of line after version number"); - sl_pp_token_peek_destroy(&peek); - return -1; - } - } - } - - /* Should not get here. */ -} diff --git a/mesalib/src/mesa/shader/slang/library/slang_builtin_120_fragment.gc b/mesalib/src/glsl/program.h index 7d516046a..893169b6c 100644 --- a/mesalib/src/mesa/shader/slang/library/slang_builtin_120_fragment.gc +++ b/mesalib/src/glsl/program.h @@ -1,8 +1,7 @@ /* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * Copyright © 2010 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -22,9 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -// -// From Shader Spec, ver. 1.20, rev. 6 -// - -varying vec2 gl_PointCoord; +#include "main/core.h" +extern void +link_shaders(GLcontext *ctx, struct gl_shader_program *prog); diff --git a/mesalib/src/glsl/s_expression.cpp b/mesalib/src/glsl/s_expression.cpp new file mode 100644 index 000000000..4458c48d6 --- /dev/null +++ b/mesalib/src/glsl/s_expression.cpp @@ -0,0 +1,140 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <assert.h> +#include "s_expression.h" + +s_symbol::s_symbol(const char *tmp, size_t n) +{ + this->str = talloc_strndup (this, tmp, n); + assert(this->str != NULL); +} + +s_list::s_list() +{ +} + +unsigned +s_list::length() const +{ + unsigned i = 0; + foreach_iter(exec_list_iterator, it, this->subexpressions) { + i++; + } + return i; +} + +static s_expression * +read_atom(void *ctx, const char *& src) +{ + s_expression *expr = NULL; + + // Skip leading spaces. + src += strspn(src, " \v\t\r\n"); + + size_t n = strcspn(src, "( \v\t\r\n)"); + if (n == 0) + return NULL; // no atom + + // Check if the atom is a number. + char *float_end = NULL; + double f = strtod(src, &float_end); + if (float_end != src) { + char *int_end = NULL; + int i = strtol(src, &int_end, 10); + // If strtod matched more characters, it must have a decimal part + if (float_end > int_end) + expr = new(ctx) s_float(f); + else + expr = new(ctx) s_int(i); + } else { + // Not a number; return a symbol. + expr = new(ctx) s_symbol(src, n); + } + + src += n; + + return expr; +} + +s_expression * +s_expression::read_expression(void *ctx, const char *&src) +{ + assert(src != NULL); + + s_expression *atom = read_atom(ctx, src); + if (atom != NULL) + return atom; + + // Skip leading spaces. + src += strspn(src, " \v\t\r\n"); + if (src[0] == '(') { + ++src; + + s_list *list = new(ctx) s_list; + s_expression *expr; + + while ((expr = read_expression(ctx, src)) != NULL) { + list->subexpressions.push_tail(expr); + } + src += strspn(src, " \v\t\r\n"); + if (src[0] != ')') { + printf("Unclosed expression (check your parenthesis).\n"); + return NULL; + } + ++src; + return list; + } + return NULL; +} + +void s_int::print() +{ + printf("%d", this->val); +} + +void s_float::print() +{ + printf("%f", this->val); +} + +void s_symbol::print() +{ + printf("%s", this->str); +} + +void s_list::print() +{ + printf("("); + foreach_iter(exec_list_iterator, it, this->subexpressions) { + s_expression *expr = (s_expression*) it.get(); + expr->print(); + printf(" "); + } + printf(")"); +} + diff --git a/mesalib/src/glsl/s_expression.h b/mesalib/src/glsl/s_expression.h new file mode 100644 index 000000000..aa22475a1 --- /dev/null +++ b/mesalib/src/glsl/s_expression.h @@ -0,0 +1,142 @@ +/* -*- c++ -*- */ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#pragma once +#ifndef S_EXPRESSION_H +#define S_EXPRESSION_H + +#include "list.h" + +#define SX_AS_(t,x) ((x) && ((s_expression*) x)->is_##t()) ? ((s_##t*) (x)) \ + : NULL +#define SX_AS_LIST(x) SX_AS_(list, x) +#define SX_AS_SYMBOL(x) SX_AS_(symbol, x) +#define SX_AS_NUMBER(x) SX_AS_(number, x) +#define SX_AS_INT(x) SX_AS_(int, x) + +/* For our purposes, S-Expressions are: + * - <int> + * - <float> + * - symbol + * - (expr1 expr2 ... exprN) where exprN is an S-Expression + * + * Unlike LISP/Scheme, we do not support (foo . bar) pairs. + */ +class s_expression : public exec_node +{ +public: + /** + * Read an S-Expression from the given string. + * Advances the supplied pointer to just after the expression read. + * + * Any allocation will be performed with 'ctx' as the talloc owner. + */ + static s_expression *read_expression(void *ctx, const char *&src); + + /** + * Print out an S-Expression. Useful for debugging. + */ + virtual void print() = 0; + + virtual bool is_list() const { return false; } + virtual bool is_symbol() const { return false; } + virtual bool is_number() const { return false; } + virtual bool is_int() const { return false; } + +protected: + s_expression() { } +}; + +/* Atoms */ + +class s_number : public s_expression +{ +public: + bool is_number() const { return true; } + + virtual float fvalue() = 0; + +protected: + s_number() { } +}; + +class s_int : public s_number +{ +public: + s_int(int x) : val(x) { } + + bool is_int() const { return true; } + + float fvalue() { return float(this->val); } + int value() { return this->val; } + + void print(); + +private: + int val; +}; + +class s_float : public s_number +{ +public: + s_float(float x) : val(x) { } + + float fvalue() { return this->val; } + + void print(); + +private: + float val; +}; + +class s_symbol : public s_expression +{ +public: + s_symbol(const char *, size_t); + + bool is_symbol() const { return true; } + + const char *value() { return this->str; } + + void print(); + +private: + char *str; +}; + +/* Lists of expressions: (expr1 ... exprN) */ +class s_list : public s_expression +{ +public: + s_list(); + + virtual bool is_list() const { return true; } + unsigned length() const; + + void print(); + + exec_list subexpressions; +}; + +#endif /* S_EXPRESSION_H */ diff --git a/mesalib/src/glu/sgi/libtess/geom.c b/mesalib/src/glu/sgi/libtess/geom.c index 7d3b8d8a6..35b36a394 100644 --- a/mesalib/src/glu/sgi/libtess/geom.c +++ b/mesalib/src/glu/sgi/libtess/geom.c @@ -198,7 +198,7 @@ printf("*********************%d\n",RandomInterpolate); #endif -#define Swap(a,b) if (1) { GLUvertex *t = a; a = b; b = t; } else +#define Swap(a,b) do { GLUvertex *t = a; a = b; b = t; } while (0) void __gl_edgeIntersect( GLUvertex *o1, GLUvertex *d1, GLUvertex *o2, GLUvertex *d2, diff --git a/mesalib/src/glu/sgi/libtess/mesh.c b/mesalib/src/glu/sgi/libtess/mesh.c index 95f87cdc9..36cb3a7be 100644 --- a/mesalib/src/glu/sgi/libtess/mesh.c +++ b/mesalib/src/glu/sgi/libtess/mesh.c @@ -38,8 +38,12 @@ #include "mesh.h" #include "memalloc.h" +#ifndef TRUE #define TRUE 1 +#endif +#ifndef FALSE #define FALSE 0 +#endif static GLUvertex *allocVertex() { diff --git a/mesalib/src/glu/sgi/libtess/normal.c b/mesalib/src/glu/sgi/libtess/normal.c index 7ab83167b..9a3bd43d3 100644 --- a/mesalib/src/glu/sgi/libtess/normal.c +++ b/mesalib/src/glu/sgi/libtess/normal.c @@ -39,8 +39,12 @@ #include <math.h> #include <assert.h> +#ifndef TRUE #define TRUE 1 +#endif +#ifndef FALSE #define FALSE 0 +#endif #define Dot(u,v) (u[0]*v[0] + u[1]*v[1] + u[2]*v[2]) diff --git a/mesalib/src/glu/sgi/libtess/priorityq-heap.c b/mesalib/src/glu/sgi/libtess/priorityq-heap.c index e3a6c6068..52698b59c 100644 --- a/mesalib/src/glu/sgi/libtess/priorityq-heap.c +++ b/mesalib/src/glu/sgi/libtess/priorityq-heap.c @@ -39,8 +39,12 @@ #define INIT_SIZE 32 +#ifndef TRUE #define TRUE 1 +#endif +#ifndef FALSE #define FALSE 0 +#endif #ifdef FOR_TRITE_TEST_PROGRAM #define LEQ(x,y) (*pq->leq)(x,y) @@ -159,7 +163,7 @@ void pqInit( PriorityQ *pq ) PQhandle pqInsert( PriorityQ *pq, PQkey keyNew ) { long curr; - PQhandle free; + PQhandle free_handle; curr = ++ pq->size; if( (curr*2) > pq->max ) { @@ -186,21 +190,21 @@ PQhandle pqInsert( PriorityQ *pq, PQkey keyNew ) } if( pq->freeList == 0 ) { - free = curr; + free_handle = curr; } else { - free = pq->freeList; - pq->freeList = pq->handles[free].node; + free_handle = pq->freeList; + pq->freeList = pq->handles[free_handle].node; } - pq->nodes[curr].handle = free; - pq->handles[free].node = curr; - pq->handles[free].key = keyNew; + pq->nodes[curr].handle = free_handle; + pq->handles[free_handle].node = curr; + pq->handles[free_handle].key = keyNew; if( pq->initialized ) { FloatUp( pq, curr ); } - assert(free != LONG_MAX); - return free; + assert(free_handle != LONG_MAX); + return free_handle; } /* really __gl_pqHeapExtractMin */ diff --git a/mesalib/src/glu/sgi/libtess/priorityq.c b/mesalib/src/glu/sgi/libtess/priorityq.c index 11f0263ac..c6b99cce5 100644 --- a/mesalib/src/glu/sgi/libtess/priorityq.c +++ b/mesalib/src/glu/sgi/libtess/priorityq.c @@ -85,7 +85,7 @@ void pqDeletePriorityQ( PriorityQ *pq ) #define LT(x,y) (! LEQ(y,x)) #define GT(x,y) (! LEQ(x,y)) -#define Swap(a,b) if(1){PQkey *tmp = *a; *a = *b; *b = tmp;}else +#define Swap(a,b) do{PQkey *tmp = *a; *a = *b; *b = tmp;}while(0) /* really __gl_pqSortInit */ int pqInit( PriorityQ *pq ) diff --git a/mesalib/src/glu/sgi/libtess/render.c b/mesalib/src/glu/sgi/libtess/render.c index 4f376f7f4..bca836f04 100644 --- a/mesalib/src/glu/sgi/libtess/render.c +++ b/mesalib/src/glu/sgi/libtess/render.c @@ -39,8 +39,12 @@ #include "tess.h" #include "render.h" +#ifndef TRUE #define TRUE 1 +#endif +#ifndef FALSE #define FALSE 0 +#endif /* This structure remembers the information we need about a primitive * to be able to render it later, once we have determined which @@ -143,11 +147,11 @@ static void RenderMaximumFaceGroup( GLUtesselator *tess, GLUface *fOrig ) #define AddToTrail(f,t) ((f)->trail = (t), (t) = (f), (f)->marked = TRUE) -#define FreeTrail(t) if( 1 ) { \ +#define FreeTrail(t) do { \ while( (t) != NULL ) { \ (t)->marked = FALSE; t = (t)->trail; \ } \ - } else /* absorb trailing semicolon */ + } while(0) /* absorb trailing semicolon */ diff --git a/mesalib/src/glu/sgi/libtess/sweep.c b/mesalib/src/glu/sgi/libtess/sweep.c index 744be6b47..eca828ff6 100644 --- a/mesalib/src/glu/sgi/libtess/sweep.c +++ b/mesalib/src/glu/sgi/libtess/sweep.c @@ -46,8 +46,12 @@ #include "memalloc.h" #include "sweep.h" +#ifndef TRUE #define TRUE 1 +#endif +#ifndef FALSE #define FALSE 0 +#endif #ifdef FOR_TRITE_TEST_PROGRAM extern void DebugEvent( GLUtesselator *tess ); diff --git a/mesalib/src/glu/sgi/libtess/tess.c b/mesalib/src/glu/sgi/libtess/tess.c index 029a02c3a..4a0e8dea7 100644 --- a/mesalib/src/glu/sgi/libtess/tess.c +++ b/mesalib/src/glu/sgi/libtess/tess.c @@ -47,8 +47,12 @@ #define GLU_TESS_DEFAULT_TOLERANCE 0.0 #define GLU_TESS_MESH 100112 /* void (*)(GLUmesh *mesh) */ +#ifndef TRUE #define TRUE 1 +#endif +#ifndef FALSE #define FALSE 0 +#endif /*ARGSUSED*/ static void GLAPIENTRY noBegin( GLenum type ) {} /*ARGSUSED*/ static void GLAPIENTRY noEdgeFlag( GLboolean boundaryEdge ) {} diff --git a/mesalib/src/glu/sgi/libutil/mipmap.c b/mesalib/src/glu/sgi/libutil/mipmap.c index 8e63eaaad..026ab849c 100644 --- a/mesalib/src/glu/sgi/libutil/mipmap.c +++ b/mesalib/src/glu/sgi/libutil/mipmap.c @@ -5552,7 +5552,7 @@ static void shove233rev(const GLfloat shoveComponents[], static void extract565(int isSwap, const void *packedPixel, GLfloat extractComponents[]) { - GLushort ushort= *(const GLushort *)packedPixel; + GLushort ushort; if (isSwap) { ushort= __GLU_SWAP_2_BYTES(packedPixel); @@ -5593,7 +5593,7 @@ static void shove565(const GLfloat shoveComponents[], static void extract565rev(int isSwap, const void *packedPixel, GLfloat extractComponents[]) { - GLushort ushort= *(const GLushort *)packedPixel; + GLushort ushort; if (isSwap) { ushort= __GLU_SWAP_2_BYTES(packedPixel); diff --git a/mesalib/src/mapi/glapi/Makefile b/mesalib/src/mapi/glapi/Makefile new file mode 100644 index 000000000..ca9381d42 --- /dev/null +++ b/mesalib/src/mapi/glapi/Makefile @@ -0,0 +1,53 @@ +# src/mapi/glapi/Makefile + +TOP = ../../.. +include $(TOP)/configs/current + +TARGET = glapi + +MAPI = $(TOP)/src/mapi/mapi + +include sources.mak +GLAPI_OBJECTS = $(GLAPI_SOURCES:.c=.o) +GLAPI_ASM_OBJECTS = $(GLAPI_ASM_SOURCES:.S=.o) + +include $(MAPI)/sources.mak +MAPI_GLAPI_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o) +MAPI_GLAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES)) + +TARGET_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_GLAPI_OBJECTS) + +INCLUDE_DIRS = \ + -I$(TOP)/include \ + -I$(TOP)/src/mapi \ + -I$(TOP)/src/mesa + +default: depend lib$(TARGET).a + +lib$(TARGET).a: $(TARGET_OBJECTS) + @$(MKLIB) -o $(TARGET) -static $(TARGET_OBJECTS) + +$(GLAPI_OBJECTS): %.o: %.c + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + +$(GLAPI_ASM_OBJECTS): %.o: %.S + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + +$(MAPI_GLAPI_OBJECTS): %.o: $(MAPI)/%.c + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ + +install: + +clean: + -rm -f $(TARGET_OBJECTS) + -rm -f lib$(TARGET).a + -rm -f depend depend.bak + +depend: $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) + @ echo "running $(MKDEP)" + @ touch depend + @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \ + -DMAPI_GLAPI_CURRENT $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) \ + 2>/dev/null | sed -e 's,^$(MAPI)/,,' > depend + +-include depend diff --git a/mesalib/src/mapi/glapi/SConscript b/mesalib/src/mapi/glapi/SConscript new file mode 100644 index 000000000..40db237fc --- /dev/null +++ b/mesalib/src/mapi/glapi/SConscript @@ -0,0 +1,82 @@ +####################################################################### +# SConscript for glapi + + +Import('*') + +if env['platform'] != 'winddk': + + env = env.Clone() + + env.Append(CPPDEFINES = [ + 'MAPI_GLAPI_CURRENT', + ]) + + if env['platform'] == 'windows': + env.Append(CPPDEFINES = [ + '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers + 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers + 'WIN32_THREADS', # use Win32 thread API + ]) + + env.Append(CPPPATH = [ + '#/src/mapi', + '#/src/mesa', + ]) + + glapi_sources = [ + 'glapi_dispatch.c', + 'glapi_entrypoint.c', + 'glapi_getproc.c', + 'glapi_nop.c', + 'glthread.c', + ] + + mapi_sources = [ + 'u_current.c', + 'u_execmem.c', + 'u_thread.c', + ] + for s in mapi_sources: + o = env.SharedObject(s[:-2], '../mapi/' + s) + glapi_sources.append(o) + + # + # Assembly sources + # + if gcc and env['machine'] == 'x86': + env.Append(CPPDEFINES = [ + 'USE_X86_ASM', + 'USE_MMX_ASM', + 'USE_3DNOW_ASM', + 'USE_SSE_ASM', + ]) + glapi_sources += [ + 'glapi_x86.S', + ] + elif gcc and env['machine'] == 'x86_64': + env.Append(CPPDEFINES = [ + 'USE_X86_64_ASM', + ]) + glapi_sources += [ + 'glapi_x86-64.S' + ] + elif gcc and env['machine'] == 'ppc': + env.Append(CPPDEFINES = [ + 'USE_PPC_ASM', + 'USE_VMX_ASM', + ]) + glapi_sources += [ + ] + elif gcc and env['machine'] == 'sparc': + glapi_sources += [ + 'glapi_sparc.S' + ] + else: + pass + + glapi = env.ConvenienceLibrary( + target = 'glapi', + source = glapi_sources, + ) + Export('glapi') diff --git a/mesalib/src/mapi/glapi/gen-es/Makefile b/mesalib/src/mapi/glapi/gen-es/Makefile new file mode 100644 index 000000000..bda8e9ef7 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/Makefile @@ -0,0 +1,96 @@ +TOP = ../../../.. +GLAPI = ../gen +include $(TOP)/configs/current + +OUTPUTS := \ + glapi/glapidispatch.h \ + glapi/glapioffsets.h \ + glapi/glapitable.h \ + glapi/glapitemp.h \ + glapi/glprocs.h \ + glapi/glapi_sparc.S \ + glapi/glapi_x86-64.S \ + glapi/glapi_x86.S \ + main/remap_helper.h + +COMMON = gl_XML.py glX_XML.py license.py typeexpr.py +COMMON := $(addprefix $(GLAPI)/, $(COMMON)) + +ES1_APIXML := es1_API.xml +ES2_APIXML := es2_API.xml +ES1_OUTPUT_DIR := $(TOP)/src/mapi/es1api +ES2_OUTPUT_DIR := $(TOP)/src/mapi/es2api + +ES1_DEPS = $(ES1_APIXML) base1_API.xml es1_EXT.xml es_EXT.xml \ + es1_COMPAT.xml es_COMPAT.xml +ES2_DEPS = $(ES2_APIXML) base2_API.xml es2_EXT.xml es_EXT.xml \ + es2_COMPAT.xml es_COMPAT.xml + +ES1_OUTPUTS := $(addprefix $(ES1_OUTPUT_DIR)/, $(OUTPUTS)) +ES2_OUTPUTS := $(addprefix $(ES2_OUTPUT_DIR)/, $(OUTPUTS)) + +all: es1 es2 + +es1: $(ES1_OUTPUTS) +es2: $(ES2_OUTPUTS) + +$(ES1_OUTPUTS): APIXML := $(ES1_APIXML) +$(ES2_OUTPUTS): APIXML := $(ES2_APIXML) +$(ES1_OUTPUTS): $(ES1_DEPS) +$(ES2_OUTPUTS): $(ES2_DEPS) + +define gen-glapi + @mkdir -p $(dir $@) + $(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) $(1) > $@ +endef + +%/glapidispatch.h: $(GLAPI)/gl_table.py $(COMMON) + $(call gen-glapi,-c -m remap_table) + +%/glapioffsets.h: $(GLAPI)/gl_offsets.py $(COMMON) + $(call gen-glapi,-c) + +%/glapitable.h: $(GLAPI)/gl_table.py $(COMMON) + $(call gen-glapi,-c) + +%/glapitemp.h: $(GLAPI)/gl_apitemp.py $(COMMON) + $(call gen-glapi,-c) + +%/glprocs.h: $(GLAPI)/gl_procs.py $(COMMON) + $(call gen-glapi,-c) + +%/glapi_sparc.S: $(GLAPI)/gl_SPARC_asm.py $(COMMON) + $(call gen-glapi) + +%/glapi_x86-64.S: $(GLAPI)/gl_x86-64_asm.py $(COMMON) + $(call gen-glapi) + +%/glapi_x86.S: $(GLAPI)/gl_x86_asm.py $(COMMON) + $(call gen-glapi) + +%/main/remap_helper.h: $(GLAPI)/remap_helper.py $(COMMON) + $(call gen-glapi) + +verify_xml: + @if [ ! -f gl.h ]; then \ + echo "Please copy gl.h and gl2.h to this directory"; \ + exit 1; \ + fi + @echo "Verifying that es1_API.xml covers OpenGL ES 1.1..." + @$(PYTHON2) $(PYTHON_FLAGS) gl_parse_header.py gl.h > tmp.xml + @$(PYTHON2) $(PYTHON_FLAGS) gl_compare.py difference tmp.xml es1_API.xml + @echo "Verifying that es2_API.xml covers OpenGL ES 2.0..." + @$(PYTHON2) $(PYTHON_FLAGS) gl_parse_header.py gl2.h > tmp.xml + @$(PYTHON2) $(PYTHON_FLAGS) gl_compare.py difference tmp.xml es2_API.xml + @rm -f tmp.xml + +clean-es1: + -rm -rf $(ES1_OUTPUT_DIR)/glapi + -rm -rf $(ES1_OUTPUT_DIR)/main + +clean-es2: + -rm -rf $(ES2_OUTPUT_DIR)/glapi + -rm -rf $(ES2_OUTPUT_DIR)/main + +clean: clean-es1 clean-es2 + -rm -f *~ *.pyc *.pyo diff --git a/mesalib/src/mapi/glapi/gen-es/base1_API.xml b/mesalib/src/mapi/glapi/gen-es/base1_API.xml new file mode 100644 index 000000000..720be257c --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/base1_API.xml @@ -0,0 +1,744 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<!-- OpenGL and OpenGL ES 1.x APIs + This file defines the base categories that can be shared by all APIs. + They are defined in an incremental fashion. +--> + +<OpenGLAPI> + +<!-- base subset of OpenGL 1.0 --> +<category name="base1.0"> + <enum name="FALSE" value="0x0"/> + <enum name="TRUE" value="0x1"/> + <enum name="ZERO" value="0x0"/> + <enum name="ONE" value="0x1"/> + <enum name="NO_ERROR" value="0x0"/> + + <enum name="POINTS" value="0x0000"/> + <enum name="LINES" value="0x0001"/> + <enum name="LINE_LOOP" value="0x0002"/> + <enum name="LINE_STRIP" value="0x0003"/> + <enum name="TRIANGLES" value="0x0004"/> + <enum name="TRIANGLE_STRIP" value="0x0005"/> + <enum name="TRIANGLE_FAN" value="0x0006"/> + <enum name="NEVER" value="0x0200"/> + <enum name="LESS" value="0x0201"/> + <enum name="EQUAL" value="0x0202"/> + <enum name="LEQUAL" value="0x0203"/> + <enum name="GREATER" value="0x0204"/> + <enum name="NOTEQUAL" value="0x0205"/> + <enum name="GEQUAL" value="0x0206"/> + <enum name="ALWAYS" value="0x0207"/> + <enum name="SRC_COLOR" value="0x0300"/> + <enum name="ONE_MINUS_SRC_COLOR" value="0x0301"/> + <enum name="SRC_ALPHA" value="0x0302"/> + <enum name="ONE_MINUS_SRC_ALPHA" value="0x0303"/> + <enum name="DST_ALPHA" value="0x0304"/> + <enum name="ONE_MINUS_DST_ALPHA" value="0x0305"/> + <enum name="DST_COLOR" value="0x0306"/> + <enum name="ONE_MINUS_DST_COLOR" value="0x0307"/> + <enum name="SRC_ALPHA_SATURATE" value="0x0308"/> + <enum name="FRONT" value="0x0404"/> + <enum name="BACK" value="0x0405"/> + <enum name="FRONT_AND_BACK" value="0x0408"/> + <enum name="INVALID_ENUM" value="0x0500"/> + <enum name="INVALID_VALUE" value="0x0501"/> + <enum name="INVALID_OPERATION" value="0x0502"/> + <enum name="OUT_OF_MEMORY" value="0x0505"/> + <enum name="CW" value="0x0900"/> + <enum name="CCW" value="0x0901"/> + <enum name="CULL_FACE" count="1" value="0x0B44"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEPTH_TEST" count="1" value="0x0B71"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_TEST" count="1" value="0x0B90"> + <size name="Get" mode="get"/> + </enum> + <enum name="DITHER" count="1" value="0x0BD0"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND" count="1" value="0x0BE2"> + <size name="Get" mode="get"/> + </enum> + <enum name="SCISSOR_TEST" count="1" value="0x0C11"> + <size name="Get" mode="get"/> + </enum> + <enum name="UNPACK_ALIGNMENT" count="1" value="0x0CF5"> + <size name="Get" mode="get"/> + </enum> + <enum name="PACK_ALIGNMENT" count="1" value="0x0D05"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_TEXTURE_SIZE" count="1" value="0x0D33"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_VIEWPORT_DIMS" count="2" value="0x0D3A"> + <size name="Get" mode="get"/> + </enum> + <enum name="SUBPIXEL_BITS" count="1" value="0x0D50"> + <size name="Get" mode="get"/> + </enum> + <enum name="RED_BITS" count="1" value="0x0D52"> + <size name="Get" mode="get"/> + </enum> + <enum name="GREEN_BITS" count="1" value="0x0D53"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLUE_BITS" count="1" value="0x0D54"> + <size name="Get" mode="get"/> + </enum> + <enum name="ALPHA_BITS" count="1" value="0x0D55"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEPTH_BITS" count="1" value="0x0D56"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_BITS" count="1" value="0x0D57"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_2D" count="1" value="0x0DE1"> + <size name="Get" mode="get"/> + </enum> + <enum name="DONT_CARE" value="0x1100"/> + <enum name="FASTEST" value="0x1101"/> + <enum name="NICEST" value="0x1102"/> + <enum name="BYTE" count="1" value="0x1400"> + <size name="CallLists"/> + </enum> + <enum name="UNSIGNED_BYTE" count="1" value="0x1401"> + <size name="CallLists"/> + </enum> + <enum name="SHORT" count="2" value="0x1402"> + <size name="CallLists"/> + </enum> + <enum name="UNSIGNED_SHORT" count="2" value="0x1403"> + <size name="CallLists"/> + </enum> + <enum name="FLOAT" count="4" value="0x1406"> + <size name="CallLists"/> + </enum> + <enum name="INVERT" value="0x150A"/> + <enum name="TEXTURE" value="0x1702"/> + <enum name="ALPHA" value="0x1906"/> + <enum name="RGB" value="0x1907"/> + <enum name="RGBA" value="0x1908"/> + <enum name="LUMINANCE" value="0x1909"/> + <enum name="LUMINANCE_ALPHA" value="0x190A"/> + <enum name="KEEP" value="0x1E00"/> + <enum name="REPLACE" value="0x1E01"/> + <enum name="INCR" value="0x1E02"/> + <enum name="DECR" value="0x1E03"/> + <enum name="VENDOR" value="0x1F00"/> + <enum name="RENDERER" value="0x1F01"/> + <enum name="VERSION" value="0x1F02"/> + <enum name="EXTENSIONS" value="0x1F03"/> + <enum name="NEAREST" value="0x2600"/> + <enum name="LINEAR" value="0x2601"/> + <enum name="NEAREST_MIPMAP_NEAREST" value="0x2700"/> + <enum name="LINEAR_MIPMAP_NEAREST" value="0x2701"/> + <enum name="NEAREST_MIPMAP_LINEAR" value="0x2702"/> + <enum name="LINEAR_MIPMAP_LINEAR" value="0x2703"/> + <enum name="TEXTURE_MAG_FILTER" count="1" value="0x2800"> + <size name="TexParameterfv"/> + <size name="TexParameteriv"/> + <size name="GetTexParameterfv" mode="get"/> + <size name="GetTexParameteriv" mode="get"/> + </enum> + <enum name="TEXTURE_MIN_FILTER" count="1" value="0x2801"> + <size name="TexParameterfv"/> + <size name="TexParameteriv"/> + <size name="GetTexParameterfv" mode="get"/> + <size name="GetTexParameteriv" mode="get"/> + </enum> + <enum name="TEXTURE_WRAP_S" count="1" value="0x2802"> + <size name="TexParameterfv"/> + <size name="TexParameteriv"/> + <size name="GetTexParameterfv" mode="get"/> + <size name="GetTexParameteriv" mode="get"/> + </enum> + <enum name="TEXTURE_WRAP_T" count="1" value="0x2803"> + <size name="TexParameterfv"/> + <size name="TexParameteriv"/> + <size name="GetTexParameterfv" mode="get"/> + <size name="GetTexParameteriv" mode="get"/> + </enum> + <enum name="REPEAT" value="0x2901"/> + + <enum name="DEPTH_BUFFER_BIT" value="0x00000100"/> + <enum name="STENCIL_BUFFER_BIT" value="0x00000400"/> + <enum name="COLOR_BUFFER_BIT" value="0x00004000"/> + + <type name="float" size="4" float="true" glx_name="FLOAT32"/> + <type name="clampf" size="4" float="true" glx_name="FLOAT32"/> + + <type name="int" size="4" glx_name="CARD32"/> + <type name="uint" size="4" unsigned="true" glx_name="CARD32"/> + <type name="sizei" size="4" glx_name="CARD32"/> + <type name="enum" size="4" unsigned="true" glx_name="ENUM"/> + <type name="bitfield" size="4" unsigned="true" glx_name="CARD32"/> + + <type name="short" size="2" glx_name="CARD16"/> + <type name="ushort" size="2" unsigned="true" glx_name="CARD16"/> + + <type name="byte" size="1" glx_name="CARD8"/> + <type name="ubyte" size="1" unsigned="true" glx_name="CARD8"/> + <type name="boolean" size="1" unsigned="true" glx_name="CARD8"/> + + <type name="void" size="1"/> + + <function name="BlendFunc" offset="241"> + <param name="sfactor" type="GLenum"/> + <param name="dfactor" type="GLenum"/> + <glx rop="160"/> + </function> + + <function name="Clear" offset="203"> + <param name="mask" type="GLbitfield"/> + <glx rop="127"/> + </function> + + <function name="ClearColor" offset="206"> + <param name="red" type="GLclampf"/> + <param name="green" type="GLclampf"/> + <param name="blue" type="GLclampf"/> + <param name="alpha" type="GLclampf"/> + <glx rop="130"/> + </function> + + <function name="ClearStencil" offset="207"> + <param name="s" type="GLint"/> + <glx rop="131"/> + </function> + + <function name="ColorMask" offset="210"> + <param name="red" type="GLboolean"/> + <param name="green" type="GLboolean"/> + <param name="blue" type="GLboolean"/> + <param name="alpha" type="GLboolean"/> + <glx rop="134"/> + </function> + + <function name="CullFace" offset="152"> + <param name="mode" type="GLenum"/> + <glx rop="79"/> + </function> + + <function name="DepthFunc" offset="245"> + <param name="func" type="GLenum"/> + <glx rop="164"/> + </function> + + <function name="DepthMask" offset="211"> + <param name="flag" type="GLboolean"/> + <glx rop="135"/> + </function> + + <function name="Disable" offset="214"> + <param name="cap" type="GLenum"/> + <glx rop="138" handcode="client"/> + </function> + + <function name="Enable" offset="215"> + <param name="cap" type="GLenum"/> + <glx rop="139" handcode="client"/> + </function> + + <function name="Finish" offset="216"> + <glx sop="108" handcode="true"/> + </function> + + <function name="Flush" offset="217"> + <glx sop="142" handcode="true"/> + </function> + + <function name="FrontFace" offset="157"> + <param name="mode" type="GLenum"/> + <glx rop="84"/> + </function> + + <function name="GetError" offset="261"> + <return type="GLenum"/> + <glx sop="115" handcode="client"/> + </function> + + <function name="GetIntegerv" offset="263"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="117" handcode="client"/> + </function> + + <function name="GetString" offset="275"> + <param name="name" type="GLenum"/> + <return type="const GLubyte *"/> + <glx sop="129" handcode="true"/> + </function> + + <function name="Hint" offset="158"> + <param name="target" type="GLenum"/> + <param name="mode" type="GLenum"/> + <glx rop="85"/> + </function> + + <function name="LineWidth" offset="168"> + <param name="width" type="GLfloat"/> + <glx rop="95"/> + </function> + + <function name="PixelStorei" offset="250"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx sop="110" handcode="client"/> + </function> + + <function name="ReadPixels" offset="256"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type" img_target="0"/> + <glx sop="111"/> + </function> + + <function name="Scissor" offset="176"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="103"/> + </function> + + <function name="StencilFunc" offset="243"> + <param name="func" type="GLenum"/> + <param name="ref" type="GLint"/> + <param name="mask" type="GLuint"/> + <glx rop="162"/> + </function> + + <function name="StencilMask" offset="209"> + <param name="mask" type="GLuint"/> + <glx rop="133"/> + </function> + + <function name="StencilOp" offset="244"> + <param name="fail" type="GLenum"/> + <param name="zfail" type="GLenum"/> + <param name="zpass" type="GLenum"/> + <glx rop="163"/> + </function> + + <function name="TexParameterf" offset="178"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="105"/> + </function> + + <function name="Viewport" offset="305"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="191"/> + </function> + + <!-- these are not in OpenGL ES 1.0 --> + <enum name="LINE_WIDTH" count="1" value="0x0B21"> + <size name="Get" mode="get"/> + </enum> + <enum name="CULL_FACE_MODE" count="1" value="0x0B45"> + <size name="Get" mode="get"/> + </enum> + <enum name="FRONT_FACE" count="1" value="0x0B46"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEPTH_RANGE" count="2" value="0x0B70"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEPTH_WRITEMASK" count="1" value="0x0B72"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEPTH_CLEAR_VALUE" count="1" value="0x0B73"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEPTH_FUNC" count="1" value="0x0B74"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_CLEAR_VALUE" count="1" value="0x0B91"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_FUNC" count="1" value="0x0B92"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_VALUE_MASK" count="1" value="0x0B93"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_FAIL" count="1" value="0x0B94"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_PASS_DEPTH_FAIL" count="1" value="0x0B95"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_PASS_DEPTH_PASS" count="1" value="0x0B96"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_REF" count="1" value="0x0B97"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_WRITEMASK" count="1" value="0x0B98"> + <size name="Get" mode="get"/> + </enum> + <enum name="VIEWPORT" count="4" value="0x0BA2"> + <size name="Get" mode="get"/> + </enum> + <enum name="SCISSOR_BOX" count="4" value="0x0C10"> + <size name="Get" mode="get"/> + </enum> + <enum name="COLOR_CLEAR_VALUE" count="4" value="0x0C22"> + <size name="Get" mode="get"/> + </enum> + <enum name="COLOR_WRITEMASK" count="4" value="0x0C23"> + <size name="Get" mode="get"/> + </enum> + + <function name="TexParameterfv" offset="179"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="106"/> + </function> + + <function name="TexParameteri" offset="180"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="107"/> + </function> + + <function name="TexParameteriv" offset="181"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="108"/> + </function> + + <function name="GetBooleanv" offset="258"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLboolean *" output="true" variable_param="pname"/> + <glx sop="112" handcode="client"/> + </function> + + <function name="GetFloatv" offset="262"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="116" handcode="client"/> + </function> + + <function name="GetTexParameterfv" offset="282"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="136"/> + </function> + + <function name="GetTexParameteriv" offset="283"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="137"/> + </function> + + <function name="IsEnabled" offset="286"> + <param name="cap" type="GLenum"/> + <return type="GLboolean"/> + <glx sop="140" handcode="client"/> + </function> +</category> + +<!-- base subset of OpenGL 1.1 --> +<category name="base1.1"> + <enum name="POLYGON_OFFSET_FILL" value="0x8037"/> + + <function name="BindTexture" offset="307"> + <param name="target" type="GLenum"/> + <param name="texture" type="GLuint"/> + <glx rop="4117"/> + </function> + + <function name="CopyTexImage2D" offset="324"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLenum"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="border" type="GLint"/> + <glx rop="4120"/> + </function> + + <function name="CopyTexSubImage2D" offset="326"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="4122"/> + </function> + + <function name="DeleteTextures" offset="327"> + <param name="n" type="GLsizei" counter="true"/> + <param name="textures" type="const GLuint *" count="n"/> + <glx sop="144"/> + </function> + + <function name="DrawArrays" offset="310"> + <param name="mode" type="GLenum"/> + <param name="first" type="GLint"/> + <param name="count" type="GLsizei"/> + <glx rop="193" handcode="true"/> + </function> + + <function name="DrawElements" offset="311"> + <param name="mode" type="GLenum"/> + <param name="count" type="GLsizei"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="GenTextures" offset="328"> + <param name="n" type="GLsizei" counter="true"/> + <param name="textures" type="GLuint *" output="true" count="n"/> + <glx sop="145" always_array="true"/> + </function> + + <function name="PolygonOffset" offset="319"> + <param name="factor" type="GLfloat"/> + <param name="units" type="GLfloat"/> + <glx rop="192"/> + </function> + + <function name="TexSubImage2D" offset="333"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="UNUSED" type="GLuint" padding="true"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_xoff="xoffset" img_yoff="yoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + <glx rop="4100" large="true"/> + </function> + + <!-- these are not in OpenGL ES 1.0 --> + <enum name="POLYGON_OFFSET_UNITS" count="1" value="0x2A00"> + <size name="Get" mode="get"/> + </enum> + <enum name="POLYGON_OFFSET_FACTOR" count="1" value="0x8038"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_BINDING_2D" count="1" value="0x8069"> + <size name="Get" mode="get"/> + </enum> + + <function name="IsTexture" offset="330"> + <param name="texture" type="GLuint"/> + <return type="GLboolean"/> + <glx sop="146"/> + </function> +</category> + +<!-- base subset of OpenGL 1.2 --> +<category name="base1.2"> + <enum name="UNSIGNED_SHORT_4_4_4_4" value="0x8033"/> + <enum name="UNSIGNED_SHORT_5_5_5_1" value="0x8034"/> + <enum name="CLAMP_TO_EDGE" value="0x812F"/> + <enum name="UNSIGNED_SHORT_5_6_5" value="0x8363"/> + <enum name="ALIASED_POINT_SIZE_RANGE" count="2" value="0x846D"> + <size name="Get" mode="get"/> + </enum> + <enum name="ALIASED_LINE_WIDTH_RANGE" count="2" value="0x846E"> + <size name="Get" mode="get"/> + </enum> +</category> + +<!-- base subset of OpenGL 1.3 --> +<category name="base1.3"> + <enum name="SAMPLE_ALPHA_TO_COVERAGE" count="1" value="0x809E"> + <size name="Get" mode="get"/> + </enum> + <enum name="SAMPLE_COVERAGE" count="1" value="0x80A0"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE0" value="0x84C0"/> + <enum name="TEXTURE1" value="0x84C1"/> + <enum name="TEXTURE2" value="0x84C2"/> + <enum name="TEXTURE3" value="0x84C3"/> + <enum name="TEXTURE4" value="0x84C4"/> + <enum name="TEXTURE5" value="0x84C5"/> + <enum name="TEXTURE6" value="0x84C6"/> + <enum name="TEXTURE7" value="0x84C7"/> + <enum name="TEXTURE8" value="0x84C8"/> + <enum name="TEXTURE9" value="0x84C9"/> + <enum name="TEXTURE10" value="0x84CA"/> + <enum name="TEXTURE11" value="0x84CB"/> + <enum name="TEXTURE12" value="0x84CC"/> + <enum name="TEXTURE13" value="0x84CD"/> + <enum name="TEXTURE14" value="0x84CE"/> + <enum name="TEXTURE15" value="0x84CF"/> + <enum name="TEXTURE16" value="0x84D0"/> + <enum name="TEXTURE17" value="0x84D1"/> + <enum name="TEXTURE18" value="0x84D2"/> + <enum name="TEXTURE19" value="0x84D3"/> + <enum name="TEXTURE20" value="0x84D4"/> + <enum name="TEXTURE21" value="0x84D5"/> + <enum name="TEXTURE22" value="0x84D6"/> + <enum name="TEXTURE23" value="0x84D7"/> + <enum name="TEXTURE24" value="0x84D8"/> + <enum name="TEXTURE25" value="0x84D9"/> + <enum name="TEXTURE26" value="0x84DA"/> + <enum name="TEXTURE27" value="0x84DB"/> + <enum name="TEXTURE28" value="0x84DC"/> + <enum name="TEXTURE29" value="0x84DD"/> + <enum name="TEXTURE30" value="0x84DE"/> + <enum name="TEXTURE31" value="0x84DF"/> + <enum name="NUM_COMPRESSED_TEXTURE_FORMATS" count="1" value="0x86A2"> + <size name="Get" mode="get"/> + </enum> + <enum name="COMPRESSED_TEXTURE_FORMATS" count="-1" value="0x86A3"> + <size name="Get" mode="get"/> + </enum> + + <function name="ActiveTexture" offset="374"> + <param name="texture" type="GLenum"/> + <glx rop="197"/> + </function> + + <function name="CompressedTexImage2D" offset="assign"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="imageSize" type="GLsizei" counter="true"/> + <param name="data" type="const GLvoid *" count="imageSize"/> + <glx rop="215" handcode="client"/> + </function> + + <function name="CompressedTexSubImage2D" offset="assign"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="imageSize" type="GLsizei" counter="true"/> + <param name="data" type="const GLvoid *" count="imageSize"/> + <glx rop="218" handcode="client"/> + </function> + + <function name="SampleCoverage" offset="assign"> + <param name="value" type="GLclampf"/> + <param name="invert" type="GLboolean"/> + <glx rop="229"/> + </function> + + <!-- these are not in OpenGL ES 1.0 --> + <enum name="SAMPLE_BUFFERS" count="1" value="0x80A8"> + <size name="Get" mode="get"/> + </enum> + <enum name="SAMPLES" count="1" value="0x80A9"> + <size name="Get" mode="get"/> + </enum> + <enum name="SAMPLE_COVERAGE_VALUE" count="1" value="0x80AA"> + <size name="Get" mode="get"/> + </enum> + <enum name="SAMPLE_COVERAGE_INVERT" count="1" value="0x80AB"> + <size name="Get" mode="get"/> + </enum> + <enum name="ACTIVE_TEXTURE" count="1" value="0x84E0"> + <size name="Get" mode="get"/> + </enum> +</category> + +<!-- base subset of OpenGL 1.4 --> +<category name="base1.4"> + <enum name="GENERATE_MIPMAP_HINT" value="0x8192"/> +</category> + +<!-- base subset of OpenGL 1.5 --> +<category name="base1.5"> + <enum name="BUFFER_SIZE" value="0x8764"/> + <enum name="BUFFER_USAGE" value="0x8765"/> + <enum name="ARRAY_BUFFER" value="0x8892"/> + <enum name="ELEMENT_ARRAY_BUFFER" value="0x8893"/> + <enum name="ARRAY_BUFFER_BINDING" value="0x8894"/> + <enum name="ELEMENT_ARRAY_BUFFER_BINDING" value="0x8895"/> + <enum name="STATIC_DRAW" value="0x88E4"/> + <enum name="DYNAMIC_DRAW" value="0x88E8"/> + + <type name="intptr" size="4" glx_name="CARD32"/> + <type name="sizeiptr" size="4" glx_name="CARD32"/> + + <function name="BindBuffer" offset="assign"> + <param name="target" type="GLenum"/> + <param name="buffer" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="BufferData" offset="assign"> + <param name="target" type="GLenum"/> + <param name="size" type="GLsizeiptr" counter="true"/> + <param name="data" type="const GLvoid *" count="size" img_null_flag="true"/> + <param name="usage" type="GLenum"/> + <glx ignore="true"/> + </function> + + <function name="BufferSubData" offset="assign"> + <param name="target" type="GLenum"/> + <param name="offset" type="GLintptr"/> + <param name="size" type="GLsizeiptr" counter="true"/> + <param name="data" type="const GLvoid *" count="size"/> + <glx ignore="true"/> + </function> + + <function name="DeleteBuffers" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="buffer" type="const GLuint *" count="n"/> + <glx ignore="true"/> + </function> + + <function name="GenBuffers" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="buffer" type="GLuint *" output="true" count="n"/> + <glx ignore="true"/> + </function> + + <function name="GetBufferParameteriv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx ignore="true"/> + </function> + + <function name="IsBuffer" offset="assign"> + <param name="buffer" type="GLuint"/> + <return type="GLboolean"/> + <glx ignore="true"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/base2_API.xml b/mesalib/src/mapi/glapi/gen-es/base2_API.xml new file mode 100644 index 000000000..b59ef62de --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/base2_API.xml @@ -0,0 +1,533 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<!-- OpenGL and OpenGL ES 2.x APIs --> + +<OpenGLAPI> + +<xi:include href="base1_API.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<!-- base subset of OpenGL 2.0 --> +<category name="base2.0"> + <enum name="BLEND_EQUATION_RGB" count="1" value="0x8009"> <!-- same as BLEND_EQUATION --> + <size name="Get" mode="get"/> + </enum> + <enum name="VERTEX_ATTRIB_ARRAY_ENABLED" count="1" value="0x8622"> + <size name="GetVertexAttribdv" mode="get"/> + <size name="GetVertexAttribfv" mode="get"/> + <size name="GetVertexAttribiv" mode="get"/> + </enum> + <enum name="VERTEX_ATTRIB_ARRAY_SIZE" count="1" value="0x8623"> + <size name="GetVertexAttribdv" mode="get"/> + <size name="GetVertexAttribfv" mode="get"/> + <size name="GetVertexAttribiv" mode="get"/> + </enum> + <enum name="VERTEX_ATTRIB_ARRAY_STRIDE" count="1" value="0x8624"> + <size name="GetVertexAttribdv" mode="get"/> + <size name="GetVertexAttribfv" mode="get"/> + <size name="GetVertexAttribiv" mode="get"/> + </enum> + <enum name="VERTEX_ATTRIB_ARRAY_TYPE" count="1" value="0x8625"> + <size name="GetVertexAttribdv" mode="get"/> + <size name="GetVertexAttribfv" mode="get"/> + <size name="GetVertexAttribiv" mode="get"/> + </enum> + <enum name="CURRENT_VERTEX_ATTRIB" count="1" value="0x8626"> + <size name="GetVertexAttribdv" mode="get"/> + <size name="GetVertexAttribfv" mode="get"/> + <size name="GetVertexAttribiv" mode="get"/> + </enum> + <enum name="VERTEX_ATTRIB_ARRAY_POINTER" value="0x8645"/> + <enum name="STENCIL_BACK_FUNC" count="1" value="0x8800"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_BACK_FAIL" count="1" value="0x8801"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_BACK_PASS_DEPTH_FAIL" count="1" value="0x8802"> + <size name="Get" mode="get"/> + </enum> + <enum name="STENCIL_BACK_PASS_DEPTH_PASS" count="1" value="0x8803"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_EQUATION_ALPHA" count="1" value="0x883D"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_VERTEX_ATTRIBS" count="1" value="0x8869"> + <size name="Get" mode="get"/> + </enum> + <enum name="VERTEX_ATTRIB_ARRAY_NORMALIZED" value="0x886A"/> + <enum name="MAX_TEXTURE_IMAGE_UNITS" count="1" value="0x8872"> + <size name="Get" mode="get"/> + </enum> + <enum name="FRAGMENT_SHADER" value="0x8B30"/> + <enum name="VERTEX_SHADER" value="0x8B31"/> + <enum name="MAX_VERTEX_TEXTURE_IMAGE_UNITS" value="0x8B4C"/> + <enum name="MAX_COMBINED_TEXTURE_IMAGE_UNITS" value="0x8B4D"/> + <enum name="SHADER_TYPE" value="0x8B4F"/> + <enum name="FLOAT_VEC2" value="0x8B50"/> + <enum name="FLOAT_VEC3" value="0x8B51"/> + <enum name="FLOAT_VEC4" value="0x8B52"/> + <enum name="INT_VEC2" value="0x8B53"/> + <enum name="INT_VEC3" value="0x8B54"/> + <enum name="INT_VEC4" value="0x8B55"/> + <enum name="BOOL" value="0x8B56"/> + <enum name="BOOL_VEC2" value="0x8B57"/> + <enum name="BOOL_VEC3" value="0x8B58"/> + <enum name="BOOL_VEC4" value="0x8B59"/> + <enum name="FLOAT_MAT2" value="0x8B5A"/> + <enum name="FLOAT_MAT3" value="0x8B5B"/> + <enum name="FLOAT_MAT4" value="0x8B5C"/> + <enum name="SAMPLER_2D" value="0x8B5E"/> + <enum name="SAMPLER_CUBE" value="0x8B60"/> + <enum name="DELETE_STATUS" value="0x8B80"/> + <enum name="COMPILE_STATUS" value="0x8B81"/> + <enum name="LINK_STATUS" value="0x8B82"/> + <enum name="VALIDATE_STATUS" value="0x8B83"/> + <enum name="INFO_LOG_LENGTH" value="0x8B84"/> + <enum name="ATTACHED_SHADERS" value="0x8B85"/> + <enum name="ACTIVE_UNIFORMS" value="0x8B86"/> + <enum name="ACTIVE_UNIFORM_MAX_LENGTH" value="0x8B87"/> + <enum name="SHADER_SOURCE_LENGTH" value="0x8B88"/> + <enum name="ACTIVE_ATTRIBUTES" value="0x8B89"/> + <enum name="ACTIVE_ATTRIBUTE_MAX_LENGTH" value="0x8B8A"/> + <enum name="SHADING_LANGUAGE_VERSION" value="0x8B8C"/> + <enum name="CURRENT_PROGRAM" value="0x8B8D"/> + <enum name="STENCIL_BACK_REF" value="0x8CA3"/> + <enum name="STENCIL_BACK_VALUE_MASK" value="0x8CA4"/> + <enum name="STENCIL_BACK_WRITEMASK" value="0x8CA5"/> + + <type name="char" size="1" glx_name="CARD8"/> + + <function name="AttachShader" offset="assign"> + <param name="program" type="GLuint"/> + <param name="shader" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="BindAttribLocation" offset="assign"> + <param name="program" type="GLuint"/> + <param name="index" type="GLuint"/> + <param name="name" type="const GLchar *"/> + <glx ignore="true"/> + </function> + + <function name="BlendEquationSeparate" offset="assign"> + <param name="modeRGB" type="GLenum"/> + <param name="modeA" type="GLenum"/> + <glx rop="4228"/> + </function> + + <function name="CompileShader" offset="assign"> + <param name="shader" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="CreateProgram" offset="assign"> + <return type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="CreateShader" offset="assign"> + <param name="type" type="GLenum"/> + <return type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="DeleteProgram" offset="assign"> + <param name="program" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="DeleteShader" offset="assign"> + <param name="program" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="DetachShader" offset="assign"> + <param name="program" type="GLuint"/> + <param name="shader" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="DisableVertexAttribArray" offset="assign"> + <param name="index" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="EnableVertexAttribArray" offset="assign"> + <param name="index" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="GetActiveAttrib" offset="assign"> + <param name="program" type="GLuint"/> + <param name="index" type="GLuint"/> + <param name="bufSize" type="GLsizei "/> + <param name="length" type="GLsizei *" output="true"/> + <param name="size" type="GLint *" output="true"/> + <param name="type" type="GLenum *" output="true"/> + <param name="name" type="GLchar *" output="true"/> + <glx ignore="true"/> + </function> + + <function name="GetActiveUniform" offset="assign"> + <param name="program" type="GLuint"/> + <param name="index" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *" output="true"/> + <param name="size" type="GLint *" output="true"/> + <param name="type" type="GLenum *" output="true"/> + <param name="name" type="GLchar *" output="true"/> + <glx ignore="true"/> + </function> + + <function name="GetAttachedShaders" offset="assign"> + <param name="program" type="GLuint"/> + <param name="maxCount" type="GLsizei"/> + <param name="count" type="GLsizei *" output="true"/> + <param name="obj" type="GLuint *" output="true"/> + <glx ignore="true"/> + </function> + + <function name="GetAttribLocation" offset="assign"> + <param name="program" type="GLuint"/> + <param name="name" type="const GLchar *"/> + <return type="GLint"/> + <glx ignore="true"/> + </function> + + <function name="GetProgramiv" offset="assign"> + <param name="program" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *"/> + <glx ignore="true"/> + </function> + + <function name="GetProgramInfoLog" offset="assign"> + <param name="program" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="infoLog" type="GLchar *"/> + <glx ignore="true"/> + </function> + + <function name="GetShaderiv" offset="assign"> + <param name="shader" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *"/> + <glx ignore="true"/> + </function> + + <function name="GetShaderInfoLog" offset="assign"> + <param name="shader" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="infoLog" type="GLchar *"/> + <glx ignore="true"/> + </function> + + <function name="GetShaderSource" offset="assign"> + <param name="shader" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *" output="true"/> + <param name="source" type="GLchar *" output="true"/> + <glx ignore="true"/> + </function> + + <function name="GetUniformfv" offset="assign"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="params" type="GLfloat *" output="true"/> + <glx ignore="true"/> + </function> + + <function name="GetUniformiv" offset="assign"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="params" type="GLint *"/> + <glx ignore="true"/> + </function> + + <function name="GetUniformLocation" offset="assign"> + <param name="program" type="GLuint"/> + <param name="name" type="const GLchar *"/> + <return type="GLint"/> + <glx ignore="true"/> + </function> + + <function name="GetVertexAttribfv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx ignore="true"/> + </function> + + <function name="GetVertexAttribiv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx ignore="true"/> + </function> + + <function name="GetVertexAttribPointerv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="pointer" type="GLvoid **" output="true"/> + <glx ignore="true"/> + </function> + + <function name="IsProgram" offset="assign"> + <param name="program" type="GLuint"/> + <return type="GLboolean"/> + <glx ignore="true"/> + </function> + + <function name="IsShader" offset="assign"> + <param name="shader" type="GLuint"/> + <return type="GLboolean"/> + <glx ignore="true"/> + </function> + + <function name="LinkProgram" offset="assign"> + <param name="program" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="ShaderSource" offset="assign"> + <param name="shader" type="GLuint"/> + <param name="count" type="GLsizei"/> + <param name="string" type="const GLchar **"/> + <param name="length" type="const GLint *"/> + <glx ignore="true"/> + </function> + + <function name="StencilFuncSeparate" offset="assign"> + <param name="face" type="GLenum"/> + <param name="func" type="GLenum"/> + <param name="ref" type="GLint"/> + <param name="mask" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="StencilOpSeparate" offset="assign"> + <param name="face" type="GLenum"/> + <param name="sfail" type="GLenum"/> + <param name="zfail" type="GLenum"/> + <param name="zpass" type="GLenum"/> + <glx ignore="true"/> + </function> + + <function name="StencilMaskSeparate" offset="assign"> + <param name="face" type="GLenum"/> + <param name="mask" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="Uniform1f" offset="assign"> + <param name="location" type="GLint"/> + <param name="v0" type="GLfloat"/> + <glx ignore="true"/> + </function> + + <function name="Uniform1fv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLfloat *"/> + <glx ignore="true"/> + </function> + + <function name="Uniform1i" offset="assign"> + <param name="location" type="GLint"/> + <param name="v0" type="GLint"/> + <glx ignore="true"/> + </function> + + <function name="Uniform1iv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLint *"/> + <glx ignore="true"/> + </function> + + <function name="Uniform2f" offset="assign"> + <param name="location" type="GLint"/> + <param name="v0" type="GLfloat"/> + <param name="v1" type="GLfloat"/> + <glx ignore="true"/> + </function> + + <function name="Uniform2fv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLfloat *"/> + <glx ignore="true"/> + </function> + + <function name="Uniform2i" offset="assign"> + <param name="location" type="GLint"/> + <param name="v0" type="GLint"/> + <param name="v1" type="GLint"/> + <glx ignore="true"/> + </function> + + <function name="Uniform2iv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLint *"/> + <glx ignore="true"/> + </function> + + <function name="Uniform3f" offset="assign"> + <param name="location" type="GLint"/> + <param name="v0" type="GLfloat"/> + <param name="v1" type="GLfloat"/> + <param name="v2" type="GLfloat"/> + <glx ignore="true"/> + </function> + + <function name="Uniform3fv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLfloat *"/> + <glx ignore="true"/> + </function> + + <function name="Uniform3i" offset="assign"> + <param name="location" type="GLint"/> + <param name="v0" type="GLint"/> + <param name="v1" type="GLint"/> + <param name="v2" type="GLint"/> + <glx ignore="true"/> + </function> + + <function name="Uniform3iv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLint *"/> + <glx ignore="true"/> + </function> + + <function name="Uniform4f" offset="assign"> + <param name="location" type="GLint"/> + <param name="v0" type="GLfloat"/> + <param name="v1" type="GLfloat"/> + <param name="v2" type="GLfloat"/> + <param name="v3" type="GLfloat"/> + <glx ignore="true"/> + </function> + + <function name="Uniform4fv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLfloat *"/> + <glx ignore="true"/> + </function> + + <function name="Uniform4i" offset="assign"> + <param name="location" type="GLint"/> + <param name="v0" type="GLint"/> + <param name="v1" type="GLint"/> + <param name="v2" type="GLint"/> + <param name="v3" type="GLint"/> + <glx ignore="true"/> + </function> + + <function name="Uniform4iv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLint *"/> + <glx ignore="true"/> + </function> + + <function name="UniformMatrix2fv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="transpose" type="GLboolean"/> + <param name="value" type="const GLfloat *"/> + <glx ignore="true"/> + </function> + + <function name="UniformMatrix3fv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="transpose" type="GLboolean"/> + <param name="value" type="const GLfloat *"/> + <glx ignore="true"/> + </function> + + <function name="UniformMatrix4fv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="transpose" type="GLboolean"/> + <param name="value" type="const GLfloat *"/> + <glx ignore="true"/> + </function> + + <function name="UseProgram" offset="assign"> + <param name="program" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="ValidateProgram" offset="assign"> + <param name="program" type="GLuint"/> + <glx ignore="true"/> + </function> + + <function name="VertexAttrib1f" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLfloat"/> + </function> + + <function name="VertexAttrib1fv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLfloat *"/> + </function> + + <function name="VertexAttrib2f" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + </function> + + <function name="VertexAttrib2fv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLfloat *"/> + </function> + + <function name="VertexAttrib3f" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + </function> + + <function name="VertexAttrib3fv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLfloat *"/> + </function> + + <function name="VertexAttrib4f" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <param name="w" type="GLfloat"/> + </function> + + <function name="VertexAttrib4fv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLfloat *"/> + </function> + + <function name="VertexAttribPointer" offset="assign"> + <param name="index" type="GLuint"/> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="normalized" type="GLboolean"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/es1_API.xml b/mesalib/src/mapi/glapi/gen-es/es1_API.xml new file mode 100644 index 000000000..3428ae561 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/es1_API.xml @@ -0,0 +1,1100 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<!-- OpenGL ES 1.x API --> + +<OpenGLAPI> + +<xi:include href="base1_API.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<!-- core subset of OpenGL 1.3 defined in OpenGL ES 1.0 --> +<category name="core1.0"> + <!-- addition to base1.0 --> + <enum name="ADD" value="0x0104"/> + <enum name="STACK_OVERFLOW" value="0x0503"/> + <enum name="STACK_UNDERFLOW" value="0x0504"/> + <enum name="EXP" value="0x0800"/> + <enum name="EXP2" value="0x0801"/> + <enum name="POINT_SMOOTH" count="1" value="0x0B10"> + <size name="Get" mode="get"/> + </enum> + <enum name="LINE_SMOOTH" count="1" value="0x0B20"> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHTING" count="1" value="0x0B50"> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHT_MODEL_TWO_SIDE" count="1" value="0x0B52"> + <size name="LightModelfv"/> + <size name="LightModeliv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHT_MODEL_AMBIENT" count="4" value="0x0B53"> + <size name="LightModelfv"/> + <size name="LightModeliv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="COLOR_MATERIAL" count="1" value="0x0B57"> + <size name="Get" mode="get"/> + </enum> + <enum name="FOG" count="1" value="0x0B60"> + <size name="Get" mode="get"/> + </enum> + <enum name="FOG_DENSITY" count="1" value="0x0B62"> + <size name="Fogfv"/> + <size name="Fogiv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="FOG_START" count="1" value="0x0B63"> + <size name="Fogfv"/> + <size name="Fogiv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="FOG_END" count="1" value="0x0B64"> + <size name="Fogfv"/> + <size name="Fogiv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="FOG_MODE" count="1" value="0x0B65"> + <size name="Fogfv"/> + <size name="Fogiv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="FOG_COLOR" count="4" value="0x0B66"> + <size name="Fogfv"/> + <size name="Fogiv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="NORMALIZE" count="1" value="0x0BA1"> + <size name="Get" mode="get"/> + </enum> + <enum name="ALPHA_TEST" count="1" value="0x0BC0"> + <size name="Get" mode="get"/> + </enum> + <enum name="PERSPECTIVE_CORRECTION_HINT" count="1" value="0x0C50"> + <size name="Get" mode="get"/> + </enum> + <enum name="POINT_SMOOTH_HINT" count="1" value="0x0C51"> + <size name="Get" mode="get"/> + </enum> + <enum name="LINE_SMOOTH_HINT" count="1" value="0x0C52"> + <size name="Get" mode="get"/> + </enum> + <enum name="POLYGON_SMOOTH_HINT" count="1" value="0x0C53"> + <size name="Get" mode="get"/> + </enum> + <enum name="FOG_HINT" count="1" value="0x0C54"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_LIGHTS" count="1" value="0x0D31"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_MODELVIEW_STACK_DEPTH" count="1" value="0x0D36"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_PROJECTION_STACK_DEPTH" count="1" value="0x0D38"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_TEXTURE_STACK_DEPTH" count="1" value="0x0D39"> + <size name="Get" mode="get"/> + </enum> + <enum name="AMBIENT" count="4" value="0x1200"> + <size name="Materialfv"/> + <size name="Materialiv"/> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetMaterialfv" mode="get"/> + <size name="GetMaterialiv" mode="get"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="DIFFUSE" count="4" value="0x1201"> + <size name="Materialfv"/> + <size name="Materialiv"/> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetMaterialfv" mode="get"/> + <size name="GetMaterialiv" mode="get"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="SPECULAR" count="4" value="0x1202"> + <size name="Materialfv"/> + <size name="Materialiv"/> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetMaterialfv" mode="get"/> + <size name="GetMaterialiv" mode="get"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="POSITION" count="4" value="0x1203"> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="SPOT_DIRECTION" count="3" value="0x1204"> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="SPOT_EXPONENT" count="1" value="0x1205"> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="SPOT_CUTOFF" count="1" value="0x1206"> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="CONSTANT_ATTENUATION" count="1" value="0x1207"> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="LINEAR_ATTENUATION" count="1" value="0x1208"> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="QUADRATIC_ATTENUATION" count="1" value="0x1209"> + <size name="Lightfv"/> + <size name="Lightiv"/> + <size name="GetLightfv" mode="get"/> + <size name="GetLightiv" mode="get"/> + </enum> + <enum name="CLEAR" value="0x1500"/> + <enum name="AND" value="0x1501"/> + <enum name="AND_REVERSE" value="0x1502"/> + <enum name="COPY" value="0x1503"/> + <enum name="AND_INVERTED" value="0x1504"/> + <enum name="NOOP" value="0x1505"/> + <enum name="XOR" value="0x1506"/> + <enum name="OR" value="0x1507"/> + <enum name="NOR" value="0x1508"/> + <enum name="EQUIV" value="0x1509"/> + <enum name="OR_REVERSE" value="0x150B"/> + <enum name="COPY_INVERTED" value="0x150C"/> + <enum name="OR_INVERTED" value="0x150D"/> + <enum name="NAND" value="0x150E"/> + <enum name="SET" value="0x150F"/> + <enum name="EMISSION" count="4" value="0x1600"> + <size name="Materialfv"/> + <size name="Materialiv"/> + <size name="GetMaterialfv" mode="get"/> + <size name="GetMaterialiv" mode="get"/> + </enum> + <enum name="SHININESS" count="1" value="0x1601"> + <size name="Materialfv"/> + <size name="Materialiv"/> + <size name="GetMaterialfv" mode="get"/> + <size name="GetMaterialiv" mode="get"/> + </enum> + <enum name="AMBIENT_AND_DIFFUSE" count="4" value="0x1602"> + <size name="Materialfv"/> + <size name="Materialiv"/> + <size name="GetMaterialfv" mode="get"/> + <size name="GetMaterialiv" mode="get"/> + </enum> + <enum name="MODELVIEW" value="0x1700"/> + <enum name="PROJECTION" value="0x1701"/> + <enum name="FLAT" value="0x1D00"/> + <enum name="SMOOTH" value="0x1D01"/> + <enum name="MODULATE" value="0x2100"/> + <enum name="DECAL" value="0x2101"/> + <enum name="TEXTURE_ENV_MODE" count="1" value="0x2200"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="TEXTURE_ENV_COLOR" count="4" value="0x2201"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="TEXTURE_ENV" value="0x2300"/> + <enum name="LIGHT0" count="1" value="0x4000"> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHT1" count="1" value="0x4001"> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHT2" count="1" value="0x4002"> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHT3" count="1" value="0x4003"> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHT4" count="1" value="0x4004"> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHT5" count="1" value="0x4005"> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHT6" count="1" value="0x4006"> + <size name="Get" mode="get"/> + </enum> + <enum name="LIGHT7" count="1" value="0x4007"> + <size name="Get" mode="get"/> + </enum> + + <function name="AlphaFunc" offset="240"> + <param name="func" type="GLenum"/> + <param name="ref" type="GLclampf"/> + <glx rop="159"/> + </function> + + <function name="Color4f" offset="29" vectorequiv="Color4fv"> + <param name="red" type="GLfloat"/> + <param name="green" type="GLfloat"/> + <param name="blue" type="GLfloat"/> + <param name="alpha" type="GLfloat"/> + </function> + + <function name="Fogf" offset="153"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="80"/> + </function> + + <function name="Fogfv" offset="154"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="81"/> + </function> + + <function name="Lightf" offset="159"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="86"/> + </function> + + <function name="Lightfv" offset="160"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="87"/> + </function> + + <function name="LightModelf" offset="163"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="90"/> + </function> + + <function name="LightModelfv" offset="164"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="91"/> + </function> + + <function name="LoadIdentity" offset="290"> + <glx rop="176"/> + </function> + + <function name="LoadMatrixf" offset="291"> + <param name="m" type="const GLfloat *" count="16"/> + <glx rop="177"/> + </function> + + <function name="LogicOp" offset="242"> + <param name="opcode" type="GLenum"/> + <glx rop="161"/> + </function> + + <function name="Materialf" offset="169"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="96"/> + </function> + + <function name="Materialfv" offset="170"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="97"/> + </function> + + <function name="MatrixMode" offset="293"> + <param name="mode" type="GLenum"/> + <glx rop="179"/> + </function> + + <function name="MultMatrixf" offset="294"> + <param name="m" type="const GLfloat *" count="16"/> + <glx rop="180"/> + </function> + + <function name="Normal3f" offset="56" vectorequiv="Normal3fv"> + <param name="nx" type="GLfloat"/> + <param name="ny" type="GLfloat"/> + <param name="nz" type="GLfloat"/> + </function> + + <function name="PointSize" offset="173"> + <param name="size" type="GLfloat"/> + <glx rop="100"/> + </function> + + <function name="PopMatrix" offset="297"> + <glx rop="183"/> + </function> + + <function name="PushMatrix" offset="298"> + <glx rop="184"/> + </function> + + <function name="Rotatef" offset="300"> + <param name="angle" type="GLfloat"/> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <glx rop="186"/> + </function> + + <function name="Scalef" offset="302"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <glx rop="188"/> + </function> + + <function name="ShadeModel" offset="177"> + <param name="mode" type="GLenum"/> + <glx rop="104"/> + </function> + + <function name="TexEnvf" offset="184"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="111"/> + </function> + + <function name="TexEnvfv" offset="185"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="112"/> + </function> + + <function name="TexImage2D" offset="183"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="target" img_send_null="true" img_pad_dimensions="true"/> + <glx rop="110" large="true"/> + </function> + + <function name="Translatef" offset="304"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <glx rop="190"/> + </function> + + <!-- addition to base1.1 --> + <enum name="COLOR_LOGIC_OP" value="0x0BF2"/> + <enum name="VERTEX_ARRAY" count="1" value="0x8074"> + <size name="Get" mode="get"/> + </enum> + <enum name="NORMAL_ARRAY" count="1" value="0x8075"> + <size name="Get" mode="get"/> + </enum> + <enum name="COLOR_ARRAY" count="1" value="0x8076"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_COORD_ARRAY" count="1" value="0x8078"> + <size name="Get" mode="get"/> + </enum> + + <function name="ColorPointer" offset="308"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="DisableClientState" offset="309"> + <param name="array" type="GLenum"/> + <glx handcode="true"/> + </function> + + <function name="EnableClientState" offset="313"> + <param name="array" type="GLenum"/> + <glx handcode="true"/> + </function> + + <function name="NormalPointer" offset="318"> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="TexCoordPointer" offset="320"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="VertexPointer" offset="321"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <!-- addition to base1.2 --> + <enum name="SMOOTH_POINT_SIZE_RANGE" count="2" value="0x0B12"> + <size name="Get" mode="get"/> + </enum> + <enum name="SMOOTH_LINE_WIDTH_RANGE" count="2" value="0x0B22"> + <size name="Get" mode="get"/> + </enum> + <enum name="RESCALE_NORMAL" count="1" value="0x803A"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_ELEMENTS_VERTICES" count="1" value="0x80E8"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_ELEMENTS_INDICES" count="1" value="0x80E9"> + <size name="Get" mode="get"/> + </enum> + + <!-- addition to base1.3 --> + <enum name="MULTISAMPLE" count="1" value="0x809D"> + <size name="Get" mode="get"/> + </enum> + <enum name="SAMPLE_ALPHA_TO_ONE" count="1" value="0x809F"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_TEXTURE_UNITS" count="1" value="0x84E2"> + <size name="Get" mode="get"/> + </enum> + + <function name="ClientActiveTexture" offset="375"> + <param name="texture" type="GLenum"/> + <glx handcode="true"/> + </function> + + <function name="MultiTexCoord4f" offset="402" vectorequiv="MultiTexCoord4fv"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfloat"/> + <param name="t" type="GLfloat"/> + <param name="r" type="GLfloat"/> + <param name="q" type="GLfloat"/> + </function> +</category> + +<!-- core subset of OpenGL 1.5 defined in OpenGL ES 1.1 --> +<category name="core1.1"> + <!-- addition to base1.0 --> + <enum name="CURRENT_COLOR" count="4" value="0x0B00"> + <size name="Get" mode="get"/> + </enum> + <enum name="CURRENT_NORMAL" count="3" value="0x0B02"> + <size name="Get" mode="get"/> + </enum> + <enum name="CURRENT_TEXTURE_COORDS" count="4" value="0x0B03"> + <size name="Get" mode="get"/> + </enum> + <enum name="POINT_SIZE" count="1" value="0x0B11"> + <size name="Get" mode="get"/> + </enum> + <enum name="SHADE_MODEL" count="1" value="0x0B54"> + <size name="Get" mode="get"/> + </enum> + <enum name="MATRIX_MODE" count="1" value="0x0BA0"> + <size name="Get" mode="get"/> + </enum> + <enum name="MODELVIEW_STACK_DEPTH" count="1" value="0x0BA3"> + <size name="Get" mode="get"/> + </enum> + <enum name="PROJECTION_STACK_DEPTH" count="1" value="0x0BA4"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_STACK_DEPTH" count="1" value="0x0BA5"> + <size name="Get" mode="get"/> + </enum> + <enum name="MODELVIEW_MATRIX" count="16" value="0x0BA6"> + <size name="Get" mode="get"/> + </enum> + <enum name="PROJECTION_MATRIX" count="16" value="0x0BA7"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_MATRIX" count="16" value="0x0BA8"> + <size name="Get" mode="get"/> + </enum> + <enum name="ALPHA_TEST_FUNC" count="1" value="0x0BC1"> + <size name="Get" mode="get"/> + </enum> + <enum name="ALPHA_TEST_REF" count="1" value="0x0BC2"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_DST" count="1" value="0x0BE0"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_SRC" count="1" value="0x0BE1"> + <size name="Get" mode="get"/> + </enum> + <enum name="LOGIC_OP_MODE" count="1" value="0x0BF0"> + <size name="Get" mode="get"/> + </enum> + <enum name="ALPHA_SCALE" count="1" value="0x0D1C"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_CLIP_PLANES" count="1" value="0x0D32"> + <size name="Get" mode="get"/> + </enum> + <enum name="CLIP_PLANE0" count="1" value="0x3000"> + <size name="Get" mode="get"/> + </enum> + <enum name="CLIP_PLANE1" count="1" value="0x3001"> + <size name="Get" mode="get"/> + </enum> + <enum name="CLIP_PLANE2" count="1" value="0x3002"> + <size name="Get" mode="get"/> + </enum> + <enum name="CLIP_PLANE3" count="1" value="0x3003"> + <size name="Get" mode="get"/> + </enum> + <enum name="CLIP_PLANE4" count="1" value="0x3004"> + <size name="Get" mode="get"/> + </enum> + <enum name="CLIP_PLANE5" count="1" value="0x3005"> + <size name="Get" mode="get"/> + </enum> + + <function name="Color4ub" offset="35" vectorequiv="Color4ubv"> + <param name="red" type="GLubyte"/> + <param name="green" type="GLubyte"/> + <param name="blue" type="GLubyte"/> + <param name="alpha" type="GLubyte"/> + </function> + + <function name="GetLightfv" offset="264"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="118"/> + </function> + + <function name="GetMaterialfv" offset="269"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="123"/> + </function> + + <function name="GetTexEnvfv" offset="276"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="130"/> + </function> + + <function name="GetTexEnviv" offset="277"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="131"/> + </function> + + <function name="TexEnvi" offset="186"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="113"/> + </function> + + <function name="TexEnviv" offset="187"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="114"/> + </function> + + <!-- addition to base1.1 --> + <enum name="VERTEX_ARRAY_SIZE" count="1" value="0x807A"> + <size name="Get" mode="get"/> + </enum> + <enum name="VERTEX_ARRAY_TYPE" count="1" value="0x807B"> + <size name="Get" mode="get"/> + </enum> + <enum name="VERTEX_ARRAY_STRIDE" count="1" value="0x807C"> + <size name="Get" mode="get"/> + </enum> + <enum name="NORMAL_ARRAY_TYPE" count="1" value="0x807E"> + <size name="Get" mode="get"/> + </enum> + <enum name="NORMAL_ARRAY_STRIDE" count="1" value="0x807F"> + <size name="Get" mode="get"/> + </enum> + <enum name="COLOR_ARRAY_SIZE" count="1" value="0x8081"> + <size name="Get" mode="get"/> + </enum> + <enum name="COLOR_ARRAY_TYPE" count="1" value="0x8082"> + <size name="Get" mode="get"/> + </enum> + <enum name="COLOR_ARRAY_STRIDE" count="1" value="0x8083"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_COORD_ARRAY_SIZE" count="1" value="0x8088"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_COORD_ARRAY_TYPE" count="1" value="0x8089"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_COORD_ARRAY_STRIDE" count="1" value="0x808A"> + <size name="Get" mode="get"/> + </enum> + <enum name="VERTEX_ARRAY_POINTER" value="0x808E"/> + <enum name="NORMAL_ARRAY_POINTER" value="0x808F"/> + <enum name="COLOR_ARRAY_POINTER" value="0x8090"/> + <enum name="TEXTURE_COORD_ARRAY_POINTER" value="0x8092"/> + + <function name="GetPointerv" offset="329"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLvoid **" output="true"/> + <glx handcode="true"/> + </function> + + <!-- addition to base1.2 --> + + <!-- addition to base1.3 --> + <enum name="CLIENT_ACTIVE_TEXTURE" count="1" value="0x84E1"> + <size name="Get" mode="get"/> + </enum> + <enum name="SUBTRACT" value="0x84E7"/> + <enum name="COMBINE" value="0x8570"/> + <enum name="COMBINE_RGB" count="1" value="0x8571"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="COMBINE_ALPHA" count="1" value="0x8572"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="RGB_SCALE" count="1" value="0x8573"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="ADD_SIGNED" value="0x8574"/> + <enum name="INTERPOLATE" value="0x8575"/> + <enum name="CONSTANT" value="0x8576"/> + <enum name="PRIMARY_COLOR" value="0x8577"/> + <enum name="PREVIOUS" value="0x8578"/> + <enum name="OPERAND0_RGB" count="1" value="0x8590"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="OPERAND1_RGB" count="1" value="0x8591"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="OPERAND2_RGB" count="1" value="0x8592"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="OPERAND0_ALPHA" count="1" value="0x8598"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="OPERAND1_ALPHA" count="1" value="0x8599"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="OPERAND2_ALPHA" count="1" value="0x859A"> + <size name="TexEnvfv"/> + <size name="TexEnviv"/> + <size name="GetTexEnvfv" mode="get"/> + <size name="GetTexEnviv" mode="get"/> + </enum> + <enum name="DOT3_RGB" value="0x86AE"/> + <enum name="DOT3_RGBA" value="0x86AF"/> + + <!-- addition to base1.4 --> + <enum name="POINT_SIZE_MIN" count="1" value="0x8126"> + <size name="PointParameterfv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="POINT_SIZE_MAX" count="1" value="0x8127"> + <size name="PointParameterfv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="POINT_FADE_THRESHOLD_SIZE" count="1" value="0x8128"> + <size name="PointParameterfv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="POINT_DISTANCE_ATTENUATION" count="3" value="0x8129"> + <size name="PointParameterfv"/> + <size name="Get" mode="get"/> + </enum> + <enum name="GENERATE_MIPMAP" count="1" value="0x8191"> + <size name="TexParameterfv"/> + <size name="TexParameteriv"/> + <size name="GetTexParameterfv" mode="get"/> + <size name="GetTexParameteriv" mode="get"/> + </enum> + + <function name="PointParameterf" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="2065"/> + </function> + + <function name="PointParameterfv" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="2066"/> + </function> + + <!-- addition to base1.5 --> + <enum name="SRC0_RGB" value="0x8580"/> + <enum name="SRC1_RGB" value="0x8581"/> + <enum name="SRC2_RGB" value="0x8582"/> + <enum name="SRC0_ALPHA" value="0x8588"/> + <enum name="SRC1_ALPHA" value="0x8589"/> + <enum name="SRC2_ALPHA" value="0x858A"/> + <enum name="VERTEX_ARRAY_BUFFER_BINDING" count="1" value="0x8896"> + <size name="Get" mode="get"/> + </enum> + <enum name="NORMAL_ARRAY_BUFFER_BINDING" count="1" value="0x8897"> + <size name="Get" mode="get"/> + </enum> + <enum name="COLOR_ARRAY_BUFFER_BINDING" count="1" value="0x8898"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_COORD_ARRAY_BUFFER_BINDING" count="1" value="0x889A"> + <size name="Get" mode="get"/> + </enum> +</category> + +<!-- OpenGL ES 1.0 --> +<category name="es1.0"> + <!-- addition to core1.0 --> + + <!-- from GL_OES_fixed_point --> + <enum name="FIXED" value="0x140C"/> + + <type name="fixed" size="4" /> + <type name="clampx" size="4" /> + + <function name="AlphaFuncx" offset="assign"> + <param name="func" type="GLenum"/> + <param name="ref" type="GLclampx"/> + </function> + + <function name="ClearColorx" offset="assign"> + <param name="red" type="GLclampx"/> + <param name="green" type="GLclampx"/> + <param name="blue" type="GLclampx"/> + <param name="alpha" type="GLclampx"/> + </function> + + <function name="ClearDepthx" offset="assign"> + <param name="depth" type="GLclampx"/> + </function> + + <function name="Color4x" offset="assign"> + <param name="red" type="GLfixed"/> + <param name="green" type="GLfixed"/> + <param name="blue" type="GLfixed"/> + <param name="alpha" type="GLfixed"/> + </function> + + <function name="DepthRangex" offset="assign"> + <param name="zNear" type="GLclampx"/> + <param name="zFar" type="GLclampx"/> + </function> + + <function name="Fogx" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="Fogxv" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="Frustumx" offset="assign"> + <param name="left" type="GLfixed"/> + <param name="right" type="GLfixed"/> + <param name="bottom" type="GLfixed"/> + <param name="top" type="GLfixed"/> + <param name="zNear" type="GLfixed"/> + <param name="zFar" type="GLfixed"/> + </function> + + <function name="LightModelx" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="LightModelxv" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="Lightx" offset="assign"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="Lightxv" offset="assign"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="LineWidthx" offset="assign"> + <param name="width" type="GLfixed"/> + </function> + + <function name="LoadMatrixx" offset="assign"> + <param name="m" type="const GLfixed *" count="16"/> + </function> + + <function name="Materialx" offset="assign"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="Materialxv" offset="assign"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="MultMatrixx" offset="assign"> + <param name="m" type="const GLfixed *" count="16"/> + </function> + + <function name="MultiTexCoord4x" offset="assign"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfixed"/> + <param name="t" type="GLfixed"/> + <param name="r" type="GLfixed"/> + <param name="q" type="GLfixed"/> + </function> + + <function name="Normal3x" offset="assign"> + <param name="nx" type="GLfixed"/> + <param name="ny" type="GLfixed"/> + <param name="nz" type="GLfixed"/> + </function> + + <function name="Orthox" offset="assign"> + <param name="left" type="GLfixed"/> + <param name="right" type="GLfixed"/> + <param name="bottom" type="GLfixed"/> + <param name="top" type="GLfixed"/> + <param name="zNear" type="GLfixed"/> + <param name="zFar" type="GLfixed"/> + </function> + + <function name="PointSizex" offset="assign"> + <param name="size" type="GLfixed"/> + </function> + + <function name="PolygonOffsetx" offset="assign"> + <param name="factor" type="GLfixed"/> + <param name="units" type="GLfixed"/> + </function> + + <function name="Rotatex" offset="assign"> + <param name="angle" type="GLfixed"/> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <function name="SampleCoveragex" offset="assign"> + <param name="value" type="GLclampx"/> + <param name="invert" type="GLboolean"/> + </function> + + <function name="Scalex" offset="assign"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <function name="TexEnvx" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="TexEnvxv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="TexParameterx" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="Translatex" offset="assign"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <!-- from GL_OES_single_precision --> + <function name="ClearDepthf" offset="assign"> + <param name="depth" type="GLclampf"/> + </function> + + <function name="DepthRangef" offset="assign"> + <param name="zNear" type="GLclampf"/> + <param name="zFar" type="GLclampf"/> + </function> + + <function name="Frustumf" offset="assign"> + <param name="left" type="GLfloat"/> + <param name="right" type="GLfloat"/> + <param name="bottom" type="GLfloat"/> + <param name="top" type="GLfloat"/> + <param name="zNear" type="GLfloat"/> + <param name="zFar" type="GLfloat"/> + </function> + + <function name="Orthof" offset="assign"> + <param name="left" type="GLfloat"/> + <param name="right" type="GLfloat"/> + <param name="bottom" type="GLfloat"/> + <param name="top" type="GLfloat"/> + <param name="zNear" type="GLfloat"/> + <param name="zFar" type="GLfloat"/> + </function> +</category> + +<!-- OpenGL ES 1.1 --> +<category name="es1.1"> + <!-- addition to core1.1 --> + + <!-- from GL_OES_fixed_point --> + <function name="ClipPlanex" offset="assign"> + <param name="plane" type="GLenum"/> + <param name="equation" type="const GLfixed *" count="4"/> + </function> + + <function name="GetClipPlanex" offset="assign"> + <param name="plane" type="GLenum"/> + <param name="equation" type="GLfixed *" output="true" count="4"/> + </function> + + <function name="GetFixedv" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetLightxv" offset="assign"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetMaterialxv" offset="assign"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetTexEnvxv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetTexParameterxv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="PointParameterx" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="PointParameterxv" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *"/> + </function> + + <function name="TexParameterxv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <!-- from GL_OES_matrix_get --> + <enum name="MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898D"/> + <enum name="PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898E"/> + <enum name="TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898F"/> + + <!-- from GL_OES_single_precision --> + <function name="ClipPlanef" offset="assign"> + <param name="plane" type="GLenum"/> + <param name="equation" type="const GLfloat *" count="4"/> + </function> + + <function name="GetClipPlanef" offset="assign"> + <param name="plane" type="GLenum"/> + <param name="equation" type="GLfloat *" output="true" count="4"/> + </function> +</category> + +<xi:include href="es1_EXT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<xi:include href="es1_COMPAT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/es1_COMPAT.xml b/mesalib/src/mapi/glapi/gen-es/es1_COMPAT.xml new file mode 100644 index 000000000..096cea88d --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/es1_COMPAT.xml @@ -0,0 +1,135 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<OpenGLAPI> + +<!-- This file defines the functions that are needed by Mesa. It + makes sure the generated glapi headers are compatible with Mesa. + It mainly consists of missing functions and aliases in OpenGL ES. +--> + +<xi:include href="es_COMPAT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<!-- except for those defined by es_COMPAT.xml, these are also needed --> +<category name="compat"> + <!-- OpenGL 1.0 --> + <function name="TexGenf" alias="TexGenfOES" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="117"/> + </function> + + <function name="TexGenfv" alias="TexGenfvOES" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="118"/> + </function> + + <function name="TexGeni" alias="TexGeniOES" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="119"/> + </function> + + <function name="TexGeniv" alias="TexGenivOES" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="120"/> + </function> + + <function name="GetTexGenfv" alias="GetTexGenfvOES" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="133"/> + </function> + + <function name="GetTexGeniv" alias="GetTexGenivOES" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="134"/> + </function> + + <!-- OpenGL 1.2 --> + <function name="BlendColor" offset="336" static_dispatch="false"> + <param name="red" type="GLclampf"/> + <param name="green" type="GLclampf"/> + <param name="blue" type="GLclampf"/> + <param name="alpha" type="GLclampf"/> + <glx rop="4096"/> + </function> + + <function name="BlendEquation" alias="BlendEquationOES" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="4097"/> + </function> + + <function name="TexImage3D" offset="371" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/> + <glx rop="4114" large="true"/> + </function> + + <function name="TexSubImage3D" offset="372" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="UNUSED" type="GLuint" padding="true"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + <glx rop="4115" large="true"/> + </function> + + <function name="CopyTexSubImage3D" offset="373" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="4123"/> + </function> + + <!-- GL_ARB_multitexture --> + <function name="ActiveTextureARB" alias="ActiveTexture" static_dispatch="false"> + <param name="texture" type="GLenum"/> + <glx rop="197"/> + </function> + + <function name="ClientActiveTextureARB" alias="ClientActiveTexture" static_dispatch="false"> + <param name="texture" type="GLenum"/> + <glx handcode="true"/> + </function> + + <function name="MultiTexCoord4fARB" alias="MultiTexCoord4f" vectorequiv="MultiTexCoord4fvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfloat"/> + <param name="t" type="GLfloat"/> + <param name="r" type="GLfloat"/> + <param name="q" type="GLfloat"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/es1_EXT.xml b/mesalib/src/mapi/glapi/gen-es/es1_EXT.xml new file mode 100644 index 000000000..c1e86373d --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/es1_EXT.xml @@ -0,0 +1,699 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<!-- OpenGL ES 1.x extensions --> + +<OpenGLAPI> + +<xi:include href="es_EXT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_blend_equation_separate" number="1"> + <enum name="BLEND_EQUATION_RGB_OES" count="1" value="0x8009"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_EQUATION_ALPHA_OES" count="1" value="0x883D"> + <size name="Get" mode="get"/> + </enum> + + <function name="BlendEquationSeparateOES" offset="assign"> + <param name="modeRGB" type="GLenum"/> + <param name="modeA" type="GLenum"/> + <glx rop="4228"/> + </function> +</category> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_blend_func_separate" number="2"> + <enum name="BLEND_DST_RGB_OES" count="1" value="0x80C8"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_SRC_RGB_OES" count="1" value="0x80C9"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_DST_ALPHA_OES" count="1" value="0x80CA"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_SRC_ALPHA_OES" count="1" value="0x80CB"> + <size name="Get" mode="get"/> + </enum> + + <function name="BlendFuncSeparateOES" offset="assign"> + <param name="sfactorRGB" type="GLenum"/> + <param name="dfactorRGB" type="GLenum"/> + <param name="sfactorAlpha" type="GLenum"/> + <param name="dfactorAlpha" type="GLenum"/> + <glx rop="4134"/> + </function> +</category> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_blend_subtract" number="3"> + <enum name="FUNC_ADD_OES" value="0x8006"/> + <enum name="BLEND_EQUATION_OES" count="1" value="0x8009"> + <size name="Get" mode="get"/> + </enum> + <enum name="FUNC_SUBTRACT_OES" value="0x800A"/> + <enum name="FUNC_REVERSE_SUBTRACT_OES" value="0x800B"/> + + <function name="BlendEquationOES" offset="337"> + <param name="mode" type="GLenum"/> + <glx rop="4097"/> + </function> +</category> + +<!-- core addition to es1.0 and later --> +<category name="GL_OES_byte_coordinates" number="4"> + <enum name="BYTE" value="0x1400"/> +</category> + +<!-- optional for es1.1 --> +<category name="GL_OES_draw_texture" number="7"> + <enum name="TEXTURE_CROP_RECT_OES" value="0x8B9D"/> + + <function name="DrawTexiOES" offset="assign"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + <param name="width" type="GLint"/> + <param name="height" type="GLint"/> + </function> + + <function name="DrawTexivOES" offset="assign"> + <param name="coords" type="const GLint *" count="5"/> + </function> + + <function name="DrawTexfOES" offset="assign"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <param name="width" type="GLfloat"/> + <param name="height" type="GLfloat"/> + </function> + + <function name="DrawTexfvOES" offset="assign"> + <param name="coords" type="const GLfloat *" count="5"/> + </function> + + <function name="DrawTexsOES" offset="assign"> + <param name="x" type="GLshort"/> + <param name="y" type="GLshort"/> + <param name="z" type="GLshort"/> + <param name="width" type="GLshort"/> + <param name="height" type="GLshort"/> + </function> + + <function name="DrawTexsvOES" offset="assign"> + <param name="coords" type="const GLshort *" count="5"/> + </function> + + <function name="DrawTexxOES" offset="assign"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + <param name="width" type="GLfixed"/> + <param name="height" type="GLfixed"/> + </function> + + <function name="DrawTexxvOES" offset="assign"> + <param name="coords" type="const GLfixed *" count="5"/> + </function> + + <!-- TexParameter{ifx}v is skipped here --> +</category> + +<!-- core addition to es1.0 and later --> +<category name="GL_OES_fixed_point" number="9"> + <enum name="FIXED_OES" value="0x140C"/> + + <!-- additon to es1.0 --> + <function name="AlphaFuncxOES" alias="AlphaFuncx"> + <param name="func" type="GLenum"/> + <param name="ref" type="GLclampx"/> + </function> + + <function name="ClearColorxOES" alias="ClearColorx"> + <param name="red" type="GLclampx"/> + <param name="green" type="GLclampx"/> + <param name="blue" type="GLclampx"/> + <param name="alpha" type="GLclampx"/> + </function> + + <function name="ClearDepthxOES" alias="ClearDepthx"> + <param name="depth" type="GLclampx"/> + </function> + + <function name="Color4xOES" alias="Color4x"> + <param name="red" type="GLfixed"/> + <param name="green" type="GLfixed"/> + <param name="blue" type="GLfixed"/> + <param name="alpha" type="GLfixed"/> + </function> + + <function name="DepthRangexOES" alias="DepthRangex"> + <param name="zNear" type="GLclampx"/> + <param name="zFar" type="GLclampx"/> + </function> + + <function name="FogxOES" alias="Fogx"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="FogxvOES" alias="Fogxv"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="FrustumxOES" alias="Frustumx"> + <param name="left" type="GLfixed"/> + <param name="right" type="GLfixed"/> + <param name="bottom" type="GLfixed"/> + <param name="top" type="GLfixed"/> + <param name="zNear" type="GLfixed"/> + <param name="zFar" type="GLfixed"/> + </function> + + <function name="LightModelxOES" alias="LightModelx"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="LightModelxvOES" alias="LightModelxv"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="LightxOES" alias="Lightx"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="LightxvOES" alias="Lightxv"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="LineWidthxOES" alias="LineWidthx"> + <param name="width" type="GLfixed"/> + </function> + + <function name="LoadMatrixxOES" alias="LoadMatrixx"> + <param name="m" type="const GLfixed *" count="16"/> + </function> + + <function name="MaterialxOES" alias="Materialx"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="MaterialxvOES" alias="Materialxv"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="MultiTexCoord4xOES" alias="MultiTexCoord4x"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfixed"/> + <param name="t" type="GLfixed"/> + <param name="r" type="GLfixed"/> + <param name="q" type="GLfixed"/> + </function> + + <function name="MultMatrixxOES" alias="MultMatrixx"> + <param name="m" type="const GLfixed *" count="16"/> + </function> + + <function name="Normal3xOES" alias="Normal3x"> + <param name="nx" type="GLfixed"/> + <param name="ny" type="GLfixed"/> + <param name="nz" type="GLfixed"/> + </function> + + <function name="OrthoxOES" alias="Orthox"> + <param name="left" type="GLfixed"/> + <param name="right" type="GLfixed"/> + <param name="bottom" type="GLfixed"/> + <param name="top" type="GLfixed"/> + <param name="zNear" type="GLfixed"/> + <param name="zFar" type="GLfixed"/> + </function> + + <function name="PointSizexOES" alias="PointSizex"> + <param name="size" type="GLfixed"/> + </function> + + <function name="PolygonOffsetxOES" alias="PolygonOffsetx"> + <param name="factor" type="GLfixed"/> + <param name="units" type="GLfixed"/> + </function> + + <function name="RotatexOES" alias="Rotatex"> + <param name="angle" type="GLfixed"/> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <function name="SampleCoveragexOES" alias="SampleCoveragex"> + <param name="value" type="GLclampx"/> + <param name="invert" type="GLboolean"/> + </function> + + <function name="ScalexOES" alias="Scalex"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <function name="TexEnvxOES" alias="TexEnvx"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="TexEnvxvOES" alias="TexEnvxv"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> + + <function name="TexParameterxOES" alias="TexParameterx"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="TranslatexOES" alias="Translatex"> + <param name="x" type="GLfixed"/> + <param name="y" type="GLfixed"/> + <param name="z" type="GLfixed"/> + </function> + + <!-- additon to es1.1 --> + <function name="ClipPlanexOES" alias="ClipPlanex"> + <param name="plane" type="GLenum"/> + <param name="equation" type="const GLfixed *" count="4"/> + </function> + + <function name="GetClipPlanexOES" alias="GetClipPlanex"> + <param name="plane" type="GLenum"/> + <param name="equation" type="GLfixed *" output="true" count="4"/> + </function> + + <function name="GetFixedvOES" alias="GetFixedv"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetLightxvOES" alias="GetLightxv"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetMaterialxvOES" alias="GetMaterialxv"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetTexEnvxvOES" alias="GetTexEnvxv"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="GetTexParameterxvOES" alias="GetTexParameterxv"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="PointParameterxOES" alias="PointParameterx"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfixed"/> + </function> + + <function name="PointParameterxvOES" alias="PointParameterxv"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *"/> + </function> + + <function name="TexParameterxvOES" alias="TexParameterxv"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> +</category> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_framebuffer_object" number="10"> + <enum name="NONE_OES" value="0"/> + <enum name="INVALID_FRAMEBUFFER_OPERATION_OES" value="0x0506"/> + <enum name="RGBA4_OES" value="0x8056"/> + <enum name="RGB5_A1_OES" value="0x8057"/> + <enum name="DEPTH_COMPONENT16_OES" value="0x81A5"/> + + <enum name="MAX_RENDERBUFFER_SIZE_OES" value="0x84E8"/> + <enum name="FRAMEBUFFER_BINDING_OES" value="0x8CA6"/> + <enum name="RENDERBUFFER_BINDING_OES" value="0x8CA7"/> + <enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES" value="0x8CD0"/> + <enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES" value="0x8CD1"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES" value="0x8CD2"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES" value="0x8CD3"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" value="0x8CD4"/> + <enum name="FRAMEBUFFER_COMPLETE_OES" value="0x8CD5"/> + <enum name="FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES" value="0x8CD6"/> + <enum name="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES" value="0x8CD7"/> + <enum name="FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES" value="0x8CD9"/> + <enum name="FRAMEBUFFER_INCOMPLETE_FORMATS_OES" value="0x8CDA"/> + <enum name="FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES" value="0x8CDB"/> + <enum name="FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES" value="0x8CDC"/> + <enum name="FRAMEBUFFER_UNSUPPORTED_OES" value="0x8CDD"/> + <enum name="COLOR_ATTACHMENT0_OES" value="0x8CE0"/> + <enum name="DEPTH_ATTACHMENT_OES" value="0x8D00"/> + <enum name="STENCIL_ATTACHMENT_OES" value="0x8D20"/> + <enum name="FRAMEBUFFER_OES" value="0x8D40"/> + <enum name="RENDERBUFFER_OES" value="0x8D41"/> + <enum name="RENDERBUFFER_WIDTH_OES" value="0x8D42"/> + <enum name="RENDERBUFFER_HEIGHT_OES" value="0x8D43"/> + <enum name="RENDERBUFFER_INTERNAL_FORMAT_OES" value="0x8D44"/> + <enum name="STENCIL_INDEX1_OES" value="0x8D46"/> + <enum name="STENCIL_INDEX4_OES" value="0x8D47"/> + <enum name="STENCIL_INDEX8_OES" value="0x8D48"/> + <enum name="RENDERBUFFER_RED_SIZE_OES" value="0x8D50"/> + <enum name="RENDERBUFFER_GREEN_SIZE_OES" value="0x8D51"/> + <enum name="RENDERBUFFER_BLUE_SIZE_OES" value="0x8D52"/> + <enum name="RENDERBUFFER_ALPHA_SIZE_OES" value="0x8D53"/> + <enum name="RENDERBUFFER_DEPTH_SIZE_OES" value="0x8D54"/> + <enum name="RENDERBUFFER_STENCIL_SIZE_OES" value="0x8D55"/> + <enum name="RGB565_OES" value="0x8D62"/> + + <function name="BindFramebufferOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="framebuffer" type="GLuint"/> + </function> + + <function name="BindRenderbufferOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="renderbuffer" type="GLuint"/> + </function> + + <function name="CheckFramebufferStatusOES" offset="assign"> + <param name="target" type="GLenum"/> + <return type="GLenum"/> + </function> + + <function name="DeleteFramebuffersOES" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="framebuffers" type="const GLuint *" count="n"/> + </function> + + <function name="DeleteRenderbuffersOES" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="renderbuffers" type="const GLuint *" count="n"/> + </function> + + <function name="FramebufferRenderbufferOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="renderbuffertarget" type="GLenum"/> + <param name="renderbuffer" type="GLuint"/> + </function> + + <function name="FramebufferTexture2DOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="textarget" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + </function> + + <function name="GenerateMipmapOES" offset="assign"> + <param name="target" type="GLenum"/> + </function> + + <function name="GenFramebuffersOES" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="framebuffers" type="GLuint *" count="n" output="true"/> + </function> + + <function name="GenRenderbuffersOES" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="renderbuffers" type="GLuint *" count="n" output="true"/> + </function> + + <function name="GetFramebufferAttachmentParameterivOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true"/> + </function> + + <function name="GetRenderbufferParameterivOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true"/> + </function> + + <function name="IsFramebufferOES" offset="assign"> + <param name="framebuffer" type="GLuint"/> + <return type="GLboolean"/> + </function> + + <function name="IsRenderbufferOES" offset="assign"> + <param name="renderbuffer" type="GLuint"/> + <return type="GLboolean"/> + </function> + + <function name="RenderbufferStorageOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </function> +</category> + +<!-- core addition to es1.1 --> +<category name="GL_OES_matrix_get" number="11"> + <enum name="MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898D"/> + <enum name="PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898E"/> + <enum name="TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898F"/> +</category> + +<!-- optional for es1.1 --> +<category name="GL_OES_matrix_palette" number="12"> + <enum name="MAX_VERTEX_UNITS_OES" value="0x86A4"/> + <enum name="WEIGHT_ARRAY_TYPE_OES" value="0x86A9"/> + <enum name="WEIGHT_ARRAY_STRIDE_OES" value="0x86AA"/> + <enum name="WEIGHT_ARRAY_SIZE_OES" value="0x86AB"/> + <enum name="WEIGHT_ARRAY_POINTER_OES" value="0x86AC"/> + <enum name="WEIGHT_ARRAY_OES" value="0x86AD"/> + <enum name="MATRIX_PALETTE_OES" value="0x8840"/> + <enum name="MAX_PALETTE_MATRICES_OES" value="0x8842"/> + <enum name="CURRENT_PALETTE_MATRIX_OES" value="0x8843"/> + <enum name="MATRIX_INDEX_ARRAY_OES" value="0x8844"/> + <enum name="MATRIX_INDEX_ARRAY_SIZE_OES" value="0x8846"/> + <enum name="MATRIX_INDEX_ARRAY_TYPE_OES" value="0x8847"/> + <enum name="MATRIX_INDEX_ARRAY_STRIDE_OES" value="0x8848"/> + <enum name="MATRIX_INDEX_ARRAY_POINTER_OES" value="0x8849"/> + <enum name="WEIGHT_ARRAY_BUFFER_BINDING_OES" value="0x889E"/> + <enum name="MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES" value="0x8B9E"/> + + <function name="CurrentPaletteMatrixOES"> + <param name="matrixpaletteindex" type="GLuint"/> + </function> + + <function name="LoadPaletteFromModelViewMatrixOES"> + </function> + + <function name="MatrixIndexPointerOES"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </function> + + <function name="WeightPointerOES"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </function> +</category> + +<!-- required for es1.1 --> +<category name="GL_OES_point_size_array" number="14"> + <enum name="POINT_SIZE_ARRAY_TYPE_OES" value="0x898A"/> + <enum name="POINT_SIZE_ARRAY_STRIDE_OES" value="0x898B"/> + <enum name="POINT_SIZE_ARRAY_POINTER_OES" value="0x898C"/> + <enum name="POINT_SIZE_ARRAY_OES" value="0x8B9C"/> + <enum name="POINT_SIZE_ARRAY_BUFFER_BINDING_OES" value="0x8B9F"/> + + <function name="PointSizePointerOES" offset="assign"> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </function> +</category> + +<!-- required for es1.1 --> +<category name="GL_OES_point_sprite" number="15"> + <enum name="POINT_SPRITE_OES" value="0x8861"/> + <enum name="COORD_REPLACE_OES" value="0x8862"/> +</category> + +<!-- optional for es1.0 --> +<category name="GL_OES_query_matrix" number="16"> + <function name="QueryMatrixxOES" offset="assign"> + <param name="mantissa" type="GLfixed *" count="16" /> + <param name="exponent" type="GLint *" count="16" /> + <return type="GLbitfield"/> + </function> +</category> + +<!-- required for es1.0 and later --> +<category name="GL_OES_read_format" number="17"> + <enum name="IMPLEMENTATION_COLOR_READ_TYPE_OES" value="0x8B9A"/> + <enum name="IMPLEMENTATION_COLOR_READ_FORMAT_OES" value="0x8B9B"/> +</category> + +<!-- core addition to es1.0 and later --> +<category name="GL_OES_single_precision" number="18"> + <!-- additon to es1.0 --> + <function name="ClearDepthfOES" alias="ClearDepthf"> + <param name="depth" type="GLclampf"/> + </function> + + <function name="DepthRangefOES" alias="DepthRangef"> + <param name="zNear" type="GLclampf"/> + <param name="zFar" type="GLclampf"/> + </function> + + <function name="FrustumfOES" alias="Frustumf"> + <param name="left" type="GLfloat"/> + <param name="right" type="GLfloat"/> + <param name="bottom" type="GLfloat"/> + <param name="top" type="GLfloat"/> + <param name="zNear" type="GLfloat"/> + <param name="zFar" type="GLfloat"/> + </function> + + <function name="OrthofOES" alias="Orthof"> + <param name="left" type="GLfloat"/> + <param name="right" type="GLfloat"/> + <param name="bottom" type="GLfloat"/> + <param name="top" type="GLfloat"/> + <param name="zNear" type="GLfloat"/> + <param name="zFar" type="GLfloat"/> + </function> + + <!-- additon to es1.1 --> + <function name="ClipPlanefOES" alias="ClipPlanef"> + <param name="plane" type="GLenum"/> + <param name="equation" type="const GLfloat *" count="4"/> + </function> + + <function name="GetClipPlanefOES" alias="GetClipPlanef"> + <param name="plane" type="GLenum"/> + <param name="equation" type="GLfloat *" output="true" count="4"/> + </function> +</category> + +<!-- part of es1.1 extension pack --> +<category name="GL_OES_texture_cube_map" number="20"> + <enum name="TEXTURE_GEN_MODE_OES" value="0x2500"/> + <enum name="NORMAL_MAP_OES" value="0x8511"/> + <enum name="REFLECTION_MAP_OES" value="0x8512"/> + <enum name="TEXTURE_CUBE_MAP_OES" value="0x8513"/> + <enum name="TEXTURE_BINDING_CUBE_MAP_OES" value="0x8514"/> + <enum name="TEXTURE_CUBE_MAP_POSITIVE_X_OES" value="0x8515"/> + <enum name="TEXTURE_CUBE_MAP_NEGATIVE_X_OES" value="0x8516"/> + <enum name="TEXTURE_CUBE_MAP_POSITIVE_Y_OES" value="0x8517"/> + <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" value="0x8518"/> + <enum name="TEXTURE_CUBE_MAP_POSITIVE_Z_OES" value="0x8519"/> + <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" value="0x851A"/> + <enum name="MAX_CUBE_MAP_TEXTURE_SIZE_OES" value="0x851C"/> + <enum name="TEXTURE_GEN_STR_OES" value="0x8D60"/> + + <function name="GetTexGenfvOES" offset="279"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="133"/> + </function> + + <function name="GetTexGenivOES" offset="280"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="134"/> + </function> + + <function name="GetTexGenxvOES" offset="assign"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfixed *" output="true" variable_param="pname"/> + </function> + + <function name="TexGenfOES" offset="190"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="117"/> + </function> + + <function name="TexGenfvOES" offset="191"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="118"/> + </function> + + <function name="TexGeniOES" offset="192"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="119"/> + </function> + + <function name="TexGenivOES" offset="193"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="120"/> + </function> + + <function name="TexGenxOES" offset="assign"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + </function> + + <function name="TexGenxvOES" offset="assign"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfixed *" variable_param="pname"/> + </function> +</category> + +<category name="GL_OES_texture_env_crossbar" number="21"> + <!-- No new functions, types, enums. --> +</category> + +<category name="GL_OES_texture_mirrored_repeat" number="22"> + <!-- No new functions, types, enums. --> +</category> + +<category name="GL_EXT_texture_lod_bias" number="60"> + <enum name="TEXTURE_FILTER_CONTROL_EXT" value="0x8500"/> + <enum name="TEXTURE_LOD_BIAS_EXT" value="0x8501"/> + <enum name="MAX_TEXTURE_LOD_BIAS_EXT" value="0x84FD"/> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/es2_API.xml b/mesalib/src/mapi/glapi/gen-es/es2_API.xml new file mode 100644 index 000000000..f8af63b94 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/es2_API.xml @@ -0,0 +1,294 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<!-- OpenGL ES 2.x API --> + +<OpenGLAPI> + +<xi:include href="base2_API.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<!-- core subset of OpenGL 2.0 defined in OpenGL ES 2.0 --> +<category name="core2.0"> + <!-- addition to base1.0 --> + <enum name="NONE" value="0x0"/> + <enum name="INT" count="4" value="0x1404"> + <size name="CallLists"/> + </enum> + <enum name="UNSIGNED_INT" count="4" value="0x1405"> + <size name="CallLists"/> + </enum> + <enum name="STENCIL_INDEX" value="0x1901"/> + <enum name="DEPTH_COMPONENT" value="0x1902"/> + + <function name="TexImage2D" offset="183"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLint"/> <!-- XXX the actual type is GLenum... --> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="target" img_send_null="true" img_pad_dimensions="true"/> + <glx rop="110" large="true"/> + </function> + + <!-- addition to base1.1 --> + <enum name="RGBA4" value="0x8056"/> + <enum name="RGB5_A1" value="0x8057"/> + + <!-- addition to base1.2 --> + <enum name="CONSTANT_COLOR" value="0x8001"/> + <enum name="ONE_MINUS_CONSTANT_COLOR" value="0x8002"/> + <enum name="CONSTANT_ALPHA" value="0x8003"/> + <enum name="ONE_MINUS_CONSTANT_ALPHA" value="0x8004"/> + <enum name="BLEND_COLOR" count="4" value="0x8005"> + <size name="Get" mode="get"/> + </enum> + <enum name="FUNC_ADD" value="0x8006"/> + <enum name="BLEND_EQUATION" count="1" value="0x8009"> + <size name="Get" mode="get"/> + </enum> + <enum name="FUNC_SUBTRACT" value="0x800A"/> + <enum name="FUNC_REVERSE_SUBTRACT" value="0x800B"/> + + <function name="BlendColor" offset="336"> + <param name="red" type="GLclampf"/> + <param name="green" type="GLclampf"/> + <param name="blue" type="GLclampf"/> + <param name="alpha" type="GLclampf"/> + <glx rop="4096"/> + </function> + + <function name="BlendEquation" offset="337"> + <param name="mode" type="GLenum"/> + <glx rop="4097"/> + </function> + + <!-- addition to base1.3 --> + <enum name="TEXTURE_CUBE_MAP" count="1" value="0x8513"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_BINDING_CUBE_MAP" count="1" value="0x8514"> + <size name="Get" mode="get"/> + </enum> + <enum name="TEXTURE_CUBE_MAP_POSITIVE_X" value="0x8515"/> + <enum name="TEXTURE_CUBE_MAP_NEGATIVE_X" value="0x8516"/> + <enum name="TEXTURE_CUBE_MAP_POSITIVE_Y" value="0x8517"/> + <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Y" value="0x8518"/> + <enum name="TEXTURE_CUBE_MAP_POSITIVE_Z" value="0x8519"/> + <enum name="TEXTURE_CUBE_MAP_NEGATIVE_Z" value="0x851A"/> + <enum name="MAX_CUBE_MAP_TEXTURE_SIZE" count="1" value="0x851C"> + <size name="Get" mode="get"/> + </enum> + + <!-- addition to base1.4 --> + <enum name="BLEND_DST_RGB" count="1" value="0x80C8"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_SRC_RGB" count="1" value="0x80C9"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_DST_ALPHA" count="1" value="0x80CA"> + <size name="Get" mode="get"/> + </enum> + <enum name="BLEND_SRC_ALPHA" count="1" value="0x80CB"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEPTH_COMPONENT16" value="0x81A5"/> + <enum name="MIRRORED_REPEAT" value="0x8370"/> + <enum name="INCR_WRAP" value="0x8507"/> + <enum name="DECR_WRAP" value="0x8508"/> + + <function name="BlendFuncSeparate" offset="assign"> + <param name="sfactorRGB" type="GLenum"/> + <param name="dfactorRGB" type="GLenum"/> + <param name="sfactorAlpha" type="GLenum"/> + <param name="dfactorAlpha" type="GLenum"/> + <glx rop="4134"/> + </function> + + <!-- addition to base1.5 --> + <enum name="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING" count="1" value="0x889F"> + <size name="GetVertexAttribdv" mode="get"/> + <size name="GetVertexAttribfv" mode="get"/> + <size name="GetVertexAttribiv" mode="get"/> + </enum> + <enum name="STREAM_DRAW" value="0x88E0"/> + + <!-- addition to base2.0 --> + <!-- base2.0 should have everything defined --> +</category> + +<!-- OpenGL ES 2.0 --> +<category name="es2.0"> + <!-- addition to core2.0 --> + <enum name="LOW_FLOAT" value="0x8DF0"/> + <enum name="MEDIUM_FLOAT" value="0x8DF1"/> + <enum name="HIGH_FLOAT" value="0x8DF2"/> + <enum name="LOW_INT" value="0x8DF3"/> + <enum name="MEDIUM_INT" value="0x8DF4"/> + <enum name="HIGH_INT" value="0x8DF5"/> + <enum name="SHADER_BINARY_FORMATS" value="0x8DF8"/> + <enum name="NUM_SHADER_BINARY_FORMATS" value="0x8DF9"/> + <enum name="SHADER_COMPILER" value="0x8DFA"/> + <enum name="MAX_VERTEX_UNIFORM_VECTORS" value="0x8DFB"/> + <enum name="MAX_VARYING_VECTORS" value="0x8DFC"/> + <enum name="MAX_FRAGMENT_UNIFORM_VECTORS" value="0x8DFD"/> + + <function name="GetShaderPrecisionFormat" offset="assign"> + <param name="shadertype" type="GLenum"/> + <param name="precisiontype" type="GLenum"/> + <param name="range" type="GLint *"/> + <param name="precision" type="GLint *"/> + </function> + + <function name="ReleaseShaderCompiler" offset="assign"> + </function> + + <function name="ShaderBinary" offset="assign"> + <param name="n" type="GLsizei"/> + <param name="shaders" type="const GLuint *"/> + <param name="binaryformat" type="GLenum"/> + <param name="binary" type="const GLvoid *"/> + <param name="length" type="GLsizei"/> + </function> + + <!-- from GL_OES_fixed_point --> + <enum name="FIXED" value="0x140C"/> + <type name="fixed" size="4" /> + + <!-- from GL_OES_framebuffer_object --> + <enum name="INVALID_FRAMEBUFFER_OPERATION" value="0x0506"/> + <enum name="MAX_RENDERBUFFER_SIZE" value="0x84E8"/> + <enum name="FRAMEBUFFER_BINDING" value="0x8CA6"/> + <enum name="RENDERBUFFER_BINDING" value="0x8CA7"/> + <enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE" value="0x8CD0"/> + <enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME" value="0x8CD1"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL" value="0x8CD2"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE" value="0x8CD3"/> + <enum name="FRAMEBUFFER_COMPLETE" value="0x8CD5"/> + <enum name="FRAMEBUFFER_INCOMPLETE_ATTACHMENT" value="0x8CD6"/> + <enum name="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT" value="0x8CD7"/> + <enum name="FRAMEBUFFER_INCOMPLETE_DIMENSIONS" value="0x8CD9"/> + <enum name="FRAMEBUFFER_UNSUPPORTED" value="0x8CDD"/> + <enum name="COLOR_ATTACHMENT0" value="0x8CE0"/> + <enum name="DEPTH_ATTACHMENT" value="0x8D00"/> + <enum name="STENCIL_ATTACHMENT" value="0x8D20"/> + <enum name="FRAMEBUFFER" value="0x8D40"/> + <enum name="RENDERBUFFER" value="0x8D41"/> + <enum name="RENDERBUFFER_WIDTH" value="0x8D42"/> + <enum name="RENDERBUFFER_HEIGHT" value="0x8D43"/> + <enum name="RENDERBUFFER_INTERNAL_FORMAT" value="0x8D44"/> + <enum name="STENCIL_INDEX8" value="0x8D48"/> + <enum name="RENDERBUFFER_RED_SIZE" value="0x8D50"/> + <enum name="RENDERBUFFER_GREEN_SIZE" value="0x8D51"/> + <enum name="RENDERBUFFER_BLUE_SIZE" value="0x8D52"/> + <enum name="RENDERBUFFER_ALPHA_SIZE" value="0x8D53"/> + <enum name="RENDERBUFFER_DEPTH_SIZE" value="0x8D54"/> + <enum name="RENDERBUFFER_STENCIL_SIZE" value="0x8D55"/> + <enum name="RGB565" value="0x8D62"/> + + <function name="BindFramebuffer" offset="assign"> + <param name="target" type="GLenum"/> + <param name="framebuffer" type="GLuint"/> + </function> + + <function name="BindRenderbuffer" offset="assign"> + <param name="target" type="GLenum"/> + <param name="renderbuffer" type="GLuint"/> + </function> + + <function name="CheckFramebufferStatus" offset="assign"> + <param name="target" type="GLenum"/> + <return type="GLenum"/> + </function> + + <function name="DeleteFramebuffers" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="framebuffers" type="const GLuint *" count="n"/> + </function> + + <function name="DeleteRenderbuffers" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="renderbuffers" type="const GLuint *" count="n"/> + </function> + + <function name="FramebufferRenderbuffer" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="renderbuffertarget" type="GLenum"/> + <param name="renderbuffer" type="GLuint"/> + </function> + + <function name="FramebufferTexture2D" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="textarget" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + </function> + + <function name="GenerateMipmap" offset="assign"> + <param name="target" type="GLenum"/> + </function> + + <function name="GenFramebuffers" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="framebuffers" type="GLuint *" count="n" output="true"/> + </function> + + <function name="GenRenderbuffers" offset="assign"> + <param name="n" type="GLsizei" counter="true"/> + <param name="renderbuffers" type="GLuint *" count="n" output="true"/> + </function> + + <function name="GetFramebufferAttachmentParameteriv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true"/> + </function> + + <function name="GetRenderbufferParameteriv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true"/> + </function> + + <function name="IsFramebuffer" offset="assign"> + <param name="framebuffer" type="GLuint"/> + <return type="GLboolean"/> + </function> + + <function name="IsRenderbuffer" offset="assign"> + <param name="renderbuffer" type="GLuint"/> + <return type="GLboolean"/> + </function> + + <function name="RenderbufferStorage" offset="assign"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </function> + + <!-- from GL_OES_read_format --> + <enum name="IMPLEMENTATION_COLOR_READ_TYPE" value="0x8B9A"/> + <enum name="IMPLEMENTATION_COLOR_READ_FORMAT" value="0x8B9B"/> + + <!-- from GL_OES_single_precision --> + <function name="ClearDepthf" offset="assign"> + <param name="depth" type="GLclampf"/> + </function> + + <function name="DepthRangef" offset="assign"> + <param name="zNear" type="GLclampf"/> + <param name="zFar" type="GLclampf"/> + </function> +</category> + +<xi:include href="es2_EXT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<xi:include href="es2_COMPAT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/es2_COMPAT.xml b/mesalib/src/mapi/glapi/gen-es/es2_COMPAT.xml new file mode 100644 index 000000000..1bd356963 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/es2_COMPAT.xml @@ -0,0 +1,368 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<OpenGLAPI> + +<!-- This file defines the functions that are needed by Mesa. It + makes sure the generated glapi headers are compatible with Mesa. + It mainly consists of missing functions and aliases in OpenGL ES. +--> + +<xi:include href="es_COMPAT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<!-- except for those defined by es_COMPAT.xml, these are also needed --> +<category name="compat"> + <!-- OpenGL 1.0 --> + <function name="Color4f" offset="29" vectorequiv="Color4fv" static_dispatch="false"> + <param name="red" type="GLfloat"/> + <param name="green" type="GLfloat"/> + <param name="blue" type="GLfloat"/> + <param name="alpha" type="GLfloat"/> + </function> + + <function name="Color4ub" offset="35" vectorequiv="Color4ubv" static_dispatch="false"> + <param name="red" type="GLubyte"/> + <param name="green" type="GLubyte"/> + <param name="blue" type="GLubyte"/> + <param name="alpha" type="GLubyte"/> + </function> + + <function name="Normal3f" offset="56" vectorequiv="Normal3fv" static_dispatch="false"> + <param name="nx" type="GLfloat"/> + <param name="ny" type="GLfloat"/> + <param name="nz" type="GLfloat"/> + </function> + + <function name="Fogf" offset="153" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="80"/> + </function> + + <function name="Fogfv" offset="154" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="81"/> + </function> + + <function name="Lightf" offset="159" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="86"/> + </function> + + <function name="Lightfv" offset="160" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="87"/> + </function> + + <function name="LightModelf" offset="163" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="90"/> + </function> + + <function name="LightModelfv" offset="164" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="91"/> + </function> + + <function name="Materialf" offset="169" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="96"/> + </function> + + <function name="Materialfv" offset="170" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="97"/> + </function> + + <function name="PointSize" offset="173" static_dispatch="false"> + <param name="size" type="GLfloat"/> + <glx rop="100"/> + </function> + + <function name="ShadeModel" offset="177" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="104"/> + </function> + + <function name="TexEnvf" offset="184" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="111"/> + </function> + + <function name="TexEnvfv" offset="185" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="112"/> + </function> + + <function name="TexEnvi" offset="186" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="113"/> + </function> + + <function name="TexEnviv" offset="187" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="114"/> + </function> + + <function name="TexGenf" offset="190" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="117"/> + </function> + + <function name="TexGenfv" offset="191" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="118"/> + </function> + + <function name="TexGeni" offset="192" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="119"/> + </function> + + <function name="TexGeniv" offset="193" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="120"/> + </function> + + <function name="AlphaFunc" offset="240" static_dispatch="false"> + <param name="func" type="GLenum"/> + <param name="ref" type="GLclampf"/> + <glx rop="159"/> + </function> + + <function name="LogicOp" offset="242" static_dispatch="false"> + <param name="opcode" type="GLenum"/> + <glx rop="161"/> + </function> + + <function name="GetLightfv" offset="264" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="118"/> + </function> + + <function name="GetMaterialfv" offset="269" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="123"/> + </function> + + <function name="GetTexEnvfv" offset="276" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="130"/> + </function> + + <function name="GetTexEnviv" offset="277" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="131"/> + </function> + + <function name="GetTexGenfv" offset="279" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="133"/> + </function> + + <function name="GetTexGeniv" offset="280" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="134"/> + </function> + + <function name="LoadIdentity" offset="290" static_dispatch="false"> + <glx rop="176"/> + </function> + + <function name="LoadMatrixf" offset="291" static_dispatch="false"> + <param name="m" type="const GLfloat *" count="16"/> + <glx rop="177"/> + </function> + + <function name="MatrixMode" offset="293" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="179"/> + </function> + + <function name="MultMatrixf" offset="294" static_dispatch="false"> + <param name="m" type="const GLfloat *" count="16"/> + <glx rop="180"/> + </function> + + <function name="PopMatrix" offset="297" static_dispatch="false"> + <glx rop="183"/> + </function> + + <function name="PushMatrix" offset="298" static_dispatch="false"> + <glx rop="184"/> + </function> + + <function name="Rotatef" offset="300" static_dispatch="false"> + <param name="angle" type="GLfloat"/> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <glx rop="186"/> + </function> + + <function name="Scalef" offset="302" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <glx rop="188"/> + </function> + + <function name="Translatef" offset="304" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <glx rop="190"/> + </function> + + <!-- OpenGL 1.1 --> + <function name="ColorPointer" offset="308" static_dispatch="false"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="DisableClientState" offset="309" static_dispatch="false"> + <param name="array" type="GLenum"/> + <glx handcode="true"/> + </function> + + <function name="EnableClientState" offset="313" static_dispatch="false"> + <param name="array" type="GLenum"/> + <glx handcode="true"/> + </function> + + <function name="NormalPointer" offset="318" static_dispatch="false"> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="TexCoordPointer" offset="320" static_dispatch="false"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="VertexPointer" offset="321" static_dispatch="false"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="GetPointerv" offset="329" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLvoid **" output="true"/> + <glx handcode="true"/> + </function> + + <!-- OpenGL 1.2 --> + <function name="TexImage3D" alias="TexImage3DOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/> + <glx rop="4114" large="true"/> + </function> + + <function name="TexSubImage3D" alias="TexSubImage3DOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="UNUSED" type="GLuint" padding="true"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + <glx rop="4115" large="true"/> + </function> + + <function name="CopyTexSubImage3D" alias="CopyTexSubImage3DOES" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="4123"/> + </function> + + <!-- GL_ARB_multitexture --> + <function name="ActiveTextureARB" alias="ActiveTexture" static_dispatch="false"> + <param name="texture" type="GLenum"/> + <glx rop="197"/> + </function> + + <function name="ClientActiveTextureARB" offset="375" static_dispatch="false"> + <param name="texture" type="GLenum"/> + <glx handcode="true"/> + </function> + + <function name="MultiTexCoord4fARB" offset="402" vectorequiv="MultiTexCoord4fvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfloat"/> + <param name="t" type="GLfloat"/> + <param name="r" type="GLfloat"/> + <param name="q" type="GLfloat"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/es2_EXT.xml b/mesalib/src/mapi/glapi/gen-es/es2_EXT.xml new file mode 100644 index 000000000..4a67952e5 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/es2_EXT.xml @@ -0,0 +1,162 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<!-- OpenGL ES 2.x extensions --> + +<OpenGLAPI> + +<xi:include href="es_EXT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<category name="GL_OES_texture_3D" number="34"> + <enum name="TEXTURE_BINDING_3D_OES" value="0x806A"/> + <enum name="TEXTURE_3D_OES" value="0x806F"/> + <enum name="TEXTURE_WRAP_R_OES" value="0x8072"/> + <enum name="MAX_3D_TEXTURE_SIZE_OES" value="0x8073"/> + <enum name="SAMPLER_3D_OES" value="0x8B5F"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" value="0x8CD4"/> + + <function name="CompressedTexImage3DOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="imageSize" type="GLsizei" counter="true"/> + <param name="data" type="const GLvoid *" count="imageSize"/> + <glx rop="216" handcode="client"/> + </function> + + <function name="CompressedTexSubImage3DOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="imageSize" type="GLsizei" counter="true"/> + <param name="data" type="const GLvoid *" count="imageSize"/> + <glx rop="219" handcode="client"/> + </function> + + <function name="CopyTexSubImage3DOES" offset="373"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="4123"/> + </function> + + <function name="FramebufferTexture3DOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="textarget" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + <param name="zoffset" type="GLint"/> + <glx rop="4323"/> + </function> + + <function name="TexImage3DOES" offset="371"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/> + <glx rop="4114" large="true"/> + </function> + + <function name="TexSubImage3DOES" offset="372"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="UNUSED" type="GLuint" padding="true"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + <glx rop="4115" large="true"/> + </function> +</category> + +<!-- the other name is OES_texture_float_linear --> +<category name="OES_texture_half_float_linear" number="35"> + <!-- No new functions, types, enums. --> +</category> + +<!-- the other name is OES_texture_float --> +<category name="OES_texture_half_float" number="36"> + <enum name="HALF_FLOAT_OES" value="0x8D61"/> +</category> + +<category name="GL_OES_texture_npot" number="37"> + <!-- No new functions, types, enums. --> +</category> + +<category name="GL_OES_vertex_half_float" number="38"> + <enum name="HALF_FLOAT_OES" value="0x8D61"/> +</category> + +<category name="GL_EXT_texture_type_2_10_10_10_REV" number="42"> + <enum name="UNSIGNED_INT_2_10_10_10_REV_EXT" value="0x8368"/> +</category> + +<category name="GL_OES_packed_depth_stencil" number="43"> + <enum name="DEPTH_STENCIL_OES" value="0x84F9"/> + <enum name="UNSIGNED_INT_24_8_OES" value="0x84FA"/> + <enum name="DEPTH24_STENCIL8_OES" value="0x88F0"/> +</category> + +<category name="GL_OES_depth_texture" number="44"> + <!-- No new functions, types, enums. --> +</category> + +<category name="GL_OES_standard_derivatives" number="45"> + <enum name="FRAGMENT_SHADER_DERIVATIVE_HINT_OES" value="0x8B8B"/> +</category> + +<category name="GL_OES_vertex_type_10_10_10_2" number="46"> + <enum name="UNSIGNED_INT_10_10_10_2_OES" value="0x8DF6"/> + <enum name="INT_10_10_10_2_OES" value="0x8DF7"/> +</category> + +<category name="GL_OES_get_program_binary" number="47"> + <enum name="PROGRAM_BINARY_LENGTH_OES" value="0x8741"/> + <enum name="NUM_PROGRAM_BINARY_FORMATS_OES" value="0x87FE"/> + <enum name="PROGRAM_BINARY_FORMATS_OES" value="0x87FF"/> + + <function name="GetProgramBinaryOES" offset="assign"> + <param name="program" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="binaryFormat" type="GLenum *"/> + <param name="binary" type="GLvoid *"/> + </function> + + <function name="ProgramBinaryOES" offset="assign"> + <param name="program" type="GLuint"/> + <param name="binaryFormat" type="GLenum"/> + <param name="binary" type="const GLvoid *"/> + <param name="length" type="GLint"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/es_COMPAT.xml b/mesalib/src/mapi/glapi/gen-es/es_COMPAT.xml new file mode 100644 index 000000000..7c7292611 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/es_COMPAT.xml @@ -0,0 +1,2646 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<OpenGLAPI> + +<!-- This file defines the following categories + + a subset of 1.0 + a subset of 1.1 + a subset of 1.2 + a subset of GL_ARB_multitexture + GL_APPLE_vertex_array_object + + to make sure the generated glapi headers are compatible with Mesa. + It is included by es1_COMPAT.xml and es2_COMPAT.xml. +--> + +<category name="1.0"> + <type name="double" size="8" float="true" glx_name="FLOAT64"/> + <type name="clampd" size="8" float="true" glx_name="FLOAT64"/> + + <type name="float" size="4" float="true" glx_name="FLOAT32"/> + <type name="clampf" size="4" float="true" glx_name="FLOAT32"/> + + <type name="int" size="4" glx_name="CARD32"/> + <type name="uint" size="4" unsigned="true" glx_name="CARD32"/> + <type name="sizei" size="4" unsigned="true" glx_name="CARD32"/> + <type name="enum" size="4" unsigned="true" glx_name="ENUM"/> + <type name="bitfield" size="4" unsigned="true" glx_name="CARD32"/> + + <type name="short" size="2" glx_name="CARD16"/> + <type name="ushort" size="2" unsigned="true" glx_name="CARD16"/> + + <type name="byte" size="1" glx_name="CARD8"/> + <type name="ubyte" size="1" unsigned="true" glx_name="CARD8"/> + <type name="boolean" size="1" unsigned="true" glx_name="CARD8"/> + + <type name="void" size="1"/> + + <function name="NewList" offset="0" static_dispatch="false"> + <param name="list" type="GLuint"/> + <param name="mode" type="GLenum"/> + <glx sop="101"/> + </function> + + <function name="EndList" offset="1" static_dispatch="false"> + <glx sop="102"/> + </function> + + <function name="CallList" offset="2" static_dispatch="false"> + <param name="list" type="GLuint"/> + <glx rop="1"/> + </function> + + <function name="CallLists" offset="3" static_dispatch="false"> + <param name="n" type="GLsizei" counter="true"/> + <param name="type" type="GLenum"/> + <param name="lists" type="const GLvoid *" variable_param="type" count="n"/> + <glx rop="2" large="true"/> + </function> + + <function name="DeleteLists" offset="4" static_dispatch="false"> + <param name="list" type="GLuint"/> + <param name="range" type="GLsizei"/> + <glx sop="103"/> + </function> + + <function name="GenLists" offset="5" static_dispatch="false"> + <param name="range" type="GLsizei"/> + <return type="GLuint"/> + <glx sop="104"/> + </function> + + <function name="ListBase" offset="6" static_dispatch="false"> + <param name="base" type="GLuint"/> + <glx rop="3"/> + </function> + + <function name="Begin" offset="7" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="4"/> + </function> + + <function name="Bitmap" offset="8" static_dispatch="false"> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="xorig" type="GLfloat"/> + <param name="yorig" type="GLfloat"/> + <param name="xmove" type="GLfloat"/> + <param name="ymove" type="GLfloat"/> + <param name="bitmap" type="const GLubyte *" img_width="width" img_height="height" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP" img_target="0" img_pad_dimensions="false"/> + <glx rop="5" large="true"/> + </function> + + <function name="Color3b" offset="9" vectorequiv="Color3bv" static_dispatch="false"> + <param name="red" type="GLbyte"/> + <param name="green" type="GLbyte"/> + <param name="blue" type="GLbyte"/> + </function> + + <function name="Color3bv" offset="10" static_dispatch="false"> + <param name="v" type="const GLbyte *" count="3"/> + <glx rop="6"/> + </function> + + <function name="Color3d" offset="11" vectorequiv="Color3dv" static_dispatch="false"> + <param name="red" type="GLdouble"/> + <param name="green" type="GLdouble"/> + <param name="blue" type="GLdouble"/> + </function> + + <function name="Color3dv" offset="12" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="3"/> + <glx rop="7"/> + </function> + + <function name="Color3f" offset="13" vectorequiv="Color3fv" static_dispatch="false"> + <param name="red" type="GLfloat"/> + <param name="green" type="GLfloat"/> + <param name="blue" type="GLfloat"/> + </function> + + <function name="Color3fv" offset="14" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="3"/> + <glx rop="8"/> + </function> + + <function name="Color3i" offset="15" vectorequiv="Color3iv" static_dispatch="false"> + <param name="red" type="GLint"/> + <param name="green" type="GLint"/> + <param name="blue" type="GLint"/> + </function> + + <function name="Color3iv" offset="16" static_dispatch="false"> + <param name="v" type="const GLint *" count="3"/> + <glx rop="9"/> + </function> + + <function name="Color3s" offset="17" vectorequiv="Color3sv" static_dispatch="false"> + <param name="red" type="GLshort"/> + <param name="green" type="GLshort"/> + <param name="blue" type="GLshort"/> + </function> + + <function name="Color3sv" offset="18" static_dispatch="false"> + <param name="v" type="const GLshort *" count="3"/> + <glx rop="10"/> + </function> + + <function name="Color3ub" offset="19" vectorequiv="Color3ubv" static_dispatch="false"> + <param name="red" type="GLubyte"/> + <param name="green" type="GLubyte"/> + <param name="blue" type="GLubyte"/> + </function> + + <function name="Color3ubv" offset="20" static_dispatch="false"> + <param name="v" type="const GLubyte *" count="3"/> + <glx rop="11"/> + </function> + + <function name="Color3ui" offset="21" vectorequiv="Color3uiv" static_dispatch="false"> + <param name="red" type="GLuint"/> + <param name="green" type="GLuint"/> + <param name="blue" type="GLuint"/> + </function> + + <function name="Color3uiv" offset="22" static_dispatch="false"> + <param name="v" type="const GLuint *" count="3"/> + <glx rop="12"/> + </function> + + <function name="Color3us" offset="23" vectorequiv="Color3usv" static_dispatch="false"> + <param name="red" type="GLushort"/> + <param name="green" type="GLushort"/> + <param name="blue" type="GLushort"/> + </function> + + <function name="Color3usv" offset="24" static_dispatch="false"> + <param name="v" type="const GLushort *" count="3"/> + <glx rop="13"/> + </function> + + <function name="Color4b" offset="25" vectorequiv="Color4bv" static_dispatch="false"> + <param name="red" type="GLbyte"/> + <param name="green" type="GLbyte"/> + <param name="blue" type="GLbyte"/> + <param name="alpha" type="GLbyte"/> + </function> + + <function name="Color4bv" offset="26" static_dispatch="false"> + <param name="v" type="const GLbyte *" count="4"/> + <glx rop="14"/> + </function> + + <function name="Color4d" offset="27" vectorequiv="Color4dv" static_dispatch="false"> + <param name="red" type="GLdouble"/> + <param name="green" type="GLdouble"/> + <param name="blue" type="GLdouble"/> + <param name="alpha" type="GLdouble"/> + </function> + + <function name="Color4dv" offset="28" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="4"/> + <glx rop="15"/> + </function> + + <!--function name="Color4f" offset="29" vectorequiv="Color4fv" static_dispatch="false"> + <param name="red" type="GLfloat"/> + <param name="green" type="GLfloat"/> + <param name="blue" type="GLfloat"/> + <param name="alpha" type="GLfloat"/> + </function--> + + <function name="Color4fv" offset="30" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="4"/> + <glx rop="16"/> + </function> + + <function name="Color4i" offset="31" vectorequiv="Color4iv" static_dispatch="false"> + <param name="red" type="GLint"/> + <param name="green" type="GLint"/> + <param name="blue" type="GLint"/> + <param name="alpha" type="GLint"/> + </function> + + <function name="Color4iv" offset="32" static_dispatch="false"> + <param name="v" type="const GLint *" count="4"/> + <glx rop="17"/> + </function> + + <function name="Color4s" offset="33" vectorequiv="Color4sv" static_dispatch="false"> + <param name="red" type="GLshort"/> + <param name="green" type="GLshort"/> + <param name="blue" type="GLshort"/> + <param name="alpha" type="GLshort"/> + </function> + + <function name="Color4sv" offset="34" static_dispatch="false"> + <param name="v" type="const GLshort *" count="4"/> + <glx rop="18"/> + </function> + + <!--function name="Color4ub" offset="35" vectorequiv="Color4ubv" static_dispatch="false"> + <param name="red" type="GLubyte"/> + <param name="green" type="GLubyte"/> + <param name="blue" type="GLubyte"/> + <param name="alpha" type="GLubyte"/> + </function--> + + <function name="Color4ubv" offset="36" static_dispatch="false"> + <param name="v" type="const GLubyte *" count="4"/> + <glx rop="19"/> + </function> + + <function name="Color4ui" offset="37" vectorequiv="Color4uiv" static_dispatch="false"> + <param name="red" type="GLuint"/> + <param name="green" type="GLuint"/> + <param name="blue" type="GLuint"/> + <param name="alpha" type="GLuint"/> + </function> + + <function name="Color4uiv" offset="38" static_dispatch="false"> + <param name="v" type="const GLuint *" count="4"/> + <glx rop="20"/> + </function> + + <function name="Color4us" offset="39" vectorequiv="Color4usv" static_dispatch="false"> + <param name="red" type="GLushort"/> + <param name="green" type="GLushort"/> + <param name="blue" type="GLushort"/> + <param name="alpha" type="GLushort"/> + </function> + + <function name="Color4usv" offset="40" static_dispatch="false"> + <param name="v" type="const GLushort *" count="4"/> + <glx rop="21"/> + </function> + + <function name="EdgeFlag" offset="41" vectorequiv="EdgeFlagv" static_dispatch="false"> + <param name="flag" type="GLboolean"/> + </function> + + <function name="EdgeFlagv" offset="42" static_dispatch="false"> + <param name="flag" type="const GLboolean *" count="1"/> + <glx rop="22"/> + </function> + + <function name="End" offset="43" static_dispatch="false"> + <glx rop="23"/> + </function> + + <function name="Indexd" offset="44" vectorequiv="Indexdv" static_dispatch="false"> + <param name="c" type="GLdouble"/> + </function> + + <function name="Indexdv" offset="45" static_dispatch="false"> + <param name="c" type="const GLdouble *" count="1"/> + <glx rop="24"/> + </function> + + <function name="Indexf" offset="46" vectorequiv="Indexfv" static_dispatch="false"> + <param name="c" type="GLfloat"/> + </function> + + <function name="Indexfv" offset="47" static_dispatch="false"> + <param name="c" type="const GLfloat *" count="1"/> + <glx rop="25"/> + </function> + + <function name="Indexi" offset="48" vectorequiv="Indexiv" static_dispatch="false"> + <param name="c" type="GLint"/> + </function> + + <function name="Indexiv" offset="49" static_dispatch="false"> + <param name="c" type="const GLint *" count="1"/> + <glx rop="26"/> + </function> + + <function name="Indexs" offset="50" vectorequiv="Indexsv" static_dispatch="false"> + <param name="c" type="GLshort"/> + </function> + + <function name="Indexsv" offset="51" static_dispatch="false"> + <param name="c" type="const GLshort *" count="1"/> + <glx rop="27"/> + </function> + + <function name="Normal3b" offset="52" vectorequiv="Normal3bv" static_dispatch="false"> + <param name="nx" type="GLbyte"/> + <param name="ny" type="GLbyte"/> + <param name="nz" type="GLbyte"/> + </function> + + <function name="Normal3bv" offset="53" static_dispatch="false"> + <param name="v" type="const GLbyte *" count="3"/> + <glx rop="28"/> + </function> + + <function name="Normal3d" offset="54" vectorequiv="Normal3dv" static_dispatch="false"> + <param name="nx" type="GLdouble"/> + <param name="ny" type="GLdouble"/> + <param name="nz" type="GLdouble"/> + </function> + + <function name="Normal3dv" offset="55" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="3"/> + <glx rop="29"/> + </function> + + <!--function name="Normal3f" offset="56" vectorequiv="Normal3fv" static_dispatch="false"> + <param name="nx" type="GLfloat"/> + <param name="ny" type="GLfloat"/> + <param name="nz" type="GLfloat"/> + </function--> + + <function name="Normal3fv" offset="57" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="3"/> + <glx rop="30"/> + </function> + + <function name="Normal3i" offset="58" vectorequiv="Normal3iv" static_dispatch="false"> + <param name="nx" type="GLint"/> + <param name="ny" type="GLint"/> + <param name="nz" type="GLint"/> + </function> + + <function name="Normal3iv" offset="59" static_dispatch="false"> + <param name="v" type="const GLint *" count="3"/> + <glx rop="31"/> + </function> + + <function name="Normal3s" offset="60" vectorequiv="Normal3sv" static_dispatch="false"> + <param name="nx" type="GLshort"/> + <param name="ny" type="GLshort"/> + <param name="nz" type="GLshort"/> + </function> + + <function name="Normal3sv" offset="61" static_dispatch="false"> + <param name="v" type="const GLshort *" count="3"/> + <glx rop="32"/> + </function> + + <function name="RasterPos2d" offset="62" vectorequiv="RasterPos2dv" static_dispatch="false"> + <param name="x" type="GLdouble"/> + <param name="y" type="GLdouble"/> + </function> + + <function name="RasterPos2dv" offset="63" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="2"/> + <glx rop="33"/> + </function> + + <function name="RasterPos2f" offset="64" vectorequiv="RasterPos2fv" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + </function> + + <function name="RasterPos2fv" offset="65" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="2"/> + <glx rop="34"/> + </function> + + <function name="RasterPos2i" offset="66" vectorequiv="RasterPos2iv" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + </function> + + <function name="RasterPos2iv" offset="67" static_dispatch="false"> + <param name="v" type="const GLint *" count="2"/> + <glx rop="35"/> + </function> + + <function name="RasterPos2s" offset="68" vectorequiv="RasterPos2sv" static_dispatch="false"> + <param name="x" type="GLshort"/> + <param name="y" type="GLshort"/> + </function> + + <function name="RasterPos2sv" offset="69" static_dispatch="false"> + <param name="v" type="const GLshort *" count="2"/> + <glx rop="36"/> + </function> + + <function name="RasterPos3d" offset="70" vectorequiv="RasterPos3dv" static_dispatch="false"> + <param name="x" type="GLdouble"/> + <param name="y" type="GLdouble"/> + <param name="z" type="GLdouble"/> + </function> + + <function name="RasterPos3dv" offset="71" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="3"/> + <glx rop="37"/> + </function> + + <function name="RasterPos3f" offset="72" vectorequiv="RasterPos3fv" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + </function> + + <function name="RasterPos3fv" offset="73" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="3"/> + <glx rop="38"/> + </function> + + <function name="RasterPos3i" offset="74" vectorequiv="RasterPos3iv" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + </function> + + <function name="RasterPos3iv" offset="75" static_dispatch="false"> + <param name="v" type="const GLint *" count="3"/> + <glx rop="39"/> + </function> + + <function name="RasterPos3s" offset="76" vectorequiv="RasterPos3sv" static_dispatch="false"> + <param name="x" type="GLshort"/> + <param name="y" type="GLshort"/> + <param name="z" type="GLshort"/> + </function> + + <function name="RasterPos3sv" offset="77" static_dispatch="false"> + <param name="v" type="const GLshort *" count="3"/> + <glx rop="40"/> + </function> + + <function name="RasterPos4d" offset="78" vectorequiv="RasterPos4dv" static_dispatch="false"> + <param name="x" type="GLdouble"/> + <param name="y" type="GLdouble"/> + <param name="z" type="GLdouble"/> + <param name="w" type="GLdouble"/> + </function> + + <function name="RasterPos4dv" offset="79" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="4"/> + <glx rop="41"/> + </function> + + <function name="RasterPos4f" offset="80" vectorequiv="RasterPos4fv" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <param name="w" type="GLfloat"/> + </function> + + <function name="RasterPos4fv" offset="81" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="4"/> + <glx rop="42"/> + </function> + + <function name="RasterPos4i" offset="82" vectorequiv="RasterPos4iv" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + <param name="w" type="GLint"/> + </function> + + <function name="RasterPos4iv" offset="83" static_dispatch="false"> + <param name="v" type="const GLint *" count="4"/> + <glx rop="43"/> + </function> + + <function name="RasterPos4s" offset="84" vectorequiv="RasterPos4sv" static_dispatch="false"> + <param name="x" type="GLshort"/> + <param name="y" type="GLshort"/> + <param name="z" type="GLshort"/> + <param name="w" type="GLshort"/> + </function> + + <function name="RasterPos4sv" offset="85" static_dispatch="false"> + <param name="v" type="const GLshort *" count="4"/> + <glx rop="44"/> + </function> + + <function name="Rectd" offset="86" vectorequiv="Rectdv" static_dispatch="false"> + <param name="x1" type="GLdouble"/> + <param name="y1" type="GLdouble"/> + <param name="x2" type="GLdouble"/> + <param name="y2" type="GLdouble"/> + </function> + + <function name="Rectdv" offset="87" static_dispatch="false"> + <param name="v1" type="const GLdouble *" count="2"/> + <param name="v2" type="const GLdouble *" count="2"/> + <glx rop="45"/> + </function> + + <function name="Rectf" offset="88" vectorequiv="Rectfv" static_dispatch="false"> + <param name="x1" type="GLfloat"/> + <param name="y1" type="GLfloat"/> + <param name="x2" type="GLfloat"/> + <param name="y2" type="GLfloat"/> + </function> + + <function name="Rectfv" offset="89" static_dispatch="false"> + <param name="v1" type="const GLfloat *" count="2"/> + <param name="v2" type="const GLfloat *" count="2"/> + <glx rop="46"/> + </function> + + <function name="Recti" offset="90" vectorequiv="Rectiv" static_dispatch="false"> + <param name="x1" type="GLint"/> + <param name="y1" type="GLint"/> + <param name="x2" type="GLint"/> + <param name="y2" type="GLint"/> + </function> + + <function name="Rectiv" offset="91" static_dispatch="false"> + <param name="v1" type="const GLint *" count="2"/> + <param name="v2" type="const GLint *" count="2"/> + <glx rop="47"/> + </function> + + <function name="Rects" offset="92" vectorequiv="Rectsv" static_dispatch="false"> + <param name="x1" type="GLshort"/> + <param name="y1" type="GLshort"/> + <param name="x2" type="GLshort"/> + <param name="y2" type="GLshort"/> + </function> + + <function name="Rectsv" offset="93" static_dispatch="false"> + <param name="v1" type="const GLshort *" count="2"/> + <param name="v2" type="const GLshort *" count="2"/> + <glx rop="48"/> + </function> + + <function name="TexCoord1d" offset="94" vectorequiv="TexCoord1dv" static_dispatch="false"> + <param name="s" type="GLdouble"/> + </function> + + <function name="TexCoord1dv" offset="95" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="1"/> + <glx rop="49"/> + </function> + + <function name="TexCoord1f" offset="96" vectorequiv="TexCoord1fv" static_dispatch="false"> + <param name="s" type="GLfloat"/> + </function> + + <function name="TexCoord1fv" offset="97" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="1"/> + <glx rop="50"/> + </function> + + <function name="TexCoord1i" offset="98" vectorequiv="TexCoord1iv" static_dispatch="false"> + <param name="s" type="GLint"/> + </function> + + <function name="TexCoord1iv" offset="99" static_dispatch="false"> + <param name="v" type="const GLint *" count="1"/> + <glx rop="51"/> + </function> + + <function name="TexCoord1s" offset="100" vectorequiv="TexCoord1sv" static_dispatch="false"> + <param name="s" type="GLshort"/> + </function> + + <function name="TexCoord1sv" offset="101" static_dispatch="false"> + <param name="v" type="const GLshort *" count="1"/> + <glx rop="52"/> + </function> + + <function name="TexCoord2d" offset="102" vectorequiv="TexCoord2dv" static_dispatch="false"> + <param name="s" type="GLdouble"/> + <param name="t" type="GLdouble"/> + </function> + + <function name="TexCoord2dv" offset="103" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="2"/> + <glx rop="53"/> + </function> + + <function name="TexCoord2f" offset="104" vectorequiv="TexCoord2fv" static_dispatch="false"> + <param name="s" type="GLfloat"/> + <param name="t" type="GLfloat"/> + </function> + + <function name="TexCoord2fv" offset="105" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="2"/> + <glx rop="54"/> + </function> + + <function name="TexCoord2i" offset="106" vectorequiv="TexCoord2iv" static_dispatch="false"> + <param name="s" type="GLint"/> + <param name="t" type="GLint"/> + </function> + + <function name="TexCoord2iv" offset="107" static_dispatch="false"> + <param name="v" type="const GLint *" count="2"/> + <glx rop="55"/> + </function> + + <function name="TexCoord2s" offset="108" vectorequiv="TexCoord2sv" static_dispatch="false"> + <param name="s" type="GLshort"/> + <param name="t" type="GLshort"/> + </function> + + <function name="TexCoord2sv" offset="109" static_dispatch="false"> + <param name="v" type="const GLshort *" count="2"/> + <glx rop="56"/> + </function> + + <function name="TexCoord3d" offset="110" vectorequiv="TexCoord3dv" static_dispatch="false"> + <param name="s" type="GLdouble"/> + <param name="t" type="GLdouble"/> + <param name="r" type="GLdouble"/> + </function> + + <function name="TexCoord3dv" offset="111" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="3"/> + <glx rop="57"/> + </function> + + <function name="TexCoord3f" offset="112" vectorequiv="TexCoord3fv" static_dispatch="false"> + <param name="s" type="GLfloat"/> + <param name="t" type="GLfloat"/> + <param name="r" type="GLfloat"/> + </function> + + <function name="TexCoord3fv" offset="113" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="3"/> + <glx rop="58"/> + </function> + + <function name="TexCoord3i" offset="114" vectorequiv="TexCoord3iv" static_dispatch="false"> + <param name="s" type="GLint"/> + <param name="t" type="GLint"/> + <param name="r" type="GLint"/> + </function> + + <function name="TexCoord3iv" offset="115" static_dispatch="false"> + <param name="v" type="const GLint *" count="3"/> + <glx rop="59"/> + </function> + + <function name="TexCoord3s" offset="116" vectorequiv="TexCoord3sv" static_dispatch="false"> + <param name="s" type="GLshort"/> + <param name="t" type="GLshort"/> + <param name="r" type="GLshort"/> + </function> + + <function name="TexCoord3sv" offset="117" static_dispatch="false"> + <param name="v" type="const GLshort *" count="3"/> + <glx rop="60"/> + </function> + + <function name="TexCoord4d" offset="118" vectorequiv="TexCoord4dv" static_dispatch="false"> + <param name="s" type="GLdouble"/> + <param name="t" type="GLdouble"/> + <param name="r" type="GLdouble"/> + <param name="q" type="GLdouble"/> + </function> + + <function name="TexCoord4dv" offset="119" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="4"/> + <glx rop="61"/> + </function> + + <function name="TexCoord4f" offset="120" vectorequiv="TexCoord4fv" static_dispatch="false"> + <param name="s" type="GLfloat"/> + <param name="t" type="GLfloat"/> + <param name="r" type="GLfloat"/> + <param name="q" type="GLfloat"/> + </function> + + <function name="TexCoord4fv" offset="121" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="4"/> + <glx rop="62"/> + </function> + + <function name="TexCoord4i" offset="122" vectorequiv="TexCoord4iv" static_dispatch="false"> + <param name="s" type="GLint"/> + <param name="t" type="GLint"/> + <param name="r" type="GLint"/> + <param name="q" type="GLint"/> + </function> + + <function name="TexCoord4iv" offset="123" static_dispatch="false"> + <param name="v" type="const GLint *" count="4"/> + <glx rop="63"/> + </function> + + <function name="TexCoord4s" offset="124" vectorequiv="TexCoord4sv" static_dispatch="false"> + <param name="s" type="GLshort"/> + <param name="t" type="GLshort"/> + <param name="r" type="GLshort"/> + <param name="q" type="GLshort"/> + </function> + + <function name="TexCoord4sv" offset="125" static_dispatch="false"> + <param name="v" type="const GLshort *" count="4"/> + <glx rop="64"/> + </function> + + <function name="Vertex2d" offset="126" vectorequiv="Vertex2dv" static_dispatch="false"> + <param name="x" type="GLdouble"/> + <param name="y" type="GLdouble"/> + </function> + + <function name="Vertex2dv" offset="127" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="2"/> + <glx rop="65"/> + </function> + + <function name="Vertex2f" offset="128" vectorequiv="Vertex2fv" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + </function> + + <function name="Vertex2fv" offset="129" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="2"/> + <glx rop="66"/> + </function> + + <function name="Vertex2i" offset="130" vectorequiv="Vertex2iv" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + </function> + + <function name="Vertex2iv" offset="131" static_dispatch="false"> + <param name="v" type="const GLint *" count="2"/> + <glx rop="67"/> + </function> + + <function name="Vertex2s" offset="132" vectorequiv="Vertex2sv" static_dispatch="false"> + <param name="x" type="GLshort"/> + <param name="y" type="GLshort"/> + </function> + + <function name="Vertex2sv" offset="133" static_dispatch="false"> + <param name="v" type="const GLshort *" count="2"/> + <glx rop="68"/> + </function> + + <function name="Vertex3d" offset="134" vectorequiv="Vertex3dv" static_dispatch="false"> + <param name="x" type="GLdouble"/> + <param name="y" type="GLdouble"/> + <param name="z" type="GLdouble"/> + </function> + + <function name="Vertex3dv" offset="135" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="3"/> + <glx rop="69"/> + </function> + + <function name="Vertex3f" offset="136" vectorequiv="Vertex3fv" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + </function> + + <function name="Vertex3fv" offset="137" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="3"/> + <glx rop="70"/> + </function> + + <function name="Vertex3i" offset="138" vectorequiv="Vertex3iv" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + </function> + + <function name="Vertex3iv" offset="139" static_dispatch="false"> + <param name="v" type="const GLint *" count="3"/> + <glx rop="71"/> + </function> + + <function name="Vertex3s" offset="140" vectorequiv="Vertex3sv" static_dispatch="false"> + <param name="x" type="GLshort"/> + <param name="y" type="GLshort"/> + <param name="z" type="GLshort"/> + </function> + + <function name="Vertex3sv" offset="141" static_dispatch="false"> + <param name="v" type="const GLshort *" count="3"/> + <glx rop="72"/> + </function> + + <function name="Vertex4d" offset="142" vectorequiv="Vertex4dv" static_dispatch="false"> + <param name="x" type="GLdouble"/> + <param name="y" type="GLdouble"/> + <param name="z" type="GLdouble"/> + <param name="w" type="GLdouble"/> + </function> + + <function name="Vertex4dv" offset="143" static_dispatch="false"> + <param name="v" type="const GLdouble *" count="4"/> + <glx rop="73"/> + </function> + + <function name="Vertex4f" offset="144" vectorequiv="Vertex4fv" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <param name="w" type="GLfloat"/> + </function> + + <function name="Vertex4fv" offset="145" static_dispatch="false"> + <param name="v" type="const GLfloat *" count="4"/> + <glx rop="74"/> + </function> + + <function name="Vertex4i" offset="146" vectorequiv="Vertex4iv" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + <param name="w" type="GLint"/> + </function> + + <function name="Vertex4iv" offset="147" static_dispatch="false"> + <param name="v" type="const GLint *" count="4"/> + <glx rop="75"/> + </function> + + <function name="Vertex4s" offset="148" vectorequiv="Vertex4sv" static_dispatch="false"> + <param name="x" type="GLshort"/> + <param name="y" type="GLshort"/> + <param name="z" type="GLshort"/> + <param name="w" type="GLshort"/> + </function> + + <function name="Vertex4sv" offset="149" static_dispatch="false"> + <param name="v" type="const GLshort *" count="4"/> + <glx rop="76"/> + </function> + + <function name="ClipPlane" offset="150" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="const GLdouble *" count="4"/> + <glx rop="77"/> + </function> + + <function name="ColorMaterial" offset="151" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="mode" type="GLenum"/> + <glx rop="78"/> + </function> + + <!--function name="CullFace" offset="152" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="79"/> + </function> + + <function name="Fogf" offset="153" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="80"/> + </function> + + <function name="Fogfv" offset="154" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="81"/> + </function--> + + <function name="Fogi" offset="155" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="82"/> + </function> + + <function name="Fogiv" offset="156" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="83"/> + </function> + + <!--function name="FrontFace" offset="157" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="84"/> + </function> + + <function name="Hint" offset="158" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="mode" type="GLenum"/> + <glx rop="85"/> + </function> + + <function name="Lightf" offset="159" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="86"/> + </function> + + <function name="Lightfv" offset="160" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="87"/> + </function--> + + <function name="Lighti" offset="161" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="88"/> + </function> + + <function name="Lightiv" offset="162" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="89"/> + </function> + + <!--function name="LightModelf" offset="163" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="90"/> + </function> + + <function name="LightModelfv" offset="164" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="91"/> + </function--> + + <function name="LightModeli" offset="165" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="92"/> + </function> + + <function name="LightModeliv" offset="166" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="93"/> + </function> + + <function name="LineStipple" offset="167" static_dispatch="false"> + <param name="factor" type="GLint"/> + <param name="pattern" type="GLushort"/> + <glx rop="94"/> + </function> + + <!--function name="LineWidth" offset="168" static_dispatch="false"> + <param name="width" type="GLfloat"/> + <glx rop="95"/> + </function> + + <function name="Materialf" offset="169" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="96"/> + </function> + + <function name="Materialfv" offset="170" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="97"/> + </function--> + + <function name="Materiali" offset="171" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="98"/> + </function> + + <function name="Materialiv" offset="172" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="99"/> + </function> + + <!--function name="PointSize" offset="173" static_dispatch="false"> + <param name="size" type="GLfloat"/> + <glx rop="100"/> + </function--> + + <function name="PolygonMode" offset="174" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="mode" type="GLenum"/> + <glx rop="101"/> + </function> + + <function name="PolygonStipple" offset="175" static_dispatch="false"> + <param name="mask" type="const GLubyte *" img_width="32" img_height="32" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP" img_target="0" img_pad_dimensions="false"/> + <glx rop="102"/> + </function> + + <!--function name="Scissor" offset="176" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="103"/> + </function> + + <function name="ShadeModel" offset="177" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="104"/> + </function> + + <function name="TexParameterf" offset="178" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="105"/> + </function> + + <function name="TexParameterfv" offset="179" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="106"/> + </function> + + <function name="TexParameteri" offset="180" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="107"/> + </function> + + <function name="TexParameteriv" offset="181" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="108"/> + </function--> + + <function name="TexImage1D" offset="182" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_format="format" img_type="type" img_target="target" img_send_null="true" img_pad_dimensions="true"/> + <glx rop="109" large="true"/> + </function> + + <!--function name="TexImage2D" offset="183" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="target" img_send_null="true" img_pad_dimensions="true"/> + <glx rop="110" large="true"/> + </function> + + <function name="TexEnvf" offset="184" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="111"/> + </function> + + <function name="TexEnvfv" offset="185" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="112"/> + </function> + + <function name="TexEnvi" offset="186" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="113"/> + </function> + + <function name="TexEnviv" offset="187" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="114"/> + </function--> + + <function name="TexGend" offset="188" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLdouble"/> + <glx rop="115"/> + </function> + + <function name="TexGendv" offset="189" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLdouble *" variable_param="pname"/> + <glx rop="116"/> + </function> + + <!--function name="TexGenf" offset="190" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="117"/> + </function> + + <function name="TexGenfv" offset="191" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="118"/> + </function> + + <function name="TexGeni" offset="192" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="119"/> + </function> + + <function name="TexGeniv" offset="193" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="120"/> + </function--> + + <function name="FeedbackBuffer" offset="194" static_dispatch="false"> + <param name="size" type="GLsizei"/> + <param name="type" type="GLenum"/> + <param name="buffer" type="GLfloat *" output="true"/> + <glx sop="105" handcode="true"/> + </function> + + <function name="SelectBuffer" offset="195" static_dispatch="false"> + <param name="size" type="GLsizei"/> + <param name="buffer" type="GLuint *" output="true"/> + <glx sop="106" handcode="true"/> + </function> + + <function name="RenderMode" offset="196" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <return type="GLint"/> + <glx sop="107" handcode="true"/> + </function> + + <function name="InitNames" offset="197" static_dispatch="false"> + <glx rop="121"/> + </function> + + <function name="LoadName" offset="198" static_dispatch="false"> + <param name="name" type="GLuint"/> + <glx rop="122"/> + </function> + + <function name="PassThrough" offset="199" static_dispatch="false"> + <param name="token" type="GLfloat"/> + <glx rop="123"/> + </function> + + <function name="PopName" offset="200" static_dispatch="false"> + <glx rop="124"/> + </function> + + <function name="PushName" offset="201" static_dispatch="false"> + <param name="name" type="GLuint"/> + <glx rop="125"/> + </function> + + <function name="DrawBuffer" offset="202" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="126"/> + </function> + + <!--function name="Clear" offset="203" static_dispatch="false"> + <param name="mask" type="GLbitfield"/> + <glx rop="127"/> + </function--> + + <function name="ClearAccum" offset="204" static_dispatch="false"> + <param name="red" type="GLfloat"/> + <param name="green" type="GLfloat"/> + <param name="blue" type="GLfloat"/> + <param name="alpha" type="GLfloat"/> + <glx rop="128"/> + </function> + + <function name="ClearIndex" offset="205" static_dispatch="false"> + <param name="c" type="GLfloat"/> + <glx rop="129"/> + </function> + + <!--function name="ClearColor" offset="206" static_dispatch="false"> + <param name="red" type="GLclampf"/> + <param name="green" type="GLclampf"/> + <param name="blue" type="GLclampf"/> + <param name="alpha" type="GLclampf"/> + <glx rop="130"/> + </function> + + <function name="ClearStencil" offset="207" static_dispatch="false"> + <param name="s" type="GLint"/> + <glx rop="131"/> + </function--> + + <function name="ClearDepth" offset="208" static_dispatch="false"> + <param name="depth" type="GLclampd"/> + <glx rop="132"/> + </function> + + <!--function name="StencilMask" offset="209" static_dispatch="false"> + <param name="mask" type="GLuint"/> + <glx rop="133"/> + </function> + + <function name="ColorMask" offset="210" static_dispatch="false"> + <param name="red" type="GLboolean"/> + <param name="green" type="GLboolean"/> + <param name="blue" type="GLboolean"/> + <param name="alpha" type="GLboolean"/> + <glx rop="134"/> + </function> + + <function name="DepthMask" offset="211" static_dispatch="false"> + <param name="flag" type="GLboolean"/> + <glx rop="135"/> + </function--> + + <function name="IndexMask" offset="212" static_dispatch="false"> + <param name="mask" type="GLuint"/> + <glx rop="136"/> + </function> + + <function name="Accum" offset="213" static_dispatch="false"> + <param name="op" type="GLenum"/> + <param name="value" type="GLfloat"/> + <glx rop="137"/> + </function> + + <!--function name="Disable" offset="214" static_dispatch="false"> + <param name="cap" type="GLenum"/> + <glx rop="138" handcode="client"/> + </function> + + <function name="Enable" offset="215" static_dispatch="false"> + <param name="cap" type="GLenum"/> + <glx rop="139" handcode="client"/> + </function> + + <function name="Finish" offset="216" static_dispatch="false"> + <glx sop="108" handcode="true"/> + </function> + + <function name="Flush" offset="217" static_dispatch="false"> + <glx sop="142" handcode="true"/> + </function--> + + <function name="PopAttrib" offset="218" static_dispatch="false"> + <glx rop="141"/> + </function> + + <function name="PushAttrib" offset="219" static_dispatch="false"> + <param name="mask" type="GLbitfield"/> + <glx rop="142"/> + </function> + + <function name="Map1d" offset="220" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="u1" type="GLdouble"/> + <param name="u2" type="GLdouble"/> + <param name="stride" type="GLint" client_only="true"/> + <param name="order" type="GLint"/> + <param name="points" type="const GLdouble *" variable_param="order"/> + <glx rop="143" handcode="true"/> + </function> + + <function name="Map1f" offset="221" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="u1" type="GLfloat"/> + <param name="u2" type="GLfloat"/> + <param name="stride" type="GLint" client_only="true"/> + <param name="order" type="GLint"/> + <param name="points" type="const GLfloat *" variable_param="order"/> + <glx rop="144" handcode="true"/> + </function> + + <function name="Map2d" offset="222" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="u1" type="GLdouble"/> + <param name="u2" type="GLdouble"/> + <param name="ustride" type="GLint" client_only="true"/> + <param name="uorder" type="GLint"/> + <param name="v1" type="GLdouble"/> + <param name="v2" type="GLdouble"/> + <param name="vstride" type="GLint" client_only="true"/> + <param name="vorder" type="GLint"/> + <param name="points" type="const GLdouble *" variable_param="uorder"/> + <glx rop="145" handcode="true"/> + </function> + + <function name="Map2f" offset="223" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="u1" type="GLfloat"/> + <param name="u2" type="GLfloat"/> + <param name="ustride" type="GLint" client_only="true"/> + <param name="uorder" type="GLint"/> + <param name="v1" type="GLfloat"/> + <param name="v2" type="GLfloat"/> + <param name="vstride" type="GLint" client_only="true"/> + <param name="vorder" type="GLint"/> + <param name="points" type="const GLfloat *" variable_param="uorder"/> + <glx rop="146" handcode="true"/> + </function> + + <function name="MapGrid1d" offset="224" static_dispatch="false"> + <param name="un" type="GLint"/> + <param name="u1" type="GLdouble"/> + <param name="u2" type="GLdouble"/> + <glx rop="147"/> + </function> + + <function name="MapGrid1f" offset="225" static_dispatch="false"> + <param name="un" type="GLint"/> + <param name="u1" type="GLfloat"/> + <param name="u2" type="GLfloat"/> + <glx rop="148"/> + </function> + + <function name="MapGrid2d" offset="226" static_dispatch="false"> + <param name="un" type="GLint"/> + <param name="u1" type="GLdouble"/> + <param name="u2" type="GLdouble"/> + <param name="vn" type="GLint"/> + <param name="v1" type="GLdouble"/> + <param name="v2" type="GLdouble"/> + <glx rop="149"/> + </function> + + <function name="MapGrid2f" offset="227" static_dispatch="false"> + <param name="un" type="GLint"/> + <param name="u1" type="GLfloat"/> + <param name="u2" type="GLfloat"/> + <param name="vn" type="GLint"/> + <param name="v1" type="GLfloat"/> + <param name="v2" type="GLfloat"/> + <glx rop="150"/> + </function> + + <function name="EvalCoord1d" offset="228" vectorequiv="EvalCoord1dv" static_dispatch="false"> + <param name="u" type="GLdouble"/> + </function> + + <function name="EvalCoord1dv" offset="229" static_dispatch="false"> + <param name="u" type="const GLdouble *" count="1"/> + <glx rop="151"/> + </function> + + <function name="EvalCoord1f" offset="230" vectorequiv="EvalCoord1fv" static_dispatch="false"> + <param name="u" type="GLfloat"/> + </function> + + <function name="EvalCoord1fv" offset="231" static_dispatch="false"> + <param name="u" type="const GLfloat *" count="1"/> + <glx rop="152"/> + </function> + + <function name="EvalCoord2d" offset="232" vectorequiv="EvalCoord2dv" static_dispatch="false"> + <param name="u" type="GLdouble"/> + <param name="v" type="GLdouble"/> + </function> + + <function name="EvalCoord2dv" offset="233" static_dispatch="false"> + <param name="u" type="const GLdouble *" count="2"/> + <glx rop="153"/> + </function> + + <function name="EvalCoord2f" offset="234" vectorequiv="EvalCoord2fv" static_dispatch="false"> + <param name="u" type="GLfloat"/> + <param name="v" type="GLfloat"/> + </function> + + <function name="EvalCoord2fv" offset="235" static_dispatch="false"> + <param name="u" type="const GLfloat *" count="2"/> + <glx rop="154"/> + </function> + + <function name="EvalMesh1" offset="236" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <param name="i1" type="GLint"/> + <param name="i2" type="GLint"/> + <glx rop="155"/> + </function> + + <function name="EvalPoint1" offset="237" static_dispatch="false"> + <param name="i" type="GLint"/> + <glx rop="156"/> + </function> + + <function name="EvalMesh2" offset="238" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <param name="i1" type="GLint"/> + <param name="i2" type="GLint"/> + <param name="j1" type="GLint"/> + <param name="j2" type="GLint"/> + <glx rop="157"/> + </function> + + <function name="EvalPoint2" offset="239" static_dispatch="false"> + <param name="i" type="GLint"/> + <param name="j" type="GLint"/> + <glx rop="158"/> + </function> + + <!--function name="AlphaFunc" offset="240" static_dispatch="false"> + <param name="func" type="GLenum"/> + <param name="ref" type="GLclampf"/> + <glx rop="159"/> + </function> + + <function name="BlendFunc" offset="241" static_dispatch="false"> + <param name="sfactor" type="GLenum"/> + <param name="dfactor" type="GLenum"/> + <glx rop="160"/> + </function> + + <function name="LogicOp" offset="242" static_dispatch="false"> + <param name="opcode" type="GLenum"/> + <glx rop="161"/> + </function> + + <function name="StencilFunc" offset="243" static_dispatch="false"> + <param name="func" type="GLenum"/> + <param name="ref" type="GLint"/> + <param name="mask" type="GLuint"/> + <glx rop="162"/> + </function> + + <function name="StencilOp" offset="244" static_dispatch="false"> + <param name="fail" type="GLenum"/> + <param name="zfail" type="GLenum"/> + <param name="zpass" type="GLenum"/> + <glx rop="163"/> + </function> + + <function name="DepthFunc" offset="245" static_dispatch="false"> + <param name="func" type="GLenum"/> + <glx rop="164"/> + </function--> + + <function name="PixelZoom" offset="246" static_dispatch="false"> + <param name="xfactor" type="GLfloat"/> + <param name="yfactor" type="GLfloat"/> + <glx rop="165"/> + </function> + + <function name="PixelTransferf" offset="247" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx rop="166"/> + </function> + + <function name="PixelTransferi" offset="248" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx rop="167"/> + </function> + + <function name="PixelStoref" offset="249" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLfloat"/> + <glx sop="109" handcode="client"/> + </function> + + <!--function name="PixelStorei" offset="250" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="param" type="GLint"/> + <glx sop="110" handcode="client"/> + </function--> + + <function name="PixelMapfv" offset="251" static_dispatch="false"> + <param name="map" type="GLenum"/> + <param name="mapsize" type="GLsizei" counter="true"/> + <param name="values" type="const GLfloat *" count="mapsize"/> + <glx rop="168" large="true"/> + </function> + + <function name="PixelMapuiv" offset="252" static_dispatch="false"> + <param name="map" type="GLenum"/> + <param name="mapsize" type="GLsizei" counter="true"/> + <param name="values" type="const GLuint *" count="mapsize"/> + <glx rop="169" large="true"/> + </function> + + <function name="PixelMapusv" offset="253" static_dispatch="false"> + <param name="map" type="GLenum"/> + <param name="mapsize" type="GLsizei" counter="true"/> + <param name="values" type="const GLushort *" count="mapsize"/> + <glx rop="170" large="true"/> + </function> + + <function name="ReadBuffer" offset="254" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="171"/> + </function> + + <function name="CopyPixels" offset="255" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="type" type="GLenum"/> + <glx rop="172"/> + </function> + + <!--function name="ReadPixels" offset="256" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type" img_target="0"/> + <glx sop="111"/> + </function--> + + <function name="DrawPixels" offset="257" static_dispatch="false"> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="0" img_pad_dimensions="false"/> + <glx rop="173" large="true"/> + </function> + + <!--function name="GetBooleanv" offset="258" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLboolean *" output="true" variable_param="pname"/> + <glx sop="112" handcode="client"/> + </function--> + + <function name="GetClipPlane" offset="259" static_dispatch="false"> + <param name="plane" type="GLenum"/> + <param name="equation" type="GLdouble *" output="true" count="4"/> + <glx sop="113" always_array="true"/> + </function> + + <function name="GetDoublev" offset="260" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLdouble *" output="true" variable_param="pname"/> + <glx sop="114" handcode="client"/> + </function> + + <!--function name="GetError" offset="261" static_dispatch="false"> + <return type="GLenum"/> + <glx sop="115" handcode="client"/> + </function> + + <function name="GetFloatv" offset="262" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="116" handcode="client"/> + </function> + + <function name="GetIntegerv" offset="263" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="117" handcode="client"/> + </function> + + <function name="GetLightfv" offset="264" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="118"/> + </function--> + + <function name="GetLightiv" offset="265" static_dispatch="false"> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="119"/> + </function> + + <function name="GetMapdv" offset="266" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="query" type="GLenum"/> + <param name="v" type="GLdouble *" output="true" variable_param="target query"/> + <glx sop="120"/> + </function> + + <function name="GetMapfv" offset="267" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="query" type="GLenum"/> + <param name="v" type="GLfloat *" output="true" variable_param="target query"/> + <glx sop="121"/> + </function> + + <function name="GetMapiv" offset="268" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="query" type="GLenum"/> + <param name="v" type="GLint *" output="true" variable_param="target query"/> + <glx sop="122"/> + </function> + + <!--function name="GetMaterialfv" offset="269" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="123"/> + </function--> + + <function name="GetMaterialiv" offset="270" static_dispatch="false"> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="124"/> + </function> + + <function name="GetPixelMapfv" offset="271" static_dispatch="false"> + <param name="map" type="GLenum"/> + <param name="values" type="GLfloat *" output="true" variable_param="map"/> + <glx sop="125"/> + </function> + + <function name="GetPixelMapuiv" offset="272" static_dispatch="false"> + <param name="map" type="GLenum"/> + <param name="values" type="GLuint *" output="true" variable_param="map"/> + <glx sop="126"/> + </function> + + <function name="GetPixelMapusv" offset="273" static_dispatch="false"> + <param name="map" type="GLenum"/> + <param name="values" type="GLushort *" output="true" variable_param="map"/> + <glx sop="127"/> + </function> + + <function name="GetPolygonStipple" offset="274" static_dispatch="false"> + <param name="mask" type="GLubyte *" output="true" img_width="32" img_height="32" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP"/> + <glx sop="128"/> + </function> + + <!--function name="GetString" offset="275" static_dispatch="false"> + <param name="name" type="GLenum"/> + <return type="const GLubyte *"/> + <glx sop="129" handcode="true"/> + </function> + + <function name="GetTexEnvfv" offset="276" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="130"/> + </function> + + <function name="GetTexEnviv" offset="277" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="131"/> + </function--> + + <function name="GetTexGendv" offset="278" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLdouble *" output="true" variable_param="pname"/> + <glx sop="132"/> + </function> + + <!--function name="GetTexGenfv" offset="279" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="133"/> + </function> + + <function name="GetTexGeniv" offset="280" static_dispatch="false"> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="134"/> + </function--> + + <function name="GetTexImage" offset="281" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type"/> + <glx sop="135" dimensions_in_reply="true"/> + </function> + + <!--function name="GetTexParameterfv" offset="282" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="136"/> + </function> + + <function name="GetTexParameteriv" offset="283" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="137"/> + </function--> + + <function name="GetTexLevelParameterfv" offset="284" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="138"/> + </function> + + <function name="GetTexLevelParameteriv" offset="285" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="139"/> + </function> + + <!--function name="IsEnabled" offset="286" static_dispatch="false"> + <param name="cap" type="GLenum"/> + <return type="GLboolean"/> + <glx sop="140" handcode="client"/> + </function--> + + <function name="IsList" offset="287" static_dispatch="false"> + <param name="list" type="GLuint"/> + <return type="GLboolean"/> + <glx sop="141"/> + </function> + + <function name="DepthRange" offset="288" static_dispatch="false"> + <param name="zNear" type="GLclampd"/> + <param name="zFar" type="GLclampd"/> + <glx rop="174"/> + </function> + + <function name="Frustum" offset="289" static_dispatch="false"> + <param name="left" type="GLdouble"/> + <param name="right" type="GLdouble"/> + <param name="bottom" type="GLdouble"/> + <param name="top" type="GLdouble"/> + <param name="zNear" type="GLdouble"/> + <param name="zFar" type="GLdouble"/> + <glx rop="175"/> + </function> + + <!--function name="LoadIdentity" offset="290" static_dispatch="false"> + <glx rop="176"/> + </function> + + <function name="LoadMatrixf" offset="291" static_dispatch="false"> + <param name="m" type="const GLfloat *" count="16"/> + <glx rop="177"/> + </function--> + + <function name="LoadMatrixd" offset="292" static_dispatch="false"> + <param name="m" type="const GLdouble *" count="16"/> + <glx rop="178"/> + </function> + + <!--function name="MatrixMode" offset="293" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="179"/> + </function> + + <function name="MultMatrixf" offset="294" static_dispatch="false"> + <param name="m" type="const GLfloat *" count="16"/> + <glx rop="180"/> + </function--> + + <function name="MultMatrixd" offset="295" static_dispatch="false"> + <param name="m" type="const GLdouble *" count="16"/> + <glx rop="181"/> + </function> + + <function name="Ortho" offset="296" static_dispatch="false"> + <param name="left" type="GLdouble"/> + <param name="right" type="GLdouble"/> + <param name="bottom" type="GLdouble"/> + <param name="top" type="GLdouble"/> + <param name="zNear" type="GLdouble"/> + <param name="zFar" type="GLdouble"/> + <glx rop="182"/> + </function> + + <!--function name="PopMatrix" offset="297" static_dispatch="false"> + <glx rop="183"/> + </function> + + <function name="PushMatrix" offset="298" static_dispatch="false"> + <glx rop="184"/> + </function--> + + <function name="Rotated" offset="299" static_dispatch="false"> + <param name="angle" type="GLdouble"/> + <param name="x" type="GLdouble"/> + <param name="y" type="GLdouble"/> + <param name="z" type="GLdouble"/> + <glx rop="185"/> + </function> + + <!--function name="Rotatef" offset="300" static_dispatch="false"> + <param name="angle" type="GLfloat"/> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <glx rop="186"/> + </function--> + + <function name="Scaled" offset="301" static_dispatch="false"> + <param name="x" type="GLdouble"/> + <param name="y" type="GLdouble"/> + <param name="z" type="GLdouble"/> + <glx rop="187"/> + </function> + + <!--function name="Scalef" offset="302" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <glx rop="188"/> + </function--> + + <function name="Translated" offset="303" static_dispatch="false"> + <param name="x" type="GLdouble"/> + <param name="y" type="GLdouble"/> + <param name="z" type="GLdouble"/> + <glx rop="189"/> + </function> + + <!--function name="Translatef" offset="304" static_dispatch="false"> + <param name="x" type="GLfloat"/> + <param name="y" type="GLfloat"/> + <param name="z" type="GLfloat"/> + <glx rop="190"/> + </function> + + <function name="Viewport" offset="305" static_dispatch="false"> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="191"/> + </function--> +</category> + +<category name="1.1"> + <function name="ArrayElement" offset="306" static_dispatch="false"> + <param name="i" type="GLint"/> + <glx handcode="true"/> + </function> + + <!--function name="ColorPointer" offset="308" static_dispatch="false"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="DisableClientState" offset="309" static_dispatch="false"> + <param name="array" type="GLenum"/> + <glx handcode="true"/> + </function> + + <function name="DrawArrays" offset="310" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <param name="first" type="GLint"/> + <param name="count" type="GLsizei"/> + <glx rop="193" handcode="true"/> + </function> + + <function name="DrawElements" offset="311" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <param name="count" type="GLsizei"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid *"/> + <glx handcode="true"/> + </function--> + + <function name="EdgeFlagPointer" offset="312" static_dispatch="false"> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <!--function name="EnableClientState" offset="313" static_dispatch="false"> + <param name="array" type="GLenum"/> + <glx handcode="true"/> + </function> + + <function name="GetPointerv" offset="329" static_dispatch="false"> + <param name="pname" type="GLenum"/> + <param name="params" type="GLvoid **" output="true"/> + <glx handcode="true"/> + </function--> + + <function name="IndexPointer" offset="314" static_dispatch="false"> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="InterleavedArrays" offset="317" static_dispatch="false"> + <param name="format" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <!--function name="NormalPointer" offset="318" static_dispatch="false"> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="TexCoordPointer" offset="320" static_dispatch="false"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="VertexPointer" offset="321" static_dispatch="false"> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="PolygonOffset" offset="319" static_dispatch="false"> + <param name="factor" type="GLfloat"/> + <param name="units" type="GLfloat"/> + <glx rop="192"/> + </function--> + + <function name="CopyTexImage1D" offset="323" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLenum"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="border" type="GLint"/> + <glx rop="4119"/> + </function> + + <!--function name="CopyTexImage2D" offset="324" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLenum"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="border" type="GLint"/> + <glx rop="4120"/> + </function--> + + <function name="CopyTexSubImage1D" offset="325" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <glx rop="4121"/> + </function> + + <!--function name="CopyTexSubImage2D" offset="326" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="4122"/> + </function--> + + <function name="TexSubImage1D" offset="332" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="UNUSED" type="GLuint" padding="true"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_xoff="xoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + <glx rop="4099" large="true"/> + </function> + + <!--function name="TexSubImage2D" offset="333" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="UNUSED" type="GLuint" padding="true"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_xoff="xoffset" img_yoff="yoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + <glx rop="4100" large="true"/> + </function--> + + <function name="AreTexturesResident" offset="322" static_dispatch="false"> + <param name="n" type="GLsizei" counter="true"/> + <param name="textures" type="const GLuint *" count="n"/> + <param name="residences" type="GLboolean *" output="true" count="n"/> + <return type="GLboolean"/> + <glx sop="143" handcode="client" always_array="true"/> + </function> + + <!--function name="BindTexture" offset="307" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="texture" type="GLuint"/> + <glx rop="4117"/> + </function> + + <function name="DeleteTextures" offset="327" static_dispatch="false"> + <param name="n" type="GLsizei" counter="true"/> + <param name="textures" type="const GLuint *" count="n"/> + <glx sop="144"/> + </function> + + <function name="GenTextures" offset="328" static_dispatch="false"> + <param name="n" type="GLsizei" counter="true"/> + <param name="textures" type="GLuint *" output="true" count="n"/> + <glx sop="145" always_array="true"/> + </function> + + <function name="IsTexture" offset="330" static_dispatch="false"> + <param name="texture" type="GLuint"/> + <return type="GLboolean"/> + <glx sop="146"/> + </function--> + + <function name="PrioritizeTextures" offset="331" static_dispatch="false"> + <param name="n" type="GLsizei" counter="true"/> + <param name="textures" type="const GLuint *" count="n"/> + <param name="priorities" type="const GLclampf *" count="n"/> + <glx rop="4118"/> + </function> + + <function name="Indexub" offset="315" vectorequiv="Indexubv" static_dispatch="false"> + <param name="c" type="GLubyte"/> + </function> + + <function name="Indexubv" offset="316" static_dispatch="false"> + <param name="c" type="const GLubyte *" count="1"/> + <glx rop="194"/> + </function> + + <function name="PopClientAttrib" offset="334" static_dispatch="false"> + <glx handcode="true"/> + </function> + + <function name="PushClientAttrib" offset="335" static_dispatch="false"> + <param name="mask" type="GLbitfield"/> + <glx handcode="true"/> + </function> +</category> + +<category name="1.2"> + <!--function name="BlendColor" offset="336" static_dispatch="false"> + <param name="red" type="GLclampf"/> + <param name="green" type="GLclampf"/> + <param name="blue" type="GLclampf"/> + <param name="alpha" type="GLclampf"/> + <glx rop="4096"/> + </function> + + <function name="BlendEquation" offset="337" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <glx rop="4097"/> + </function--> + + <function name="DrawRangeElements" offset="338" static_dispatch="false"> + <param name="mode" type="GLenum"/> + <param name="start" type="GLuint"/> + <param name="end" type="GLuint"/> + <param name="count" type="GLsizei"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid *"/> + <glx handcode="true"/> + </function> + + <function name="ColorTable" offset="339" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="table" type="const GLvoid *" img_width="width" img_pad_dimensions="false" img_format="format" img_type="type" img_target="target"/> + <glx rop="2053" large="true"/> + </function> + + <function name="ColorTableParameterfv" offset="340" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="2054"/> + </function> + + <function name="ColorTableParameteriv" offset="341" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="2055"/> + </function> + + <function name="CopyColorTable" offset="342" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <glx rop="2056"/> + </function> + + <function name="GetColorTable" offset="343" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="table" type="GLvoid *" output="true" img_width="width" img_format="format" img_type="type"/> + <glx sop="147" dimensions_in_reply="true"/> + </function> + + <function name="GetColorTableParameterfv" offset="344" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="148"/> + </function> + + <function name="GetColorTableParameteriv" offset="345" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="149"/> + </function> + + <function name="ColorSubTable" offset="346" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="start" type="GLsizei"/> + <param name="count" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="data" type="const GLvoid *" img_width="count" img_pad_dimensions="false" img_format="format" img_type="type" img_target="target"/> + <glx rop="195" large="true"/> + </function> + + <function name="CopyColorSubTable" offset="347" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="start" type="GLsizei"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <glx rop="196"/> + </function> + + <function name="ConvolutionFilter1D" offset="348" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="image" type="const GLvoid *" img_width="width" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + <glx rop="4101" large="true"/> + </function> + + <function name="ConvolutionFilter2D" offset="349" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="image" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + <glx rop="4102" large="true"/> + </function> + + <function name="ConvolutionParameterf" offset="350" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat"/> + <glx rop="4103"/> + </function> + + <function name="ConvolutionParameterfv" offset="351" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLfloat *" variable_param="pname"/> + <glx rop="4104"/> + </function> + + <function name="ConvolutionParameteri" offset="352" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint"/> + <glx rop="4105"/> + </function> + + <function name="ConvolutionParameteriv" offset="353" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="const GLint *" variable_param="pname"/> + <glx rop="4106"/> + </function> + + <function name="CopyConvolutionFilter1D" offset="354" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <glx rop="4107"/> + </function> + + <function name="CopyConvolutionFilter2D" offset="355" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="4108"/> + </function> + + <function name="GetConvolutionFilter" offset="356" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="image" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type"/> + <glx sop="150" dimensions_in_reply="true"/> + </function> + + <function name="GetConvolutionParameterfv" offset="357" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="151"/> + </function> + + <function name="GetConvolutionParameteriv" offset="358" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="152"/> + </function> + + <function name="GetSeparableFilter" offset="359" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="row" type="GLvoid *" output="true"/> + <param name="column" type="GLvoid *" output="true"/> + <param name="span" type="GLvoid *" output="true"/> + <glx sop="153" handcode="true"/> + </function> + + <function name="SeparableFilter2D" offset="360" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="row" type="const GLvoid *"/> + <param name="column" type="const GLvoid *"/> + <glx rop="4109" handcode="true"/> + </function> + + <function name="GetHistogram" offset="361" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="reset" type="GLboolean"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="values" type="GLvoid *" output="true" img_width="width" img_format="format" img_type="type"/> + <glx sop="154" dimensions_in_reply="true" img_reset="reset"/> + </function> + + <function name="GetHistogramParameterfv" offset="362" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="155"/> + </function> + + <function name="GetHistogramParameteriv" offset="363" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="156"/> + </function> + + <function name="GetMinmax" offset="364" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="reset" type="GLboolean"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="values" type="GLvoid *" output="true" img_width="2" img_format="format" img_type="type"/> + <glx sop="157" img_reset="reset"/> + </function> + + <function name="GetMinmaxParameterfv" offset="365" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLfloat *" output="true" variable_param="pname"/> + <glx sop="158"/> + </function> + + <function name="GetMinmaxParameteriv" offset="366" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *" output="true" variable_param="pname"/> + <glx sop="159"/> + </function> + + <function name="Histogram" offset="367" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="internalformat" type="GLenum"/> + <param name="sink" type="GLboolean"/> + <glx rop="4110"/> + </function> + + <function name="Minmax" offset="368" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="internalformat" type="GLenum"/> + <param name="sink" type="GLboolean"/> + <glx rop="4111"/> + </function> + + <function name="ResetHistogram" offset="369" static_dispatch="false"> + <param name="target" type="GLenum"/> + <glx rop="4112"/> + </function> + + <function name="ResetMinmax" offset="370" static_dispatch="false"> + <param name="target" type="GLenum"/> + <glx rop="4113"/> + </function> + + <!--function name="TexImage3D" offset="371" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalformat" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/> + <glx rop="4114" large="true"/> + </function> + + <function name="TexSubImage3D" offset="372" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="UNUSED" type="GLuint" padding="true"/> + <param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/> + <glx rop="4115" large="true"/> + </function> + + <function name="CopyTexSubImage3D" offset="373" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <glx rop="4123"/> + </function--> +</category> + +<category name="GL_ARB_multitexture" number="1"> + <!--function name="ActiveTextureARB" offset="374" static_dispatch="false"> + <param name="texture" type="GLenum"/> + <glx rop="197"/> + </function> + + <function name="ClientActiveTextureARB" offset="375" static_dispatch="false"> + <param name="texture" type="GLenum"/> + <glx handcode="true"/> + </function--> + + <function name="MultiTexCoord1dARB" offset="376" vectorequiv="MultiTexCoord1dvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLdouble"/> + </function> + + <function name="MultiTexCoord1dvARB" offset="377" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLdouble *" count="1"/> + <glx rop="198"/> + </function> + + <function name="MultiTexCoord1fARB" offset="378" vectorequiv="MultiTexCoord1fvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfloat"/> + </function> + + <function name="MultiTexCoord1fvARB" offset="379" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLfloat *" count="1"/> + <glx rop="199"/> + </function> + + <function name="MultiTexCoord1iARB" offset="380" vectorequiv="MultiTexCoord1ivARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLint"/> + </function> + + <function name="MultiTexCoord1ivARB" offset="381" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLint *" count="1"/> + <glx rop="200"/> + </function> + + <function name="MultiTexCoord1sARB" offset="382" vectorequiv="MultiTexCoord1svARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLshort"/> + </function> + + <function name="MultiTexCoord1svARB" offset="383" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLshort *" count="1"/> + <glx rop="201"/> + </function> + + <function name="MultiTexCoord2dARB" offset="384" vectorequiv="MultiTexCoord2dvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLdouble"/> + <param name="t" type="GLdouble"/> + </function> + + <function name="MultiTexCoord2dvARB" offset="385" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLdouble *" count="2"/> + <glx rop="202"/> + </function> + + <function name="MultiTexCoord2fARB" offset="386" vectorequiv="MultiTexCoord2fvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfloat"/> + <param name="t" type="GLfloat"/> + </function> + + <function name="MultiTexCoord2fvARB" offset="387" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLfloat *" count="2"/> + <glx rop="203"/> + </function> + + <function name="MultiTexCoord2iARB" offset="388" vectorequiv="MultiTexCoord2ivARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLint"/> + <param name="t" type="GLint"/> + </function> + + <function name="MultiTexCoord2ivARB" offset="389" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLint *" count="2"/> + <glx rop="204"/> + </function> + + <function name="MultiTexCoord2sARB" offset="390" vectorequiv="MultiTexCoord2svARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLshort"/> + <param name="t" type="GLshort"/> + </function> + + <function name="MultiTexCoord2svARB" offset="391" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLshort *" count="2"/> + <glx rop="205"/> + </function> + + <function name="MultiTexCoord3dARB" offset="392" vectorequiv="MultiTexCoord3dvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLdouble"/> + <param name="t" type="GLdouble"/> + <param name="r" type="GLdouble"/> + </function> + + <function name="MultiTexCoord3dvARB" offset="393" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLdouble *" count="3"/> + <glx rop="206"/> + </function> + + <function name="MultiTexCoord3fARB" offset="394" vectorequiv="MultiTexCoord3fvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfloat"/> + <param name="t" type="GLfloat"/> + <param name="r" type="GLfloat"/> + </function> + + <function name="MultiTexCoord3fvARB" offset="395" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLfloat *" count="3"/> + <glx rop="207"/> + </function> + + <function name="MultiTexCoord3iARB" offset="396" vectorequiv="MultiTexCoord3ivARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLint"/> + <param name="t" type="GLint"/> + <param name="r" type="GLint"/> + </function> + + <function name="MultiTexCoord3ivARB" offset="397" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLint *" count="3"/> + <glx rop="208"/> + </function> + + <function name="MultiTexCoord3sARB" offset="398" vectorequiv="MultiTexCoord3svARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLshort"/> + <param name="t" type="GLshort"/> + <param name="r" type="GLshort"/> + </function> + + <function name="MultiTexCoord3svARB" offset="399" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLshort *" count="3"/> + <glx rop="209"/> + </function> + + <function name="MultiTexCoord4dARB" offset="400" vectorequiv="MultiTexCoord4dvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLdouble"/> + <param name="t" type="GLdouble"/> + <param name="r" type="GLdouble"/> + <param name="q" type="GLdouble"/> + </function> + + <function name="MultiTexCoord4dvARB" offset="401" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLdouble *" count="4"/> + <glx rop="210"/> + </function> + + <!--function name="MultiTexCoord4fARB" offset="402" vectorequiv="MultiTexCoord4fvARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLfloat"/> + <param name="t" type="GLfloat"/> + <param name="r" type="GLfloat"/> + <param name="q" type="GLfloat"/> + </function--> + + <function name="MultiTexCoord4fvARB" offset="403" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLfloat *" count="4"/> + <glx rop="211"/> + </function> + + <function name="MultiTexCoord4iARB" offset="404" vectorequiv="MultiTexCoord4ivARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLint"/> + <param name="t" type="GLint"/> + <param name="r" type="GLint"/> + <param name="q" type="GLint"/> + </function> + + <function name="MultiTexCoord4ivARB" offset="405" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLint *" count="4"/> + <glx rop="212"/> + </function> + + <function name="MultiTexCoord4sARB" offset="406" vectorequiv="MultiTexCoord4svARB" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="s" type="GLshort"/> + <param name="t" type="GLshort"/> + <param name="r" type="GLshort"/> + <param name="q" type="GLshort"/> + </function> + + <function name="MultiTexCoord4svARB" offset="407" static_dispatch="false"> + <param name="target" type="GLenum"/> + <param name="v" type="const GLshort *" count="4"/> + <glx rop="213"/> + </function> +</category> + +<xi:include href="../gen/APPLE_vertex_array_object.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/es_EXT.xml b/mesalib/src/mapi/glapi/gen-es/es_EXT.xml new file mode 100644 index 000000000..0013df87e --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/es_EXT.xml @@ -0,0 +1,125 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "../gen/gl_API.dtd"> + +<!-- OpenGL ES extensions --> + +<OpenGLAPI> + +<category name="GL_OES_compressed_paletted_texture" number="6"> + <enum name="PALETTE4_RGB8_OES" value="0x8B90"/> + <enum name="PALETTE4_RGBA8_OES" value="0x8B91"/> + <enum name="PALETTE4_R5_G6_B5_OES" value="0x8B92"/> + <enum name="PALETTE4_RGBA4_OES" value="0x8B93"/> + <enum name="PALETTE4_RGB5_A1_OES" value="0x8B94"/> + <enum name="PALETTE8_RGB8_OES" value="0x8B95"/> + <enum name="PALETTE8_RGBA8_OES" value="0x8B96"/> + <enum name="PALETTE8_R5_G6_B5_OES" value="0x8B97"/> + <enum name="PALETTE8_RGBA4_OES" value="0x8B98"/> + <enum name="PALETTE8_RGB5_A1_OES" value="0x8B99"/> +</category> + +<!-- 23. GL_OES_EGL_image --> +<xi:include href="../gen/OES_EGL_image.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<category name="GL_OES_depth24" number="24"> + <enum name="DEPTH_COMPONENT24_OES" value="0x81A6"/> +</category> + +<category name="GL_OES_depth32" number="25"> + <enum name="DEPTH_COMPONENT32_OES" value="0x81A7"/> +</category> + +<category name="GL_OES_element_index_uint" number="26"> + <!-- No new functions, types, enums. --> +</category> + +<category name="GL_OES_fbo_render_mipmap" number="27"> + <!-- No new functions, types, enums. --> +</category> + +<category name="GL_OES_mapbuffer" number="29"> + <enum name="WRITE_ONLY_OES" value="0x88B9"/> + <enum name="BUFFER_ACCESS_OES" value="0x88BB"/> + <enum name="BUFFER_MAPPED_OES" value="0x88BC"/> + <enum name="BUFFER_MAP_POINTER_OES" value="0x88BD"/> + + <function name="GetBufferPointervOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLvoid **"/> + </function> + + <function name="MapBufferOES" offset="assign"> + <param name="target" type="GLenum"/> + <param name="access" type="GLenum"/> + <return type="GLvoid *"/> + </function> + + <function name="UnmapBufferOES" offset="assign"> + <param name="target" type="GLenum"/> + <return type="GLboolean"/> + </function> +</category> + +<category name="GL_OES_rgb8_rgba8" number="30"> + <enum name="RGB8_OES" value="0x8051"/> + <enum name="RGBA8_OES" value="0x8058"/> +</category> + +<category name="GL_OES_stencil1" number="31"> + <enum name="STENCIL_INDEX1_OES" value="0x8D46"/> +</category> + +<category name="GL_OES_stencil4" number="32"> + <enum name="STENCIL_INDEX4_OES" value="0x8D47"/> +</category> + +<category name="GL_OES_stencil8" number="33"> + <enum name="STENCIL_INDEX8_OES" value="0x8D48"/> +</category> + +<category name="GL_EXT_texture_filter_anisotropic" number="41"> + <enum name="TEXTURE_MAX_ANISOTROPY_EXT" value="0x84FE"/> + <enum name="MAX_TEXTURE_MAX_ANISOTROPY_EXT" value="0x84FF"/> +</category> + +<category name="GL_EXT_texture_compression_dxt1" number="49"> + <enum name="COMPRESSED_RGB_S3TC_DXT1_EXT" value="0x83F0"/> + <enum name="COMPRESSED_RGBA_S3TC_DXT1_EXT" value="0x83F1"/> +</category> + +<category name="GL_EXT_texture_format_BGRA8888" number="51"> + <enum name="BGRA_EXT" value="0x80E1"/> +</category> + +<category name="GL_EXT_blend_minmax" number="65"> + <enum name="MIN_EXT" value="0x8007"/> + <enum name="MAX_EXT" value="0x8008"/> +</category> + +<category name="GL_EXT_read_format_bgra" number="66"> + <enum name="BGRA_EXT" value="0x80E1"/> + <enum name="UNSIGNED_SHORT_4_4_4_4_REV_EXT" value="0x8365"/> + <enum name="UNSIGNED_SHORT_1_5_5_5_REV_EXT" value="0x8366"/> +</category> + +<category name="GL_EXT_multi_draw_arrays" number="69"> + <function name="MultiDrawArraysEXT" offset="assign"> + <param name="mode" type="GLenum"/> + <param name="first" type="const GLint *"/> + <param name="count" type="const GLsizei *"/> + <param name="primcount" type="GLsizei"/> + <glx handcode="true"/> + </function> + + <function name="MultiDrawElementsEXT" offset="assign"> + <param name="mode" type="GLenum"/> + <param name="count" type="const GLsizei *"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid **"/> + <param name="primcount" type="GLsizei"/> + <glx handcode="true"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen-es/gl_compare.py b/mesalib/src/mapi/glapi/gen-es/gl_compare.py new file mode 100644 index 000000000..6b5e43bb9 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/gl_compare.py @@ -0,0 +1,354 @@ +#!/usr/bin/python +# +# Copyright (C) 2009 Chia-I Wu <olv@0xlab.org> +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +import sys +import os.path +import getopt + +GLAPI = "../../glapi/gen" +sys.path.append(GLAPI) + +import gl_XML +import glX_XML + +class ApiSet(object): + def __init__(self, api, elts=["enum", "type", "function"]): + self.api = api + self.elts = elts + + def _check_enum(self, e1, e2, strict=True): + if e1.name != e2.name: + raise ValueError("%s: name mismatch" % e1.name) + if e1.value != e2.value: + raise ValueError("%s: value 0x%04x != 0x%04x" + % (e1.name, e1.value, e2.value)) + + def _check_type(self, t1, t2, strict=True): + if t1.name != t2.name: + raise ValueError("%s: name mismatch" % t1.name) + if t1.type_expr.string() != t2.type_expr.string(): + raise ValueError("%s: type %s != %s" + % (t1.name, t1.type_expr.string(), t2.type_expr.string())) + + def _check_function(self, f1, f2, strict=True): + if f1.name != f2.name: + raise ValueError("%s: name mismatch" % f1.name) + if f1.return_type != f2.return_type: + raise ValueError("%s: return type %s != %s" + % (f1.name, f1.return_type, f2.return_type)) + # there might be padded parameters + if strict and len(f1.parameters) != len(f2.parameters): + raise ValueError("%s: parameter length %d != %d" + % (f1.name, len(f1.parameters), len(f2.parameters))) + if f1.assign_offset != f2.assign_offset: + if ((f1.assign_offset and f2.offset < 0) or + (f2.assign_offset and f1.offset < 0)): + raise ValueError("%s: assign offset %d != %d" + % (f1.name, f1.assign_offset, f2.assign_offset)) + elif not f1.assign_offset: + if f1.offset != f2.offset: + raise ValueError("%s: offset %d != %d" + % (f1.name, f1.offset, f2.offset)) + + if strict: + l1 = f1.entry_points + l2 = f2.entry_points + l1.sort() + l2.sort() + if l1 != l2: + raise ValueError("%s: entry points %s != %s" + % (f1.name, l1, l2)) + + l1 = f1.static_entry_points + l2 = f2.static_entry_points + l1.sort() + l2.sort() + if l1 != l2: + raise ValueError("%s: static entry points %s != %s" + % (f1.name, l1, l2)) + + pad = 0 + for i in xrange(len(f1.parameters)): + p1 = f1.parameters[i] + p2 = f2.parameters[i + pad] + + if not strict and p1.is_padding != p2.is_padding: + if p1.is_padding: + pad -= 1 + continue + else: + pad += 1 + p2 = f2.parameters[i + pad] + + if strict and p1.name != p2.name: + raise ValueError("%s: parameter %d name %s != %s" + % (f1.name, i, p1.name, p2.name)) + if p1.type_expr.string() != p2.type_expr.string(): + if (strict or + # special case + f1.name == "TexImage2D" and p1.name != "internalformat"): + raise ValueError("%s: parameter %s type %s != %s" + % (f1.name, p1.name, p1.type_expr.string(), + p2.type_expr.string())) + + def union(self, other): + union = gl_XML.gl_api(None) + + if "enum" in self.elts: + union.enums_by_name = other.enums_by_name.copy() + for key, val in self.api.enums_by_name.iteritems(): + if key not in union.enums_by_name: + union.enums_by_name[key] = val + else: + self._check_enum(val, other.enums_by_name[key]) + + if "type" in self.elts: + union.types_by_name = other.types_by_name.copy() + for key, val in self.api.types_by_name.iteritems(): + if key not in union.types_by_name: + union.types_by_name[key] = val + else: + self._check_type(val, other.types_by_name[key]) + + if "function" in self.elts: + union.functions_by_name = other.functions_by_name.copy() + for key, val in self.api.functions_by_name.iteritems(): + if key not in union.functions_by_name: + union.functions_by_name[key] = val + else: + self._check_function(val, other.functions_by_name[key]) + + return union + + def intersection(self, other): + intersection = gl_XML.gl_api(None) + + if "enum" in self.elts: + for key, val in self.api.enums_by_name.iteritems(): + if key in other.enums_by_name: + self._check_enum(val, other.enums_by_name[key]) + intersection.enums_by_name[key] = val + + if "type" in self.elts: + for key, val in self.api.types_by_name.iteritems(): + if key in other.types_by_name: + self._check_type(val, other.types_by_name[key]) + intersection.types_by_name[key] = val + + if "function" in self.elts: + for key, val in self.api.functions_by_name.iteritems(): + if key in other.functions_by_name: + self._check_function(val, other.functions_by_name[key]) + intersection.functions_by_name[key] = val + + return intersection + + def difference(self, other): + difference = gl_XML.gl_api(None) + + if "enum" in self.elts: + for key, val in self.api.enums_by_name.iteritems(): + if key not in other.enums_by_name: + difference.enums_by_name[key] = val + else: + self._check_enum(val, other.enums_by_name[key]) + + if "type" in self.elts: + for key, val in self.api.types_by_name.iteritems(): + if key not in other.types_by_name: + difference.types_by_name[key] = val + else: + self._check_type(val, other.types_by_name[key]) + + if "function" in self.elts: + for key, val in self.api.functions_by_name.iteritems(): + if key not in other.functions_by_name: + difference.functions_by_name[key] = val + else: + self._check_function(val, other.functions_by_name[key], False) + + return difference + +def cmp_enum(e1, e2): + if e1.value < e2.value: + return -1 + elif e1.value > e2.value: + return 1 + else: + return 0 + +def cmp_type(t1, t2): + return t1.size - t2.size + +def cmp_function(f1, f2): + if f1.name > f2.name: + return 1 + elif f1.name < f2.name: + return -1 + else: + return 0 + +def spaces(n, str=""): + spaces = n - len(str) + if spaces < 1: + spaces = 1 + return " " * spaces + +def output_enum(e, indent=0): + attrs = 'name="%s"' % e.name + if e.default_count > 0: + tab = spaces(37, attrs) + attrs += '%scount="%d"' % (tab, e.default_count) + tab = spaces(48, attrs) + val = "%04x" % e.value + val = "0x" + val.upper() + attrs += '%svalue="%s"' % (tab, val) + + # no child + if not e.functions: + print '%s<enum %s/>' % (spaces(indent), attrs) + return + + print '%s<enum %s>' % (spaces(indent), attrs) + for key, val in e.functions.iteritems(): + attrs = 'name="%s"' % key + if val[0] != e.default_count: + attrs += ' count="%d"' % val[0] + if not val[1]: + attrs += ' mode="get"' + + print '%s<size %s/>' % (spaces(indent * 2), attrs) + + print '%s</enum>' % spaces(indent) + +def output_type(t, indent=0): + tab = spaces(16, t.name) + attrs = 'name="%s"%ssize="%d"' % (t.name, tab, t.size) + ctype = t.type_expr.string() + if ctype.find("unsigned") != -1: + attrs += ' unsigned="true"' + elif ctype.find("signed") == -1: + attrs += ' float="true"' + print '%s<type %s/>' % (spaces(indent), attrs) + +def output_function(f, indent=0): + attrs = 'name="%s"' % f.name + if f.offset > 0: + if f.assign_offset: + attrs += ' offset="assign"' + else: + attrs += ' offset="%d"' % f.offset + print '%s<function %s>' % (spaces(indent), attrs) + + for p in f.parameters: + attrs = 'name="%s" type="%s"' \ + % (p.name, p.type_expr.original_string) + print '%s<param %s/>' % (spaces(indent * 2), attrs) + if f.return_type != "void": + attrs = 'type="%s"' % f.return_type + print '%s<return %s/>' % (spaces(indent * 2), attrs) + + print '%s</function>' % spaces(indent) + +def output_category(api, indent=0): + enums = api.enums_by_name.values() + enums.sort(cmp_enum) + types = api.types_by_name.values() + types.sort(cmp_type) + functions = api.functions_by_name.values() + functions.sort(cmp_function) + + for e in enums: + output_enum(e, indent) + if enums and types: + print + for t in types: + output_type(t, indent) + if enums or types: + print + for f in functions: + output_function(f, indent) + if f != functions[-1]: + print + +def is_api_empty(api): + return bool(not api.enums_by_name and + not api.types_by_name and + not api.functions_by_name) + +def show_usage(ops): + print "Usage: %s [-k elts] <%s> <file1> <file2>" % (sys.argv[0], "|".join(ops)) + print " -k elts A comma separated string of types of elements to" + print " skip. Possible types are enum, type, and function." + sys.exit(1) + +def main(): + ops = ["union", "intersection", "difference"] + elts = ["enum", "type", "function"] + + try: + options, args = getopt.getopt(sys.argv[1:], "k:") + except Exception, e: + show_usage(ops) + + if len(args) != 3: + show_usage(ops) + op, file1, file2 = args + if op not in ops: + show_usage(ops) + + skips = [] + for opt, val in options: + if opt == "-k": + skips = val.split(",") + + for elt in skips: + try: + elts.remove(elt) + except ValueError: + show_usage(ops) + + api1 = gl_XML.parse_GL_API(file1, glX_XML.glx_item_factory()) + api2 = gl_XML.parse_GL_API(file2, glX_XML.glx_item_factory()) + + set = ApiSet(api1, elts) + func = getattr(set, op) + result = func(api2) + + if not is_api_empty(result): + cat_name = "%s_of_%s_and_%s" \ + % (op, os.path.basename(file1), os.path.basename(file2)) + + print '<?xml version="1.0"?>' + print '<!DOCTYPE OpenGLAPI SYSTEM "%s/gl_API.dtd">' % GLAPI + print + print '<OpenGLAPI>' + print + print '<category name="%s">' % (cat_name) + output_category(result, 4) + print '</category>' + print + print '</OpenGLAPI>' + +if __name__ == "__main__": + main() diff --git a/mesalib/src/mapi/glapi/gen-es/gl_parse_header.py b/mesalib/src/mapi/glapi/gen-es/gl_parse_header.py new file mode 100644 index 000000000..5382eba35 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen-es/gl_parse_header.py @@ -0,0 +1,450 @@ +#!/usr/bin/python +# +# Copyright (C) 2009 Chia-I Wu <olv@0xlab.org> +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + +import sys +import os.path +import getopt +import re + +GLAPI = "../../glapi/gen" +sys.path.append(GLAPI) + +class HeaderParser(object): + """Parser for GL header files.""" + + def __init__(self, verbose=0): + # match #if and #ifdef + self.IFDEF = re.compile('#\s*if(n?def\s+(?P<ifdef>\w+)|\s+(?P<if>.+))') + # match #endif + self.ENDIF = re.compile('#\s*endif') + # match typedef abc def; + self.TYPEDEF = re.compile('typedef\s+(?P<from>[\w ]+)\s+(?P<to>\w+);') + # match #define XYZ VAL + self.DEFINE = re.compile('#\s*define\s+(?P<key>\w+)(?P<value>\s+[\w"]*)?') + # match GLAPI + self.GLAPI = re.compile('^GL_?API(CALL)?\s+(?P<return>[\w\s*]+[\w*])\s+(GL)?_?APIENTRY\s+(?P<name>\w+)\s*\((?P<params>[\w\s(,*\[\])]+)\)\s*;') + + self.split_params = re.compile('\s*,\s*') + self.split_ctype = re.compile('(\W)') + # ignore GL_VERSION_X_Y + self.ignore_enum = re.compile('GL(_ES)?_VERSION(_ES_C[ML])?_\d_\d') + + self.verbose = verbose + self._reset() + + def _reset(self): + """Reset to initial state.""" + self.ifdef_levels = [] + self.need_char = False + + # use typeexpr? + def _format_ctype(self, ctype, fix=True): + """Format a ctype string, optionally fix it.""" + # split the type string + tmp = self.split_ctype.split(ctype) + tmp = [s for s in tmp if s and s != " "] + + pretty = "" + for i in xrange(len(tmp)): + # add missing GL prefix + if (fix and tmp[i] != "const" and tmp[i] != "*" and + not tmp[i].startswith("GL")): + tmp[i] = "GL" + tmp[i] + + if i == 0: + pretty = tmp[i] + else: + sep = " " + if tmp[i - 1] == "*": + sep = "" + pretty += sep + tmp[i] + return pretty + + # use typeexpr? + def _get_ctype_attrs(self, ctype): + """Get the attributes of a ctype.""" + is_float = (ctype.find("float") != -1 or ctype.find("double") != -1) + is_signed = not (ctype.find("unsigned") != -1) + + size = 0 + if ctype.find("char") != -1: + size = 1 + elif ctype.find("short") != -1: + size = 2 + elif ctype.find("int") != -1: + size = 4 + elif is_float: + if ctype.find("float") != -1: + size = 4 + else: + size = 8 + + return (size, is_float, is_signed) + + def _parse_define(self, line): + """Parse a #define line for an <enum>.""" + m = self.DEFINE.search(line) + if not m: + if self.verbose and line.find("#define") >= 0: + print "ignore %s" % (line) + return None + + key = m.group("key").strip() + val = m.group("value").strip() + + # enum must begin with GL_ and be all uppercase + if ((not (key.startswith("GL_") and key.isupper())) or + (self.ignore_enum.match(key) and val == "1")): + if self.verbose: + print "ignore enum %s" % (key) + return None + + return (key, val) + + def _parse_typedef(self, line): + """Parse a typedef line for a <type>.""" + m = self.TYPEDEF.search(line) + if not m: + if self.verbose and line.find("typedef") >= 0: + print "ignore %s" % (line) + return None + + f = m.group("from").strip() + t = m.group("to").strip() + if not t.startswith("GL"): + if self.verbose: + print "ignore type %s" % (t) + return None + attrs = self._get_ctype_attrs(f) + + return (f, t, attrs) + + def _parse_gl_api(self, line): + """Parse a GLAPI line for a <function>.""" + m = self.GLAPI.search(line) + if not m: + if self.verbose and line.find("APIENTRY") >= 0: + print "ignore %s" % (line) + return None + + rettype = m.group("return") + rettype = self._format_ctype(rettype) + if rettype == "GLvoid": + rettype = "" + + name = m.group("name") + + param_str = m.group("params") + chunks = self.split_params.split(param_str) + chunks = [s.strip() for s in chunks] + if len(chunks) == 1 and (chunks[0] == "void" or chunks[0] == "GLvoid"): + chunks = [] + + params = [] + for c in chunks: + # split type and variable name + idx = c.rfind("*") + if idx < 0: + idx = c.rfind(" ") + if idx >= 0: + idx += 1 + ctype = c[:idx] + var = c[idx:] + else: + ctype = c + var = "unnamed" + + # convert array to pointer + idx = var.find("[") + if idx >= 0: + var = var[:idx] + ctype += "*" + + ctype = self._format_ctype(ctype) + var = var.strip() + + if not self.need_char and ctype.find("GLchar") >= 0: + self.need_char = True + + params.append((ctype, var)) + + return (rettype, name, params) + + def _change_level(self, line): + """Parse a #ifdef line and change level.""" + m = self.IFDEF.search(line) + if m: + ifdef = m.group("ifdef") + if not ifdef: + ifdef = m.group("if") + self.ifdef_levels.append(ifdef) + return True + m = self.ENDIF.search(line) + if m: + self.ifdef_levels.pop() + return True + return False + + def _read_header(self, header): + """Open a header file and read its contents.""" + lines = [] + try: + fp = open(header, "rb") + lines = fp.readlines() + fp.close() + except IOError, e: + print "failed to read %s: %s" % (header, e) + return lines + + def _cmp_enum(self, enum1, enum2): + """Compare two enums.""" + # sort by length of the values as strings + val1 = enum1[1] + val2 = enum2[1] + ret = len(val1) - len(val2) + # sort by the values + if not ret: + val1 = int(val1, 16) + val2 = int(val2, 16) + ret = val1 - val2 + # in case int cannot hold the result + if ret > 0: + ret = 1 + elif ret < 0: + ret = -1 + # sort by the names + if not ret: + if enum1[0] < enum2[0]: + ret = -1 + elif enum1[0] > enum2[0]: + ret = 1 + return ret + + def _cmp_type(self, type1, type2): + """Compare two types.""" + attrs1 = type1[2] + attrs2 = type2[2] + # sort by type size + ret = attrs1[0] - attrs2[0] + # float is larger + if not ret: + ret = attrs1[1] - attrs2[1] + # signed is larger + if not ret: + ret = attrs1[2] - attrs2[2] + # reverse + ret = -ret + return ret + + def _cmp_function(self, func1, func2): + """Compare two functions.""" + name1 = func1[1] + name2 = func2[1] + ret = 0 + # sort by the names + if name1 < name2: + ret = -1 + elif name1 > name2: + ret = 1 + return ret + + def _postprocess_dict(self, hdict): + """Post-process a header dict and return an ordered list.""" + hlist = [] + largest = 0 + for key, cat in hdict.iteritems(): + size = len(cat["enums"]) + len(cat["types"]) + len(cat["functions"]) + # ignore empty category + if not size: + continue + + cat["enums"].sort(self._cmp_enum) + # remove duplicates + dup = [] + for i in xrange(1, len(cat["enums"])): + if cat["enums"][i] == cat["enums"][i - 1]: + dup.insert(0, i) + for i in dup: + e = cat["enums"].pop(i) + if self.verbose: + print "remove duplicate enum %s" % e[0] + + cat["types"].sort(self._cmp_type) + cat["functions"].sort(self._cmp_function) + + # largest category comes first + if size > largest: + hlist.insert(0, (key, cat)) + largest = size + else: + hlist.append((key, cat)) + return hlist + + def parse(self, header): + """Parse a header file.""" + self._reset() + + if self.verbose: + print "Parsing %s" % (header) + + hdict = {} + lines = self._read_header(header) + for line in lines: + if self._change_level(line): + continue + + # skip until the first ifdef (i.e. __gl_h_) + if not self.ifdef_levels: + continue + + cat_name = os.path.basename(header) + # check if we are in an extension + if (len(self.ifdef_levels) > 1 and + self.ifdef_levels[-1].startswith("GL_")): + cat_name = self.ifdef_levels[-1] + + try: + cat = hdict[cat_name] + except KeyError: + cat = { + "enums": [], + "types": [], + "functions": [] + } + hdict[cat_name] = cat + + key = "enums" + elem = self._parse_define(line) + if not elem: + key = "types" + elem = self._parse_typedef(line) + if not elem: + key = "functions" + elem = self._parse_gl_api(line) + + if elem: + cat[key].append(elem) + + if self.need_char: + if self.verbose: + print "define GLchar" + elem = self._parse_typedef("typedef char GLchar;") + cat["types"].append(elem) + return self._postprocess_dict(hdict) + +def spaces(n, str=""): + spaces = n - len(str) + if spaces < 1: + spaces = 1 + return " " * spaces + +def output_xml(name, hlist): + """Output a parsed header in OpenGLAPI XML.""" + + for i in xrange(len(hlist)): + cat_name, cat = hlist[i] + + print '<category name="%s">' % (cat_name) + indent = 4 + + for enum in cat["enums"]: + name = enum[0][3:] + value = enum[1] + tab = spaces(41, name) + attrs = 'name="%s"%svalue="%s"' % (name, tab, value) + print '%s<enum %s/>' % (spaces(indent), attrs) + + if cat["enums"] and cat["types"]: + print + + for type in cat["types"]: + ctype = type[0] + size, is_float, is_signed = type[2] + + attrs = 'name="%s"' % (type[1][2:]) + attrs += spaces(16, attrs) + 'size="%d"' % (size) + if is_float: + attrs += ' float="true"' + elif not is_signed: + attrs += ' unsigned="true"' + + print '%s<type %s/>' % (spaces(indent), attrs) + + for func in cat["functions"]: + print + ret = func[0] + name = func[1][2:] + params = func[2] + + attrs = 'name="%s" offset="assign"' % name + print '%s<function %s>' % (spaces(indent), attrs) + + for param in params: + attrs = 'name="%s" type="%s"' % (param[1], param[0]) + print '%s<param %s/>' % (spaces(indent * 2), attrs) + if ret: + attrs = 'type="%s"' % ret + print '%s<return %s/>' % (spaces(indent * 2), attrs) + + print '%s</function>' % spaces(indent) + + print '</category>' + print + +def show_usage(): + print "Usage: %s [-v] <header> ..." % sys.argv[0] + sys.exit(1) + +def main(): + try: + args, headers = getopt.getopt(sys.argv[1:], "v") + except Exception, e: + show_usage() + if not headers: + show_usage() + + verbose = 0 + for arg in args: + if arg[0] == "-v": + verbose += 1 + + need_xml_header = True + parser = HeaderParser(verbose) + for h in headers: + h = os.path.abspath(h) + hlist = parser.parse(h) + + if need_xml_header: + print '<?xml version="1.0"?>' + print '<!DOCTYPE OpenGLAPI SYSTEM "%s/gl_API.dtd">' % GLAPI + need_xml_header = False + + print + print '<!-- %s -->' % (h) + print '<OpenGLAPI>' + print + output_xml(h, hlist) + print '</OpenGLAPI>' + +if __name__ == '__main__': + main() diff --git a/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml b/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml new file mode 100644 index 000000000..5741a588c --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml @@ -0,0 +1,69 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + + +<OpenGLAPI> + +<category name="3.1"> + + <function name="DrawArraysInstanced" offset="assign"> + <param name="mode" type="GLenum"/> + <param name="first" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="primcount" type="GLsizei"/> + </function> + + <function name="DrawElementsInstanced" offset="assign"> + <param name="mode" type="GLenum"/> + <param name="count" type="GLsizei"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid *"/> + <param name="primcount" type="GLsizei"/> + </function> + +</category> + + +<category name="GL_ARB_draw_instanced" number="44"> + + <function name="DrawArraysInstancedARB" alias="DrawArraysInstanced"> + <param name="mode" type="GLenum"/> + <param name="first" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="primcount" type="GLsizei"/> + </function> + + <function name="DrawElementsInstancedARB" alias="DrawElementsInstanced"> + <param name="mode" type="GLenum"/> + <param name="count" type="GLsizei"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid *"/> + <param name="primcount" type="GLsizei"/> + </function> + +</category> + + +<category name="GL_EXT_draw_instanced" number="327"> + + <function name="DrawArraysInstancedEXT" alias="DrawArraysInstanced"> + <param name="mode" type="GLenum"/> + <param name="first" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="primcount" type="GLsizei"/> + </function> + + <function name="DrawElementsInstancedEXT" alias="DrawElementsInstanced"> + <param name="mode" type="GLenum"/> + <param name="count" type="GLsizei"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid *"/> + <param name="primcount" type="GLsizei"/> + </function> + +</category> + + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/ARB_geometry_shader4.xml b/mesalib/src/mapi/glapi/gen/ARB_geometry_shader4.xml new file mode 100644 index 000000000..ca9a101a0 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_geometry_shader4.xml @@ -0,0 +1,57 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + +<OpenGLAPI> + + +<category name="GL_ARB_geometry_shader4" number="47"> + <enum name="GEOMETRY_SHADER_ARB" value="0x8DD9"/> + <enum name="GEOMETRY_VERTICES_OUT_ARB" value="0x8DDA"/> + <enum name="GEOMETRY_INPUT_TYPE_ARB" value="0x8DDB"/> + <enum name="GEOMETRY_OUTPUT_TYPE_ARB" value="0x8DDC"/> + <enum name="MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB" value="0x8C29"/> + <enum name="MAX_GEOMETRY_VARYING_COMPONENTS_ARB" value="0x8DDD"/> + <enum name="MAX_VERTEX_VARYING_COMPONENTS_ARB" value="0x8DDE"/> + <enum name="MAX_VARYING_COMPONENTS" value="0x8B4B"/> + <enum name="MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB" value="0x8DDF"/> + <enum name="MAX_GEOMETRY_OUTPUT_VERTICES_ARB" value="0x8DE0"/> + <enum name="MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB" value="0x8DE1"/> + <enum name="LINES_ADJACENCY_ARB" value="0xA"/> + <enum name="LINE_STRIP_ADJACENCY_ARB" value="0xB"/> + <enum name="TRIANGLES_ADJACENCY_ARB" value="0xC"/> + <enum name="TRIANGLE_STRIP_ADJACENCY_ARB" value="0xD"/> + <enum name="FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB" value="0x8DA8"/> + <enum name="FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB" value="0x8DA9"/> + <enum name="FRAMEBUFFER_ATTACHMENT_LAYERED_ARB" value="0x8DA7"/> + <enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER" value="0x8CD4"/> + <enum name="PROGRAM_POINT_SIZE_ARB" value="0x8642"/> + <function name="ProgramParameteriARB" offset="assign"> + <param name="program" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="value" type="GLint"/> + </function> + <function name="FramebufferTextureARB" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + </function> + <function name="FramebufferTextureLayerARB" alias="FramebufferTextureLayer"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + <param name="layer" type="GLint"/> + </function> + <function name="FramebufferTextureFaceARB" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + <param name="face" type="GLenum"/> + </function> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml b/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml index 3cdc84d2b..8dc827c5a 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml @@ -3,7 +3,7 @@ <OpenGLAPI> -<category name="GL_ARB_seamless_cubemap" number="65"> +<category name="GL_ARB_seamless_cube_map" number="65"> <enum name="TEXTURE_CUBE_MAP_SEAMLESS" count="1" value="0x88F4"> <size name="Get" mode="get"/> </enum> diff --git a/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml b/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml new file mode 100644 index 000000000..06deafce4 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml @@ -0,0 +1,163 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + + +<OpenGLAPI> + +<category name="GL_EXT_transform_feedback" number="352"> + + <enum name="TRANSFORM_FEEDBACK_BUFFER_EXT" value="0x8C8E"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_START_EXT" value="0x8C84"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT" value="0x8C85"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT" value="0x8C8F"/> + <enum name="INTERLEAVED_ATTRIBS_EXT" value="0x8C8C"/> + <enum name="SEPARATE_ATTRIBS_EXT" value="0x8C8D"/> + <enum name="PRIMITIVES_GENERATED_EXT" value="0x8C87"/> + <enum name="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT" value="0x8C88"/> + <enum name="RASTERIZER_DISCARD_EXT" value="0x8C89"/> + <enum name="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT" value="0x8C8A"/> + <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT" value="0x8C8B"/> + <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT" value="0x8C80"/> + <enum name="TRANSFORM_FEEDBACK_VARYINGS_EXT" value="0x8C83"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_MODE_EXT" value="0x8C7F"/> + <enum name="TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT" value="0x8C76"/> + + <function name="BindBufferRangeEXT" offset="assign"> + <param name="target" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="buffer" type="GLuint"/> + <param name="offset" type="GLintptr"/> + <param name="size" type="GLsizeiptr"/> + </function> + + <function name="BindBufferOffsetEXT" offset="assign"> + <param name="target" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="buffer" type="GLuint"/> + <param name="offset" type="GLintptr"/> + </function> + + <function name="BindBufferBaseEXT" offset="assign"> + <param name="target" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="buffer" type="GLuint"/> + </function> + + <function name="BeginTransformFeedbackEXT" offset="assign"> + <param name="mode" type="GLenum"/> + </function> + + <function name="EndTransformFeedbackEXT" offset="assign"> + </function> + + <function name="TransformFeedbackVaryingsEXT" offset="assign"> + <param name="program" type="GLuint"/> + <param name="count" type="GLsizei"/> + <param name="varyings" type="const char **"/> + <param name="bufferMode" type="GLenum"/> + </function> + + <function name="GetTransformFeedbackVaryingEXT" offset="assign"> + <param name="program" type="GLuint"/> + <param name="index" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="size" type="GLsizei *"/> + <param name="type" type="GLenum *"/> + <param name="name" type="GLchar *"/> + </function> + + <!-- Note: the glGetIntegerIndexedvEXT() and glGetBooleanIndexedvEXT + functions are defined in the EXT_draw_buffers2.xml file --> + +</category> + + +<!-- Note: these 3.0 entrypoints might get moved to a new file --> + +<category name="3.0"> + + <function name="BindBufferRange" alias="BindBufferRangeEXT"> + <param name="target" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="buffer" type="GLuint"/> + <param name="offset" type="GLintptr"/> + <param name="size" type="GLsizeiptr"/> + </function> + + <function name="BindBufferBase" alias="BindBufferBaseEXT"> + <param name="target" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="buffer" type="GLuint"/> + </function> + + <function name="BeginTransformFeedback" alias="BeginTransformFeedbackEXT"> + <param name="mode" type="GLenum"/> + </function> + + <function name="EndTransformFeedback" alias="EndTransformFeedbackEXT"> + </function> + + <function name="TransformFeedbackVaryings" alias="TransformFeedbackVaryingsEXT"> + <param name="program" type="GLuint"/> + <param name="count" type="GLsizei"/> + <param name="varyings" type="const char **"/> + <param name="bufferMode" type="GLenum"/> + </function> + + <function name="GetTransformFeedbackVarying" alias="GetTransformFeedbackVaryingEXT"> + <param name="program" type="GLuint"/> + <param name="index" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="size" type="GLsizei *"/> + <param name="type" type="GLenum *"/> + <param name="name" type="GLchar *"/> + </function> + +</category> + + +<category name="GL_ARB_transform_feedback2" number="93"> + + <enum name="TRANSFORM_FEEDBACK" value="0x8E22"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_PAUSED" value="0x8E23"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_ACTIVE" value="0x8E24"/> + <enum name="TRANSFORM_FEEDBACK_BINDING" value="0x8E25"/> + + <function name="BindTransformFeedback" offset="assign"> + <param name="target" type="GLenum"/> + <param name="id" type="GLuint"/> + </function> + + <function name="DeleteTransformFeedbacks" offset="assign"> + <param name="n" type="GLsizei"/> + <param name="ids" type="const GLuint *"/> + </function> + + <function name="GenTransformFeedbacks" offset="assign"> + <param name="n" type="GLsizei"/> + <param name="ids" type="GLuint *"/> + </function> + + <function name="IsTransformFeedback" offset="assign"> + <param name="id" type="GLuint"/> + <return type="GLboolean"/> + </function> + + <function name="PauseTransformFeedback" offset="assign"> + </function> + + <function name="ResumeTransformFeedback" offset="assign"> + </function> + + <function name="DrawTransformFeedback" offset="assign"> + <param name="mode" type="GLenum"/> + <param name="id" type="GLuint"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/GL3.xml b/mesalib/src/mapi/glapi/gen/GL3.xml new file mode 100644 index 000000000..0d8d935f0 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/GL3.xml @@ -0,0 +1,581 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + + +<OpenGLAPI> + +<category name="3.0"> + + <enum name="COMPARE_REF_TO_TEXTURE" value="0x884E"/> + <enum name="CLIP_DISTANCE0" value="0x3000"/> + <enum name="CLIP_DISTANCE1" value="0x3001"/> + <enum name="CLIP_DISTANCE2" value="0x3002"/> + <enum name="CLIP_DISTANCE3" value="0x3003"/> + <enum name="CLIP_DISTANCE4" value="0x3004"/> + <enum name="CLIP_DISTANCE5" value="0x3005"/> + <enum name="CLIP_DISTANCE6" value="0x3006"/> + <enum name="CLIP_DISTANCE7" value="0x3007"/> + <enum name="MAX_CLIP_DISTANCES" value="0x0D32"/> + <enum name="MAJOR_VERSION" value="0x821B"/> + <enum name="MINOR_VERSION" value="0x821C"/> + <enum name="NUM_EXTENSIONS" value="0x821D"/> + <enum name="CONTEXT_FLAGS" value="0x821E"/> + <enum name="DEPTH_BUFFER" value="0x8223"/> + <enum name="STENCIL_BUFFER" value="0x8224"/> + <enum name="COMPRESSED_RED" value="0x8225"/> + <enum name="COMPRESSED_RG" value="0x8226"/> + <enum name="CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT" value="0x0001"/> + <enum name="RGBA32F" value="0x8814"/> + <enum name="RGB32F" value="0x8815"/> + <enum name="RGBA16F" value="0x881A"/> + <enum name="RGB16F" value="0x881B"/> + <enum name="VERTEX_ATTRIB_ARRAY_INTEGER" value="0x88FD"/> + <enum name="MAX_ARRAY_TEXTURE_LAYERS" value="0x88FF"/> + <enum name="MIN_PROGRAM_TEXEL_OFFSET" value="0x8904"/> + <enum name="MAX_PROGRAM_TEXEL_OFFSET" value="0x8905"/> + <enum name="CLAMP_READ_COLOR" value="0x891C"/> + <enum name="FIXED_ONLY" value="0x891D"/> + <enum name="MAX_VARYING_COMPONENTS" value="0x8B4B"/> + <enum name="TEXTURE_1D_ARRAY" value="0x8C18"/> + <enum name="PROXY_TEXTURE_1D_ARRAY" value="0x8C19"/> + <enum name="TEXTURE_2D_ARRAY" value="0x8C1A"/> + <enum name="PROXY_TEXTURE_2D_ARRAY" value="0x8C1B"/> + <enum name="TEXTURE_BINDING_1D_ARRAY" value="0x8C1C"/> + <enum name="TEXTURE_BINDING_2D_ARRAY" value="0x8C1D"/> + <enum name="R11F_G11F_B10F" value="0x8C3A"/> + <enum name="UNSIGNED_INT_10F_11F_11F_REV" value="0x8C3B"/> + <enum name="RGB9_E5" value="0x8C3D"/> + <enum name="UNSIGNED_INT_5_9_9_9_REV" value="0x8C3E"/> + <enum name="TEXTURE_SHARED_SIZE" value="0x8C3F"/> + <enum name="TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH" value="0x8C76"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_MODE" value="0x8C7F"/> + <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS" value="0x8C80"/> + <enum name="TRANSFORM_FEEDBACK_VARYINGS" value="0x8C83"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_START" value="0x8C84"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_SIZE" value="0x8C85"/> + <enum name="PRIMITIVES_GENERATED" value="0x8C87"/> + <enum name="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN" value="0x8C88"/> + <enum name="RASTERIZER_DISCARD" value="0x8C89"/> + <enum name="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS" value="0x8C8A"/> + <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS" value="0x8C8B"/> + <enum name="INTERLEAVED_ATTRIBS" value="0x8C8C"/> + <enum name="SEPARATE_ATTRIBS" value="0x8C8D"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER" value="0x8C8E"/> + <enum name="TRANSFORM_FEEDBACK_BUFFER_BINDING" value="0x8C8F"/> + <enum name="RGBA32UI" value="0x8D70"/> + <enum name="RGB32UI" value="0x8D71"/> + <enum name="RGBA16UI" value="0x8D76"/> + <enum name="RGB16UI" value="0x8D77"/> + <enum name="RGBA8UI" value="0x8D7C"/> + <enum name="RGB8UI" value="0x8D7D"/> + <enum name="RGBA32I" value="0x8D82"/> + <enum name="RGB32I" value="0x8D83"/> + <enum name="RGBA16I" value="0x8D88"/> + <enum name="RGB16I" value="0x8D89"/> + <enum name="RGBA8I" value="0x8D8E"/> + <enum name="RGB8I" value="0x8D8F"/> + <enum name="RED_INTEGER" value="0x8D94"/> + <enum name="GREEN_INTEGER" value="0x8D95"/> + <enum name="BLUE_INTEGER" value="0x8D96"/> + <enum name="RGB_INTEGER" value="0x8D98"/> + <enum name="RGBA_INTEGER" value="0x8D99"/> + <enum name="BGR_INTEGER" value="0x8D9A"/> + <enum name="BGRA_INTEGER" value="0x8D9B"/> + <enum name="SAMPLER_1D_ARRAY" value="0x8DC0"/> + <enum name="SAMPLER_2D_ARRAY" value="0x8DC1"/> + <enum name="SAMPLER_1D_ARRAY_SHADOW" value="0x8DC3"/> + <enum name="SAMPLER_2D_ARRAY_SHADOW" value="0x8DC4"/> + <enum name="SAMPLER_CUBE_SHADOW" value="0x8DC5"/> + <enum name="UNSIGNED_INT_VEC2" value="0x8DC6"/> + <enum name="UNSIGNED_INT_VEC3" value="0x8DC7"/> + <enum name="UNSIGNED_INT_VEC4" value="0x8DC8"/> + <enum name="INT_SAMPLER_1D" value="0x8DC9"/> + <enum name="INT_SAMPLER_2D" value="0x8DCA"/> + <enum name="INT_SAMPLER_3D" value="0x8DCB"/> + <enum name="INT_SAMPLER_CUBE" value="0x8DCC"/> + <enum name="INT_SAMPLER_1D_ARRAY" value="0x8DCE"/> + <enum name="INT_SAMPLER_2D_ARRAY" value="0x8DCF"/> + <enum name="UNSIGNED_INT_SAMPLER_1D" value="0x8DD1"/> + <enum name="UNSIGNED_INT_SAMPLER_2D" value="0x8DD2"/> + <enum name="UNSIGNED_INT_SAMPLER_3D" value="0x8DD3"/> + <enum name="UNSIGNED_INT_SAMPLER_CUBE" value="0x8DD4"/> + <enum name="UNSIGNED_INT_SAMPLER_1D_ARRAY" value="0x8DD6"/> + <enum name="UNSIGNED_INT_SAMPLER_2D_ARRAY" value="0x8DD7"/> + <enum name="QUERY_WAIT" value="0x8E13"/> + <enum name="QUERY_NO_WAIT" value="0x8E14"/> + <enum name="QUERY_BY_REGION_WAIT" value="0x8E15"/> + <enum name="QUERY_BY_REGION_NO_WAIT" value="0x8E16"/> + <enum name="BUFFER_ACCESS_FLAGS" value="0x911F"/> + <enum name="BUFFER_MAP_LENGTH" value="0x9120"/> + <enum name="BUFFER_MAP_OFFSET" value="0x9121"/> + + <function name="ClearBufferiv" offset="assign"> + <param name="buffer" type="GLenum"/> + <param name="drawbuffer" type="GLint"/> + <param name="value" type="const GLint *"/> + </function> + + <function name="ClearBufferuiv" offset="assign"> + <param name="buffer" type="GLenum"/> + <param name="drawbuffer" type="GLint"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="ClearBufferfv" offset="assign"> + <param name="buffer" type="GLenum"/> + <param name="drawbuffer" type="GLint"/> + <param name="value" type="const GLfloat *"/> + </function> + + <function name="ClearBufferfi" offset="assign"> + <param name="buffer" type="GLenum"/> + <param name="drawbuffer" type="GLint"/> + <param name="depth" type="const GLfloat"/> + <param name="stencil" type="const GLint"/> + </function> + + <function name="GetStringi" offset="assign"> + <param name="name" type="GLenum"/> + <param name="index" type="GLuint"/> + <return type="const GLubyte *"/> + </function> + + <function name="IsEnabledi" offset="assign"> + <param name="cap" type="GLenum"/> + <param name="index" type="GLuint"/> + <return type="GLboolean"/> + </function> + + <function name="GetFragDataLocation" offset="assign"> + <param name="program" type="GLuint"/> + <param name="name" type="const GLchar *"/> + <return type="GLint"/> + </function> + + <function name="BindFragDataLocation" offset="assign"> + <param name="program" type="GLuint"/> + <param name="color" type="GLuint"/> + <param name="name" type="const GLchar *"/> + </function> + + <function name="ColorMaski" offset="assign"> + <param name="index" type="GLuint"/> + <param name="r" type="GLboolean"/> + <param name="g" type="GLboolean"/> + <param name="b" type="GLboolean"/> + <param name="a" type="GLboolean"/> + </function> + + <function name="GetBooleani_v" offset="assign"> + <param name="cap" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="value" type="GLboolean *"/> + </function> + + <function name="GetIntegeri_v" offset="assign"> + <param name="cap" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="value" type="GLint *"/> + </function> + + <function name="Enablei" offset="assign"> + <param name="cap" type="GLenum"/> + <param name="index" type="GLuint"/> + </function> + + <function name="Disablei" offset="assign"> + <param name="cap" type="GLenum"/> + <param name="index" type="GLuint"/> + </function> + + <function name="BeginTransformFeedback" offset="assign"> + <param name="mode" type="GLenum"/> + </function> + + <function name="EndTransformFeedback" offset="assign"> + </function> + + <function name="BindBufferRange" offset="assign"> + <param name="target" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="buffer" type="GLuint"/> + <param name="offset" type="GLintptr"/> + <param name="size" type="GLsizeiptr"/> + </function> + + <function name="BindBufferBase" offset="assign"> + <param name="target" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="buffer" type="GLuint"/> + </function> + + <function name="TransformFeedbackVaryings" offset="assign"> + <param name="program" type="GLuint"/> + <param name="count" type="GLsizei"/> + <param name="varyings" type="const GLchar* *"/> + <param name="bufferMode" type="GLenum"/> + </function> + + <function name="GetTransformFeedbackVarying" offset="assign"> + <param name="program" type="GLuint"/> + <param name="index" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="size" type="GLsizei *"/> + <param name="type" type="GLenum *"/> + <param name="name" type="GLchar *"/> + </function> + + <function name="ClampColor" offset="assign"> + <param name="target" type="GLenum"/> + <param name="clamp" type="GLenum"/> + </function> + + <function name="BeginConditionalRender" offset="assign"> + <param name="id" type="GLuint"/> + <param name="mode" type="GLenum"/> + </function> + + <function name="EndConditionalRender" offset="assign"> + </function> + + <function name="VertexAttribIPointer" offset="assign"> + <param name="index" type="GLuint"/> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </function> + + <function name="GetVertexAttribIiv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint *"/> + </function> + + <function name="GetVertexAttribIuiv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLuint *"/> + </function> + + <function name="VertexAttribI1i" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLint"/> + </function> + + <function name="VertexAttribI2i" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + </function> + + <function name="VertexAttribI3i" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + </function> + + <function name="VertexAttribI4i" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="z" type="GLint"/> + <param name="w" type="GLint"/> + </function> + + <function name="VertexAttribI1ui" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLuint"/> + </function> + + <function name="VertexAttribI2ui" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + </function> + + <function name="VertexAttribI3ui" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + <param name="z" type="GLuint"/> + </function> + + <function name="VertexAttribI4ui" offset="assign"> + <param name="index" type="GLuint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + <param name="z" type="GLuint"/> + <param name="w" type="GLuint"/> + </function> + + <function name="VertexAttribI1iv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLint *"/> + </function> + + <function name="VertexAttribI2iv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLint *"/> + </function> + + <function name="VertexAttribI3iv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLint *"/> + </function> + + <function name="VertexAttribI4iv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLint *"/> + </function> + + <function name="VertexAttribI1uiv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLuint *"/> + </function> + + <function name="VertexAttribI2uiv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLuint *"/> + </function> + + <function name="VertexAttribI3uiv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLuint *"/> + </function> + + <function name="VertexAttribI4uiv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLuint *"/> + </function> + + <function name="VertexAttribI4bv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLbyte *"/> + </function> + + <function name="VertexAttribI4sv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLshort *"/> + </function> + + <function name="VertexAttribI4ubv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLubyte *"/> + </function> + + <function name="VertexAttribI4usv" offset="assign"> + <param name="index" type="GLuint"/> + <param name="v" type="const GLushort *"/> + </function> + + <function name="GetUniformuiv" offset="assign"> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <param name="params" type="GLuint *"/> + </function> + + <function name="Uniform1ui" offset="assign"> + <param name="locatoin" type="GLint"/> + <param name="x" type="GLuint"/> + </function> + + <function name="Uniform2ui" offset="assign"> + <param name="location" type="GLint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + </function> + + <function name="Uniform3ui" offset="assign"> + <param name="location" type="GLint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + <param name="z" type="GLuint"/> + </function> + + <function name="Uniform4ui" offset="assign"> + <param name="location" type="GLint"/> + <param name="x" type="GLuint"/> + <param name="y" type="GLuint"/> + <param name="z" type="GLuint"/> + <param name="w" type="GLuint"/> + </function> + + <function name="Uniform1uiv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="Uniform2uiv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="Uniform3uiv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="Uniform4uiv" offset="assign"> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="TexParameterIiv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="value" type="const GLint *"/> + </function> + + <function name="TexParameterIuiv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="value" type="const GLuint *"/> + </function> + + <function name="GetTexParameterIiv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="value" type="GLint *"/> + </function> + + <function name="GetTexParameterIuiv" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="value" type="GLuint *"/> + </function> + +</category> + + +<category name="3.1"> + + <enum name="SAMPLER_2D_RECT" value="0x8B63"/> + <enum name="SAMPLER_2D_RECT_SHADOW" value="0x8B64"/> + <enum name="SAMPLER_BUFFER" value="0x8DC2"/> + <enum name="INT_SAMPLER_2D_RECT" value="0x8DCD"/> + <enum name="INT_SAMPLER_BUFFER" value="0x8DD0"/> + <enum name="UNSIGNED_INT_SAMPLER_2D_RECT" value="0x8DD5"/> + <enum name="UNSIGNED_INT_SAMPLER_BUFFER" value="0x8DD8"/> + <enum name="TEXTURE_BUFFER" value="0x8C2A"/> + <enum name="MAX_TEXTURE_BUFFER_SIZE" value="0x8C2B"/> + <enum name="TEXTURE_BINDING_BUFFER" value="0x8C2C"/> + <enum name="TEXTURE_BUFFER_DATA_STORE_BINDING" value="0x8C2D"/> + <enum name="TEXTURE_BUFFER_FORMAT" value="0x8C2E"/> + <enum name="TEXTURE_RECTANGLE" value="0x84F5"/> + <enum name="TEXTURE_BINDING_RECTANGLE" value="0x84F6"/> + <enum name="PROXY_TEXTURE_RECTANGLE" value="0x84F7"/> + <enum name="MAX_RECTANGLE_TEXTURE_SIZE" value="0x84F8"/> + <enum name="RED_SNORM" value="0x8F90"/> + <enum name="RG_SNORM" value="0x8F91"/> + <enum name="RGB_SNORM" value="0x8F92"/> + <enum name="RGBA_SNORM" value="0x8F93"/> + <enum name="R8_SNORM" value="0x8F94"/> + <enum name="RG8_SNORM" value="0x8F95"/> + <enum name="RGB8_SNORM" value="0x8F96"/> + <enum name="RGBA8_SNORM" value="0x8F97"/> + <enum name="R16_SNORM" value="0x8F98"/> + <enum name="RG16_SNORM" value="0x8F99"/> + <enum name="RGB16_SNORM" value="0x8F9A"/> + <enum name="RGBA16_SNORM" value="0x8F9B"/> + <enum name="SIGNED_NORMALIZED" value="0x8F9C"/> + <enum name="PRIMITIVE_RESTART" value="0x8F9D"/> + <enum name="PRIMITIVE_RESTART_INDEX" value="0x8F9E"/> + + <function name="DrawArraysInstanced" offset="assign"> + <param name="mode" type="GLenum"/> + <param name="first" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="primcount" type="GLsizei"/> + </function> + + <function name="DrawElementsInstanced" offset="assign"> + <param name="mode" type="GLenum"/> + <param name="count" type="GLsizei"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid *"/> + <param name="primcount" type="GLsizei"/> + </function> + + <function name="TexBuffer" offset="assign"> + <param name="target" type="GLenum"/> + <param name="internalFormat" type="GLenum"/> + <param name="buffer" type="GLuint"/> + </function> + + <function name="glPrimitiveRestartIndex" offset="assign"> + <param name="index" type="GLuint"/> + </function> + +</category> + + +<category name="3.2"> + + <enum name="CONTEXT_CORE_PROFILE_BIT" value="0x00000001"/> + <enum name="CONTEXT_COMPATIBILITY_PROFILE_BIT" value="0x00000002"/> + <enum name="LINES_ADJACENCY" value="0x000A"/> + <enum name="LINE_STRIP_ADJACENCY" value="0x000B"/> + <enum name="TRIANGLES_ADJACENCY" value="0x000C"/> + <enum name="TRIANGLE_STRIP_ADJACENCY" value="0x000D"/> + <enum name="PROGRAM_POINT_SIZE" value="0x8642"/> + <enum name="MAX_GEOMETRY_TEXTURE_IMAGE_UNITS" value="0x8C29"/> + <enum name="FRAMEBUFFER_ATTACHMENT_LAYERED" value="0x8DA7"/> + <enum name="FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS" value="0x8DA8"/> + <enum name="GEOMETRY_SHADER" value="0x8DD9"/> + <enum name="GEOMETRY_VERTICES_OUT" value="0x8916"/> + <enum name="GEOMETRY_INPUT_TYPE" value="0x8917"/> + <enum name="GEOMETRY_OUTPUT_TYPE" value="0x8918"/> + <enum name="MAX_GEOMETRY_UNIFORM_COMPONENTS" value="0x8DDF"/> + <enum name="MAX_GEOMETRY_OUTPUT_VERTICES" value="0x8DE0"/> + <enum name="MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS" value="0x8DE1"/> + <enum name="MAX_VERTEX_OUTPUT_COMPONENTS" value="0x9122"/> + <enum name="MAX_GEOMETRY_INPUT_COMPONENTS" value="0x9123"/> + <enum name="MAX_GEOMETRY_OUTPUT_COMPONENTS" value="0x9124"/> + <enum name="MAX_FRAGMENT_INPUT_COMPONENTS" value="0x9125"/> + <enum name="CONTEXT_PROFILE_MASK" value="0x9126"/> + + <function name="GetInteger64i_v" offset="assign"> + <param name="cap" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="data" type="GLint64 *"/> + </function> + + <function name="GetBufferParameteri64v" offset="assign"> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <param name="params" type="GLint64 *"/> + </function> + + <function name="ProgramParameteri" offset="assign"> + <param name="program" type="GLuint"/> + <param name="pname" type="GLenum"/> + <param name="value" type="GLint"/> + </function> + + <function name="FramebufferTexture" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + </function> + + <function name="FramebufferTextureFace" offset="assign"> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + <param name="face" type="GLenum"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/Makefile b/mesalib/src/mapi/glapi/gen/Makefile new file mode 100644 index 000000000..41640b3b0 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/Makefile @@ -0,0 +1,208 @@ +# This file isn't used during a normal compilation since we don't want to +# require Python in order to compile Mesa. +# Instead, when the Mesa developers update/change the API interface it's +# up to him/her to re-run this makefile and check in the newly generated files. + + +TOP = ../../../.. +include $(TOP)/configs/current + +MESA_DIR = $(TOP)/src/mesa +MESA_GLAPI_DIR = $(TOP)/src/mapi/glapi +MESA_GLX_DIR = $(TOP)/src/glx + +MESA_GLAPI_OUTPUTS = \ + $(MESA_GLAPI_DIR)/glprocs.h \ + $(MESA_GLAPI_DIR)/glapitemp.h \ + $(MESA_GLAPI_DIR)/glapioffsets.h \ + $(MESA_GLAPI_DIR)/glapitable.h \ + $(MESA_GLAPI_DIR)/glapidispatch.h + +MESA_GLAPI_ASM_OUTPUTS = \ + $(MESA_GLAPI_DIR)/glapi_x86.S \ + $(MESA_GLAPI_DIR)/glapi_x86-64.S \ + $(MESA_GLAPI_DIR)/glapi_sparc.S + +MESA_OUTPUTS = \ + $(MESA_GLAPI_OUTPUTS) \ + $(MESA_GLAPI_ASM_OUTPUTS) \ + $(MESA_DIR)/main/enums.c \ + $(MESA_DIR)/main/remap_helper.h \ + $(MESA_GLX_DIR)/indirect.c \ + $(MESA_GLX_DIR)/indirect.h \ + $(MESA_GLX_DIR)/indirect_init.c \ + $(MESA_GLX_DIR)/indirect_size.h \ + $(MESA_GLX_DIR)/indirect_size.c + +###################################################################### + +XORG_GLX_DIR = $(XORG_BASE)/glx +XORG_GLAPI_DIR = $(XORG_BASE)/glx + +XORG_GLAPI_FILES = \ + $(XORG_GLAPI_DIR)/glapi.h \ + $(XORG_GLAPI_DIR)/glapi.c \ + $(XORG_GLAPI_DIR)/glapi_getproc.c \ + $(XORG_GLAPI_DIR)/glapi_nop.c \ + $(XORG_GLAPI_DIR)/glthread.c \ + $(XORG_GLAPI_DIR)/glthread.h + +XORG_GLAPI_OUTPUTS = \ + $(XORG_GLAPI_DIR)/glprocs.h \ + $(XORG_GLAPI_DIR)/glapitemp.h \ + $(XORG_GLAPI_DIR)/glapioffsets.h \ + $(XORG_GLAPI_DIR)/glapitable.h \ + $(XORG_GLAPI_DIR)/glapidispatch.h + +XORG_OUTPUTS = \ + $(XORG_GLAPI_FILES) \ + $(XORG_GLAPI_OUTPUTS) \ + $(XORG_GLX_DIR)/indirect_dispatch.c \ + $(XORG_GLX_DIR)/indirect_dispatch_swap.c \ + $(XORG_GLX_DIR)/indirect_dispatch.h \ + $(XORG_GLX_DIR)/indirect_reqsize.c \ + $(XORG_GLX_DIR)/indirect_reqsize.h \ + $(XORG_GLX_DIR)/indirect_size.h \ + $(XORG_GLX_DIR)/indirect_size_get.c \ + $(XORG_GLX_DIR)/indirect_size_get.h \ + $(XORG_GLX_DIR)/indirect_table.c + +###################################################################### + +API_XML = \ + gl_API.xml \ + ARB_copy_buffer.xml \ + ARB_depth_clamp.xml \ + ARB_draw_elements_base_vertex.xml \ + ARB_draw_instanced.xml \ + ARB_framebuffer_object.xml \ + ARB_geometry_shader4.xml \ + ARB_map_buffer_range.xml \ + ARB_seamless_cube_map.xml \ + ARB_sync.xml \ + ARB_vertex_array_object.xml \ + APPLE_object_purgeable.xml \ + APPLE_vertex_array_object.xml \ + EXT_draw_buffers2.xml \ + EXT_framebuffer_object.xml \ + EXT_packed_depth_stencil.xml \ + EXT_provoking_vertex.xml \ + EXT_texture_array.xml \ + EXT_transform_feedback.xml \ + NV_conditional_render.xml \ + OES_EGL_image.xml + +COMMON = $(API_XML) gl_XML.py glX_XML.py license.py typeexpr.py + +COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py + +###################################################################### + +all: mesa xorg + +mesa: $(MESA_OUTPUTS) + +xorg: check-xorg-source $(XORG_OUTPUTS) + +check-xorg-source: + @if ! test -d $(XORG_GLX_DIR); then \ + echo "ERROR: Must specify path to xserver/GL/ checkout; set XORG_BASE env var."; \ + exit 1; \ + fi + +clean: + -rm -f *~ *.pyo + -rm -f $(MESA_OUTPUTS) + +###################################################################### + +$(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c + cp $< $@ + +$(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h + cp $< $@ + +###################################################################### + +$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapioffsets.h: gl_offsets.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapitable.h: gl_table.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapidispatch.h: gl_table.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@ + +###################################################################### + +$(MESA_GLAPI_DIR)/glapi_x86.S: gl_x86_asm.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +$(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +###################################################################### + +$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON) $(ES_API) + $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_API.xml \ + -f $(MESA_GLAPI_DIR)/gen-es/es1_API.xml \ + -f $(MESA_GLAPI_DIR)/gen-es/es2_API.xml > $@ + +$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + +###################################################################### + +$(MESA_GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@ + +$(MESA_GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m init_h > $@ + +$(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m init_c > $@ + +$(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-set -h _INDIRECT_SIZE_H_ \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +$(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c --only-set \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +###################################################################### + +$(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c > $@ + +$(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c -s > $@ + +$(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_h -f gl_and_glX_API.xml -s > $@ + +$(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ + | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_h --only-get -h '_INDIRECT_SIZE_GET_H_' \ + | $(INDENT) $(INDENT_FLAGS) -l200 > $@ + +$(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_c | $(INDENT) $(INDENT_FLAGS) > $@ + +$(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX) + $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_and_glX_API.xml > $@ diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_recv.py b/mesalib/src/mapi/glapi/gen/glX_proto_recv.py index 31745fcef..887f63191 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_recv.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_recv.py @@ -384,9 +384,9 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto): print ' int error;' if self.do_swap: - print ' __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);' + print ' struct glx_context * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);' else: - print ' __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);' + print ' struct glx_context * const cx = __glXForceCurrent(cl, req->contextTag, &error);' print '' if name not in f.glx_vendorpriv_names: diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_send.py b/mesalib/src/mapi/glapi/gen/glX_proto_send.py index c52b85bfb..bd41c9e66 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_send.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_send.py @@ -220,7 +220,7 @@ __glXReadReply( Display *dpy, size_t size, void * dest, GLboolean reply_is_alway } NOINLINE void -__glXReadPixelReply( Display *dpy, __GLXcontext * gc, unsigned max_dim, +__glXReadPixelReply( Display *dpy, struct glx_context * gc, unsigned max_dim, GLint width, GLint height, GLint depth, GLenum format, GLenum type, void * dest, GLboolean dimensions_in_reply ) { @@ -264,7 +264,7 @@ __glXReadPixelReply( Display *dpy, __GLXcontext * gc, unsigned max_dim, #define X_GLXSingle 0 NOINLINE FASTCALL GLubyte * -__glXSetupSingleRequest( __GLXcontext * gc, GLint sop, GLint cmdlen ) +__glXSetupSingleRequest( struct glx_context * gc, GLint sop, GLint cmdlen ) { xGLXSingleReq * req; Display * const dpy = gc->currentDpy; @@ -279,7 +279,7 @@ __glXSetupSingleRequest( __GLXcontext * gc, GLint sop, GLint cmdlen ) } NOINLINE FASTCALL GLubyte * -__glXSetupVendorRequest( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen ) +__glXSetupVendorRequest( struct glx_context * gc, GLint code, GLint vop, GLint cmdlen ) { xGLXVendorPrivateReq * req; Display * const dpy = gc->currentDpy; @@ -371,10 +371,10 @@ const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; print '#define %s %d' % (func.opcode_vendor_name(name), func.glx_vendorpriv) print '%s gl%s(%s)' % (func.return_type, func_name, func.get_parameter_string()) print '{' - print ' __GLXcontext * const gc = __glXGetCurrentContext();' + print ' struct glx_context * const gc = __glXGetCurrentContext();' print '' - print '#ifdef GLX_DIRECT_RENDERING' - print ' if (gc->driContext) {' + print '#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)' + print ' if (gc->isDirect) {' print ' %sCALL_%s(GET_DISPATCH(), (%s));' % (ret_string, func.name, func.get_called_parameter_string()) print ' } else' print '#endif' @@ -408,7 +408,7 @@ const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; print """static FASTCALL NOINLINE void generic_%u_byte( GLint rop, const void * ptr ) { - __GLXcontext * const gc = __glXGetCurrentContext(); + struct glx_context * const gc = __glXGetCurrentContext(); const GLuint cmdlen = %u; emit_header(gc->pc, rop, cmdlen); @@ -523,7 +523,7 @@ generic_%u_byte( GLint rop, const void * ptr ) def common_func_print_just_start(self, f, name): - print ' __GLXcontext * const gc = __glXGetCurrentContext();' + print ' struct glx_context * const gc = __glXGetCurrentContext();' # The only reason that single and vendor private commands need # a variable called 'dpy' is becuase they use the SyncHandle @@ -895,13 +895,13 @@ static int NoOp(void) * Create and initialize a new GL dispatch table. The table is initialized * with GLX indirect rendering protocol functions. */ -__GLapi * __glXNewIndirectAPI( void ) +struct _glapi_table * __glXNewIndirectAPI( void ) { - __GLapi *glAPI; + struct _glapi_table *glAPI; GLuint entries; entries = _glapi_get_dispatch_table_size(); - glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *)); + glAPI = (struct _glapi_table *) Xmalloc(entries * sizeof(void *)); /* first, set all entries to point to no-op functions */ { @@ -971,15 +971,15 @@ extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_array ); extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy, - __GLXcontext * gc, unsigned max_dim, GLint width, GLint height, + struct glx_context * gc, unsigned max_dim, GLint width, GLint height, GLint depth, GLenum format, GLenum type, void * dest, GLboolean dimensions_in_reply ); extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest( - __GLXcontext * gc, GLint sop, GLint cmdlen ); + struct glx_context * gc, GLint sop, GLint cmdlen ); extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest( - __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen ); + struct glx_context * gc, GLint code, GLint vop, GLint cmdlen ); """ diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_size.py b/mesalib/src/mapi/glapi/gen/glX_proto_size.py index 95cb5110c..f16ea4c3b 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_size.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_size.py @@ -329,7 +329,7 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common): self.printVisibility( "INTERNAL", "internal" ) print '' print '' - print '#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)' + print '#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(GLX_USE_APPLEGL)' print '# undef HAVE_ALIAS' print '#endif' print '#ifdef HAVE_ALIAS' diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 3e2981b91..123565458 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -4666,8 +4666,8 @@ <function name="MultiDrawArrays" alias="MultiDrawArraysEXT"> <param name="mode" type="GLenum"/> - <param name="first" type="GLint *"/> <!-- Spec bug. Should be const. --> - <param name="count" type="GLsizei *"/> <!-- Spec bug. Should be const. --> + <param name="first" type="const GLint *"/> + <param name="count" type="const GLsizei *"/> <param name="primcount" type="GLsizei"/> </function> @@ -7967,6 +7967,12 @@ <xi:include href="NV_conditional_render.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<xi:include href="EXT_transform_feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<xi:include href="ARB_draw_instanced.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + +<xi:include href="ARB_geometry_shader4.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + <!-- Non-ARB extensions sorted by extension number. --> @@ -9788,8 +9794,8 @@ <category name="GL_EXT_multi_draw_arrays" number="148"> <function name="MultiDrawArraysEXT" offset="assign"> <param name="mode" type="GLenum"/> - <param name="first" type="GLint *"/> <!-- Spec bug. Should be const. --> - <param name="count" type="GLsizei *"/> <!-- Spec bug. Should be const. --> + <param name="first" type="const GLint *"/> + <param name="count" type="const GLsizei *"/> <param name="primcount" type="GLsizei"/> <glx handcode="true"/> </function> diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py index 3a9ea3c86..0caa01030 100644 --- a/mesalib/src/mapi/glapi/gen/gl_enums.py +++ b/mesalib/src/mapi/glapi/gen/gl_enums.py @@ -105,7 +105,8 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } else { /* this is not re-entrant safe, no big deal here */ - sprintf(token_tmp, "0x%x", nr); + _mesa_snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr); + token_tmp[sizeof(token_tmp) - 1] = '\\0'; return token_tmp; } } @@ -151,8 +152,10 @@ int _mesa_lookup_enum_by_name( const char *symbol ) return - def printBody(self, api): - self.process_enums( api ) + def printBody(self, api_list): + self.enum_table = {} + for api in api_list: + self.process_enums( api ) keys = self.enum_table.keys() keys.sort() @@ -209,16 +212,20 @@ int _mesa_lookup_enum_by_name( const char *symbol ) def process_enums(self, api): - self.enum_table = {} - for obj in api.enumIterateByName(): if obj.value not in self.enum_table: self.enum_table[ obj.value ] = [] + enum = self.enum_table[ obj.value ] name = "GL_" + obj.name priority = obj.priority() - self.enum_table[ obj.value ].append( [name, priority] ) + already_in = False; + for n, p in enum: + if n == name: + already_in = True + if not already_in: + enum.append( [name, priority] ) def show_usage(): @@ -226,18 +233,16 @@ def show_usage(): sys.exit(1) if __name__ == '__main__': - file_name = "gl_API.xml" - try: (args, trail) = getopt.getopt(sys.argv[1:], "f:") except Exception,e: show_usage() + api_list = [] for (arg,val) in args: if arg == "-f": - file_name = val - - api = gl_XML.parse_GL_API( file_name ) + api = gl_XML.parse_GL_API( val ) + api_list.append(api); printer = PrintGlEnums() - printer.Print( api ) + printer.Print( api_list ) diff --git a/mesalib/src/mapi/glapi/gen/remap_helper.py b/mesalib/src/mapi/glapi/gen/remap_helper.py index 8b50526d2..69b8e5e9d 100644 --- a/mesalib/src/mapi/glapi/gen/remap_helper.py +++ b/mesalib/src/mapi/glapi/gen/remap_helper.py @@ -65,17 +65,12 @@ class PrintGlRemap(gl_XML.gl_print_base): def printRealHeader(self): print '#include "main/dispatch.h"' + print '#include "main/remap.h"' print '' return def printBody(self, api): - print 'struct gl_function_remap {' - print ' GLint func_index;' - print ' GLint dispatch_offset; /* for sanity check */' - print '};' - print '' - pool_indices = {} print '/* this is internal to remap.c */' @@ -108,10 +103,7 @@ class PrintGlRemap(gl_XML.gl_print_base): print '' print '/* these functions need to be remapped */' - print 'static const struct {' - print ' GLint pool_index;' - print ' GLint remap_index;' - print '} MESA_remap_table_functions[] = {' + print 'static const struct gl_function_pool_remap MESA_remap_table_functions[] = {' # output all functions that need to be remapped # iterate by offsets so that they are sorted by remap indices for f in api.functionIterateByOffset(): diff --git a/mesalib/src/mapi/glapi/glapi.h b/mesalib/src/mapi/glapi/glapi.h index 8603317da..b404dd617 100644 --- a/mesalib/src/mapi/glapi/glapi.h +++ b/mesalib/src/mapi/glapi/glapi.h @@ -39,20 +39,33 @@ * This module is intended to be non-Mesa-specific so it can be used * with the X/DRI libGL also. */ - - #ifndef _GLAPI_H #define _GLAPI_H -#include "glthread.h" - - -struct _glapi_table; - -typedef void (*_glapi_proc)(void); /* generic function pointer */ - +/* opengl.dll does not export _glapi_* */ +#if defined(_WIN32) +#define _GLAPI_NO_EXPORTS +#endif -#if defined(USE_MGL_NAMESPACE) +#ifdef _GLAPI_NO_EXPORTS +# define _GLAPI_EXPORT +#else /* _GLAPI_NO_EXPORTS */ +# ifdef _WIN32 +# ifdef _GLAPI_DLL_EXPORTS +# define _GLAPI_EXPORT __declspec(dllexport) +# else +# define _GLAPI_EXPORT __declspec(dllimport) +# endif +# elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define _GLAPI_EXPORT __attribute__((visibility("default"))) +# else +# define _GLAPI_EXPORT +# endif +#endif /* _GLAPI_NO_EXPORTS */ + + +/* Is this needed? It is incomplete anyway. */ +#ifdef USE_MGL_NAMESPACE #define _glapi_set_dispatch _mglapi_set_dispatch #define _glapi_get_dispatch _mglapi_get_dispatch #define _glapi_set_context _mglapi_set_context @@ -61,47 +74,36 @@ typedef void (*_glapi_proc)(void); /* generic function pointer */ #define _glapi_Context _mglapi_Context #endif +#include "glthread.h" -#if defined(__GNUC__) -# define likely(x) __builtin_expect(!!(x), 1) -# define unlikely(x) __builtin_expect(!!(x), 0) -#else -# define likely(x) (x) -# define unlikely(x) (x) -#endif +typedef void (*_glapi_proc)(void); +struct _glapi_table; -/** - ** Define the GET_DISPATCH() and GET_CURRENT_CONTEXT() macros. - ** - ** \param C local variable which will hold the current context. - **/ #if defined (GLX_USE_TLS) -extern const struct _glapi_table *_glapi_Dispatch; - -extern const void *_glapi_Context; - -extern __thread struct _glapi_table * _glapi_tls_Dispatch +_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch __attribute__((tls_model("initial-exec"))); -extern __thread void * _glapi_tls_Context +_GLAPI_EXPORT extern __thread void * _glapi_tls_Context __attribute__((tls_model("initial-exec"))); -# define GET_DISPATCH() _glapi_tls_Dispatch +_GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch; +_GLAPI_EXPORT extern const void *_glapi_Context; +# define GET_DISPATCH() _glapi_tls_Dispatch # define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context #else #ifdef INSERVER -#define EXTERN _declspec(dllimport) +#define SERVEXTERN _declspec(dllimport) #else -#define EXTERN _declspec(dllexport) +#define SERVEXTERN _declspec(dllexport) #endif -EXTERN struct _glapi_table *_glapi_Dispatch; -EXTERN void *_glapi_Context; +SERVEXTERN struct _glapi_table *_glapi_Dispatch; +SERVEXTERN void *_glapi_Context; # ifdef THREADS @@ -114,7 +116,6 @@ EXTERN void *_glapi_Context; # else # define GET_DISPATCH() _glapi_Dispatch - # define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context # endif @@ -122,77 +123,63 @@ EXTERN void *_glapi_Context; #endif /* defined (GLX_USE_TLS) */ -/** - ** GL API public functions - **/ - -extern void -_glapi_init_multithread(void); - - -extern void +void _glapi_destroy_multithread(void); -EXTERN void +SERVEXTERN void _glapi_check_multithread(void); -extern void +SERVEXTERN void _glapi_set_context(void *context); -extern void * +SERVEXTERN void * _glapi_get_context(void); -extern void +SERVEXTERN void _glapi_set_dispatch(struct _glapi_table *dispatch); -extern struct _glapi_table * +SERVEXTERN struct _glapi_table * _glapi_get_dispatch(void); -extern unsigned int +SERVEXTERN unsigned int _glapi_get_dispatch_table_size(void); -EXTERN int +SERVEXTERN int _glapi_add_dispatch( const char * const * function_names, const char * parameter_signature ); -extern int +_GLAPI_EXPORT int _glapi_get_proc_offset(const char *funcName); -extern _glapi_proc +_GLAPI_EXPORT _glapi_proc _glapi_get_proc_address(const char *funcName); -/** - * GL API local functions and defines - */ - -extern void -init_glapi_relocs_once(void); - -extern void -_glapi_check_table_not_null(const struct _glapi_table *table); - - -extern void -_glapi_check_table(const struct _glapi_table *table); +_GLAPI_EXPORT const char * +_glapi_get_proc_name(unsigned int offset); -extern const char * -_glapi_get_proc_name(unsigned int offset); +_GLAPI_EXPORT unsigned long +_glthread_GetID(void); /* - * Number of extension functions which we can dynamically add at runtime. + * These stubs are kept so that the old DRI drivers still load. */ -#define MAX_EXTENSION_FUNCS 300 +SERVEXTERN void +_glapi_noop_enable_warnings(unsigned char enable); -#endif +_GLAPI_EXPORT void +_glapi_set_warning_func(_glapi_proc func); + + +#endif /* _GLAPI_H */ diff --git a/mesalib/src/mapi/glapi/glapi_dispatch.c b/mesalib/src/mapi/glapi/glapi_dispatch.c index 32b9535e3..7421a36d3 100644 --- a/mesalib/src/mapi/glapi/glapi_dispatch.c +++ b/mesalib/src/mapi/glapi/glapi_dispatch.c @@ -27,8 +27,8 @@ * \file glapi_dispatch.c * * This file generates all the gl* function entrypoints. This code is not - * used if optimized assembly stubs are available (e.g., using x86/glapi_x86.S - * on IA32 or sparc/glapi_sparc.S on SPARC). + * used if optimized assembly stubs are available (e.g., using + * glapi/glapi_x86.S on IA32 or glapi/glapi_sparc.S on SPARC). * * \note * This file is also used to build the client-side libGL that loads DRI-based @@ -37,18 +37,9 @@ * \author Brian Paul <brian@precisioninsight.com> */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" +#include "glapi/glapi_priv.h" #include "glapi/glapitable.h" #include "glapi/glapidispatch.h" -#include "glapi/glthread.h" #if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) diff --git a/mesalib/src/mapi/glapi/glapi_entrypoint.c b/mesalib/src/mapi/glapi/glapi_entrypoint.c new file mode 100644 index 000000000..993ccb94c --- /dev/null +++ b/mesalib/src/mapi/glapi/glapi_entrypoint.c @@ -0,0 +1,344 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file glapi_entrypoint.c + * + * Arch-specific code for manipulating GL API entrypoints (dispatch stubs). + */ + + +#include "glapi/glapi_priv.h" +#include "mapi/u_execmem.h" + + +#ifdef USE_X86_ASM + +#if defined( GLX_USE_TLS ) +extern GLubyte gl_dispatch_functions_start[]; +extern GLubyte gl_dispatch_functions_end[]; +#else +extern const GLubyte gl_dispatch_functions_start[]; +#endif + +#endif /* USE_X86_ASM */ + + +#if defined(DISPATCH_FUNCTION_SIZE) + +_glapi_proc +get_entrypoint_address(unsigned int functionOffset) +{ + return (_glapi_proc) (gl_dispatch_functions_start + + (DISPATCH_FUNCTION_SIZE * functionOffset)); +} + +#endif + + +#if defined(USE_X86_ASM) + +/** + * Perform platform-specific GL API entry-point fixups. + */ +static void +init_glapi_relocs( void ) +{ +#if defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT) + extern unsigned long _x86_get_dispatch(void); + char run_time_patch[] = { + 0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */ + }; + GLuint *offset = (GLuint *) &run_time_patch[2]; /* 32-bits for x86/32 */ + const GLubyte * const get_disp = (const GLubyte *) run_time_patch; + GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start; + + *offset = _x86_get_dispatch(); + while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) { + (void) memcpy( curr_func, get_disp, sizeof(run_time_patch)); + curr_func += DISPATCH_FUNCTION_SIZE; + } +#endif +} + + +/** + * Generate a dispatch function (entrypoint) which jumps through + * the given slot number (offset) in the current dispatch table. + * We need assembly language in order to accomplish this. + */ +_glapi_proc +generate_entrypoint(unsigned int functionOffset) +{ + /* 32 is chosen as something of a magic offset. For x86, the dispatch + * at offset 32 is the first one where the offset in the + * "jmp OFFSET*4(%eax)" can't be encoded in a single byte. + */ + const GLubyte * const template_func = gl_dispatch_functions_start + + (DISPATCH_FUNCTION_SIZE * 32); + GLubyte * const code = (GLubyte *) u_execmem_alloc(DISPATCH_FUNCTION_SIZE); + + + if ( code != NULL ) { + (void) memcpy(code, template_func, DISPATCH_FUNCTION_SIZE); + fill_in_entrypoint_offset( (_glapi_proc) code, functionOffset ); + } + + return (_glapi_proc) code; +} + + +/** + * This function inserts a new dispatch offset into the assembly language + * stub that was generated with the preceeding function. + */ +void +fill_in_entrypoint_offset(_glapi_proc entrypoint, unsigned int offset) +{ + GLubyte * const code = (GLubyte *) entrypoint; + +#if defined(GLX_USE_TLS) + *((unsigned int *)(code + 8)) = 4 * offset; +#elif defined(THREADS) + *((unsigned int *)(code + 11)) = 4 * offset; + *((unsigned int *)(code + 22)) = 4 * offset; +#else + *((unsigned int *)(code + 7)) = 4 * offset; +#endif +} + + +#elif defined(USE_SPARC_ASM) + +extern void __glapi_sparc_icache_flush(unsigned int *); + +static void +init_glapi_relocs( void ) +{ +#if defined(PTHREADS) || defined(GLX_USE_TLS) + static const unsigned int template[] = { +#ifdef GLX_USE_TLS + 0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */ + 0x8730e00a, /* srl %g3, 10, %g3 */ + 0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */ +#ifdef __arch64__ + 0xc259c002, /* ldx [%g7 + %g2], %g1 */ + 0xc2584003, /* ldx [%g1 + %g3], %g1 */ +#else + 0xc201c002, /* ld [%g7 + %g2], %g1 */ + 0xc2004003, /* ld [%g1 + %g3], %g1 */ +#endif + 0x81c04000, /* jmp %g1 */ + 0x01000000, /* nop */ +#else +#ifdef __arch64__ + 0x03000000, /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */ + 0x05000000, /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */ + 0x82106000, /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */ + 0x8730e00a, /* 64-bit 0x0c --> srl %g3, 10, %g3 */ + 0x83287020, /* 64-bit 0x10 --> sllx %g1, 32, %g1 */ + 0x82004002, /* 64-bit 0x14 --> add %g1, %g2, %g1 */ + 0xc2586000, /* 64-bit 0x18 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */ +#else + 0x03000000, /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */ + 0x8730e00a, /* 32-bit 0x04 --> srl %g3, 10, %g3 */ + 0xc2006000, /* 32-bit 0x08 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */ +#endif + 0x80a06000, /* --> cmp %g1, 0 */ + 0x02800005, /* --> be +4*5 */ + 0x01000000, /* --> nop */ +#ifdef __arch64__ + 0xc2584003, /* 64-bit --> ldx [%g1 + %g3], %g1 */ +#else + 0xc2004003, /* 32-bit --> ld [%g1 + %g3], %g1 */ +#endif + 0x81c04000, /* --> jmp %g1 */ + 0x01000000, /* --> nop */ +#ifdef __arch64__ + 0x9de3bf80, /* 64-bit --> save %sp, -128, %sp */ +#else + 0x9de3bfc0, /* 32-bit --> save %sp, -64, %sp */ +#endif + 0xa0100003, /* --> mov %g3, %l0 */ + 0x40000000, /* --> call _glapi_get_dispatch */ + 0x01000000, /* --> nop */ + 0x82100008, /* --> mov %o0, %g1 */ + 0x86100010, /* --> mov %l0, %g3 */ + 0x10bffff7, /* --> ba -4*9 */ + 0x81e80000, /* --> restore */ +#endif + }; +#ifdef GLX_USE_TLS + extern unsigned int __glapi_sparc_tls_stub; + extern unsigned long __glapi_sparc_get_dispatch(void); + unsigned int *code = &__glapi_sparc_tls_stub; + unsigned long dispatch = __glapi_sparc_get_dispatch(); +#else + extern unsigned int __glapi_sparc_pthread_stub; + unsigned int *code = &__glapi_sparc_pthread_stub; + unsigned long dispatch = (unsigned long) &_glapi_Dispatch; + unsigned long call_dest = (unsigned long ) &_glapi_get_dispatch; + int idx; +#endif + +#ifdef GLX_USE_TLS + code[0] = template[0] | (dispatch >> 10); + code[1] = template[1]; + __glapi_sparc_icache_flush(&code[0]); + code[2] = template[2] | (dispatch & 0x3ff); + code[3] = template[3]; + __glapi_sparc_icache_flush(&code[2]); + code[4] = template[4]; + code[5] = template[5]; + __glapi_sparc_icache_flush(&code[4]); + code[6] = template[6]; + __glapi_sparc_icache_flush(&code[6]); +#else +#if defined(__arch64__) + code[0] = template[0] | (dispatch >> (32 + 10)); + code[1] = template[1] | ((dispatch & 0xffffffff) >> 10); + __glapi_sparc_icache_flush(&code[0]); + code[2] = template[2] | ((dispatch >> 32) & 0x3ff); + code[3] = template[3]; + __glapi_sparc_icache_flush(&code[2]); + code[4] = template[4]; + code[5] = template[5]; + __glapi_sparc_icache_flush(&code[4]); + code[6] = template[6] | (dispatch & 0x3ff); + idx = 7; +#else + code[0] = template[0] | (dispatch >> 10); + code[1] = template[1]; + __glapi_sparc_icache_flush(&code[0]); + code[2] = template[2] | (dispatch & 0x3ff); + idx = 3; +#endif + code[idx + 0] = template[idx + 0]; + __glapi_sparc_icache_flush(&code[idx - 1]); + code[idx + 1] = template[idx + 1]; + code[idx + 2] = template[idx + 2]; + __glapi_sparc_icache_flush(&code[idx + 1]); + code[idx + 3] = template[idx + 3]; + code[idx + 4] = template[idx + 4]; + __glapi_sparc_icache_flush(&code[idx + 3]); + code[idx + 5] = template[idx + 5]; + code[idx + 6] = template[idx + 6]; + __glapi_sparc_icache_flush(&code[idx + 5]); + code[idx + 7] = template[idx + 7]; + code[idx + 8] = template[idx + 8] | + (((call_dest - ((unsigned long) &code[idx + 8])) + >> 2) & 0x3fffffff); + __glapi_sparc_icache_flush(&code[idx + 7]); + code[idx + 9] = template[idx + 9]; + code[idx + 10] = template[idx + 10]; + __glapi_sparc_icache_flush(&code[idx + 9]); + code[idx + 11] = template[idx + 11]; + code[idx + 12] = template[idx + 12]; + __glapi_sparc_icache_flush(&code[idx + 11]); + code[idx + 13] = template[idx + 13]; + __glapi_sparc_icache_flush(&code[idx + 13]); +#endif +#endif +} + + +_glapi_proc +generate_entrypoint(GLuint functionOffset) +{ +#if defined(PTHREADS) || defined(GLX_USE_TLS) + static const unsigned int template[] = { + 0x07000000, /* sethi %hi(0), %g3 */ + 0x8210000f, /* mov %o7, %g1 */ + 0x40000000, /* call */ + 0x9e100001, /* mov %g1, %o7 */ + }; +#ifdef GLX_USE_TLS + extern unsigned int __glapi_sparc_tls_stub; + unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub; +#else + extern unsigned int __glapi_sparc_pthread_stub; + unsigned long call_dest = (unsigned long ) &__glapi_sparc_pthread_stub; +#endif + unsigned int *code = (unsigned int *) u_execmem_alloc(sizeof(template)); + if (code) { + code[0] = template[0] | (functionOffset & 0x3fffff); + code[1] = template[1]; + __glapi_sparc_icache_flush(&code[0]); + code[2] = template[2] | + (((call_dest - ((unsigned long) &code[2])) + >> 2) & 0x3fffffff); + code[3] = template[3]; + __glapi_sparc_icache_flush(&code[2]); + } + return (_glapi_proc) code; +#endif +} + + +void +fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset) +{ + unsigned int *code = (unsigned int *) entrypoint; + + code[0] &= ~0x3fffff; + code[0] |= (offset * sizeof(void *)) & 0x3fffff; + __glapi_sparc_icache_flush(&code[0]); +} + + +#else /* USE_*_ASM */ + +static void +init_glapi_relocs( void ) +{ +} + + +_glapi_proc +generate_entrypoint(GLuint functionOffset) +{ + (void) functionOffset; + return NULL; +} + + +void +fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset) +{ + /* an unimplemented architecture */ + (void) entrypoint; + (void) offset; +} + +#endif /* USE_*_ASM */ + + +void +init_glapi_relocs_once( void ) +{ +#if defined(PTHREADS) || defined(GLX_USE_TLS) + static pthread_once_t once_control = PTHREAD_ONCE_INIT; + pthread_once( & once_control, init_glapi_relocs ); +#endif +} diff --git a/mesalib/src/mapi/glapi/glapi_getproc.c b/mesalib/src/mapi/glapi/glapi_getproc.c index e0920f9a3..2eb6bbc8a 100644 --- a/mesalib/src/mapi/glapi/glapi_getproc.c +++ b/mesalib/src/mapi/glapi/glapi_getproc.c @@ -30,34 +30,19 @@ */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include "glapi/mesa.h" -#else -#include "main/glheader.h" -#include "main/compiler.h" -#endif - -#include "glapi/glapi.h" -#include "glapi/glapioffsets.h" +#include "glapi/glapi_priv.h" #include "glapi/glapitable.h" +#include "glapi/glapioffsets.h" -#if defined(USE_X64_64_ASM) && defined(GLX_USE_TLS) -# define DISPATCH_FUNCTION_SIZE 16 -#elif defined(USE_X86_ASM) -# if defined(THREADS) && !defined(GLX_USE_TLS) -# define DISPATCH_FUNCTION_SIZE 32 -# else -# define DISPATCH_FUNCTION_SIZE 16 -# endif -#endif +/********************************************************************** + * Static function management. + */ + -#if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server) && !defined(XGLServer) +#if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server) # define NEED_FUNCTION_POINTER #endif - -/* The code in this file is auto-generated with Python */ #include "glapi/glprocs.h" @@ -66,13 +51,13 @@ * and return the corresponding glprocs_table_t entry. */ static const glprocs_table_t * -find_entry( const char * n ) +get_static_proc( const char * n ) { GLuint i; for (i = 0; static_functions[i].Name_offset >= 0; i++) { const char *testName = gl_string_table + static_functions[i].Name_offset; #ifdef MANGLE - /* skip the "m" prefix on the name */ + /* skip the prefix on the name */ if (strcmp(testName, n + 1) == 0) #else if (strcmp(testName, n) == 0) @@ -92,27 +77,16 @@ find_entry( const char * n ) static GLint get_static_proc_offset(const char *funcName) { - const glprocs_table_t * const f = find_entry( funcName ); - if (f) { - return f->Offset; + const glprocs_table_t * const f = get_static_proc( funcName ); + if (f == NULL) { + return -1; } - return -1; -} - -#ifdef USE_X86_ASM - -#if defined( GLX_USE_TLS ) -extern GLubyte gl_dispatch_functions_start[]; -extern GLubyte gl_dispatch_functions_end[]; -#else -extern const GLubyte gl_dispatch_functions_start[]; -#endif - -#endif /* USE_X86_ASM */ + return f->Offset; +} -#if !defined(XFree86Server) && !defined(XGLServer) +#if !defined(XFree86Server) /** * Return dispatch function address for the named static (built-in) function. @@ -121,27 +95,32 @@ extern const GLubyte gl_dispatch_functions_start[]; static _glapi_proc get_static_proc_address(const char *funcName) { - const glprocs_table_t * const f = find_entry( funcName ); - if (f) { + const glprocs_table_t * const f = get_static_proc( funcName ); + if (f == NULL) { + return NULL; + } + #if defined(DISPATCH_FUNCTION_SIZE) && defined(GLX_INDIRECT_RENDERING) - return (f->Address == NULL) - ? (_glapi_proc) (gl_dispatch_functions_start - + (DISPATCH_FUNCTION_SIZE * f->Offset)) - : f->Address; + return (f->Address == NULL) + ? get_entrypoint_address(f->Offset) + : f->Address; #elif defined(DISPATCH_FUNCTION_SIZE) - return (_glapi_proc) (gl_dispatch_functions_start - + (DISPATCH_FUNCTION_SIZE * f->Offset)); + return get_entrypoint_address(f->Offset); #else - return f->Address; + return f->Address; #endif - } - else { - return NULL; - } } -#endif /* !defined(XFree86Server) && !defined(XGLServer) */ +#else +static _glapi_proc +get_static_proc_address(const char *funcName) +{ + (void) funcName; + return NULL; +} + +#endif /* !defined(XFree86Server) */ /** @@ -162,172 +141,6 @@ get_static_proc_name( GLuint offset ) -#if defined(PTHREADS) || defined(GLX_USE_TLS) - -/** - * Perform platform-specific GL API entry-point fixups. - */ -static void -init_glapi_relocs( void ) -{ -#if defined(USE_X86_ASM) && defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT) - extern unsigned long _x86_get_dispatch(void); - char run_time_patch[] = { - 0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */ - }; - GLuint *offset = (GLuint *) &run_time_patch[2]; /* 32-bits for x86/32 */ - const GLubyte * const get_disp = (const GLubyte *) run_time_patch; - GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start; - - *offset = _x86_get_dispatch(); - while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) { - (void) memcpy( curr_func, get_disp, sizeof(run_time_patch)); - curr_func += DISPATCH_FUNCTION_SIZE; - } -#endif -#ifdef USE_SPARC_ASM - extern void __glapi_sparc_icache_flush(unsigned int *); - static const unsigned int template[] = { -#ifdef GLX_USE_TLS - 0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */ - 0x8730e00a, /* srl %g3, 10, %g3 */ - 0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */ -#ifdef __arch64__ - 0xc259c002, /* ldx [%g7 + %g2], %g1 */ - 0xc2584003, /* ldx [%g1 + %g3], %g1 */ -#else - 0xc201c002, /* ld [%g7 + %g2], %g1 */ - 0xc2004003, /* ld [%g1 + %g3], %g1 */ -#endif - 0x81c04000, /* jmp %g1 */ - 0x01000000, /* nop */ -#else -#ifdef __arch64__ - 0x03000000, /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */ - 0x05000000, /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */ - 0x82106000, /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */ - 0x8730e00a, /* 64-bit 0x0c --> srl %g3, 10, %g3 */ - 0x83287020, /* 64-bit 0x10 --> sllx %g1, 32, %g1 */ - 0x82004002, /* 64-bit 0x14 --> add %g1, %g2, %g1 */ - 0xc2586000, /* 64-bit 0x18 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */ -#else - 0x03000000, /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */ - 0x8730e00a, /* 32-bit 0x04 --> srl %g3, 10, %g3 */ - 0xc2006000, /* 32-bit 0x08 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */ -#endif - 0x80a06000, /* --> cmp %g1, 0 */ - 0x02800005, /* --> be +4*5 */ - 0x01000000, /* --> nop */ -#ifdef __arch64__ - 0xc2584003, /* 64-bit --> ldx [%g1 + %g3], %g1 */ -#else - 0xc2004003, /* 32-bit --> ld [%g1 + %g3], %g1 */ -#endif - 0x81c04000, /* --> jmp %g1 */ - 0x01000000, /* --> nop */ -#ifdef __arch64__ - 0x9de3bf80, /* 64-bit --> save %sp, -128, %sp */ -#else - 0x9de3bfc0, /* 32-bit --> save %sp, -64, %sp */ -#endif - 0xa0100003, /* --> mov %g3, %l0 */ - 0x40000000, /* --> call _glapi_get_dispatch */ - 0x01000000, /* --> nop */ - 0x82100008, /* --> mov %o0, %g1 */ - 0x86100010, /* --> mov %l0, %g3 */ - 0x10bffff7, /* --> ba -4*9 */ - 0x81e80000, /* --> restore */ -#endif - }; -#ifdef GLX_USE_TLS - extern unsigned int __glapi_sparc_tls_stub; - extern unsigned long __glapi_sparc_get_dispatch(void); - unsigned int *code = &__glapi_sparc_tls_stub; - unsigned long dispatch = __glapi_sparc_get_dispatch(); -#else - extern unsigned int __glapi_sparc_pthread_stub; - unsigned int *code = &__glapi_sparc_pthread_stub; - unsigned long dispatch = (unsigned long) &_glapi_Dispatch; - unsigned long call_dest = (unsigned long ) &_glapi_get_dispatch; - int idx; -#endif - -#if defined(GLX_USE_TLS) - code[0] = template[0] | (dispatch >> 10); - code[1] = template[1]; - __glapi_sparc_icache_flush(&code[0]); - code[2] = template[2] | (dispatch & 0x3ff); - code[3] = template[3]; - __glapi_sparc_icache_flush(&code[2]); - code[4] = template[4]; - code[5] = template[5]; - __glapi_sparc_icache_flush(&code[4]); - code[6] = template[6]; - __glapi_sparc_icache_flush(&code[6]); -#else -#if defined(__arch64__) - code[0] = template[0] | (dispatch >> (32 + 10)); - code[1] = template[1] | ((dispatch & 0xffffffff) >> 10); - __glapi_sparc_icache_flush(&code[0]); - code[2] = template[2] | ((dispatch >> 32) & 0x3ff); - code[3] = template[3]; - __glapi_sparc_icache_flush(&code[2]); - code[4] = template[4]; - code[5] = template[5]; - __glapi_sparc_icache_flush(&code[4]); - code[6] = template[6] | (dispatch & 0x3ff); - idx = 7; -#else - code[0] = template[0] | (dispatch >> 10); - code[1] = template[1]; - __glapi_sparc_icache_flush(&code[0]); - code[2] = template[2] | (dispatch & 0x3ff); - idx = 3; -#endif - code[idx + 0] = template[idx + 0]; - __glapi_sparc_icache_flush(&code[idx - 1]); - code[idx + 1] = template[idx + 1]; - code[idx + 2] = template[idx + 2]; - __glapi_sparc_icache_flush(&code[idx + 1]); - code[idx + 3] = template[idx + 3]; - code[idx + 4] = template[idx + 4]; - __glapi_sparc_icache_flush(&code[idx + 3]); - code[idx + 5] = template[idx + 5]; - code[idx + 6] = template[idx + 6]; - __glapi_sparc_icache_flush(&code[idx + 5]); - code[idx + 7] = template[idx + 7]; - code[idx + 8] = template[idx + 8] | - (((call_dest - ((unsigned long) &code[idx + 8])) - >> 2) & 0x3fffffff); - __glapi_sparc_icache_flush(&code[idx + 7]); - code[idx + 9] = template[idx + 9]; - code[idx + 10] = template[idx + 10]; - __glapi_sparc_icache_flush(&code[idx + 9]); - code[idx + 11] = template[idx + 11]; - code[idx + 12] = template[idx + 12]; - __glapi_sparc_icache_flush(&code[idx + 11]); - code[idx + 13] = template[idx + 13]; - __glapi_sparc_icache_flush(&code[idx + 13]); -#endif -#endif -} - -void -init_glapi_relocs_once( void ) -{ - static pthread_once_t once_control = PTHREAD_ONCE_INIT; - pthread_once( & once_control, init_glapi_relocs ); -} - -#else - -void -init_glapi_relocs_once( void ) { } - -#endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */ - - - /********************************************************************** * Extension function management. */ @@ -381,107 +194,54 @@ struct _glapi_function { static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS]; static GLuint NumExtEntryPoints = 0; -#ifdef USE_SPARC_ASM -extern void __glapi_sparc_icache_flush(unsigned int *); -#endif -static void -fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset); - -/** - * Generate a dispatch function (entrypoint) which jumps through - * the given slot number (offset) in the current dispatch table. - * We need assembly language in order to accomplish this. - */ -static _glapi_proc -generate_entrypoint(GLuint functionOffset) +static struct _glapi_function * +get_extension_proc(const char *funcName) { -#if defined(USE_X86_ASM) - /* 32 is chosen as something of a magic offset. For x86, the dispatch - * at offset 32 is the first one where the offset in the - * "jmp OFFSET*4(%eax)" can't be encoded in a single byte. - */ - const GLubyte * const template_func = gl_dispatch_functions_start - + (DISPATCH_FUNCTION_SIZE * 32); - GLubyte * const code = (GLubyte *) malloc(DISPATCH_FUNCTION_SIZE); - - - if ( code != NULL ) { - (void) memcpy(code, template_func, DISPATCH_FUNCTION_SIZE); - fill_in_entrypoint_offset( (_glapi_proc) code, functionOffset ); + GLuint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].name, funcName) == 0) { + return & ExtEntryTable[i]; + } } + return NULL; +} - return (_glapi_proc) code; -#elif defined(USE_SPARC_ASM) - -#if defined(PTHREADS) || defined(GLX_USE_TLS) - static const unsigned int template[] = { - 0x07000000, /* sethi %hi(0), %g3 */ - 0x8210000f, /* mov %o7, %g1 */ - 0x40000000, /* call */ - 0x9e100001, /* mov %g1, %o7 */ - }; -#ifdef GLX_USE_TLS - extern unsigned int __glapi_sparc_tls_stub; - unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub; -#else - extern unsigned int __glapi_sparc_pthread_stub; - unsigned long call_dest = (unsigned long ) &__glapi_sparc_pthread_stub; -#endif - unsigned int *code = (unsigned int *) malloc(sizeof(template)); - if (code) { - code[0] = template[0] | (functionOffset & 0x3fffff); - code[1] = template[1]; - __glapi_sparc_icache_flush(&code[0]); - code[2] = template[2] | - (((call_dest - ((unsigned long) &code[2])) - >> 2) & 0x3fffffff); - code[3] = template[3]; - __glapi_sparc_icache_flush(&code[2]); + +static GLint +get_extension_proc_offset(const char *funcName) +{ + const struct _glapi_function * const f = get_extension_proc( funcName ); + if (f == NULL) { + return -1; } - return (_glapi_proc) code; -#endif -#else - (void) functionOffset; - return NULL; -#endif /* USE_*_ASM */ + return f->dispatch_offset; } -/** - * This function inserts a new dispatch offset into the assembly language - * stub that was generated with the preceeding function. - */ -static void -fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset) +static _glapi_proc +get_extension_proc_address(const char *funcName) { -#if defined(USE_X86_ASM) - GLubyte * const code = (GLubyte *) entrypoint; - -#if DISPATCH_FUNCTION_SIZE == 32 - *((unsigned int *)(code + 11)) = 4 * offset; - *((unsigned int *)(code + 22)) = 4 * offset; -#elif DISPATCH_FUNCTION_SIZE == 16 && defined( GLX_USE_TLS ) - *((unsigned int *)(code + 8)) = 4 * offset; -#elif DISPATCH_FUNCTION_SIZE == 16 - *((unsigned int *)(code + 7)) = 4 * offset; -#else -# error Invalid DISPATCH_FUNCTION_SIZE! -#endif + const struct _glapi_function * const f = get_extension_proc( funcName ); + if (f == NULL) { + return NULL; + } -#elif defined(USE_SPARC_ASM) - unsigned int *code = (unsigned int *) entrypoint; - code[0] &= ~0x3fffff; - code[0] |= (offset * sizeof(void *)) & 0x3fffff; - __glapi_sparc_icache_flush(&code[0]); -#else + return f->dispatch_stub; +} - /* an unimplemented architecture */ - (void) entrypoint; - (void) offset; -#endif /* USE_*_ASM */ +static const char * +get_extension_proc_name(GLuint offset) +{ + GLuint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (ExtEntryTable[i].dispatch_offset == offset) { + return ExtEntryTable[i].name; + } + } + return NULL; } @@ -518,20 +278,55 @@ static struct _glapi_function * add_function_name( const char * funcName ) { struct _glapi_function * entry = NULL; - - if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) { - _glapi_proc entrypoint = generate_entrypoint(~0); - if (entrypoint != NULL) { - entry = & ExtEntryTable[NumExtEntryPoints]; - - ExtEntryTable[NumExtEntryPoints].name = str_dup(funcName); - ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL; - ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0; - ExtEntryTable[NumExtEntryPoints].dispatch_stub = entrypoint; - NumExtEntryPoints++; - } + _glapi_proc entrypoint = NULL; + char * name_dup = NULL; + + if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS) + return NULL; + + if (funcName == NULL) + return NULL; + + name_dup = str_dup(funcName); + if (name_dup == NULL) + return NULL; + + entrypoint = generate_entrypoint(~0); + + if (entrypoint == NULL) { + free(name_dup); + return NULL; } + entry = & ExtEntryTable[NumExtEntryPoints]; + NumExtEntryPoints++; + + entry->name = name_dup; + entry->parameter_signature = NULL; + entry->dispatch_offset = ~0; + entry->dispatch_stub = entrypoint; + + return entry; +} + + +static struct _glapi_function * +set_entry_info( struct _glapi_function * entry, const char * signature, unsigned offset ) +{ + char * sig_dup = NULL; + + if (signature == NULL) + return NULL; + + sig_dup = str_dup(signature); + if (sig_dup == NULL) + return NULL; + + fill_in_entrypoint_offset(entry->dispatch_stub, offset); + + entry->parameter_signature = sig_dup; + entry->dispatch_offset = offset; + return entry; } @@ -584,7 +379,7 @@ add_function_name( const char * funcName ) */ #ifndef INSERVER -PUBLIC int +int _glapi_add_dispatch( const char * const * function_names, const char * parameter_signature ) { @@ -594,88 +389,103 @@ _glapi_add_dispatch( const char * const * function_names, struct _glapi_function * entry[8]; GLboolean is_static[8]; unsigned i; - unsigned j; int offset = ~0; - int new_offset; + init_glapi_relocs_once(); (void) memset( is_static, 0, sizeof( is_static ) ); (void) memset( entry, 0, sizeof( entry ) ); + /* Find the _single_ dispatch offset for all function names that already + * exist (and have a dispatch offset). + */ + for ( i = 0 ; function_names[i] != NULL ; i++ ) { - /* Do some trivial validation on the name of the function. - */ + const char * funcName = function_names[i]; + int static_offset; + int extension_offset; - if (!function_names[i] || function_names[i][0] != 'g' || function_names[i][1] != 'l') + if (funcName[0] != 'g' || funcName[1] != 'l') return -1; - - /* Determine if the named function already exists. If the function does - * exist, it must have the same parameter signature as the function - * being added. - */ - - new_offset = get_static_proc_offset(function_names[i]); - if (new_offset >= 0) { + + /* search built-in functions */ + static_offset = get_static_proc_offset(funcName); + + if (static_offset >= 0) { + + is_static[i] = GL_TRUE; + /* FIXME: Make sure the parameter signatures match! How do we get * FIXME: the parameter signature for static functions? */ - if ( (offset != ~0) && (new_offset != offset) ) { + if ( (offset != ~0) && (static_offset != offset) ) { return -1; } - is_static[i] = GL_TRUE; - offset = new_offset; + offset = static_offset; + + continue; } - - - for ( j = 0 ; j < NumExtEntryPoints ; j++ ) { - if (strcmp(ExtEntryTable[j].name, function_names[i]) == 0) { - /* The offset may be ~0 if the function name was added by - * glXGetProcAddress but never filled in by the driver. - */ - - if (ExtEntryTable[j].dispatch_offset != ~0) { - if (strcmp(real_sig, ExtEntryTable[j].parameter_signature) - != 0) { - return -1; - } - - if ( (offset != ~0) && (ExtEntryTable[j].dispatch_offset != offset) ) { - return -1; - } - - offset = ExtEntryTable[j].dispatch_offset; - } - - entry[i] = & ExtEntryTable[j]; - break; + + /* search added extension functions */ + entry[i] = get_extension_proc(funcName); + + if (entry[i] != NULL) { + extension_offset = entry[i]->dispatch_offset; + + /* The offset may be ~0 if the function name was added by + * glXGetProcAddress but never filled in by the driver. + */ + + if (extension_offset == ~0) { + continue; } + + if (strcmp(real_sig, entry[i]->parameter_signature) != 0) { + return -1; + } + + if ( (offset != ~0) && (extension_offset != offset) ) { + return -1; + } + + offset = extension_offset; } } + /* If all function names are either new (or with no dispatch offset), + * allocate a new dispatch offset. + */ + if (offset == ~0) { offset = next_dynamic_offset; next_dynamic_offset++; } + /* Fill in the dispatch offset for the new function names (and those with + * no dispatch offset). + */ + for ( i = 0 ; function_names[i] != NULL ; i++ ) { - if (! is_static[i] ) { + if (is_static[i]) { + continue; + } + + /* generate entrypoints for new function names */ + if (entry[i] == NULL) { + entry[i] = add_function_name( function_names[i] ); if (entry[i] == NULL) { - entry[i] = add_function_name( function_names[i] ); - if (entry[i] == NULL) { - /* FIXME: Possible memory leak here. - */ - return -1; - } + /* FIXME: Possible memory leak here. */ + return -1; } + } - entry[i]->parameter_signature = str_dup(real_sig); - fill_in_entrypoint_offset(entry[i]->dispatch_stub, offset); - entry[i]->dispatch_offset = offset; + if (entry[i]->dispatch_offset == ~0) { + set_entry_info( entry[i], real_sig, offset ); } } - + return offset; } #endif @@ -683,16 +493,16 @@ _glapi_add_dispatch( const char * const * function_names, /** * Return offset of entrypoint for named function within dispatch table. */ -PUBLIC GLint +GLint _GLAPI_EXPORT _glapi_get_proc_offset(const char *funcName) { + GLint offset; + /* search extension functions first */ - GLuint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].name, funcName) == 0) { - return ExtEntryTable[i].dispatch_offset; - } - } + offset = get_extension_proc_offset(funcName); + if (offset >= 0) + return offset; + /* search static functions */ return get_static_proc_offset(funcName); } @@ -704,14 +514,17 @@ _glapi_get_proc_offset(const char *funcName) * in the name of static functions, try generating a new API entrypoint on * the fly with assembly language. */ -PUBLIC _glapi_proc +_glapi_proc _GLAPI_EXPORT _glapi_get_proc_address(const char *funcName) { + _glapi_proc func; struct _glapi_function * entry; - GLuint i; + + init_glapi_relocs_once(); #ifdef MANGLE - if (funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l') + /* skip the prefix on the name */ + if (funcName[1] != 'g' || funcName[2] != 'l') return NULL; #else if (funcName[0] != 'g' || funcName[1] != 'l') @@ -719,23 +532,21 @@ _glapi_get_proc_address(const char *funcName) #endif /* search extension functions first */ - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].name, funcName) == 0) { - return ExtEntryTable[i].dispatch_stub; - } - } + func = get_extension_proc_address(funcName); + if (func) + return func; -#if !defined( XFree86Server ) && !defined( XGLServer ) /* search static functions */ - { - const _glapi_proc func = get_static_proc_address(funcName); - if (func) - return func; - } -#endif /* !defined( XFree86Server ) */ + func = get_static_proc_address(funcName); + if (func) + return func; + /* generate entrypoint, dispatch offset must be filled in by the driver */ entry = add_function_name(funcName); - return (entry == NULL) ? NULL : entry->dispatch_stub; + if (entry == NULL) + return NULL; + + return entry->dispatch_stub; } @@ -744,10 +555,9 @@ _glapi_get_proc_address(const char *funcName) * Return the name of the function at the given dispatch offset. * This is only intended for debugging. */ -const char * +const char * _GLAPI_EXPORT _glapi_get_proc_name(GLuint offset) { - GLuint i; const char * n; /* search built-in functions */ @@ -757,16 +567,56 @@ _glapi_get_proc_name(GLuint offset) } /* search added extension functions */ - for (i = 0; i < NumExtEntryPoints; i++) { - if (ExtEntryTable[i].dispatch_offset == offset) { - return ExtEntryTable[i].name; - } - } - return NULL; + return get_extension_proc_name(offset); } +/********************************************************************** + * GL API table functions. + */ + + +/* + * The dispatch table size (number of entries) is the size of the + * _glapi_table struct plus the number of dynamic entries we can add. + * The extra slots can be filled in by DRI drivers that register new extension + * functions. + */ +#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) + + +/** + * Return size of dispatch table struct as number of functions (or + * slots). + */ +GLuint _GLAPI_EXPORT +_glapi_get_dispatch_table_size(void) +{ + return DISPATCH_TABLE_SIZE; +} + + +/** + * Make sure there are no NULL pointers in the given dispatch table. + * Intended for debugging purposes. + */ +void +_glapi_check_table_not_null(const struct _glapi_table *table) +{ +#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */ + const GLuint entries = _glapi_get_dispatch_table_size(); + const void **tab = (const void **) table; + GLuint i; + for (i = 1; i < entries; i++) { + assert(tab[i]); + } +#else + (void) table; +#endif +} + + /** * Do some spot checks to be sure that the dispatch table * slots are assigned correctly. For debugging only. @@ -774,7 +624,7 @@ _glapi_get_proc_name(GLuint offset) void _glapi_check_table(const struct _glapi_table *table) { -#if 0 /* enable this for extra DEBUG */ +#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */ { GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); char *BeginFunc = (char*) &table->Begin; diff --git a/mesalib/src/mapi/glapi/glapi_nop.c b/mesalib/src/mapi/glapi/glapi_nop.c index 4257b1fbc..365a6e1c8 100644 --- a/mesalib/src/mapi/glapi/glapi_nop.c +++ b/mesalib/src/mapi/glapi/glapi_nop.c @@ -3,7 +3,7 @@ * Version: 7.8 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2010 VMWare, Inc. All Rights Reserved. + * Copyright (C) 2010 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -38,32 +38,15 @@ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include "glapi/mesa.h" -#else -#include "main/compiler.h" -#include "main/glheader.h" -#endif - -#include "glapi/glapi.h" - - -/* - * These stubs are kept so that the old DRI drivers still load. - */ -PUBLIC void -_glapi_noop_enable_warnings(GLboolean enable); +#include "glapi/glapi_priv.h" -PUBLIC void -_glapi_set_warning_func(_glapi_proc func); -void -_glapi_noop_enable_warnings(GLboolean enable) +void _GLAPI_EXPORT +_glapi_noop_enable_warnings(unsigned char enable) { } -void +void _GLAPI_EXPORT _glapi_set_warning_func(_glapi_proc func) { } diff --git a/mesalib/src/mapi/glapi/glapi_priv.h b/mesalib/src/mapi/glapi/glapi_priv.h new file mode 100644 index 000000000..3ab553a2b --- /dev/null +++ b/mesalib/src/mapi/glapi/glapi_priv.h @@ -0,0 +1,114 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef _GLAPI_PRIV_H +#define _GLAPI_PRIV_H + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#include "glapi/mesa.h" +#else /* HAVE_DIX_CONFIG_H */ +#define GL_GLEXT_PROTOTYPES +#include "GL/gl.h" +#include "GL/glext.h" + +#ifndef GL_OES_fixed_point +typedef int GLfixed; +typedef int GLclampx; +#endif + +#ifndef GL_OES_EGL_image +typedef void *GLeglImageOES; +#endif + +#endif /* HAVE_DIX_CONFIG_H */ + +#include "glapi/glapi.h" + + +/* getproc */ + +extern void +_glapi_check_table_not_null(const struct _glapi_table *table); + + +extern void +_glapi_check_table(const struct _glapi_table *table); + + +/* entrypoint */ + +extern void +init_glapi_relocs_once(void); + + +extern _glapi_proc +generate_entrypoint(unsigned int functionOffset); + + +extern void +fill_in_entrypoint_offset(_glapi_proc entrypoint, unsigned int offset); + + +extern _glapi_proc +get_entrypoint_address(unsigned int functionOffset); + + +/** + * Size (in bytes) of dispatch function (entrypoint). + */ +#if defined(USE_X86_ASM) +# if defined(GLX_USE_TLS) +# define DISPATCH_FUNCTION_SIZE 16 +# elif defined(THREADS) +# define DISPATCH_FUNCTION_SIZE 32 +# else +# define DISPATCH_FUNCTION_SIZE 16 +# endif +#endif + +#if defined(USE_X64_64_ASM) +# if defined(GLX_USE_TLS) +# define DISPATCH_FUNCTION_SIZE 16 +# endif +#endif + + +/** + * Number of extension functions which we can dynamically add at runtime. + * + * Number of extension functions is also subject to the size of backing exec + * mem we allocate. For the common case of dispatch stubs with size 16 bytes, + * the two limits will be hit simultaneously. For larger dispatch function + * sizes, MAX_EXTENSION_FUNCS is effectively reduced. + */ +#define MAX_EXTENSION_FUNCS 256 + + +#endif diff --git a/mesalib/src/mapi/glapi/glapi_sparc.S b/mesalib/src/mapi/glapi/glapi_sparc.S new file mode 100644 index 000000000..c353ece56 --- /dev/null +++ b/mesalib/src/mapi/glapi/glapi_sparc.S @@ -0,0 +1,1412 @@ +/* DO NOT EDIT - This file generated automatically by gl_SPARC_asm.py (from Mesa) script */ + +/* + * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * (C) Copyright IBM Corporation 2004 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL, IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "glapi/glapioffsets.h" + +#ifdef __arch64__ +#define GL_OFF(N) ((N) * 8) +#define GL_LL ldx +#define GL_TIE_LD(SYM) %tie_ldx(SYM) +#define GL_STACK_SIZE 128 +#else +#define GL_OFF(N) ((N) * 4) +#define GL_LL ld +#define GL_TIE_LD(SYM) %tie_ld(SYM) +#define GL_STACK_SIZE 64 +#endif + +#define GLOBL_FN(x) .globl x ; .type x, @function +#define HIDDEN(x) .hidden x + + .register %g2, #scratch + .register %g3, #scratch + + .text + + GLOBL_FN(__glapi_sparc_icache_flush) + HIDDEN(__glapi_sparc_icache_flush) + .type __glapi_sparc_icache_flush, @function +__glapi_sparc_icache_flush: /* %o0 = insn_addr */ + flush %o0 + retl + nop + + .align 32 + + .type __glapi_sparc_get_pc, @function +__glapi_sparc_get_pc: + retl + add %o7, %g2, %g2 + .size __glapi_sparc_get_pc, .-__glapi_sparc_get_pc + +#ifdef GLX_USE_TLS + + GLOBL_FN(__glapi_sparc_get_dispatch) + HIDDEN(__glapi_sparc_get_dispatch) +__glapi_sparc_get_dispatch: + mov %o7, %g1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2 + call __glapi_sparc_get_pc + add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2 + mov %g1, %o7 + sethi %tie_hi22(_glapi_tls_Dispatch), %g1 + add %g1, %tie_lo10(_glapi_tls_Dispatch), %g1 + GL_LL [%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch) + retl + mov %g2, %o0 + + .data + .align 32 + + /* --> sethi %hi(_glapi_tls_Dispatch), %g1 */ + /* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */ + GLOBL_FN(__glapi_sparc_tls_stub) + HIDDEN(__glapi_sparc_tls_stub) +__glapi_sparc_tls_stub: /* Call offset in %g3 */ + mov %o7, %g1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2 + call __glapi_sparc_get_pc + add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2 + mov %g1, %o7 + srl %g3, 10, %g3 + sethi %tie_hi22(_glapi_tls_Dispatch), %g1 + add %g1, %tie_lo10(_glapi_tls_Dispatch), %g1 + GL_LL [%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch) + GL_LL [%g7+%g2], %g1 + GL_LL [%g1 + %g3], %g1 + jmp %g1 + nop + .size __glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub + +#define GL_STUB(fn, off) \ + GLOBL_FN(fn); \ +fn: ba __glapi_sparc_tls_stub; \ + sethi GL_OFF(off), %g3; \ + .size fn,.-fn; + +#elif defined(PTHREADS) + + /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */ + /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */ + /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */ + /* 64-bit 0x0c --> sllx %g1, 32, %g1 */ + /* 64-bit 0x10 --> add %g1, %g2, %g1 */ + /* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */ + + /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */ + /* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */ + + .data + .align 32 + + GLOBL_FN(__glapi_sparc_pthread_stub) + HIDDEN(__glapi_sparc_pthread_stub) +__glapi_sparc_pthread_stub: /* Call offset in %g3 */ + mov %o7, %g1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2 + call __glapi_sparc_get_pc + add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2 + mov %g1, %o7 + sethi %hi(_glapi_Dispatch), %g1 + or %g1, %lo(_glapi_Dispatch), %g1 + srl %g3, 10, %g3 + GL_LL [%g2+%g1], %g2 + GL_LL [%g2], %g1 + cmp %g1, 0 + be 2f + nop +1: GL_LL [%g1 + %g3], %g1 + jmp %g1 + nop +2: save %sp, GL_STACK_SIZE, %sp + mov %g3, %l0 + call _glapi_get_dispatch + nop + mov %o0, %g1 + mov %l0, %g3 + ba 1b + restore %g0, %g0, %g0 + .size __glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub + +#define GL_STUB(fn, off) \ + GLOBL_FN(fn); \ +fn: ba __glapi_sparc_pthread_stub; \ + sethi GL_OFF(off), %g3; \ + .size fn,.-fn; + +#else /* Non-threaded version. */ + + .type __glapi_sparc_nothread_stub, @function +__glapi_sparc_nothread_stub: /* Call offset in %g3 */ + mov %o7, %g1 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %g2 + call __glapi_sparc_get_pc + add %g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2 + mov %g1, %o7 + srl %g3, 10, %g3 + sethi %hi(_glapi_Dispatch), %g1 + or %g1, %lo(_glapi_Dispatch), %g1 + GL_LL [%g2+%g1], %g2 + GL_LL [%g2], %g1 + GL_LL [%g1 + %g3], %g1 + jmp %g1 + nop + .size __glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub + +#define GL_STUB(fn, off) \ + GLOBL_FN(fn); \ +fn: ba __glapi_sparc_nothread_stub; \ + sethi GL_OFF(off), %g3; \ + .size fn,.-fn; + +#endif + +#define GL_STUB_ALIAS(fn, alias) \ + .globl fn; \ + .set fn, alias + + .text + .align 32 + + .globl gl_dispatch_functions_start + HIDDEN(gl_dispatch_functions_start) +gl_dispatch_functions_start: + + GL_STUB(glNewList, _gloffset_NewList) + GL_STUB(glEndList, _gloffset_EndList) + GL_STUB(glCallList, _gloffset_CallList) + GL_STUB(glCallLists, _gloffset_CallLists) + GL_STUB(glDeleteLists, _gloffset_DeleteLists) + GL_STUB(glGenLists, _gloffset_GenLists) + GL_STUB(glListBase, _gloffset_ListBase) + GL_STUB(glBegin, _gloffset_Begin) + GL_STUB(glBitmap, _gloffset_Bitmap) + GL_STUB(glColor3b, _gloffset_Color3b) + GL_STUB(glColor3bv, _gloffset_Color3bv) + GL_STUB(glColor3d, _gloffset_Color3d) + GL_STUB(glColor3dv, _gloffset_Color3dv) + GL_STUB(glColor3f, _gloffset_Color3f) + GL_STUB(glColor3fv, _gloffset_Color3fv) + GL_STUB(glColor3i, _gloffset_Color3i) + GL_STUB(glColor3iv, _gloffset_Color3iv) + GL_STUB(glColor3s, _gloffset_Color3s) + GL_STUB(glColor3sv, _gloffset_Color3sv) + GL_STUB(glColor3ub, _gloffset_Color3ub) + GL_STUB(glColor3ubv, _gloffset_Color3ubv) + GL_STUB(glColor3ui, _gloffset_Color3ui) + GL_STUB(glColor3uiv, _gloffset_Color3uiv) + GL_STUB(glColor3us, _gloffset_Color3us) + GL_STUB(glColor3usv, _gloffset_Color3usv) + GL_STUB(glColor4b, _gloffset_Color4b) + GL_STUB(glColor4bv, _gloffset_Color4bv) + GL_STUB(glColor4d, _gloffset_Color4d) + GL_STUB(glColor4dv, _gloffset_Color4dv) + GL_STUB(glColor4f, _gloffset_Color4f) + GL_STUB(glColor4fv, _gloffset_Color4fv) + GL_STUB(glColor4i, _gloffset_Color4i) + GL_STUB(glColor4iv, _gloffset_Color4iv) + GL_STUB(glColor4s, _gloffset_Color4s) + GL_STUB(glColor4sv, _gloffset_Color4sv) + GL_STUB(glColor4ub, _gloffset_Color4ub) + GL_STUB(glColor4ubv, _gloffset_Color4ubv) + GL_STUB(glColor4ui, _gloffset_Color4ui) + GL_STUB(glColor4uiv, _gloffset_Color4uiv) + GL_STUB(glColor4us, _gloffset_Color4us) + GL_STUB(glColor4usv, _gloffset_Color4usv) + GL_STUB(glEdgeFlag, _gloffset_EdgeFlag) + GL_STUB(glEdgeFlagv, _gloffset_EdgeFlagv) + GL_STUB(glEnd, _gloffset_End) + GL_STUB(glIndexd, _gloffset_Indexd) + GL_STUB(glIndexdv, _gloffset_Indexdv) + GL_STUB(glIndexf, _gloffset_Indexf) + GL_STUB(glIndexfv, _gloffset_Indexfv) + GL_STUB(glIndexi, _gloffset_Indexi) + GL_STUB(glIndexiv, _gloffset_Indexiv) + GL_STUB(glIndexs, _gloffset_Indexs) + GL_STUB(glIndexsv, _gloffset_Indexsv) + GL_STUB(glNormal3b, _gloffset_Normal3b) + GL_STUB(glNormal3bv, _gloffset_Normal3bv) + GL_STUB(glNormal3d, _gloffset_Normal3d) + GL_STUB(glNormal3dv, _gloffset_Normal3dv) + GL_STUB(glNormal3f, _gloffset_Normal3f) + GL_STUB(glNormal3fv, _gloffset_Normal3fv) + GL_STUB(glNormal3i, _gloffset_Normal3i) + GL_STUB(glNormal3iv, _gloffset_Normal3iv) + GL_STUB(glNormal3s, _gloffset_Normal3s) + GL_STUB(glNormal3sv, _gloffset_Normal3sv) + GL_STUB(glRasterPos2d, _gloffset_RasterPos2d) + GL_STUB(glRasterPos2dv, _gloffset_RasterPos2dv) + GL_STUB(glRasterPos2f, _gloffset_RasterPos2f) + GL_STUB(glRasterPos2fv, _gloffset_RasterPos2fv) + GL_STUB(glRasterPos2i, _gloffset_RasterPos2i) + GL_STUB(glRasterPos2iv, _gloffset_RasterPos2iv) + GL_STUB(glRasterPos2s, _gloffset_RasterPos2s) + GL_STUB(glRasterPos2sv, _gloffset_RasterPos2sv) + GL_STUB(glRasterPos3d, _gloffset_RasterPos3d) + GL_STUB(glRasterPos3dv, _gloffset_RasterPos3dv) + GL_STUB(glRasterPos3f, _gloffset_RasterPos3f) + GL_STUB(glRasterPos3fv, _gloffset_RasterPos3fv) + GL_STUB(glRasterPos3i, _gloffset_RasterPos3i) + GL_STUB(glRasterPos3iv, _gloffset_RasterPos3iv) + GL_STUB(glRasterPos3s, _gloffset_RasterPos3s) + GL_STUB(glRasterPos3sv, _gloffset_RasterPos3sv) + GL_STUB(glRasterPos4d, _gloffset_RasterPos4d) + GL_STUB(glRasterPos4dv, _gloffset_RasterPos4dv) + GL_STUB(glRasterPos4f, _gloffset_RasterPos4f) + GL_STUB(glRasterPos4fv, _gloffset_RasterPos4fv) + GL_STUB(glRasterPos4i, _gloffset_RasterPos4i) + GL_STUB(glRasterPos4iv, _gloffset_RasterPos4iv) + GL_STUB(glRasterPos4s, _gloffset_RasterPos4s) + GL_STUB(glRasterPos4sv, _gloffset_RasterPos4sv) + GL_STUB(glRectd, _gloffset_Rectd) + GL_STUB(glRectdv, _gloffset_Rectdv) + GL_STUB(glRectf, _gloffset_Rectf) + GL_STUB(glRectfv, _gloffset_Rectfv) + GL_STUB(glRecti, _gloffset_Recti) + GL_STUB(glRectiv, _gloffset_Rectiv) + GL_STUB(glRects, _gloffset_Rects) + GL_STUB(glRectsv, _gloffset_Rectsv) + GL_STUB(glTexCoord1d, _gloffset_TexCoord1d) + GL_STUB(glTexCoord1dv, _gloffset_TexCoord1dv) + GL_STUB(glTexCoord1f, _gloffset_TexCoord1f) + GL_STUB(glTexCoord1fv, _gloffset_TexCoord1fv) + GL_STUB(glTexCoord1i, _gloffset_TexCoord1i) + GL_STUB(glTexCoord1iv, _gloffset_TexCoord1iv) + GL_STUB(glTexCoord1s, _gloffset_TexCoord1s) + GL_STUB(glTexCoord1sv, _gloffset_TexCoord1sv) + GL_STUB(glTexCoord2d, _gloffset_TexCoord2d) + GL_STUB(glTexCoord2dv, _gloffset_TexCoord2dv) + GL_STUB(glTexCoord2f, _gloffset_TexCoord2f) + GL_STUB(glTexCoord2fv, _gloffset_TexCoord2fv) + GL_STUB(glTexCoord2i, _gloffset_TexCoord2i) + GL_STUB(glTexCoord2iv, _gloffset_TexCoord2iv) + GL_STUB(glTexCoord2s, _gloffset_TexCoord2s) + GL_STUB(glTexCoord2sv, _gloffset_TexCoord2sv) + GL_STUB(glTexCoord3d, _gloffset_TexCoord3d) + GL_STUB(glTexCoord3dv, _gloffset_TexCoord3dv) + GL_STUB(glTexCoord3f, _gloffset_TexCoord3f) + GL_STUB(glTexCoord3fv, _gloffset_TexCoord3fv) + GL_STUB(glTexCoord3i, _gloffset_TexCoord3i) + GL_STUB(glTexCoord3iv, _gloffset_TexCoord3iv) + GL_STUB(glTexCoord3s, _gloffset_TexCoord3s) + GL_STUB(glTexCoord3sv, _gloffset_TexCoord3sv) + GL_STUB(glTexCoord4d, _gloffset_TexCoord4d) + GL_STUB(glTexCoord4dv, _gloffset_TexCoord4dv) + GL_STUB(glTexCoord4f, _gloffset_TexCoord4f) + GL_STUB(glTexCoord4fv, _gloffset_TexCoord4fv) + GL_STUB(glTexCoord4i, _gloffset_TexCoord4i) + GL_STUB(glTexCoord4iv, _gloffset_TexCoord4iv) + GL_STUB(glTexCoord4s, _gloffset_TexCoord4s) + GL_STUB(glTexCoord4sv, _gloffset_TexCoord4sv) + GL_STUB(glVertex2d, _gloffset_Vertex2d) + GL_STUB(glVertex2dv, _gloffset_Vertex2dv) + GL_STUB(glVertex2f, _gloffset_Vertex2f) + GL_STUB(glVertex2fv, _gloffset_Vertex2fv) + GL_STUB(glVertex2i, _gloffset_Vertex2i) + GL_STUB(glVertex2iv, _gloffset_Vertex2iv) + GL_STUB(glVertex2s, _gloffset_Vertex2s) + GL_STUB(glVertex2sv, _gloffset_Vertex2sv) + GL_STUB(glVertex3d, _gloffset_Vertex3d) + GL_STUB(glVertex3dv, _gloffset_Vertex3dv) + GL_STUB(glVertex3f, _gloffset_Vertex3f) + GL_STUB(glVertex3fv, _gloffset_Vertex3fv) + GL_STUB(glVertex3i, _gloffset_Vertex3i) + GL_STUB(glVertex3iv, _gloffset_Vertex3iv) + GL_STUB(glVertex3s, _gloffset_Vertex3s) + GL_STUB(glVertex3sv, _gloffset_Vertex3sv) + GL_STUB(glVertex4d, _gloffset_Vertex4d) + GL_STUB(glVertex4dv, _gloffset_Vertex4dv) + GL_STUB(glVertex4f, _gloffset_Vertex4f) + GL_STUB(glVertex4fv, _gloffset_Vertex4fv) + GL_STUB(glVertex4i, _gloffset_Vertex4i) + GL_STUB(glVertex4iv, _gloffset_Vertex4iv) + GL_STUB(glVertex4s, _gloffset_Vertex4s) + GL_STUB(glVertex4sv, _gloffset_Vertex4sv) + GL_STUB(glClipPlane, _gloffset_ClipPlane) + GL_STUB(glColorMaterial, _gloffset_ColorMaterial) + GL_STUB(glCullFace, _gloffset_CullFace) + GL_STUB(glFogf, _gloffset_Fogf) + GL_STUB(glFogfv, _gloffset_Fogfv) + GL_STUB(glFogi, _gloffset_Fogi) + GL_STUB(glFogiv, _gloffset_Fogiv) + GL_STUB(glFrontFace, _gloffset_FrontFace) + GL_STUB(glHint, _gloffset_Hint) + GL_STUB(glLightf, _gloffset_Lightf) + GL_STUB(glLightfv, _gloffset_Lightfv) + GL_STUB(glLighti, _gloffset_Lighti) + GL_STUB(glLightiv, _gloffset_Lightiv) + GL_STUB(glLightModelf, _gloffset_LightModelf) + GL_STUB(glLightModelfv, _gloffset_LightModelfv) + GL_STUB(glLightModeli, _gloffset_LightModeli) + GL_STUB(glLightModeliv, _gloffset_LightModeliv) + GL_STUB(glLineStipple, _gloffset_LineStipple) + GL_STUB(glLineWidth, _gloffset_LineWidth) + GL_STUB(glMaterialf, _gloffset_Materialf) + GL_STUB(glMaterialfv, _gloffset_Materialfv) + GL_STUB(glMateriali, _gloffset_Materiali) + GL_STUB(glMaterialiv, _gloffset_Materialiv) + GL_STUB(glPointSize, _gloffset_PointSize) + GL_STUB(glPolygonMode, _gloffset_PolygonMode) + GL_STUB(glPolygonStipple, _gloffset_PolygonStipple) + GL_STUB(glScissor, _gloffset_Scissor) + GL_STUB(glShadeModel, _gloffset_ShadeModel) + GL_STUB(glTexParameterf, _gloffset_TexParameterf) + GL_STUB(glTexParameterfv, _gloffset_TexParameterfv) + GL_STUB(glTexParameteri, _gloffset_TexParameteri) + GL_STUB(glTexParameteriv, _gloffset_TexParameteriv) + GL_STUB(glTexImage1D, _gloffset_TexImage1D) + GL_STUB(glTexImage2D, _gloffset_TexImage2D) + GL_STUB(glTexEnvf, _gloffset_TexEnvf) + GL_STUB(glTexEnvfv, _gloffset_TexEnvfv) + GL_STUB(glTexEnvi, _gloffset_TexEnvi) + GL_STUB(glTexEnviv, _gloffset_TexEnviv) + GL_STUB(glTexGend, _gloffset_TexGend) + GL_STUB(glTexGendv, _gloffset_TexGendv) + GL_STUB(glTexGenf, _gloffset_TexGenf) + GL_STUB(glTexGenfv, _gloffset_TexGenfv) + GL_STUB(glTexGeni, _gloffset_TexGeni) + GL_STUB(glTexGeniv, _gloffset_TexGeniv) + GL_STUB(glFeedbackBuffer, _gloffset_FeedbackBuffer) + GL_STUB(glSelectBuffer, _gloffset_SelectBuffer) + GL_STUB(glRenderMode, _gloffset_RenderMode) + GL_STUB(glInitNames, _gloffset_InitNames) + GL_STUB(glLoadName, _gloffset_LoadName) + GL_STUB(glPassThrough, _gloffset_PassThrough) + GL_STUB(glPopName, _gloffset_PopName) + GL_STUB(glPushName, _gloffset_PushName) + GL_STUB(glDrawBuffer, _gloffset_DrawBuffer) + GL_STUB(glClear, _gloffset_Clear) + GL_STUB(glClearAccum, _gloffset_ClearAccum) + GL_STUB(glClearIndex, _gloffset_ClearIndex) + GL_STUB(glClearColor, _gloffset_ClearColor) + GL_STUB(glClearStencil, _gloffset_ClearStencil) + GL_STUB(glClearDepth, _gloffset_ClearDepth) + GL_STUB(glStencilMask, _gloffset_StencilMask) + GL_STUB(glColorMask, _gloffset_ColorMask) + GL_STUB(glDepthMask, _gloffset_DepthMask) + GL_STUB(glIndexMask, _gloffset_IndexMask) + GL_STUB(glAccum, _gloffset_Accum) + GL_STUB(glDisable, _gloffset_Disable) + GL_STUB(glEnable, _gloffset_Enable) + GL_STUB(glFinish, _gloffset_Finish) + GL_STUB(glFlush, _gloffset_Flush) + GL_STUB(glPopAttrib, _gloffset_PopAttrib) + GL_STUB(glPushAttrib, _gloffset_PushAttrib) + GL_STUB(glMap1d, _gloffset_Map1d) + GL_STUB(glMap1f, _gloffset_Map1f) + GL_STUB(glMap2d, _gloffset_Map2d) + GL_STUB(glMap2f, _gloffset_Map2f) + GL_STUB(glMapGrid1d, _gloffset_MapGrid1d) + GL_STUB(glMapGrid1f, _gloffset_MapGrid1f) + GL_STUB(glMapGrid2d, _gloffset_MapGrid2d) + GL_STUB(glMapGrid2f, _gloffset_MapGrid2f) + GL_STUB(glEvalCoord1d, _gloffset_EvalCoord1d) + GL_STUB(glEvalCoord1dv, _gloffset_EvalCoord1dv) + GL_STUB(glEvalCoord1f, _gloffset_EvalCoord1f) + GL_STUB(glEvalCoord1fv, _gloffset_EvalCoord1fv) + GL_STUB(glEvalCoord2d, _gloffset_EvalCoord2d) + GL_STUB(glEvalCoord2dv, _gloffset_EvalCoord2dv) + GL_STUB(glEvalCoord2f, _gloffset_EvalCoord2f) + GL_STUB(glEvalCoord2fv, _gloffset_EvalCoord2fv) + GL_STUB(glEvalMesh1, _gloffset_EvalMesh1) + GL_STUB(glEvalPoint1, _gloffset_EvalPoint1) + GL_STUB(glEvalMesh2, _gloffset_EvalMesh2) + GL_STUB(glEvalPoint2, _gloffset_EvalPoint2) + GL_STUB(glAlphaFunc, _gloffset_AlphaFunc) + GL_STUB(glBlendFunc, _gloffset_BlendFunc) + GL_STUB(glLogicOp, _gloffset_LogicOp) + GL_STUB(glStencilFunc, _gloffset_StencilFunc) + GL_STUB(glStencilOp, _gloffset_StencilOp) + GL_STUB(glDepthFunc, _gloffset_DepthFunc) + GL_STUB(glPixelZoom, _gloffset_PixelZoom) + GL_STUB(glPixelTransferf, _gloffset_PixelTransferf) + GL_STUB(glPixelTransferi, _gloffset_PixelTransferi) + GL_STUB(glPixelStoref, _gloffset_PixelStoref) + GL_STUB(glPixelStorei, _gloffset_PixelStorei) + GL_STUB(glPixelMapfv, _gloffset_PixelMapfv) + GL_STUB(glPixelMapuiv, _gloffset_PixelMapuiv) + GL_STUB(glPixelMapusv, _gloffset_PixelMapusv) + GL_STUB(glReadBuffer, _gloffset_ReadBuffer) + GL_STUB(glCopyPixels, _gloffset_CopyPixels) + GL_STUB(glReadPixels, _gloffset_ReadPixels) + GL_STUB(glDrawPixels, _gloffset_DrawPixels) + GL_STUB(glGetBooleanv, _gloffset_GetBooleanv) + GL_STUB(glGetClipPlane, _gloffset_GetClipPlane) + GL_STUB(glGetDoublev, _gloffset_GetDoublev) + GL_STUB(glGetError, _gloffset_GetError) + GL_STUB(glGetFloatv, _gloffset_GetFloatv) + GL_STUB(glGetIntegerv, _gloffset_GetIntegerv) + GL_STUB(glGetLightfv, _gloffset_GetLightfv) + GL_STUB(glGetLightiv, _gloffset_GetLightiv) + GL_STUB(glGetMapdv, _gloffset_GetMapdv) + GL_STUB(glGetMapfv, _gloffset_GetMapfv) + GL_STUB(glGetMapiv, _gloffset_GetMapiv) + GL_STUB(glGetMaterialfv, _gloffset_GetMaterialfv) + GL_STUB(glGetMaterialiv, _gloffset_GetMaterialiv) + GL_STUB(glGetPixelMapfv, _gloffset_GetPixelMapfv) + GL_STUB(glGetPixelMapuiv, _gloffset_GetPixelMapuiv) + GL_STUB(glGetPixelMapusv, _gloffset_GetPixelMapusv) + GL_STUB(glGetPolygonStipple, _gloffset_GetPolygonStipple) + GL_STUB(glGetString, _gloffset_GetString) + GL_STUB(glGetTexEnvfv, _gloffset_GetTexEnvfv) + GL_STUB(glGetTexEnviv, _gloffset_GetTexEnviv) + GL_STUB(glGetTexGendv, _gloffset_GetTexGendv) + GL_STUB(glGetTexGenfv, _gloffset_GetTexGenfv) + GL_STUB(glGetTexGeniv, _gloffset_GetTexGeniv) + GL_STUB(glGetTexImage, _gloffset_GetTexImage) + GL_STUB(glGetTexParameterfv, _gloffset_GetTexParameterfv) + GL_STUB(glGetTexParameteriv, _gloffset_GetTexParameteriv) + GL_STUB(glGetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv) + GL_STUB(glGetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv) + GL_STUB(glIsEnabled, _gloffset_IsEnabled) + GL_STUB(glIsList, _gloffset_IsList) + GL_STUB(glDepthRange, _gloffset_DepthRange) + GL_STUB(glFrustum, _gloffset_Frustum) + GL_STUB(glLoadIdentity, _gloffset_LoadIdentity) + GL_STUB(glLoadMatrixf, _gloffset_LoadMatrixf) + GL_STUB(glLoadMatrixd, _gloffset_LoadMatrixd) + GL_STUB(glMatrixMode, _gloffset_MatrixMode) + GL_STUB(glMultMatrixf, _gloffset_MultMatrixf) + GL_STUB(glMultMatrixd, _gloffset_MultMatrixd) + GL_STUB(glOrtho, _gloffset_Ortho) + GL_STUB(glPopMatrix, _gloffset_PopMatrix) + GL_STUB(glPushMatrix, _gloffset_PushMatrix) + GL_STUB(glRotated, _gloffset_Rotated) + GL_STUB(glRotatef, _gloffset_Rotatef) + GL_STUB(glScaled, _gloffset_Scaled) + GL_STUB(glScalef, _gloffset_Scalef) + GL_STUB(glTranslated, _gloffset_Translated) + GL_STUB(glTranslatef, _gloffset_Translatef) + GL_STUB(glViewport, _gloffset_Viewport) + GL_STUB(glArrayElement, _gloffset_ArrayElement) + GL_STUB(glBindTexture, _gloffset_BindTexture) + GL_STUB(glColorPointer, _gloffset_ColorPointer) + GL_STUB(glDisableClientState, _gloffset_DisableClientState) + GL_STUB(glDrawArrays, _gloffset_DrawArrays) + GL_STUB(glDrawElements, _gloffset_DrawElements) + GL_STUB(glEdgeFlagPointer, _gloffset_EdgeFlagPointer) + GL_STUB(glEnableClientState, _gloffset_EnableClientState) + GL_STUB(glIndexPointer, _gloffset_IndexPointer) + GL_STUB(glIndexub, _gloffset_Indexub) + GL_STUB(glIndexubv, _gloffset_Indexubv) + GL_STUB(glInterleavedArrays, _gloffset_InterleavedArrays) + GL_STUB(glNormalPointer, _gloffset_NormalPointer) + GL_STUB(glPolygonOffset, _gloffset_PolygonOffset) + GL_STUB(glTexCoordPointer, _gloffset_TexCoordPointer) + GL_STUB(glVertexPointer, _gloffset_VertexPointer) + GL_STUB(glAreTexturesResident, _gloffset_AreTexturesResident) + GL_STUB(glCopyTexImage1D, _gloffset_CopyTexImage1D) + GL_STUB(glCopyTexImage2D, _gloffset_CopyTexImage2D) + GL_STUB(glCopyTexSubImage1D, _gloffset_CopyTexSubImage1D) + GL_STUB(glCopyTexSubImage2D, _gloffset_CopyTexSubImage2D) + GL_STUB(glDeleteTextures, _gloffset_DeleteTextures) + GL_STUB(glGenTextures, _gloffset_GenTextures) + GL_STUB(glGetPointerv, _gloffset_GetPointerv) + GL_STUB(glIsTexture, _gloffset_IsTexture) + GL_STUB(glPrioritizeTextures, _gloffset_PrioritizeTextures) + GL_STUB(glTexSubImage1D, _gloffset_TexSubImage1D) + GL_STUB(glTexSubImage2D, _gloffset_TexSubImage2D) + GL_STUB(glPopClientAttrib, _gloffset_PopClientAttrib) + GL_STUB(glPushClientAttrib, _gloffset_PushClientAttrib) + GL_STUB(glBlendColor, _gloffset_BlendColor) + GL_STUB(glBlendEquation, _gloffset_BlendEquation) + GL_STUB(glDrawRangeElements, _gloffset_DrawRangeElements) + GL_STUB(glColorTable, _gloffset_ColorTable) + GL_STUB(glColorTableParameterfv, _gloffset_ColorTableParameterfv) + GL_STUB(glColorTableParameteriv, _gloffset_ColorTableParameteriv) + GL_STUB(glCopyColorTable, _gloffset_CopyColorTable) + GL_STUB(glGetColorTable, _gloffset_GetColorTable) + GL_STUB(glGetColorTableParameterfv, _gloffset_GetColorTableParameterfv) + GL_STUB(glGetColorTableParameteriv, _gloffset_GetColorTableParameteriv) + GL_STUB(glColorSubTable, _gloffset_ColorSubTable) + GL_STUB(glCopyColorSubTable, _gloffset_CopyColorSubTable) + GL_STUB(glConvolutionFilter1D, _gloffset_ConvolutionFilter1D) + GL_STUB(glConvolutionFilter2D, _gloffset_ConvolutionFilter2D) + GL_STUB(glConvolutionParameterf, _gloffset_ConvolutionParameterf) + GL_STUB(glConvolutionParameterfv, _gloffset_ConvolutionParameterfv) + GL_STUB(glConvolutionParameteri, _gloffset_ConvolutionParameteri) + GL_STUB(glConvolutionParameteriv, _gloffset_ConvolutionParameteriv) + GL_STUB(glCopyConvolutionFilter1D, _gloffset_CopyConvolutionFilter1D) + GL_STUB(glCopyConvolutionFilter2D, _gloffset_CopyConvolutionFilter2D) + GL_STUB(glGetConvolutionFilter, _gloffset_GetConvolutionFilter) + GL_STUB(glGetConvolutionParameterfv, _gloffset_GetConvolutionParameterfv) + GL_STUB(glGetConvolutionParameteriv, _gloffset_GetConvolutionParameteriv) + GL_STUB(glGetSeparableFilter, _gloffset_GetSeparableFilter) + GL_STUB(glSeparableFilter2D, _gloffset_SeparableFilter2D) + GL_STUB(glGetHistogram, _gloffset_GetHistogram) + GL_STUB(glGetHistogramParameterfv, _gloffset_GetHistogramParameterfv) + GL_STUB(glGetHistogramParameteriv, _gloffset_GetHistogramParameteriv) + GL_STUB(glGetMinmax, _gloffset_GetMinmax) + GL_STUB(glGetMinmaxParameterfv, _gloffset_GetMinmaxParameterfv) + GL_STUB(glGetMinmaxParameteriv, _gloffset_GetMinmaxParameteriv) + GL_STUB(glHistogram, _gloffset_Histogram) + GL_STUB(glMinmax, _gloffset_Minmax) + GL_STUB(glResetHistogram, _gloffset_ResetHistogram) + GL_STUB(glResetMinmax, _gloffset_ResetMinmax) + GL_STUB(glTexImage3D, _gloffset_TexImage3D) + GL_STUB(glTexSubImage3D, _gloffset_TexSubImage3D) + GL_STUB(glCopyTexSubImage3D, _gloffset_CopyTexSubImage3D) + GL_STUB(glActiveTextureARB, _gloffset_ActiveTextureARB) + GL_STUB(glClientActiveTextureARB, _gloffset_ClientActiveTextureARB) + GL_STUB(glMultiTexCoord1dARB, _gloffset_MultiTexCoord1dARB) + GL_STUB(glMultiTexCoord1dvARB, _gloffset_MultiTexCoord1dvARB) + GL_STUB(glMultiTexCoord1fARB, _gloffset_MultiTexCoord1fARB) + GL_STUB(glMultiTexCoord1fvARB, _gloffset_MultiTexCoord1fvARB) + GL_STUB(glMultiTexCoord1iARB, _gloffset_MultiTexCoord1iARB) + GL_STUB(glMultiTexCoord1ivARB, _gloffset_MultiTexCoord1ivARB) + GL_STUB(glMultiTexCoord1sARB, _gloffset_MultiTexCoord1sARB) + GL_STUB(glMultiTexCoord1svARB, _gloffset_MultiTexCoord1svARB) + GL_STUB(glMultiTexCoord2dARB, _gloffset_MultiTexCoord2dARB) + GL_STUB(glMultiTexCoord2dvARB, _gloffset_MultiTexCoord2dvARB) + GL_STUB(glMultiTexCoord2fARB, _gloffset_MultiTexCoord2fARB) + GL_STUB(glMultiTexCoord2fvARB, _gloffset_MultiTexCoord2fvARB) + GL_STUB(glMultiTexCoord2iARB, _gloffset_MultiTexCoord2iARB) + GL_STUB(glMultiTexCoord2ivARB, _gloffset_MultiTexCoord2ivARB) + GL_STUB(glMultiTexCoord2sARB, _gloffset_MultiTexCoord2sARB) + GL_STUB(glMultiTexCoord2svARB, _gloffset_MultiTexCoord2svARB) + GL_STUB(glMultiTexCoord3dARB, _gloffset_MultiTexCoord3dARB) + GL_STUB(glMultiTexCoord3dvARB, _gloffset_MultiTexCoord3dvARB) + GL_STUB(glMultiTexCoord3fARB, _gloffset_MultiTexCoord3fARB) + GL_STUB(glMultiTexCoord3fvARB, _gloffset_MultiTexCoord3fvARB) + GL_STUB(glMultiTexCoord3iARB, _gloffset_MultiTexCoord3iARB) + GL_STUB(glMultiTexCoord3ivARB, _gloffset_MultiTexCoord3ivARB) + GL_STUB(glMultiTexCoord3sARB, _gloffset_MultiTexCoord3sARB) + GL_STUB(glMultiTexCoord3svARB, _gloffset_MultiTexCoord3svARB) + GL_STUB(glMultiTexCoord4dARB, _gloffset_MultiTexCoord4dARB) + GL_STUB(glMultiTexCoord4dvARB, _gloffset_MultiTexCoord4dvARB) + GL_STUB(glMultiTexCoord4fARB, _gloffset_MultiTexCoord4fARB) + GL_STUB(glMultiTexCoord4fvARB, _gloffset_MultiTexCoord4fvARB) + GL_STUB(glMultiTexCoord4iARB, _gloffset_MultiTexCoord4iARB) + GL_STUB(glMultiTexCoord4ivARB, _gloffset_MultiTexCoord4ivARB) + GL_STUB(glMultiTexCoord4sARB, _gloffset_MultiTexCoord4sARB) + GL_STUB(glMultiTexCoord4svARB, _gloffset_MultiTexCoord4svARB) + GL_STUB(glAttachShader, _gloffset_AttachShader) + GL_STUB(glCreateProgram, _gloffset_CreateProgram) + GL_STUB(glCreateShader, _gloffset_CreateShader) + GL_STUB(glDeleteProgram, _gloffset_DeleteProgram) + GL_STUB(glDeleteShader, _gloffset_DeleteShader) + GL_STUB(glDetachShader, _gloffset_DetachShader) + GL_STUB(glGetAttachedShaders, _gloffset_GetAttachedShaders) + GL_STUB(glGetProgramInfoLog, _gloffset_GetProgramInfoLog) + GL_STUB(glGetProgramiv, _gloffset_GetProgramiv) + GL_STUB(glGetShaderInfoLog, _gloffset_GetShaderInfoLog) + GL_STUB(glGetShaderiv, _gloffset_GetShaderiv) + GL_STUB(glIsProgram, _gloffset_IsProgram) + GL_STUB(glIsShader, _gloffset_IsShader) + GL_STUB(glStencilFuncSeparate, _gloffset_StencilFuncSeparate) + GL_STUB(glStencilMaskSeparate, _gloffset_StencilMaskSeparate) + GL_STUB(glStencilOpSeparate, _gloffset_StencilOpSeparate) + GL_STUB(glUniformMatrix2x3fv, _gloffset_UniformMatrix2x3fv) + GL_STUB(glUniformMatrix2x4fv, _gloffset_UniformMatrix2x4fv) + GL_STUB(glUniformMatrix3x2fv, _gloffset_UniformMatrix3x2fv) + GL_STUB(glUniformMatrix3x4fv, _gloffset_UniformMatrix3x4fv) + GL_STUB(glUniformMatrix4x2fv, _gloffset_UniformMatrix4x2fv) + GL_STUB(glUniformMatrix4x3fv, _gloffset_UniformMatrix4x3fv) + GL_STUB(glDrawArraysInstanced, _gloffset_DrawArraysInstanced) + GL_STUB(glDrawElementsInstanced, _gloffset_DrawElementsInstanced) + GL_STUB(glLoadTransposeMatrixdARB, _gloffset_LoadTransposeMatrixdARB) + GL_STUB(glLoadTransposeMatrixfARB, _gloffset_LoadTransposeMatrixfARB) + GL_STUB(glMultTransposeMatrixdARB, _gloffset_MultTransposeMatrixdARB) + GL_STUB(glMultTransposeMatrixfARB, _gloffset_MultTransposeMatrixfARB) + GL_STUB(glSampleCoverageARB, _gloffset_SampleCoverageARB) + GL_STUB(glCompressedTexImage1DARB, _gloffset_CompressedTexImage1DARB) + GL_STUB(glCompressedTexImage2DARB, _gloffset_CompressedTexImage2DARB) + GL_STUB(glCompressedTexImage3DARB, _gloffset_CompressedTexImage3DARB) + GL_STUB(glCompressedTexSubImage1DARB, _gloffset_CompressedTexSubImage1DARB) + GL_STUB(glCompressedTexSubImage2DARB, _gloffset_CompressedTexSubImage2DARB) + GL_STUB(glCompressedTexSubImage3DARB, _gloffset_CompressedTexSubImage3DARB) + GL_STUB(glGetCompressedTexImageARB, _gloffset_GetCompressedTexImageARB) + GL_STUB(glDisableVertexAttribArrayARB, _gloffset_DisableVertexAttribArrayARB) + GL_STUB(glEnableVertexAttribArrayARB, _gloffset_EnableVertexAttribArrayARB) + GL_STUB(glGetProgramEnvParameterdvARB, _gloffset_GetProgramEnvParameterdvARB) + GL_STUB(glGetProgramEnvParameterfvARB, _gloffset_GetProgramEnvParameterfvARB) + GL_STUB(glGetProgramLocalParameterdvARB, _gloffset_GetProgramLocalParameterdvARB) + GL_STUB(glGetProgramLocalParameterfvARB, _gloffset_GetProgramLocalParameterfvARB) + GL_STUB(glGetProgramStringARB, _gloffset_GetProgramStringARB) + GL_STUB(glGetProgramivARB, _gloffset_GetProgramivARB) + GL_STUB(glGetVertexAttribdvARB, _gloffset_GetVertexAttribdvARB) + GL_STUB(glGetVertexAttribfvARB, _gloffset_GetVertexAttribfvARB) + GL_STUB(glGetVertexAttribivARB, _gloffset_GetVertexAttribivARB) + GL_STUB(glProgramEnvParameter4dARB, _gloffset_ProgramEnvParameter4dARB) + GL_STUB(glProgramEnvParameter4dvARB, _gloffset_ProgramEnvParameter4dvARB) + GL_STUB(glProgramEnvParameter4fARB, _gloffset_ProgramEnvParameter4fARB) + GL_STUB(glProgramEnvParameter4fvARB, _gloffset_ProgramEnvParameter4fvARB) + GL_STUB(glProgramLocalParameter4dARB, _gloffset_ProgramLocalParameter4dARB) + GL_STUB(glProgramLocalParameter4dvARB, _gloffset_ProgramLocalParameter4dvARB) + GL_STUB(glProgramLocalParameter4fARB, _gloffset_ProgramLocalParameter4fARB) + GL_STUB(glProgramLocalParameter4fvARB, _gloffset_ProgramLocalParameter4fvARB) + GL_STUB(glProgramStringARB, _gloffset_ProgramStringARB) + GL_STUB(glVertexAttrib1dARB, _gloffset_VertexAttrib1dARB) + GL_STUB(glVertexAttrib1dvARB, _gloffset_VertexAttrib1dvARB) + GL_STUB(glVertexAttrib1fARB, _gloffset_VertexAttrib1fARB) + GL_STUB(glVertexAttrib1fvARB, _gloffset_VertexAttrib1fvARB) + GL_STUB(glVertexAttrib1sARB, _gloffset_VertexAttrib1sARB) + GL_STUB(glVertexAttrib1svARB, _gloffset_VertexAttrib1svARB) + GL_STUB(glVertexAttrib2dARB, _gloffset_VertexAttrib2dARB) + GL_STUB(glVertexAttrib2dvARB, _gloffset_VertexAttrib2dvARB) + GL_STUB(glVertexAttrib2fARB, _gloffset_VertexAttrib2fARB) + GL_STUB(glVertexAttrib2fvARB, _gloffset_VertexAttrib2fvARB) + GL_STUB(glVertexAttrib2sARB, _gloffset_VertexAttrib2sARB) + GL_STUB(glVertexAttrib2svARB, _gloffset_VertexAttrib2svARB) + GL_STUB(glVertexAttrib3dARB, _gloffset_VertexAttrib3dARB) + GL_STUB(glVertexAttrib3dvARB, _gloffset_VertexAttrib3dvARB) + GL_STUB(glVertexAttrib3fARB, _gloffset_VertexAttrib3fARB) + GL_STUB(glVertexAttrib3fvARB, _gloffset_VertexAttrib3fvARB) + GL_STUB(glVertexAttrib3sARB, _gloffset_VertexAttrib3sARB) + GL_STUB(glVertexAttrib3svARB, _gloffset_VertexAttrib3svARB) + GL_STUB(glVertexAttrib4NbvARB, _gloffset_VertexAttrib4NbvARB) + GL_STUB(glVertexAttrib4NivARB, _gloffset_VertexAttrib4NivARB) + GL_STUB(glVertexAttrib4NsvARB, _gloffset_VertexAttrib4NsvARB) + GL_STUB(glVertexAttrib4NubARB, _gloffset_VertexAttrib4NubARB) + GL_STUB(glVertexAttrib4NubvARB, _gloffset_VertexAttrib4NubvARB) + GL_STUB(glVertexAttrib4NuivARB, _gloffset_VertexAttrib4NuivARB) + GL_STUB(glVertexAttrib4NusvARB, _gloffset_VertexAttrib4NusvARB) + GL_STUB(glVertexAttrib4bvARB, _gloffset_VertexAttrib4bvARB) + GL_STUB(glVertexAttrib4dARB, _gloffset_VertexAttrib4dARB) + GL_STUB(glVertexAttrib4dvARB, _gloffset_VertexAttrib4dvARB) + GL_STUB(glVertexAttrib4fARB, _gloffset_VertexAttrib4fARB) + GL_STUB(glVertexAttrib4fvARB, _gloffset_VertexAttrib4fvARB) + GL_STUB(glVertexAttrib4ivARB, _gloffset_VertexAttrib4ivARB) + GL_STUB(glVertexAttrib4sARB, _gloffset_VertexAttrib4sARB) + GL_STUB(glVertexAttrib4svARB, _gloffset_VertexAttrib4svARB) + GL_STUB(glVertexAttrib4ubvARB, _gloffset_VertexAttrib4ubvARB) + GL_STUB(glVertexAttrib4uivARB, _gloffset_VertexAttrib4uivARB) + GL_STUB(glVertexAttrib4usvARB, _gloffset_VertexAttrib4usvARB) + GL_STUB(glVertexAttribPointerARB, _gloffset_VertexAttribPointerARB) + GL_STUB(glBindBufferARB, _gloffset_BindBufferARB) + GL_STUB(glBufferDataARB, _gloffset_BufferDataARB) + GL_STUB(glBufferSubDataARB, _gloffset_BufferSubDataARB) + GL_STUB(glDeleteBuffersARB, _gloffset_DeleteBuffersARB) + GL_STUB(glGenBuffersARB, _gloffset_GenBuffersARB) + GL_STUB(glGetBufferParameterivARB, _gloffset_GetBufferParameterivARB) + GL_STUB(glGetBufferPointervARB, _gloffset_GetBufferPointervARB) + GL_STUB(glGetBufferSubDataARB, _gloffset_GetBufferSubDataARB) + GL_STUB(glIsBufferARB, _gloffset_IsBufferARB) + GL_STUB(glMapBufferARB, _gloffset_MapBufferARB) + GL_STUB(glUnmapBufferARB, _gloffset_UnmapBufferARB) + GL_STUB(glBeginQueryARB, _gloffset_BeginQueryARB) + GL_STUB(glDeleteQueriesARB, _gloffset_DeleteQueriesARB) + GL_STUB(glEndQueryARB, _gloffset_EndQueryARB) + GL_STUB(glGenQueriesARB, _gloffset_GenQueriesARB) + GL_STUB(glGetQueryObjectivARB, _gloffset_GetQueryObjectivARB) + GL_STUB(glGetQueryObjectuivARB, _gloffset_GetQueryObjectuivARB) + GL_STUB(glGetQueryivARB, _gloffset_GetQueryivARB) + GL_STUB(glIsQueryARB, _gloffset_IsQueryARB) + GL_STUB(glAttachObjectARB, _gloffset_AttachObjectARB) + GL_STUB(glCompileShaderARB, _gloffset_CompileShaderARB) + GL_STUB(glCreateProgramObjectARB, _gloffset_CreateProgramObjectARB) + GL_STUB(glCreateShaderObjectARB, _gloffset_CreateShaderObjectARB) + GL_STUB(glDeleteObjectARB, _gloffset_DeleteObjectARB) + GL_STUB(glDetachObjectARB, _gloffset_DetachObjectARB) + GL_STUB(glGetActiveUniformARB, _gloffset_GetActiveUniformARB) + GL_STUB(glGetAttachedObjectsARB, _gloffset_GetAttachedObjectsARB) + GL_STUB(glGetHandleARB, _gloffset_GetHandleARB) + GL_STUB(glGetInfoLogARB, _gloffset_GetInfoLogARB) + GL_STUB(glGetObjectParameterfvARB, _gloffset_GetObjectParameterfvARB) + GL_STUB(glGetObjectParameterivARB, _gloffset_GetObjectParameterivARB) + GL_STUB(glGetShaderSourceARB, _gloffset_GetShaderSourceARB) + GL_STUB(glGetUniformLocationARB, _gloffset_GetUniformLocationARB) + GL_STUB(glGetUniformfvARB, _gloffset_GetUniformfvARB) + GL_STUB(glGetUniformivARB, _gloffset_GetUniformivARB) + GL_STUB(glLinkProgramARB, _gloffset_LinkProgramARB) + GL_STUB(glShaderSourceARB, _gloffset_ShaderSourceARB) + GL_STUB(glUniform1fARB, _gloffset_Uniform1fARB) + GL_STUB(glUniform1fvARB, _gloffset_Uniform1fvARB) + GL_STUB(glUniform1iARB, _gloffset_Uniform1iARB) + GL_STUB(glUniform1ivARB, _gloffset_Uniform1ivARB) + GL_STUB(glUniform2fARB, _gloffset_Uniform2fARB) + GL_STUB(glUniform2fvARB, _gloffset_Uniform2fvARB) + GL_STUB(glUniform2iARB, _gloffset_Uniform2iARB) + GL_STUB(glUniform2ivARB, _gloffset_Uniform2ivARB) + GL_STUB(glUniform3fARB, _gloffset_Uniform3fARB) + GL_STUB(glUniform3fvARB, _gloffset_Uniform3fvARB) + GL_STUB(glUniform3iARB, _gloffset_Uniform3iARB) + GL_STUB(glUniform3ivARB, _gloffset_Uniform3ivARB) + GL_STUB(glUniform4fARB, _gloffset_Uniform4fARB) + GL_STUB(glUniform4fvARB, _gloffset_Uniform4fvARB) + GL_STUB(glUniform4iARB, _gloffset_Uniform4iARB) + GL_STUB(glUniform4ivARB, _gloffset_Uniform4ivARB) + GL_STUB(glUniformMatrix2fvARB, _gloffset_UniformMatrix2fvARB) + GL_STUB(glUniformMatrix3fvARB, _gloffset_UniformMatrix3fvARB) + GL_STUB(glUniformMatrix4fvARB, _gloffset_UniformMatrix4fvARB) + GL_STUB(glUseProgramObjectARB, _gloffset_UseProgramObjectARB) + GL_STUB(glValidateProgramARB, _gloffset_ValidateProgramARB) + GL_STUB(glBindAttribLocationARB, _gloffset_BindAttribLocationARB) + GL_STUB(glGetActiveAttribARB, _gloffset_GetActiveAttribARB) + GL_STUB(glGetAttribLocationARB, _gloffset_GetAttribLocationARB) + GL_STUB(glDrawBuffersARB, _gloffset_DrawBuffersARB) + GL_STUB(glRenderbufferStorageMultisample, _gloffset_RenderbufferStorageMultisample) + GL_STUB(glFramebufferTextureARB, _gloffset_FramebufferTextureARB) + GL_STUB(glFramebufferTextureFaceARB, _gloffset_FramebufferTextureFaceARB) + GL_STUB(glProgramParameteriARB, _gloffset_ProgramParameteriARB) + GL_STUB(glFlushMappedBufferRange, _gloffset_FlushMappedBufferRange) + GL_STUB(glMapBufferRange, _gloffset_MapBufferRange) + GL_STUB(glBindVertexArray, _gloffset_BindVertexArray) + GL_STUB(glGenVertexArrays, _gloffset_GenVertexArrays) + GL_STUB(glCopyBufferSubData, _gloffset_CopyBufferSubData) + GL_STUB(glClientWaitSync, _gloffset_ClientWaitSync) + GL_STUB(glDeleteSync, _gloffset_DeleteSync) + GL_STUB(glFenceSync, _gloffset_FenceSync) + GL_STUB(glGetInteger64v, _gloffset_GetInteger64v) + GL_STUB(glGetSynciv, _gloffset_GetSynciv) + GL_STUB(glIsSync, _gloffset_IsSync) + GL_STUB(glWaitSync, _gloffset_WaitSync) + GL_STUB(glDrawElementsBaseVertex, _gloffset_DrawElementsBaseVertex) + GL_STUB(glDrawRangeElementsBaseVertex, _gloffset_DrawRangeElementsBaseVertex) + GL_STUB(glMultiDrawElementsBaseVertex, _gloffset_MultiDrawElementsBaseVertex) + GL_STUB(glBindTransformFeedback, _gloffset_BindTransformFeedback) + GL_STUB(glDeleteTransformFeedbacks, _gloffset_DeleteTransformFeedbacks) + GL_STUB(glDrawTransformFeedback, _gloffset_DrawTransformFeedback) + GL_STUB(glGenTransformFeedbacks, _gloffset_GenTransformFeedbacks) + GL_STUB(glIsTransformFeedback, _gloffset_IsTransformFeedback) + GL_STUB(glPauseTransformFeedback, _gloffset_PauseTransformFeedback) + GL_STUB(glResumeTransformFeedback, _gloffset_ResumeTransformFeedback) + GL_STUB(glPolygonOffsetEXT, _gloffset_PolygonOffsetEXT) + GL_STUB(gl_dispatch_stub_590, _gloffset_GetPixelTexGenParameterfvSGIS) + HIDDEN(gl_dispatch_stub_590) + GL_STUB(gl_dispatch_stub_591, _gloffset_GetPixelTexGenParameterivSGIS) + HIDDEN(gl_dispatch_stub_591) + GL_STUB(gl_dispatch_stub_592, _gloffset_PixelTexGenParameterfSGIS) + HIDDEN(gl_dispatch_stub_592) + GL_STUB(gl_dispatch_stub_593, _gloffset_PixelTexGenParameterfvSGIS) + HIDDEN(gl_dispatch_stub_593) + GL_STUB(gl_dispatch_stub_594, _gloffset_PixelTexGenParameteriSGIS) + HIDDEN(gl_dispatch_stub_594) + GL_STUB(gl_dispatch_stub_595, _gloffset_PixelTexGenParameterivSGIS) + HIDDEN(gl_dispatch_stub_595) + GL_STUB(gl_dispatch_stub_596, _gloffset_SampleMaskSGIS) + HIDDEN(gl_dispatch_stub_596) + GL_STUB(gl_dispatch_stub_597, _gloffset_SamplePatternSGIS) + HIDDEN(gl_dispatch_stub_597) + GL_STUB(glColorPointerEXT, _gloffset_ColorPointerEXT) + GL_STUB(glEdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT) + GL_STUB(glIndexPointerEXT, _gloffset_IndexPointerEXT) + GL_STUB(glNormalPointerEXT, _gloffset_NormalPointerEXT) + GL_STUB(glTexCoordPointerEXT, _gloffset_TexCoordPointerEXT) + GL_STUB(glVertexPointerEXT, _gloffset_VertexPointerEXT) + GL_STUB(glPointParameterfEXT, _gloffset_PointParameterfEXT) + GL_STUB(glPointParameterfvEXT, _gloffset_PointParameterfvEXT) + GL_STUB(glLockArraysEXT, _gloffset_LockArraysEXT) + GL_STUB(glUnlockArraysEXT, _gloffset_UnlockArraysEXT) + GL_STUB(gl_dispatch_stub_608, _gloffset_CullParameterdvEXT) + HIDDEN(gl_dispatch_stub_608) + GL_STUB(gl_dispatch_stub_609, _gloffset_CullParameterfvEXT) + HIDDEN(gl_dispatch_stub_609) + GL_STUB(glSecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT) + GL_STUB(glSecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT) + GL_STUB(glSecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT) + GL_STUB(glSecondaryColor3dvEXT, _gloffset_SecondaryColor3dvEXT) + GL_STUB(glSecondaryColor3fEXT, _gloffset_SecondaryColor3fEXT) + GL_STUB(glSecondaryColor3fvEXT, _gloffset_SecondaryColor3fvEXT) + GL_STUB(glSecondaryColor3iEXT, _gloffset_SecondaryColor3iEXT) + GL_STUB(glSecondaryColor3ivEXT, _gloffset_SecondaryColor3ivEXT) + GL_STUB(glSecondaryColor3sEXT, _gloffset_SecondaryColor3sEXT) + GL_STUB(glSecondaryColor3svEXT, _gloffset_SecondaryColor3svEXT) + GL_STUB(glSecondaryColor3ubEXT, _gloffset_SecondaryColor3ubEXT) + GL_STUB(glSecondaryColor3ubvEXT, _gloffset_SecondaryColor3ubvEXT) + GL_STUB(glSecondaryColor3uiEXT, _gloffset_SecondaryColor3uiEXT) + GL_STUB(glSecondaryColor3uivEXT, _gloffset_SecondaryColor3uivEXT) + GL_STUB(glSecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT) + GL_STUB(glSecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT) + GL_STUB(glSecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT) + GL_STUB(glMultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT) + GL_STUB(glMultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT) + GL_STUB(glFogCoordPointerEXT, _gloffset_FogCoordPointerEXT) + GL_STUB(glFogCoorddEXT, _gloffset_FogCoorddEXT) + GL_STUB(glFogCoorddvEXT, _gloffset_FogCoorddvEXT) + GL_STUB(glFogCoordfEXT, _gloffset_FogCoordfEXT) + GL_STUB(glFogCoordfvEXT, _gloffset_FogCoordfvEXT) + GL_STUB(gl_dispatch_stub_634, _gloffset_PixelTexGenSGIX) + HIDDEN(gl_dispatch_stub_634) + GL_STUB(glBlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT) + GL_STUB(glFlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV) + GL_STUB(glVertexArrayRangeNV, _gloffset_VertexArrayRangeNV) + GL_STUB(glCombinerInputNV, _gloffset_CombinerInputNV) + GL_STUB(glCombinerOutputNV, _gloffset_CombinerOutputNV) + GL_STUB(glCombinerParameterfNV, _gloffset_CombinerParameterfNV) + GL_STUB(glCombinerParameterfvNV, _gloffset_CombinerParameterfvNV) + GL_STUB(glCombinerParameteriNV, _gloffset_CombinerParameteriNV) + GL_STUB(glCombinerParameterivNV, _gloffset_CombinerParameterivNV) + GL_STUB(glFinalCombinerInputNV, _gloffset_FinalCombinerInputNV) + GL_STUB(glGetCombinerInputParameterfvNV, _gloffset_GetCombinerInputParameterfvNV) + GL_STUB(glGetCombinerInputParameterivNV, _gloffset_GetCombinerInputParameterivNV) + GL_STUB(glGetCombinerOutputParameterfvNV, _gloffset_GetCombinerOutputParameterfvNV) + GL_STUB(glGetCombinerOutputParameterivNV, _gloffset_GetCombinerOutputParameterivNV) + GL_STUB(glGetFinalCombinerInputParameterfvNV, _gloffset_GetFinalCombinerInputParameterfvNV) + GL_STUB(glGetFinalCombinerInputParameterivNV, _gloffset_GetFinalCombinerInputParameterivNV) + GL_STUB(glResizeBuffersMESA, _gloffset_ResizeBuffersMESA) + GL_STUB(glWindowPos2dMESA, _gloffset_WindowPos2dMESA) + GL_STUB(glWindowPos2dvMESA, _gloffset_WindowPos2dvMESA) + GL_STUB(glWindowPos2fMESA, _gloffset_WindowPos2fMESA) + GL_STUB(glWindowPos2fvMESA, _gloffset_WindowPos2fvMESA) + GL_STUB(glWindowPos2iMESA, _gloffset_WindowPos2iMESA) + GL_STUB(glWindowPos2ivMESA, _gloffset_WindowPos2ivMESA) + GL_STUB(glWindowPos2sMESA, _gloffset_WindowPos2sMESA) + GL_STUB(glWindowPos2svMESA, _gloffset_WindowPos2svMESA) + GL_STUB(glWindowPos3dMESA, _gloffset_WindowPos3dMESA) + GL_STUB(glWindowPos3dvMESA, _gloffset_WindowPos3dvMESA) + GL_STUB(glWindowPos3fMESA, _gloffset_WindowPos3fMESA) + GL_STUB(glWindowPos3fvMESA, _gloffset_WindowPos3fvMESA) + GL_STUB(glWindowPos3iMESA, _gloffset_WindowPos3iMESA) + GL_STUB(glWindowPos3ivMESA, _gloffset_WindowPos3ivMESA) + GL_STUB(glWindowPos3sMESA, _gloffset_WindowPos3sMESA) + GL_STUB(glWindowPos3svMESA, _gloffset_WindowPos3svMESA) + GL_STUB(glWindowPos4dMESA, _gloffset_WindowPos4dMESA) + GL_STUB(glWindowPos4dvMESA, _gloffset_WindowPos4dvMESA) + GL_STUB(glWindowPos4fMESA, _gloffset_WindowPos4fMESA) + GL_STUB(glWindowPos4fvMESA, _gloffset_WindowPos4fvMESA) + GL_STUB(glWindowPos4iMESA, _gloffset_WindowPos4iMESA) + GL_STUB(glWindowPos4ivMESA, _gloffset_WindowPos4ivMESA) + GL_STUB(glWindowPos4sMESA, _gloffset_WindowPos4sMESA) + GL_STUB(glWindowPos4svMESA, _gloffset_WindowPos4svMESA) + GL_STUB(gl_dispatch_stub_676, _gloffset_MultiModeDrawArraysIBM) + HIDDEN(gl_dispatch_stub_676) + GL_STUB(gl_dispatch_stub_677, _gloffset_MultiModeDrawElementsIBM) + HIDDEN(gl_dispatch_stub_677) + GL_STUB(gl_dispatch_stub_678, _gloffset_DeleteFencesNV) + HIDDEN(gl_dispatch_stub_678) + GL_STUB(gl_dispatch_stub_679, _gloffset_FinishFenceNV) + HIDDEN(gl_dispatch_stub_679) + GL_STUB(gl_dispatch_stub_680, _gloffset_GenFencesNV) + HIDDEN(gl_dispatch_stub_680) + GL_STUB(gl_dispatch_stub_681, _gloffset_GetFenceivNV) + HIDDEN(gl_dispatch_stub_681) + GL_STUB(gl_dispatch_stub_682, _gloffset_IsFenceNV) + HIDDEN(gl_dispatch_stub_682) + GL_STUB(gl_dispatch_stub_683, _gloffset_SetFenceNV) + HIDDEN(gl_dispatch_stub_683) + GL_STUB(gl_dispatch_stub_684, _gloffset_TestFenceNV) + HIDDEN(gl_dispatch_stub_684) + GL_STUB(glAreProgramsResidentNV, _gloffset_AreProgramsResidentNV) + GL_STUB(glBindProgramNV, _gloffset_BindProgramNV) + GL_STUB(glDeleteProgramsNV, _gloffset_DeleteProgramsNV) + GL_STUB(glExecuteProgramNV, _gloffset_ExecuteProgramNV) + GL_STUB(glGenProgramsNV, _gloffset_GenProgramsNV) + GL_STUB(glGetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV) + GL_STUB(glGetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV) + GL_STUB(glGetProgramStringNV, _gloffset_GetProgramStringNV) + GL_STUB(glGetProgramivNV, _gloffset_GetProgramivNV) + GL_STUB(glGetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV) + GL_STUB(glGetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV) + GL_STUB(glGetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV) + GL_STUB(glGetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV) + GL_STUB(glGetVertexAttribivNV, _gloffset_GetVertexAttribivNV) + GL_STUB(glIsProgramNV, _gloffset_IsProgramNV) + GL_STUB(glLoadProgramNV, _gloffset_LoadProgramNV) + GL_STUB(glProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV) + GL_STUB(glProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV) + GL_STUB(glRequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV) + GL_STUB(glTrackMatrixNV, _gloffset_TrackMatrixNV) + GL_STUB(glVertexAttrib1dNV, _gloffset_VertexAttrib1dNV) + GL_STUB(glVertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV) + GL_STUB(glVertexAttrib1fNV, _gloffset_VertexAttrib1fNV) + GL_STUB(glVertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV) + GL_STUB(glVertexAttrib1sNV, _gloffset_VertexAttrib1sNV) + GL_STUB(glVertexAttrib1svNV, _gloffset_VertexAttrib1svNV) + GL_STUB(glVertexAttrib2dNV, _gloffset_VertexAttrib2dNV) + GL_STUB(glVertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV) + GL_STUB(glVertexAttrib2fNV, _gloffset_VertexAttrib2fNV) + GL_STUB(glVertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV) + GL_STUB(glVertexAttrib2sNV, _gloffset_VertexAttrib2sNV) + GL_STUB(glVertexAttrib2svNV, _gloffset_VertexAttrib2svNV) + GL_STUB(glVertexAttrib3dNV, _gloffset_VertexAttrib3dNV) + GL_STUB(glVertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV) + GL_STUB(glVertexAttrib3fNV, _gloffset_VertexAttrib3fNV) + GL_STUB(glVertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV) + GL_STUB(glVertexAttrib3sNV, _gloffset_VertexAttrib3sNV) + GL_STUB(glVertexAttrib3svNV, _gloffset_VertexAttrib3svNV) + GL_STUB(glVertexAttrib4dNV, _gloffset_VertexAttrib4dNV) + GL_STUB(glVertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV) + GL_STUB(glVertexAttrib4fNV, _gloffset_VertexAttrib4fNV) + GL_STUB(glVertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV) + GL_STUB(glVertexAttrib4sNV, _gloffset_VertexAttrib4sNV) + GL_STUB(glVertexAttrib4svNV, _gloffset_VertexAttrib4svNV) + GL_STUB(glVertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV) + GL_STUB(glVertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV) + GL_STUB(glVertexAttribPointerNV, _gloffset_VertexAttribPointerNV) + GL_STUB(glVertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV) + GL_STUB(glVertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV) + GL_STUB(glVertexAttribs1svNV, _gloffset_VertexAttribs1svNV) + GL_STUB(glVertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV) + GL_STUB(glVertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV) + GL_STUB(glVertexAttribs2svNV, _gloffset_VertexAttribs2svNV) + GL_STUB(glVertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV) + GL_STUB(glVertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV) + GL_STUB(glVertexAttribs3svNV, _gloffset_VertexAttribs3svNV) + GL_STUB(glVertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV) + GL_STUB(glVertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV) + GL_STUB(glVertexAttribs4svNV, _gloffset_VertexAttribs4svNV) + GL_STUB(glVertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV) + GL_STUB(glGetTexBumpParameterfvATI, _gloffset_GetTexBumpParameterfvATI) + GL_STUB(glGetTexBumpParameterivATI, _gloffset_GetTexBumpParameterivATI) + GL_STUB(glTexBumpParameterfvATI, _gloffset_TexBumpParameterfvATI) + GL_STUB(glTexBumpParameterivATI, _gloffset_TexBumpParameterivATI) + GL_STUB(glAlphaFragmentOp1ATI, _gloffset_AlphaFragmentOp1ATI) + GL_STUB(glAlphaFragmentOp2ATI, _gloffset_AlphaFragmentOp2ATI) + GL_STUB(glAlphaFragmentOp3ATI, _gloffset_AlphaFragmentOp3ATI) + GL_STUB(glBeginFragmentShaderATI, _gloffset_BeginFragmentShaderATI) + GL_STUB(glBindFragmentShaderATI, _gloffset_BindFragmentShaderATI) + GL_STUB(glColorFragmentOp1ATI, _gloffset_ColorFragmentOp1ATI) + GL_STUB(glColorFragmentOp2ATI, _gloffset_ColorFragmentOp2ATI) + GL_STUB(glColorFragmentOp3ATI, _gloffset_ColorFragmentOp3ATI) + GL_STUB(glDeleteFragmentShaderATI, _gloffset_DeleteFragmentShaderATI) + GL_STUB(glEndFragmentShaderATI, _gloffset_EndFragmentShaderATI) + GL_STUB(glGenFragmentShadersATI, _gloffset_GenFragmentShadersATI) + GL_STUB(glPassTexCoordATI, _gloffset_PassTexCoordATI) + GL_STUB(glSampleMapATI, _gloffset_SampleMapATI) + GL_STUB(glSetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI) + GL_STUB(glPointParameteriNV, _gloffset_PointParameteriNV) + GL_STUB(glPointParameterivNV, _gloffset_PointParameterivNV) + GL_STUB(gl_dispatch_stub_765, _gloffset_ActiveStencilFaceEXT) + HIDDEN(gl_dispatch_stub_765) + GL_STUB(gl_dispatch_stub_766, _gloffset_BindVertexArrayAPPLE) + HIDDEN(gl_dispatch_stub_766) + GL_STUB(gl_dispatch_stub_767, _gloffset_DeleteVertexArraysAPPLE) + HIDDEN(gl_dispatch_stub_767) + GL_STUB(gl_dispatch_stub_768, _gloffset_GenVertexArraysAPPLE) + HIDDEN(gl_dispatch_stub_768) + GL_STUB(gl_dispatch_stub_769, _gloffset_IsVertexArrayAPPLE) + HIDDEN(gl_dispatch_stub_769) + GL_STUB(glGetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV) + GL_STUB(glGetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV) + GL_STUB(glProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV) + GL_STUB(glProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV) + GL_STUB(glProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV) + GL_STUB(glProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV) + GL_STUB(gl_dispatch_stub_776, _gloffset_DepthBoundsEXT) + HIDDEN(gl_dispatch_stub_776) + GL_STUB(gl_dispatch_stub_777, _gloffset_BlendEquationSeparateEXT) + HIDDEN(gl_dispatch_stub_777) + GL_STUB(glBindFramebufferEXT, _gloffset_BindFramebufferEXT) + GL_STUB(glBindRenderbufferEXT, _gloffset_BindRenderbufferEXT) + GL_STUB(glCheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT) + GL_STUB(glDeleteFramebuffersEXT, _gloffset_DeleteFramebuffersEXT) + GL_STUB(glDeleteRenderbuffersEXT, _gloffset_DeleteRenderbuffersEXT) + GL_STUB(glFramebufferRenderbufferEXT, _gloffset_FramebufferRenderbufferEXT) + GL_STUB(glFramebufferTexture1DEXT, _gloffset_FramebufferTexture1DEXT) + GL_STUB(glFramebufferTexture2DEXT, _gloffset_FramebufferTexture2DEXT) + GL_STUB(glFramebufferTexture3DEXT, _gloffset_FramebufferTexture3DEXT) + GL_STUB(glGenFramebuffersEXT, _gloffset_GenFramebuffersEXT) + GL_STUB(glGenRenderbuffersEXT, _gloffset_GenRenderbuffersEXT) + GL_STUB(glGenerateMipmapEXT, _gloffset_GenerateMipmapEXT) + GL_STUB(glGetFramebufferAttachmentParameterivEXT, _gloffset_GetFramebufferAttachmentParameterivEXT) + GL_STUB(glGetRenderbufferParameterivEXT, _gloffset_GetRenderbufferParameterivEXT) + GL_STUB(glIsFramebufferEXT, _gloffset_IsFramebufferEXT) + GL_STUB(glIsRenderbufferEXT, _gloffset_IsRenderbufferEXT) + GL_STUB(glRenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT) + GL_STUB(gl_dispatch_stub_795, _gloffset_BlitFramebufferEXT) + HIDDEN(gl_dispatch_stub_795) + GL_STUB(gl_dispatch_stub_796, _gloffset_BufferParameteriAPPLE) + HIDDEN(gl_dispatch_stub_796) + GL_STUB(gl_dispatch_stub_797, _gloffset_FlushMappedBufferRangeAPPLE) + HIDDEN(gl_dispatch_stub_797) + GL_STUB(glFramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT) + GL_STUB(glColorMaskIndexedEXT, _gloffset_ColorMaskIndexedEXT) + GL_STUB(glDisableIndexedEXT, _gloffset_DisableIndexedEXT) + GL_STUB(glEnableIndexedEXT, _gloffset_EnableIndexedEXT) + GL_STUB(glGetBooleanIndexedvEXT, _gloffset_GetBooleanIndexedvEXT) + GL_STUB(glGetIntegerIndexedvEXT, _gloffset_GetIntegerIndexedvEXT) + GL_STUB(glIsEnabledIndexedEXT, _gloffset_IsEnabledIndexedEXT) + GL_STUB(glBeginConditionalRenderNV, _gloffset_BeginConditionalRenderNV) + GL_STUB(glEndConditionalRenderNV, _gloffset_EndConditionalRenderNV) + GL_STUB(glBeginTransformFeedbackEXT, _gloffset_BeginTransformFeedbackEXT) + GL_STUB(glBindBufferBaseEXT, _gloffset_BindBufferBaseEXT) + GL_STUB(glBindBufferOffsetEXT, _gloffset_BindBufferOffsetEXT) + GL_STUB(glBindBufferRangeEXT, _gloffset_BindBufferRangeEXT) + GL_STUB(glEndTransformFeedbackEXT, _gloffset_EndTransformFeedbackEXT) + GL_STUB(glGetTransformFeedbackVaryingEXT, _gloffset_GetTransformFeedbackVaryingEXT) + GL_STUB(glTransformFeedbackVaryingsEXT, _gloffset_TransformFeedbackVaryingsEXT) + GL_STUB(glProvokingVertexEXT, _gloffset_ProvokingVertexEXT) + GL_STUB(gl_dispatch_stub_815, _gloffset_GetTexParameterPointervAPPLE) + HIDDEN(gl_dispatch_stub_815) + GL_STUB(gl_dispatch_stub_816, _gloffset_TextureRangeAPPLE) + HIDDEN(gl_dispatch_stub_816) + GL_STUB(glGetObjectParameterivAPPLE, _gloffset_GetObjectParameterivAPPLE) + GL_STUB(glObjectPurgeableAPPLE, _gloffset_ObjectPurgeableAPPLE) + GL_STUB(glObjectUnpurgeableAPPLE, _gloffset_ObjectUnpurgeableAPPLE) + GL_STUB(gl_dispatch_stub_820, _gloffset_StencilFuncSeparateATI) + HIDDEN(gl_dispatch_stub_820) + GL_STUB(gl_dispatch_stub_821, _gloffset_ProgramEnvParameters4fvEXT) + HIDDEN(gl_dispatch_stub_821) + GL_STUB(gl_dispatch_stub_822, _gloffset_ProgramLocalParameters4fvEXT) + HIDDEN(gl_dispatch_stub_822) + GL_STUB(gl_dispatch_stub_823, _gloffset_GetQueryObjecti64vEXT) + HIDDEN(gl_dispatch_stub_823) + GL_STUB(gl_dispatch_stub_824, _gloffset_GetQueryObjectui64vEXT) + HIDDEN(gl_dispatch_stub_824) + GL_STUB(glEGLImageTargetRenderbufferStorageOES, _gloffset_EGLImageTargetRenderbufferStorageOES) + GL_STUB(glEGLImageTargetTexture2DOES, _gloffset_EGLImageTargetTexture2DOES) + GL_STUB_ALIAS(glArrayElementEXT, glArrayElement) + GL_STUB_ALIAS(glBindTextureEXT, glBindTexture) + GL_STUB_ALIAS(glDrawArraysEXT, glDrawArrays) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glAreTexturesResidentEXT, glAreTexturesResident) +#endif + GL_STUB_ALIAS(glCopyTexImage1DEXT, glCopyTexImage1D) + GL_STUB_ALIAS(glCopyTexImage2DEXT, glCopyTexImage2D) + GL_STUB_ALIAS(glCopyTexSubImage1DEXT, glCopyTexSubImage1D) + GL_STUB_ALIAS(glCopyTexSubImage2DEXT, glCopyTexSubImage2D) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glDeleteTexturesEXT, glDeleteTextures) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGenTexturesEXT, glGenTextures) +#endif + GL_STUB_ALIAS(glGetPointervEXT, glGetPointerv) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glIsTextureEXT, glIsTexture) +#endif + GL_STUB_ALIAS(glPrioritizeTexturesEXT, glPrioritizeTextures) + GL_STUB_ALIAS(glTexSubImage1DEXT, glTexSubImage1D) + GL_STUB_ALIAS(glTexSubImage2DEXT, glTexSubImage2D) + GL_STUB_ALIAS(glBlendColorEXT, glBlendColor) + GL_STUB_ALIAS(glBlendEquationEXT, glBlendEquation) + GL_STUB_ALIAS(glDrawRangeElementsEXT, glDrawRangeElements) + GL_STUB_ALIAS(glColorTableSGI, glColorTable) + GL_STUB_ALIAS(glColorTableEXT, glColorTable) + GL_STUB_ALIAS(glColorTableParameterfvSGI, glColorTableParameterfv) + GL_STUB_ALIAS(glColorTableParameterivSGI, glColorTableParameteriv) + GL_STUB_ALIAS(glCopyColorTableSGI, glCopyColorTable) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetColorTableSGI, glGetColorTable) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetColorTableEXT, glGetColorTable) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetColorTableParameterfvSGI, glGetColorTableParameterfv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetColorTableParameterfvEXT, glGetColorTableParameterfv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetColorTableParameterivSGI, glGetColorTableParameteriv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetColorTableParameterivEXT, glGetColorTableParameteriv) +#endif + GL_STUB_ALIAS(glColorSubTableEXT, glColorSubTable) + GL_STUB_ALIAS(glCopyColorSubTableEXT, glCopyColorSubTable) + GL_STUB_ALIAS(glConvolutionFilter1DEXT, glConvolutionFilter1D) + GL_STUB_ALIAS(glConvolutionFilter2DEXT, glConvolutionFilter2D) + GL_STUB_ALIAS(glConvolutionParameterfEXT, glConvolutionParameterf) + GL_STUB_ALIAS(glConvolutionParameterfvEXT, glConvolutionParameterfv) + GL_STUB_ALIAS(glConvolutionParameteriEXT, glConvolutionParameteri) + GL_STUB_ALIAS(glConvolutionParameterivEXT, glConvolutionParameteriv) + GL_STUB_ALIAS(glCopyConvolutionFilter1DEXT, glCopyConvolutionFilter1D) + GL_STUB_ALIAS(glCopyConvolutionFilter2DEXT, glCopyConvolutionFilter2D) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetConvolutionFilterEXT, glGetConvolutionFilter) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetConvolutionParameterfvEXT, glGetConvolutionParameterfv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetConvolutionParameterivEXT, glGetConvolutionParameteriv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetSeparableFilterEXT, glGetSeparableFilter) +#endif + GL_STUB_ALIAS(glSeparableFilter2DEXT, glSeparableFilter2D) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetHistogramEXT, glGetHistogram) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetHistogramParameterfvEXT, glGetHistogramParameterfv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetHistogramParameterivEXT, glGetHistogramParameteriv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetMinmaxEXT, glGetMinmax) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetMinmaxParameterfvEXT, glGetMinmaxParameterfv) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(glGetMinmaxParameterivEXT, glGetMinmaxParameteriv) +#endif + GL_STUB_ALIAS(glHistogramEXT, glHistogram) + GL_STUB_ALIAS(glMinmaxEXT, glMinmax) + GL_STUB_ALIAS(glResetHistogramEXT, glResetHistogram) + GL_STUB_ALIAS(glResetMinmaxEXT, glResetMinmax) + GL_STUB_ALIAS(glTexImage3DEXT, glTexImage3D) + GL_STUB_ALIAS(glTexSubImage3DEXT, glTexSubImage3D) + GL_STUB_ALIAS(glCopyTexSubImage3DEXT, glCopyTexSubImage3D) + GL_STUB_ALIAS(glActiveTexture, glActiveTextureARB) + GL_STUB_ALIAS(glClientActiveTexture, glClientActiveTextureARB) + GL_STUB_ALIAS(glMultiTexCoord1d, glMultiTexCoord1dARB) + GL_STUB_ALIAS(glMultiTexCoord1dv, glMultiTexCoord1dvARB) + GL_STUB_ALIAS(glMultiTexCoord1f, glMultiTexCoord1fARB) + GL_STUB_ALIAS(glMultiTexCoord1fv, glMultiTexCoord1fvARB) + GL_STUB_ALIAS(glMultiTexCoord1i, glMultiTexCoord1iARB) + GL_STUB_ALIAS(glMultiTexCoord1iv, glMultiTexCoord1ivARB) + GL_STUB_ALIAS(glMultiTexCoord1s, glMultiTexCoord1sARB) + GL_STUB_ALIAS(glMultiTexCoord1sv, glMultiTexCoord1svARB) + GL_STUB_ALIAS(glMultiTexCoord2d, glMultiTexCoord2dARB) + GL_STUB_ALIAS(glMultiTexCoord2dv, glMultiTexCoord2dvARB) + GL_STUB_ALIAS(glMultiTexCoord2f, glMultiTexCoord2fARB) + GL_STUB_ALIAS(glMultiTexCoord2fv, glMultiTexCoord2fvARB) + GL_STUB_ALIAS(glMultiTexCoord2i, glMultiTexCoord2iARB) + GL_STUB_ALIAS(glMultiTexCoord2iv, glMultiTexCoord2ivARB) + GL_STUB_ALIAS(glMultiTexCoord2s, glMultiTexCoord2sARB) + GL_STUB_ALIAS(glMultiTexCoord2sv, glMultiTexCoord2svARB) + GL_STUB_ALIAS(glMultiTexCoord3d, glMultiTexCoord3dARB) + GL_STUB_ALIAS(glMultiTexCoord3dv, glMultiTexCoord3dvARB) + GL_STUB_ALIAS(glMultiTexCoord3f, glMultiTexCoord3fARB) + GL_STUB_ALIAS(glMultiTexCoord3fv, glMultiTexCoord3fvARB) + GL_STUB_ALIAS(glMultiTexCoord3i, glMultiTexCoord3iARB) + GL_STUB_ALIAS(glMultiTexCoord3iv, glMultiTexCoord3ivARB) + GL_STUB_ALIAS(glMultiTexCoord3s, glMultiTexCoord3sARB) + GL_STUB_ALIAS(glMultiTexCoord3sv, glMultiTexCoord3svARB) + GL_STUB_ALIAS(glMultiTexCoord4d, glMultiTexCoord4dARB) + GL_STUB_ALIAS(glMultiTexCoord4dv, glMultiTexCoord4dvARB) + GL_STUB_ALIAS(glMultiTexCoord4f, glMultiTexCoord4fARB) + GL_STUB_ALIAS(glMultiTexCoord4fv, glMultiTexCoord4fvARB) + GL_STUB_ALIAS(glMultiTexCoord4i, glMultiTexCoord4iARB) + GL_STUB_ALIAS(glMultiTexCoord4iv, glMultiTexCoord4ivARB) + GL_STUB_ALIAS(glMultiTexCoord4s, glMultiTexCoord4sARB) + GL_STUB_ALIAS(glMultiTexCoord4sv, glMultiTexCoord4svARB) + GL_STUB_ALIAS(glStencilOpSeparateATI, glStencilOpSeparate) + GL_STUB_ALIAS(glDrawArraysInstancedARB, glDrawArraysInstanced) + GL_STUB_ALIAS(glDrawArraysInstancedEXT, glDrawArraysInstanced) + GL_STUB_ALIAS(glDrawElementsInstancedARB, glDrawElementsInstanced) + GL_STUB_ALIAS(glDrawElementsInstancedEXT, glDrawElementsInstanced) + GL_STUB_ALIAS(glLoadTransposeMatrixd, glLoadTransposeMatrixdARB) + GL_STUB_ALIAS(glLoadTransposeMatrixf, glLoadTransposeMatrixfARB) + GL_STUB_ALIAS(glMultTransposeMatrixd, glMultTransposeMatrixdARB) + GL_STUB_ALIAS(glMultTransposeMatrixf, glMultTransposeMatrixfARB) + GL_STUB_ALIAS(glSampleCoverage, glSampleCoverageARB) + GL_STUB_ALIAS(glCompressedTexImage1D, glCompressedTexImage1DARB) + GL_STUB_ALIAS(glCompressedTexImage2D, glCompressedTexImage2DARB) + GL_STUB_ALIAS(glCompressedTexImage3D, glCompressedTexImage3DARB) + GL_STUB_ALIAS(glCompressedTexSubImage1D, glCompressedTexSubImage1DARB) + GL_STUB_ALIAS(glCompressedTexSubImage2D, glCompressedTexSubImage2DARB) + GL_STUB_ALIAS(glCompressedTexSubImage3D, glCompressedTexSubImage3DARB) + GL_STUB_ALIAS(glGetCompressedTexImage, glGetCompressedTexImageARB) + GL_STUB_ALIAS(glDisableVertexAttribArray, glDisableVertexAttribArrayARB) + GL_STUB_ALIAS(glEnableVertexAttribArray, glEnableVertexAttribArrayARB) + GL_STUB_ALIAS(glGetVertexAttribdv, glGetVertexAttribdvARB) + GL_STUB_ALIAS(glGetVertexAttribfv, glGetVertexAttribfvARB) + GL_STUB_ALIAS(glGetVertexAttribiv, glGetVertexAttribivARB) + GL_STUB_ALIAS(glProgramParameter4dNV, glProgramEnvParameter4dARB) + GL_STUB_ALIAS(glProgramParameter4dvNV, glProgramEnvParameter4dvARB) + GL_STUB_ALIAS(glProgramParameter4fNV, glProgramEnvParameter4fARB) + GL_STUB_ALIAS(glProgramParameter4fvNV, glProgramEnvParameter4fvARB) + GL_STUB_ALIAS(glVertexAttrib1d, glVertexAttrib1dARB) + GL_STUB_ALIAS(glVertexAttrib1dv, glVertexAttrib1dvARB) + GL_STUB_ALIAS(glVertexAttrib1f, glVertexAttrib1fARB) + GL_STUB_ALIAS(glVertexAttrib1fv, glVertexAttrib1fvARB) + GL_STUB_ALIAS(glVertexAttrib1s, glVertexAttrib1sARB) + GL_STUB_ALIAS(glVertexAttrib1sv, glVertexAttrib1svARB) + GL_STUB_ALIAS(glVertexAttrib2d, glVertexAttrib2dARB) + GL_STUB_ALIAS(glVertexAttrib2dv, glVertexAttrib2dvARB) + GL_STUB_ALIAS(glVertexAttrib2f, glVertexAttrib2fARB) + GL_STUB_ALIAS(glVertexAttrib2fv, glVertexAttrib2fvARB) + GL_STUB_ALIAS(glVertexAttrib2s, glVertexAttrib2sARB) + GL_STUB_ALIAS(glVertexAttrib2sv, glVertexAttrib2svARB) + GL_STUB_ALIAS(glVertexAttrib3d, glVertexAttrib3dARB) + GL_STUB_ALIAS(glVertexAttrib3dv, glVertexAttrib3dvARB) + GL_STUB_ALIAS(glVertexAttrib3f, glVertexAttrib3fARB) + GL_STUB_ALIAS(glVertexAttrib3fv, glVertexAttrib3fvARB) + GL_STUB_ALIAS(glVertexAttrib3s, glVertexAttrib3sARB) + GL_STUB_ALIAS(glVertexAttrib3sv, glVertexAttrib3svARB) + GL_STUB_ALIAS(glVertexAttrib4Nbv, glVertexAttrib4NbvARB) + GL_STUB_ALIAS(glVertexAttrib4Niv, glVertexAttrib4NivARB) + GL_STUB_ALIAS(glVertexAttrib4Nsv, glVertexAttrib4NsvARB) + GL_STUB_ALIAS(glVertexAttrib4Nub, glVertexAttrib4NubARB) + GL_STUB_ALIAS(glVertexAttrib4Nubv, glVertexAttrib4NubvARB) + GL_STUB_ALIAS(glVertexAttrib4Nuiv, glVertexAttrib4NuivARB) + GL_STUB_ALIAS(glVertexAttrib4Nusv, glVertexAttrib4NusvARB) + GL_STUB_ALIAS(glVertexAttrib4bv, glVertexAttrib4bvARB) + GL_STUB_ALIAS(glVertexAttrib4d, glVertexAttrib4dARB) + GL_STUB_ALIAS(glVertexAttrib4dv, glVertexAttrib4dvARB) + GL_STUB_ALIAS(glVertexAttrib4f, glVertexAttrib4fARB) + GL_STUB_ALIAS(glVertexAttrib4fv, glVertexAttrib4fvARB) + GL_STUB_ALIAS(glVertexAttrib4iv, glVertexAttrib4ivARB) + GL_STUB_ALIAS(glVertexAttrib4s, glVertexAttrib4sARB) + GL_STUB_ALIAS(glVertexAttrib4sv, glVertexAttrib4svARB) + GL_STUB_ALIAS(glVertexAttrib4ubv, glVertexAttrib4ubvARB) + GL_STUB_ALIAS(glVertexAttrib4uiv, glVertexAttrib4uivARB) + GL_STUB_ALIAS(glVertexAttrib4usv, glVertexAttrib4usvARB) + GL_STUB_ALIAS(glVertexAttribPointer, glVertexAttribPointerARB) + GL_STUB_ALIAS(glBindBuffer, glBindBufferARB) + GL_STUB_ALIAS(glBufferData, glBufferDataARB) + GL_STUB_ALIAS(glBufferSubData, glBufferSubDataARB) + GL_STUB_ALIAS(glDeleteBuffers, glDeleteBuffersARB) + GL_STUB_ALIAS(glGenBuffers, glGenBuffersARB) + GL_STUB_ALIAS(glGetBufferParameteriv, glGetBufferParameterivARB) + GL_STUB_ALIAS(glGetBufferPointerv, glGetBufferPointervARB) + GL_STUB_ALIAS(glGetBufferSubData, glGetBufferSubDataARB) + GL_STUB_ALIAS(glIsBuffer, glIsBufferARB) + GL_STUB_ALIAS(glMapBuffer, glMapBufferARB) + GL_STUB_ALIAS(glUnmapBuffer, glUnmapBufferARB) + GL_STUB_ALIAS(glBeginQuery, glBeginQueryARB) + GL_STUB_ALIAS(glDeleteQueries, glDeleteQueriesARB) + GL_STUB_ALIAS(glEndQuery, glEndQueryARB) + GL_STUB_ALIAS(glGenQueries, glGenQueriesARB) + GL_STUB_ALIAS(glGetQueryObjectiv, glGetQueryObjectivARB) + GL_STUB_ALIAS(glGetQueryObjectuiv, glGetQueryObjectuivARB) + GL_STUB_ALIAS(glGetQueryiv, glGetQueryivARB) + GL_STUB_ALIAS(glIsQuery, glIsQueryARB) + GL_STUB_ALIAS(glCompileShader, glCompileShaderARB) + GL_STUB_ALIAS(glGetActiveUniform, glGetActiveUniformARB) + GL_STUB_ALIAS(glGetShaderSource, glGetShaderSourceARB) + GL_STUB_ALIAS(glGetUniformLocation, glGetUniformLocationARB) + GL_STUB_ALIAS(glGetUniformfv, glGetUniformfvARB) + GL_STUB_ALIAS(glGetUniformiv, glGetUniformivARB) + GL_STUB_ALIAS(glLinkProgram, glLinkProgramARB) + GL_STUB_ALIAS(glShaderSource, glShaderSourceARB) + GL_STUB_ALIAS(glUniform1f, glUniform1fARB) + GL_STUB_ALIAS(glUniform1fv, glUniform1fvARB) + GL_STUB_ALIAS(glUniform1i, glUniform1iARB) + GL_STUB_ALIAS(glUniform1iv, glUniform1ivARB) + GL_STUB_ALIAS(glUniform2f, glUniform2fARB) + GL_STUB_ALIAS(glUniform2fv, glUniform2fvARB) + GL_STUB_ALIAS(glUniform2i, glUniform2iARB) + GL_STUB_ALIAS(glUniform2iv, glUniform2ivARB) + GL_STUB_ALIAS(glUniform3f, glUniform3fARB) + GL_STUB_ALIAS(glUniform3fv, glUniform3fvARB) + GL_STUB_ALIAS(glUniform3i, glUniform3iARB) + GL_STUB_ALIAS(glUniform3iv, glUniform3ivARB) + GL_STUB_ALIAS(glUniform4f, glUniform4fARB) + GL_STUB_ALIAS(glUniform4fv, glUniform4fvARB) + GL_STUB_ALIAS(glUniform4i, glUniform4iARB) + GL_STUB_ALIAS(glUniform4iv, glUniform4ivARB) + GL_STUB_ALIAS(glUniformMatrix2fv, glUniformMatrix2fvARB) + GL_STUB_ALIAS(glUniformMatrix3fv, glUniformMatrix3fvARB) + GL_STUB_ALIAS(glUniformMatrix4fv, glUniformMatrix4fvARB) + GL_STUB_ALIAS(glUseProgram, glUseProgramObjectARB) + GL_STUB_ALIAS(glValidateProgram, glValidateProgramARB) + GL_STUB_ALIAS(glBindAttribLocation, glBindAttribLocationARB) + GL_STUB_ALIAS(glGetActiveAttrib, glGetActiveAttribARB) + GL_STUB_ALIAS(glGetAttribLocation, glGetAttribLocationARB) + GL_STUB_ALIAS(glDrawBuffers, glDrawBuffersARB) + GL_STUB_ALIAS(glDrawBuffersATI, glDrawBuffersARB) + GL_STUB_ALIAS(glRenderbufferStorageMultisampleEXT, glRenderbufferStorageMultisample) + GL_STUB_ALIAS(glPointParameterf, glPointParameterfEXT) + GL_STUB_ALIAS(glPointParameterfARB, glPointParameterfEXT) + GL_STUB_ALIAS(glPointParameterfSGIS, glPointParameterfEXT) + GL_STUB_ALIAS(glPointParameterfv, glPointParameterfvEXT) + GL_STUB_ALIAS(glPointParameterfvARB, glPointParameterfvEXT) + GL_STUB_ALIAS(glPointParameterfvSGIS, glPointParameterfvEXT) + GL_STUB_ALIAS(glSecondaryColor3b, glSecondaryColor3bEXT) + GL_STUB_ALIAS(glSecondaryColor3bv, glSecondaryColor3bvEXT) + GL_STUB_ALIAS(glSecondaryColor3d, glSecondaryColor3dEXT) + GL_STUB_ALIAS(glSecondaryColor3dv, glSecondaryColor3dvEXT) + GL_STUB_ALIAS(glSecondaryColor3f, glSecondaryColor3fEXT) + GL_STUB_ALIAS(glSecondaryColor3fv, glSecondaryColor3fvEXT) + GL_STUB_ALIAS(glSecondaryColor3i, glSecondaryColor3iEXT) + GL_STUB_ALIAS(glSecondaryColor3iv, glSecondaryColor3ivEXT) + GL_STUB_ALIAS(glSecondaryColor3s, glSecondaryColor3sEXT) + GL_STUB_ALIAS(glSecondaryColor3sv, glSecondaryColor3svEXT) + GL_STUB_ALIAS(glSecondaryColor3ub, glSecondaryColor3ubEXT) + GL_STUB_ALIAS(glSecondaryColor3ubv, glSecondaryColor3ubvEXT) + GL_STUB_ALIAS(glSecondaryColor3ui, glSecondaryColor3uiEXT) + GL_STUB_ALIAS(glSecondaryColor3uiv, glSecondaryColor3uivEXT) + GL_STUB_ALIAS(glSecondaryColor3us, glSecondaryColor3usEXT) + GL_STUB_ALIAS(glSecondaryColor3usv, glSecondaryColor3usvEXT) + GL_STUB_ALIAS(glSecondaryColorPointer, glSecondaryColorPointerEXT) + GL_STUB_ALIAS(glMultiDrawArrays, glMultiDrawArraysEXT) + GL_STUB_ALIAS(glMultiDrawElements, glMultiDrawElementsEXT) + GL_STUB_ALIAS(glFogCoordPointer, glFogCoordPointerEXT) + GL_STUB_ALIAS(glFogCoordd, glFogCoorddEXT) + GL_STUB_ALIAS(glFogCoorddv, glFogCoorddvEXT) + GL_STUB_ALIAS(glFogCoordf, glFogCoordfEXT) + GL_STUB_ALIAS(glFogCoordfv, glFogCoordfvEXT) + GL_STUB_ALIAS(glBlendFuncSeparate, glBlendFuncSeparateEXT) + GL_STUB_ALIAS(glBlendFuncSeparateINGR, glBlendFuncSeparateEXT) + GL_STUB_ALIAS(glWindowPos2d, glWindowPos2dMESA) + GL_STUB_ALIAS(glWindowPos2dARB, glWindowPos2dMESA) + GL_STUB_ALIAS(glWindowPos2dv, glWindowPos2dvMESA) + GL_STUB_ALIAS(glWindowPos2dvARB, glWindowPos2dvMESA) + GL_STUB_ALIAS(glWindowPos2f, glWindowPos2fMESA) + GL_STUB_ALIAS(glWindowPos2fARB, glWindowPos2fMESA) + GL_STUB_ALIAS(glWindowPos2fv, glWindowPos2fvMESA) + GL_STUB_ALIAS(glWindowPos2fvARB, glWindowPos2fvMESA) + GL_STUB_ALIAS(glWindowPos2i, glWindowPos2iMESA) + GL_STUB_ALIAS(glWindowPos2iARB, glWindowPos2iMESA) + GL_STUB_ALIAS(glWindowPos2iv, glWindowPos2ivMESA) + GL_STUB_ALIAS(glWindowPos2ivARB, glWindowPos2ivMESA) + GL_STUB_ALIAS(glWindowPos2s, glWindowPos2sMESA) + GL_STUB_ALIAS(glWindowPos2sARB, glWindowPos2sMESA) + GL_STUB_ALIAS(glWindowPos2sv, glWindowPos2svMESA) + GL_STUB_ALIAS(glWindowPos2svARB, glWindowPos2svMESA) + GL_STUB_ALIAS(glWindowPos3d, glWindowPos3dMESA) + GL_STUB_ALIAS(glWindowPos3dARB, glWindowPos3dMESA) + GL_STUB_ALIAS(glWindowPos3dv, glWindowPos3dvMESA) + GL_STUB_ALIAS(glWindowPos3dvARB, glWindowPos3dvMESA) + GL_STUB_ALIAS(glWindowPos3f, glWindowPos3fMESA) + GL_STUB_ALIAS(glWindowPos3fARB, glWindowPos3fMESA) + GL_STUB_ALIAS(glWindowPos3fv, glWindowPos3fvMESA) + GL_STUB_ALIAS(glWindowPos3fvARB, glWindowPos3fvMESA) + GL_STUB_ALIAS(glWindowPos3i, glWindowPos3iMESA) + GL_STUB_ALIAS(glWindowPos3iARB, glWindowPos3iMESA) + GL_STUB_ALIAS(glWindowPos3iv, glWindowPos3ivMESA) + GL_STUB_ALIAS(glWindowPos3ivARB, glWindowPos3ivMESA) + GL_STUB_ALIAS(glWindowPos3s, glWindowPos3sMESA) + GL_STUB_ALIAS(glWindowPos3sARB, glWindowPos3sMESA) + GL_STUB_ALIAS(glWindowPos3sv, glWindowPos3svMESA) + GL_STUB_ALIAS(glWindowPos3svARB, glWindowPos3svMESA) + GL_STUB_ALIAS(glBindProgramARB, glBindProgramNV) + GL_STUB_ALIAS(glDeleteProgramsARB, glDeleteProgramsNV) + GL_STUB_ALIAS(glGenProgramsARB, glGenProgramsNV) + GL_STUB_ALIAS(glGetVertexAttribPointerv, glGetVertexAttribPointervNV) + GL_STUB_ALIAS(glGetVertexAttribPointervARB, glGetVertexAttribPointervNV) + GL_STUB_ALIAS(glIsProgramARB, glIsProgramNV) + GL_STUB_ALIAS(glPointParameteri, glPointParameteriNV) + GL_STUB_ALIAS(glPointParameteriv, glPointParameterivNV) + GL_STUB_ALIAS(glBindFramebuffer, glBindFramebufferEXT) + GL_STUB_ALIAS(glBindRenderbuffer, glBindRenderbufferEXT) + GL_STUB_ALIAS(glCheckFramebufferStatus, glCheckFramebufferStatusEXT) + GL_STUB_ALIAS(glDeleteFramebuffers, glDeleteFramebuffersEXT) + GL_STUB_ALIAS(glDeleteRenderbuffers, glDeleteRenderbuffersEXT) + GL_STUB_ALIAS(glFramebufferRenderbuffer, glFramebufferRenderbufferEXT) + GL_STUB_ALIAS(glFramebufferTexture1D, glFramebufferTexture1DEXT) + GL_STUB_ALIAS(glFramebufferTexture2D, glFramebufferTexture2DEXT) + GL_STUB_ALIAS(glFramebufferTexture3D, glFramebufferTexture3DEXT) + GL_STUB_ALIAS(glGenFramebuffers, glGenFramebuffersEXT) + GL_STUB_ALIAS(glGenRenderbuffers, glGenRenderbuffersEXT) + GL_STUB_ALIAS(glGenerateMipmap, glGenerateMipmapEXT) + GL_STUB_ALIAS(glGetFramebufferAttachmentParameteriv, glGetFramebufferAttachmentParameterivEXT) + GL_STUB_ALIAS(glGetRenderbufferParameteriv, glGetRenderbufferParameterivEXT) + GL_STUB_ALIAS(glIsFramebuffer, glIsFramebufferEXT) + GL_STUB_ALIAS(glIsRenderbuffer, glIsRenderbufferEXT) + GL_STUB_ALIAS(glRenderbufferStorage, glRenderbufferStorageEXT) + GL_STUB_ALIAS(glFramebufferTextureLayer, glFramebufferTextureLayerEXT) + GL_STUB_ALIAS(glBeginTransformFeedback, glBeginTransformFeedbackEXT) + GL_STUB_ALIAS(glBindBufferBase, glBindBufferBaseEXT) + GL_STUB_ALIAS(glBindBufferRange, glBindBufferRangeEXT) + GL_STUB_ALIAS(glEndTransformFeedback, glEndTransformFeedbackEXT) + GL_STUB_ALIAS(glGetTransformFeedbackVarying, glGetTransformFeedbackVaryingEXT) + GL_STUB_ALIAS(glTransformFeedbackVaryings, glTransformFeedbackVaryingsEXT) + GL_STUB_ALIAS(glProvokingVertex, glProvokingVertexEXT) + + .globl gl_dispatch_functions_end + HIDDEN(gl_dispatch_functions_end) +gl_dispatch_functions_end: diff --git a/mesalib/src/mapi/glapi/glapi_x86-64.S b/mesalib/src/mapi/glapi/glapi_x86-64.S new file mode 100644 index 000000000..8cfd815a5 --- /dev/null +++ b/mesalib/src/mapi/glapi/glapi_x86-64.S @@ -0,0 +1,31648 @@ +/* DO NOT EDIT - This file generated automatically by gl_x86-64_asm.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* If we build with gcc's -fvisibility=hidden flag, we'll need to change + * the symbol visibility mode to 'default'. + */ + +#include "x86/assyntax.h" + +#ifdef __GNUC__ +# pragma GCC visibility push(default) +# define HIDDEN(x) .hidden x +#else +# define HIDDEN(x) +#endif + +# if defined(USE_MGL_NAMESPACE) +# define GL_PREFIX(n) GLNAME(CONCAT(mgl,n)) +# define _glapi_Dispatch _mglapi_Dispatch +# else +# define GL_PREFIX(n) GLNAME(CONCAT(gl,n)) +# endif + +#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS) +# define THREADS +#endif + + .text + +#ifdef GLX_USE_TLS + + .globl _x86_64_get_get_dispatch; HIDDEN(_x86_64_get_get_dispatch) +_x86_64_get_get_dispatch: + lea _x86_64_get_dispatch(%rip), %rax + ret + + .p2align 4,,15 +_x86_64_get_dispatch: + movq _glapi_tls_Dispatch@GOTTPOFF(%rip), %rax + movq %fs:(%rax), %rax + ret + .size _x86_64_get_dispatch, .-_x86_64_get_dispatch + +#elif defined(PTHREADS) + + .extern _glapi_Dispatch + .extern _gl_DispatchTSD + .extern pthread_getspecific + + .p2align 4,,15 +_x86_64_get_dispatch: + movq _gl_DispatchTSD(%rip), %rdi + jmp pthread_getspecific@PLT + +#elif defined(THREADS) + + .extern _glapi_get_dispatch + +#endif + + .p2align 4,,15 + .globl GL_PREFIX(NewList) + .type GL_PREFIX(NewList), @function +GL_PREFIX(NewList): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 0(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq (%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 0(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 0(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(NewList), .-GL_PREFIX(NewList) + + .p2align 4,,15 + .globl GL_PREFIX(EndList) + .type GL_PREFIX(EndList), @function +GL_PREFIX(EndList): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 8(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 8(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 8(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 8(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EndList), .-GL_PREFIX(EndList) + + .p2align 4,,15 + .globl GL_PREFIX(CallList) + .type GL_PREFIX(CallList), @function +GL_PREFIX(CallList): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 16(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 16(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 16(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 16(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CallList), .-GL_PREFIX(CallList) + + .p2align 4,,15 + .globl GL_PREFIX(CallLists) + .type GL_PREFIX(CallLists), @function +GL_PREFIX(CallLists): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 24(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 24(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 24(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 24(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CallLists), .-GL_PREFIX(CallLists) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteLists) + .type GL_PREFIX(DeleteLists), @function +GL_PREFIX(DeleteLists): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 32(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 32(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 32(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 32(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteLists), .-GL_PREFIX(DeleteLists) + + .p2align 4,,15 + .globl GL_PREFIX(GenLists) + .type GL_PREFIX(GenLists), @function +GL_PREFIX(GenLists): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 40(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 40(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 40(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 40(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenLists), .-GL_PREFIX(GenLists) + + .p2align 4,,15 + .globl GL_PREFIX(ListBase) + .type GL_PREFIX(ListBase), @function +GL_PREFIX(ListBase): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 48(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 48(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 48(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 48(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ListBase), .-GL_PREFIX(ListBase) + + .p2align 4,,15 + .globl GL_PREFIX(Begin) + .type GL_PREFIX(Begin), @function +GL_PREFIX(Begin): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 56(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 56(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 56(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 56(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Begin), .-GL_PREFIX(Begin) + + .p2align 4,,15 + .globl GL_PREFIX(Bitmap) + .type GL_PREFIX(Bitmap), @function +GL_PREFIX(Bitmap): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 64(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + movq %rdx, 48(%rsp) + call _x86_64_get_dispatch@PLT + movq 48(%rsp), %rdx + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 64(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 64(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + movq %rdx, 48(%rsp) + call _glapi_get_dispatch + movq 48(%rsp), %rdx + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 64(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Bitmap), .-GL_PREFIX(Bitmap) + + .p2align 4,,15 + .globl GL_PREFIX(Color3b) + .type GL_PREFIX(Color3b), @function +GL_PREFIX(Color3b): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 72(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 72(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 72(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 72(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3b), .-GL_PREFIX(Color3b) + + .p2align 4,,15 + .globl GL_PREFIX(Color3bv) + .type GL_PREFIX(Color3bv), @function +GL_PREFIX(Color3bv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 80(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 80(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 80(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 80(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3bv), .-GL_PREFIX(Color3bv) + + .p2align 4,,15 + .globl GL_PREFIX(Color3d) + .type GL_PREFIX(Color3d), @function +GL_PREFIX(Color3d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 88(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 88(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 88(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 88(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3d), .-GL_PREFIX(Color3d) + + .p2align 4,,15 + .globl GL_PREFIX(Color3dv) + .type GL_PREFIX(Color3dv), @function +GL_PREFIX(Color3dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 96(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 96(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 96(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 96(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3dv), .-GL_PREFIX(Color3dv) + + .p2align 4,,15 + .globl GL_PREFIX(Color3f) + .type GL_PREFIX(Color3f), @function +GL_PREFIX(Color3f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 104(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3f), .-GL_PREFIX(Color3f) + + .p2align 4,,15 + .globl GL_PREFIX(Color3fv) + .type GL_PREFIX(Color3fv), @function +GL_PREFIX(Color3fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3fv), .-GL_PREFIX(Color3fv) + + .p2align 4,,15 + .globl GL_PREFIX(Color3i) + .type GL_PREFIX(Color3i), @function +GL_PREFIX(Color3i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3i), .-GL_PREFIX(Color3i) + + .p2align 4,,15 + .globl GL_PREFIX(Color3iv) + .type GL_PREFIX(Color3iv), @function +GL_PREFIX(Color3iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3iv), .-GL_PREFIX(Color3iv) + + .p2align 4,,15 + .globl GL_PREFIX(Color3s) + .type GL_PREFIX(Color3s), @function +GL_PREFIX(Color3s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3s), .-GL_PREFIX(Color3s) + + .p2align 4,,15 + .globl GL_PREFIX(Color3sv) + .type GL_PREFIX(Color3sv), @function +GL_PREFIX(Color3sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3sv), .-GL_PREFIX(Color3sv) + + .p2align 4,,15 + .globl GL_PREFIX(Color3ub) + .type GL_PREFIX(Color3ub), @function +GL_PREFIX(Color3ub): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3ub), .-GL_PREFIX(Color3ub) + + .p2align 4,,15 + .globl GL_PREFIX(Color3ubv) + .type GL_PREFIX(Color3ubv), @function +GL_PREFIX(Color3ubv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3ubv), .-GL_PREFIX(Color3ubv) + + .p2align 4,,15 + .globl GL_PREFIX(Color3ui) + .type GL_PREFIX(Color3ui), @function +GL_PREFIX(Color3ui): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3ui), .-GL_PREFIX(Color3ui) + + .p2align 4,,15 + .globl GL_PREFIX(Color3uiv) + .type GL_PREFIX(Color3uiv), @function +GL_PREFIX(Color3uiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3uiv), .-GL_PREFIX(Color3uiv) + + .p2align 4,,15 + .globl GL_PREFIX(Color3us) + .type GL_PREFIX(Color3us), @function +GL_PREFIX(Color3us): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3us), .-GL_PREFIX(Color3us) + + .p2align 4,,15 + .globl GL_PREFIX(Color3usv) + .type GL_PREFIX(Color3usv), @function +GL_PREFIX(Color3usv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color3usv), .-GL_PREFIX(Color3usv) + + .p2align 4,,15 + .globl GL_PREFIX(Color4b) + .type GL_PREFIX(Color4b), @function +GL_PREFIX(Color4b): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4b), .-GL_PREFIX(Color4b) + + .p2align 4,,15 + .globl GL_PREFIX(Color4bv) + .type GL_PREFIX(Color4bv), @function +GL_PREFIX(Color4bv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4bv), .-GL_PREFIX(Color4bv) + + .p2align 4,,15 + .globl GL_PREFIX(Color4d) + .type GL_PREFIX(Color4d), @function +GL_PREFIX(Color4d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 216(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4d), .-GL_PREFIX(Color4d) + + .p2align 4,,15 + .globl GL_PREFIX(Color4dv) + .type GL_PREFIX(Color4dv), @function +GL_PREFIX(Color4dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4dv), .-GL_PREFIX(Color4dv) + + .p2align 4,,15 + .globl GL_PREFIX(Color4f) + .type GL_PREFIX(Color4f), @function +GL_PREFIX(Color4f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 232(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4f), .-GL_PREFIX(Color4f) + + .p2align 4,,15 + .globl GL_PREFIX(Color4fv) + .type GL_PREFIX(Color4fv), @function +GL_PREFIX(Color4fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4fv), .-GL_PREFIX(Color4fv) + + .p2align 4,,15 + .globl GL_PREFIX(Color4i) + .type GL_PREFIX(Color4i), @function +GL_PREFIX(Color4i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4i), .-GL_PREFIX(Color4i) + + .p2align 4,,15 + .globl GL_PREFIX(Color4iv) + .type GL_PREFIX(Color4iv), @function +GL_PREFIX(Color4iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4iv), .-GL_PREFIX(Color4iv) + + .p2align 4,,15 + .globl GL_PREFIX(Color4s) + .type GL_PREFIX(Color4s), @function +GL_PREFIX(Color4s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4s), .-GL_PREFIX(Color4s) + + .p2align 4,,15 + .globl GL_PREFIX(Color4sv) + .type GL_PREFIX(Color4sv), @function +GL_PREFIX(Color4sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4sv), .-GL_PREFIX(Color4sv) + + .p2align 4,,15 + .globl GL_PREFIX(Color4ub) + .type GL_PREFIX(Color4ub), @function +GL_PREFIX(Color4ub): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4ub), .-GL_PREFIX(Color4ub) + + .p2align 4,,15 + .globl GL_PREFIX(Color4ubv) + .type GL_PREFIX(Color4ubv), @function +GL_PREFIX(Color4ubv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4ubv), .-GL_PREFIX(Color4ubv) + + .p2align 4,,15 + .globl GL_PREFIX(Color4ui) + .type GL_PREFIX(Color4ui), @function +GL_PREFIX(Color4ui): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4ui), .-GL_PREFIX(Color4ui) + + .p2align 4,,15 + .globl GL_PREFIX(Color4uiv) + .type GL_PREFIX(Color4uiv), @function +GL_PREFIX(Color4uiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4uiv), .-GL_PREFIX(Color4uiv) + + .p2align 4,,15 + .globl GL_PREFIX(Color4us) + .type GL_PREFIX(Color4us), @function +GL_PREFIX(Color4us): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4us), .-GL_PREFIX(Color4us) + + .p2align 4,,15 + .globl GL_PREFIX(Color4usv) + .type GL_PREFIX(Color4usv), @function +GL_PREFIX(Color4usv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Color4usv), .-GL_PREFIX(Color4usv) + + .p2align 4,,15 + .globl GL_PREFIX(EdgeFlag) + .type GL_PREFIX(EdgeFlag), @function +GL_PREFIX(EdgeFlag): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EdgeFlag), .-GL_PREFIX(EdgeFlag) + + .p2align 4,,15 + .globl GL_PREFIX(EdgeFlagv) + .type GL_PREFIX(EdgeFlagv), @function +GL_PREFIX(EdgeFlagv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EdgeFlagv), .-GL_PREFIX(EdgeFlagv) + + .p2align 4,,15 + .globl GL_PREFIX(End) + .type GL_PREFIX(End), @function +GL_PREFIX(End): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 344(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(End), .-GL_PREFIX(End) + + .p2align 4,,15 + .globl GL_PREFIX(Indexd) + .type GL_PREFIX(Indexd), @function +GL_PREFIX(Indexd): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 352(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexd), .-GL_PREFIX(Indexd) + + .p2align 4,,15 + .globl GL_PREFIX(Indexdv) + .type GL_PREFIX(Indexdv), @function +GL_PREFIX(Indexdv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexdv), .-GL_PREFIX(Indexdv) + + .p2align 4,,15 + .globl GL_PREFIX(Indexf) + .type GL_PREFIX(Indexf), @function +GL_PREFIX(Indexf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 368(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexf), .-GL_PREFIX(Indexf) + + .p2align 4,,15 + .globl GL_PREFIX(Indexfv) + .type GL_PREFIX(Indexfv), @function +GL_PREFIX(Indexfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexfv), .-GL_PREFIX(Indexfv) + + .p2align 4,,15 + .globl GL_PREFIX(Indexi) + .type GL_PREFIX(Indexi), @function +GL_PREFIX(Indexi): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexi), .-GL_PREFIX(Indexi) + + .p2align 4,,15 + .globl GL_PREFIX(Indexiv) + .type GL_PREFIX(Indexiv), @function +GL_PREFIX(Indexiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexiv), .-GL_PREFIX(Indexiv) + + .p2align 4,,15 + .globl GL_PREFIX(Indexs) + .type GL_PREFIX(Indexs), @function +GL_PREFIX(Indexs): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexs), .-GL_PREFIX(Indexs) + + .p2align 4,,15 + .globl GL_PREFIX(Indexsv) + .type GL_PREFIX(Indexsv), @function +GL_PREFIX(Indexsv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexsv), .-GL_PREFIX(Indexsv) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3b) + .type GL_PREFIX(Normal3b), @function +GL_PREFIX(Normal3b): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3b), .-GL_PREFIX(Normal3b) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3bv) + .type GL_PREFIX(Normal3bv), @function +GL_PREFIX(Normal3bv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3bv), .-GL_PREFIX(Normal3bv) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3d) + .type GL_PREFIX(Normal3d), @function +GL_PREFIX(Normal3d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 432(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3d), .-GL_PREFIX(Normal3d) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3dv) + .type GL_PREFIX(Normal3dv), @function +GL_PREFIX(Normal3dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3dv), .-GL_PREFIX(Normal3dv) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3f) + .type GL_PREFIX(Normal3f), @function +GL_PREFIX(Normal3f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 448(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3f), .-GL_PREFIX(Normal3f) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3fv) + .type GL_PREFIX(Normal3fv), @function +GL_PREFIX(Normal3fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3fv), .-GL_PREFIX(Normal3fv) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3i) + .type GL_PREFIX(Normal3i), @function +GL_PREFIX(Normal3i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3i), .-GL_PREFIX(Normal3i) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3iv) + .type GL_PREFIX(Normal3iv), @function +GL_PREFIX(Normal3iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3iv), .-GL_PREFIX(Normal3iv) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3s) + .type GL_PREFIX(Normal3s), @function +GL_PREFIX(Normal3s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3s), .-GL_PREFIX(Normal3s) + + .p2align 4,,15 + .globl GL_PREFIX(Normal3sv) + .type GL_PREFIX(Normal3sv), @function +GL_PREFIX(Normal3sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Normal3sv), .-GL_PREFIX(Normal3sv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos2d) + .type GL_PREFIX(RasterPos2d), @function +GL_PREFIX(RasterPos2d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 496(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos2d), .-GL_PREFIX(RasterPos2d) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos2dv) + .type GL_PREFIX(RasterPos2dv), @function +GL_PREFIX(RasterPos2dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos2dv), .-GL_PREFIX(RasterPos2dv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos2f) + .type GL_PREFIX(RasterPos2f), @function +GL_PREFIX(RasterPos2f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 512(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos2f), .-GL_PREFIX(RasterPos2f) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos2fv) + .type GL_PREFIX(RasterPos2fv), @function +GL_PREFIX(RasterPos2fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos2fv), .-GL_PREFIX(RasterPos2fv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos2i) + .type GL_PREFIX(RasterPos2i), @function +GL_PREFIX(RasterPos2i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos2i), .-GL_PREFIX(RasterPos2i) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos2iv) + .type GL_PREFIX(RasterPos2iv), @function +GL_PREFIX(RasterPos2iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos2iv), .-GL_PREFIX(RasterPos2iv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos2s) + .type GL_PREFIX(RasterPos2s), @function +GL_PREFIX(RasterPos2s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos2s), .-GL_PREFIX(RasterPos2s) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos2sv) + .type GL_PREFIX(RasterPos2sv), @function +GL_PREFIX(RasterPos2sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos2sv), .-GL_PREFIX(RasterPos2sv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos3d) + .type GL_PREFIX(RasterPos3d), @function +GL_PREFIX(RasterPos3d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 560(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos3d), .-GL_PREFIX(RasterPos3d) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos3dv) + .type GL_PREFIX(RasterPos3dv), @function +GL_PREFIX(RasterPos3dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos3dv), .-GL_PREFIX(RasterPos3dv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos3f) + .type GL_PREFIX(RasterPos3f), @function +GL_PREFIX(RasterPos3f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 576(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos3f), .-GL_PREFIX(RasterPos3f) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos3fv) + .type GL_PREFIX(RasterPos3fv), @function +GL_PREFIX(RasterPos3fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos3fv), .-GL_PREFIX(RasterPos3fv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos3i) + .type GL_PREFIX(RasterPos3i), @function +GL_PREFIX(RasterPos3i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos3i), .-GL_PREFIX(RasterPos3i) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos3iv) + .type GL_PREFIX(RasterPos3iv), @function +GL_PREFIX(RasterPos3iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos3iv), .-GL_PREFIX(RasterPos3iv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos3s) + .type GL_PREFIX(RasterPos3s), @function +GL_PREFIX(RasterPos3s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos3s), .-GL_PREFIX(RasterPos3s) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos3sv) + .type GL_PREFIX(RasterPos3sv), @function +GL_PREFIX(RasterPos3sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos3sv), .-GL_PREFIX(RasterPos3sv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos4d) + .type GL_PREFIX(RasterPos4d), @function +GL_PREFIX(RasterPos4d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 624(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos4d), .-GL_PREFIX(RasterPos4d) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos4dv) + .type GL_PREFIX(RasterPos4dv), @function +GL_PREFIX(RasterPos4dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 632(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos4dv), .-GL_PREFIX(RasterPos4dv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos4f) + .type GL_PREFIX(RasterPos4f), @function +GL_PREFIX(RasterPos4f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 640(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos4f), .-GL_PREFIX(RasterPos4f) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos4fv) + .type GL_PREFIX(RasterPos4fv), @function +GL_PREFIX(RasterPos4fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos4fv), .-GL_PREFIX(RasterPos4fv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos4i) + .type GL_PREFIX(RasterPos4i), @function +GL_PREFIX(RasterPos4i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos4i), .-GL_PREFIX(RasterPos4i) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos4iv) + .type GL_PREFIX(RasterPos4iv), @function +GL_PREFIX(RasterPos4iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos4iv), .-GL_PREFIX(RasterPos4iv) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos4s) + .type GL_PREFIX(RasterPos4s), @function +GL_PREFIX(RasterPos4s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 672(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos4s), .-GL_PREFIX(RasterPos4s) + + .p2align 4,,15 + .globl GL_PREFIX(RasterPos4sv) + .type GL_PREFIX(RasterPos4sv), @function +GL_PREFIX(RasterPos4sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RasterPos4sv), .-GL_PREFIX(RasterPos4sv) + + .p2align 4,,15 + .globl GL_PREFIX(Rectd) + .type GL_PREFIX(Rectd), @function +GL_PREFIX(Rectd): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 688(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Rectd), .-GL_PREFIX(Rectd) + + .p2align 4,,15 + .globl GL_PREFIX(Rectdv) + .type GL_PREFIX(Rectdv), @function +GL_PREFIX(Rectdv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Rectdv), .-GL_PREFIX(Rectdv) + + .p2align 4,,15 + .globl GL_PREFIX(Rectf) + .type GL_PREFIX(Rectf), @function +GL_PREFIX(Rectf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 704(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Rectf), .-GL_PREFIX(Rectf) + + .p2align 4,,15 + .globl GL_PREFIX(Rectfv) + .type GL_PREFIX(Rectfv), @function +GL_PREFIX(Rectfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 712(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Rectfv), .-GL_PREFIX(Rectfv) + + .p2align 4,,15 + .globl GL_PREFIX(Recti) + .type GL_PREFIX(Recti), @function +GL_PREFIX(Recti): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Recti), .-GL_PREFIX(Recti) + + .p2align 4,,15 + .globl GL_PREFIX(Rectiv) + .type GL_PREFIX(Rectiv), @function +GL_PREFIX(Rectiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 728(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Rectiv), .-GL_PREFIX(Rectiv) + + .p2align 4,,15 + .globl GL_PREFIX(Rects) + .type GL_PREFIX(Rects), @function +GL_PREFIX(Rects): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 736(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Rects), .-GL_PREFIX(Rects) + + .p2align 4,,15 + .globl GL_PREFIX(Rectsv) + .type GL_PREFIX(Rectsv), @function +GL_PREFIX(Rectsv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Rectsv), .-GL_PREFIX(Rectsv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord1d) + .type GL_PREFIX(TexCoord1d), @function +GL_PREFIX(TexCoord1d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 752(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord1d), .-GL_PREFIX(TexCoord1d) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord1dv) + .type GL_PREFIX(TexCoord1dv), @function +GL_PREFIX(TexCoord1dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 760(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord1dv), .-GL_PREFIX(TexCoord1dv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord1f) + .type GL_PREFIX(TexCoord1f), @function +GL_PREFIX(TexCoord1f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 768(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord1f), .-GL_PREFIX(TexCoord1f) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord1fv) + .type GL_PREFIX(TexCoord1fv), @function +GL_PREFIX(TexCoord1fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 776(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord1fv), .-GL_PREFIX(TexCoord1fv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord1i) + .type GL_PREFIX(TexCoord1i), @function +GL_PREFIX(TexCoord1i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 784(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord1i), .-GL_PREFIX(TexCoord1i) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord1iv) + .type GL_PREFIX(TexCoord1iv), @function +GL_PREFIX(TexCoord1iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 792(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord1iv), .-GL_PREFIX(TexCoord1iv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord1s) + .type GL_PREFIX(TexCoord1s), @function +GL_PREFIX(TexCoord1s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 800(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord1s), .-GL_PREFIX(TexCoord1s) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord1sv) + .type GL_PREFIX(TexCoord1sv), @function +GL_PREFIX(TexCoord1sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 808(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord1sv), .-GL_PREFIX(TexCoord1sv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord2d) + .type GL_PREFIX(TexCoord2d), @function +GL_PREFIX(TexCoord2d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 816(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord2d), .-GL_PREFIX(TexCoord2d) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord2dv) + .type GL_PREFIX(TexCoord2dv), @function +GL_PREFIX(TexCoord2dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 824(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord2dv), .-GL_PREFIX(TexCoord2dv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord2f) + .type GL_PREFIX(TexCoord2f), @function +GL_PREFIX(TexCoord2f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 832(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord2f), .-GL_PREFIX(TexCoord2f) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord2fv) + .type GL_PREFIX(TexCoord2fv), @function +GL_PREFIX(TexCoord2fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 840(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord2fv), .-GL_PREFIX(TexCoord2fv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord2i) + .type GL_PREFIX(TexCoord2i), @function +GL_PREFIX(TexCoord2i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord2i), .-GL_PREFIX(TexCoord2i) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord2iv) + .type GL_PREFIX(TexCoord2iv), @function +GL_PREFIX(TexCoord2iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 856(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord2iv), .-GL_PREFIX(TexCoord2iv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord2s) + .type GL_PREFIX(TexCoord2s), @function +GL_PREFIX(TexCoord2s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord2s), .-GL_PREFIX(TexCoord2s) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord2sv) + .type GL_PREFIX(TexCoord2sv), @function +GL_PREFIX(TexCoord2sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 872(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord2sv), .-GL_PREFIX(TexCoord2sv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord3d) + .type GL_PREFIX(TexCoord3d), @function +GL_PREFIX(TexCoord3d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 880(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord3d), .-GL_PREFIX(TexCoord3d) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord3dv) + .type GL_PREFIX(TexCoord3dv), @function +GL_PREFIX(TexCoord3dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord3dv), .-GL_PREFIX(TexCoord3dv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord3f) + .type GL_PREFIX(TexCoord3f), @function +GL_PREFIX(TexCoord3f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 896(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord3f), .-GL_PREFIX(TexCoord3f) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord3fv) + .type GL_PREFIX(TexCoord3fv), @function +GL_PREFIX(TexCoord3fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord3fv), .-GL_PREFIX(TexCoord3fv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord3i) + .type GL_PREFIX(TexCoord3i), @function +GL_PREFIX(TexCoord3i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord3i), .-GL_PREFIX(TexCoord3i) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord3iv) + .type GL_PREFIX(TexCoord3iv), @function +GL_PREFIX(TexCoord3iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord3iv), .-GL_PREFIX(TexCoord3iv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord3s) + .type GL_PREFIX(TexCoord3s), @function +GL_PREFIX(TexCoord3s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord3s), .-GL_PREFIX(TexCoord3s) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord3sv) + .type GL_PREFIX(TexCoord3sv), @function +GL_PREFIX(TexCoord3sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord3sv), .-GL_PREFIX(TexCoord3sv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord4d) + .type GL_PREFIX(TexCoord4d), @function +GL_PREFIX(TexCoord4d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 944(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord4d), .-GL_PREFIX(TexCoord4d) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord4dv) + .type GL_PREFIX(TexCoord4dv), @function +GL_PREFIX(TexCoord4dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord4dv), .-GL_PREFIX(TexCoord4dv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord4f) + .type GL_PREFIX(TexCoord4f), @function +GL_PREFIX(TexCoord4f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 960(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord4f), .-GL_PREFIX(TexCoord4f) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord4fv) + .type GL_PREFIX(TexCoord4fv), @function +GL_PREFIX(TexCoord4fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 968(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord4fv), .-GL_PREFIX(TexCoord4fv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord4i) + .type GL_PREFIX(TexCoord4i), @function +GL_PREFIX(TexCoord4i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 976(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord4i), .-GL_PREFIX(TexCoord4i) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord4iv) + .type GL_PREFIX(TexCoord4iv), @function +GL_PREFIX(TexCoord4iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord4iv), .-GL_PREFIX(TexCoord4iv) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord4s) + .type GL_PREFIX(TexCoord4s), @function +GL_PREFIX(TexCoord4s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord4s), .-GL_PREFIX(TexCoord4s) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoord4sv) + .type GL_PREFIX(TexCoord4sv), @function +GL_PREFIX(TexCoord4sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoord4sv), .-GL_PREFIX(TexCoord4sv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex2d) + .type GL_PREFIX(Vertex2d), @function +GL_PREFIX(Vertex2d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1008(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex2d), .-GL_PREFIX(Vertex2d) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex2dv) + .type GL_PREFIX(Vertex2dv), @function +GL_PREFIX(Vertex2dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex2dv), .-GL_PREFIX(Vertex2dv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex2f) + .type GL_PREFIX(Vertex2f), @function +GL_PREFIX(Vertex2f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1024(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex2f), .-GL_PREFIX(Vertex2f) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex2fv) + .type GL_PREFIX(Vertex2fv), @function +GL_PREFIX(Vertex2fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex2fv), .-GL_PREFIX(Vertex2fv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex2i) + .type GL_PREFIX(Vertex2i), @function +GL_PREFIX(Vertex2i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex2i), .-GL_PREFIX(Vertex2i) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex2iv) + .type GL_PREFIX(Vertex2iv), @function +GL_PREFIX(Vertex2iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex2iv), .-GL_PREFIX(Vertex2iv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex2s) + .type GL_PREFIX(Vertex2s), @function +GL_PREFIX(Vertex2s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex2s), .-GL_PREFIX(Vertex2s) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex2sv) + .type GL_PREFIX(Vertex2sv), @function +GL_PREFIX(Vertex2sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex2sv), .-GL_PREFIX(Vertex2sv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex3d) + .type GL_PREFIX(Vertex3d), @function +GL_PREFIX(Vertex3d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1072(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex3d), .-GL_PREFIX(Vertex3d) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex3dv) + .type GL_PREFIX(Vertex3dv), @function +GL_PREFIX(Vertex3dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex3dv), .-GL_PREFIX(Vertex3dv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex3f) + .type GL_PREFIX(Vertex3f), @function +GL_PREFIX(Vertex3f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1088(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex3f), .-GL_PREFIX(Vertex3f) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex3fv) + .type GL_PREFIX(Vertex3fv), @function +GL_PREFIX(Vertex3fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex3fv), .-GL_PREFIX(Vertex3fv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex3i) + .type GL_PREFIX(Vertex3i), @function +GL_PREFIX(Vertex3i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex3i), .-GL_PREFIX(Vertex3i) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex3iv) + .type GL_PREFIX(Vertex3iv), @function +GL_PREFIX(Vertex3iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex3iv), .-GL_PREFIX(Vertex3iv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex3s) + .type GL_PREFIX(Vertex3s), @function +GL_PREFIX(Vertex3s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex3s), .-GL_PREFIX(Vertex3s) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex3sv) + .type GL_PREFIX(Vertex3sv), @function +GL_PREFIX(Vertex3sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex3sv), .-GL_PREFIX(Vertex3sv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex4d) + .type GL_PREFIX(Vertex4d), @function +GL_PREFIX(Vertex4d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1136(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex4d), .-GL_PREFIX(Vertex4d) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex4dv) + .type GL_PREFIX(Vertex4dv), @function +GL_PREFIX(Vertex4dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex4dv), .-GL_PREFIX(Vertex4dv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex4f) + .type GL_PREFIX(Vertex4f), @function +GL_PREFIX(Vertex4f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1152(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex4f), .-GL_PREFIX(Vertex4f) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex4fv) + .type GL_PREFIX(Vertex4fv), @function +GL_PREFIX(Vertex4fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex4fv), .-GL_PREFIX(Vertex4fv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex4i) + .type GL_PREFIX(Vertex4i), @function +GL_PREFIX(Vertex4i): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex4i), .-GL_PREFIX(Vertex4i) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex4iv) + .type GL_PREFIX(Vertex4iv), @function +GL_PREFIX(Vertex4iv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex4iv), .-GL_PREFIX(Vertex4iv) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex4s) + .type GL_PREFIX(Vertex4s), @function +GL_PREFIX(Vertex4s): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex4s), .-GL_PREFIX(Vertex4s) + + .p2align 4,,15 + .globl GL_PREFIX(Vertex4sv) + .type GL_PREFIX(Vertex4sv), @function +GL_PREFIX(Vertex4sv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Vertex4sv), .-GL_PREFIX(Vertex4sv) + + .p2align 4,,15 + .globl GL_PREFIX(ClipPlane) + .type GL_PREFIX(ClipPlane), @function +GL_PREFIX(ClipPlane): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ClipPlane), .-GL_PREFIX(ClipPlane) + + .p2align 4,,15 + .globl GL_PREFIX(ColorMaterial) + .type GL_PREFIX(ColorMaterial), @function +GL_PREFIX(ColorMaterial): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorMaterial), .-GL_PREFIX(ColorMaterial) + + .p2align 4,,15 + .globl GL_PREFIX(CullFace) + .type GL_PREFIX(CullFace), @function +GL_PREFIX(CullFace): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1216(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CullFace), .-GL_PREFIX(CullFace) + + .p2align 4,,15 + .globl GL_PREFIX(Fogf) + .type GL_PREFIX(Fogf), @function +GL_PREFIX(Fogf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1224(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Fogf), .-GL_PREFIX(Fogf) + + .p2align 4,,15 + .globl GL_PREFIX(Fogfv) + .type GL_PREFIX(Fogfv), @function +GL_PREFIX(Fogfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Fogfv), .-GL_PREFIX(Fogfv) + + .p2align 4,,15 + .globl GL_PREFIX(Fogi) + .type GL_PREFIX(Fogi), @function +GL_PREFIX(Fogi): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Fogi), .-GL_PREFIX(Fogi) + + .p2align 4,,15 + .globl GL_PREFIX(Fogiv) + .type GL_PREFIX(Fogiv), @function +GL_PREFIX(Fogiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Fogiv), .-GL_PREFIX(Fogiv) + + .p2align 4,,15 + .globl GL_PREFIX(FrontFace) + .type GL_PREFIX(FrontFace), @function +GL_PREFIX(FrontFace): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FrontFace), .-GL_PREFIX(FrontFace) + + .p2align 4,,15 + .globl GL_PREFIX(Hint) + .type GL_PREFIX(Hint), @function +GL_PREFIX(Hint): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Hint), .-GL_PREFIX(Hint) + + .p2align 4,,15 + .globl GL_PREFIX(Lightf) + .type GL_PREFIX(Lightf), @function +GL_PREFIX(Lightf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1272(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Lightf), .-GL_PREFIX(Lightf) + + .p2align 4,,15 + .globl GL_PREFIX(Lightfv) + .type GL_PREFIX(Lightfv), @function +GL_PREFIX(Lightfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Lightfv), .-GL_PREFIX(Lightfv) + + .p2align 4,,15 + .globl GL_PREFIX(Lighti) + .type GL_PREFIX(Lighti), @function +GL_PREFIX(Lighti): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Lighti), .-GL_PREFIX(Lighti) + + .p2align 4,,15 + .globl GL_PREFIX(Lightiv) + .type GL_PREFIX(Lightiv), @function +GL_PREFIX(Lightiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Lightiv), .-GL_PREFIX(Lightiv) + + .p2align 4,,15 + .globl GL_PREFIX(LightModelf) + .type GL_PREFIX(LightModelf), @function +GL_PREFIX(LightModelf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1304(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LightModelf), .-GL_PREFIX(LightModelf) + + .p2align 4,,15 + .globl GL_PREFIX(LightModelfv) + .type GL_PREFIX(LightModelfv), @function +GL_PREFIX(LightModelfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LightModelfv), .-GL_PREFIX(LightModelfv) + + .p2align 4,,15 + .globl GL_PREFIX(LightModeli) + .type GL_PREFIX(LightModeli), @function +GL_PREFIX(LightModeli): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LightModeli), .-GL_PREFIX(LightModeli) + + .p2align 4,,15 + .globl GL_PREFIX(LightModeliv) + .type GL_PREFIX(LightModeliv), @function +GL_PREFIX(LightModeliv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LightModeliv), .-GL_PREFIX(LightModeliv) + + .p2align 4,,15 + .globl GL_PREFIX(LineStipple) + .type GL_PREFIX(LineStipple), @function +GL_PREFIX(LineStipple): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LineStipple), .-GL_PREFIX(LineStipple) + + .p2align 4,,15 + .globl GL_PREFIX(LineWidth) + .type GL_PREFIX(LineWidth), @function +GL_PREFIX(LineWidth): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1344(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LineWidth), .-GL_PREFIX(LineWidth) + + .p2align 4,,15 + .globl GL_PREFIX(Materialf) + .type GL_PREFIX(Materialf), @function +GL_PREFIX(Materialf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1352(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Materialf), .-GL_PREFIX(Materialf) + + .p2align 4,,15 + .globl GL_PREFIX(Materialfv) + .type GL_PREFIX(Materialfv), @function +GL_PREFIX(Materialfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Materialfv), .-GL_PREFIX(Materialfv) + + .p2align 4,,15 + .globl GL_PREFIX(Materiali) + .type GL_PREFIX(Materiali), @function +GL_PREFIX(Materiali): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1368(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Materiali), .-GL_PREFIX(Materiali) + + .p2align 4,,15 + .globl GL_PREFIX(Materialiv) + .type GL_PREFIX(Materialiv), @function +GL_PREFIX(Materialiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Materialiv), .-GL_PREFIX(Materialiv) + + .p2align 4,,15 + .globl GL_PREFIX(PointSize) + .type GL_PREFIX(PointSize), @function +GL_PREFIX(PointSize): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1384(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PointSize), .-GL_PREFIX(PointSize) + + .p2align 4,,15 + .globl GL_PREFIX(PolygonMode) + .type GL_PREFIX(PolygonMode), @function +GL_PREFIX(PolygonMode): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PolygonMode), .-GL_PREFIX(PolygonMode) + + .p2align 4,,15 + .globl GL_PREFIX(PolygonStipple) + .type GL_PREFIX(PolygonStipple), @function +GL_PREFIX(PolygonStipple): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PolygonStipple), .-GL_PREFIX(PolygonStipple) + + .p2align 4,,15 + .globl GL_PREFIX(Scissor) + .type GL_PREFIX(Scissor), @function +GL_PREFIX(Scissor): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Scissor), .-GL_PREFIX(Scissor) + + .p2align 4,,15 + .globl GL_PREFIX(ShadeModel) + .type GL_PREFIX(ShadeModel), @function +GL_PREFIX(ShadeModel): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ShadeModel), .-GL_PREFIX(ShadeModel) + + .p2align 4,,15 + .globl GL_PREFIX(TexParameterf) + .type GL_PREFIX(TexParameterf), @function +GL_PREFIX(TexParameterf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1424(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexParameterf), .-GL_PREFIX(TexParameterf) + + .p2align 4,,15 + .globl GL_PREFIX(TexParameterfv) + .type GL_PREFIX(TexParameterfv), @function +GL_PREFIX(TexParameterfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexParameterfv), .-GL_PREFIX(TexParameterfv) + + .p2align 4,,15 + .globl GL_PREFIX(TexParameteri) + .type GL_PREFIX(TexParameteri), @function +GL_PREFIX(TexParameteri): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexParameteri), .-GL_PREFIX(TexParameteri) + + .p2align 4,,15 + .globl GL_PREFIX(TexParameteriv) + .type GL_PREFIX(TexParameteriv), @function +GL_PREFIX(TexParameteriv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexParameteriv), .-GL_PREFIX(TexParameteriv) + + .p2align 4,,15 + .globl GL_PREFIX(TexImage1D) + .type GL_PREFIX(TexImage1D), @function +GL_PREFIX(TexImage1D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexImage1D), .-GL_PREFIX(TexImage1D) + + .p2align 4,,15 + .globl GL_PREFIX(TexImage2D) + .type GL_PREFIX(TexImage2D), @function +GL_PREFIX(TexImage2D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexImage2D), .-GL_PREFIX(TexImage2D) + + .p2align 4,,15 + .globl GL_PREFIX(TexEnvf) + .type GL_PREFIX(TexEnvf), @function +GL_PREFIX(TexEnvf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1472(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexEnvf), .-GL_PREFIX(TexEnvf) + + .p2align 4,,15 + .globl GL_PREFIX(TexEnvfv) + .type GL_PREFIX(TexEnvfv), @function +GL_PREFIX(TexEnvfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexEnvfv), .-GL_PREFIX(TexEnvfv) + + .p2align 4,,15 + .globl GL_PREFIX(TexEnvi) + .type GL_PREFIX(TexEnvi), @function +GL_PREFIX(TexEnvi): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexEnvi), .-GL_PREFIX(TexEnvi) + + .p2align 4,,15 + .globl GL_PREFIX(TexEnviv) + .type GL_PREFIX(TexEnviv), @function +GL_PREFIX(TexEnviv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexEnviv), .-GL_PREFIX(TexEnviv) + + .p2align 4,,15 + .globl GL_PREFIX(TexGend) + .type GL_PREFIX(TexGend), @function +GL_PREFIX(TexGend): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1504(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexGend), .-GL_PREFIX(TexGend) + + .p2align 4,,15 + .globl GL_PREFIX(TexGendv) + .type GL_PREFIX(TexGendv), @function +GL_PREFIX(TexGendv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexGendv), .-GL_PREFIX(TexGendv) + + .p2align 4,,15 + .globl GL_PREFIX(TexGenf) + .type GL_PREFIX(TexGenf), @function +GL_PREFIX(TexGenf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1520(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 1520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexGenf), .-GL_PREFIX(TexGenf) + + .p2align 4,,15 + .globl GL_PREFIX(TexGenfv) + .type GL_PREFIX(TexGenfv), @function +GL_PREFIX(TexGenfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexGenfv), .-GL_PREFIX(TexGenfv) + + .p2align 4,,15 + .globl GL_PREFIX(TexGeni) + .type GL_PREFIX(TexGeni), @function +GL_PREFIX(TexGeni): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexGeni), .-GL_PREFIX(TexGeni) + + .p2align 4,,15 + .globl GL_PREFIX(TexGeniv) + .type GL_PREFIX(TexGeniv), @function +GL_PREFIX(TexGeniv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexGeniv), .-GL_PREFIX(TexGeniv) + + .p2align 4,,15 + .globl GL_PREFIX(FeedbackBuffer) + .type GL_PREFIX(FeedbackBuffer), @function +GL_PREFIX(FeedbackBuffer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FeedbackBuffer), .-GL_PREFIX(FeedbackBuffer) + + .p2align 4,,15 + .globl GL_PREFIX(SelectBuffer) + .type GL_PREFIX(SelectBuffer), @function +GL_PREFIX(SelectBuffer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SelectBuffer), .-GL_PREFIX(SelectBuffer) + + .p2align 4,,15 + .globl GL_PREFIX(RenderMode) + .type GL_PREFIX(RenderMode), @function +GL_PREFIX(RenderMode): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RenderMode), .-GL_PREFIX(RenderMode) + + .p2align 4,,15 + .globl GL_PREFIX(InitNames) + .type GL_PREFIX(InitNames), @function +GL_PREFIX(InitNames): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1576(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(InitNames), .-GL_PREFIX(InitNames) + + .p2align 4,,15 + .globl GL_PREFIX(LoadName) + .type GL_PREFIX(LoadName), @function +GL_PREFIX(LoadName): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LoadName), .-GL_PREFIX(LoadName) + + .p2align 4,,15 + .globl GL_PREFIX(PassThrough) + .type GL_PREFIX(PassThrough), @function +GL_PREFIX(PassThrough): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1592(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PassThrough), .-GL_PREFIX(PassThrough) + + .p2align 4,,15 + .globl GL_PREFIX(PopName) + .type GL_PREFIX(PopName), @function +GL_PREFIX(PopName): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1600(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PopName), .-GL_PREFIX(PopName) + + .p2align 4,,15 + .globl GL_PREFIX(PushName) + .type GL_PREFIX(PushName), @function +GL_PREFIX(PushName): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PushName), .-GL_PREFIX(PushName) + + .p2align 4,,15 + .globl GL_PREFIX(DrawBuffer) + .type GL_PREFIX(DrawBuffer), @function +GL_PREFIX(DrawBuffer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawBuffer), .-GL_PREFIX(DrawBuffer) + + .p2align 4,,15 + .globl GL_PREFIX(Clear) + .type GL_PREFIX(Clear), @function +GL_PREFIX(Clear): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Clear), .-GL_PREFIX(Clear) + + .p2align 4,,15 + .globl GL_PREFIX(ClearAccum) + .type GL_PREFIX(ClearAccum), @function +GL_PREFIX(ClearAccum): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1632(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 1632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ClearAccum), .-GL_PREFIX(ClearAccum) + + .p2align 4,,15 + .globl GL_PREFIX(ClearIndex) + .type GL_PREFIX(ClearIndex), @function +GL_PREFIX(ClearIndex): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1640(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ClearIndex), .-GL_PREFIX(ClearIndex) + + .p2align 4,,15 + .globl GL_PREFIX(ClearColor) + .type GL_PREFIX(ClearColor), @function +GL_PREFIX(ClearColor): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ClearColor), .-GL_PREFIX(ClearColor) + + .p2align 4,,15 + .globl GL_PREFIX(ClearStencil) + .type GL_PREFIX(ClearStencil), @function +GL_PREFIX(ClearStencil): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ClearStencil), .-GL_PREFIX(ClearStencil) + + .p2align 4,,15 + .globl GL_PREFIX(ClearDepth) + .type GL_PREFIX(ClearDepth), @function +GL_PREFIX(ClearDepth): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ClearDepth), .-GL_PREFIX(ClearDepth) + + .p2align 4,,15 + .globl GL_PREFIX(StencilMask) + .type GL_PREFIX(StencilMask), @function +GL_PREFIX(StencilMask): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1672(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(StencilMask), .-GL_PREFIX(StencilMask) + + .p2align 4,,15 + .globl GL_PREFIX(ColorMask) + .type GL_PREFIX(ColorMask), @function +GL_PREFIX(ColorMask): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorMask), .-GL_PREFIX(ColorMask) + + .p2align 4,,15 + .globl GL_PREFIX(DepthMask) + .type GL_PREFIX(DepthMask), @function +GL_PREFIX(DepthMask): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1688(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DepthMask), .-GL_PREFIX(DepthMask) + + .p2align 4,,15 + .globl GL_PREFIX(IndexMask) + .type GL_PREFIX(IndexMask), @function +GL_PREFIX(IndexMask): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IndexMask), .-GL_PREFIX(IndexMask) + + .p2align 4,,15 + .globl GL_PREFIX(Accum) + .type GL_PREFIX(Accum), @function +GL_PREFIX(Accum): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1704(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Accum), .-GL_PREFIX(Accum) + + .p2align 4,,15 + .globl GL_PREFIX(Disable) + .type GL_PREFIX(Disable), @function +GL_PREFIX(Disable): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1712(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Disable), .-GL_PREFIX(Disable) + + .p2align 4,,15 + .globl GL_PREFIX(Enable) + .type GL_PREFIX(Enable), @function +GL_PREFIX(Enable): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Enable), .-GL_PREFIX(Enable) + + .p2align 4,,15 + .globl GL_PREFIX(Finish) + .type GL_PREFIX(Finish), @function +GL_PREFIX(Finish): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1728(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Finish), .-GL_PREFIX(Finish) + + .p2align 4,,15 + .globl GL_PREFIX(Flush) + .type GL_PREFIX(Flush), @function +GL_PREFIX(Flush): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1736(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Flush), .-GL_PREFIX(Flush) + + .p2align 4,,15 + .globl GL_PREFIX(PopAttrib) + .type GL_PREFIX(PopAttrib), @function +GL_PREFIX(PopAttrib): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 1744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1744(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 1744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PopAttrib), .-GL_PREFIX(PopAttrib) + + .p2align 4,,15 + .globl GL_PREFIX(PushAttrib) + .type GL_PREFIX(PushAttrib), @function +GL_PREFIX(PushAttrib): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1752(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PushAttrib), .-GL_PREFIX(PushAttrib) + + .p2align 4,,15 + .globl GL_PREFIX(Map1d) + .type GL_PREFIX(Map1d), @function +GL_PREFIX(Map1d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %rcx, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %rcx + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1760(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %rcx, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %rcx + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Map1d), .-GL_PREFIX(Map1d) + + .p2align 4,,15 + .globl GL_PREFIX(Map1f) + .type GL_PREFIX(Map1f), @function +GL_PREFIX(Map1f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %rcx, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %rcx + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1768(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %rcx, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %rcx + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Map1f), .-GL_PREFIX(Map1f) + + .p2align 4,,15 + .globl GL_PREFIX(Map2d) + .type GL_PREFIX(Map2d), @function +GL_PREFIX(Map2d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $88, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + movq %rcx, 56(%rsp) + movq %r8, 64(%rsp) + movq %r9, 72(%rsp) + call _x86_64_get_dispatch@PLT + movq 72(%rsp), %r9 + movq 64(%rsp), %r8 + movq 56(%rsp), %rcx + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $88, %rsp + movq 1776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1776(%rax), %r11 + jmp *%r11 +1: + subq $88, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + movq %rcx, 56(%rsp) + movq %r8, 64(%rsp) + movq %r9, 72(%rsp) + call _glapi_get_dispatch + movq 72(%rsp), %r9 + movq 64(%rsp), %r8 + movq 56(%rsp), %rcx + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $88, %rsp + movq 1776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Map2d), .-GL_PREFIX(Map2d) + + .p2align 4,,15 + .globl GL_PREFIX(Map2f) + .type GL_PREFIX(Map2f), @function +GL_PREFIX(Map2f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $88, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + movq %rcx, 56(%rsp) + movq %r8, 64(%rsp) + movq %r9, 72(%rsp) + call _x86_64_get_dispatch@PLT + movq 72(%rsp), %r9 + movq 64(%rsp), %r8 + movq 56(%rsp), %rcx + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $88, %rsp + movq 1784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1784(%rax), %r11 + jmp *%r11 +1: + subq $88, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %rdx, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + movq %rcx, 56(%rsp) + movq %r8, 64(%rsp) + movq %r9, 72(%rsp) + call _glapi_get_dispatch + movq 72(%rsp), %r9 + movq 64(%rsp), %r8 + movq 56(%rsp), %rcx + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %rdx + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $88, %rsp + movq 1784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Map2f), .-GL_PREFIX(Map2f) + + .p2align 4,,15 + .globl GL_PREFIX(MapGrid1d) + .type GL_PREFIX(MapGrid1d), @function +GL_PREFIX(MapGrid1d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1792(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MapGrid1d), .-GL_PREFIX(MapGrid1d) + + .p2align 4,,15 + .globl GL_PREFIX(MapGrid1f) + .type GL_PREFIX(MapGrid1f), @function +GL_PREFIX(MapGrid1f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1800(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MapGrid1f), .-GL_PREFIX(MapGrid1f) + + .p2align 4,,15 + .globl GL_PREFIX(MapGrid2d) + .type GL_PREFIX(MapGrid2d), @function +GL_PREFIX(MapGrid2d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1808(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MapGrid2d), .-GL_PREFIX(MapGrid2d) + + .p2align 4,,15 + .globl GL_PREFIX(MapGrid2f) + .type GL_PREFIX(MapGrid2f), @function +GL_PREFIX(MapGrid2f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1816(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %rsi, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %rsi + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $56, %rsp + movq 1816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MapGrid2f), .-GL_PREFIX(MapGrid2f) + + .p2align 4,,15 + .globl GL_PREFIX(EvalCoord1d) + .type GL_PREFIX(EvalCoord1d), @function +GL_PREFIX(EvalCoord1d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1824(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalCoord1d), .-GL_PREFIX(EvalCoord1d) + + .p2align 4,,15 + .globl GL_PREFIX(EvalCoord1dv) + .type GL_PREFIX(EvalCoord1dv), @function +GL_PREFIX(EvalCoord1dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1832(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalCoord1dv), .-GL_PREFIX(EvalCoord1dv) + + .p2align 4,,15 + .globl GL_PREFIX(EvalCoord1f) + .type GL_PREFIX(EvalCoord1f), @function +GL_PREFIX(EvalCoord1f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1840(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 1840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalCoord1f), .-GL_PREFIX(EvalCoord1f) + + .p2align 4,,15 + .globl GL_PREFIX(EvalCoord1fv) + .type GL_PREFIX(EvalCoord1fv), @function +GL_PREFIX(EvalCoord1fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalCoord1fv), .-GL_PREFIX(EvalCoord1fv) + + .p2align 4,,15 + .globl GL_PREFIX(EvalCoord2d) + .type GL_PREFIX(EvalCoord2d), @function +GL_PREFIX(EvalCoord2d): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1856(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalCoord2d), .-GL_PREFIX(EvalCoord2d) + + .p2align 4,,15 + .globl GL_PREFIX(EvalCoord2dv) + .type GL_PREFIX(EvalCoord2dv), @function +GL_PREFIX(EvalCoord2dv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalCoord2dv), .-GL_PREFIX(EvalCoord2dv) + + .p2align 4,,15 + .globl GL_PREFIX(EvalCoord2f) + .type GL_PREFIX(EvalCoord2f), @function +GL_PREFIX(EvalCoord2f): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1872(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalCoord2f), .-GL_PREFIX(EvalCoord2f) + + .p2align 4,,15 + .globl GL_PREFIX(EvalCoord2fv) + .type GL_PREFIX(EvalCoord2fv), @function +GL_PREFIX(EvalCoord2fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1880(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalCoord2fv), .-GL_PREFIX(EvalCoord2fv) + + .p2align 4,,15 + .globl GL_PREFIX(EvalMesh1) + .type GL_PREFIX(EvalMesh1), @function +GL_PREFIX(EvalMesh1): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalMesh1), .-GL_PREFIX(EvalMesh1) + + .p2align 4,,15 + .globl GL_PREFIX(EvalPoint1) + .type GL_PREFIX(EvalPoint1), @function +GL_PREFIX(EvalPoint1): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1896(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalPoint1), .-GL_PREFIX(EvalPoint1) + + .p2align 4,,15 + .globl GL_PREFIX(EvalMesh2) + .type GL_PREFIX(EvalMesh2), @function +GL_PREFIX(EvalMesh2): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 1904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalMesh2), .-GL_PREFIX(EvalMesh2) + + .p2align 4,,15 + .globl GL_PREFIX(EvalPoint2) + .type GL_PREFIX(EvalPoint2), @function +GL_PREFIX(EvalPoint2): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EvalPoint2), .-GL_PREFIX(EvalPoint2) + + .p2align 4,,15 + .globl GL_PREFIX(AlphaFunc) + .type GL_PREFIX(AlphaFunc), @function +GL_PREFIX(AlphaFunc): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(AlphaFunc), .-GL_PREFIX(AlphaFunc) + + .p2align 4,,15 + .globl GL_PREFIX(BlendFunc) + .type GL_PREFIX(BlendFunc), @function +GL_PREFIX(BlendFunc): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BlendFunc), .-GL_PREFIX(BlendFunc) + + .p2align 4,,15 + .globl GL_PREFIX(LogicOp) + .type GL_PREFIX(LogicOp), @function +GL_PREFIX(LogicOp): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LogicOp), .-GL_PREFIX(LogicOp) + + .p2align 4,,15 + .globl GL_PREFIX(StencilFunc) + .type GL_PREFIX(StencilFunc), @function +GL_PREFIX(StencilFunc): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(StencilFunc), .-GL_PREFIX(StencilFunc) + + .p2align 4,,15 + .globl GL_PREFIX(StencilOp) + .type GL_PREFIX(StencilOp), @function +GL_PREFIX(StencilOp): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 1952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 1952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(StencilOp), .-GL_PREFIX(StencilOp) + + .p2align 4,,15 + .globl GL_PREFIX(DepthFunc) + .type GL_PREFIX(DepthFunc), @function +GL_PREFIX(DepthFunc): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 1960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 1960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DepthFunc), .-GL_PREFIX(DepthFunc) + + .p2align 4,,15 + .globl GL_PREFIX(PixelZoom) + .type GL_PREFIX(PixelZoom), @function +GL_PREFIX(PixelZoom): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1968(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 1968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PixelZoom), .-GL_PREFIX(PixelZoom) + + .p2align 4,,15 + .globl GL_PREFIX(PixelTransferf) + .type GL_PREFIX(PixelTransferf), @function +GL_PREFIX(PixelTransferf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1976(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PixelTransferf), .-GL_PREFIX(PixelTransferf) + + .p2align 4,,15 + .globl GL_PREFIX(PixelTransferi) + .type GL_PREFIX(PixelTransferi), @function +GL_PREFIX(PixelTransferi): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 1984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 1984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PixelTransferi), .-GL_PREFIX(PixelTransferi) + + .p2align 4,,15 + .globl GL_PREFIX(PixelStoref) + .type GL_PREFIX(PixelStoref), @function +GL_PREFIX(PixelStoref): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 1992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 1992(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 1992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PixelStoref), .-GL_PREFIX(PixelStoref) + + .p2align 4,,15 + .globl GL_PREFIX(PixelStorei) + .type GL_PREFIX(PixelStorei), @function +GL_PREFIX(PixelStorei): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PixelStorei), .-GL_PREFIX(PixelStorei) + + .p2align 4,,15 + .globl GL_PREFIX(PixelMapfv) + .type GL_PREFIX(PixelMapfv), @function +GL_PREFIX(PixelMapfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2008(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PixelMapfv), .-GL_PREFIX(PixelMapfv) + + .p2align 4,,15 + .globl GL_PREFIX(PixelMapuiv) + .type GL_PREFIX(PixelMapuiv), @function +GL_PREFIX(PixelMapuiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PixelMapuiv), .-GL_PREFIX(PixelMapuiv) + + .p2align 4,,15 + .globl GL_PREFIX(PixelMapusv) + .type GL_PREFIX(PixelMapusv), @function +GL_PREFIX(PixelMapusv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2024(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PixelMapusv), .-GL_PREFIX(PixelMapusv) + + .p2align 4,,15 + .globl GL_PREFIX(ReadBuffer) + .type GL_PREFIX(ReadBuffer), @function +GL_PREFIX(ReadBuffer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ReadBuffer), .-GL_PREFIX(ReadBuffer) + + .p2align 4,,15 + .globl GL_PREFIX(CopyPixels) + .type GL_PREFIX(CopyPixels), @function +GL_PREFIX(CopyPixels): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyPixels), .-GL_PREFIX(CopyPixels) + + .p2align 4,,15 + .globl GL_PREFIX(ReadPixels) + .type GL_PREFIX(ReadPixels), @function +GL_PREFIX(ReadPixels): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ReadPixels), .-GL_PREFIX(ReadPixels) + + .p2align 4,,15 + .globl GL_PREFIX(DrawPixels) + .type GL_PREFIX(DrawPixels), @function +GL_PREFIX(DrawPixels): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawPixels), .-GL_PREFIX(DrawPixels) + + .p2align 4,,15 + .globl GL_PREFIX(GetBooleanv) + .type GL_PREFIX(GetBooleanv), @function +GL_PREFIX(GetBooleanv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetBooleanv), .-GL_PREFIX(GetBooleanv) + + .p2align 4,,15 + .globl GL_PREFIX(GetClipPlane) + .type GL_PREFIX(GetClipPlane), @function +GL_PREFIX(GetClipPlane): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2072(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetClipPlane), .-GL_PREFIX(GetClipPlane) + + .p2align 4,,15 + .globl GL_PREFIX(GetDoublev) + .type GL_PREFIX(GetDoublev), @function +GL_PREFIX(GetDoublev): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetDoublev), .-GL_PREFIX(GetDoublev) + + .p2align 4,,15 + .globl GL_PREFIX(GetError) + .type GL_PREFIX(GetError), @function +GL_PREFIX(GetError): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2088(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetError), .-GL_PREFIX(GetError) + + .p2align 4,,15 + .globl GL_PREFIX(GetFloatv) + .type GL_PREFIX(GetFloatv), @function +GL_PREFIX(GetFloatv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetFloatv), .-GL_PREFIX(GetFloatv) + + .p2align 4,,15 + .globl GL_PREFIX(GetIntegerv) + .type GL_PREFIX(GetIntegerv), @function +GL_PREFIX(GetIntegerv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetIntegerv), .-GL_PREFIX(GetIntegerv) + + .p2align 4,,15 + .globl GL_PREFIX(GetLightfv) + .type GL_PREFIX(GetLightfv), @function +GL_PREFIX(GetLightfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetLightfv), .-GL_PREFIX(GetLightfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetLightiv) + .type GL_PREFIX(GetLightiv), @function +GL_PREFIX(GetLightiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetLightiv), .-GL_PREFIX(GetLightiv) + + .p2align 4,,15 + .globl GL_PREFIX(GetMapdv) + .type GL_PREFIX(GetMapdv), @function +GL_PREFIX(GetMapdv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetMapdv), .-GL_PREFIX(GetMapdv) + + .p2align 4,,15 + .globl GL_PREFIX(GetMapfv) + .type GL_PREFIX(GetMapfv), @function +GL_PREFIX(GetMapfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetMapfv), .-GL_PREFIX(GetMapfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetMapiv) + .type GL_PREFIX(GetMapiv), @function +GL_PREFIX(GetMapiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetMapiv), .-GL_PREFIX(GetMapiv) + + .p2align 4,,15 + .globl GL_PREFIX(GetMaterialfv) + .type GL_PREFIX(GetMaterialfv), @function +GL_PREFIX(GetMaterialfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetMaterialfv), .-GL_PREFIX(GetMaterialfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetMaterialiv) + .type GL_PREFIX(GetMaterialiv), @function +GL_PREFIX(GetMaterialiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetMaterialiv), .-GL_PREFIX(GetMaterialiv) + + .p2align 4,,15 + .globl GL_PREFIX(GetPixelMapfv) + .type GL_PREFIX(GetPixelMapfv), @function +GL_PREFIX(GetPixelMapfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetPixelMapfv), .-GL_PREFIX(GetPixelMapfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetPixelMapuiv) + .type GL_PREFIX(GetPixelMapuiv), @function +GL_PREFIX(GetPixelMapuiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetPixelMapuiv), .-GL_PREFIX(GetPixelMapuiv) + + .p2align 4,,15 + .globl GL_PREFIX(GetPixelMapusv) + .type GL_PREFIX(GetPixelMapusv), @function +GL_PREFIX(GetPixelMapusv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetPixelMapusv), .-GL_PREFIX(GetPixelMapusv) + + .p2align 4,,15 + .globl GL_PREFIX(GetPolygonStipple) + .type GL_PREFIX(GetPolygonStipple), @function +GL_PREFIX(GetPolygonStipple): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetPolygonStipple), .-GL_PREFIX(GetPolygonStipple) + + .p2align 4,,15 + .globl GL_PREFIX(GetString) + .type GL_PREFIX(GetString), @function +GL_PREFIX(GetString): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetString), .-GL_PREFIX(GetString) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexEnvfv) + .type GL_PREFIX(GetTexEnvfv), @function +GL_PREFIX(GetTexEnvfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexEnvfv), .-GL_PREFIX(GetTexEnvfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexEnviv) + .type GL_PREFIX(GetTexEnviv), @function +GL_PREFIX(GetTexEnviv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2216(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexEnviv), .-GL_PREFIX(GetTexEnviv) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexGendv) + .type GL_PREFIX(GetTexGendv), @function +GL_PREFIX(GetTexGendv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexGendv), .-GL_PREFIX(GetTexGendv) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexGenfv) + .type GL_PREFIX(GetTexGenfv), @function +GL_PREFIX(GetTexGenfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexGenfv), .-GL_PREFIX(GetTexGenfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexGeniv) + .type GL_PREFIX(GetTexGeniv), @function +GL_PREFIX(GetTexGeniv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexGeniv), .-GL_PREFIX(GetTexGeniv) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexImage) + .type GL_PREFIX(GetTexImage), @function +GL_PREFIX(GetTexImage): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexImage), .-GL_PREFIX(GetTexImage) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexParameterfv) + .type GL_PREFIX(GetTexParameterfv), @function +GL_PREFIX(GetTexParameterfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexParameterfv), .-GL_PREFIX(GetTexParameterfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexParameteriv) + .type GL_PREFIX(GetTexParameteriv), @function +GL_PREFIX(GetTexParameteriv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexParameteriv), .-GL_PREFIX(GetTexParameteriv) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexLevelParameterfv) + .type GL_PREFIX(GetTexLevelParameterfv), @function +GL_PREFIX(GetTexLevelParameterfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexLevelParameterfv), .-GL_PREFIX(GetTexLevelParameterfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexLevelParameteriv) + .type GL_PREFIX(GetTexLevelParameteriv), @function +GL_PREFIX(GetTexLevelParameteriv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexLevelParameteriv), .-GL_PREFIX(GetTexLevelParameteriv) + + .p2align 4,,15 + .globl GL_PREFIX(IsEnabled) + .type GL_PREFIX(IsEnabled), @function +GL_PREFIX(IsEnabled): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsEnabled), .-GL_PREFIX(IsEnabled) + + .p2align 4,,15 + .globl GL_PREFIX(IsList) + .type GL_PREFIX(IsList), @function +GL_PREFIX(IsList): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsList), .-GL_PREFIX(IsList) + + .p2align 4,,15 + .globl GL_PREFIX(DepthRange) + .type GL_PREFIX(DepthRange), @function +GL_PREFIX(DepthRange): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DepthRange), .-GL_PREFIX(DepthRange) + + .p2align 4,,15 + .globl GL_PREFIX(Frustum) + .type GL_PREFIX(Frustum), @function +GL_PREFIX(Frustum): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + movq %xmm4, 32(%rsp) + movq %xmm5, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm5 + movq 32(%rsp), %xmm4 + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $56, %rsp + movq 2312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2312(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + movq %xmm4, 32(%rsp) + movq %xmm5, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm5 + movq 32(%rsp), %xmm4 + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $56, %rsp + movq 2312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Frustum), .-GL_PREFIX(Frustum) + + .p2align 4,,15 + .globl GL_PREFIX(LoadIdentity) + .type GL_PREFIX(LoadIdentity), @function +GL_PREFIX(LoadIdentity): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2320(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LoadIdentity), .-GL_PREFIX(LoadIdentity) + + .p2align 4,,15 + .globl GL_PREFIX(LoadMatrixf) + .type GL_PREFIX(LoadMatrixf), @function +GL_PREFIX(LoadMatrixf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LoadMatrixf), .-GL_PREFIX(LoadMatrixf) + + .p2align 4,,15 + .globl GL_PREFIX(LoadMatrixd) + .type GL_PREFIX(LoadMatrixd), @function +GL_PREFIX(LoadMatrixd): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LoadMatrixd), .-GL_PREFIX(LoadMatrixd) + + .p2align 4,,15 + .globl GL_PREFIX(MatrixMode) + .type GL_PREFIX(MatrixMode), @function +GL_PREFIX(MatrixMode): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2344(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MatrixMode), .-GL_PREFIX(MatrixMode) + + .p2align 4,,15 + .globl GL_PREFIX(MultMatrixf) + .type GL_PREFIX(MultMatrixf), @function +GL_PREFIX(MultMatrixf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultMatrixf), .-GL_PREFIX(MultMatrixf) + + .p2align 4,,15 + .globl GL_PREFIX(MultMatrixd) + .type GL_PREFIX(MultMatrixd), @function +GL_PREFIX(MultMatrixd): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultMatrixd), .-GL_PREFIX(MultMatrixd) + + .p2align 4,,15 + .globl GL_PREFIX(Ortho) + .type GL_PREFIX(Ortho), @function +GL_PREFIX(Ortho): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + movq %xmm4, 32(%rsp) + movq %xmm5, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm5 + movq 32(%rsp), %xmm4 + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $56, %rsp + movq 2368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2368(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + movq %xmm4, 32(%rsp) + movq %xmm5, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm5 + movq 32(%rsp), %xmm4 + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $56, %rsp + movq 2368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Ortho), .-GL_PREFIX(Ortho) + + .p2align 4,,15 + .globl GL_PREFIX(PopMatrix) + .type GL_PREFIX(PopMatrix), @function +GL_PREFIX(PopMatrix): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2376(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PopMatrix), .-GL_PREFIX(PopMatrix) + + .p2align 4,,15 + .globl GL_PREFIX(PushMatrix) + .type GL_PREFIX(PushMatrix), @function +GL_PREFIX(PushMatrix): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2384(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PushMatrix), .-GL_PREFIX(PushMatrix) + + .p2align 4,,15 + .globl GL_PREFIX(Rotated) + .type GL_PREFIX(Rotated), @function +GL_PREFIX(Rotated): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 2392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2392(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 2392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Rotated), .-GL_PREFIX(Rotated) + + .p2align 4,,15 + .globl GL_PREFIX(Rotatef) + .type GL_PREFIX(Rotatef), @function +GL_PREFIX(Rotatef): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 2400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2400(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 2400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Rotatef), .-GL_PREFIX(Rotatef) + + .p2align 4,,15 + .globl GL_PREFIX(Scaled) + .type GL_PREFIX(Scaled), @function +GL_PREFIX(Scaled): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2408(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Scaled), .-GL_PREFIX(Scaled) + + .p2align 4,,15 + .globl GL_PREFIX(Scalef) + .type GL_PREFIX(Scalef), @function +GL_PREFIX(Scalef): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2416(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Scalef), .-GL_PREFIX(Scalef) + + .p2align 4,,15 + .globl GL_PREFIX(Translated) + .type GL_PREFIX(Translated), @function +GL_PREFIX(Translated): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2424(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Translated), .-GL_PREFIX(Translated) + + .p2align 4,,15 + .globl GL_PREFIX(Translatef) + .type GL_PREFIX(Translatef), @function +GL_PREFIX(Translatef): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2432(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Translatef), .-GL_PREFIX(Translatef) + + .p2align 4,,15 + .globl GL_PREFIX(Viewport) + .type GL_PREFIX(Viewport), @function +GL_PREFIX(Viewport): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Viewport), .-GL_PREFIX(Viewport) + + .p2align 4,,15 + .globl GL_PREFIX(ArrayElement) + .type GL_PREFIX(ArrayElement), @function +GL_PREFIX(ArrayElement): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ArrayElement), .-GL_PREFIX(ArrayElement) + + .p2align 4,,15 + .globl GL_PREFIX(BindTexture) + .type GL_PREFIX(BindTexture), @function +GL_PREFIX(BindTexture): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindTexture), .-GL_PREFIX(BindTexture) + + .p2align 4,,15 + .globl GL_PREFIX(ColorPointer) + .type GL_PREFIX(ColorPointer), @function +GL_PREFIX(ColorPointer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorPointer), .-GL_PREFIX(ColorPointer) + + .p2align 4,,15 + .globl GL_PREFIX(DisableClientState) + .type GL_PREFIX(DisableClientState), @function +GL_PREFIX(DisableClientState): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DisableClientState), .-GL_PREFIX(DisableClientState) + + .p2align 4,,15 + .globl GL_PREFIX(DrawArrays) + .type GL_PREFIX(DrawArrays), @function +GL_PREFIX(DrawArrays): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawArrays), .-GL_PREFIX(DrawArrays) + + .p2align 4,,15 + .globl GL_PREFIX(DrawElements) + .type GL_PREFIX(DrawElements), @function +GL_PREFIX(DrawElements): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawElements), .-GL_PREFIX(DrawElements) + + .p2align 4,,15 + .globl GL_PREFIX(EdgeFlagPointer) + .type GL_PREFIX(EdgeFlagPointer), @function +GL_PREFIX(EdgeFlagPointer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EdgeFlagPointer), .-GL_PREFIX(EdgeFlagPointer) + + .p2align 4,,15 + .globl GL_PREFIX(EnableClientState) + .type GL_PREFIX(EnableClientState), @function +GL_PREFIX(EnableClientState): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EnableClientState), .-GL_PREFIX(EnableClientState) + + .p2align 4,,15 + .globl GL_PREFIX(IndexPointer) + .type GL_PREFIX(IndexPointer), @function +GL_PREFIX(IndexPointer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IndexPointer), .-GL_PREFIX(IndexPointer) + + .p2align 4,,15 + .globl GL_PREFIX(Indexub) + .type GL_PREFIX(Indexub), @function +GL_PREFIX(Indexub): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexub), .-GL_PREFIX(Indexub) + + .p2align 4,,15 + .globl GL_PREFIX(Indexubv) + .type GL_PREFIX(Indexubv), @function +GL_PREFIX(Indexubv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Indexubv), .-GL_PREFIX(Indexubv) + + .p2align 4,,15 + .globl GL_PREFIX(InterleavedArrays) + .type GL_PREFIX(InterleavedArrays), @function +GL_PREFIX(InterleavedArrays): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(InterleavedArrays), .-GL_PREFIX(InterleavedArrays) + + .p2align 4,,15 + .globl GL_PREFIX(NormalPointer) + .type GL_PREFIX(NormalPointer), @function +GL_PREFIX(NormalPointer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(NormalPointer), .-GL_PREFIX(NormalPointer) + + .p2align 4,,15 + .globl GL_PREFIX(PolygonOffset) + .type GL_PREFIX(PolygonOffset), @function +GL_PREFIX(PolygonOffset): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2552(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 2552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PolygonOffset), .-GL_PREFIX(PolygonOffset) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoordPointer) + .type GL_PREFIX(TexCoordPointer), @function +GL_PREFIX(TexCoordPointer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoordPointer), .-GL_PREFIX(TexCoordPointer) + + .p2align 4,,15 + .globl GL_PREFIX(VertexPointer) + .type GL_PREFIX(VertexPointer), @function +GL_PREFIX(VertexPointer): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexPointer), .-GL_PREFIX(VertexPointer) + + .p2align 4,,15 + .globl GL_PREFIX(AreTexturesResident) + .type GL_PREFIX(AreTexturesResident), @function +GL_PREFIX(AreTexturesResident): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2576(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(AreTexturesResident), .-GL_PREFIX(AreTexturesResident) + + .p2align 4,,15 + .globl GL_PREFIX(CopyTexImage1D) + .type GL_PREFIX(CopyTexImage1D), @function +GL_PREFIX(CopyTexImage1D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyTexImage1D), .-GL_PREFIX(CopyTexImage1D) + + .p2align 4,,15 + .globl GL_PREFIX(CopyTexImage2D) + .type GL_PREFIX(CopyTexImage2D), @function +GL_PREFIX(CopyTexImage2D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyTexImage2D), .-GL_PREFIX(CopyTexImage2D) + + .p2align 4,,15 + .globl GL_PREFIX(CopyTexSubImage1D) + .type GL_PREFIX(CopyTexSubImage1D), @function +GL_PREFIX(CopyTexSubImage1D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyTexSubImage1D), .-GL_PREFIX(CopyTexSubImage1D) + + .p2align 4,,15 + .globl GL_PREFIX(CopyTexSubImage2D) + .type GL_PREFIX(CopyTexSubImage2D), @function +GL_PREFIX(CopyTexSubImage2D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyTexSubImage2D), .-GL_PREFIX(CopyTexSubImage2D) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteTextures) + .type GL_PREFIX(DeleteTextures), @function +GL_PREFIX(DeleteTextures): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteTextures), .-GL_PREFIX(DeleteTextures) + + .p2align 4,,15 + .globl GL_PREFIX(GenTextures) + .type GL_PREFIX(GenTextures), @function +GL_PREFIX(GenTextures): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenTextures), .-GL_PREFIX(GenTextures) + + .p2align 4,,15 + .globl GL_PREFIX(GetPointerv) + .type GL_PREFIX(GetPointerv), @function +GL_PREFIX(GetPointerv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 2632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2632(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 2632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetPointerv), .-GL_PREFIX(GetPointerv) + + .p2align 4,,15 + .globl GL_PREFIX(IsTexture) + .type GL_PREFIX(IsTexture), @function +GL_PREFIX(IsTexture): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2640(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsTexture), .-GL_PREFIX(IsTexture) + + .p2align 4,,15 + .globl GL_PREFIX(PrioritizeTextures) + .type GL_PREFIX(PrioritizeTextures), @function +GL_PREFIX(PrioritizeTextures): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PrioritizeTextures), .-GL_PREFIX(PrioritizeTextures) + + .p2align 4,,15 + .globl GL_PREFIX(TexSubImage1D) + .type GL_PREFIX(TexSubImage1D), @function +GL_PREFIX(TexSubImage1D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexSubImage1D), .-GL_PREFIX(TexSubImage1D) + + .p2align 4,,15 + .globl GL_PREFIX(TexSubImage2D) + .type GL_PREFIX(TexSubImage2D), @function +GL_PREFIX(TexSubImage2D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexSubImage2D), .-GL_PREFIX(TexSubImage2D) + + .p2align 4,,15 + .globl GL_PREFIX(PopClientAttrib) + .type GL_PREFIX(PopClientAttrib), @function +GL_PREFIX(PopClientAttrib): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 2672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2672(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 2672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PopClientAttrib), .-GL_PREFIX(PopClientAttrib) + + .p2align 4,,15 + .globl GL_PREFIX(PushClientAttrib) + .type GL_PREFIX(PushClientAttrib), @function +GL_PREFIX(PushClientAttrib): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PushClientAttrib), .-GL_PREFIX(PushClientAttrib) + + .p2align 4,,15 + .globl GL_PREFIX(BlendColor) + .type GL_PREFIX(BlendColor), @function +GL_PREFIX(BlendColor): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2688(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BlendColor), .-GL_PREFIX(BlendColor) + + .p2align 4,,15 + .globl GL_PREFIX(BlendEquation) + .type GL_PREFIX(BlendEquation), @function +GL_PREFIX(BlendEquation): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BlendEquation), .-GL_PREFIX(BlendEquation) + + .p2align 4,,15 + .globl GL_PREFIX(DrawRangeElements) + .type GL_PREFIX(DrawRangeElements), @function +GL_PREFIX(DrawRangeElements): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2704(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawRangeElements), .-GL_PREFIX(DrawRangeElements) + + .p2align 4,,15 + .globl GL_PREFIX(ColorTable) + .type GL_PREFIX(ColorTable), @function +GL_PREFIX(ColorTable): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2712(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorTable), .-GL_PREFIX(ColorTable) + + .p2align 4,,15 + .globl GL_PREFIX(ColorTableParameterfv) + .type GL_PREFIX(ColorTableParameterfv), @function +GL_PREFIX(ColorTableParameterfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorTableParameterfv), .-GL_PREFIX(ColorTableParameterfv) + + .p2align 4,,15 + .globl GL_PREFIX(ColorTableParameteriv) + .type GL_PREFIX(ColorTableParameteriv), @function +GL_PREFIX(ColorTableParameteriv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2728(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorTableParameteriv), .-GL_PREFIX(ColorTableParameteriv) + + .p2align 4,,15 + .globl GL_PREFIX(CopyColorTable) + .type GL_PREFIX(CopyColorTable), @function +GL_PREFIX(CopyColorTable): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2736(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyColorTable), .-GL_PREFIX(CopyColorTable) + + .p2align 4,,15 + .globl GL_PREFIX(GetColorTable) + .type GL_PREFIX(GetColorTable), @function +GL_PREFIX(GetColorTable): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetColorTable), .-GL_PREFIX(GetColorTable) + + .p2align 4,,15 + .globl GL_PREFIX(GetColorTableParameterfv) + .type GL_PREFIX(GetColorTableParameterfv), @function +GL_PREFIX(GetColorTableParameterfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2752(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetColorTableParameterfv), .-GL_PREFIX(GetColorTableParameterfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetColorTableParameteriv) + .type GL_PREFIX(GetColorTableParameteriv), @function +GL_PREFIX(GetColorTableParameteriv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2760(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetColorTableParameteriv), .-GL_PREFIX(GetColorTableParameteriv) + + .p2align 4,,15 + .globl GL_PREFIX(ColorSubTable) + .type GL_PREFIX(ColorSubTable), @function +GL_PREFIX(ColorSubTable): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2768(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorSubTable), .-GL_PREFIX(ColorSubTable) + + .p2align 4,,15 + .globl GL_PREFIX(CopyColorSubTable) + .type GL_PREFIX(CopyColorSubTable), @function +GL_PREFIX(CopyColorSubTable): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2776(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyColorSubTable), .-GL_PREFIX(CopyColorSubTable) + + .p2align 4,,15 + .globl GL_PREFIX(ConvolutionFilter1D) + .type GL_PREFIX(ConvolutionFilter1D), @function +GL_PREFIX(ConvolutionFilter1D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2784(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ConvolutionFilter1D), .-GL_PREFIX(ConvolutionFilter1D) + + .p2align 4,,15 + .globl GL_PREFIX(ConvolutionFilter2D) + .type GL_PREFIX(ConvolutionFilter2D), @function +GL_PREFIX(ConvolutionFilter2D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2792(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ConvolutionFilter2D), .-GL_PREFIX(ConvolutionFilter2D) + + .p2align 4,,15 + .globl GL_PREFIX(ConvolutionParameterf) + .type GL_PREFIX(ConvolutionParameterf), @function +GL_PREFIX(ConvolutionParameterf): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 2800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2800(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $24, %rsp + movq 2800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ConvolutionParameterf), .-GL_PREFIX(ConvolutionParameterf) + + .p2align 4,,15 + .globl GL_PREFIX(ConvolutionParameterfv) + .type GL_PREFIX(ConvolutionParameterfv), @function +GL_PREFIX(ConvolutionParameterfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2808(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ConvolutionParameterfv), .-GL_PREFIX(ConvolutionParameterfv) + + .p2align 4,,15 + .globl GL_PREFIX(ConvolutionParameteri) + .type GL_PREFIX(ConvolutionParameteri), @function +GL_PREFIX(ConvolutionParameteri): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2816(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ConvolutionParameteri), .-GL_PREFIX(ConvolutionParameteri) + + .p2align 4,,15 + .globl GL_PREFIX(ConvolutionParameteriv) + .type GL_PREFIX(ConvolutionParameteriv), @function +GL_PREFIX(ConvolutionParameteriv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2824(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ConvolutionParameteriv), .-GL_PREFIX(ConvolutionParameteriv) + + .p2align 4,,15 + .globl GL_PREFIX(CopyConvolutionFilter1D) + .type GL_PREFIX(CopyConvolutionFilter1D), @function +GL_PREFIX(CopyConvolutionFilter1D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2832(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyConvolutionFilter1D), .-GL_PREFIX(CopyConvolutionFilter1D) + + .p2align 4,,15 + .globl GL_PREFIX(CopyConvolutionFilter2D) + .type GL_PREFIX(CopyConvolutionFilter2D), @function +GL_PREFIX(CopyConvolutionFilter2D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2840(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyConvolutionFilter2D), .-GL_PREFIX(CopyConvolutionFilter2D) + + .p2align 4,,15 + .globl GL_PREFIX(GetConvolutionFilter) + .type GL_PREFIX(GetConvolutionFilter), @function +GL_PREFIX(GetConvolutionFilter): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetConvolutionFilter), .-GL_PREFIX(GetConvolutionFilter) + + .p2align 4,,15 + .globl GL_PREFIX(GetConvolutionParameterfv) + .type GL_PREFIX(GetConvolutionParameterfv), @function +GL_PREFIX(GetConvolutionParameterfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2856(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetConvolutionParameterfv), .-GL_PREFIX(GetConvolutionParameterfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetConvolutionParameteriv) + .type GL_PREFIX(GetConvolutionParameteriv), @function +GL_PREFIX(GetConvolutionParameteriv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetConvolutionParameteriv), .-GL_PREFIX(GetConvolutionParameteriv) + + .p2align 4,,15 + .globl GL_PREFIX(GetSeparableFilter) + .type GL_PREFIX(GetSeparableFilter), @function +GL_PREFIX(GetSeparableFilter): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2872(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetSeparableFilter), .-GL_PREFIX(GetSeparableFilter) + + .p2align 4,,15 + .globl GL_PREFIX(SeparableFilter2D) + .type GL_PREFIX(SeparableFilter2D), @function +GL_PREFIX(SeparableFilter2D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2880(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SeparableFilter2D), .-GL_PREFIX(SeparableFilter2D) + + .p2align 4,,15 + .globl GL_PREFIX(GetHistogram) + .type GL_PREFIX(GetHistogram), @function +GL_PREFIX(GetHistogram): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetHistogram), .-GL_PREFIX(GetHistogram) + + .p2align 4,,15 + .globl GL_PREFIX(GetHistogramParameterfv) + .type GL_PREFIX(GetHistogramParameterfv), @function +GL_PREFIX(GetHistogramParameterfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2896(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetHistogramParameterfv), .-GL_PREFIX(GetHistogramParameterfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetHistogramParameteriv) + .type GL_PREFIX(GetHistogramParameteriv), @function +GL_PREFIX(GetHistogramParameteriv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetHistogramParameteriv), .-GL_PREFIX(GetHistogramParameteriv) + + .p2align 4,,15 + .globl GL_PREFIX(GetMinmax) + .type GL_PREFIX(GetMinmax), @function +GL_PREFIX(GetMinmax): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetMinmax), .-GL_PREFIX(GetMinmax) + + .p2align 4,,15 + .globl GL_PREFIX(GetMinmaxParameterfv) + .type GL_PREFIX(GetMinmaxParameterfv), @function +GL_PREFIX(GetMinmaxParameterfv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetMinmaxParameterfv), .-GL_PREFIX(GetMinmaxParameterfv) + + .p2align 4,,15 + .globl GL_PREFIX(GetMinmaxParameteriv) + .type GL_PREFIX(GetMinmaxParameteriv), @function +GL_PREFIX(GetMinmaxParameteriv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetMinmaxParameteriv), .-GL_PREFIX(GetMinmaxParameteriv) + + .p2align 4,,15 + .globl GL_PREFIX(Histogram) + .type GL_PREFIX(Histogram), @function +GL_PREFIX(Histogram): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Histogram), .-GL_PREFIX(Histogram) + + .p2align 4,,15 + .globl GL_PREFIX(Minmax) + .type GL_PREFIX(Minmax), @function +GL_PREFIX(Minmax): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 2944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 2944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Minmax), .-GL_PREFIX(Minmax) + + .p2align 4,,15 + .globl GL_PREFIX(ResetHistogram) + .type GL_PREFIX(ResetHistogram), @function +GL_PREFIX(ResetHistogram): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ResetHistogram), .-GL_PREFIX(ResetHistogram) + + .p2align 4,,15 + .globl GL_PREFIX(ResetMinmax) + .type GL_PREFIX(ResetMinmax), @function +GL_PREFIX(ResetMinmax): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ResetMinmax), .-GL_PREFIX(ResetMinmax) + + .p2align 4,,15 + .globl GL_PREFIX(TexImage3D) + .type GL_PREFIX(TexImage3D), @function +GL_PREFIX(TexImage3D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2968(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexImage3D), .-GL_PREFIX(TexImage3D) + + .p2align 4,,15 + .globl GL_PREFIX(TexSubImage3D) + .type GL_PREFIX(TexSubImage3D), @function +GL_PREFIX(TexSubImage3D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2976(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexSubImage3D), .-GL_PREFIX(TexSubImage3D) + + .p2align 4,,15 + .globl GL_PREFIX(CopyTexSubImage3D) + .type GL_PREFIX(CopyTexSubImage3D), @function +GL_PREFIX(CopyTexSubImage3D): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 2984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyTexSubImage3D), .-GL_PREFIX(CopyTexSubImage3D) + + .p2align 4,,15 + .globl GL_PREFIX(ActiveTextureARB) + .type GL_PREFIX(ActiveTextureARB), @function +GL_PREFIX(ActiveTextureARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 2992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 2992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 2992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 2992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ActiveTextureARB), .-GL_PREFIX(ActiveTextureARB) + + .p2align 4,,15 + .globl GL_PREFIX(ClientActiveTextureARB) + .type GL_PREFIX(ClientActiveTextureARB), @function +GL_PREFIX(ClientActiveTextureARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ClientActiveTextureARB), .-GL_PREFIX(ClientActiveTextureARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord1dARB) + .type GL_PREFIX(MultiTexCoord1dARB), @function +GL_PREFIX(MultiTexCoord1dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3008(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord1dARB), .-GL_PREFIX(MultiTexCoord1dARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord1dvARB) + .type GL_PREFIX(MultiTexCoord1dvARB), @function +GL_PREFIX(MultiTexCoord1dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord1dvARB), .-GL_PREFIX(MultiTexCoord1dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord1fARB) + .type GL_PREFIX(MultiTexCoord1fARB), @function +GL_PREFIX(MultiTexCoord1fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3024(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord1fARB), .-GL_PREFIX(MultiTexCoord1fARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord1fvARB) + .type GL_PREFIX(MultiTexCoord1fvARB), @function +GL_PREFIX(MultiTexCoord1fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord1fvARB), .-GL_PREFIX(MultiTexCoord1fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord1iARB) + .type GL_PREFIX(MultiTexCoord1iARB), @function +GL_PREFIX(MultiTexCoord1iARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord1iARB), .-GL_PREFIX(MultiTexCoord1iARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord1ivARB) + .type GL_PREFIX(MultiTexCoord1ivARB), @function +GL_PREFIX(MultiTexCoord1ivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord1ivARB), .-GL_PREFIX(MultiTexCoord1ivARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord1sARB) + .type GL_PREFIX(MultiTexCoord1sARB), @function +GL_PREFIX(MultiTexCoord1sARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord1sARB), .-GL_PREFIX(MultiTexCoord1sARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord1svARB) + .type GL_PREFIX(MultiTexCoord1svARB), @function +GL_PREFIX(MultiTexCoord1svARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord1svARB), .-GL_PREFIX(MultiTexCoord1svARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord2dARB) + .type GL_PREFIX(MultiTexCoord2dARB), @function +GL_PREFIX(MultiTexCoord2dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3072(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord2dARB), .-GL_PREFIX(MultiTexCoord2dARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord2dvARB) + .type GL_PREFIX(MultiTexCoord2dvARB), @function +GL_PREFIX(MultiTexCoord2dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord2dvARB), .-GL_PREFIX(MultiTexCoord2dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord2fARB) + .type GL_PREFIX(MultiTexCoord2fARB), @function +GL_PREFIX(MultiTexCoord2fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3088(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord2fARB), .-GL_PREFIX(MultiTexCoord2fARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord2fvARB) + .type GL_PREFIX(MultiTexCoord2fvARB), @function +GL_PREFIX(MultiTexCoord2fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord2fvARB), .-GL_PREFIX(MultiTexCoord2fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord2iARB) + .type GL_PREFIX(MultiTexCoord2iARB), @function +GL_PREFIX(MultiTexCoord2iARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord2iARB), .-GL_PREFIX(MultiTexCoord2iARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord2ivARB) + .type GL_PREFIX(MultiTexCoord2ivARB), @function +GL_PREFIX(MultiTexCoord2ivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord2ivARB), .-GL_PREFIX(MultiTexCoord2ivARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord2sARB) + .type GL_PREFIX(MultiTexCoord2sARB), @function +GL_PREFIX(MultiTexCoord2sARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord2sARB), .-GL_PREFIX(MultiTexCoord2sARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord2svARB) + .type GL_PREFIX(MultiTexCoord2svARB), @function +GL_PREFIX(MultiTexCoord2svARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord2svARB), .-GL_PREFIX(MultiTexCoord2svARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord3dARB) + .type GL_PREFIX(MultiTexCoord3dARB), @function +GL_PREFIX(MultiTexCoord3dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3136(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord3dARB), .-GL_PREFIX(MultiTexCoord3dARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord3dvARB) + .type GL_PREFIX(MultiTexCoord3dvARB), @function +GL_PREFIX(MultiTexCoord3dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord3dvARB), .-GL_PREFIX(MultiTexCoord3dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord3fARB) + .type GL_PREFIX(MultiTexCoord3fARB), @function +GL_PREFIX(MultiTexCoord3fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3152(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord3fARB), .-GL_PREFIX(MultiTexCoord3fARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord3fvARB) + .type GL_PREFIX(MultiTexCoord3fvARB), @function +GL_PREFIX(MultiTexCoord3fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord3fvARB), .-GL_PREFIX(MultiTexCoord3fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord3iARB) + .type GL_PREFIX(MultiTexCoord3iARB), @function +GL_PREFIX(MultiTexCoord3iARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord3iARB), .-GL_PREFIX(MultiTexCoord3iARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord3ivARB) + .type GL_PREFIX(MultiTexCoord3ivARB), @function +GL_PREFIX(MultiTexCoord3ivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord3ivARB), .-GL_PREFIX(MultiTexCoord3ivARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord3sARB) + .type GL_PREFIX(MultiTexCoord3sARB), @function +GL_PREFIX(MultiTexCoord3sARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord3sARB), .-GL_PREFIX(MultiTexCoord3sARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord3svARB) + .type GL_PREFIX(MultiTexCoord3svARB), @function +GL_PREFIX(MultiTexCoord3svARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord3svARB), .-GL_PREFIX(MultiTexCoord3svARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord4dARB) + .type GL_PREFIX(MultiTexCoord4dARB), @function +GL_PREFIX(MultiTexCoord4dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3200(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord4dARB), .-GL_PREFIX(MultiTexCoord4dARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord4dvARB) + .type GL_PREFIX(MultiTexCoord4dvARB), @function +GL_PREFIX(MultiTexCoord4dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord4dvARB), .-GL_PREFIX(MultiTexCoord4dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord4fARB) + .type GL_PREFIX(MultiTexCoord4fARB), @function +GL_PREFIX(MultiTexCoord4fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3216(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord4fARB), .-GL_PREFIX(MultiTexCoord4fARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord4fvARB) + .type GL_PREFIX(MultiTexCoord4fvARB), @function +GL_PREFIX(MultiTexCoord4fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord4fvARB), .-GL_PREFIX(MultiTexCoord4fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord4iARB) + .type GL_PREFIX(MultiTexCoord4iARB), @function +GL_PREFIX(MultiTexCoord4iARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord4iARB), .-GL_PREFIX(MultiTexCoord4iARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord4ivARB) + .type GL_PREFIX(MultiTexCoord4ivARB), @function +GL_PREFIX(MultiTexCoord4ivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord4ivARB), .-GL_PREFIX(MultiTexCoord4ivARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord4sARB) + .type GL_PREFIX(MultiTexCoord4sARB), @function +GL_PREFIX(MultiTexCoord4sARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord4sARB), .-GL_PREFIX(MultiTexCoord4sARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultiTexCoord4svARB) + .type GL_PREFIX(MultiTexCoord4svARB), @function +GL_PREFIX(MultiTexCoord4svARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiTexCoord4svARB), .-GL_PREFIX(MultiTexCoord4svARB) + + .p2align 4,,15 + .globl GL_PREFIX(AttachShader) + .type GL_PREFIX(AttachShader), @function +GL_PREFIX(AttachShader): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(AttachShader), .-GL_PREFIX(AttachShader) + + .p2align 4,,15 + .globl GL_PREFIX(CreateProgram) + .type GL_PREFIX(CreateProgram), @function +GL_PREFIX(CreateProgram): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 3272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3272(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 3272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CreateProgram), .-GL_PREFIX(CreateProgram) + + .p2align 4,,15 + .globl GL_PREFIX(CreateShader) + .type GL_PREFIX(CreateShader), @function +GL_PREFIX(CreateShader): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CreateShader), .-GL_PREFIX(CreateShader) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteProgram) + .type GL_PREFIX(DeleteProgram), @function +GL_PREFIX(DeleteProgram): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteProgram), .-GL_PREFIX(DeleteProgram) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteShader) + .type GL_PREFIX(DeleteShader), @function +GL_PREFIX(DeleteShader): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteShader), .-GL_PREFIX(DeleteShader) + + .p2align 4,,15 + .globl GL_PREFIX(DetachShader) + .type GL_PREFIX(DetachShader), @function +GL_PREFIX(DetachShader): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DetachShader), .-GL_PREFIX(DetachShader) + + .p2align 4,,15 + .globl GL_PREFIX(GetAttachedShaders) + .type GL_PREFIX(GetAttachedShaders), @function +GL_PREFIX(GetAttachedShaders): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetAttachedShaders), .-GL_PREFIX(GetAttachedShaders) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramInfoLog) + .type GL_PREFIX(GetProgramInfoLog), @function +GL_PREFIX(GetProgramInfoLog): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramInfoLog), .-GL_PREFIX(GetProgramInfoLog) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramiv) + .type GL_PREFIX(GetProgramiv), @function +GL_PREFIX(GetProgramiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramiv), .-GL_PREFIX(GetProgramiv) + + .p2align 4,,15 + .globl GL_PREFIX(GetShaderInfoLog) + .type GL_PREFIX(GetShaderInfoLog), @function +GL_PREFIX(GetShaderInfoLog): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetShaderInfoLog), .-GL_PREFIX(GetShaderInfoLog) + + .p2align 4,,15 + .globl GL_PREFIX(GetShaderiv) + .type GL_PREFIX(GetShaderiv), @function +GL_PREFIX(GetShaderiv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3344(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetShaderiv), .-GL_PREFIX(GetShaderiv) + + .p2align 4,,15 + .globl GL_PREFIX(IsProgram) + .type GL_PREFIX(IsProgram), @function +GL_PREFIX(IsProgram): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsProgram), .-GL_PREFIX(IsProgram) + + .p2align 4,,15 + .globl GL_PREFIX(IsShader) + .type GL_PREFIX(IsShader), @function +GL_PREFIX(IsShader): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsShader), .-GL_PREFIX(IsShader) + + .p2align 4,,15 + .globl GL_PREFIX(StencilFuncSeparate) + .type GL_PREFIX(StencilFuncSeparate), @function +GL_PREFIX(StencilFuncSeparate): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3368(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(StencilFuncSeparate), .-GL_PREFIX(StencilFuncSeparate) + + .p2align 4,,15 + .globl GL_PREFIX(StencilMaskSeparate) + .type GL_PREFIX(StencilMaskSeparate), @function +GL_PREFIX(StencilMaskSeparate): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(StencilMaskSeparate), .-GL_PREFIX(StencilMaskSeparate) + + .p2align 4,,15 + .globl GL_PREFIX(StencilOpSeparate) + .type GL_PREFIX(StencilOpSeparate), @function +GL_PREFIX(StencilOpSeparate): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(StencilOpSeparate), .-GL_PREFIX(StencilOpSeparate) + + .p2align 4,,15 + .globl GL_PREFIX(UniformMatrix2x3fv) + .type GL_PREFIX(UniformMatrix2x3fv), @function +GL_PREFIX(UniformMatrix2x3fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UniformMatrix2x3fv), .-GL_PREFIX(UniformMatrix2x3fv) + + .p2align 4,,15 + .globl GL_PREFIX(UniformMatrix2x4fv) + .type GL_PREFIX(UniformMatrix2x4fv), @function +GL_PREFIX(UniformMatrix2x4fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UniformMatrix2x4fv), .-GL_PREFIX(UniformMatrix2x4fv) + + .p2align 4,,15 + .globl GL_PREFIX(UniformMatrix3x2fv) + .type GL_PREFIX(UniformMatrix3x2fv), @function +GL_PREFIX(UniformMatrix3x2fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UniformMatrix3x2fv), .-GL_PREFIX(UniformMatrix3x2fv) + + .p2align 4,,15 + .globl GL_PREFIX(UniformMatrix3x4fv) + .type GL_PREFIX(UniformMatrix3x4fv), @function +GL_PREFIX(UniformMatrix3x4fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UniformMatrix3x4fv), .-GL_PREFIX(UniformMatrix3x4fv) + + .p2align 4,,15 + .globl GL_PREFIX(UniformMatrix4x2fv) + .type GL_PREFIX(UniformMatrix4x2fv), @function +GL_PREFIX(UniformMatrix4x2fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UniformMatrix4x2fv), .-GL_PREFIX(UniformMatrix4x2fv) + + .p2align 4,,15 + .globl GL_PREFIX(UniformMatrix4x3fv) + .type GL_PREFIX(UniformMatrix4x3fv), @function +GL_PREFIX(UniformMatrix4x3fv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UniformMatrix4x3fv), .-GL_PREFIX(UniformMatrix4x3fv) + + .p2align 4,,15 + .globl GL_PREFIX(DrawArraysInstanced) + .type GL_PREFIX(DrawArraysInstanced), @function +GL_PREFIX(DrawArraysInstanced): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawArraysInstanced), .-GL_PREFIX(DrawArraysInstanced) + + .p2align 4,,15 + .globl GL_PREFIX(DrawElementsInstanced) + .type GL_PREFIX(DrawElementsInstanced), @function +GL_PREFIX(DrawElementsInstanced): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawElementsInstanced), .-GL_PREFIX(DrawElementsInstanced) + + .p2align 4,,15 + .globl GL_PREFIX(LoadTransposeMatrixdARB) + .type GL_PREFIX(LoadTransposeMatrixdARB), @function +GL_PREFIX(LoadTransposeMatrixdARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LoadTransposeMatrixdARB), .-GL_PREFIX(LoadTransposeMatrixdARB) + + .p2align 4,,15 + .globl GL_PREFIX(LoadTransposeMatrixfARB) + .type GL_PREFIX(LoadTransposeMatrixfARB), @function +GL_PREFIX(LoadTransposeMatrixfARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LoadTransposeMatrixfARB), .-GL_PREFIX(LoadTransposeMatrixfARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultTransposeMatrixdARB) + .type GL_PREFIX(MultTransposeMatrixdARB), @function +GL_PREFIX(MultTransposeMatrixdARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultTransposeMatrixdARB), .-GL_PREFIX(MultTransposeMatrixdARB) + + .p2align 4,,15 + .globl GL_PREFIX(MultTransposeMatrixfARB) + .type GL_PREFIX(MultTransposeMatrixfARB), @function +GL_PREFIX(MultTransposeMatrixfARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultTransposeMatrixfARB), .-GL_PREFIX(MultTransposeMatrixfARB) + + .p2align 4,,15 + .globl GL_PREFIX(SampleCoverageARB) + .type GL_PREFIX(SampleCoverageARB), @function +GL_PREFIX(SampleCoverageARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SampleCoverageARB), .-GL_PREFIX(SampleCoverageARB) + + .p2align 4,,15 + .globl GL_PREFIX(CompressedTexImage1DARB) + .type GL_PREFIX(CompressedTexImage1DARB), @function +GL_PREFIX(CompressedTexImage1DARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CompressedTexImage1DARB), .-GL_PREFIX(CompressedTexImage1DARB) + + .p2align 4,,15 + .globl GL_PREFIX(CompressedTexImage2DARB) + .type GL_PREFIX(CompressedTexImage2DARB), @function +GL_PREFIX(CompressedTexImage2DARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CompressedTexImage2DARB), .-GL_PREFIX(CompressedTexImage2DARB) + + .p2align 4,,15 + .globl GL_PREFIX(CompressedTexImage3DARB) + .type GL_PREFIX(CompressedTexImage3DARB), @function +GL_PREFIX(CompressedTexImage3DARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CompressedTexImage3DARB), .-GL_PREFIX(CompressedTexImage3DARB) + + .p2align 4,,15 + .globl GL_PREFIX(CompressedTexSubImage1DARB) + .type GL_PREFIX(CompressedTexSubImage1DARB), @function +GL_PREFIX(CompressedTexSubImage1DARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CompressedTexSubImage1DARB), .-GL_PREFIX(CompressedTexSubImage1DARB) + + .p2align 4,,15 + .globl GL_PREFIX(CompressedTexSubImage2DARB) + .type GL_PREFIX(CompressedTexSubImage2DARB), @function +GL_PREFIX(CompressedTexSubImage2DARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CompressedTexSubImage2DARB), .-GL_PREFIX(CompressedTexSubImage2DARB) + + .p2align 4,,15 + .globl GL_PREFIX(CompressedTexSubImage3DARB) + .type GL_PREFIX(CompressedTexSubImage3DARB), @function +GL_PREFIX(CompressedTexSubImage3DARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CompressedTexSubImage3DARB), .-GL_PREFIX(CompressedTexSubImage3DARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetCompressedTexImageARB) + .type GL_PREFIX(GetCompressedTexImageARB), @function +GL_PREFIX(GetCompressedTexImageARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetCompressedTexImageARB), .-GL_PREFIX(GetCompressedTexImageARB) + + .p2align 4,,15 + .globl GL_PREFIX(DisableVertexAttribArrayARB) + .type GL_PREFIX(DisableVertexAttribArrayARB), @function +GL_PREFIX(DisableVertexAttribArrayARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DisableVertexAttribArrayARB), .-GL_PREFIX(DisableVertexAttribArrayARB) + + .p2align 4,,15 + .globl GL_PREFIX(EnableVertexAttribArrayARB) + .type GL_PREFIX(EnableVertexAttribArrayARB), @function +GL_PREFIX(EnableVertexAttribArrayARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 3560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 3560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EnableVertexAttribArrayARB), .-GL_PREFIX(EnableVertexAttribArrayARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramEnvParameterdvARB) + .type GL_PREFIX(GetProgramEnvParameterdvARB), @function +GL_PREFIX(GetProgramEnvParameterdvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramEnvParameterdvARB), .-GL_PREFIX(GetProgramEnvParameterdvARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramEnvParameterfvARB) + .type GL_PREFIX(GetProgramEnvParameterfvARB), @function +GL_PREFIX(GetProgramEnvParameterfvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3576(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramEnvParameterfvARB), .-GL_PREFIX(GetProgramEnvParameterfvARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramLocalParameterdvARB) + .type GL_PREFIX(GetProgramLocalParameterdvARB), @function +GL_PREFIX(GetProgramLocalParameterdvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramLocalParameterdvARB), .-GL_PREFIX(GetProgramLocalParameterdvARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramLocalParameterfvARB) + .type GL_PREFIX(GetProgramLocalParameterfvARB), @function +GL_PREFIX(GetProgramLocalParameterfvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramLocalParameterfvARB), .-GL_PREFIX(GetProgramLocalParameterfvARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramStringARB) + .type GL_PREFIX(GetProgramStringARB), @function +GL_PREFIX(GetProgramStringARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramStringARB), .-GL_PREFIX(GetProgramStringARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramivARB) + .type GL_PREFIX(GetProgramivARB), @function +GL_PREFIX(GetProgramivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramivARB), .-GL_PREFIX(GetProgramivARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetVertexAttribdvARB) + .type GL_PREFIX(GetVertexAttribdvARB), @function +GL_PREFIX(GetVertexAttribdvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetVertexAttribdvARB), .-GL_PREFIX(GetVertexAttribdvARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetVertexAttribfvARB) + .type GL_PREFIX(GetVertexAttribfvARB), @function +GL_PREFIX(GetVertexAttribfvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetVertexAttribfvARB), .-GL_PREFIX(GetVertexAttribfvARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetVertexAttribivARB) + .type GL_PREFIX(GetVertexAttribivARB), @function +GL_PREFIX(GetVertexAttribivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3632(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetVertexAttribivARB), .-GL_PREFIX(GetVertexAttribivARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramEnvParameter4dARB) + .type GL_PREFIX(ProgramEnvParameter4dARB), @function +GL_PREFIX(ProgramEnvParameter4dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 3640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3640(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 3640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramEnvParameter4dARB), .-GL_PREFIX(ProgramEnvParameter4dARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramEnvParameter4dvARB) + .type GL_PREFIX(ProgramEnvParameter4dvARB), @function +GL_PREFIX(ProgramEnvParameter4dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramEnvParameter4dvARB), .-GL_PREFIX(ProgramEnvParameter4dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramEnvParameter4fARB) + .type GL_PREFIX(ProgramEnvParameter4fARB), @function +GL_PREFIX(ProgramEnvParameter4fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 3656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3656(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 3656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramEnvParameter4fARB), .-GL_PREFIX(ProgramEnvParameter4fARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramEnvParameter4fvARB) + .type GL_PREFIX(ProgramEnvParameter4fvARB), @function +GL_PREFIX(ProgramEnvParameter4fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramEnvParameter4fvARB), .-GL_PREFIX(ProgramEnvParameter4fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramLocalParameter4dARB) + .type GL_PREFIX(ProgramLocalParameter4dARB), @function +GL_PREFIX(ProgramLocalParameter4dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 3672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3672(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 3672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramLocalParameter4dARB), .-GL_PREFIX(ProgramLocalParameter4dARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramLocalParameter4dvARB) + .type GL_PREFIX(ProgramLocalParameter4dvARB), @function +GL_PREFIX(ProgramLocalParameter4dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramLocalParameter4dvARB), .-GL_PREFIX(ProgramLocalParameter4dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramLocalParameter4fARB) + .type GL_PREFIX(ProgramLocalParameter4fARB), @function +GL_PREFIX(ProgramLocalParameter4fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _x86_64_get_dispatch@PLT + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 3688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3688(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %xmm0, 16(%rsp) + movq %xmm1, 24(%rsp) + movq %xmm2, 32(%rsp) + movq %xmm3, 40(%rsp) + call _glapi_get_dispatch + movq 40(%rsp), %xmm3 + movq 32(%rsp), %xmm2 + movq 24(%rsp), %xmm1 + movq 16(%rsp), %xmm0 + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 3688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramLocalParameter4fARB), .-GL_PREFIX(ProgramLocalParameter4fARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramLocalParameter4fvARB) + .type GL_PREFIX(ProgramLocalParameter4fvARB), @function +GL_PREFIX(ProgramLocalParameter4fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramLocalParameter4fvARB), .-GL_PREFIX(ProgramLocalParameter4fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramStringARB) + .type GL_PREFIX(ProgramStringARB), @function +GL_PREFIX(ProgramStringARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3704(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramStringARB), .-GL_PREFIX(ProgramStringARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1dARB) + .type GL_PREFIX(VertexAttrib1dARB), @function +GL_PREFIX(VertexAttrib1dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3712(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1dARB), .-GL_PREFIX(VertexAttrib1dARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1dvARB) + .type GL_PREFIX(VertexAttrib1dvARB), @function +GL_PREFIX(VertexAttrib1dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1dvARB), .-GL_PREFIX(VertexAttrib1dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1fARB) + .type GL_PREFIX(VertexAttrib1fARB), @function +GL_PREFIX(VertexAttrib1fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3728(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1fARB), .-GL_PREFIX(VertexAttrib1fARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1fvARB) + .type GL_PREFIX(VertexAttrib1fvARB), @function +GL_PREFIX(VertexAttrib1fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3736(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1fvARB), .-GL_PREFIX(VertexAttrib1fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1sARB) + .type GL_PREFIX(VertexAttrib1sARB), @function +GL_PREFIX(VertexAttrib1sARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1sARB), .-GL_PREFIX(VertexAttrib1sARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1svARB) + .type GL_PREFIX(VertexAttrib1svARB), @function +GL_PREFIX(VertexAttrib1svARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3752(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1svARB), .-GL_PREFIX(VertexAttrib1svARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2dARB) + .type GL_PREFIX(VertexAttrib2dARB), @function +GL_PREFIX(VertexAttrib2dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3760(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2dARB), .-GL_PREFIX(VertexAttrib2dARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2dvARB) + .type GL_PREFIX(VertexAttrib2dvARB), @function +GL_PREFIX(VertexAttrib2dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3768(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2dvARB), .-GL_PREFIX(VertexAttrib2dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2fARB) + .type GL_PREFIX(VertexAttrib2fARB), @function +GL_PREFIX(VertexAttrib2fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3776(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 3776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2fARB), .-GL_PREFIX(VertexAttrib2fARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2fvARB) + .type GL_PREFIX(VertexAttrib2fvARB), @function +GL_PREFIX(VertexAttrib2fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3784(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2fvARB), .-GL_PREFIX(VertexAttrib2fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2sARB) + .type GL_PREFIX(VertexAttrib2sARB), @function +GL_PREFIX(VertexAttrib2sARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 3792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3792(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 3792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2sARB), .-GL_PREFIX(VertexAttrib2sARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2svARB) + .type GL_PREFIX(VertexAttrib2svARB), @function +GL_PREFIX(VertexAttrib2svARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3800(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2svARB), .-GL_PREFIX(VertexAttrib2svARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3dARB) + .type GL_PREFIX(VertexAttrib3dARB), @function +GL_PREFIX(VertexAttrib3dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3808(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3dARB), .-GL_PREFIX(VertexAttrib3dARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3dvARB) + .type GL_PREFIX(VertexAttrib3dvARB), @function +GL_PREFIX(VertexAttrib3dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3816(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3dvARB), .-GL_PREFIX(VertexAttrib3dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3fARB) + .type GL_PREFIX(VertexAttrib3fARB), @function +GL_PREFIX(VertexAttrib3fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3824(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3fARB), .-GL_PREFIX(VertexAttrib3fARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3fvARB) + .type GL_PREFIX(VertexAttrib3fvARB), @function +GL_PREFIX(VertexAttrib3fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3832(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3fvARB), .-GL_PREFIX(VertexAttrib3fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3sARB) + .type GL_PREFIX(VertexAttrib3sARB), @function +GL_PREFIX(VertexAttrib3sARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3840(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3sARB), .-GL_PREFIX(VertexAttrib3sARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3svARB) + .type GL_PREFIX(VertexAttrib3svARB), @function +GL_PREFIX(VertexAttrib3svARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3svARB), .-GL_PREFIX(VertexAttrib3svARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4NbvARB) + .type GL_PREFIX(VertexAttrib4NbvARB), @function +GL_PREFIX(VertexAttrib4NbvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3856(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4NbvARB), .-GL_PREFIX(VertexAttrib4NbvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4NivARB) + .type GL_PREFIX(VertexAttrib4NivARB), @function +GL_PREFIX(VertexAttrib4NivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4NivARB), .-GL_PREFIX(VertexAttrib4NivARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4NsvARB) + .type GL_PREFIX(VertexAttrib4NsvARB), @function +GL_PREFIX(VertexAttrib4NsvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3872(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4NsvARB), .-GL_PREFIX(VertexAttrib4NsvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4NubARB) + .type GL_PREFIX(VertexAttrib4NubARB), @function +GL_PREFIX(VertexAttrib4NubARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3880(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4NubARB), .-GL_PREFIX(VertexAttrib4NubARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4NubvARB) + .type GL_PREFIX(VertexAttrib4NubvARB), @function +GL_PREFIX(VertexAttrib4NubvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4NubvARB), .-GL_PREFIX(VertexAttrib4NubvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4NuivARB) + .type GL_PREFIX(VertexAttrib4NuivARB), @function +GL_PREFIX(VertexAttrib4NuivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3896(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4NuivARB), .-GL_PREFIX(VertexAttrib4NuivARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4NusvARB) + .type GL_PREFIX(VertexAttrib4NusvARB), @function +GL_PREFIX(VertexAttrib4NusvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4NusvARB), .-GL_PREFIX(VertexAttrib4NusvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4bvARB) + .type GL_PREFIX(VertexAttrib4bvARB), @function +GL_PREFIX(VertexAttrib4bvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4bvARB), .-GL_PREFIX(VertexAttrib4bvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4dARB) + .type GL_PREFIX(VertexAttrib4dARB), @function +GL_PREFIX(VertexAttrib4dARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3920(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4dARB), .-GL_PREFIX(VertexAttrib4dARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4dvARB) + .type GL_PREFIX(VertexAttrib4dvARB), @function +GL_PREFIX(VertexAttrib4dvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4dvARB), .-GL_PREFIX(VertexAttrib4dvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4fARB) + .type GL_PREFIX(VertexAttrib4fARB), @function +GL_PREFIX(VertexAttrib4fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3936(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 3936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4fARB), .-GL_PREFIX(VertexAttrib4fARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4fvARB) + .type GL_PREFIX(VertexAttrib4fvARB), @function +GL_PREFIX(VertexAttrib4fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4fvARB), .-GL_PREFIX(VertexAttrib4fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4ivARB) + .type GL_PREFIX(VertexAttrib4ivARB), @function +GL_PREFIX(VertexAttrib4ivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4ivARB), .-GL_PREFIX(VertexAttrib4ivARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4sARB) + .type GL_PREFIX(VertexAttrib4sARB), @function +GL_PREFIX(VertexAttrib4sARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 3960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4sARB), .-GL_PREFIX(VertexAttrib4sARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4svARB) + .type GL_PREFIX(VertexAttrib4svARB), @function +GL_PREFIX(VertexAttrib4svARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3968(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4svARB), .-GL_PREFIX(VertexAttrib4svARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4ubvARB) + .type GL_PREFIX(VertexAttrib4ubvARB), @function +GL_PREFIX(VertexAttrib4ubvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3976(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4ubvARB), .-GL_PREFIX(VertexAttrib4ubvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4uivARB) + .type GL_PREFIX(VertexAttrib4uivARB), @function +GL_PREFIX(VertexAttrib4uivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4uivARB), .-GL_PREFIX(VertexAttrib4uivARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4usvARB) + .type GL_PREFIX(VertexAttrib4usvARB), @function +GL_PREFIX(VertexAttrib4usvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 3992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 3992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 3992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 3992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4usvARB), .-GL_PREFIX(VertexAttrib4usvARB) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribPointerARB) + .type GL_PREFIX(VertexAttribPointerARB), @function +GL_PREFIX(VertexAttribPointerARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribPointerARB), .-GL_PREFIX(VertexAttribPointerARB) + + .p2align 4,,15 + .globl GL_PREFIX(BindBufferARB) + .type GL_PREFIX(BindBufferARB), @function +GL_PREFIX(BindBufferARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4008(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindBufferARB), .-GL_PREFIX(BindBufferARB) + + .p2align 4,,15 + .globl GL_PREFIX(BufferDataARB) + .type GL_PREFIX(BufferDataARB), @function +GL_PREFIX(BufferDataARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BufferDataARB), .-GL_PREFIX(BufferDataARB) + + .p2align 4,,15 + .globl GL_PREFIX(BufferSubDataARB) + .type GL_PREFIX(BufferSubDataARB), @function +GL_PREFIX(BufferSubDataARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4024(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BufferSubDataARB), .-GL_PREFIX(BufferSubDataARB) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteBuffersARB) + .type GL_PREFIX(DeleteBuffersARB), @function +GL_PREFIX(DeleteBuffersARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteBuffersARB), .-GL_PREFIX(DeleteBuffersARB) + + .p2align 4,,15 + .globl GL_PREFIX(GenBuffersARB) + .type GL_PREFIX(GenBuffersARB), @function +GL_PREFIX(GenBuffersARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenBuffersARB), .-GL_PREFIX(GenBuffersARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetBufferParameterivARB) + .type GL_PREFIX(GetBufferParameterivARB), @function +GL_PREFIX(GetBufferParameterivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetBufferParameterivARB), .-GL_PREFIX(GetBufferParameterivARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetBufferPointervARB) + .type GL_PREFIX(GetBufferPointervARB), @function +GL_PREFIX(GetBufferPointervARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetBufferPointervARB), .-GL_PREFIX(GetBufferPointervARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetBufferSubDataARB) + .type GL_PREFIX(GetBufferSubDataARB), @function +GL_PREFIX(GetBufferSubDataARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetBufferSubDataARB), .-GL_PREFIX(GetBufferSubDataARB) + + .p2align 4,,15 + .globl GL_PREFIX(IsBufferARB) + .type GL_PREFIX(IsBufferARB), @function +GL_PREFIX(IsBufferARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4072(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsBufferARB), .-GL_PREFIX(IsBufferARB) + + .p2align 4,,15 + .globl GL_PREFIX(MapBufferARB) + .type GL_PREFIX(MapBufferARB), @function +GL_PREFIX(MapBufferARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MapBufferARB), .-GL_PREFIX(MapBufferARB) + + .p2align 4,,15 + .globl GL_PREFIX(UnmapBufferARB) + .type GL_PREFIX(UnmapBufferARB), @function +GL_PREFIX(UnmapBufferARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4088(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UnmapBufferARB), .-GL_PREFIX(UnmapBufferARB) + + .p2align 4,,15 + .globl GL_PREFIX(BeginQueryARB) + .type GL_PREFIX(BeginQueryARB), @function +GL_PREFIX(BeginQueryARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BeginQueryARB), .-GL_PREFIX(BeginQueryARB) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteQueriesARB) + .type GL_PREFIX(DeleteQueriesARB), @function +GL_PREFIX(DeleteQueriesARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteQueriesARB), .-GL_PREFIX(DeleteQueriesARB) + + .p2align 4,,15 + .globl GL_PREFIX(EndQueryARB) + .type GL_PREFIX(EndQueryARB), @function +GL_PREFIX(EndQueryARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EndQueryARB), .-GL_PREFIX(EndQueryARB) + + .p2align 4,,15 + .globl GL_PREFIX(GenQueriesARB) + .type GL_PREFIX(GenQueriesARB), @function +GL_PREFIX(GenQueriesARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenQueriesARB), .-GL_PREFIX(GenQueriesARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetQueryObjectivARB) + .type GL_PREFIX(GetQueryObjectivARB), @function +GL_PREFIX(GetQueryObjectivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetQueryObjectivARB), .-GL_PREFIX(GetQueryObjectivARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetQueryObjectuivARB) + .type GL_PREFIX(GetQueryObjectuivARB), @function +GL_PREFIX(GetQueryObjectuivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetQueryObjectuivARB), .-GL_PREFIX(GetQueryObjectuivARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetQueryivARB) + .type GL_PREFIX(GetQueryivARB), @function +GL_PREFIX(GetQueryivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetQueryivARB), .-GL_PREFIX(GetQueryivARB) + + .p2align 4,,15 + .globl GL_PREFIX(IsQueryARB) + .type GL_PREFIX(IsQueryARB), @function +GL_PREFIX(IsQueryARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsQueryARB), .-GL_PREFIX(IsQueryARB) + + .p2align 4,,15 + .globl GL_PREFIX(AttachObjectARB) + .type GL_PREFIX(AttachObjectARB), @function +GL_PREFIX(AttachObjectARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(AttachObjectARB), .-GL_PREFIX(AttachObjectARB) + + .p2align 4,,15 + .globl GL_PREFIX(CompileShaderARB) + .type GL_PREFIX(CompileShaderARB), @function +GL_PREFIX(CompileShaderARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CompileShaderARB), .-GL_PREFIX(CompileShaderARB) + + .p2align 4,,15 + .globl GL_PREFIX(CreateProgramObjectARB) + .type GL_PREFIX(CreateProgramObjectARB), @function +GL_PREFIX(CreateProgramObjectARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 4176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4176(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 4176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CreateProgramObjectARB), .-GL_PREFIX(CreateProgramObjectARB) + + .p2align 4,,15 + .globl GL_PREFIX(CreateShaderObjectARB) + .type GL_PREFIX(CreateShaderObjectARB), @function +GL_PREFIX(CreateShaderObjectARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CreateShaderObjectARB), .-GL_PREFIX(CreateShaderObjectARB) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteObjectARB) + .type GL_PREFIX(DeleteObjectARB), @function +GL_PREFIX(DeleteObjectARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteObjectARB), .-GL_PREFIX(DeleteObjectARB) + + .p2align 4,,15 + .globl GL_PREFIX(DetachObjectARB) + .type GL_PREFIX(DetachObjectARB), @function +GL_PREFIX(DetachObjectARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DetachObjectARB), .-GL_PREFIX(DetachObjectARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetActiveUniformARB) + .type GL_PREFIX(GetActiveUniformARB), @function +GL_PREFIX(GetActiveUniformARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetActiveUniformARB), .-GL_PREFIX(GetActiveUniformARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetAttachedObjectsARB) + .type GL_PREFIX(GetAttachedObjectsARB), @function +GL_PREFIX(GetAttachedObjectsARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4216(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetAttachedObjectsARB), .-GL_PREFIX(GetAttachedObjectsARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetHandleARB) + .type GL_PREFIX(GetHandleARB), @function +GL_PREFIX(GetHandleARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetHandleARB), .-GL_PREFIX(GetHandleARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetInfoLogARB) + .type GL_PREFIX(GetInfoLogARB), @function +GL_PREFIX(GetInfoLogARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetInfoLogARB), .-GL_PREFIX(GetInfoLogARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetObjectParameterfvARB) + .type GL_PREFIX(GetObjectParameterfvARB), @function +GL_PREFIX(GetObjectParameterfvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetObjectParameterfvARB), .-GL_PREFIX(GetObjectParameterfvARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetObjectParameterivARB) + .type GL_PREFIX(GetObjectParameterivARB), @function +GL_PREFIX(GetObjectParameterivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetObjectParameterivARB), .-GL_PREFIX(GetObjectParameterivARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetShaderSourceARB) + .type GL_PREFIX(GetShaderSourceARB), @function +GL_PREFIX(GetShaderSourceARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetShaderSourceARB), .-GL_PREFIX(GetShaderSourceARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetUniformLocationARB) + .type GL_PREFIX(GetUniformLocationARB), @function +GL_PREFIX(GetUniformLocationARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetUniformLocationARB), .-GL_PREFIX(GetUniformLocationARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetUniformfvARB) + .type GL_PREFIX(GetUniformfvARB), @function +GL_PREFIX(GetUniformfvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetUniformfvARB), .-GL_PREFIX(GetUniformfvARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetUniformivARB) + .type GL_PREFIX(GetUniformivARB), @function +GL_PREFIX(GetUniformivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetUniformivARB), .-GL_PREFIX(GetUniformivARB) + + .p2align 4,,15 + .globl GL_PREFIX(LinkProgramARB) + .type GL_PREFIX(LinkProgramARB), @function +GL_PREFIX(LinkProgramARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LinkProgramARB), .-GL_PREFIX(LinkProgramARB) + + .p2align 4,,15 + .globl GL_PREFIX(ShaderSourceARB) + .type GL_PREFIX(ShaderSourceARB), @function +GL_PREFIX(ShaderSourceARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ShaderSourceARB), .-GL_PREFIX(ShaderSourceARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform1fARB) + .type GL_PREFIX(Uniform1fARB), @function +GL_PREFIX(Uniform1fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4304(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform1fARB), .-GL_PREFIX(Uniform1fARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform1fvARB) + .type GL_PREFIX(Uniform1fvARB), @function +GL_PREFIX(Uniform1fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform1fvARB), .-GL_PREFIX(Uniform1fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform1iARB) + .type GL_PREFIX(Uniform1iARB), @function +GL_PREFIX(Uniform1iARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform1iARB), .-GL_PREFIX(Uniform1iARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform1ivARB) + .type GL_PREFIX(Uniform1ivARB), @function +GL_PREFIX(Uniform1ivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform1ivARB), .-GL_PREFIX(Uniform1ivARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform2fARB) + .type GL_PREFIX(Uniform2fARB), @function +GL_PREFIX(Uniform2fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4336(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform2fARB), .-GL_PREFIX(Uniform2fARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform2fvARB) + .type GL_PREFIX(Uniform2fvARB), @function +GL_PREFIX(Uniform2fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4344(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform2fvARB), .-GL_PREFIX(Uniform2fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform2iARB) + .type GL_PREFIX(Uniform2iARB), @function +GL_PREFIX(Uniform2iARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform2iARB), .-GL_PREFIX(Uniform2iARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform2ivARB) + .type GL_PREFIX(Uniform2ivARB), @function +GL_PREFIX(Uniform2ivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform2ivARB), .-GL_PREFIX(Uniform2ivARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform3fARB) + .type GL_PREFIX(Uniform3fARB), @function +GL_PREFIX(Uniform3fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4368(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform3fARB), .-GL_PREFIX(Uniform3fARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform3fvARB) + .type GL_PREFIX(Uniform3fvARB), @function +GL_PREFIX(Uniform3fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform3fvARB), .-GL_PREFIX(Uniform3fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform3iARB) + .type GL_PREFIX(Uniform3iARB), @function +GL_PREFIX(Uniform3iARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform3iARB), .-GL_PREFIX(Uniform3iARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform3ivARB) + .type GL_PREFIX(Uniform3ivARB), @function +GL_PREFIX(Uniform3ivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform3ivARB), .-GL_PREFIX(Uniform3ivARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform4fARB) + .type GL_PREFIX(Uniform4fARB), @function +GL_PREFIX(Uniform4fARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4400(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 4400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform4fARB), .-GL_PREFIX(Uniform4fARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform4fvARB) + .type GL_PREFIX(Uniform4fvARB), @function +GL_PREFIX(Uniform4fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform4fvARB), .-GL_PREFIX(Uniform4fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform4iARB) + .type GL_PREFIX(Uniform4iARB), @function +GL_PREFIX(Uniform4iARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform4iARB), .-GL_PREFIX(Uniform4iARB) + + .p2align 4,,15 + .globl GL_PREFIX(Uniform4ivARB) + .type GL_PREFIX(Uniform4ivARB), @function +GL_PREFIX(Uniform4ivARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(Uniform4ivARB), .-GL_PREFIX(Uniform4ivARB) + + .p2align 4,,15 + .globl GL_PREFIX(UniformMatrix2fvARB) + .type GL_PREFIX(UniformMatrix2fvARB), @function +GL_PREFIX(UniformMatrix2fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UniformMatrix2fvARB), .-GL_PREFIX(UniformMatrix2fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(UniformMatrix3fvARB) + .type GL_PREFIX(UniformMatrix3fvARB), @function +GL_PREFIX(UniformMatrix3fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UniformMatrix3fvARB), .-GL_PREFIX(UniformMatrix3fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(UniformMatrix4fvARB) + .type GL_PREFIX(UniformMatrix4fvARB), @function +GL_PREFIX(UniformMatrix4fvARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UniformMatrix4fvARB), .-GL_PREFIX(UniformMatrix4fvARB) + + .p2align 4,,15 + .globl GL_PREFIX(UseProgramObjectARB) + .type GL_PREFIX(UseProgramObjectARB), @function +GL_PREFIX(UseProgramObjectARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UseProgramObjectARB), .-GL_PREFIX(UseProgramObjectARB) + + .p2align 4,,15 + .globl GL_PREFIX(ValidateProgramARB) + .type GL_PREFIX(ValidateProgramARB), @function +GL_PREFIX(ValidateProgramARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ValidateProgramARB), .-GL_PREFIX(ValidateProgramARB) + + .p2align 4,,15 + .globl GL_PREFIX(BindAttribLocationARB) + .type GL_PREFIX(BindAttribLocationARB), @function +GL_PREFIX(BindAttribLocationARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindAttribLocationARB), .-GL_PREFIX(BindAttribLocationARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetActiveAttribARB) + .type GL_PREFIX(GetActiveAttribARB), @function +GL_PREFIX(GetActiveAttribARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetActiveAttribARB), .-GL_PREFIX(GetActiveAttribARB) + + .p2align 4,,15 + .globl GL_PREFIX(GetAttribLocationARB) + .type GL_PREFIX(GetAttribLocationARB), @function +GL_PREFIX(GetAttribLocationARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetAttribLocationARB), .-GL_PREFIX(GetAttribLocationARB) + + .p2align 4,,15 + .globl GL_PREFIX(DrawBuffersARB) + .type GL_PREFIX(DrawBuffersARB), @function +GL_PREFIX(DrawBuffersARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawBuffersARB), .-GL_PREFIX(DrawBuffersARB) + + .p2align 4,,15 + .globl GL_PREFIX(RenderbufferStorageMultisample) + .type GL_PREFIX(RenderbufferStorageMultisample), @function +GL_PREFIX(RenderbufferStorageMultisample): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RenderbufferStorageMultisample), .-GL_PREFIX(RenderbufferStorageMultisample) + + .p2align 4,,15 + .globl GL_PREFIX(FramebufferTextureARB) + .type GL_PREFIX(FramebufferTextureARB), @function +GL_PREFIX(FramebufferTextureARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FramebufferTextureARB), .-GL_PREFIX(FramebufferTextureARB) + + .p2align 4,,15 + .globl GL_PREFIX(FramebufferTextureFaceARB) + .type GL_PREFIX(FramebufferTextureFaceARB), @function +GL_PREFIX(FramebufferTextureFaceARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FramebufferTextureFaceARB), .-GL_PREFIX(FramebufferTextureFaceARB) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramParameteriARB) + .type GL_PREFIX(ProgramParameteriARB), @function +GL_PREFIX(ProgramParameteriARB): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramParameteriARB), .-GL_PREFIX(ProgramParameteriARB) + + .p2align 4,,15 + .globl GL_PREFIX(FlushMappedBufferRange) + .type GL_PREFIX(FlushMappedBufferRange), @function +GL_PREFIX(FlushMappedBufferRange): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FlushMappedBufferRange), .-GL_PREFIX(FlushMappedBufferRange) + + .p2align 4,,15 + .globl GL_PREFIX(MapBufferRange) + .type GL_PREFIX(MapBufferRange), @function +GL_PREFIX(MapBufferRange): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MapBufferRange), .-GL_PREFIX(MapBufferRange) + + .p2align 4,,15 + .globl GL_PREFIX(BindVertexArray) + .type GL_PREFIX(BindVertexArray), @function +GL_PREFIX(BindVertexArray): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindVertexArray), .-GL_PREFIX(BindVertexArray) + + .p2align 4,,15 + .globl GL_PREFIX(GenVertexArrays) + .type GL_PREFIX(GenVertexArrays), @function +GL_PREFIX(GenVertexArrays): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenVertexArrays), .-GL_PREFIX(GenVertexArrays) + + .p2align 4,,15 + .globl GL_PREFIX(CopyBufferSubData) + .type GL_PREFIX(CopyBufferSubData), @function +GL_PREFIX(CopyBufferSubData): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CopyBufferSubData), .-GL_PREFIX(CopyBufferSubData) + + .p2align 4,,15 + .globl GL_PREFIX(ClientWaitSync) + .type GL_PREFIX(ClientWaitSync), @function +GL_PREFIX(ClientWaitSync): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4576(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ClientWaitSync), .-GL_PREFIX(ClientWaitSync) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteSync) + .type GL_PREFIX(DeleteSync), @function +GL_PREFIX(DeleteSync): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteSync), .-GL_PREFIX(DeleteSync) + + .p2align 4,,15 + .globl GL_PREFIX(FenceSync) + .type GL_PREFIX(FenceSync), @function +GL_PREFIX(FenceSync): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FenceSync), .-GL_PREFIX(FenceSync) + + .p2align 4,,15 + .globl GL_PREFIX(GetInteger64v) + .type GL_PREFIX(GetInteger64v), @function +GL_PREFIX(GetInteger64v): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetInteger64v), .-GL_PREFIX(GetInteger64v) + + .p2align 4,,15 + .globl GL_PREFIX(GetSynciv) + .type GL_PREFIX(GetSynciv), @function +GL_PREFIX(GetSynciv): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetSynciv), .-GL_PREFIX(GetSynciv) + + .p2align 4,,15 + .globl GL_PREFIX(IsSync) + .type GL_PREFIX(IsSync), @function +GL_PREFIX(IsSync): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsSync), .-GL_PREFIX(IsSync) + + .p2align 4,,15 + .globl GL_PREFIX(WaitSync) + .type GL_PREFIX(WaitSync), @function +GL_PREFIX(WaitSync): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WaitSync), .-GL_PREFIX(WaitSync) + + .p2align 4,,15 + .globl GL_PREFIX(DrawElementsBaseVertex) + .type GL_PREFIX(DrawElementsBaseVertex), @function +GL_PREFIX(DrawElementsBaseVertex): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4632(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawElementsBaseVertex), .-GL_PREFIX(DrawElementsBaseVertex) + + .p2align 4,,15 + .globl GL_PREFIX(DrawRangeElementsBaseVertex) + .type GL_PREFIX(DrawRangeElementsBaseVertex), @function +GL_PREFIX(DrawRangeElementsBaseVertex): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4640(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawRangeElementsBaseVertex), .-GL_PREFIX(DrawRangeElementsBaseVertex) + + .p2align 4,,15 + .globl GL_PREFIX(MultiDrawElementsBaseVertex) + .type GL_PREFIX(MultiDrawElementsBaseVertex), @function +GL_PREFIX(MultiDrawElementsBaseVertex): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiDrawElementsBaseVertex), .-GL_PREFIX(MultiDrawElementsBaseVertex) + + .p2align 4,,15 + .globl GL_PREFIX(BindTransformFeedback) + .type GL_PREFIX(BindTransformFeedback), @function +GL_PREFIX(BindTransformFeedback): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4656(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindTransformFeedback), .-GL_PREFIX(BindTransformFeedback) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteTransformFeedbacks) + .type GL_PREFIX(DeleteTransformFeedbacks), @function +GL_PREFIX(DeleteTransformFeedbacks): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteTransformFeedbacks), .-GL_PREFIX(DeleteTransformFeedbacks) + + .p2align 4,,15 + .globl GL_PREFIX(DrawTransformFeedback) + .type GL_PREFIX(DrawTransformFeedback), @function +GL_PREFIX(DrawTransformFeedback): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4672(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DrawTransformFeedback), .-GL_PREFIX(DrawTransformFeedback) + + .p2align 4,,15 + .globl GL_PREFIX(GenTransformFeedbacks) + .type GL_PREFIX(GenTransformFeedbacks), @function +GL_PREFIX(GenTransformFeedbacks): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenTransformFeedbacks), .-GL_PREFIX(GenTransformFeedbacks) + + .p2align 4,,15 + .globl GL_PREFIX(IsTransformFeedback) + .type GL_PREFIX(IsTransformFeedback), @function +GL_PREFIX(IsTransformFeedback): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4688(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsTransformFeedback), .-GL_PREFIX(IsTransformFeedback) + + .p2align 4,,15 + .globl GL_PREFIX(PauseTransformFeedback) + .type GL_PREFIX(PauseTransformFeedback), @function +GL_PREFIX(PauseTransformFeedback): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 4696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4696(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 4696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PauseTransformFeedback), .-GL_PREFIX(PauseTransformFeedback) + + .p2align 4,,15 + .globl GL_PREFIX(ResumeTransformFeedback) + .type GL_PREFIX(ResumeTransformFeedback), @function +GL_PREFIX(ResumeTransformFeedback): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 4704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4704(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 4704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ResumeTransformFeedback), .-GL_PREFIX(ResumeTransformFeedback) + + .p2align 4,,15 + .globl GL_PREFIX(PolygonOffsetEXT) + .type GL_PREFIX(PolygonOffsetEXT), @function +GL_PREFIX(PolygonOffsetEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4712(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PolygonOffsetEXT), .-GL_PREFIX(PolygonOffsetEXT) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_590) + .type GL_PREFIX(_dispatch_stub_590), @function + HIDDEN(GL_PREFIX(_dispatch_stub_590)) +GL_PREFIX(_dispatch_stub_590): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_590), .-GL_PREFIX(_dispatch_stub_590) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_591) + .type GL_PREFIX(_dispatch_stub_591), @function + HIDDEN(GL_PREFIX(_dispatch_stub_591)) +GL_PREFIX(_dispatch_stub_591): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4728(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_591), .-GL_PREFIX(_dispatch_stub_591) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_592) + .type GL_PREFIX(_dispatch_stub_592), @function + HIDDEN(GL_PREFIX(_dispatch_stub_592)) +GL_PREFIX(_dispatch_stub_592): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4736(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_592), .-GL_PREFIX(_dispatch_stub_592) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_593) + .type GL_PREFIX(_dispatch_stub_593), @function + HIDDEN(GL_PREFIX(_dispatch_stub_593)) +GL_PREFIX(_dispatch_stub_593): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_593), .-GL_PREFIX(_dispatch_stub_593) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_594) + .type GL_PREFIX(_dispatch_stub_594), @function + HIDDEN(GL_PREFIX(_dispatch_stub_594)) +GL_PREFIX(_dispatch_stub_594): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4752(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_594), .-GL_PREFIX(_dispatch_stub_594) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_595) + .type GL_PREFIX(_dispatch_stub_595), @function + HIDDEN(GL_PREFIX(_dispatch_stub_595)) +GL_PREFIX(_dispatch_stub_595): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4760(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_595), .-GL_PREFIX(_dispatch_stub_595) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_596) + .type GL_PREFIX(_dispatch_stub_596), @function + HIDDEN(GL_PREFIX(_dispatch_stub_596)) +GL_PREFIX(_dispatch_stub_596): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4768(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_596), .-GL_PREFIX(_dispatch_stub_596) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_597) + .type GL_PREFIX(_dispatch_stub_597), @function + HIDDEN(GL_PREFIX(_dispatch_stub_597)) +GL_PREFIX(_dispatch_stub_597): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4776(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_597), .-GL_PREFIX(_dispatch_stub_597) + + .p2align 4,,15 + .globl GL_PREFIX(ColorPointerEXT) + .type GL_PREFIX(ColorPointerEXT), @function +GL_PREFIX(ColorPointerEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4784(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorPointerEXT), .-GL_PREFIX(ColorPointerEXT) + + .p2align 4,,15 + .globl GL_PREFIX(EdgeFlagPointerEXT) + .type GL_PREFIX(EdgeFlagPointerEXT), @function +GL_PREFIX(EdgeFlagPointerEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4792(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EdgeFlagPointerEXT), .-GL_PREFIX(EdgeFlagPointerEXT) + + .p2align 4,,15 + .globl GL_PREFIX(IndexPointerEXT) + .type GL_PREFIX(IndexPointerEXT), @function +GL_PREFIX(IndexPointerEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4800(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IndexPointerEXT), .-GL_PREFIX(IndexPointerEXT) + + .p2align 4,,15 + .globl GL_PREFIX(NormalPointerEXT) + .type GL_PREFIX(NormalPointerEXT), @function +GL_PREFIX(NormalPointerEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4808(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(NormalPointerEXT), .-GL_PREFIX(NormalPointerEXT) + + .p2align 4,,15 + .globl GL_PREFIX(TexCoordPointerEXT) + .type GL_PREFIX(TexCoordPointerEXT), @function +GL_PREFIX(TexCoordPointerEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4816(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexCoordPointerEXT), .-GL_PREFIX(TexCoordPointerEXT) + + .p2align 4,,15 + .globl GL_PREFIX(VertexPointerEXT) + .type GL_PREFIX(VertexPointerEXT), @function +GL_PREFIX(VertexPointerEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4824(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 4824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexPointerEXT), .-GL_PREFIX(VertexPointerEXT) + + .p2align 4,,15 + .globl GL_PREFIX(PointParameterfEXT) + .type GL_PREFIX(PointParameterfEXT), @function +GL_PREFIX(PointParameterfEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4832(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 4832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PointParameterfEXT), .-GL_PREFIX(PointParameterfEXT) + + .p2align 4,,15 + .globl GL_PREFIX(PointParameterfvEXT) + .type GL_PREFIX(PointParameterfvEXT), @function +GL_PREFIX(PointParameterfvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4840(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PointParameterfvEXT), .-GL_PREFIX(PointParameterfvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(LockArraysEXT) + .type GL_PREFIX(LockArraysEXT), @function +GL_PREFIX(LockArraysEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LockArraysEXT), .-GL_PREFIX(LockArraysEXT) + + .p2align 4,,15 + .globl GL_PREFIX(UnlockArraysEXT) + .type GL_PREFIX(UnlockArraysEXT), @function +GL_PREFIX(UnlockArraysEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 4856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4856(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 4856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(UnlockArraysEXT), .-GL_PREFIX(UnlockArraysEXT) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_608) + .type GL_PREFIX(_dispatch_stub_608), @function + HIDDEN(GL_PREFIX(_dispatch_stub_608)) +GL_PREFIX(_dispatch_stub_608): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_608), .-GL_PREFIX(_dispatch_stub_608) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_609) + .type GL_PREFIX(_dispatch_stub_609), @function + HIDDEN(GL_PREFIX(_dispatch_stub_609)) +GL_PREFIX(_dispatch_stub_609): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 4872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4872(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 4872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_609), .-GL_PREFIX(_dispatch_stub_609) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3bEXT) + .type GL_PREFIX(SecondaryColor3bEXT), @function +GL_PREFIX(SecondaryColor3bEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4880(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3bEXT), .-GL_PREFIX(SecondaryColor3bEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3bvEXT) + .type GL_PREFIX(SecondaryColor3bvEXT), @function +GL_PREFIX(SecondaryColor3bvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3bvEXT), .-GL_PREFIX(SecondaryColor3bvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3dEXT) + .type GL_PREFIX(SecondaryColor3dEXT), @function +GL_PREFIX(SecondaryColor3dEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4896(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3dEXT), .-GL_PREFIX(SecondaryColor3dEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3dvEXT) + .type GL_PREFIX(SecondaryColor3dvEXT), @function +GL_PREFIX(SecondaryColor3dvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3dvEXT), .-GL_PREFIX(SecondaryColor3dvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3fEXT) + .type GL_PREFIX(SecondaryColor3fEXT), @function +GL_PREFIX(SecondaryColor3fEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4912(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 4912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3fEXT), .-GL_PREFIX(SecondaryColor3fEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3fvEXT) + .type GL_PREFIX(SecondaryColor3fvEXT), @function +GL_PREFIX(SecondaryColor3fvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3fvEXT), .-GL_PREFIX(SecondaryColor3fvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3iEXT) + .type GL_PREFIX(SecondaryColor3iEXT), @function +GL_PREFIX(SecondaryColor3iEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3iEXT), .-GL_PREFIX(SecondaryColor3iEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3ivEXT) + .type GL_PREFIX(SecondaryColor3ivEXT), @function +GL_PREFIX(SecondaryColor3ivEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3ivEXT), .-GL_PREFIX(SecondaryColor3ivEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3sEXT) + .type GL_PREFIX(SecondaryColor3sEXT), @function +GL_PREFIX(SecondaryColor3sEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3sEXT), .-GL_PREFIX(SecondaryColor3sEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3svEXT) + .type GL_PREFIX(SecondaryColor3svEXT), @function +GL_PREFIX(SecondaryColor3svEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3svEXT), .-GL_PREFIX(SecondaryColor3svEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3ubEXT) + .type GL_PREFIX(SecondaryColor3ubEXT), @function +GL_PREFIX(SecondaryColor3ubEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3ubEXT), .-GL_PREFIX(SecondaryColor3ubEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3ubvEXT) + .type GL_PREFIX(SecondaryColor3ubvEXT), @function +GL_PREFIX(SecondaryColor3ubvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4968(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3ubvEXT), .-GL_PREFIX(SecondaryColor3ubvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3uiEXT) + .type GL_PREFIX(SecondaryColor3uiEXT), @function +GL_PREFIX(SecondaryColor3uiEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4976(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3uiEXT), .-GL_PREFIX(SecondaryColor3uiEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3uivEXT) + .type GL_PREFIX(SecondaryColor3uivEXT), @function +GL_PREFIX(SecondaryColor3uivEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 4984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 4984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3uivEXT), .-GL_PREFIX(SecondaryColor3uivEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3usEXT) + .type GL_PREFIX(SecondaryColor3usEXT), @function +GL_PREFIX(SecondaryColor3usEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 4992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 4992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 4992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 4992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3usEXT), .-GL_PREFIX(SecondaryColor3usEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColor3usvEXT) + .type GL_PREFIX(SecondaryColor3usvEXT), @function +GL_PREFIX(SecondaryColor3usvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColor3usvEXT), .-GL_PREFIX(SecondaryColor3usvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(SecondaryColorPointerEXT) + .type GL_PREFIX(SecondaryColorPointerEXT), @function +GL_PREFIX(SecondaryColorPointerEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5008(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SecondaryColorPointerEXT), .-GL_PREFIX(SecondaryColorPointerEXT) + + .p2align 4,,15 + .globl GL_PREFIX(MultiDrawArraysEXT) + .type GL_PREFIX(MultiDrawArraysEXT), @function +GL_PREFIX(MultiDrawArraysEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5016(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiDrawArraysEXT), .-GL_PREFIX(MultiDrawArraysEXT) + + .p2align 4,,15 + .globl GL_PREFIX(MultiDrawElementsEXT) + .type GL_PREFIX(MultiDrawElementsEXT), @function +GL_PREFIX(MultiDrawElementsEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5024(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(MultiDrawElementsEXT), .-GL_PREFIX(MultiDrawElementsEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FogCoordPointerEXT) + .type GL_PREFIX(FogCoordPointerEXT), @function +GL_PREFIX(FogCoordPointerEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FogCoordPointerEXT), .-GL_PREFIX(FogCoordPointerEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FogCoorddEXT) + .type GL_PREFIX(FogCoorddEXT), @function +GL_PREFIX(FogCoorddEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 5040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5040(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 5040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FogCoorddEXT), .-GL_PREFIX(FogCoorddEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FogCoorddvEXT) + .type GL_PREFIX(FogCoorddvEXT), @function +GL_PREFIX(FogCoorddvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FogCoorddvEXT), .-GL_PREFIX(FogCoorddvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FogCoordfEXT) + .type GL_PREFIX(FogCoordfEXT), @function +GL_PREFIX(FogCoordfEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $8, %rsp + movq %xmm0, (%rsp) + call _x86_64_get_dispatch@PLT + movq (%rsp), %xmm0 + addq $8, %rsp + movq 5056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5056(%rax), %r11 + jmp *%r11 +1: + subq $8, %rsp + movq %xmm0, (%rsp) + call _glapi_get_dispatch + movq (%rsp), %xmm0 + addq $8, %rsp + movq 5056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FogCoordfEXT), .-GL_PREFIX(FogCoordfEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FogCoordfvEXT) + .type GL_PREFIX(FogCoordfvEXT), @function +GL_PREFIX(FogCoordfvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5064(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FogCoordfvEXT), .-GL_PREFIX(FogCoordfvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_634) + .type GL_PREFIX(_dispatch_stub_634), @function + HIDDEN(GL_PREFIX(_dispatch_stub_634)) +GL_PREFIX(_dispatch_stub_634): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5072(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_634), .-GL_PREFIX(_dispatch_stub_634) + + .p2align 4,,15 + .globl GL_PREFIX(BlendFuncSeparateEXT) + .type GL_PREFIX(BlendFuncSeparateEXT), @function +GL_PREFIX(BlendFuncSeparateEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BlendFuncSeparateEXT), .-GL_PREFIX(BlendFuncSeparateEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FlushVertexArrayRangeNV) + .type GL_PREFIX(FlushVertexArrayRangeNV), @function +GL_PREFIX(FlushVertexArrayRangeNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 5088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5088(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 5088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FlushVertexArrayRangeNV), .-GL_PREFIX(FlushVertexArrayRangeNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexArrayRangeNV) + .type GL_PREFIX(VertexArrayRangeNV), @function +GL_PREFIX(VertexArrayRangeNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexArrayRangeNV), .-GL_PREFIX(VertexArrayRangeNV) + + .p2align 4,,15 + .globl GL_PREFIX(CombinerInputNV) + .type GL_PREFIX(CombinerInputNV), @function +GL_PREFIX(CombinerInputNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CombinerInputNV), .-GL_PREFIX(CombinerInputNV) + + .p2align 4,,15 + .globl GL_PREFIX(CombinerOutputNV) + .type GL_PREFIX(CombinerOutputNV), @function +GL_PREFIX(CombinerOutputNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CombinerOutputNV), .-GL_PREFIX(CombinerOutputNV) + + .p2align 4,,15 + .globl GL_PREFIX(CombinerParameterfNV) + .type GL_PREFIX(CombinerParameterfNV), @function +GL_PREFIX(CombinerParameterfNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5120(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CombinerParameterfNV), .-GL_PREFIX(CombinerParameterfNV) + + .p2align 4,,15 + .globl GL_PREFIX(CombinerParameterfvNV) + .type GL_PREFIX(CombinerParameterfvNV), @function +GL_PREFIX(CombinerParameterfvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CombinerParameterfvNV), .-GL_PREFIX(CombinerParameterfvNV) + + .p2align 4,,15 + .globl GL_PREFIX(CombinerParameteriNV) + .type GL_PREFIX(CombinerParameteriNV), @function +GL_PREFIX(CombinerParameteriNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CombinerParameteriNV), .-GL_PREFIX(CombinerParameteriNV) + + .p2align 4,,15 + .globl GL_PREFIX(CombinerParameterivNV) + .type GL_PREFIX(CombinerParameterivNV), @function +GL_PREFIX(CombinerParameterivNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CombinerParameterivNV), .-GL_PREFIX(CombinerParameterivNV) + + .p2align 4,,15 + .globl GL_PREFIX(FinalCombinerInputNV) + .type GL_PREFIX(FinalCombinerInputNV), @function +GL_PREFIX(FinalCombinerInputNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FinalCombinerInputNV), .-GL_PREFIX(FinalCombinerInputNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetCombinerInputParameterfvNV) + .type GL_PREFIX(GetCombinerInputParameterfvNV), @function +GL_PREFIX(GetCombinerInputParameterfvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetCombinerInputParameterfvNV), .-GL_PREFIX(GetCombinerInputParameterfvNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetCombinerInputParameterivNV) + .type GL_PREFIX(GetCombinerInputParameterivNV), @function +GL_PREFIX(GetCombinerInputParameterivNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetCombinerInputParameterivNV), .-GL_PREFIX(GetCombinerInputParameterivNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetCombinerOutputParameterfvNV) + .type GL_PREFIX(GetCombinerOutputParameterfvNV), @function +GL_PREFIX(GetCombinerOutputParameterfvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5176(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetCombinerOutputParameterfvNV), .-GL_PREFIX(GetCombinerOutputParameterfvNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetCombinerOutputParameterivNV) + .type GL_PREFIX(GetCombinerOutputParameterivNV), @function +GL_PREFIX(GetCombinerOutputParameterivNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetCombinerOutputParameterivNV), .-GL_PREFIX(GetCombinerOutputParameterivNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetFinalCombinerInputParameterfvNV) + .type GL_PREFIX(GetFinalCombinerInputParameterfvNV), @function +GL_PREFIX(GetFinalCombinerInputParameterfvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetFinalCombinerInputParameterfvNV), .-GL_PREFIX(GetFinalCombinerInputParameterfvNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetFinalCombinerInputParameterivNV) + .type GL_PREFIX(GetFinalCombinerInputParameterivNV), @function +GL_PREFIX(GetFinalCombinerInputParameterivNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetFinalCombinerInputParameterivNV), .-GL_PREFIX(GetFinalCombinerInputParameterivNV) + + .p2align 4,,15 + .globl GL_PREFIX(ResizeBuffersMESA) + .type GL_PREFIX(ResizeBuffersMESA), @function +GL_PREFIX(ResizeBuffersMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 5208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5208(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 5208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ResizeBuffersMESA), .-GL_PREFIX(ResizeBuffersMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos2dMESA) + .type GL_PREFIX(WindowPos2dMESA), @function +GL_PREFIX(WindowPos2dMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 5216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5216(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 5216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos2dMESA), .-GL_PREFIX(WindowPos2dMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos2dvMESA) + .type GL_PREFIX(WindowPos2dvMESA), @function +GL_PREFIX(WindowPos2dvMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos2dvMESA), .-GL_PREFIX(WindowPos2dvMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos2fMESA) + .type GL_PREFIX(WindowPos2fMESA), @function +GL_PREFIX(WindowPos2fMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 5232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5232(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 5232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos2fMESA), .-GL_PREFIX(WindowPos2fMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos2fvMESA) + .type GL_PREFIX(WindowPos2fvMESA), @function +GL_PREFIX(WindowPos2fvMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos2fvMESA), .-GL_PREFIX(WindowPos2fvMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos2iMESA) + .type GL_PREFIX(WindowPos2iMESA), @function +GL_PREFIX(WindowPos2iMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos2iMESA), .-GL_PREFIX(WindowPos2iMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos2ivMESA) + .type GL_PREFIX(WindowPos2ivMESA), @function +GL_PREFIX(WindowPos2ivMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos2ivMESA), .-GL_PREFIX(WindowPos2ivMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos2sMESA) + .type GL_PREFIX(WindowPos2sMESA), @function +GL_PREFIX(WindowPos2sMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos2sMESA), .-GL_PREFIX(WindowPos2sMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos2svMESA) + .type GL_PREFIX(WindowPos2svMESA), @function +GL_PREFIX(WindowPos2svMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos2svMESA), .-GL_PREFIX(WindowPos2svMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos3dMESA) + .type GL_PREFIX(WindowPos3dMESA), @function +GL_PREFIX(WindowPos3dMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 5280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5280(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 5280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos3dMESA), .-GL_PREFIX(WindowPos3dMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos3dvMESA) + .type GL_PREFIX(WindowPos3dvMESA), @function +GL_PREFIX(WindowPos3dvMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos3dvMESA), .-GL_PREFIX(WindowPos3dvMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos3fMESA) + .type GL_PREFIX(WindowPos3fMESA), @function +GL_PREFIX(WindowPos3fMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 5296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5296(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $24, %rsp + movq 5296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos3fMESA), .-GL_PREFIX(WindowPos3fMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos3fvMESA) + .type GL_PREFIX(WindowPos3fvMESA), @function +GL_PREFIX(WindowPos3fvMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos3fvMESA), .-GL_PREFIX(WindowPos3fvMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos3iMESA) + .type GL_PREFIX(WindowPos3iMESA), @function +GL_PREFIX(WindowPos3iMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos3iMESA), .-GL_PREFIX(WindowPos3iMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos3ivMESA) + .type GL_PREFIX(WindowPos3ivMESA), @function +GL_PREFIX(WindowPos3ivMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos3ivMESA), .-GL_PREFIX(WindowPos3ivMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos3sMESA) + .type GL_PREFIX(WindowPos3sMESA), @function +GL_PREFIX(WindowPos3sMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos3sMESA), .-GL_PREFIX(WindowPos3sMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos3svMESA) + .type GL_PREFIX(WindowPos3svMESA), @function +GL_PREFIX(WindowPos3svMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos3svMESA), .-GL_PREFIX(WindowPos3svMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos4dMESA) + .type GL_PREFIX(WindowPos4dMESA), @function +GL_PREFIX(WindowPos4dMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 5344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5344(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 5344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos4dMESA), .-GL_PREFIX(WindowPos4dMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos4dvMESA) + .type GL_PREFIX(WindowPos4dvMESA), @function +GL_PREFIX(WindowPos4dvMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos4dvMESA), .-GL_PREFIX(WindowPos4dvMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos4fMESA) + .type GL_PREFIX(WindowPos4fMESA), @function +GL_PREFIX(WindowPos4fMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 5360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5360(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %xmm0, (%rsp) + movq %xmm1, 8(%rsp) + movq %xmm2, 16(%rsp) + movq %xmm3, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm3 + movq 16(%rsp), %xmm2 + movq 8(%rsp), %xmm1 + movq (%rsp), %xmm0 + addq $40, %rsp + movq 5360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos4fMESA), .-GL_PREFIX(WindowPos4fMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos4fvMESA) + .type GL_PREFIX(WindowPos4fvMESA), @function +GL_PREFIX(WindowPos4fvMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5368(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos4fvMESA), .-GL_PREFIX(WindowPos4fvMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos4iMESA) + .type GL_PREFIX(WindowPos4iMESA), @function +GL_PREFIX(WindowPos4iMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos4iMESA), .-GL_PREFIX(WindowPos4iMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos4ivMESA) + .type GL_PREFIX(WindowPos4ivMESA), @function +GL_PREFIX(WindowPos4ivMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos4ivMESA), .-GL_PREFIX(WindowPos4ivMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos4sMESA) + .type GL_PREFIX(WindowPos4sMESA), @function +GL_PREFIX(WindowPos4sMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos4sMESA), .-GL_PREFIX(WindowPos4sMESA) + + .p2align 4,,15 + .globl GL_PREFIX(WindowPos4svMESA) + .type GL_PREFIX(WindowPos4svMESA), @function +GL_PREFIX(WindowPos4svMESA): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(WindowPos4svMESA), .-GL_PREFIX(WindowPos4svMESA) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_676) + .type GL_PREFIX(_dispatch_stub_676), @function + HIDDEN(GL_PREFIX(_dispatch_stub_676)) +GL_PREFIX(_dispatch_stub_676): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_676), .-GL_PREFIX(_dispatch_stub_676) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_677) + .type GL_PREFIX(_dispatch_stub_677), @function + HIDDEN(GL_PREFIX(_dispatch_stub_677)) +GL_PREFIX(_dispatch_stub_677): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_677), .-GL_PREFIX(_dispatch_stub_677) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_678) + .type GL_PREFIX(_dispatch_stub_678), @function + HIDDEN(GL_PREFIX(_dispatch_stub_678)) +GL_PREFIX(_dispatch_stub_678): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_678), .-GL_PREFIX(_dispatch_stub_678) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_679) + .type GL_PREFIX(_dispatch_stub_679), @function + HIDDEN(GL_PREFIX(_dispatch_stub_679)) +GL_PREFIX(_dispatch_stub_679): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_679), .-GL_PREFIX(_dispatch_stub_679) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_680) + .type GL_PREFIX(_dispatch_stub_680), @function + HIDDEN(GL_PREFIX(_dispatch_stub_680)) +GL_PREFIX(_dispatch_stub_680): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_680), .-GL_PREFIX(_dispatch_stub_680) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_681) + .type GL_PREFIX(_dispatch_stub_681), @function + HIDDEN(GL_PREFIX(_dispatch_stub_681)) +GL_PREFIX(_dispatch_stub_681): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5448(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_681), .-GL_PREFIX(_dispatch_stub_681) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_682) + .type GL_PREFIX(_dispatch_stub_682), @function + HIDDEN(GL_PREFIX(_dispatch_stub_682)) +GL_PREFIX(_dispatch_stub_682): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_682), .-GL_PREFIX(_dispatch_stub_682) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_683) + .type GL_PREFIX(_dispatch_stub_683), @function + HIDDEN(GL_PREFIX(_dispatch_stub_683)) +GL_PREFIX(_dispatch_stub_683): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_683), .-GL_PREFIX(_dispatch_stub_683) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_684) + .type GL_PREFIX(_dispatch_stub_684), @function + HIDDEN(GL_PREFIX(_dispatch_stub_684)) +GL_PREFIX(_dispatch_stub_684): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_684), .-GL_PREFIX(_dispatch_stub_684) + + .p2align 4,,15 + .globl GL_PREFIX(AreProgramsResidentNV) + .type GL_PREFIX(AreProgramsResidentNV), @function +GL_PREFIX(AreProgramsResidentNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(AreProgramsResidentNV), .-GL_PREFIX(AreProgramsResidentNV) + + .p2align 4,,15 + .globl GL_PREFIX(BindProgramNV) + .type GL_PREFIX(BindProgramNV), @function +GL_PREFIX(BindProgramNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5488(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindProgramNV), .-GL_PREFIX(BindProgramNV) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteProgramsNV) + .type GL_PREFIX(DeleteProgramsNV), @function +GL_PREFIX(DeleteProgramsNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteProgramsNV), .-GL_PREFIX(DeleteProgramsNV) + + .p2align 4,,15 + .globl GL_PREFIX(ExecuteProgramNV) + .type GL_PREFIX(ExecuteProgramNV), @function +GL_PREFIX(ExecuteProgramNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ExecuteProgramNV), .-GL_PREFIX(ExecuteProgramNV) + + .p2align 4,,15 + .globl GL_PREFIX(GenProgramsNV) + .type GL_PREFIX(GenProgramsNV), @function +GL_PREFIX(GenProgramsNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenProgramsNV), .-GL_PREFIX(GenProgramsNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramParameterdvNV) + .type GL_PREFIX(GetProgramParameterdvNV), @function +GL_PREFIX(GetProgramParameterdvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramParameterdvNV), .-GL_PREFIX(GetProgramParameterdvNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramParameterfvNV) + .type GL_PREFIX(GetProgramParameterfvNV), @function +GL_PREFIX(GetProgramParameterfvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramParameterfvNV), .-GL_PREFIX(GetProgramParameterfvNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramStringNV) + .type GL_PREFIX(GetProgramStringNV), @function +GL_PREFIX(GetProgramStringNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramStringNV), .-GL_PREFIX(GetProgramStringNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramivNV) + .type GL_PREFIX(GetProgramivNV), @function +GL_PREFIX(GetProgramivNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramivNV), .-GL_PREFIX(GetProgramivNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetTrackMatrixivNV) + .type GL_PREFIX(GetTrackMatrixivNV), @function +GL_PREFIX(GetTrackMatrixivNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTrackMatrixivNV), .-GL_PREFIX(GetTrackMatrixivNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetVertexAttribPointervNV) + .type GL_PREFIX(GetVertexAttribPointervNV), @function +GL_PREFIX(GetVertexAttribPointervNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetVertexAttribPointervNV), .-GL_PREFIX(GetVertexAttribPointervNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetVertexAttribdvNV) + .type GL_PREFIX(GetVertexAttribdvNV), @function +GL_PREFIX(GetVertexAttribdvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetVertexAttribdvNV), .-GL_PREFIX(GetVertexAttribdvNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetVertexAttribfvNV) + .type GL_PREFIX(GetVertexAttribfvNV), @function +GL_PREFIX(GetVertexAttribfvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5576(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetVertexAttribfvNV), .-GL_PREFIX(GetVertexAttribfvNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetVertexAttribivNV) + .type GL_PREFIX(GetVertexAttribivNV), @function +GL_PREFIX(GetVertexAttribivNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetVertexAttribivNV), .-GL_PREFIX(GetVertexAttribivNV) + + .p2align 4,,15 + .globl GL_PREFIX(IsProgramNV) + .type GL_PREFIX(IsProgramNV), @function +GL_PREFIX(IsProgramNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 5592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 5592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsProgramNV), .-GL_PREFIX(IsProgramNV) + + .p2align 4,,15 + .globl GL_PREFIX(LoadProgramNV) + .type GL_PREFIX(LoadProgramNV), @function +GL_PREFIX(LoadProgramNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(LoadProgramNV), .-GL_PREFIX(LoadProgramNV) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramParameters4dvNV) + .type GL_PREFIX(ProgramParameters4dvNV), @function +GL_PREFIX(ProgramParameters4dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramParameters4dvNV), .-GL_PREFIX(ProgramParameters4dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramParameters4fvNV) + .type GL_PREFIX(ProgramParameters4fvNV), @function +GL_PREFIX(ProgramParameters4fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5616(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5616(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5616(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5616(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramParameters4fvNV), .-GL_PREFIX(ProgramParameters4fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(RequestResidentProgramsNV) + .type GL_PREFIX(RequestResidentProgramsNV), @function +GL_PREFIX(RequestResidentProgramsNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5624(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5624(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5624(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5624(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RequestResidentProgramsNV), .-GL_PREFIX(RequestResidentProgramsNV) + + .p2align 4,,15 + .globl GL_PREFIX(TrackMatrixNV) + .type GL_PREFIX(TrackMatrixNV), @function +GL_PREFIX(TrackMatrixNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5632(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5632(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5632(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5632(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TrackMatrixNV), .-GL_PREFIX(TrackMatrixNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1dNV) + .type GL_PREFIX(VertexAttrib1dNV), @function +GL_PREFIX(VertexAttrib1dNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5640(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5640(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5640(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5640(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1dNV), .-GL_PREFIX(VertexAttrib1dNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1dvNV) + .type GL_PREFIX(VertexAttrib1dvNV), @function +GL_PREFIX(VertexAttrib1dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5648(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5648(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5648(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5648(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1dvNV), .-GL_PREFIX(VertexAttrib1dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1fNV) + .type GL_PREFIX(VertexAttrib1fNV), @function +GL_PREFIX(VertexAttrib1fNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5656(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _x86_64_get_dispatch@PLT + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5656(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5656(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + call _glapi_get_dispatch + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5656(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1fNV), .-GL_PREFIX(VertexAttrib1fNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1fvNV) + .type GL_PREFIX(VertexAttrib1fvNV), @function +GL_PREFIX(VertexAttrib1fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5664(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5664(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5664(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5664(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1fvNV), .-GL_PREFIX(VertexAttrib1fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1sNV) + .type GL_PREFIX(VertexAttrib1sNV), @function +GL_PREFIX(VertexAttrib1sNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5672(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5672(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5672(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5672(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1sNV), .-GL_PREFIX(VertexAttrib1sNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib1svNV) + .type GL_PREFIX(VertexAttrib1svNV), @function +GL_PREFIX(VertexAttrib1svNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5680(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5680(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5680(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5680(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib1svNV), .-GL_PREFIX(VertexAttrib1svNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2dNV) + .type GL_PREFIX(VertexAttrib2dNV), @function +GL_PREFIX(VertexAttrib2dNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5688(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5688(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5688(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5688(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2dNV), .-GL_PREFIX(VertexAttrib2dNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2dvNV) + .type GL_PREFIX(VertexAttrib2dvNV), @function +GL_PREFIX(VertexAttrib2dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5696(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5696(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5696(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5696(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2dvNV), .-GL_PREFIX(VertexAttrib2dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2fNV) + .type GL_PREFIX(VertexAttrib2fNV), @function +GL_PREFIX(VertexAttrib2fNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5704(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _x86_64_get_dispatch@PLT + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5704(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5704(%rax), %r11 + jmp *%r11 +1: + subq $24, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + call _glapi_get_dispatch + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $24, %rsp + movq 5704(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2fNV), .-GL_PREFIX(VertexAttrib2fNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2fvNV) + .type GL_PREFIX(VertexAttrib2fvNV), @function +GL_PREFIX(VertexAttrib2fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5712(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5712(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5712(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5712(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2fvNV), .-GL_PREFIX(VertexAttrib2fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2sNV) + .type GL_PREFIX(VertexAttrib2sNV), @function +GL_PREFIX(VertexAttrib2sNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5720(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5720(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5720(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5720(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2sNV), .-GL_PREFIX(VertexAttrib2sNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib2svNV) + .type GL_PREFIX(VertexAttrib2svNV), @function +GL_PREFIX(VertexAttrib2svNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5728(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5728(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5728(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5728(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib2svNV), .-GL_PREFIX(VertexAttrib2svNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3dNV) + .type GL_PREFIX(VertexAttrib3dNV), @function +GL_PREFIX(VertexAttrib3dNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5736(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5736(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5736(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5736(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3dNV), .-GL_PREFIX(VertexAttrib3dNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3dvNV) + .type GL_PREFIX(VertexAttrib3dvNV), @function +GL_PREFIX(VertexAttrib3dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5744(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5744(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5744(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5744(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3dvNV), .-GL_PREFIX(VertexAttrib3dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3fNV) + .type GL_PREFIX(VertexAttrib3fNV), @function +GL_PREFIX(VertexAttrib3fNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5752(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _x86_64_get_dispatch@PLT + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5752(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5752(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + call _glapi_get_dispatch + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5752(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3fNV), .-GL_PREFIX(VertexAttrib3fNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3fvNV) + .type GL_PREFIX(VertexAttrib3fvNV), @function +GL_PREFIX(VertexAttrib3fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5760(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5760(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5760(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5760(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3fvNV), .-GL_PREFIX(VertexAttrib3fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3sNV) + .type GL_PREFIX(VertexAttrib3sNV), @function +GL_PREFIX(VertexAttrib3sNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5768(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5768(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5768(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5768(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3sNV), .-GL_PREFIX(VertexAttrib3sNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib3svNV) + .type GL_PREFIX(VertexAttrib3svNV), @function +GL_PREFIX(VertexAttrib3svNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5776(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5776(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5776(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5776(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib3svNV), .-GL_PREFIX(VertexAttrib3svNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4dNV) + .type GL_PREFIX(VertexAttrib4dNV), @function +GL_PREFIX(VertexAttrib4dNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5784(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5784(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5784(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5784(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4dNV), .-GL_PREFIX(VertexAttrib4dNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4dvNV) + .type GL_PREFIX(VertexAttrib4dvNV), @function +GL_PREFIX(VertexAttrib4dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5792(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5792(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5792(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5792(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4dvNV), .-GL_PREFIX(VertexAttrib4dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4fNV) + .type GL_PREFIX(VertexAttrib4fNV), @function +GL_PREFIX(VertexAttrib4fNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5800(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _x86_64_get_dispatch@PLT + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5800(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5800(%rax), %r11 + jmp *%r11 +1: + subq $40, %rsp + movq %rdi, (%rsp) + movq %xmm0, 8(%rsp) + movq %xmm1, 16(%rsp) + movq %xmm2, 24(%rsp) + movq %xmm3, 32(%rsp) + call _glapi_get_dispatch + movq 32(%rsp), %xmm3 + movq 24(%rsp), %xmm2 + movq 16(%rsp), %xmm1 + movq 8(%rsp), %xmm0 + movq (%rsp), %rdi + addq $40, %rsp + movq 5800(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4fNV), .-GL_PREFIX(VertexAttrib4fNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4fvNV) + .type GL_PREFIX(VertexAttrib4fvNV), @function +GL_PREFIX(VertexAttrib4fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5808(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5808(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5808(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5808(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4fvNV), .-GL_PREFIX(VertexAttrib4fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4sNV) + .type GL_PREFIX(VertexAttrib4sNV), @function +GL_PREFIX(VertexAttrib4sNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5816(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5816(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5816(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5816(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4sNV), .-GL_PREFIX(VertexAttrib4sNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4svNV) + .type GL_PREFIX(VertexAttrib4svNV), @function +GL_PREFIX(VertexAttrib4svNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5824(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5824(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5824(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5824(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4svNV), .-GL_PREFIX(VertexAttrib4svNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4ubNV) + .type GL_PREFIX(VertexAttrib4ubNV), @function +GL_PREFIX(VertexAttrib4ubNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5832(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5832(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5832(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5832(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4ubNV), .-GL_PREFIX(VertexAttrib4ubNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttrib4ubvNV) + .type GL_PREFIX(VertexAttrib4ubvNV), @function +GL_PREFIX(VertexAttrib4ubvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5840(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5840(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5840(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5840(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttrib4ubvNV), .-GL_PREFIX(VertexAttrib4ubvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribPointerNV) + .type GL_PREFIX(VertexAttribPointerNV), @function +GL_PREFIX(VertexAttribPointerNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5848(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5848(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5848(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5848(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribPointerNV), .-GL_PREFIX(VertexAttribPointerNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs1dvNV) + .type GL_PREFIX(VertexAttribs1dvNV), @function +GL_PREFIX(VertexAttribs1dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5856(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5856(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5856(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5856(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs1dvNV), .-GL_PREFIX(VertexAttribs1dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs1fvNV) + .type GL_PREFIX(VertexAttribs1fvNV), @function +GL_PREFIX(VertexAttribs1fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5864(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5864(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5864(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5864(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs1fvNV), .-GL_PREFIX(VertexAttribs1fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs1svNV) + .type GL_PREFIX(VertexAttribs1svNV), @function +GL_PREFIX(VertexAttribs1svNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5872(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5872(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5872(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5872(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs1svNV), .-GL_PREFIX(VertexAttribs1svNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs2dvNV) + .type GL_PREFIX(VertexAttribs2dvNV), @function +GL_PREFIX(VertexAttribs2dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5880(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5880(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5880(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5880(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs2dvNV), .-GL_PREFIX(VertexAttribs2dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs2fvNV) + .type GL_PREFIX(VertexAttribs2fvNV), @function +GL_PREFIX(VertexAttribs2fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5888(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5888(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5888(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5888(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs2fvNV), .-GL_PREFIX(VertexAttribs2fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs2svNV) + .type GL_PREFIX(VertexAttribs2svNV), @function +GL_PREFIX(VertexAttribs2svNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5896(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5896(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5896(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5896(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs2svNV), .-GL_PREFIX(VertexAttribs2svNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs3dvNV) + .type GL_PREFIX(VertexAttribs3dvNV), @function +GL_PREFIX(VertexAttribs3dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5904(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5904(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5904(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5904(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs3dvNV), .-GL_PREFIX(VertexAttribs3dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs3fvNV) + .type GL_PREFIX(VertexAttribs3fvNV), @function +GL_PREFIX(VertexAttribs3fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5912(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5912(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5912(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5912(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs3fvNV), .-GL_PREFIX(VertexAttribs3fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs3svNV) + .type GL_PREFIX(VertexAttribs3svNV), @function +GL_PREFIX(VertexAttribs3svNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5920(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5920(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5920(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5920(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs3svNV), .-GL_PREFIX(VertexAttribs3svNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs4dvNV) + .type GL_PREFIX(VertexAttribs4dvNV), @function +GL_PREFIX(VertexAttribs4dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5928(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5928(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5928(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5928(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs4dvNV), .-GL_PREFIX(VertexAttribs4dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs4fvNV) + .type GL_PREFIX(VertexAttribs4fvNV), @function +GL_PREFIX(VertexAttribs4fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5936(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5936(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5936(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5936(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs4fvNV), .-GL_PREFIX(VertexAttribs4fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs4svNV) + .type GL_PREFIX(VertexAttribs4svNV), @function +GL_PREFIX(VertexAttribs4svNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5944(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5944(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5944(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5944(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs4svNV), .-GL_PREFIX(VertexAttribs4svNV) + + .p2align 4,,15 + .globl GL_PREFIX(VertexAttribs4ubvNV) + .type GL_PREFIX(VertexAttribs4ubvNV), @function +GL_PREFIX(VertexAttribs4ubvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5952(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 5952(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5952(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 5952(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(VertexAttribs4ubvNV), .-GL_PREFIX(VertexAttribs4ubvNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexBumpParameterfvATI) + .type GL_PREFIX(GetTexBumpParameterfvATI), @function +GL_PREFIX(GetTexBumpParameterfvATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5960(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5960(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5960(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5960(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexBumpParameterfvATI), .-GL_PREFIX(GetTexBumpParameterfvATI) + + .p2align 4,,15 + .globl GL_PREFIX(GetTexBumpParameterivATI) + .type GL_PREFIX(GetTexBumpParameterivATI), @function +GL_PREFIX(GetTexBumpParameterivATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5968(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5968(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5968(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5968(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTexBumpParameterivATI), .-GL_PREFIX(GetTexBumpParameterivATI) + + .p2align 4,,15 + .globl GL_PREFIX(TexBumpParameterfvATI) + .type GL_PREFIX(TexBumpParameterfvATI), @function +GL_PREFIX(TexBumpParameterfvATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5976(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5976(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5976(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5976(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexBumpParameterfvATI), .-GL_PREFIX(TexBumpParameterfvATI) + + .p2align 4,,15 + .globl GL_PREFIX(TexBumpParameterivATI) + .type GL_PREFIX(TexBumpParameterivATI), @function +GL_PREFIX(TexBumpParameterivATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5984(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 5984(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5984(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 5984(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TexBumpParameterivATI), .-GL_PREFIX(TexBumpParameterivATI) + + .p2align 4,,15 + .globl GL_PREFIX(AlphaFragmentOp1ATI) + .type GL_PREFIX(AlphaFragmentOp1ATI), @function +GL_PREFIX(AlphaFragmentOp1ATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 5992(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5992(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 5992(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 5992(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(AlphaFragmentOp1ATI), .-GL_PREFIX(AlphaFragmentOp1ATI) + + .p2align 4,,15 + .globl GL_PREFIX(AlphaFragmentOp2ATI) + .type GL_PREFIX(AlphaFragmentOp2ATI), @function +GL_PREFIX(AlphaFragmentOp2ATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6000(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6000(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6000(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6000(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(AlphaFragmentOp2ATI), .-GL_PREFIX(AlphaFragmentOp2ATI) + + .p2align 4,,15 + .globl GL_PREFIX(AlphaFragmentOp3ATI) + .type GL_PREFIX(AlphaFragmentOp3ATI), @function +GL_PREFIX(AlphaFragmentOp3ATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6008(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6008(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6008(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6008(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(AlphaFragmentOp3ATI), .-GL_PREFIX(AlphaFragmentOp3ATI) + + .p2align 4,,15 + .globl GL_PREFIX(BeginFragmentShaderATI) + .type GL_PREFIX(BeginFragmentShaderATI), @function +GL_PREFIX(BeginFragmentShaderATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6016(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 6016(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6016(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 6016(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BeginFragmentShaderATI), .-GL_PREFIX(BeginFragmentShaderATI) + + .p2align 4,,15 + .globl GL_PREFIX(BindFragmentShaderATI) + .type GL_PREFIX(BindFragmentShaderATI), @function +GL_PREFIX(BindFragmentShaderATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6024(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6024(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6024(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6024(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindFragmentShaderATI), .-GL_PREFIX(BindFragmentShaderATI) + + .p2align 4,,15 + .globl GL_PREFIX(ColorFragmentOp1ATI) + .type GL_PREFIX(ColorFragmentOp1ATI), @function +GL_PREFIX(ColorFragmentOp1ATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6032(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6032(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6032(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6032(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorFragmentOp1ATI), .-GL_PREFIX(ColorFragmentOp1ATI) + + .p2align 4,,15 + .globl GL_PREFIX(ColorFragmentOp2ATI) + .type GL_PREFIX(ColorFragmentOp2ATI), @function +GL_PREFIX(ColorFragmentOp2ATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6040(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6040(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6040(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6040(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorFragmentOp2ATI), .-GL_PREFIX(ColorFragmentOp2ATI) + + .p2align 4,,15 + .globl GL_PREFIX(ColorFragmentOp3ATI) + .type GL_PREFIX(ColorFragmentOp3ATI), @function +GL_PREFIX(ColorFragmentOp3ATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6048(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6048(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6048(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6048(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorFragmentOp3ATI), .-GL_PREFIX(ColorFragmentOp3ATI) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteFragmentShaderATI) + .type GL_PREFIX(DeleteFragmentShaderATI), @function +GL_PREFIX(DeleteFragmentShaderATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6056(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6056(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6056(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6056(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteFragmentShaderATI), .-GL_PREFIX(DeleteFragmentShaderATI) + + .p2align 4,,15 + .globl GL_PREFIX(EndFragmentShaderATI) + .type GL_PREFIX(EndFragmentShaderATI), @function +GL_PREFIX(EndFragmentShaderATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6064(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 6064(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6064(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 6064(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EndFragmentShaderATI), .-GL_PREFIX(EndFragmentShaderATI) + + .p2align 4,,15 + .globl GL_PREFIX(GenFragmentShadersATI) + .type GL_PREFIX(GenFragmentShadersATI), @function +GL_PREFIX(GenFragmentShadersATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6072(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6072(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6072(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6072(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenFragmentShadersATI), .-GL_PREFIX(GenFragmentShadersATI) + + .p2align 4,,15 + .globl GL_PREFIX(PassTexCoordATI) + .type GL_PREFIX(PassTexCoordATI), @function +GL_PREFIX(PassTexCoordATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6080(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6080(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6080(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6080(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PassTexCoordATI), .-GL_PREFIX(PassTexCoordATI) + + .p2align 4,,15 + .globl GL_PREFIX(SampleMapATI) + .type GL_PREFIX(SampleMapATI), @function +GL_PREFIX(SampleMapATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6088(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6088(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6088(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6088(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SampleMapATI), .-GL_PREFIX(SampleMapATI) + + .p2align 4,,15 + .globl GL_PREFIX(SetFragmentShaderConstantATI) + .type GL_PREFIX(SetFragmentShaderConstantATI), @function +GL_PREFIX(SetFragmentShaderConstantATI): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6096(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6096(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6096(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6096(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(SetFragmentShaderConstantATI), .-GL_PREFIX(SetFragmentShaderConstantATI) + + .p2align 4,,15 + .globl GL_PREFIX(PointParameteriNV) + .type GL_PREFIX(PointParameteriNV), @function +GL_PREFIX(PointParameteriNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6104(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6104(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6104(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6104(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PointParameteriNV), .-GL_PREFIX(PointParameteriNV) + + .p2align 4,,15 + .globl GL_PREFIX(PointParameterivNV) + .type GL_PREFIX(PointParameterivNV), @function +GL_PREFIX(PointParameterivNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6112(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6112(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6112(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6112(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(PointParameterivNV), .-GL_PREFIX(PointParameterivNV) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_765) + .type GL_PREFIX(_dispatch_stub_765), @function + HIDDEN(GL_PREFIX(_dispatch_stub_765)) +GL_PREFIX(_dispatch_stub_765): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6120(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6120(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6120(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6120(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_765), .-GL_PREFIX(_dispatch_stub_765) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_766) + .type GL_PREFIX(_dispatch_stub_766), @function + HIDDEN(GL_PREFIX(_dispatch_stub_766)) +GL_PREFIX(_dispatch_stub_766): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6128(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6128(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6128(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6128(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_766), .-GL_PREFIX(_dispatch_stub_766) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_767) + .type GL_PREFIX(_dispatch_stub_767), @function + HIDDEN(GL_PREFIX(_dispatch_stub_767)) +GL_PREFIX(_dispatch_stub_767): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6136(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6136(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6136(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6136(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_767), .-GL_PREFIX(_dispatch_stub_767) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_768) + .type GL_PREFIX(_dispatch_stub_768), @function + HIDDEN(GL_PREFIX(_dispatch_stub_768)) +GL_PREFIX(_dispatch_stub_768): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6144(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6144(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6144(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6144(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_768), .-GL_PREFIX(_dispatch_stub_768) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_769) + .type GL_PREFIX(_dispatch_stub_769), @function + HIDDEN(GL_PREFIX(_dispatch_stub_769)) +GL_PREFIX(_dispatch_stub_769): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6152(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6152(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6152(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6152(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_769), .-GL_PREFIX(_dispatch_stub_769) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramNamedParameterdvNV) + .type GL_PREFIX(GetProgramNamedParameterdvNV), @function +GL_PREFIX(GetProgramNamedParameterdvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6160(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6160(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6160(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6160(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramNamedParameterdvNV), .-GL_PREFIX(GetProgramNamedParameterdvNV) + + .p2align 4,,15 + .globl GL_PREFIX(GetProgramNamedParameterfvNV) + .type GL_PREFIX(GetProgramNamedParameterfvNV), @function +GL_PREFIX(GetProgramNamedParameterfvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6168(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6168(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6168(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6168(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetProgramNamedParameterfvNV), .-GL_PREFIX(GetProgramNamedParameterfvNV) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramNamedParameter4dNV) + .type GL_PREFIX(ProgramNamedParameter4dNV), @function +GL_PREFIX(ProgramNamedParameter4dNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6176(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %xmm0, 24(%rsp) + movq %xmm1, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + call _x86_64_get_dispatch@PLT + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %xmm1 + movq 24(%rsp), %xmm0 + movq 16(%rsp), %rdx + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 6176(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6176(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %xmm0, 24(%rsp) + movq %xmm1, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + call _glapi_get_dispatch + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %xmm1 + movq 24(%rsp), %xmm0 + movq 16(%rsp), %rdx + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 6176(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramNamedParameter4dNV), .-GL_PREFIX(ProgramNamedParameter4dNV) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramNamedParameter4dvNV) + .type GL_PREFIX(ProgramNamedParameter4dvNV), @function +GL_PREFIX(ProgramNamedParameter4dvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramNamedParameter4dvNV), .-GL_PREFIX(ProgramNamedParameter4dvNV) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramNamedParameter4fNV) + .type GL_PREFIX(ProgramNamedParameter4fNV), @function +GL_PREFIX(ProgramNamedParameter4fNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %xmm0, 24(%rsp) + movq %xmm1, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + call _x86_64_get_dispatch@PLT + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %xmm1 + movq 24(%rsp), %xmm0 + movq 16(%rsp), %rdx + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 6192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6192(%rax), %r11 + jmp *%r11 +1: + subq $56, %rsp + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %xmm0, 24(%rsp) + movq %xmm1, 32(%rsp) + movq %xmm2, 40(%rsp) + movq %xmm3, 48(%rsp) + call _glapi_get_dispatch + movq 48(%rsp), %xmm3 + movq 40(%rsp), %xmm2 + movq 32(%rsp), %xmm1 + movq 24(%rsp), %xmm0 + movq 16(%rsp), %rdx + movq 8(%rsp), %rsi + movq (%rsp), %rdi + addq $56, %rsp + movq 6192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramNamedParameter4fNV), .-GL_PREFIX(ProgramNamedParameter4fNV) + + .p2align 4,,15 + .globl GL_PREFIX(ProgramNamedParameter4fvNV) + .type GL_PREFIX(ProgramNamedParameter4fvNV), @function +GL_PREFIX(ProgramNamedParameter4fvNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6200(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6200(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6200(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6200(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProgramNamedParameter4fvNV), .-GL_PREFIX(ProgramNamedParameter4fvNV) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_776) + .type GL_PREFIX(_dispatch_stub_776), @function + HIDDEN(GL_PREFIX(_dispatch_stub_776)) +GL_PREFIX(_dispatch_stub_776): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6208(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6208(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6208(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6208(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_776), .-GL_PREFIX(_dispatch_stub_776) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_777) + .type GL_PREFIX(_dispatch_stub_777), @function + HIDDEN(GL_PREFIX(_dispatch_stub_777)) +GL_PREFIX(_dispatch_stub_777): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6216(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6216(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6216(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6216(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_777), .-GL_PREFIX(_dispatch_stub_777) + + .p2align 4,,15 + .globl GL_PREFIX(BindFramebufferEXT) + .type GL_PREFIX(BindFramebufferEXT), @function +GL_PREFIX(BindFramebufferEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6224(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6224(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6224(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6224(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindFramebufferEXT), .-GL_PREFIX(BindFramebufferEXT) + + .p2align 4,,15 + .globl GL_PREFIX(BindRenderbufferEXT) + .type GL_PREFIX(BindRenderbufferEXT), @function +GL_PREFIX(BindRenderbufferEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6232(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6232(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6232(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6232(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindRenderbufferEXT), .-GL_PREFIX(BindRenderbufferEXT) + + .p2align 4,,15 + .globl GL_PREFIX(CheckFramebufferStatusEXT) + .type GL_PREFIX(CheckFramebufferStatusEXT), @function +GL_PREFIX(CheckFramebufferStatusEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6240(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6240(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6240(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6240(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(CheckFramebufferStatusEXT), .-GL_PREFIX(CheckFramebufferStatusEXT) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteFramebuffersEXT) + .type GL_PREFIX(DeleteFramebuffersEXT), @function +GL_PREFIX(DeleteFramebuffersEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6248(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6248(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6248(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6248(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteFramebuffersEXT), .-GL_PREFIX(DeleteFramebuffersEXT) + + .p2align 4,,15 + .globl GL_PREFIX(DeleteRenderbuffersEXT) + .type GL_PREFIX(DeleteRenderbuffersEXT), @function +GL_PREFIX(DeleteRenderbuffersEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6256(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6256(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6256(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6256(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DeleteRenderbuffersEXT), .-GL_PREFIX(DeleteRenderbuffersEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FramebufferRenderbufferEXT) + .type GL_PREFIX(FramebufferRenderbufferEXT), @function +GL_PREFIX(FramebufferRenderbufferEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6264(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6264(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6264(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6264(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FramebufferRenderbufferEXT), .-GL_PREFIX(FramebufferRenderbufferEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FramebufferTexture1DEXT) + .type GL_PREFIX(FramebufferTexture1DEXT), @function +GL_PREFIX(FramebufferTexture1DEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6272(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6272(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6272(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6272(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FramebufferTexture1DEXT), .-GL_PREFIX(FramebufferTexture1DEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FramebufferTexture2DEXT) + .type GL_PREFIX(FramebufferTexture2DEXT), @function +GL_PREFIX(FramebufferTexture2DEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6280(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6280(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6280(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6280(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FramebufferTexture2DEXT), .-GL_PREFIX(FramebufferTexture2DEXT) + + .p2align 4,,15 + .globl GL_PREFIX(FramebufferTexture3DEXT) + .type GL_PREFIX(FramebufferTexture3DEXT), @function +GL_PREFIX(FramebufferTexture3DEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6288(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6288(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6288(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6288(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FramebufferTexture3DEXT), .-GL_PREFIX(FramebufferTexture3DEXT) + + .p2align 4,,15 + .globl GL_PREFIX(GenFramebuffersEXT) + .type GL_PREFIX(GenFramebuffersEXT), @function +GL_PREFIX(GenFramebuffersEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6296(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6296(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6296(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6296(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenFramebuffersEXT), .-GL_PREFIX(GenFramebuffersEXT) + + .p2align 4,,15 + .globl GL_PREFIX(GenRenderbuffersEXT) + .type GL_PREFIX(GenRenderbuffersEXT), @function +GL_PREFIX(GenRenderbuffersEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6304(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6304(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6304(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6304(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenRenderbuffersEXT), .-GL_PREFIX(GenRenderbuffersEXT) + + .p2align 4,,15 + .globl GL_PREFIX(GenerateMipmapEXT) + .type GL_PREFIX(GenerateMipmapEXT), @function +GL_PREFIX(GenerateMipmapEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6312(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6312(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6312(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6312(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GenerateMipmapEXT), .-GL_PREFIX(GenerateMipmapEXT) + + .p2align 4,,15 + .globl GL_PREFIX(GetFramebufferAttachmentParameterivEXT) + .type GL_PREFIX(GetFramebufferAttachmentParameterivEXT), @function +GL_PREFIX(GetFramebufferAttachmentParameterivEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6320(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6320(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6320(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6320(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetFramebufferAttachmentParameterivEXT), .-GL_PREFIX(GetFramebufferAttachmentParameterivEXT) + + .p2align 4,,15 + .globl GL_PREFIX(GetRenderbufferParameterivEXT) + .type GL_PREFIX(GetRenderbufferParameterivEXT), @function +GL_PREFIX(GetRenderbufferParameterivEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6328(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6328(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6328(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6328(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetRenderbufferParameterivEXT), .-GL_PREFIX(GetRenderbufferParameterivEXT) + + .p2align 4,,15 + .globl GL_PREFIX(IsFramebufferEXT) + .type GL_PREFIX(IsFramebufferEXT), @function +GL_PREFIX(IsFramebufferEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6336(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6336(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6336(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6336(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsFramebufferEXT), .-GL_PREFIX(IsFramebufferEXT) + + .p2align 4,,15 + .globl GL_PREFIX(IsRenderbufferEXT) + .type GL_PREFIX(IsRenderbufferEXT), @function +GL_PREFIX(IsRenderbufferEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6344(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6344(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6344(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6344(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsRenderbufferEXT), .-GL_PREFIX(IsRenderbufferEXT) + + .p2align 4,,15 + .globl GL_PREFIX(RenderbufferStorageEXT) + .type GL_PREFIX(RenderbufferStorageEXT), @function +GL_PREFIX(RenderbufferStorageEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6352(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6352(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6352(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6352(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(RenderbufferStorageEXT), .-GL_PREFIX(RenderbufferStorageEXT) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_795) + .type GL_PREFIX(_dispatch_stub_795), @function + HIDDEN(GL_PREFIX(_dispatch_stub_795)) +GL_PREFIX(_dispatch_stub_795): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6360(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6360(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6360(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6360(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_795), .-GL_PREFIX(_dispatch_stub_795) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_796) + .type GL_PREFIX(_dispatch_stub_796), @function + HIDDEN(GL_PREFIX(_dispatch_stub_796)) +GL_PREFIX(_dispatch_stub_796): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6368(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6368(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6368(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6368(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_796), .-GL_PREFIX(_dispatch_stub_796) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_797) + .type GL_PREFIX(_dispatch_stub_797), @function + HIDDEN(GL_PREFIX(_dispatch_stub_797)) +GL_PREFIX(_dispatch_stub_797): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6376(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6376(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6376(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6376(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_797), .-GL_PREFIX(_dispatch_stub_797) + + .p2align 4,,15 + .globl GL_PREFIX(FramebufferTextureLayerEXT) + .type GL_PREFIX(FramebufferTextureLayerEXT), @function +GL_PREFIX(FramebufferTextureLayerEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6384(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6384(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6384(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6384(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(FramebufferTextureLayerEXT), .-GL_PREFIX(FramebufferTextureLayerEXT) + + .p2align 4,,15 + .globl GL_PREFIX(ColorMaskIndexedEXT) + .type GL_PREFIX(ColorMaskIndexedEXT), @function +GL_PREFIX(ColorMaskIndexedEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6392(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6392(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6392(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6392(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ColorMaskIndexedEXT), .-GL_PREFIX(ColorMaskIndexedEXT) + + .p2align 4,,15 + .globl GL_PREFIX(DisableIndexedEXT) + .type GL_PREFIX(DisableIndexedEXT), @function +GL_PREFIX(DisableIndexedEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6400(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6400(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6400(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6400(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(DisableIndexedEXT), .-GL_PREFIX(DisableIndexedEXT) + + .p2align 4,,15 + .globl GL_PREFIX(EnableIndexedEXT) + .type GL_PREFIX(EnableIndexedEXT), @function +GL_PREFIX(EnableIndexedEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6408(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6408(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6408(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6408(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EnableIndexedEXT), .-GL_PREFIX(EnableIndexedEXT) + + .p2align 4,,15 + .globl GL_PREFIX(GetBooleanIndexedvEXT) + .type GL_PREFIX(GetBooleanIndexedvEXT), @function +GL_PREFIX(GetBooleanIndexedvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6416(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6416(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6416(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6416(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetBooleanIndexedvEXT), .-GL_PREFIX(GetBooleanIndexedvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(GetIntegerIndexedvEXT) + .type GL_PREFIX(GetIntegerIndexedvEXT), @function +GL_PREFIX(GetIntegerIndexedvEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6424(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6424(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6424(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6424(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetIntegerIndexedvEXT), .-GL_PREFIX(GetIntegerIndexedvEXT) + + .p2align 4,,15 + .globl GL_PREFIX(IsEnabledIndexedEXT) + .type GL_PREFIX(IsEnabledIndexedEXT), @function +GL_PREFIX(IsEnabledIndexedEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6432(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6432(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6432(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6432(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(IsEnabledIndexedEXT), .-GL_PREFIX(IsEnabledIndexedEXT) + + .p2align 4,,15 + .globl GL_PREFIX(BeginConditionalRenderNV) + .type GL_PREFIX(BeginConditionalRenderNV), @function +GL_PREFIX(BeginConditionalRenderNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6440(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6440(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6440(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6440(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BeginConditionalRenderNV), .-GL_PREFIX(BeginConditionalRenderNV) + + .p2align 4,,15 + .globl GL_PREFIX(EndConditionalRenderNV) + .type GL_PREFIX(EndConditionalRenderNV), @function +GL_PREFIX(EndConditionalRenderNV): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6448(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 6448(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6448(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 6448(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EndConditionalRenderNV), .-GL_PREFIX(EndConditionalRenderNV) + + .p2align 4,,15 + .globl GL_PREFIX(BeginTransformFeedbackEXT) + .type GL_PREFIX(BeginTransformFeedbackEXT), @function +GL_PREFIX(BeginTransformFeedbackEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6456(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6456(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6456(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6456(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BeginTransformFeedbackEXT), .-GL_PREFIX(BeginTransformFeedbackEXT) + + .p2align 4,,15 + .globl GL_PREFIX(BindBufferBaseEXT) + .type GL_PREFIX(BindBufferBaseEXT), @function +GL_PREFIX(BindBufferBaseEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6464(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6464(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6464(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6464(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindBufferBaseEXT), .-GL_PREFIX(BindBufferBaseEXT) + + .p2align 4,,15 + .globl GL_PREFIX(BindBufferOffsetEXT) + .type GL_PREFIX(BindBufferOffsetEXT), @function +GL_PREFIX(BindBufferOffsetEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6472(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6472(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6472(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6472(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindBufferOffsetEXT), .-GL_PREFIX(BindBufferOffsetEXT) + + .p2align 4,,15 + .globl GL_PREFIX(BindBufferRangeEXT) + .type GL_PREFIX(BindBufferRangeEXT), @function +GL_PREFIX(BindBufferRangeEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6480(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _x86_64_get_dispatch@PLT + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6480(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6480(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + call _glapi_get_dispatch + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6480(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(BindBufferRangeEXT), .-GL_PREFIX(BindBufferRangeEXT) + + .p2align 4,,15 + .globl GL_PREFIX(EndTransformFeedbackEXT) + .type GL_PREFIX(EndTransformFeedbackEXT), @function +GL_PREFIX(EndTransformFeedbackEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6488(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + movq 6488(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6488(%rax), %r11 + jmp *%r11 +1: + pushq %rbp + call _glapi_get_dispatch + popq %rbp + movq 6488(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EndTransformFeedbackEXT), .-GL_PREFIX(EndTransformFeedbackEXT) + + .p2align 4,,15 + .globl GL_PREFIX(GetTransformFeedbackVaryingEXT) + .type GL_PREFIX(GetTransformFeedbackVaryingEXT), @function +GL_PREFIX(GetTransformFeedbackVaryingEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6496(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6496(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6496(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %r8 + pushq %r9 + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %r9 + popq %r8 + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6496(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetTransformFeedbackVaryingEXT), .-GL_PREFIX(GetTransformFeedbackVaryingEXT) + + .p2align 4,,15 + .globl GL_PREFIX(TransformFeedbackVaryingsEXT) + .type GL_PREFIX(TransformFeedbackVaryingsEXT), @function +GL_PREFIX(TransformFeedbackVaryingsEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6504(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6504(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6504(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6504(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(TransformFeedbackVaryingsEXT), .-GL_PREFIX(TransformFeedbackVaryingsEXT) + + .p2align 4,,15 + .globl GL_PREFIX(ProvokingVertexEXT) + .type GL_PREFIX(ProvokingVertexEXT), @function +GL_PREFIX(ProvokingVertexEXT): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6512(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + call _x86_64_get_dispatch@PLT + popq %rdi + movq 6512(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6512(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + call _glapi_get_dispatch + popq %rdi + movq 6512(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ProvokingVertexEXT), .-GL_PREFIX(ProvokingVertexEXT) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_815) + .type GL_PREFIX(_dispatch_stub_815), @function + HIDDEN(GL_PREFIX(_dispatch_stub_815)) +GL_PREFIX(_dispatch_stub_815): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6520(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6520(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6520(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6520(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_815), .-GL_PREFIX(_dispatch_stub_815) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_816) + .type GL_PREFIX(_dispatch_stub_816), @function + HIDDEN(GL_PREFIX(_dispatch_stub_816)) +GL_PREFIX(_dispatch_stub_816): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6528(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6528(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6528(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6528(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_816), .-GL_PREFIX(_dispatch_stub_816) + + .p2align 4,,15 + .globl GL_PREFIX(GetObjectParameterivAPPLE) + .type GL_PREFIX(GetObjectParameterivAPPLE), @function +GL_PREFIX(GetObjectParameterivAPPLE): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6536(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6536(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6536(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6536(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(GetObjectParameterivAPPLE), .-GL_PREFIX(GetObjectParameterivAPPLE) + + .p2align 4,,15 + .globl GL_PREFIX(ObjectPurgeableAPPLE) + .type GL_PREFIX(ObjectPurgeableAPPLE), @function +GL_PREFIX(ObjectPurgeableAPPLE): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6544(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6544(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6544(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6544(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ObjectPurgeableAPPLE), .-GL_PREFIX(ObjectPurgeableAPPLE) + + .p2align 4,,15 + .globl GL_PREFIX(ObjectUnpurgeableAPPLE) + .type GL_PREFIX(ObjectUnpurgeableAPPLE), @function +GL_PREFIX(ObjectUnpurgeableAPPLE): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6552(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6552(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6552(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6552(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(ObjectUnpurgeableAPPLE), .-GL_PREFIX(ObjectUnpurgeableAPPLE) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_820) + .type GL_PREFIX(_dispatch_stub_820), @function + HIDDEN(GL_PREFIX(_dispatch_stub_820)) +GL_PREFIX(_dispatch_stub_820): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6560(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6560(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6560(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6560(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_820), .-GL_PREFIX(_dispatch_stub_820) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_821) + .type GL_PREFIX(_dispatch_stub_821), @function + HIDDEN(GL_PREFIX(_dispatch_stub_821)) +GL_PREFIX(_dispatch_stub_821): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6568(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6568(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6568(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6568(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_821), .-GL_PREFIX(_dispatch_stub_821) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_822) + .type GL_PREFIX(_dispatch_stub_822), @function + HIDDEN(GL_PREFIX(_dispatch_stub_822)) +GL_PREFIX(_dispatch_stub_822): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6576(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6576(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6576(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + pushq %rcx + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rcx + popq %rdx + popq %rsi + popq %rdi + movq 6576(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_822), .-GL_PREFIX(_dispatch_stub_822) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_823) + .type GL_PREFIX(_dispatch_stub_823), @function + HIDDEN(GL_PREFIX(_dispatch_stub_823)) +GL_PREFIX(_dispatch_stub_823): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6584(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6584(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6584(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6584(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_823), .-GL_PREFIX(_dispatch_stub_823) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_824) + .type GL_PREFIX(_dispatch_stub_824), @function + HIDDEN(GL_PREFIX(_dispatch_stub_824)) +GL_PREFIX(_dispatch_stub_824): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6592(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6592(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6592(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6592(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_824), .-GL_PREFIX(_dispatch_stub_824) + + .p2align 4,,15 + .globl GL_PREFIX(EGLImageTargetRenderbufferStorageOES) + .type GL_PREFIX(EGLImageTargetRenderbufferStorageOES), @function +GL_PREFIX(EGLImageTargetRenderbufferStorageOES): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6600(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6600(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6600(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6600(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EGLImageTargetRenderbufferStorageOES), .-GL_PREFIX(EGLImageTargetRenderbufferStorageOES) + + .p2align 4,,15 + .globl GL_PREFIX(EGLImageTargetTexture2DOES) + .type GL_PREFIX(EGLImageTargetTexture2DOES), @function +GL_PREFIX(EGLImageTargetTexture2DOES): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6608(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rbp + call _x86_64_get_dispatch@PLT + popq %rbp + popq %rsi + popq %rdi + movq 6608(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6608(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rbp + call _glapi_get_dispatch + popq %rbp + popq %rsi + popq %rdi + movq 6608(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(EGLImageTargetTexture2DOES), .-GL_PREFIX(EGLImageTargetTexture2DOES) + + .globl GL_PREFIX(ArrayElementEXT) ; .set GL_PREFIX(ArrayElementEXT), GL_PREFIX(ArrayElement) + .globl GL_PREFIX(BindTextureEXT) ; .set GL_PREFIX(BindTextureEXT), GL_PREFIX(BindTexture) + .globl GL_PREFIX(DrawArraysEXT) ; .set GL_PREFIX(DrawArraysEXT), GL_PREFIX(DrawArrays) +#ifndef GLX_INDIRECT_RENDERING + .globl GL_PREFIX(AreTexturesResidentEXT) ; .set GL_PREFIX(AreTexturesResidentEXT), GL_PREFIX(AreTexturesResident) +#endif + .globl GL_PREFIX(CopyTexImage1DEXT) ; .set GL_PREFIX(CopyTexImage1DEXT), GL_PREFIX(CopyTexImage1D) + .globl GL_PREFIX(CopyTexImage2DEXT) ; .set GL_PREFIX(CopyTexImage2DEXT), GL_PREFIX(CopyTexImage2D) + .globl GL_PREFIX(CopyTexSubImage1DEXT) ; .set GL_PREFIX(CopyTexSubImage1DEXT), GL_PREFIX(CopyTexSubImage1D) + .globl GL_PREFIX(CopyTexSubImage2DEXT) ; .set GL_PREFIX(CopyTexSubImage2DEXT), GL_PREFIX(CopyTexSubImage2D) +#ifndef GLX_INDIRECT_RENDERING + .globl GL_PREFIX(DeleteTexturesEXT) ; .set GL_PREFIX(DeleteTexturesEXT), GL_PREFIX(DeleteTextures) +#endif +#ifndef GLX_INDIRECT_RENDERING + .globl GL_PREFIX(GenTexturesEXT) ; .set GL_PREFIX(GenTexturesEXT), GL_PREFIX(GenTextures) +#endif + .globl GL_PREFIX(GetPointervEXT) ; .set GL_PREFIX(GetPointervEXT), GL_PREFIX(GetPointerv) +#ifndef GLX_INDIRECT_RENDERING + .globl GL_PREFIX(IsTextureEXT) ; .set GL_PREFIX(IsTextureEXT), GL_PREFIX(IsTexture) +#endif + .globl GL_PREFIX(PrioritizeTexturesEXT) ; .set GL_PREFIX(PrioritizeTexturesEXT), GL_PREFIX(PrioritizeTextures) + .globl GL_PREFIX(TexSubImage1DEXT) ; .set GL_PREFIX(TexSubImage1DEXT), GL_PREFIX(TexSubImage1D) + .globl GL_PREFIX(TexSubImage2DEXT) ; .set GL_PREFIX(TexSubImage2DEXT), GL_PREFIX(TexSubImage2D) + .globl GL_PREFIX(BlendColorEXT) ; .set GL_PREFIX(BlendColorEXT), GL_PREFIX(BlendColor) + .globl GL_PREFIX(BlendEquationEXT) ; .set GL_PREFIX(BlendEquationEXT), GL_PREFIX(BlendEquation) + .globl GL_PREFIX(DrawRangeElementsEXT) ; .set GL_PREFIX(DrawRangeElementsEXT), GL_PREFIX(DrawRangeElements) + .globl GL_PREFIX(ColorTableEXT) ; .set GL_PREFIX(ColorTableEXT), GL_PREFIX(ColorTable) +#ifndef GLX_INDIRECT_RENDERING + .globl GL_PREFIX(GetColorTableEXT) ; .set GL_PREFIX(GetColorTableEXT), GL_PREFIX(GetColorTable) +#endif +#ifndef GLX_INDIRECT_RENDERING + .globl GL_PREFIX(GetColorTableParameterfvEXT) ; .set GL_PREFIX(GetColorTableParameterfvEXT), GL_PREFIX(GetColorTableParameterfv) +#endif +#ifndef GLX_INDIRECT_RENDERING + .globl GL_PREFIX(GetColorTableParameterivEXT) ; .set GL_PREFIX(GetColorTableParameterivEXT), GL_PREFIX(GetColorTableParameteriv) +#endif + .globl GL_PREFIX(TexImage3DEXT) ; .set GL_PREFIX(TexImage3DEXT), GL_PREFIX(TexImage3D) + .globl GL_PREFIX(TexSubImage3DEXT) ; .set GL_PREFIX(TexSubImage3DEXT), GL_PREFIX(TexSubImage3D) + .globl GL_PREFIX(CopyTexSubImage3DEXT) ; .set GL_PREFIX(CopyTexSubImage3DEXT), GL_PREFIX(CopyTexSubImage3D) + .globl GL_PREFIX(ActiveTexture) ; .set GL_PREFIX(ActiveTexture), GL_PREFIX(ActiveTextureARB) + .globl GL_PREFIX(ClientActiveTexture) ; .set GL_PREFIX(ClientActiveTexture), GL_PREFIX(ClientActiveTextureARB) + .globl GL_PREFIX(MultiTexCoord1d) ; .set GL_PREFIX(MultiTexCoord1d), GL_PREFIX(MultiTexCoord1dARB) + .globl GL_PREFIX(MultiTexCoord1dv) ; .set GL_PREFIX(MultiTexCoord1dv), GL_PREFIX(MultiTexCoord1dvARB) + .globl GL_PREFIX(MultiTexCoord1f) ; .set GL_PREFIX(MultiTexCoord1f), GL_PREFIX(MultiTexCoord1fARB) + .globl GL_PREFIX(MultiTexCoord1fv) ; .set GL_PREFIX(MultiTexCoord1fv), GL_PREFIX(MultiTexCoord1fvARB) + .globl GL_PREFIX(MultiTexCoord1i) ; .set GL_PREFIX(MultiTexCoord1i), GL_PREFIX(MultiTexCoord1iARB) + .globl GL_PREFIX(MultiTexCoord1iv) ; .set GL_PREFIX(MultiTexCoord1iv), GL_PREFIX(MultiTexCoord1ivARB) + .globl GL_PREFIX(MultiTexCoord1s) ; .set GL_PREFIX(MultiTexCoord1s), GL_PREFIX(MultiTexCoord1sARB) + .globl GL_PREFIX(MultiTexCoord1sv) ; .set GL_PREFIX(MultiTexCoord1sv), GL_PREFIX(MultiTexCoord1svARB) + .globl GL_PREFIX(MultiTexCoord2d) ; .set GL_PREFIX(MultiTexCoord2d), GL_PREFIX(MultiTexCoord2dARB) + .globl GL_PREFIX(MultiTexCoord2dv) ; .set GL_PREFIX(MultiTexCoord2dv), GL_PREFIX(MultiTexCoord2dvARB) + .globl GL_PREFIX(MultiTexCoord2f) ; .set GL_PREFIX(MultiTexCoord2f), GL_PREFIX(MultiTexCoord2fARB) + .globl GL_PREFIX(MultiTexCoord2fv) ; .set GL_PREFIX(MultiTexCoord2fv), GL_PREFIX(MultiTexCoord2fvARB) + .globl GL_PREFIX(MultiTexCoord2i) ; .set GL_PREFIX(MultiTexCoord2i), GL_PREFIX(MultiTexCoord2iARB) + .globl GL_PREFIX(MultiTexCoord2iv) ; .set GL_PREFIX(MultiTexCoord2iv), GL_PREFIX(MultiTexCoord2ivARB) + .globl GL_PREFIX(MultiTexCoord2s) ; .set GL_PREFIX(MultiTexCoord2s), GL_PREFIX(MultiTexCoord2sARB) + .globl GL_PREFIX(MultiTexCoord2sv) ; .set GL_PREFIX(MultiTexCoord2sv), GL_PREFIX(MultiTexCoord2svARB) + .globl GL_PREFIX(MultiTexCoord3d) ; .set GL_PREFIX(MultiTexCoord3d), GL_PREFIX(MultiTexCoord3dARB) + .globl GL_PREFIX(MultiTexCoord3dv) ; .set GL_PREFIX(MultiTexCoord3dv), GL_PREFIX(MultiTexCoord3dvARB) + .globl GL_PREFIX(MultiTexCoord3f) ; .set GL_PREFIX(MultiTexCoord3f), GL_PREFIX(MultiTexCoord3fARB) + .globl GL_PREFIX(MultiTexCoord3fv) ; .set GL_PREFIX(MultiTexCoord3fv), GL_PREFIX(MultiTexCoord3fvARB) + .globl GL_PREFIX(MultiTexCoord3i) ; .set GL_PREFIX(MultiTexCoord3i), GL_PREFIX(MultiTexCoord3iARB) + .globl GL_PREFIX(MultiTexCoord3iv) ; .set GL_PREFIX(MultiTexCoord3iv), GL_PREFIX(MultiTexCoord3ivARB) + .globl GL_PREFIX(MultiTexCoord3s) ; .set GL_PREFIX(MultiTexCoord3s), GL_PREFIX(MultiTexCoord3sARB) + .globl GL_PREFIX(MultiTexCoord3sv) ; .set GL_PREFIX(MultiTexCoord3sv), GL_PREFIX(MultiTexCoord3svARB) + .globl GL_PREFIX(MultiTexCoord4d) ; .set GL_PREFIX(MultiTexCoord4d), GL_PREFIX(MultiTexCoord4dARB) + .globl GL_PREFIX(MultiTexCoord4dv) ; .set GL_PREFIX(MultiTexCoord4dv), GL_PREFIX(MultiTexCoord4dvARB) + .globl GL_PREFIX(MultiTexCoord4f) ; .set GL_PREFIX(MultiTexCoord4f), GL_PREFIX(MultiTexCoord4fARB) + .globl GL_PREFIX(MultiTexCoord4fv) ; .set GL_PREFIX(MultiTexCoord4fv), GL_PREFIX(MultiTexCoord4fvARB) + .globl GL_PREFIX(MultiTexCoord4i) ; .set GL_PREFIX(MultiTexCoord4i), GL_PREFIX(MultiTexCoord4iARB) + .globl GL_PREFIX(MultiTexCoord4iv) ; .set GL_PREFIX(MultiTexCoord4iv), GL_PREFIX(MultiTexCoord4ivARB) + .globl GL_PREFIX(MultiTexCoord4s) ; .set GL_PREFIX(MultiTexCoord4s), GL_PREFIX(MultiTexCoord4sARB) + .globl GL_PREFIX(MultiTexCoord4sv) ; .set GL_PREFIX(MultiTexCoord4sv), GL_PREFIX(MultiTexCoord4svARB) + .globl GL_PREFIX(DrawArraysInstancedARB) ; .set GL_PREFIX(DrawArraysInstancedARB), GL_PREFIX(DrawArraysInstanced) + .globl GL_PREFIX(DrawArraysInstancedEXT) ; .set GL_PREFIX(DrawArraysInstancedEXT), GL_PREFIX(DrawArraysInstanced) + .globl GL_PREFIX(DrawElementsInstancedARB) ; .set GL_PREFIX(DrawElementsInstancedARB), GL_PREFIX(DrawElementsInstanced) + .globl GL_PREFIX(DrawElementsInstancedEXT) ; .set GL_PREFIX(DrawElementsInstancedEXT), GL_PREFIX(DrawElementsInstanced) + .globl GL_PREFIX(LoadTransposeMatrixd) ; .set GL_PREFIX(LoadTransposeMatrixd), GL_PREFIX(LoadTransposeMatrixdARB) + .globl GL_PREFIX(LoadTransposeMatrixf) ; .set GL_PREFIX(LoadTransposeMatrixf), GL_PREFIX(LoadTransposeMatrixfARB) + .globl GL_PREFIX(MultTransposeMatrixd) ; .set GL_PREFIX(MultTransposeMatrixd), GL_PREFIX(MultTransposeMatrixdARB) + .globl GL_PREFIX(MultTransposeMatrixf) ; .set GL_PREFIX(MultTransposeMatrixf), GL_PREFIX(MultTransposeMatrixfARB) + .globl GL_PREFIX(SampleCoverage) ; .set GL_PREFIX(SampleCoverage), GL_PREFIX(SampleCoverageARB) + .globl GL_PREFIX(CompressedTexImage1D) ; .set GL_PREFIX(CompressedTexImage1D), GL_PREFIX(CompressedTexImage1DARB) + .globl GL_PREFIX(CompressedTexImage2D) ; .set GL_PREFIX(CompressedTexImage2D), GL_PREFIX(CompressedTexImage2DARB) + .globl GL_PREFIX(CompressedTexImage3D) ; .set GL_PREFIX(CompressedTexImage3D), GL_PREFIX(CompressedTexImage3DARB) + .globl GL_PREFIX(CompressedTexSubImage1D) ; .set GL_PREFIX(CompressedTexSubImage1D), GL_PREFIX(CompressedTexSubImage1DARB) + .globl GL_PREFIX(CompressedTexSubImage2D) ; .set GL_PREFIX(CompressedTexSubImage2D), GL_PREFIX(CompressedTexSubImage2DARB) + .globl GL_PREFIX(CompressedTexSubImage3D) ; .set GL_PREFIX(CompressedTexSubImage3D), GL_PREFIX(CompressedTexSubImage3DARB) + .globl GL_PREFIX(GetCompressedTexImage) ; .set GL_PREFIX(GetCompressedTexImage), GL_PREFIX(GetCompressedTexImageARB) + .globl GL_PREFIX(DisableVertexAttribArray) ; .set GL_PREFIX(DisableVertexAttribArray), GL_PREFIX(DisableVertexAttribArrayARB) + .globl GL_PREFIX(EnableVertexAttribArray) ; .set GL_PREFIX(EnableVertexAttribArray), GL_PREFIX(EnableVertexAttribArrayARB) + .globl GL_PREFIX(GetVertexAttribdv) ; .set GL_PREFIX(GetVertexAttribdv), GL_PREFIX(GetVertexAttribdvARB) + .globl GL_PREFIX(GetVertexAttribfv) ; .set GL_PREFIX(GetVertexAttribfv), GL_PREFIX(GetVertexAttribfvARB) + .globl GL_PREFIX(GetVertexAttribiv) ; .set GL_PREFIX(GetVertexAttribiv), GL_PREFIX(GetVertexAttribivARB) + .globl GL_PREFIX(ProgramParameter4dNV) ; .set GL_PREFIX(ProgramParameter4dNV), GL_PREFIX(ProgramEnvParameter4dARB) + .globl GL_PREFIX(ProgramParameter4dvNV) ; .set GL_PREFIX(ProgramParameter4dvNV), GL_PREFIX(ProgramEnvParameter4dvARB) + .globl GL_PREFIX(ProgramParameter4fNV) ; .set GL_PREFIX(ProgramParameter4fNV), GL_PREFIX(ProgramEnvParameter4fARB) + .globl GL_PREFIX(ProgramParameter4fvNV) ; .set GL_PREFIX(ProgramParameter4fvNV), GL_PREFIX(ProgramEnvParameter4fvARB) + .globl GL_PREFIX(VertexAttrib1d) ; .set GL_PREFIX(VertexAttrib1d), GL_PREFIX(VertexAttrib1dARB) + .globl GL_PREFIX(VertexAttrib1dv) ; .set GL_PREFIX(VertexAttrib1dv), GL_PREFIX(VertexAttrib1dvARB) + .globl GL_PREFIX(VertexAttrib1f) ; .set GL_PREFIX(VertexAttrib1f), GL_PREFIX(VertexAttrib1fARB) + .globl GL_PREFIX(VertexAttrib1fv) ; .set GL_PREFIX(VertexAttrib1fv), GL_PREFIX(VertexAttrib1fvARB) + .globl GL_PREFIX(VertexAttrib1s) ; .set GL_PREFIX(VertexAttrib1s), GL_PREFIX(VertexAttrib1sARB) + .globl GL_PREFIX(VertexAttrib1sv) ; .set GL_PREFIX(VertexAttrib1sv), GL_PREFIX(VertexAttrib1svARB) + .globl GL_PREFIX(VertexAttrib2d) ; .set GL_PREFIX(VertexAttrib2d), GL_PREFIX(VertexAttrib2dARB) + .globl GL_PREFIX(VertexAttrib2dv) ; .set GL_PREFIX(VertexAttrib2dv), GL_PREFIX(VertexAttrib2dvARB) + .globl GL_PREFIX(VertexAttrib2f) ; .set GL_PREFIX(VertexAttrib2f), GL_PREFIX(VertexAttrib2fARB) + .globl GL_PREFIX(VertexAttrib2fv) ; .set GL_PREFIX(VertexAttrib2fv), GL_PREFIX(VertexAttrib2fvARB) + .globl GL_PREFIX(VertexAttrib2s) ; .set GL_PREFIX(VertexAttrib2s), GL_PREFIX(VertexAttrib2sARB) + .globl GL_PREFIX(VertexAttrib2sv) ; .set GL_PREFIX(VertexAttrib2sv), GL_PREFIX(VertexAttrib2svARB) + .globl GL_PREFIX(VertexAttrib3d) ; .set GL_PREFIX(VertexAttrib3d), GL_PREFIX(VertexAttrib3dARB) + .globl GL_PREFIX(VertexAttrib3dv) ; .set GL_PREFIX(VertexAttrib3dv), GL_PREFIX(VertexAttrib3dvARB) + .globl GL_PREFIX(VertexAttrib3f) ; .set GL_PREFIX(VertexAttrib3f), GL_PREFIX(VertexAttrib3fARB) + .globl GL_PREFIX(VertexAttrib3fv) ; .set GL_PREFIX(VertexAttrib3fv), GL_PREFIX(VertexAttrib3fvARB) + .globl GL_PREFIX(VertexAttrib3s) ; .set GL_PREFIX(VertexAttrib3s), GL_PREFIX(VertexAttrib3sARB) + .globl GL_PREFIX(VertexAttrib3sv) ; .set GL_PREFIX(VertexAttrib3sv), GL_PREFIX(VertexAttrib3svARB) + .globl GL_PREFIX(VertexAttrib4Nbv) ; .set GL_PREFIX(VertexAttrib4Nbv), GL_PREFIX(VertexAttrib4NbvARB) + .globl GL_PREFIX(VertexAttrib4Niv) ; .set GL_PREFIX(VertexAttrib4Niv), GL_PREFIX(VertexAttrib4NivARB) + .globl GL_PREFIX(VertexAttrib4Nsv) ; .set GL_PREFIX(VertexAttrib4Nsv), GL_PREFIX(VertexAttrib4NsvARB) + .globl GL_PREFIX(VertexAttrib4Nub) ; .set GL_PREFIX(VertexAttrib4Nub), GL_PREFIX(VertexAttrib4NubARB) + .globl GL_PREFIX(VertexAttrib4Nubv) ; .set GL_PREFIX(VertexAttrib4Nubv), GL_PREFIX(VertexAttrib4NubvARB) + .globl GL_PREFIX(VertexAttrib4Nuiv) ; .set GL_PREFIX(VertexAttrib4Nuiv), GL_PREFIX(VertexAttrib4NuivARB) + .globl GL_PREFIX(VertexAttrib4Nusv) ; .set GL_PREFIX(VertexAttrib4Nusv), GL_PREFIX(VertexAttrib4NusvARB) + .globl GL_PREFIX(VertexAttrib4bv) ; .set GL_PREFIX(VertexAttrib4bv), GL_PREFIX(VertexAttrib4bvARB) + .globl GL_PREFIX(VertexAttrib4d) ; .set GL_PREFIX(VertexAttrib4d), GL_PREFIX(VertexAttrib4dARB) + .globl GL_PREFIX(VertexAttrib4dv) ; .set GL_PREFIX(VertexAttrib4dv), GL_PREFIX(VertexAttrib4dvARB) + .globl GL_PREFIX(VertexAttrib4f) ; .set GL_PREFIX(VertexAttrib4f), GL_PREFIX(VertexAttrib4fARB) + .globl GL_PREFIX(VertexAttrib4fv) ; .set GL_PREFIX(VertexAttrib4fv), GL_PREFIX(VertexAttrib4fvARB) + .globl GL_PREFIX(VertexAttrib4iv) ; .set GL_PREFIX(VertexAttrib4iv), GL_PREFIX(VertexAttrib4ivARB) + .globl GL_PREFIX(VertexAttrib4s) ; .set GL_PREFIX(VertexAttrib4s), GL_PREFIX(VertexAttrib4sARB) + .globl GL_PREFIX(VertexAttrib4sv) ; .set GL_PREFIX(VertexAttrib4sv), GL_PREFIX(VertexAttrib4svARB) + .globl GL_PREFIX(VertexAttrib4ubv) ; .set GL_PREFIX(VertexAttrib4ubv), GL_PREFIX(VertexAttrib4ubvARB) + .globl GL_PREFIX(VertexAttrib4uiv) ; .set GL_PREFIX(VertexAttrib4uiv), GL_PREFIX(VertexAttrib4uivARB) + .globl GL_PREFIX(VertexAttrib4usv) ; .set GL_PREFIX(VertexAttrib4usv), GL_PREFIX(VertexAttrib4usvARB) + .globl GL_PREFIX(VertexAttribPointer) ; .set GL_PREFIX(VertexAttribPointer), GL_PREFIX(VertexAttribPointerARB) + .globl GL_PREFIX(BindBuffer) ; .set GL_PREFIX(BindBuffer), GL_PREFIX(BindBufferARB) + .globl GL_PREFIX(BufferData) ; .set GL_PREFIX(BufferData), GL_PREFIX(BufferDataARB) + .globl GL_PREFIX(BufferSubData) ; .set GL_PREFIX(BufferSubData), GL_PREFIX(BufferSubDataARB) + .globl GL_PREFIX(DeleteBuffers) ; .set GL_PREFIX(DeleteBuffers), GL_PREFIX(DeleteBuffersARB) + .globl GL_PREFIX(GenBuffers) ; .set GL_PREFIX(GenBuffers), GL_PREFIX(GenBuffersARB) + .globl GL_PREFIX(GetBufferParameteriv) ; .set GL_PREFIX(GetBufferParameteriv), GL_PREFIX(GetBufferParameterivARB) + .globl GL_PREFIX(GetBufferPointerv) ; .set GL_PREFIX(GetBufferPointerv), GL_PREFIX(GetBufferPointervARB) + .globl GL_PREFIX(GetBufferSubData) ; .set GL_PREFIX(GetBufferSubData), GL_PREFIX(GetBufferSubDataARB) + .globl GL_PREFIX(IsBuffer) ; .set GL_PREFIX(IsBuffer), GL_PREFIX(IsBufferARB) + .globl GL_PREFIX(MapBuffer) ; .set GL_PREFIX(MapBuffer), GL_PREFIX(MapBufferARB) + .globl GL_PREFIX(UnmapBuffer) ; .set GL_PREFIX(UnmapBuffer), GL_PREFIX(UnmapBufferARB) + .globl GL_PREFIX(BeginQuery) ; .set GL_PREFIX(BeginQuery), GL_PREFIX(BeginQueryARB) + .globl GL_PREFIX(DeleteQueries) ; .set GL_PREFIX(DeleteQueries), GL_PREFIX(DeleteQueriesARB) + .globl GL_PREFIX(EndQuery) ; .set GL_PREFIX(EndQuery), GL_PREFIX(EndQueryARB) + .globl GL_PREFIX(GenQueries) ; .set GL_PREFIX(GenQueries), GL_PREFIX(GenQueriesARB) + .globl GL_PREFIX(GetQueryObjectiv) ; .set GL_PREFIX(GetQueryObjectiv), GL_PREFIX(GetQueryObjectivARB) + .globl GL_PREFIX(GetQueryObjectuiv) ; .set GL_PREFIX(GetQueryObjectuiv), GL_PREFIX(GetQueryObjectuivARB) + .globl GL_PREFIX(GetQueryiv) ; .set GL_PREFIX(GetQueryiv), GL_PREFIX(GetQueryivARB) + .globl GL_PREFIX(IsQuery) ; .set GL_PREFIX(IsQuery), GL_PREFIX(IsQueryARB) + .globl GL_PREFIX(CompileShader) ; .set GL_PREFIX(CompileShader), GL_PREFIX(CompileShaderARB) + .globl GL_PREFIX(GetActiveUniform) ; .set GL_PREFIX(GetActiveUniform), GL_PREFIX(GetActiveUniformARB) + .globl GL_PREFIX(GetShaderSource) ; .set GL_PREFIX(GetShaderSource), GL_PREFIX(GetShaderSourceARB) + .globl GL_PREFIX(GetUniformLocation) ; .set GL_PREFIX(GetUniformLocation), GL_PREFIX(GetUniformLocationARB) + .globl GL_PREFIX(GetUniformfv) ; .set GL_PREFIX(GetUniformfv), GL_PREFIX(GetUniformfvARB) + .globl GL_PREFIX(GetUniformiv) ; .set GL_PREFIX(GetUniformiv), GL_PREFIX(GetUniformivARB) + .globl GL_PREFIX(LinkProgram) ; .set GL_PREFIX(LinkProgram), GL_PREFIX(LinkProgramARB) + .globl GL_PREFIX(ShaderSource) ; .set GL_PREFIX(ShaderSource), GL_PREFIX(ShaderSourceARB) + .globl GL_PREFIX(Uniform1f) ; .set GL_PREFIX(Uniform1f), GL_PREFIX(Uniform1fARB) + .globl GL_PREFIX(Uniform1fv) ; .set GL_PREFIX(Uniform1fv), GL_PREFIX(Uniform1fvARB) + .globl GL_PREFIX(Uniform1i) ; .set GL_PREFIX(Uniform1i), GL_PREFIX(Uniform1iARB) + .globl GL_PREFIX(Uniform1iv) ; .set GL_PREFIX(Uniform1iv), GL_PREFIX(Uniform1ivARB) + .globl GL_PREFIX(Uniform2f) ; .set GL_PREFIX(Uniform2f), GL_PREFIX(Uniform2fARB) + .globl GL_PREFIX(Uniform2fv) ; .set GL_PREFIX(Uniform2fv), GL_PREFIX(Uniform2fvARB) + .globl GL_PREFIX(Uniform2i) ; .set GL_PREFIX(Uniform2i), GL_PREFIX(Uniform2iARB) + .globl GL_PREFIX(Uniform2iv) ; .set GL_PREFIX(Uniform2iv), GL_PREFIX(Uniform2ivARB) + .globl GL_PREFIX(Uniform3f) ; .set GL_PREFIX(Uniform3f), GL_PREFIX(Uniform3fARB) + .globl GL_PREFIX(Uniform3fv) ; .set GL_PREFIX(Uniform3fv), GL_PREFIX(Uniform3fvARB) + .globl GL_PREFIX(Uniform3i) ; .set GL_PREFIX(Uniform3i), GL_PREFIX(Uniform3iARB) + .globl GL_PREFIX(Uniform3iv) ; .set GL_PREFIX(Uniform3iv), GL_PREFIX(Uniform3ivARB) + .globl GL_PREFIX(Uniform4f) ; .set GL_PREFIX(Uniform4f), GL_PREFIX(Uniform4fARB) + .globl GL_PREFIX(Uniform4fv) ; .set GL_PREFIX(Uniform4fv), GL_PREFIX(Uniform4fvARB) + .globl GL_PREFIX(Uniform4i) ; .set GL_PREFIX(Uniform4i), GL_PREFIX(Uniform4iARB) + .globl GL_PREFIX(Uniform4iv) ; .set GL_PREFIX(Uniform4iv), GL_PREFIX(Uniform4ivARB) + .globl GL_PREFIX(UniformMatrix2fv) ; .set GL_PREFIX(UniformMatrix2fv), GL_PREFIX(UniformMatrix2fvARB) + .globl GL_PREFIX(UniformMatrix3fv) ; .set GL_PREFIX(UniformMatrix3fv), GL_PREFIX(UniformMatrix3fvARB) + .globl GL_PREFIX(UniformMatrix4fv) ; .set GL_PREFIX(UniformMatrix4fv), GL_PREFIX(UniformMatrix4fvARB) + .globl GL_PREFIX(UseProgram) ; .set GL_PREFIX(UseProgram), GL_PREFIX(UseProgramObjectARB) + .globl GL_PREFIX(ValidateProgram) ; .set GL_PREFIX(ValidateProgram), GL_PREFIX(ValidateProgramARB) + .globl GL_PREFIX(BindAttribLocation) ; .set GL_PREFIX(BindAttribLocation), GL_PREFIX(BindAttribLocationARB) + .globl GL_PREFIX(GetActiveAttrib) ; .set GL_PREFIX(GetActiveAttrib), GL_PREFIX(GetActiveAttribARB) + .globl GL_PREFIX(GetAttribLocation) ; .set GL_PREFIX(GetAttribLocation), GL_PREFIX(GetAttribLocationARB) + .globl GL_PREFIX(DrawBuffers) ; .set GL_PREFIX(DrawBuffers), GL_PREFIX(DrawBuffersARB) + .globl GL_PREFIX(DrawBuffersATI) ; .set GL_PREFIX(DrawBuffersATI), GL_PREFIX(DrawBuffersARB) + .globl GL_PREFIX(RenderbufferStorageMultisampleEXT) ; .set GL_PREFIX(RenderbufferStorageMultisampleEXT), GL_PREFIX(RenderbufferStorageMultisample) + .globl GL_PREFIX(PointParameterf) ; .set GL_PREFIX(PointParameterf), GL_PREFIX(PointParameterfEXT) + .globl GL_PREFIX(PointParameterfARB) ; .set GL_PREFIX(PointParameterfARB), GL_PREFIX(PointParameterfEXT) + .globl GL_PREFIX(PointParameterfv) ; .set GL_PREFIX(PointParameterfv), GL_PREFIX(PointParameterfvEXT) + .globl GL_PREFIX(PointParameterfvARB) ; .set GL_PREFIX(PointParameterfvARB), GL_PREFIX(PointParameterfvEXT) + .globl GL_PREFIX(SecondaryColor3b) ; .set GL_PREFIX(SecondaryColor3b), GL_PREFIX(SecondaryColor3bEXT) + .globl GL_PREFIX(SecondaryColor3bv) ; .set GL_PREFIX(SecondaryColor3bv), GL_PREFIX(SecondaryColor3bvEXT) + .globl GL_PREFIX(SecondaryColor3d) ; .set GL_PREFIX(SecondaryColor3d), GL_PREFIX(SecondaryColor3dEXT) + .globl GL_PREFIX(SecondaryColor3dv) ; .set GL_PREFIX(SecondaryColor3dv), GL_PREFIX(SecondaryColor3dvEXT) + .globl GL_PREFIX(SecondaryColor3f) ; .set GL_PREFIX(SecondaryColor3f), GL_PREFIX(SecondaryColor3fEXT) + .globl GL_PREFIX(SecondaryColor3fv) ; .set GL_PREFIX(SecondaryColor3fv), GL_PREFIX(SecondaryColor3fvEXT) + .globl GL_PREFIX(SecondaryColor3i) ; .set GL_PREFIX(SecondaryColor3i), GL_PREFIX(SecondaryColor3iEXT) + .globl GL_PREFIX(SecondaryColor3iv) ; .set GL_PREFIX(SecondaryColor3iv), GL_PREFIX(SecondaryColor3ivEXT) + .globl GL_PREFIX(SecondaryColor3s) ; .set GL_PREFIX(SecondaryColor3s), GL_PREFIX(SecondaryColor3sEXT) + .globl GL_PREFIX(SecondaryColor3sv) ; .set GL_PREFIX(SecondaryColor3sv), GL_PREFIX(SecondaryColor3svEXT) + .globl GL_PREFIX(SecondaryColor3ub) ; .set GL_PREFIX(SecondaryColor3ub), GL_PREFIX(SecondaryColor3ubEXT) + .globl GL_PREFIX(SecondaryColor3ubv) ; .set GL_PREFIX(SecondaryColor3ubv), GL_PREFIX(SecondaryColor3ubvEXT) + .globl GL_PREFIX(SecondaryColor3ui) ; .set GL_PREFIX(SecondaryColor3ui), GL_PREFIX(SecondaryColor3uiEXT) + .globl GL_PREFIX(SecondaryColor3uiv) ; .set GL_PREFIX(SecondaryColor3uiv), GL_PREFIX(SecondaryColor3uivEXT) + .globl GL_PREFIX(SecondaryColor3us) ; .set GL_PREFIX(SecondaryColor3us), GL_PREFIX(SecondaryColor3usEXT) + .globl GL_PREFIX(SecondaryColor3usv) ; .set GL_PREFIX(SecondaryColor3usv), GL_PREFIX(SecondaryColor3usvEXT) + .globl GL_PREFIX(SecondaryColorPointer) ; .set GL_PREFIX(SecondaryColorPointer), GL_PREFIX(SecondaryColorPointerEXT) + .globl GL_PREFIX(MultiDrawArrays) ; .set GL_PREFIX(MultiDrawArrays), GL_PREFIX(MultiDrawArraysEXT) + .globl GL_PREFIX(MultiDrawElements) ; .set GL_PREFIX(MultiDrawElements), GL_PREFIX(MultiDrawElementsEXT) + .globl GL_PREFIX(FogCoordPointer) ; .set GL_PREFIX(FogCoordPointer), GL_PREFIX(FogCoordPointerEXT) + .globl GL_PREFIX(FogCoordd) ; .set GL_PREFIX(FogCoordd), GL_PREFIX(FogCoorddEXT) + .globl GL_PREFIX(FogCoorddv) ; .set GL_PREFIX(FogCoorddv), GL_PREFIX(FogCoorddvEXT) + .globl GL_PREFIX(FogCoordf) ; .set GL_PREFIX(FogCoordf), GL_PREFIX(FogCoordfEXT) + .globl GL_PREFIX(FogCoordfv) ; .set GL_PREFIX(FogCoordfv), GL_PREFIX(FogCoordfvEXT) + .globl GL_PREFIX(BlendFuncSeparate) ; .set GL_PREFIX(BlendFuncSeparate), GL_PREFIX(BlendFuncSeparateEXT) + .globl GL_PREFIX(WindowPos2d) ; .set GL_PREFIX(WindowPos2d), GL_PREFIX(WindowPos2dMESA) + .globl GL_PREFIX(WindowPos2dARB) ; .set GL_PREFIX(WindowPos2dARB), GL_PREFIX(WindowPos2dMESA) + .globl GL_PREFIX(WindowPos2dv) ; .set GL_PREFIX(WindowPos2dv), GL_PREFIX(WindowPos2dvMESA) + .globl GL_PREFIX(WindowPos2dvARB) ; .set GL_PREFIX(WindowPos2dvARB), GL_PREFIX(WindowPos2dvMESA) + .globl GL_PREFIX(WindowPos2f) ; .set GL_PREFIX(WindowPos2f), GL_PREFIX(WindowPos2fMESA) + .globl GL_PREFIX(WindowPos2fARB) ; .set GL_PREFIX(WindowPos2fARB), GL_PREFIX(WindowPos2fMESA) + .globl GL_PREFIX(WindowPos2fv) ; .set GL_PREFIX(WindowPos2fv), GL_PREFIX(WindowPos2fvMESA) + .globl GL_PREFIX(WindowPos2fvARB) ; .set GL_PREFIX(WindowPos2fvARB), GL_PREFIX(WindowPos2fvMESA) + .globl GL_PREFIX(WindowPos2i) ; .set GL_PREFIX(WindowPos2i), GL_PREFIX(WindowPos2iMESA) + .globl GL_PREFIX(WindowPos2iARB) ; .set GL_PREFIX(WindowPos2iARB), GL_PREFIX(WindowPos2iMESA) + .globl GL_PREFIX(WindowPos2iv) ; .set GL_PREFIX(WindowPos2iv), GL_PREFIX(WindowPos2ivMESA) + .globl GL_PREFIX(WindowPos2ivARB) ; .set GL_PREFIX(WindowPos2ivARB), GL_PREFIX(WindowPos2ivMESA) + .globl GL_PREFIX(WindowPos2s) ; .set GL_PREFIX(WindowPos2s), GL_PREFIX(WindowPos2sMESA) + .globl GL_PREFIX(WindowPos2sARB) ; .set GL_PREFIX(WindowPos2sARB), GL_PREFIX(WindowPos2sMESA) + .globl GL_PREFIX(WindowPos2sv) ; .set GL_PREFIX(WindowPos2sv), GL_PREFIX(WindowPos2svMESA) + .globl GL_PREFIX(WindowPos2svARB) ; .set GL_PREFIX(WindowPos2svARB), GL_PREFIX(WindowPos2svMESA) + .globl GL_PREFIX(WindowPos3d) ; .set GL_PREFIX(WindowPos3d), GL_PREFIX(WindowPos3dMESA) + .globl GL_PREFIX(WindowPos3dARB) ; .set GL_PREFIX(WindowPos3dARB), GL_PREFIX(WindowPos3dMESA) + .globl GL_PREFIX(WindowPos3dv) ; .set GL_PREFIX(WindowPos3dv), GL_PREFIX(WindowPos3dvMESA) + .globl GL_PREFIX(WindowPos3dvARB) ; .set GL_PREFIX(WindowPos3dvARB), GL_PREFIX(WindowPos3dvMESA) + .globl GL_PREFIX(WindowPos3f) ; .set GL_PREFIX(WindowPos3f), GL_PREFIX(WindowPos3fMESA) + .globl GL_PREFIX(WindowPos3fARB) ; .set GL_PREFIX(WindowPos3fARB), GL_PREFIX(WindowPos3fMESA) + .globl GL_PREFIX(WindowPos3fv) ; .set GL_PREFIX(WindowPos3fv), GL_PREFIX(WindowPos3fvMESA) + .globl GL_PREFIX(WindowPos3fvARB) ; .set GL_PREFIX(WindowPos3fvARB), GL_PREFIX(WindowPos3fvMESA) + .globl GL_PREFIX(WindowPos3i) ; .set GL_PREFIX(WindowPos3i), GL_PREFIX(WindowPos3iMESA) + .globl GL_PREFIX(WindowPos3iARB) ; .set GL_PREFIX(WindowPos3iARB), GL_PREFIX(WindowPos3iMESA) + .globl GL_PREFIX(WindowPos3iv) ; .set GL_PREFIX(WindowPos3iv), GL_PREFIX(WindowPos3ivMESA) + .globl GL_PREFIX(WindowPos3ivARB) ; .set GL_PREFIX(WindowPos3ivARB), GL_PREFIX(WindowPos3ivMESA) + .globl GL_PREFIX(WindowPos3s) ; .set GL_PREFIX(WindowPos3s), GL_PREFIX(WindowPos3sMESA) + .globl GL_PREFIX(WindowPos3sARB) ; .set GL_PREFIX(WindowPos3sARB), GL_PREFIX(WindowPos3sMESA) + .globl GL_PREFIX(WindowPos3sv) ; .set GL_PREFIX(WindowPos3sv), GL_PREFIX(WindowPos3svMESA) + .globl GL_PREFIX(WindowPos3svARB) ; .set GL_PREFIX(WindowPos3svARB), GL_PREFIX(WindowPos3svMESA) + .globl GL_PREFIX(BindProgramARB) ; .set GL_PREFIX(BindProgramARB), GL_PREFIX(BindProgramNV) + .globl GL_PREFIX(DeleteProgramsARB) ; .set GL_PREFIX(DeleteProgramsARB), GL_PREFIX(DeleteProgramsNV) + .globl GL_PREFIX(GenProgramsARB) ; .set GL_PREFIX(GenProgramsARB), GL_PREFIX(GenProgramsNV) + .globl GL_PREFIX(GetVertexAttribPointerv) ; .set GL_PREFIX(GetVertexAttribPointerv), GL_PREFIX(GetVertexAttribPointervNV) + .globl GL_PREFIX(GetVertexAttribPointervARB) ; .set GL_PREFIX(GetVertexAttribPointervARB), GL_PREFIX(GetVertexAttribPointervNV) + .globl GL_PREFIX(IsProgramARB) ; .set GL_PREFIX(IsProgramARB), GL_PREFIX(IsProgramNV) + .globl GL_PREFIX(PointParameteri) ; .set GL_PREFIX(PointParameteri), GL_PREFIX(PointParameteriNV) + .globl GL_PREFIX(PointParameteriv) ; .set GL_PREFIX(PointParameteriv), GL_PREFIX(PointParameterivNV) + .globl GL_PREFIX(DeleteVertexArrays) ; .set GL_PREFIX(DeleteVertexArrays), GL_PREFIX(_dispatch_stub_767) + .globl GL_PREFIX(IsVertexArray) ; .set GL_PREFIX(IsVertexArray), GL_PREFIX(_dispatch_stub_769) + .globl GL_PREFIX(BlendEquationSeparate) ; .set GL_PREFIX(BlendEquationSeparate), GL_PREFIX(_dispatch_stub_777) + .globl GL_PREFIX(BindFramebuffer) ; .set GL_PREFIX(BindFramebuffer), GL_PREFIX(BindFramebufferEXT) + .globl GL_PREFIX(BindRenderbuffer) ; .set GL_PREFIX(BindRenderbuffer), GL_PREFIX(BindRenderbufferEXT) + .globl GL_PREFIX(CheckFramebufferStatus) ; .set GL_PREFIX(CheckFramebufferStatus), GL_PREFIX(CheckFramebufferStatusEXT) + .globl GL_PREFIX(DeleteFramebuffers) ; .set GL_PREFIX(DeleteFramebuffers), GL_PREFIX(DeleteFramebuffersEXT) + .globl GL_PREFIX(DeleteRenderbuffers) ; .set GL_PREFIX(DeleteRenderbuffers), GL_PREFIX(DeleteRenderbuffersEXT) + .globl GL_PREFIX(FramebufferRenderbuffer) ; .set GL_PREFIX(FramebufferRenderbuffer), GL_PREFIX(FramebufferRenderbufferEXT) + .globl GL_PREFIX(FramebufferTexture1D) ; .set GL_PREFIX(FramebufferTexture1D), GL_PREFIX(FramebufferTexture1DEXT) + .globl GL_PREFIX(FramebufferTexture2D) ; .set GL_PREFIX(FramebufferTexture2D), GL_PREFIX(FramebufferTexture2DEXT) + .globl GL_PREFIX(FramebufferTexture3D) ; .set GL_PREFIX(FramebufferTexture3D), GL_PREFIX(FramebufferTexture3DEXT) + .globl GL_PREFIX(GenFramebuffers) ; .set GL_PREFIX(GenFramebuffers), GL_PREFIX(GenFramebuffersEXT) + .globl GL_PREFIX(GenRenderbuffers) ; .set GL_PREFIX(GenRenderbuffers), GL_PREFIX(GenRenderbuffersEXT) + .globl GL_PREFIX(GenerateMipmap) ; .set GL_PREFIX(GenerateMipmap), GL_PREFIX(GenerateMipmapEXT) + .globl GL_PREFIX(GetFramebufferAttachmentParameteriv) ; .set GL_PREFIX(GetFramebufferAttachmentParameteriv), GL_PREFIX(GetFramebufferAttachmentParameterivEXT) + .globl GL_PREFIX(GetRenderbufferParameteriv) ; .set GL_PREFIX(GetRenderbufferParameteriv), GL_PREFIX(GetRenderbufferParameterivEXT) + .globl GL_PREFIX(IsFramebuffer) ; .set GL_PREFIX(IsFramebuffer), GL_PREFIX(IsFramebufferEXT) + .globl GL_PREFIX(IsRenderbuffer) ; .set GL_PREFIX(IsRenderbuffer), GL_PREFIX(IsRenderbufferEXT) + .globl GL_PREFIX(RenderbufferStorage) ; .set GL_PREFIX(RenderbufferStorage), GL_PREFIX(RenderbufferStorageEXT) + .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_795) + .globl GL_PREFIX(FramebufferTextureLayer) ; .set GL_PREFIX(FramebufferTextureLayer), GL_PREFIX(FramebufferTextureLayerEXT) + .globl GL_PREFIX(BeginTransformFeedback) ; .set GL_PREFIX(BeginTransformFeedback), GL_PREFIX(BeginTransformFeedbackEXT) + .globl GL_PREFIX(BindBufferBase) ; .set GL_PREFIX(BindBufferBase), GL_PREFIX(BindBufferBaseEXT) + .globl GL_PREFIX(BindBufferRange) ; .set GL_PREFIX(BindBufferRange), GL_PREFIX(BindBufferRangeEXT) + .globl GL_PREFIX(EndTransformFeedback) ; .set GL_PREFIX(EndTransformFeedback), GL_PREFIX(EndTransformFeedbackEXT) + .globl GL_PREFIX(GetTransformFeedbackVarying) ; .set GL_PREFIX(GetTransformFeedbackVarying), GL_PREFIX(GetTransformFeedbackVaryingEXT) + .globl GL_PREFIX(TransformFeedbackVaryings) ; .set GL_PREFIX(TransformFeedbackVaryings), GL_PREFIX(TransformFeedbackVaryingsEXT) + .globl GL_PREFIX(ProvokingVertex) ; .set GL_PREFIX(ProvokingVertex), GL_PREFIX(ProvokingVertexEXT) + +#if defined(GLX_USE_TLS) && defined(__linux__) + .section ".note.ABI-tag", "a" + .p2align 2 + .long 1f - 0f /* name length */ + .long 3f - 2f /* data length */ + .long 1 /* note length */ +0: .asciz "GNU" /* vendor name */ +1: .p2align 2 +2: .long 0 /* note data: the ABI tag */ + .long 2,4,20 /* Minimum kernel version w/TLS */ +3: .p2align 2 /* pad out section */ +#endif /* GLX_USE_TLS */ + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mapi/glapi/glapi_x86.S b/mesalib/src/mapi/glapi/glapi_x86.S new file mode 100644 index 000000000..8b764c993 --- /dev/null +++ b/mesalib/src/mapi/glapi/glapi_x86.S @@ -0,0 +1,1326 @@ +/* DO NOT EDIT - This file generated automatically by gl_x86_asm.py (from Mesa) script */ + +/* + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * (C) Copyright IBM Corporation 2004, 2005 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL, IBM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "x86/assyntax.h" +#include "glapi/glapioffsets.h" + +#if defined(STDCALL_API) +# if defined(USE_MGL_NAMESPACE) +# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n2)) +# else +# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2)) +# endif +#else +# if defined(USE_MGL_NAMESPACE) +# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n)) +# define _glapi_Dispatch _mglapi_Dispatch +# else +# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n)) +# endif +#endif + +#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX)) + +#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) +#define GLOBL_FN(x) GLOBL x ; .type x, function +#else +#define GLOBL_FN(x) GLOBL x +#endif + +#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS) +# define THREADS +#endif + +#ifdef GLX_USE_TLS + +#ifdef GLX_X86_READONLY_TEXT +# define CTX_INSNS MOV_L(GS:(EAX), EAX) +#else +# define CTX_INSNS NOP /* Pad for init_glapi_relocs() */ +#endif + +# define GL_STUB(fn,off,fn_alt) \ +ALIGNTEXT16; \ +GLOBL_FN(GL_PREFIX(fn, fn_alt)); \ +GL_PREFIX(fn, fn_alt): \ + CALL(_x86_get_dispatch) ; \ + CTX_INSNS ; \ + JMP(GL_OFFSET(off)) + +#elif defined(PTHREADS) +# define GL_STUB(fn,off,fn_alt) \ +ALIGNTEXT16; \ +GLOBL_FN(GL_PREFIX(fn, fn_alt)); \ +GL_PREFIX(fn, fn_alt): \ + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ; \ + TEST_L(EAX, EAX) ; \ + JE(1f) ; \ + JMP(GL_OFFSET(off)) ; \ +1: CALL(_x86_get_dispatch) ; \ + JMP(GL_OFFSET(off)) +#elif defined(THREADS) +# define GL_STUB(fn,off,fn_alt) \ +ALIGNTEXT16; \ +GLOBL_FN(GL_PREFIX(fn, fn_alt)); \ +GL_PREFIX(fn, fn_alt): \ + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ; \ + TEST_L(EAX, EAX) ; \ + JE(1f) ; \ + JMP(GL_OFFSET(off)) ; \ +1: CALL(_glapi_get_dispatch) ; \ + JMP(GL_OFFSET(off)) +#else /* Non-threaded version. */ +# define GL_STUB(fn,off,fn_alt) \ +ALIGNTEXT16; \ +GLOBL_FN(GL_PREFIX(fn, fn_alt)); \ +GL_PREFIX(fn, fn_alt): \ + MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ; \ + JMP(GL_OFFSET(off)) +#endif + +#ifdef HAVE_ALIAS +# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt) \ + .globl GL_PREFIX(fn, fn_alt) ; \ + .set GL_PREFIX(fn, fn_alt), GL_PREFIX(alias, alias_alt) +#else +# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt) \ + GL_STUB(fn, off, fn_alt) +#endif + +SEG_TEXT + +#ifdef GLX_USE_TLS + + GLOBL GLNAME(_x86_get_dispatch) + HIDDEN(GLNAME(_x86_get_dispatch)) +ALIGNTEXT16 +GLNAME(_x86_get_dispatch): + call 1f +1: popl %eax + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax + movl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax + ret + +#elif defined(PTHREADS) +EXTERN GLNAME(_glapi_Dispatch) +EXTERN GLNAME(_gl_DispatchTSD) +EXTERN GLNAME(pthread_getspecific) + +ALIGNTEXT16 +GLNAME(_x86_get_dispatch): + SUB_L(CONST(24), ESP) + PUSH_L(GLNAME(_gl_DispatchTSD)) + CALL(GLNAME(pthread_getspecific)) + ADD_L(CONST(28), ESP) + RET +#elif defined(THREADS) +EXTERN GLNAME(_glapi_get_dispatch) +#endif + +#if defined( GLX_USE_TLS ) && !defined( GLX_X86_READONLY_TEXT ) + .section wtext, "awx", @progbits +#endif /* defined( GLX_USE_TLS ) */ + + ALIGNTEXT16 + GLOBL GLNAME(gl_dispatch_functions_start) + HIDDEN(GLNAME(gl_dispatch_functions_start)) +GLNAME(gl_dispatch_functions_start): + + GL_STUB(NewList, _gloffset_NewList, NewList@8) + GL_STUB(EndList, _gloffset_EndList, EndList@0) + GL_STUB(CallList, _gloffset_CallList, CallList@4) + GL_STUB(CallLists, _gloffset_CallLists, CallLists@12) + GL_STUB(DeleteLists, _gloffset_DeleteLists, DeleteLists@8) + GL_STUB(GenLists, _gloffset_GenLists, GenLists@4) + GL_STUB(ListBase, _gloffset_ListBase, ListBase@4) + GL_STUB(Begin, _gloffset_Begin, Begin@4) + GL_STUB(Bitmap, _gloffset_Bitmap, Bitmap@28) + GL_STUB(Color3b, _gloffset_Color3b, Color3b@12) + GL_STUB(Color3bv, _gloffset_Color3bv, Color3bv@4) + GL_STUB(Color3d, _gloffset_Color3d, Color3d@24) + GL_STUB(Color3dv, _gloffset_Color3dv, Color3dv@4) + GL_STUB(Color3f, _gloffset_Color3f, Color3f@12) + GL_STUB(Color3fv, _gloffset_Color3fv, Color3fv@4) + GL_STUB(Color3i, _gloffset_Color3i, Color3i@12) + GL_STUB(Color3iv, _gloffset_Color3iv, Color3iv@4) + GL_STUB(Color3s, _gloffset_Color3s, Color3s@12) + GL_STUB(Color3sv, _gloffset_Color3sv, Color3sv@4) + GL_STUB(Color3ub, _gloffset_Color3ub, Color3ub@12) + GL_STUB(Color3ubv, _gloffset_Color3ubv, Color3ubv@4) + GL_STUB(Color3ui, _gloffset_Color3ui, Color3ui@12) + GL_STUB(Color3uiv, _gloffset_Color3uiv, Color3uiv@4) + GL_STUB(Color3us, _gloffset_Color3us, Color3us@12) + GL_STUB(Color3usv, _gloffset_Color3usv, Color3usv@4) + GL_STUB(Color4b, _gloffset_Color4b, Color4b@16) + GL_STUB(Color4bv, _gloffset_Color4bv, Color4bv@4) + GL_STUB(Color4d, _gloffset_Color4d, Color4d@32) + GL_STUB(Color4dv, _gloffset_Color4dv, Color4dv@4) + GL_STUB(Color4f, _gloffset_Color4f, Color4f@16) + GL_STUB(Color4fv, _gloffset_Color4fv, Color4fv@4) + GL_STUB(Color4i, _gloffset_Color4i, Color4i@16) + GL_STUB(Color4iv, _gloffset_Color4iv, Color4iv@4) + GL_STUB(Color4s, _gloffset_Color4s, Color4s@16) + GL_STUB(Color4sv, _gloffset_Color4sv, Color4sv@4) + GL_STUB(Color4ub, _gloffset_Color4ub, Color4ub@16) + GL_STUB(Color4ubv, _gloffset_Color4ubv, Color4ubv@4) + GL_STUB(Color4ui, _gloffset_Color4ui, Color4ui@16) + GL_STUB(Color4uiv, _gloffset_Color4uiv, Color4uiv@4) + GL_STUB(Color4us, _gloffset_Color4us, Color4us@16) + GL_STUB(Color4usv, _gloffset_Color4usv, Color4usv@4) + GL_STUB(EdgeFlag, _gloffset_EdgeFlag, EdgeFlag@4) + GL_STUB(EdgeFlagv, _gloffset_EdgeFlagv, EdgeFlagv@4) + GL_STUB(End, _gloffset_End, End@0) + GL_STUB(Indexd, _gloffset_Indexd, Indexd@8) + GL_STUB(Indexdv, _gloffset_Indexdv, Indexdv@4) + GL_STUB(Indexf, _gloffset_Indexf, Indexf@4) + GL_STUB(Indexfv, _gloffset_Indexfv, Indexfv@4) + GL_STUB(Indexi, _gloffset_Indexi, Indexi@4) + GL_STUB(Indexiv, _gloffset_Indexiv, Indexiv@4) + GL_STUB(Indexs, _gloffset_Indexs, Indexs@4) + GL_STUB(Indexsv, _gloffset_Indexsv, Indexsv@4) + GL_STUB(Normal3b, _gloffset_Normal3b, Normal3b@12) + GL_STUB(Normal3bv, _gloffset_Normal3bv, Normal3bv@4) + GL_STUB(Normal3d, _gloffset_Normal3d, Normal3d@24) + GL_STUB(Normal3dv, _gloffset_Normal3dv, Normal3dv@4) + GL_STUB(Normal3f, _gloffset_Normal3f, Normal3f@12) + GL_STUB(Normal3fv, _gloffset_Normal3fv, Normal3fv@4) + GL_STUB(Normal3i, _gloffset_Normal3i, Normal3i@12) + GL_STUB(Normal3iv, _gloffset_Normal3iv, Normal3iv@4) + GL_STUB(Normal3s, _gloffset_Normal3s, Normal3s@12) + GL_STUB(Normal3sv, _gloffset_Normal3sv, Normal3sv@4) + GL_STUB(RasterPos2d, _gloffset_RasterPos2d, RasterPos2d@16) + GL_STUB(RasterPos2dv, _gloffset_RasterPos2dv, RasterPos2dv@4) + GL_STUB(RasterPos2f, _gloffset_RasterPos2f, RasterPos2f@8) + GL_STUB(RasterPos2fv, _gloffset_RasterPos2fv, RasterPos2fv@4) + GL_STUB(RasterPos2i, _gloffset_RasterPos2i, RasterPos2i@8) + GL_STUB(RasterPos2iv, _gloffset_RasterPos2iv, RasterPos2iv@4) + GL_STUB(RasterPos2s, _gloffset_RasterPos2s, RasterPos2s@8) + GL_STUB(RasterPos2sv, _gloffset_RasterPos2sv, RasterPos2sv@4) + GL_STUB(RasterPos3d, _gloffset_RasterPos3d, RasterPos3d@24) + GL_STUB(RasterPos3dv, _gloffset_RasterPos3dv, RasterPos3dv@4) + GL_STUB(RasterPos3f, _gloffset_RasterPos3f, RasterPos3f@12) + GL_STUB(RasterPos3fv, _gloffset_RasterPos3fv, RasterPos3fv@4) + GL_STUB(RasterPos3i, _gloffset_RasterPos3i, RasterPos3i@12) + GL_STUB(RasterPos3iv, _gloffset_RasterPos3iv, RasterPos3iv@4) + GL_STUB(RasterPos3s, _gloffset_RasterPos3s, RasterPos3s@12) + GL_STUB(RasterPos3sv, _gloffset_RasterPos3sv, RasterPos3sv@4) + GL_STUB(RasterPos4d, _gloffset_RasterPos4d, RasterPos4d@32) + GL_STUB(RasterPos4dv, _gloffset_RasterPos4dv, RasterPos4dv@4) + GL_STUB(RasterPos4f, _gloffset_RasterPos4f, RasterPos4f@16) + GL_STUB(RasterPos4fv, _gloffset_RasterPos4fv, RasterPos4fv@4) + GL_STUB(RasterPos4i, _gloffset_RasterPos4i, RasterPos4i@16) + GL_STUB(RasterPos4iv, _gloffset_RasterPos4iv, RasterPos4iv@4) + GL_STUB(RasterPos4s, _gloffset_RasterPos4s, RasterPos4s@16) + GL_STUB(RasterPos4sv, _gloffset_RasterPos4sv, RasterPos4sv@4) + GL_STUB(Rectd, _gloffset_Rectd, Rectd@32) + GL_STUB(Rectdv, _gloffset_Rectdv, Rectdv@8) + GL_STUB(Rectf, _gloffset_Rectf, Rectf@16) + GL_STUB(Rectfv, _gloffset_Rectfv, Rectfv@8) + GL_STUB(Recti, _gloffset_Recti, Recti@16) + GL_STUB(Rectiv, _gloffset_Rectiv, Rectiv@8) + GL_STUB(Rects, _gloffset_Rects, Rects@16) + GL_STUB(Rectsv, _gloffset_Rectsv, Rectsv@8) + GL_STUB(TexCoord1d, _gloffset_TexCoord1d, TexCoord1d@8) + GL_STUB(TexCoord1dv, _gloffset_TexCoord1dv, TexCoord1dv@4) + GL_STUB(TexCoord1f, _gloffset_TexCoord1f, TexCoord1f@4) + GL_STUB(TexCoord1fv, _gloffset_TexCoord1fv, TexCoord1fv@4) + GL_STUB(TexCoord1i, _gloffset_TexCoord1i, TexCoord1i@4) + GL_STUB(TexCoord1iv, _gloffset_TexCoord1iv, TexCoord1iv@4) + GL_STUB(TexCoord1s, _gloffset_TexCoord1s, TexCoord1s@4) + GL_STUB(TexCoord1sv, _gloffset_TexCoord1sv, TexCoord1sv@4) + GL_STUB(TexCoord2d, _gloffset_TexCoord2d, TexCoord2d@16) + GL_STUB(TexCoord2dv, _gloffset_TexCoord2dv, TexCoord2dv@4) + GL_STUB(TexCoord2f, _gloffset_TexCoord2f, TexCoord2f@8) + GL_STUB(TexCoord2fv, _gloffset_TexCoord2fv, TexCoord2fv@4) + GL_STUB(TexCoord2i, _gloffset_TexCoord2i, TexCoord2i@8) + GL_STUB(TexCoord2iv, _gloffset_TexCoord2iv, TexCoord2iv@4) + GL_STUB(TexCoord2s, _gloffset_TexCoord2s, TexCoord2s@8) + GL_STUB(TexCoord2sv, _gloffset_TexCoord2sv, TexCoord2sv@4) + GL_STUB(TexCoord3d, _gloffset_TexCoord3d, TexCoord3d@24) + GL_STUB(TexCoord3dv, _gloffset_TexCoord3dv, TexCoord3dv@4) + GL_STUB(TexCoord3f, _gloffset_TexCoord3f, TexCoord3f@12) + GL_STUB(TexCoord3fv, _gloffset_TexCoord3fv, TexCoord3fv@4) + GL_STUB(TexCoord3i, _gloffset_TexCoord3i, TexCoord3i@12) + GL_STUB(TexCoord3iv, _gloffset_TexCoord3iv, TexCoord3iv@4) + GL_STUB(TexCoord3s, _gloffset_TexCoord3s, TexCoord3s@12) + GL_STUB(TexCoord3sv, _gloffset_TexCoord3sv, TexCoord3sv@4) + GL_STUB(TexCoord4d, _gloffset_TexCoord4d, TexCoord4d@32) + GL_STUB(TexCoord4dv, _gloffset_TexCoord4dv, TexCoord4dv@4) + GL_STUB(TexCoord4f, _gloffset_TexCoord4f, TexCoord4f@16) + GL_STUB(TexCoord4fv, _gloffset_TexCoord4fv, TexCoord4fv@4) + GL_STUB(TexCoord4i, _gloffset_TexCoord4i, TexCoord4i@16) + GL_STUB(TexCoord4iv, _gloffset_TexCoord4iv, TexCoord4iv@4) + GL_STUB(TexCoord4s, _gloffset_TexCoord4s, TexCoord4s@16) + GL_STUB(TexCoord4sv, _gloffset_TexCoord4sv, TexCoord4sv@4) + GL_STUB(Vertex2d, _gloffset_Vertex2d, Vertex2d@16) + GL_STUB(Vertex2dv, _gloffset_Vertex2dv, Vertex2dv@4) + GL_STUB(Vertex2f, _gloffset_Vertex2f, Vertex2f@8) + GL_STUB(Vertex2fv, _gloffset_Vertex2fv, Vertex2fv@4) + GL_STUB(Vertex2i, _gloffset_Vertex2i, Vertex2i@8) + GL_STUB(Vertex2iv, _gloffset_Vertex2iv, Vertex2iv@4) + GL_STUB(Vertex2s, _gloffset_Vertex2s, Vertex2s@8) + GL_STUB(Vertex2sv, _gloffset_Vertex2sv, Vertex2sv@4) + GL_STUB(Vertex3d, _gloffset_Vertex3d, Vertex3d@24) + GL_STUB(Vertex3dv, _gloffset_Vertex3dv, Vertex3dv@4) + GL_STUB(Vertex3f, _gloffset_Vertex3f, Vertex3f@12) + GL_STUB(Vertex3fv, _gloffset_Vertex3fv, Vertex3fv@4) + GL_STUB(Vertex3i, _gloffset_Vertex3i, Vertex3i@12) + GL_STUB(Vertex3iv, _gloffset_Vertex3iv, Vertex3iv@4) + GL_STUB(Vertex3s, _gloffset_Vertex3s, Vertex3s@12) + GL_STUB(Vertex3sv, _gloffset_Vertex3sv, Vertex3sv@4) + GL_STUB(Vertex4d, _gloffset_Vertex4d, Vertex4d@32) + GL_STUB(Vertex4dv, _gloffset_Vertex4dv, Vertex4dv@4) + GL_STUB(Vertex4f, _gloffset_Vertex4f, Vertex4f@16) + GL_STUB(Vertex4fv, _gloffset_Vertex4fv, Vertex4fv@4) + GL_STUB(Vertex4i, _gloffset_Vertex4i, Vertex4i@16) + GL_STUB(Vertex4iv, _gloffset_Vertex4iv, Vertex4iv@4) + GL_STUB(Vertex4s, _gloffset_Vertex4s, Vertex4s@16) + GL_STUB(Vertex4sv, _gloffset_Vertex4sv, Vertex4sv@4) + GL_STUB(ClipPlane, _gloffset_ClipPlane, ClipPlane@8) + GL_STUB(ColorMaterial, _gloffset_ColorMaterial, ColorMaterial@8) + GL_STUB(CullFace, _gloffset_CullFace, CullFace@4) + GL_STUB(Fogf, _gloffset_Fogf, Fogf@8) + GL_STUB(Fogfv, _gloffset_Fogfv, Fogfv@8) + GL_STUB(Fogi, _gloffset_Fogi, Fogi@8) + GL_STUB(Fogiv, _gloffset_Fogiv, Fogiv@8) + GL_STUB(FrontFace, _gloffset_FrontFace, FrontFace@4) + GL_STUB(Hint, _gloffset_Hint, Hint@8) + GL_STUB(Lightf, _gloffset_Lightf, Lightf@12) + GL_STUB(Lightfv, _gloffset_Lightfv, Lightfv@12) + GL_STUB(Lighti, _gloffset_Lighti, Lighti@12) + GL_STUB(Lightiv, _gloffset_Lightiv, Lightiv@12) + GL_STUB(LightModelf, _gloffset_LightModelf, LightModelf@8) + GL_STUB(LightModelfv, _gloffset_LightModelfv, LightModelfv@8) + GL_STUB(LightModeli, _gloffset_LightModeli, LightModeli@8) + GL_STUB(LightModeliv, _gloffset_LightModeliv, LightModeliv@8) + GL_STUB(LineStipple, _gloffset_LineStipple, LineStipple@8) + GL_STUB(LineWidth, _gloffset_LineWidth, LineWidth@4) + GL_STUB(Materialf, _gloffset_Materialf, Materialf@12) + GL_STUB(Materialfv, _gloffset_Materialfv, Materialfv@12) + GL_STUB(Materiali, _gloffset_Materiali, Materiali@12) + GL_STUB(Materialiv, _gloffset_Materialiv, Materialiv@12) + GL_STUB(PointSize, _gloffset_PointSize, PointSize@4) + GL_STUB(PolygonMode, _gloffset_PolygonMode, PolygonMode@8) + GL_STUB(PolygonStipple, _gloffset_PolygonStipple, PolygonStipple@4) + GL_STUB(Scissor, _gloffset_Scissor, Scissor@16) + GL_STUB(ShadeModel, _gloffset_ShadeModel, ShadeModel@4) + GL_STUB(TexParameterf, _gloffset_TexParameterf, TexParameterf@12) + GL_STUB(TexParameterfv, _gloffset_TexParameterfv, TexParameterfv@12) + GL_STUB(TexParameteri, _gloffset_TexParameteri, TexParameteri@12) + GL_STUB(TexParameteriv, _gloffset_TexParameteriv, TexParameteriv@12) + GL_STUB(TexImage1D, _gloffset_TexImage1D, TexImage1D@32) + GL_STUB(TexImage2D, _gloffset_TexImage2D, TexImage2D@36) + GL_STUB(TexEnvf, _gloffset_TexEnvf, TexEnvf@12) + GL_STUB(TexEnvfv, _gloffset_TexEnvfv, TexEnvfv@12) + GL_STUB(TexEnvi, _gloffset_TexEnvi, TexEnvi@12) + GL_STUB(TexEnviv, _gloffset_TexEnviv, TexEnviv@12) + GL_STUB(TexGend, _gloffset_TexGend, TexGend@16) + GL_STUB(TexGendv, _gloffset_TexGendv, TexGendv@12) + GL_STUB(TexGenf, _gloffset_TexGenf, TexGenf@12) + GL_STUB(TexGenfv, _gloffset_TexGenfv, TexGenfv@12) + GL_STUB(TexGeni, _gloffset_TexGeni, TexGeni@12) + GL_STUB(TexGeniv, _gloffset_TexGeniv, TexGeniv@12) + GL_STUB(FeedbackBuffer, _gloffset_FeedbackBuffer, FeedbackBuffer@12) + GL_STUB(SelectBuffer, _gloffset_SelectBuffer, SelectBuffer@8) + GL_STUB(RenderMode, _gloffset_RenderMode, RenderMode@4) + GL_STUB(InitNames, _gloffset_InitNames, InitNames@0) + GL_STUB(LoadName, _gloffset_LoadName, LoadName@4) + GL_STUB(PassThrough, _gloffset_PassThrough, PassThrough@4) + GL_STUB(PopName, _gloffset_PopName, PopName@0) + GL_STUB(PushName, _gloffset_PushName, PushName@4) + GL_STUB(DrawBuffer, _gloffset_DrawBuffer, DrawBuffer@4) + GL_STUB(Clear, _gloffset_Clear, Clear@4) + GL_STUB(ClearAccum, _gloffset_ClearAccum, ClearAccum@16) + GL_STUB(ClearIndex, _gloffset_ClearIndex, ClearIndex@4) + GL_STUB(ClearColor, _gloffset_ClearColor, ClearColor@16) + GL_STUB(ClearStencil, _gloffset_ClearStencil, ClearStencil@4) + GL_STUB(ClearDepth, _gloffset_ClearDepth, ClearDepth@8) + GL_STUB(StencilMask, _gloffset_StencilMask, StencilMask@4) + GL_STUB(ColorMask, _gloffset_ColorMask, ColorMask@16) + GL_STUB(DepthMask, _gloffset_DepthMask, DepthMask@4) + GL_STUB(IndexMask, _gloffset_IndexMask, IndexMask@4) + GL_STUB(Accum, _gloffset_Accum, Accum@8) + GL_STUB(Disable, _gloffset_Disable, Disable@4) + GL_STUB(Enable, _gloffset_Enable, Enable@4) + GL_STUB(Finish, _gloffset_Finish, Finish@0) + GL_STUB(Flush, _gloffset_Flush, Flush@0) + GL_STUB(PopAttrib, _gloffset_PopAttrib, PopAttrib@0) + GL_STUB(PushAttrib, _gloffset_PushAttrib, PushAttrib@4) + GL_STUB(Map1d, _gloffset_Map1d, Map1d@32) + GL_STUB(Map1f, _gloffset_Map1f, Map1f@24) + GL_STUB(Map2d, _gloffset_Map2d, Map2d@56) + GL_STUB(Map2f, _gloffset_Map2f, Map2f@40) + GL_STUB(MapGrid1d, _gloffset_MapGrid1d, MapGrid1d@20) + GL_STUB(MapGrid1f, _gloffset_MapGrid1f, MapGrid1f@12) + GL_STUB(MapGrid2d, _gloffset_MapGrid2d, MapGrid2d@40) + GL_STUB(MapGrid2f, _gloffset_MapGrid2f, MapGrid2f@24) + GL_STUB(EvalCoord1d, _gloffset_EvalCoord1d, EvalCoord1d@8) + GL_STUB(EvalCoord1dv, _gloffset_EvalCoord1dv, EvalCoord1dv@4) + GL_STUB(EvalCoord1f, _gloffset_EvalCoord1f, EvalCoord1f@4) + GL_STUB(EvalCoord1fv, _gloffset_EvalCoord1fv, EvalCoord1fv@4) + GL_STUB(EvalCoord2d, _gloffset_EvalCoord2d, EvalCoord2d@16) + GL_STUB(EvalCoord2dv, _gloffset_EvalCoord2dv, EvalCoord2dv@4) + GL_STUB(EvalCoord2f, _gloffset_EvalCoord2f, EvalCoord2f@8) + GL_STUB(EvalCoord2fv, _gloffset_EvalCoord2fv, EvalCoord2fv@4) + GL_STUB(EvalMesh1, _gloffset_EvalMesh1, EvalMesh1@12) + GL_STUB(EvalPoint1, _gloffset_EvalPoint1, EvalPoint1@4) + GL_STUB(EvalMesh2, _gloffset_EvalMesh2, EvalMesh2@20) + GL_STUB(EvalPoint2, _gloffset_EvalPoint2, EvalPoint2@8) + GL_STUB(AlphaFunc, _gloffset_AlphaFunc, AlphaFunc@8) + GL_STUB(BlendFunc, _gloffset_BlendFunc, BlendFunc@8) + GL_STUB(LogicOp, _gloffset_LogicOp, LogicOp@4) + GL_STUB(StencilFunc, _gloffset_StencilFunc, StencilFunc@12) + GL_STUB(StencilOp, _gloffset_StencilOp, StencilOp@12) + GL_STUB(DepthFunc, _gloffset_DepthFunc, DepthFunc@4) + GL_STUB(PixelZoom, _gloffset_PixelZoom, PixelZoom@8) + GL_STUB(PixelTransferf, _gloffset_PixelTransferf, PixelTransferf@8) + GL_STUB(PixelTransferi, _gloffset_PixelTransferi, PixelTransferi@8) + GL_STUB(PixelStoref, _gloffset_PixelStoref, PixelStoref@8) + GL_STUB(PixelStorei, _gloffset_PixelStorei, PixelStorei@8) + GL_STUB(PixelMapfv, _gloffset_PixelMapfv, PixelMapfv@12) + GL_STUB(PixelMapuiv, _gloffset_PixelMapuiv, PixelMapuiv@12) + GL_STUB(PixelMapusv, _gloffset_PixelMapusv, PixelMapusv@12) + GL_STUB(ReadBuffer, _gloffset_ReadBuffer, ReadBuffer@4) + GL_STUB(CopyPixels, _gloffset_CopyPixels, CopyPixels@20) + GL_STUB(ReadPixels, _gloffset_ReadPixels, ReadPixels@28) + GL_STUB(DrawPixels, _gloffset_DrawPixels, DrawPixels@20) + GL_STUB(GetBooleanv, _gloffset_GetBooleanv, GetBooleanv@8) + GL_STUB(GetClipPlane, _gloffset_GetClipPlane, GetClipPlane@8) + GL_STUB(GetDoublev, _gloffset_GetDoublev, GetDoublev@8) + GL_STUB(GetError, _gloffset_GetError, GetError@0) + GL_STUB(GetFloatv, _gloffset_GetFloatv, GetFloatv@8) + GL_STUB(GetIntegerv, _gloffset_GetIntegerv, GetIntegerv@8) + GL_STUB(GetLightfv, _gloffset_GetLightfv, GetLightfv@12) + GL_STUB(GetLightiv, _gloffset_GetLightiv, GetLightiv@12) + GL_STUB(GetMapdv, _gloffset_GetMapdv, GetMapdv@12) + GL_STUB(GetMapfv, _gloffset_GetMapfv, GetMapfv@12) + GL_STUB(GetMapiv, _gloffset_GetMapiv, GetMapiv@12) + GL_STUB(GetMaterialfv, _gloffset_GetMaterialfv, GetMaterialfv@12) + GL_STUB(GetMaterialiv, _gloffset_GetMaterialiv, GetMaterialiv@12) + GL_STUB(GetPixelMapfv, _gloffset_GetPixelMapfv, GetPixelMapfv@8) + GL_STUB(GetPixelMapuiv, _gloffset_GetPixelMapuiv, GetPixelMapuiv@8) + GL_STUB(GetPixelMapusv, _gloffset_GetPixelMapusv, GetPixelMapusv@8) + GL_STUB(GetPolygonStipple, _gloffset_GetPolygonStipple, GetPolygonStipple@4) + GL_STUB(GetString, _gloffset_GetString, GetString@4) + GL_STUB(GetTexEnvfv, _gloffset_GetTexEnvfv, GetTexEnvfv@12) + GL_STUB(GetTexEnviv, _gloffset_GetTexEnviv, GetTexEnviv@12) + GL_STUB(GetTexGendv, _gloffset_GetTexGendv, GetTexGendv@12) + GL_STUB(GetTexGenfv, _gloffset_GetTexGenfv, GetTexGenfv@12) + GL_STUB(GetTexGeniv, _gloffset_GetTexGeniv, GetTexGeniv@12) + GL_STUB(GetTexImage, _gloffset_GetTexImage, GetTexImage@20) + GL_STUB(GetTexParameterfv, _gloffset_GetTexParameterfv, GetTexParameterfv@12) + GL_STUB(GetTexParameteriv, _gloffset_GetTexParameteriv, GetTexParameteriv@12) + GL_STUB(GetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv, GetTexLevelParameterfv@16) + GL_STUB(GetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv, GetTexLevelParameteriv@16) + GL_STUB(IsEnabled, _gloffset_IsEnabled, IsEnabled@4) + GL_STUB(IsList, _gloffset_IsList, IsList@4) + GL_STUB(DepthRange, _gloffset_DepthRange, DepthRange@16) + GL_STUB(Frustum, _gloffset_Frustum, Frustum@48) + GL_STUB(LoadIdentity, _gloffset_LoadIdentity, LoadIdentity@0) + GL_STUB(LoadMatrixf, _gloffset_LoadMatrixf, LoadMatrixf@4) + GL_STUB(LoadMatrixd, _gloffset_LoadMatrixd, LoadMatrixd@4) + GL_STUB(MatrixMode, _gloffset_MatrixMode, MatrixMode@4) + GL_STUB(MultMatrixf, _gloffset_MultMatrixf, MultMatrixf@4) + GL_STUB(MultMatrixd, _gloffset_MultMatrixd, MultMatrixd@4) + GL_STUB(Ortho, _gloffset_Ortho, Ortho@48) + GL_STUB(PopMatrix, _gloffset_PopMatrix, PopMatrix@0) + GL_STUB(PushMatrix, _gloffset_PushMatrix, PushMatrix@0) + GL_STUB(Rotated, _gloffset_Rotated, Rotated@32) + GL_STUB(Rotatef, _gloffset_Rotatef, Rotatef@16) + GL_STUB(Scaled, _gloffset_Scaled, Scaled@24) + GL_STUB(Scalef, _gloffset_Scalef, Scalef@12) + GL_STUB(Translated, _gloffset_Translated, Translated@24) + GL_STUB(Translatef, _gloffset_Translatef, Translatef@12) + GL_STUB(Viewport, _gloffset_Viewport, Viewport@16) + GL_STUB(ArrayElement, _gloffset_ArrayElement, ArrayElement@4) + GL_STUB(BindTexture, _gloffset_BindTexture, BindTexture@8) + GL_STUB(ColorPointer, _gloffset_ColorPointer, ColorPointer@16) + GL_STUB(DisableClientState, _gloffset_DisableClientState, DisableClientState@4) + GL_STUB(DrawArrays, _gloffset_DrawArrays, DrawArrays@12) + GL_STUB(DrawElements, _gloffset_DrawElements, DrawElements@16) + GL_STUB(EdgeFlagPointer, _gloffset_EdgeFlagPointer, EdgeFlagPointer@8) + GL_STUB(EnableClientState, _gloffset_EnableClientState, EnableClientState@4) + GL_STUB(IndexPointer, _gloffset_IndexPointer, IndexPointer@12) + GL_STUB(Indexub, _gloffset_Indexub, Indexub@4) + GL_STUB(Indexubv, _gloffset_Indexubv, Indexubv@4) + GL_STUB(InterleavedArrays, _gloffset_InterleavedArrays, InterleavedArrays@12) + GL_STUB(NormalPointer, _gloffset_NormalPointer, NormalPointer@12) + GL_STUB(PolygonOffset, _gloffset_PolygonOffset, PolygonOffset@8) + GL_STUB(TexCoordPointer, _gloffset_TexCoordPointer, TexCoordPointer@16) + GL_STUB(VertexPointer, _gloffset_VertexPointer, VertexPointer@16) + GL_STUB(AreTexturesResident, _gloffset_AreTexturesResident, AreTexturesResident@12) + GL_STUB(CopyTexImage1D, _gloffset_CopyTexImage1D, CopyTexImage1D@28) + GL_STUB(CopyTexImage2D, _gloffset_CopyTexImage2D, CopyTexImage2D@32) + GL_STUB(CopyTexSubImage1D, _gloffset_CopyTexSubImage1D, CopyTexSubImage1D@24) + GL_STUB(CopyTexSubImage2D, _gloffset_CopyTexSubImage2D, CopyTexSubImage2D@32) + GL_STUB(DeleteTextures, _gloffset_DeleteTextures, DeleteTextures@8) + GL_STUB(GenTextures, _gloffset_GenTextures, GenTextures@8) + GL_STUB(GetPointerv, _gloffset_GetPointerv, GetPointerv@8) + GL_STUB(IsTexture, _gloffset_IsTexture, IsTexture@4) + GL_STUB(PrioritizeTextures, _gloffset_PrioritizeTextures, PrioritizeTextures@12) + GL_STUB(TexSubImage1D, _gloffset_TexSubImage1D, TexSubImage1D@28) + GL_STUB(TexSubImage2D, _gloffset_TexSubImage2D, TexSubImage2D@36) + GL_STUB(PopClientAttrib, _gloffset_PopClientAttrib, PopClientAttrib@0) + GL_STUB(PushClientAttrib, _gloffset_PushClientAttrib, PushClientAttrib@4) + GL_STUB(BlendColor, _gloffset_BlendColor, BlendColor@16) + GL_STUB(BlendEquation, _gloffset_BlendEquation, BlendEquation@4) + GL_STUB(DrawRangeElements, _gloffset_DrawRangeElements, DrawRangeElements@24) + GL_STUB(ColorTable, _gloffset_ColorTable, ColorTable@24) + GL_STUB(ColorTableParameterfv, _gloffset_ColorTableParameterfv, ColorTableParameterfv@12) + GL_STUB(ColorTableParameteriv, _gloffset_ColorTableParameteriv, ColorTableParameteriv@12) + GL_STUB(CopyColorTable, _gloffset_CopyColorTable, CopyColorTable@20) + GL_STUB(GetColorTable, _gloffset_GetColorTable, GetColorTable@16) + GL_STUB(GetColorTableParameterfv, _gloffset_GetColorTableParameterfv, GetColorTableParameterfv@12) + GL_STUB(GetColorTableParameteriv, _gloffset_GetColorTableParameteriv, GetColorTableParameteriv@12) + GL_STUB(ColorSubTable, _gloffset_ColorSubTable, ColorSubTable@24) + GL_STUB(CopyColorSubTable, _gloffset_CopyColorSubTable, CopyColorSubTable@20) + GL_STUB(ConvolutionFilter1D, _gloffset_ConvolutionFilter1D, ConvolutionFilter1D@24) + GL_STUB(ConvolutionFilter2D, _gloffset_ConvolutionFilter2D, ConvolutionFilter2D@28) + GL_STUB(ConvolutionParameterf, _gloffset_ConvolutionParameterf, ConvolutionParameterf@12) + GL_STUB(ConvolutionParameterfv, _gloffset_ConvolutionParameterfv, ConvolutionParameterfv@12) + GL_STUB(ConvolutionParameteri, _gloffset_ConvolutionParameteri, ConvolutionParameteri@12) + GL_STUB(ConvolutionParameteriv, _gloffset_ConvolutionParameteriv, ConvolutionParameteriv@12) + GL_STUB(CopyConvolutionFilter1D, _gloffset_CopyConvolutionFilter1D, CopyConvolutionFilter1D@20) + GL_STUB(CopyConvolutionFilter2D, _gloffset_CopyConvolutionFilter2D, CopyConvolutionFilter2D@24) + GL_STUB(GetConvolutionFilter, _gloffset_GetConvolutionFilter, GetConvolutionFilter@16) + GL_STUB(GetConvolutionParameterfv, _gloffset_GetConvolutionParameterfv, GetConvolutionParameterfv@12) + GL_STUB(GetConvolutionParameteriv, _gloffset_GetConvolutionParameteriv, GetConvolutionParameteriv@12) + GL_STUB(GetSeparableFilter, _gloffset_GetSeparableFilter, GetSeparableFilter@24) + GL_STUB(SeparableFilter2D, _gloffset_SeparableFilter2D, SeparableFilter2D@32) + GL_STUB(GetHistogram, _gloffset_GetHistogram, GetHistogram@20) + GL_STUB(GetHistogramParameterfv, _gloffset_GetHistogramParameterfv, GetHistogramParameterfv@12) + GL_STUB(GetHistogramParameteriv, _gloffset_GetHistogramParameteriv, GetHistogramParameteriv@12) + GL_STUB(GetMinmax, _gloffset_GetMinmax, GetMinmax@20) + GL_STUB(GetMinmaxParameterfv, _gloffset_GetMinmaxParameterfv, GetMinmaxParameterfv@12) + GL_STUB(GetMinmaxParameteriv, _gloffset_GetMinmaxParameteriv, GetMinmaxParameteriv@12) + GL_STUB(Histogram, _gloffset_Histogram, Histogram@16) + GL_STUB(Minmax, _gloffset_Minmax, Minmax@12) + GL_STUB(ResetHistogram, _gloffset_ResetHistogram, ResetHistogram@4) + GL_STUB(ResetMinmax, _gloffset_ResetMinmax, ResetMinmax@4) + GL_STUB(TexImage3D, _gloffset_TexImage3D, TexImage3D@40) + GL_STUB(TexSubImage3D, _gloffset_TexSubImage3D, TexSubImage3D@44) + GL_STUB(CopyTexSubImage3D, _gloffset_CopyTexSubImage3D, CopyTexSubImage3D@36) + GL_STUB(ActiveTextureARB, _gloffset_ActiveTextureARB, ActiveTextureARB@4) + GL_STUB(ClientActiveTextureARB, _gloffset_ClientActiveTextureARB, ClientActiveTextureARB@4) + GL_STUB(MultiTexCoord1dARB, _gloffset_MultiTexCoord1dARB, MultiTexCoord1dARB@12) + GL_STUB(MultiTexCoord1dvARB, _gloffset_MultiTexCoord1dvARB, MultiTexCoord1dvARB@8) + GL_STUB(MultiTexCoord1fARB, _gloffset_MultiTexCoord1fARB, MultiTexCoord1fARB@8) + GL_STUB(MultiTexCoord1fvARB, _gloffset_MultiTexCoord1fvARB, MultiTexCoord1fvARB@8) + GL_STUB(MultiTexCoord1iARB, _gloffset_MultiTexCoord1iARB, MultiTexCoord1iARB@8) + GL_STUB(MultiTexCoord1ivARB, _gloffset_MultiTexCoord1ivARB, MultiTexCoord1ivARB@8) + GL_STUB(MultiTexCoord1sARB, _gloffset_MultiTexCoord1sARB, MultiTexCoord1sARB@8) + GL_STUB(MultiTexCoord1svARB, _gloffset_MultiTexCoord1svARB, MultiTexCoord1svARB@8) + GL_STUB(MultiTexCoord2dARB, _gloffset_MultiTexCoord2dARB, MultiTexCoord2dARB@20) + GL_STUB(MultiTexCoord2dvARB, _gloffset_MultiTexCoord2dvARB, MultiTexCoord2dvARB@8) + GL_STUB(MultiTexCoord2fARB, _gloffset_MultiTexCoord2fARB, MultiTexCoord2fARB@12) + GL_STUB(MultiTexCoord2fvARB, _gloffset_MultiTexCoord2fvARB, MultiTexCoord2fvARB@8) + GL_STUB(MultiTexCoord2iARB, _gloffset_MultiTexCoord2iARB, MultiTexCoord2iARB@12) + GL_STUB(MultiTexCoord2ivARB, _gloffset_MultiTexCoord2ivARB, MultiTexCoord2ivARB@8) + GL_STUB(MultiTexCoord2sARB, _gloffset_MultiTexCoord2sARB, MultiTexCoord2sARB@12) + GL_STUB(MultiTexCoord2svARB, _gloffset_MultiTexCoord2svARB, MultiTexCoord2svARB@8) + GL_STUB(MultiTexCoord3dARB, _gloffset_MultiTexCoord3dARB, MultiTexCoord3dARB@28) + GL_STUB(MultiTexCoord3dvARB, _gloffset_MultiTexCoord3dvARB, MultiTexCoord3dvARB@8) + GL_STUB(MultiTexCoord3fARB, _gloffset_MultiTexCoord3fARB, MultiTexCoord3fARB@16) + GL_STUB(MultiTexCoord3fvARB, _gloffset_MultiTexCoord3fvARB, MultiTexCoord3fvARB@8) + GL_STUB(MultiTexCoord3iARB, _gloffset_MultiTexCoord3iARB, MultiTexCoord3iARB@16) + GL_STUB(MultiTexCoord3ivARB, _gloffset_MultiTexCoord3ivARB, MultiTexCoord3ivARB@8) + GL_STUB(MultiTexCoord3sARB, _gloffset_MultiTexCoord3sARB, MultiTexCoord3sARB@16) + GL_STUB(MultiTexCoord3svARB, _gloffset_MultiTexCoord3svARB, MultiTexCoord3svARB@8) + GL_STUB(MultiTexCoord4dARB, _gloffset_MultiTexCoord4dARB, MultiTexCoord4dARB@36) + GL_STUB(MultiTexCoord4dvARB, _gloffset_MultiTexCoord4dvARB, MultiTexCoord4dvARB@8) + GL_STUB(MultiTexCoord4fARB, _gloffset_MultiTexCoord4fARB, MultiTexCoord4fARB@20) + GL_STUB(MultiTexCoord4fvARB, _gloffset_MultiTexCoord4fvARB, MultiTexCoord4fvARB@8) + GL_STUB(MultiTexCoord4iARB, _gloffset_MultiTexCoord4iARB, MultiTexCoord4iARB@20) + GL_STUB(MultiTexCoord4ivARB, _gloffset_MultiTexCoord4ivARB, MultiTexCoord4ivARB@8) + GL_STUB(MultiTexCoord4sARB, _gloffset_MultiTexCoord4sARB, MultiTexCoord4sARB@20) + GL_STUB(MultiTexCoord4svARB, _gloffset_MultiTexCoord4svARB, MultiTexCoord4svARB@8) + GL_STUB(AttachShader, _gloffset_AttachShader, AttachShader@8) + GL_STUB(CreateProgram, _gloffset_CreateProgram, CreateProgram@0) + GL_STUB(CreateShader, _gloffset_CreateShader, CreateShader@4) + GL_STUB(DeleteProgram, _gloffset_DeleteProgram, DeleteProgram@4) + GL_STUB(DeleteShader, _gloffset_DeleteShader, DeleteShader@4) + GL_STUB(DetachShader, _gloffset_DetachShader, DetachShader@8) + GL_STUB(GetAttachedShaders, _gloffset_GetAttachedShaders, GetAttachedShaders@16) + GL_STUB(GetProgramInfoLog, _gloffset_GetProgramInfoLog, GetProgramInfoLog@16) + GL_STUB(GetProgramiv, _gloffset_GetProgramiv, GetProgramiv@12) + GL_STUB(GetShaderInfoLog, _gloffset_GetShaderInfoLog, GetShaderInfoLog@16) + GL_STUB(GetShaderiv, _gloffset_GetShaderiv, GetShaderiv@12) + GL_STUB(IsProgram, _gloffset_IsProgram, IsProgram@4) + GL_STUB(IsShader, _gloffset_IsShader, IsShader@4) + GL_STUB(StencilFuncSeparate, _gloffset_StencilFuncSeparate, StencilFuncSeparate@16) + GL_STUB(StencilMaskSeparate, _gloffset_StencilMaskSeparate, StencilMaskSeparate@8) + GL_STUB(StencilOpSeparate, _gloffset_StencilOpSeparate, StencilOpSeparate@16) + GL_STUB(UniformMatrix2x3fv, _gloffset_UniformMatrix2x3fv, UniformMatrix2x3fv@16) + GL_STUB(UniformMatrix2x4fv, _gloffset_UniformMatrix2x4fv, UniformMatrix2x4fv@16) + GL_STUB(UniformMatrix3x2fv, _gloffset_UniformMatrix3x2fv, UniformMatrix3x2fv@16) + GL_STUB(UniformMatrix3x4fv, _gloffset_UniformMatrix3x4fv, UniformMatrix3x4fv@16) + GL_STUB(UniformMatrix4x2fv, _gloffset_UniformMatrix4x2fv, UniformMatrix4x2fv@16) + GL_STUB(UniformMatrix4x3fv, _gloffset_UniformMatrix4x3fv, UniformMatrix4x3fv@16) + GL_STUB(DrawArraysInstanced, _gloffset_DrawArraysInstanced, DrawArraysInstanced@16) + GL_STUB(DrawElementsInstanced, _gloffset_DrawElementsInstanced, DrawElementsInstanced@20) + GL_STUB(LoadTransposeMatrixdARB, _gloffset_LoadTransposeMatrixdARB, LoadTransposeMatrixdARB@4) + GL_STUB(LoadTransposeMatrixfARB, _gloffset_LoadTransposeMatrixfARB, LoadTransposeMatrixfARB@4) + GL_STUB(MultTransposeMatrixdARB, _gloffset_MultTransposeMatrixdARB, MultTransposeMatrixdARB@4) + GL_STUB(MultTransposeMatrixfARB, _gloffset_MultTransposeMatrixfARB, MultTransposeMatrixfARB@4) + GL_STUB(SampleCoverageARB, _gloffset_SampleCoverageARB, SampleCoverageARB@8) + GL_STUB(CompressedTexImage1DARB, _gloffset_CompressedTexImage1DARB, CompressedTexImage1DARB@28) + GL_STUB(CompressedTexImage2DARB, _gloffset_CompressedTexImage2DARB, CompressedTexImage2DARB@32) + GL_STUB(CompressedTexImage3DARB, _gloffset_CompressedTexImage3DARB, CompressedTexImage3DARB@36) + GL_STUB(CompressedTexSubImage1DARB, _gloffset_CompressedTexSubImage1DARB, CompressedTexSubImage1DARB@28) + GL_STUB(CompressedTexSubImage2DARB, _gloffset_CompressedTexSubImage2DARB, CompressedTexSubImage2DARB@36) + GL_STUB(CompressedTexSubImage3DARB, _gloffset_CompressedTexSubImage3DARB, CompressedTexSubImage3DARB@44) + GL_STUB(GetCompressedTexImageARB, _gloffset_GetCompressedTexImageARB, GetCompressedTexImageARB@12) + GL_STUB(DisableVertexAttribArrayARB, _gloffset_DisableVertexAttribArrayARB, DisableVertexAttribArrayARB@4) + GL_STUB(EnableVertexAttribArrayARB, _gloffset_EnableVertexAttribArrayARB, EnableVertexAttribArrayARB@4) + GL_STUB(GetProgramEnvParameterdvARB, _gloffset_GetProgramEnvParameterdvARB, GetProgramEnvParameterdvARB@12) + GL_STUB(GetProgramEnvParameterfvARB, _gloffset_GetProgramEnvParameterfvARB, GetProgramEnvParameterfvARB@12) + GL_STUB(GetProgramLocalParameterdvARB, _gloffset_GetProgramLocalParameterdvARB, GetProgramLocalParameterdvARB@12) + GL_STUB(GetProgramLocalParameterfvARB, _gloffset_GetProgramLocalParameterfvARB, GetProgramLocalParameterfvARB@12) + GL_STUB(GetProgramStringARB, _gloffset_GetProgramStringARB, GetProgramStringARB@12) + GL_STUB(GetProgramivARB, _gloffset_GetProgramivARB, GetProgramivARB@12) + GL_STUB(GetVertexAttribdvARB, _gloffset_GetVertexAttribdvARB, GetVertexAttribdvARB@12) + GL_STUB(GetVertexAttribfvARB, _gloffset_GetVertexAttribfvARB, GetVertexAttribfvARB@12) + GL_STUB(GetVertexAttribivARB, _gloffset_GetVertexAttribivARB, GetVertexAttribivARB@12) + GL_STUB(ProgramEnvParameter4dARB, _gloffset_ProgramEnvParameter4dARB, ProgramEnvParameter4dARB@40) + GL_STUB(ProgramEnvParameter4dvARB, _gloffset_ProgramEnvParameter4dvARB, ProgramEnvParameter4dvARB@12) + GL_STUB(ProgramEnvParameter4fARB, _gloffset_ProgramEnvParameter4fARB, ProgramEnvParameter4fARB@24) + GL_STUB(ProgramEnvParameter4fvARB, _gloffset_ProgramEnvParameter4fvARB, ProgramEnvParameter4fvARB@12) + GL_STUB(ProgramLocalParameter4dARB, _gloffset_ProgramLocalParameter4dARB, ProgramLocalParameter4dARB@40) + GL_STUB(ProgramLocalParameter4dvARB, _gloffset_ProgramLocalParameter4dvARB, ProgramLocalParameter4dvARB@12) + GL_STUB(ProgramLocalParameter4fARB, _gloffset_ProgramLocalParameter4fARB, ProgramLocalParameter4fARB@24) + GL_STUB(ProgramLocalParameter4fvARB, _gloffset_ProgramLocalParameter4fvARB, ProgramLocalParameter4fvARB@12) + GL_STUB(ProgramStringARB, _gloffset_ProgramStringARB, ProgramStringARB@16) + GL_STUB(VertexAttrib1dARB, _gloffset_VertexAttrib1dARB, VertexAttrib1dARB@12) + GL_STUB(VertexAttrib1dvARB, _gloffset_VertexAttrib1dvARB, VertexAttrib1dvARB@8) + GL_STUB(VertexAttrib1fARB, _gloffset_VertexAttrib1fARB, VertexAttrib1fARB@8) + GL_STUB(VertexAttrib1fvARB, _gloffset_VertexAttrib1fvARB, VertexAttrib1fvARB@8) + GL_STUB(VertexAttrib1sARB, _gloffset_VertexAttrib1sARB, VertexAttrib1sARB@8) + GL_STUB(VertexAttrib1svARB, _gloffset_VertexAttrib1svARB, VertexAttrib1svARB@8) + GL_STUB(VertexAttrib2dARB, _gloffset_VertexAttrib2dARB, VertexAttrib2dARB@20) + GL_STUB(VertexAttrib2dvARB, _gloffset_VertexAttrib2dvARB, VertexAttrib2dvARB@8) + GL_STUB(VertexAttrib2fARB, _gloffset_VertexAttrib2fARB, VertexAttrib2fARB@12) + GL_STUB(VertexAttrib2fvARB, _gloffset_VertexAttrib2fvARB, VertexAttrib2fvARB@8) + GL_STUB(VertexAttrib2sARB, _gloffset_VertexAttrib2sARB, VertexAttrib2sARB@12) + GL_STUB(VertexAttrib2svARB, _gloffset_VertexAttrib2svARB, VertexAttrib2svARB@8) + GL_STUB(VertexAttrib3dARB, _gloffset_VertexAttrib3dARB, VertexAttrib3dARB@28) + GL_STUB(VertexAttrib3dvARB, _gloffset_VertexAttrib3dvARB, VertexAttrib3dvARB@8) + GL_STUB(VertexAttrib3fARB, _gloffset_VertexAttrib3fARB, VertexAttrib3fARB@16) + GL_STUB(VertexAttrib3fvARB, _gloffset_VertexAttrib3fvARB, VertexAttrib3fvARB@8) + GL_STUB(VertexAttrib3sARB, _gloffset_VertexAttrib3sARB, VertexAttrib3sARB@16) + GL_STUB(VertexAttrib3svARB, _gloffset_VertexAttrib3svARB, VertexAttrib3svARB@8) + GL_STUB(VertexAttrib4NbvARB, _gloffset_VertexAttrib4NbvARB, VertexAttrib4NbvARB@8) + GL_STUB(VertexAttrib4NivARB, _gloffset_VertexAttrib4NivARB, VertexAttrib4NivARB@8) + GL_STUB(VertexAttrib4NsvARB, _gloffset_VertexAttrib4NsvARB, VertexAttrib4NsvARB@8) + GL_STUB(VertexAttrib4NubARB, _gloffset_VertexAttrib4NubARB, VertexAttrib4NubARB@20) + GL_STUB(VertexAttrib4NubvARB, _gloffset_VertexAttrib4NubvARB, VertexAttrib4NubvARB@8) + GL_STUB(VertexAttrib4NuivARB, _gloffset_VertexAttrib4NuivARB, VertexAttrib4NuivARB@8) + GL_STUB(VertexAttrib4NusvARB, _gloffset_VertexAttrib4NusvARB, VertexAttrib4NusvARB@8) + GL_STUB(VertexAttrib4bvARB, _gloffset_VertexAttrib4bvARB, VertexAttrib4bvARB@8) + GL_STUB(VertexAttrib4dARB, _gloffset_VertexAttrib4dARB, VertexAttrib4dARB@36) + GL_STUB(VertexAttrib4dvARB, _gloffset_VertexAttrib4dvARB, VertexAttrib4dvARB@8) + GL_STUB(VertexAttrib4fARB, _gloffset_VertexAttrib4fARB, VertexAttrib4fARB@20) + GL_STUB(VertexAttrib4fvARB, _gloffset_VertexAttrib4fvARB, VertexAttrib4fvARB@8) + GL_STUB(VertexAttrib4ivARB, _gloffset_VertexAttrib4ivARB, VertexAttrib4ivARB@8) + GL_STUB(VertexAttrib4sARB, _gloffset_VertexAttrib4sARB, VertexAttrib4sARB@20) + GL_STUB(VertexAttrib4svARB, _gloffset_VertexAttrib4svARB, VertexAttrib4svARB@8) + GL_STUB(VertexAttrib4ubvARB, _gloffset_VertexAttrib4ubvARB, VertexAttrib4ubvARB@8) + GL_STUB(VertexAttrib4uivARB, _gloffset_VertexAttrib4uivARB, VertexAttrib4uivARB@8) + GL_STUB(VertexAttrib4usvARB, _gloffset_VertexAttrib4usvARB, VertexAttrib4usvARB@8) + GL_STUB(VertexAttribPointerARB, _gloffset_VertexAttribPointerARB, VertexAttribPointerARB@24) + GL_STUB(BindBufferARB, _gloffset_BindBufferARB, BindBufferARB@8) + GL_STUB(BufferDataARB, _gloffset_BufferDataARB, BufferDataARB@16) + GL_STUB(BufferSubDataARB, _gloffset_BufferSubDataARB, BufferSubDataARB@16) + GL_STUB(DeleteBuffersARB, _gloffset_DeleteBuffersARB, DeleteBuffersARB@8) + GL_STUB(GenBuffersARB, _gloffset_GenBuffersARB, GenBuffersARB@8) + GL_STUB(GetBufferParameterivARB, _gloffset_GetBufferParameterivARB, GetBufferParameterivARB@12) + GL_STUB(GetBufferPointervARB, _gloffset_GetBufferPointervARB, GetBufferPointervARB@12) + GL_STUB(GetBufferSubDataARB, _gloffset_GetBufferSubDataARB, GetBufferSubDataARB@16) + GL_STUB(IsBufferARB, _gloffset_IsBufferARB, IsBufferARB@4) + GL_STUB(MapBufferARB, _gloffset_MapBufferARB, MapBufferARB@8) + GL_STUB(UnmapBufferARB, _gloffset_UnmapBufferARB, UnmapBufferARB@4) + GL_STUB(BeginQueryARB, _gloffset_BeginQueryARB, BeginQueryARB@8) + GL_STUB(DeleteQueriesARB, _gloffset_DeleteQueriesARB, DeleteQueriesARB@8) + GL_STUB(EndQueryARB, _gloffset_EndQueryARB, EndQueryARB@4) + GL_STUB(GenQueriesARB, _gloffset_GenQueriesARB, GenQueriesARB@8) + GL_STUB(GetQueryObjectivARB, _gloffset_GetQueryObjectivARB, GetQueryObjectivARB@12) + GL_STUB(GetQueryObjectuivARB, _gloffset_GetQueryObjectuivARB, GetQueryObjectuivARB@12) + GL_STUB(GetQueryivARB, _gloffset_GetQueryivARB, GetQueryivARB@12) + GL_STUB(IsQueryARB, _gloffset_IsQueryARB, IsQueryARB@4) + GL_STUB(AttachObjectARB, _gloffset_AttachObjectARB, AttachObjectARB@8) + GL_STUB(CompileShaderARB, _gloffset_CompileShaderARB, CompileShaderARB@4) + GL_STUB(CreateProgramObjectARB, _gloffset_CreateProgramObjectARB, CreateProgramObjectARB@0) + GL_STUB(CreateShaderObjectARB, _gloffset_CreateShaderObjectARB, CreateShaderObjectARB@4) + GL_STUB(DeleteObjectARB, _gloffset_DeleteObjectARB, DeleteObjectARB@4) + GL_STUB(DetachObjectARB, _gloffset_DetachObjectARB, DetachObjectARB@8) + GL_STUB(GetActiveUniformARB, _gloffset_GetActiveUniformARB, GetActiveUniformARB@28) + GL_STUB(GetAttachedObjectsARB, _gloffset_GetAttachedObjectsARB, GetAttachedObjectsARB@16) + GL_STUB(GetHandleARB, _gloffset_GetHandleARB, GetHandleARB@4) + GL_STUB(GetInfoLogARB, _gloffset_GetInfoLogARB, GetInfoLogARB@16) + GL_STUB(GetObjectParameterfvARB, _gloffset_GetObjectParameterfvARB, GetObjectParameterfvARB@12) + GL_STUB(GetObjectParameterivARB, _gloffset_GetObjectParameterivARB, GetObjectParameterivARB@12) + GL_STUB(GetShaderSourceARB, _gloffset_GetShaderSourceARB, GetShaderSourceARB@16) + GL_STUB(GetUniformLocationARB, _gloffset_GetUniformLocationARB, GetUniformLocationARB@8) + GL_STUB(GetUniformfvARB, _gloffset_GetUniformfvARB, GetUniformfvARB@12) + GL_STUB(GetUniformivARB, _gloffset_GetUniformivARB, GetUniformivARB@12) + GL_STUB(LinkProgramARB, _gloffset_LinkProgramARB, LinkProgramARB@4) + GL_STUB(ShaderSourceARB, _gloffset_ShaderSourceARB, ShaderSourceARB@16) + GL_STUB(Uniform1fARB, _gloffset_Uniform1fARB, Uniform1fARB@8) + GL_STUB(Uniform1fvARB, _gloffset_Uniform1fvARB, Uniform1fvARB@12) + GL_STUB(Uniform1iARB, _gloffset_Uniform1iARB, Uniform1iARB@8) + GL_STUB(Uniform1ivARB, _gloffset_Uniform1ivARB, Uniform1ivARB@12) + GL_STUB(Uniform2fARB, _gloffset_Uniform2fARB, Uniform2fARB@12) + GL_STUB(Uniform2fvARB, _gloffset_Uniform2fvARB, Uniform2fvARB@12) + GL_STUB(Uniform2iARB, _gloffset_Uniform2iARB, Uniform2iARB@12) + GL_STUB(Uniform2ivARB, _gloffset_Uniform2ivARB, Uniform2ivARB@12) + GL_STUB(Uniform3fARB, _gloffset_Uniform3fARB, Uniform3fARB@16) + GL_STUB(Uniform3fvARB, _gloffset_Uniform3fvARB, Uniform3fvARB@12) + GL_STUB(Uniform3iARB, _gloffset_Uniform3iARB, Uniform3iARB@16) + GL_STUB(Uniform3ivARB, _gloffset_Uniform3ivARB, Uniform3ivARB@12) + GL_STUB(Uniform4fARB, _gloffset_Uniform4fARB, Uniform4fARB@20) + GL_STUB(Uniform4fvARB, _gloffset_Uniform4fvARB, Uniform4fvARB@12) + GL_STUB(Uniform4iARB, _gloffset_Uniform4iARB, Uniform4iARB@20) + GL_STUB(Uniform4ivARB, _gloffset_Uniform4ivARB, Uniform4ivARB@12) + GL_STUB(UniformMatrix2fvARB, _gloffset_UniformMatrix2fvARB, UniformMatrix2fvARB@16) + GL_STUB(UniformMatrix3fvARB, _gloffset_UniformMatrix3fvARB, UniformMatrix3fvARB@16) + GL_STUB(UniformMatrix4fvARB, _gloffset_UniformMatrix4fvARB, UniformMatrix4fvARB@16) + GL_STUB(UseProgramObjectARB, _gloffset_UseProgramObjectARB, UseProgramObjectARB@4) + GL_STUB(ValidateProgramARB, _gloffset_ValidateProgramARB, ValidateProgramARB@4) + GL_STUB(BindAttribLocationARB, _gloffset_BindAttribLocationARB, BindAttribLocationARB@12) + GL_STUB(GetActiveAttribARB, _gloffset_GetActiveAttribARB, GetActiveAttribARB@28) + GL_STUB(GetAttribLocationARB, _gloffset_GetAttribLocationARB, GetAttribLocationARB@8) + GL_STUB(DrawBuffersARB, _gloffset_DrawBuffersARB, DrawBuffersARB@8) + GL_STUB(RenderbufferStorageMultisample, _gloffset_RenderbufferStorageMultisample, RenderbufferStorageMultisample@20) + GL_STUB(FramebufferTextureARB, _gloffset_FramebufferTextureARB, FramebufferTextureARB@16) + GL_STUB(FramebufferTextureFaceARB, _gloffset_FramebufferTextureFaceARB, FramebufferTextureFaceARB@20) + GL_STUB(ProgramParameteriARB, _gloffset_ProgramParameteriARB, ProgramParameteriARB@12) + GL_STUB(FlushMappedBufferRange, _gloffset_FlushMappedBufferRange, FlushMappedBufferRange@12) + GL_STUB(MapBufferRange, _gloffset_MapBufferRange, MapBufferRange@16) + GL_STUB(BindVertexArray, _gloffset_BindVertexArray, BindVertexArray@4) + GL_STUB(GenVertexArrays, _gloffset_GenVertexArrays, GenVertexArrays@8) + GL_STUB(CopyBufferSubData, _gloffset_CopyBufferSubData, CopyBufferSubData@20) + GL_STUB(ClientWaitSync, _gloffset_ClientWaitSync, ClientWaitSync@12) + GL_STUB(DeleteSync, _gloffset_DeleteSync, DeleteSync@4) + GL_STUB(FenceSync, _gloffset_FenceSync, FenceSync@8) + GL_STUB(GetInteger64v, _gloffset_GetInteger64v, GetInteger64v@8) + GL_STUB(GetSynciv, _gloffset_GetSynciv, GetSynciv@20) + GL_STUB(IsSync, _gloffset_IsSync, IsSync@4) + GL_STUB(WaitSync, _gloffset_WaitSync, WaitSync@12) + GL_STUB(DrawElementsBaseVertex, _gloffset_DrawElementsBaseVertex, DrawElementsBaseVertex@20) + GL_STUB(DrawRangeElementsBaseVertex, _gloffset_DrawRangeElementsBaseVertex, DrawRangeElementsBaseVertex@28) + GL_STUB(MultiDrawElementsBaseVertex, _gloffset_MultiDrawElementsBaseVertex, MultiDrawElementsBaseVertex@24) + GL_STUB(BindTransformFeedback, _gloffset_BindTransformFeedback, BindTransformFeedback@8) + GL_STUB(DeleteTransformFeedbacks, _gloffset_DeleteTransformFeedbacks, DeleteTransformFeedbacks@8) + GL_STUB(DrawTransformFeedback, _gloffset_DrawTransformFeedback, DrawTransformFeedback@8) + GL_STUB(GenTransformFeedbacks, _gloffset_GenTransformFeedbacks, GenTransformFeedbacks@8) + GL_STUB(IsTransformFeedback, _gloffset_IsTransformFeedback, IsTransformFeedback@4) + GL_STUB(PauseTransformFeedback, _gloffset_PauseTransformFeedback, PauseTransformFeedback@0) + GL_STUB(ResumeTransformFeedback, _gloffset_ResumeTransformFeedback, ResumeTransformFeedback@0) + GL_STUB(PolygonOffsetEXT, _gloffset_PolygonOffsetEXT, PolygonOffsetEXT@8) + GL_STUB(_dispatch_stub_590, _gloffset_GetPixelTexGenParameterfvSGIS, _dispatch_stub_590@8) + HIDDEN(GL_PREFIX(_dispatch_stub_590, _dispatch_stub_590@8)) + GL_STUB(_dispatch_stub_591, _gloffset_GetPixelTexGenParameterivSGIS, _dispatch_stub_591@8) + HIDDEN(GL_PREFIX(_dispatch_stub_591, _dispatch_stub_591@8)) + GL_STUB(_dispatch_stub_592, _gloffset_PixelTexGenParameterfSGIS, _dispatch_stub_592@8) + HIDDEN(GL_PREFIX(_dispatch_stub_592, _dispatch_stub_592@8)) + GL_STUB(_dispatch_stub_593, _gloffset_PixelTexGenParameterfvSGIS, _dispatch_stub_593@8) + HIDDEN(GL_PREFIX(_dispatch_stub_593, _dispatch_stub_593@8)) + GL_STUB(_dispatch_stub_594, _gloffset_PixelTexGenParameteriSGIS, _dispatch_stub_594@8) + HIDDEN(GL_PREFIX(_dispatch_stub_594, _dispatch_stub_594@8)) + GL_STUB(_dispatch_stub_595, _gloffset_PixelTexGenParameterivSGIS, _dispatch_stub_595@8) + HIDDEN(GL_PREFIX(_dispatch_stub_595, _dispatch_stub_595@8)) + GL_STUB(_dispatch_stub_596, _gloffset_SampleMaskSGIS, _dispatch_stub_596@8) + HIDDEN(GL_PREFIX(_dispatch_stub_596, _dispatch_stub_596@8)) + GL_STUB(_dispatch_stub_597, _gloffset_SamplePatternSGIS, _dispatch_stub_597@4) + HIDDEN(GL_PREFIX(_dispatch_stub_597, _dispatch_stub_597@4)) + GL_STUB(ColorPointerEXT, _gloffset_ColorPointerEXT, ColorPointerEXT@20) + GL_STUB(EdgeFlagPointerEXT, _gloffset_EdgeFlagPointerEXT, EdgeFlagPointerEXT@12) + GL_STUB(IndexPointerEXT, _gloffset_IndexPointerEXT, IndexPointerEXT@16) + GL_STUB(NormalPointerEXT, _gloffset_NormalPointerEXT, NormalPointerEXT@16) + GL_STUB(TexCoordPointerEXT, _gloffset_TexCoordPointerEXT, TexCoordPointerEXT@20) + GL_STUB(VertexPointerEXT, _gloffset_VertexPointerEXT, VertexPointerEXT@20) + GL_STUB(PointParameterfEXT, _gloffset_PointParameterfEXT, PointParameterfEXT@8) + GL_STUB(PointParameterfvEXT, _gloffset_PointParameterfvEXT, PointParameterfvEXT@8) + GL_STUB(LockArraysEXT, _gloffset_LockArraysEXT, LockArraysEXT@8) + GL_STUB(UnlockArraysEXT, _gloffset_UnlockArraysEXT, UnlockArraysEXT@0) + GL_STUB(_dispatch_stub_608, _gloffset_CullParameterdvEXT, _dispatch_stub_608@8) + HIDDEN(GL_PREFIX(_dispatch_stub_608, _dispatch_stub_608@8)) + GL_STUB(_dispatch_stub_609, _gloffset_CullParameterfvEXT, _dispatch_stub_609@8) + HIDDEN(GL_PREFIX(_dispatch_stub_609, _dispatch_stub_609@8)) + GL_STUB(SecondaryColor3bEXT, _gloffset_SecondaryColor3bEXT, SecondaryColor3bEXT@12) + GL_STUB(SecondaryColor3bvEXT, _gloffset_SecondaryColor3bvEXT, SecondaryColor3bvEXT@4) + GL_STUB(SecondaryColor3dEXT, _gloffset_SecondaryColor3dEXT, SecondaryColor3dEXT@24) + GL_STUB(SecondaryColor3dvEXT, _gloffset_SecondaryColor3dvEXT, SecondaryColor3dvEXT@4) + GL_STUB(SecondaryColor3fEXT, _gloffset_SecondaryColor3fEXT, SecondaryColor3fEXT@12) + GL_STUB(SecondaryColor3fvEXT, _gloffset_SecondaryColor3fvEXT, SecondaryColor3fvEXT@4) + GL_STUB(SecondaryColor3iEXT, _gloffset_SecondaryColor3iEXT, SecondaryColor3iEXT@12) + GL_STUB(SecondaryColor3ivEXT, _gloffset_SecondaryColor3ivEXT, SecondaryColor3ivEXT@4) + GL_STUB(SecondaryColor3sEXT, _gloffset_SecondaryColor3sEXT, SecondaryColor3sEXT@12) + GL_STUB(SecondaryColor3svEXT, _gloffset_SecondaryColor3svEXT, SecondaryColor3svEXT@4) + GL_STUB(SecondaryColor3ubEXT, _gloffset_SecondaryColor3ubEXT, SecondaryColor3ubEXT@12) + GL_STUB(SecondaryColor3ubvEXT, _gloffset_SecondaryColor3ubvEXT, SecondaryColor3ubvEXT@4) + GL_STUB(SecondaryColor3uiEXT, _gloffset_SecondaryColor3uiEXT, SecondaryColor3uiEXT@12) + GL_STUB(SecondaryColor3uivEXT, _gloffset_SecondaryColor3uivEXT, SecondaryColor3uivEXT@4) + GL_STUB(SecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT, SecondaryColor3usEXT@12) + GL_STUB(SecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT, SecondaryColor3usvEXT@4) + GL_STUB(SecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT, SecondaryColorPointerEXT@16) + GL_STUB(MultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT, MultiDrawArraysEXT@16) + GL_STUB(MultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT, MultiDrawElementsEXT@20) + GL_STUB(FogCoordPointerEXT, _gloffset_FogCoordPointerEXT, FogCoordPointerEXT@12) + GL_STUB(FogCoorddEXT, _gloffset_FogCoorddEXT, FogCoorddEXT@8) + GL_STUB(FogCoorddvEXT, _gloffset_FogCoorddvEXT, FogCoorddvEXT@4) + GL_STUB(FogCoordfEXT, _gloffset_FogCoordfEXT, FogCoordfEXT@4) + GL_STUB(FogCoordfvEXT, _gloffset_FogCoordfvEXT, FogCoordfvEXT@4) + GL_STUB(_dispatch_stub_634, _gloffset_PixelTexGenSGIX, _dispatch_stub_634@4) + HIDDEN(GL_PREFIX(_dispatch_stub_634, _dispatch_stub_634@4)) + GL_STUB(BlendFuncSeparateEXT, _gloffset_BlendFuncSeparateEXT, BlendFuncSeparateEXT@16) + GL_STUB(FlushVertexArrayRangeNV, _gloffset_FlushVertexArrayRangeNV, FlushVertexArrayRangeNV@0) + GL_STUB(VertexArrayRangeNV, _gloffset_VertexArrayRangeNV, VertexArrayRangeNV@8) + GL_STUB(CombinerInputNV, _gloffset_CombinerInputNV, CombinerInputNV@24) + GL_STUB(CombinerOutputNV, _gloffset_CombinerOutputNV, CombinerOutputNV@40) + GL_STUB(CombinerParameterfNV, _gloffset_CombinerParameterfNV, CombinerParameterfNV@8) + GL_STUB(CombinerParameterfvNV, _gloffset_CombinerParameterfvNV, CombinerParameterfvNV@8) + GL_STUB(CombinerParameteriNV, _gloffset_CombinerParameteriNV, CombinerParameteriNV@8) + GL_STUB(CombinerParameterivNV, _gloffset_CombinerParameterivNV, CombinerParameterivNV@8) + GL_STUB(FinalCombinerInputNV, _gloffset_FinalCombinerInputNV, FinalCombinerInputNV@16) + GL_STUB(GetCombinerInputParameterfvNV, _gloffset_GetCombinerInputParameterfvNV, GetCombinerInputParameterfvNV@20) + GL_STUB(GetCombinerInputParameterivNV, _gloffset_GetCombinerInputParameterivNV, GetCombinerInputParameterivNV@20) + GL_STUB(GetCombinerOutputParameterfvNV, _gloffset_GetCombinerOutputParameterfvNV, GetCombinerOutputParameterfvNV@16) + GL_STUB(GetCombinerOutputParameterivNV, _gloffset_GetCombinerOutputParameterivNV, GetCombinerOutputParameterivNV@16) + GL_STUB(GetFinalCombinerInputParameterfvNV, _gloffset_GetFinalCombinerInputParameterfvNV, GetFinalCombinerInputParameterfvNV@12) + GL_STUB(GetFinalCombinerInputParameterivNV, _gloffset_GetFinalCombinerInputParameterivNV, GetFinalCombinerInputParameterivNV@12) + GL_STUB(ResizeBuffersMESA, _gloffset_ResizeBuffersMESA, ResizeBuffersMESA@0) + GL_STUB(WindowPos2dMESA, _gloffset_WindowPos2dMESA, WindowPos2dMESA@16) + GL_STUB(WindowPos2dvMESA, _gloffset_WindowPos2dvMESA, WindowPos2dvMESA@4) + GL_STUB(WindowPos2fMESA, _gloffset_WindowPos2fMESA, WindowPos2fMESA@8) + GL_STUB(WindowPos2fvMESA, _gloffset_WindowPos2fvMESA, WindowPos2fvMESA@4) + GL_STUB(WindowPos2iMESA, _gloffset_WindowPos2iMESA, WindowPos2iMESA@8) + GL_STUB(WindowPos2ivMESA, _gloffset_WindowPos2ivMESA, WindowPos2ivMESA@4) + GL_STUB(WindowPos2sMESA, _gloffset_WindowPos2sMESA, WindowPos2sMESA@8) + GL_STUB(WindowPos2svMESA, _gloffset_WindowPos2svMESA, WindowPos2svMESA@4) + GL_STUB(WindowPos3dMESA, _gloffset_WindowPos3dMESA, WindowPos3dMESA@24) + GL_STUB(WindowPos3dvMESA, _gloffset_WindowPos3dvMESA, WindowPos3dvMESA@4) + GL_STUB(WindowPos3fMESA, _gloffset_WindowPos3fMESA, WindowPos3fMESA@12) + GL_STUB(WindowPos3fvMESA, _gloffset_WindowPos3fvMESA, WindowPos3fvMESA@4) + GL_STUB(WindowPos3iMESA, _gloffset_WindowPos3iMESA, WindowPos3iMESA@12) + GL_STUB(WindowPos3ivMESA, _gloffset_WindowPos3ivMESA, WindowPos3ivMESA@4) + GL_STUB(WindowPos3sMESA, _gloffset_WindowPos3sMESA, WindowPos3sMESA@12) + GL_STUB(WindowPos3svMESA, _gloffset_WindowPos3svMESA, WindowPos3svMESA@4) + GL_STUB(WindowPos4dMESA, _gloffset_WindowPos4dMESA, WindowPos4dMESA@32) + GL_STUB(WindowPos4dvMESA, _gloffset_WindowPos4dvMESA, WindowPos4dvMESA@4) + GL_STUB(WindowPos4fMESA, _gloffset_WindowPos4fMESA, WindowPos4fMESA@16) + GL_STUB(WindowPos4fvMESA, _gloffset_WindowPos4fvMESA, WindowPos4fvMESA@4) + GL_STUB(WindowPos4iMESA, _gloffset_WindowPos4iMESA, WindowPos4iMESA@16) + GL_STUB(WindowPos4ivMESA, _gloffset_WindowPos4ivMESA, WindowPos4ivMESA@4) + GL_STUB(WindowPos4sMESA, _gloffset_WindowPos4sMESA, WindowPos4sMESA@16) + GL_STUB(WindowPos4svMESA, _gloffset_WindowPos4svMESA, WindowPos4svMESA@4) + GL_STUB(_dispatch_stub_676, _gloffset_MultiModeDrawArraysIBM, _dispatch_stub_676@20) + HIDDEN(GL_PREFIX(_dispatch_stub_676, _dispatch_stub_676@20)) + GL_STUB(_dispatch_stub_677, _gloffset_MultiModeDrawElementsIBM, _dispatch_stub_677@24) + HIDDEN(GL_PREFIX(_dispatch_stub_677, _dispatch_stub_677@24)) + GL_STUB(_dispatch_stub_678, _gloffset_DeleteFencesNV, _dispatch_stub_678@8) + HIDDEN(GL_PREFIX(_dispatch_stub_678, _dispatch_stub_678@8)) + GL_STUB(_dispatch_stub_679, _gloffset_FinishFenceNV, _dispatch_stub_679@4) + HIDDEN(GL_PREFIX(_dispatch_stub_679, _dispatch_stub_679@4)) + GL_STUB(_dispatch_stub_680, _gloffset_GenFencesNV, _dispatch_stub_680@8) + HIDDEN(GL_PREFIX(_dispatch_stub_680, _dispatch_stub_680@8)) + GL_STUB(_dispatch_stub_681, _gloffset_GetFenceivNV, _dispatch_stub_681@12) + HIDDEN(GL_PREFIX(_dispatch_stub_681, _dispatch_stub_681@12)) + GL_STUB(_dispatch_stub_682, _gloffset_IsFenceNV, _dispatch_stub_682@4) + HIDDEN(GL_PREFIX(_dispatch_stub_682, _dispatch_stub_682@4)) + GL_STUB(_dispatch_stub_683, _gloffset_SetFenceNV, _dispatch_stub_683@8) + HIDDEN(GL_PREFIX(_dispatch_stub_683, _dispatch_stub_683@8)) + GL_STUB(_dispatch_stub_684, _gloffset_TestFenceNV, _dispatch_stub_684@4) + HIDDEN(GL_PREFIX(_dispatch_stub_684, _dispatch_stub_684@4)) + GL_STUB(AreProgramsResidentNV, _gloffset_AreProgramsResidentNV, AreProgramsResidentNV@12) + GL_STUB(BindProgramNV, _gloffset_BindProgramNV, BindProgramNV@8) + GL_STUB(DeleteProgramsNV, _gloffset_DeleteProgramsNV, DeleteProgramsNV@8) + GL_STUB(ExecuteProgramNV, _gloffset_ExecuteProgramNV, ExecuteProgramNV@12) + GL_STUB(GenProgramsNV, _gloffset_GenProgramsNV, GenProgramsNV@8) + GL_STUB(GetProgramParameterdvNV, _gloffset_GetProgramParameterdvNV, GetProgramParameterdvNV@16) + GL_STUB(GetProgramParameterfvNV, _gloffset_GetProgramParameterfvNV, GetProgramParameterfvNV@16) + GL_STUB(GetProgramStringNV, _gloffset_GetProgramStringNV, GetProgramStringNV@12) + GL_STUB(GetProgramivNV, _gloffset_GetProgramivNV, GetProgramivNV@12) + GL_STUB(GetTrackMatrixivNV, _gloffset_GetTrackMatrixivNV, GetTrackMatrixivNV@16) + GL_STUB(GetVertexAttribPointervNV, _gloffset_GetVertexAttribPointervNV, GetVertexAttribPointervNV@12) + GL_STUB(GetVertexAttribdvNV, _gloffset_GetVertexAttribdvNV, GetVertexAttribdvNV@12) + GL_STUB(GetVertexAttribfvNV, _gloffset_GetVertexAttribfvNV, GetVertexAttribfvNV@12) + GL_STUB(GetVertexAttribivNV, _gloffset_GetVertexAttribivNV, GetVertexAttribivNV@12) + GL_STUB(IsProgramNV, _gloffset_IsProgramNV, IsProgramNV@4) + GL_STUB(LoadProgramNV, _gloffset_LoadProgramNV, LoadProgramNV@16) + GL_STUB(ProgramParameters4dvNV, _gloffset_ProgramParameters4dvNV, ProgramParameters4dvNV@16) + GL_STUB(ProgramParameters4fvNV, _gloffset_ProgramParameters4fvNV, ProgramParameters4fvNV@16) + GL_STUB(RequestResidentProgramsNV, _gloffset_RequestResidentProgramsNV, RequestResidentProgramsNV@8) + GL_STUB(TrackMatrixNV, _gloffset_TrackMatrixNV, TrackMatrixNV@16) + GL_STUB(VertexAttrib1dNV, _gloffset_VertexAttrib1dNV, VertexAttrib1dNV@12) + GL_STUB(VertexAttrib1dvNV, _gloffset_VertexAttrib1dvNV, VertexAttrib1dvNV@8) + GL_STUB(VertexAttrib1fNV, _gloffset_VertexAttrib1fNV, VertexAttrib1fNV@8) + GL_STUB(VertexAttrib1fvNV, _gloffset_VertexAttrib1fvNV, VertexAttrib1fvNV@8) + GL_STUB(VertexAttrib1sNV, _gloffset_VertexAttrib1sNV, VertexAttrib1sNV@8) + GL_STUB(VertexAttrib1svNV, _gloffset_VertexAttrib1svNV, VertexAttrib1svNV@8) + GL_STUB(VertexAttrib2dNV, _gloffset_VertexAttrib2dNV, VertexAttrib2dNV@20) + GL_STUB(VertexAttrib2dvNV, _gloffset_VertexAttrib2dvNV, VertexAttrib2dvNV@8) + GL_STUB(VertexAttrib2fNV, _gloffset_VertexAttrib2fNV, VertexAttrib2fNV@12) + GL_STUB(VertexAttrib2fvNV, _gloffset_VertexAttrib2fvNV, VertexAttrib2fvNV@8) + GL_STUB(VertexAttrib2sNV, _gloffset_VertexAttrib2sNV, VertexAttrib2sNV@12) + GL_STUB(VertexAttrib2svNV, _gloffset_VertexAttrib2svNV, VertexAttrib2svNV@8) + GL_STUB(VertexAttrib3dNV, _gloffset_VertexAttrib3dNV, VertexAttrib3dNV@28) + GL_STUB(VertexAttrib3dvNV, _gloffset_VertexAttrib3dvNV, VertexAttrib3dvNV@8) + GL_STUB(VertexAttrib3fNV, _gloffset_VertexAttrib3fNV, VertexAttrib3fNV@16) + GL_STUB(VertexAttrib3fvNV, _gloffset_VertexAttrib3fvNV, VertexAttrib3fvNV@8) + GL_STUB(VertexAttrib3sNV, _gloffset_VertexAttrib3sNV, VertexAttrib3sNV@16) + GL_STUB(VertexAttrib3svNV, _gloffset_VertexAttrib3svNV, VertexAttrib3svNV@8) + GL_STUB(VertexAttrib4dNV, _gloffset_VertexAttrib4dNV, VertexAttrib4dNV@36) + GL_STUB(VertexAttrib4dvNV, _gloffset_VertexAttrib4dvNV, VertexAttrib4dvNV@8) + GL_STUB(VertexAttrib4fNV, _gloffset_VertexAttrib4fNV, VertexAttrib4fNV@20) + GL_STUB(VertexAttrib4fvNV, _gloffset_VertexAttrib4fvNV, VertexAttrib4fvNV@8) + GL_STUB(VertexAttrib4sNV, _gloffset_VertexAttrib4sNV, VertexAttrib4sNV@20) + GL_STUB(VertexAttrib4svNV, _gloffset_VertexAttrib4svNV, VertexAttrib4svNV@8) + GL_STUB(VertexAttrib4ubNV, _gloffset_VertexAttrib4ubNV, VertexAttrib4ubNV@20) + GL_STUB(VertexAttrib4ubvNV, _gloffset_VertexAttrib4ubvNV, VertexAttrib4ubvNV@8) + GL_STUB(VertexAttribPointerNV, _gloffset_VertexAttribPointerNV, VertexAttribPointerNV@20) + GL_STUB(VertexAttribs1dvNV, _gloffset_VertexAttribs1dvNV, VertexAttribs1dvNV@12) + GL_STUB(VertexAttribs1fvNV, _gloffset_VertexAttribs1fvNV, VertexAttribs1fvNV@12) + GL_STUB(VertexAttribs1svNV, _gloffset_VertexAttribs1svNV, VertexAttribs1svNV@12) + GL_STUB(VertexAttribs2dvNV, _gloffset_VertexAttribs2dvNV, VertexAttribs2dvNV@12) + GL_STUB(VertexAttribs2fvNV, _gloffset_VertexAttribs2fvNV, VertexAttribs2fvNV@12) + GL_STUB(VertexAttribs2svNV, _gloffset_VertexAttribs2svNV, VertexAttribs2svNV@12) + GL_STUB(VertexAttribs3dvNV, _gloffset_VertexAttribs3dvNV, VertexAttribs3dvNV@12) + GL_STUB(VertexAttribs3fvNV, _gloffset_VertexAttribs3fvNV, VertexAttribs3fvNV@12) + GL_STUB(VertexAttribs3svNV, _gloffset_VertexAttribs3svNV, VertexAttribs3svNV@12) + GL_STUB(VertexAttribs4dvNV, _gloffset_VertexAttribs4dvNV, VertexAttribs4dvNV@12) + GL_STUB(VertexAttribs4fvNV, _gloffset_VertexAttribs4fvNV, VertexAttribs4fvNV@12) + GL_STUB(VertexAttribs4svNV, _gloffset_VertexAttribs4svNV, VertexAttribs4svNV@12) + GL_STUB(VertexAttribs4ubvNV, _gloffset_VertexAttribs4ubvNV, VertexAttribs4ubvNV@12) + GL_STUB(GetTexBumpParameterfvATI, _gloffset_GetTexBumpParameterfvATI, GetTexBumpParameterfvATI@8) + GL_STUB(GetTexBumpParameterivATI, _gloffset_GetTexBumpParameterivATI, GetTexBumpParameterivATI@8) + GL_STUB(TexBumpParameterfvATI, _gloffset_TexBumpParameterfvATI, TexBumpParameterfvATI@8) + GL_STUB(TexBumpParameterivATI, _gloffset_TexBumpParameterivATI, TexBumpParameterivATI@8) + GL_STUB(AlphaFragmentOp1ATI, _gloffset_AlphaFragmentOp1ATI, AlphaFragmentOp1ATI@24) + GL_STUB(AlphaFragmentOp2ATI, _gloffset_AlphaFragmentOp2ATI, AlphaFragmentOp2ATI@36) + GL_STUB(AlphaFragmentOp3ATI, _gloffset_AlphaFragmentOp3ATI, AlphaFragmentOp3ATI@48) + GL_STUB(BeginFragmentShaderATI, _gloffset_BeginFragmentShaderATI, BeginFragmentShaderATI@0) + GL_STUB(BindFragmentShaderATI, _gloffset_BindFragmentShaderATI, BindFragmentShaderATI@4) + GL_STUB(ColorFragmentOp1ATI, _gloffset_ColorFragmentOp1ATI, ColorFragmentOp1ATI@28) + GL_STUB(ColorFragmentOp2ATI, _gloffset_ColorFragmentOp2ATI, ColorFragmentOp2ATI@40) + GL_STUB(ColorFragmentOp3ATI, _gloffset_ColorFragmentOp3ATI, ColorFragmentOp3ATI@52) + GL_STUB(DeleteFragmentShaderATI, _gloffset_DeleteFragmentShaderATI, DeleteFragmentShaderATI@4) + GL_STUB(EndFragmentShaderATI, _gloffset_EndFragmentShaderATI, EndFragmentShaderATI@0) + GL_STUB(GenFragmentShadersATI, _gloffset_GenFragmentShadersATI, GenFragmentShadersATI@4) + GL_STUB(PassTexCoordATI, _gloffset_PassTexCoordATI, PassTexCoordATI@12) + GL_STUB(SampleMapATI, _gloffset_SampleMapATI, SampleMapATI@12) + GL_STUB(SetFragmentShaderConstantATI, _gloffset_SetFragmentShaderConstantATI, SetFragmentShaderConstantATI@8) + GL_STUB(PointParameteriNV, _gloffset_PointParameteriNV, PointParameteriNV@8) + GL_STUB(PointParameterivNV, _gloffset_PointParameterivNV, PointParameterivNV@8) + GL_STUB(_dispatch_stub_765, _gloffset_ActiveStencilFaceEXT, _dispatch_stub_765@4) + HIDDEN(GL_PREFIX(_dispatch_stub_765, _dispatch_stub_765@4)) + GL_STUB(_dispatch_stub_766, _gloffset_BindVertexArrayAPPLE, _dispatch_stub_766@4) + HIDDEN(GL_PREFIX(_dispatch_stub_766, _dispatch_stub_766@4)) + GL_STUB(_dispatch_stub_767, _gloffset_DeleteVertexArraysAPPLE, _dispatch_stub_767@8) + HIDDEN(GL_PREFIX(_dispatch_stub_767, _dispatch_stub_767@8)) + GL_STUB(_dispatch_stub_768, _gloffset_GenVertexArraysAPPLE, _dispatch_stub_768@8) + HIDDEN(GL_PREFIX(_dispatch_stub_768, _dispatch_stub_768@8)) + GL_STUB(_dispatch_stub_769, _gloffset_IsVertexArrayAPPLE, _dispatch_stub_769@4) + HIDDEN(GL_PREFIX(_dispatch_stub_769, _dispatch_stub_769@4)) + GL_STUB(GetProgramNamedParameterdvNV, _gloffset_GetProgramNamedParameterdvNV, GetProgramNamedParameterdvNV@16) + GL_STUB(GetProgramNamedParameterfvNV, _gloffset_GetProgramNamedParameterfvNV, GetProgramNamedParameterfvNV@16) + GL_STUB(ProgramNamedParameter4dNV, _gloffset_ProgramNamedParameter4dNV, ProgramNamedParameter4dNV@44) + GL_STUB(ProgramNamedParameter4dvNV, _gloffset_ProgramNamedParameter4dvNV, ProgramNamedParameter4dvNV@16) + GL_STUB(ProgramNamedParameter4fNV, _gloffset_ProgramNamedParameter4fNV, ProgramNamedParameter4fNV@28) + GL_STUB(ProgramNamedParameter4fvNV, _gloffset_ProgramNamedParameter4fvNV, ProgramNamedParameter4fvNV@16) + GL_STUB(_dispatch_stub_776, _gloffset_DepthBoundsEXT, _dispatch_stub_776@16) + HIDDEN(GL_PREFIX(_dispatch_stub_776, _dispatch_stub_776@16)) + GL_STUB(_dispatch_stub_777, _gloffset_BlendEquationSeparateEXT, _dispatch_stub_777@8) + HIDDEN(GL_PREFIX(_dispatch_stub_777, _dispatch_stub_777@8)) + GL_STUB(BindFramebufferEXT, _gloffset_BindFramebufferEXT, BindFramebufferEXT@8) + GL_STUB(BindRenderbufferEXT, _gloffset_BindRenderbufferEXT, BindRenderbufferEXT@8) + GL_STUB(CheckFramebufferStatusEXT, _gloffset_CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4) + GL_STUB(DeleteFramebuffersEXT, _gloffset_DeleteFramebuffersEXT, DeleteFramebuffersEXT@8) + GL_STUB(DeleteRenderbuffersEXT, _gloffset_DeleteRenderbuffersEXT, DeleteRenderbuffersEXT@8) + GL_STUB(FramebufferRenderbufferEXT, _gloffset_FramebufferRenderbufferEXT, FramebufferRenderbufferEXT@16) + GL_STUB(FramebufferTexture1DEXT, _gloffset_FramebufferTexture1DEXT, FramebufferTexture1DEXT@20) + GL_STUB(FramebufferTexture2DEXT, _gloffset_FramebufferTexture2DEXT, FramebufferTexture2DEXT@20) + GL_STUB(FramebufferTexture3DEXT, _gloffset_FramebufferTexture3DEXT, FramebufferTexture3DEXT@24) + GL_STUB(GenFramebuffersEXT, _gloffset_GenFramebuffersEXT, GenFramebuffersEXT@8) + GL_STUB(GenRenderbuffersEXT, _gloffset_GenRenderbuffersEXT, GenRenderbuffersEXT@8) + GL_STUB(GenerateMipmapEXT, _gloffset_GenerateMipmapEXT, GenerateMipmapEXT@4) + GL_STUB(GetFramebufferAttachmentParameterivEXT, _gloffset_GetFramebufferAttachmentParameterivEXT, GetFramebufferAttachmentParameterivEXT@16) + GL_STUB(GetRenderbufferParameterivEXT, _gloffset_GetRenderbufferParameterivEXT, GetRenderbufferParameterivEXT@12) + GL_STUB(IsFramebufferEXT, _gloffset_IsFramebufferEXT, IsFramebufferEXT@4) + GL_STUB(IsRenderbufferEXT, _gloffset_IsRenderbufferEXT, IsRenderbufferEXT@4) + GL_STUB(RenderbufferStorageEXT, _gloffset_RenderbufferStorageEXT, RenderbufferStorageEXT@16) + GL_STUB(_dispatch_stub_795, _gloffset_BlitFramebufferEXT, _dispatch_stub_795@40) + HIDDEN(GL_PREFIX(_dispatch_stub_795, _dispatch_stub_795@40)) + GL_STUB(_dispatch_stub_796, _gloffset_BufferParameteriAPPLE, _dispatch_stub_796@12) + HIDDEN(GL_PREFIX(_dispatch_stub_796, _dispatch_stub_796@12)) + GL_STUB(_dispatch_stub_797, _gloffset_FlushMappedBufferRangeAPPLE, _dispatch_stub_797@12) + HIDDEN(GL_PREFIX(_dispatch_stub_797, _dispatch_stub_797@12)) + GL_STUB(FramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) + GL_STUB(ColorMaskIndexedEXT, _gloffset_ColorMaskIndexedEXT, ColorMaskIndexedEXT@20) + GL_STUB(DisableIndexedEXT, _gloffset_DisableIndexedEXT, DisableIndexedEXT@8) + GL_STUB(EnableIndexedEXT, _gloffset_EnableIndexedEXT, EnableIndexedEXT@8) + GL_STUB(GetBooleanIndexedvEXT, _gloffset_GetBooleanIndexedvEXT, GetBooleanIndexedvEXT@12) + GL_STUB(GetIntegerIndexedvEXT, _gloffset_GetIntegerIndexedvEXT, GetIntegerIndexedvEXT@12) + GL_STUB(IsEnabledIndexedEXT, _gloffset_IsEnabledIndexedEXT, IsEnabledIndexedEXT@8) + GL_STUB(BeginConditionalRenderNV, _gloffset_BeginConditionalRenderNV, BeginConditionalRenderNV@8) + GL_STUB(EndConditionalRenderNV, _gloffset_EndConditionalRenderNV, EndConditionalRenderNV@0) + GL_STUB(BeginTransformFeedbackEXT, _gloffset_BeginTransformFeedbackEXT, BeginTransformFeedbackEXT@4) + GL_STUB(BindBufferBaseEXT, _gloffset_BindBufferBaseEXT, BindBufferBaseEXT@12) + GL_STUB(BindBufferOffsetEXT, _gloffset_BindBufferOffsetEXT, BindBufferOffsetEXT@16) + GL_STUB(BindBufferRangeEXT, _gloffset_BindBufferRangeEXT, BindBufferRangeEXT@20) + GL_STUB(EndTransformFeedbackEXT, _gloffset_EndTransformFeedbackEXT, EndTransformFeedbackEXT@0) + GL_STUB(GetTransformFeedbackVaryingEXT, _gloffset_GetTransformFeedbackVaryingEXT, GetTransformFeedbackVaryingEXT@28) + GL_STUB(TransformFeedbackVaryingsEXT, _gloffset_TransformFeedbackVaryingsEXT, TransformFeedbackVaryingsEXT@16) + GL_STUB(ProvokingVertexEXT, _gloffset_ProvokingVertexEXT, ProvokingVertexEXT@4) + GL_STUB(_dispatch_stub_815, _gloffset_GetTexParameterPointervAPPLE, _dispatch_stub_815@12) + HIDDEN(GL_PREFIX(_dispatch_stub_815, _dispatch_stub_815@12)) + GL_STUB(_dispatch_stub_816, _gloffset_TextureRangeAPPLE, _dispatch_stub_816@12) + HIDDEN(GL_PREFIX(_dispatch_stub_816, _dispatch_stub_816@12)) + GL_STUB(GetObjectParameterivAPPLE, _gloffset_GetObjectParameterivAPPLE, GetObjectParameterivAPPLE@16) + GL_STUB(ObjectPurgeableAPPLE, _gloffset_ObjectPurgeableAPPLE, ObjectPurgeableAPPLE@12) + GL_STUB(ObjectUnpurgeableAPPLE, _gloffset_ObjectUnpurgeableAPPLE, ObjectUnpurgeableAPPLE@12) + GL_STUB(_dispatch_stub_820, _gloffset_StencilFuncSeparateATI, _dispatch_stub_820@16) + HIDDEN(GL_PREFIX(_dispatch_stub_820, _dispatch_stub_820@16)) + GL_STUB(_dispatch_stub_821, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_821@16) + HIDDEN(GL_PREFIX(_dispatch_stub_821, _dispatch_stub_821@16)) + GL_STUB(_dispatch_stub_822, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_822@16) + HIDDEN(GL_PREFIX(_dispatch_stub_822, _dispatch_stub_822@16)) + GL_STUB(_dispatch_stub_823, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_823@12) + HIDDEN(GL_PREFIX(_dispatch_stub_823, _dispatch_stub_823@12)) + GL_STUB(_dispatch_stub_824, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_824@12) + HIDDEN(GL_PREFIX(_dispatch_stub_824, _dispatch_stub_824@12)) + GL_STUB(EGLImageTargetRenderbufferStorageOES, _gloffset_EGLImageTargetRenderbufferStorageOES, EGLImageTargetRenderbufferStorageOES@8) + GL_STUB(EGLImageTargetTexture2DOES, _gloffset_EGLImageTargetTexture2DOES, EGLImageTargetTexture2DOES@8) + GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4) + GL_STUB_ALIAS(BindTextureEXT, _gloffset_BindTexture, BindTextureEXT@8, BindTexture, BindTexture@8) + GL_STUB_ALIAS(DrawArraysEXT, _gloffset_DrawArrays, DrawArraysEXT@12, DrawArrays, DrawArrays@12) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(AreTexturesResidentEXT, _gloffset_AreTexturesResident, AreTexturesResidentEXT@12, AreTexturesResident, AreTexturesResident@12) +#endif + GL_STUB_ALIAS(CopyTexImage1DEXT, _gloffset_CopyTexImage1D, CopyTexImage1DEXT@28, CopyTexImage1D, CopyTexImage1D@28) + GL_STUB_ALIAS(CopyTexImage2DEXT, _gloffset_CopyTexImage2D, CopyTexImage2DEXT@32, CopyTexImage2D, CopyTexImage2D@32) + GL_STUB_ALIAS(CopyTexSubImage1DEXT, _gloffset_CopyTexSubImage1D, CopyTexSubImage1DEXT@24, CopyTexSubImage1D, CopyTexSubImage1D@24) + GL_STUB_ALIAS(CopyTexSubImage2DEXT, _gloffset_CopyTexSubImage2D, CopyTexSubImage2DEXT@32, CopyTexSubImage2D, CopyTexSubImage2D@32) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(DeleteTexturesEXT, _gloffset_DeleteTextures, DeleteTexturesEXT@8, DeleteTextures, DeleteTextures@8) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(GenTexturesEXT, _gloffset_GenTextures, GenTexturesEXT@8, GenTextures, GenTextures@8) +#endif + GL_STUB_ALIAS(GetPointervEXT, _gloffset_GetPointerv, GetPointervEXT@8, GetPointerv, GetPointerv@8) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(IsTextureEXT, _gloffset_IsTexture, IsTextureEXT@4, IsTexture, IsTexture@4) +#endif + GL_STUB_ALIAS(PrioritizeTexturesEXT, _gloffset_PrioritizeTextures, PrioritizeTexturesEXT@12, PrioritizeTextures, PrioritizeTextures@12) + GL_STUB_ALIAS(TexSubImage1DEXT, _gloffset_TexSubImage1D, TexSubImage1DEXT@28, TexSubImage1D, TexSubImage1D@28) + GL_STUB_ALIAS(TexSubImage2DEXT, _gloffset_TexSubImage2D, TexSubImage2DEXT@36, TexSubImage2D, TexSubImage2D@36) + GL_STUB_ALIAS(BlendColorEXT, _gloffset_BlendColor, BlendColorEXT@16, BlendColor, BlendColor@16) + GL_STUB_ALIAS(BlendEquationEXT, _gloffset_BlendEquation, BlendEquationEXT@4, BlendEquation, BlendEquation@4) + GL_STUB_ALIAS(DrawRangeElementsEXT, _gloffset_DrawRangeElements, DrawRangeElementsEXT@24, DrawRangeElements, DrawRangeElements@24) + GL_STUB_ALIAS(ColorTableEXT, _gloffset_ColorTable, ColorTableEXT@24, ColorTable, ColorTable@24) +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(GetColorTableEXT, _gloffset_GetColorTable, GetColorTableEXT@16, GetColorTable, GetColorTable@16) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(GetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv, GetColorTableParameterfvEXT@12, GetColorTableParameterfv, GetColorTableParameterfv@12) +#endif +#ifndef GLX_INDIRECT_RENDERING + GL_STUB_ALIAS(GetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv, GetColorTableParameterivEXT@12, GetColorTableParameteriv, GetColorTableParameteriv@12) +#endif + GL_STUB_ALIAS(TexImage3DEXT, _gloffset_TexImage3D, TexImage3DEXT@40, TexImage3D, TexImage3D@40) + GL_STUB_ALIAS(TexSubImage3DEXT, _gloffset_TexSubImage3D, TexSubImage3DEXT@44, TexSubImage3D, TexSubImage3D@44) + GL_STUB_ALIAS(CopyTexSubImage3DEXT, _gloffset_CopyTexSubImage3D, CopyTexSubImage3DEXT@36, CopyTexSubImage3D, CopyTexSubImage3D@36) + GL_STUB_ALIAS(ActiveTexture, _gloffset_ActiveTextureARB, ActiveTexture@4, ActiveTextureARB, ActiveTextureARB@4) + GL_STUB_ALIAS(ClientActiveTexture, _gloffset_ClientActiveTextureARB, ClientActiveTexture@4, ClientActiveTextureARB, ClientActiveTextureARB@4) + GL_STUB_ALIAS(MultiTexCoord1d, _gloffset_MultiTexCoord1dARB, MultiTexCoord1d@12, MultiTexCoord1dARB, MultiTexCoord1dARB@12) + GL_STUB_ALIAS(MultiTexCoord1dv, _gloffset_MultiTexCoord1dvARB, MultiTexCoord1dv@8, MultiTexCoord1dvARB, MultiTexCoord1dvARB@8) + GL_STUB_ALIAS(MultiTexCoord1f, _gloffset_MultiTexCoord1fARB, MultiTexCoord1f@8, MultiTexCoord1fARB, MultiTexCoord1fARB@8) + GL_STUB_ALIAS(MultiTexCoord1fv, _gloffset_MultiTexCoord1fvARB, MultiTexCoord1fv@8, MultiTexCoord1fvARB, MultiTexCoord1fvARB@8) + GL_STUB_ALIAS(MultiTexCoord1i, _gloffset_MultiTexCoord1iARB, MultiTexCoord1i@8, MultiTexCoord1iARB, MultiTexCoord1iARB@8) + GL_STUB_ALIAS(MultiTexCoord1iv, _gloffset_MultiTexCoord1ivARB, MultiTexCoord1iv@8, MultiTexCoord1ivARB, MultiTexCoord1ivARB@8) + GL_STUB_ALIAS(MultiTexCoord1s, _gloffset_MultiTexCoord1sARB, MultiTexCoord1s@8, MultiTexCoord1sARB, MultiTexCoord1sARB@8) + GL_STUB_ALIAS(MultiTexCoord1sv, _gloffset_MultiTexCoord1svARB, MultiTexCoord1sv@8, MultiTexCoord1svARB, MultiTexCoord1svARB@8) + GL_STUB_ALIAS(MultiTexCoord2d, _gloffset_MultiTexCoord2dARB, MultiTexCoord2d@20, MultiTexCoord2dARB, MultiTexCoord2dARB@20) + GL_STUB_ALIAS(MultiTexCoord2dv, _gloffset_MultiTexCoord2dvARB, MultiTexCoord2dv@8, MultiTexCoord2dvARB, MultiTexCoord2dvARB@8) + GL_STUB_ALIAS(MultiTexCoord2f, _gloffset_MultiTexCoord2fARB, MultiTexCoord2f@12, MultiTexCoord2fARB, MultiTexCoord2fARB@12) + GL_STUB_ALIAS(MultiTexCoord2fv, _gloffset_MultiTexCoord2fvARB, MultiTexCoord2fv@8, MultiTexCoord2fvARB, MultiTexCoord2fvARB@8) + GL_STUB_ALIAS(MultiTexCoord2i, _gloffset_MultiTexCoord2iARB, MultiTexCoord2i@12, MultiTexCoord2iARB, MultiTexCoord2iARB@12) + GL_STUB_ALIAS(MultiTexCoord2iv, _gloffset_MultiTexCoord2ivARB, MultiTexCoord2iv@8, MultiTexCoord2ivARB, MultiTexCoord2ivARB@8) + GL_STUB_ALIAS(MultiTexCoord2s, _gloffset_MultiTexCoord2sARB, MultiTexCoord2s@12, MultiTexCoord2sARB, MultiTexCoord2sARB@12) + GL_STUB_ALIAS(MultiTexCoord2sv, _gloffset_MultiTexCoord2svARB, MultiTexCoord2sv@8, MultiTexCoord2svARB, MultiTexCoord2svARB@8) + GL_STUB_ALIAS(MultiTexCoord3d, _gloffset_MultiTexCoord3dARB, MultiTexCoord3d@28, MultiTexCoord3dARB, MultiTexCoord3dARB@28) + GL_STUB_ALIAS(MultiTexCoord3dv, _gloffset_MultiTexCoord3dvARB, MultiTexCoord3dv@8, MultiTexCoord3dvARB, MultiTexCoord3dvARB@8) + GL_STUB_ALIAS(MultiTexCoord3f, _gloffset_MultiTexCoord3fARB, MultiTexCoord3f@16, MultiTexCoord3fARB, MultiTexCoord3fARB@16) + GL_STUB_ALIAS(MultiTexCoord3fv, _gloffset_MultiTexCoord3fvARB, MultiTexCoord3fv@8, MultiTexCoord3fvARB, MultiTexCoord3fvARB@8) + GL_STUB_ALIAS(MultiTexCoord3i, _gloffset_MultiTexCoord3iARB, MultiTexCoord3i@16, MultiTexCoord3iARB, MultiTexCoord3iARB@16) + GL_STUB_ALIAS(MultiTexCoord3iv, _gloffset_MultiTexCoord3ivARB, MultiTexCoord3iv@8, MultiTexCoord3ivARB, MultiTexCoord3ivARB@8) + GL_STUB_ALIAS(MultiTexCoord3s, _gloffset_MultiTexCoord3sARB, MultiTexCoord3s@16, MultiTexCoord3sARB, MultiTexCoord3sARB@16) + GL_STUB_ALIAS(MultiTexCoord3sv, _gloffset_MultiTexCoord3svARB, MultiTexCoord3sv@8, MultiTexCoord3svARB, MultiTexCoord3svARB@8) + GL_STUB_ALIAS(MultiTexCoord4d, _gloffset_MultiTexCoord4dARB, MultiTexCoord4d@36, MultiTexCoord4dARB, MultiTexCoord4dARB@36) + GL_STUB_ALIAS(MultiTexCoord4dv, _gloffset_MultiTexCoord4dvARB, MultiTexCoord4dv@8, MultiTexCoord4dvARB, MultiTexCoord4dvARB@8) + GL_STUB_ALIAS(MultiTexCoord4f, _gloffset_MultiTexCoord4fARB, MultiTexCoord4f@20, MultiTexCoord4fARB, MultiTexCoord4fARB@20) + GL_STUB_ALIAS(MultiTexCoord4fv, _gloffset_MultiTexCoord4fvARB, MultiTexCoord4fv@8, MultiTexCoord4fvARB, MultiTexCoord4fvARB@8) + GL_STUB_ALIAS(MultiTexCoord4i, _gloffset_MultiTexCoord4iARB, MultiTexCoord4i@20, MultiTexCoord4iARB, MultiTexCoord4iARB@20) + GL_STUB_ALIAS(MultiTexCoord4iv, _gloffset_MultiTexCoord4ivARB, MultiTexCoord4iv@8, MultiTexCoord4ivARB, MultiTexCoord4ivARB@8) + GL_STUB_ALIAS(MultiTexCoord4s, _gloffset_MultiTexCoord4sARB, MultiTexCoord4s@20, MultiTexCoord4sARB, MultiTexCoord4sARB@20) + GL_STUB_ALIAS(MultiTexCoord4sv, _gloffset_MultiTexCoord4svARB, MultiTexCoord4sv@8, MultiTexCoord4svARB, MultiTexCoord4svARB@8) + GL_STUB_ALIAS(DrawArraysInstancedARB, _gloffset_DrawArraysInstanced, DrawArraysInstancedARB@16, DrawArraysInstanced, DrawArraysInstanced@16) + GL_STUB_ALIAS(DrawArraysInstancedEXT, _gloffset_DrawArraysInstanced, DrawArraysInstancedEXT@16, DrawArraysInstanced, DrawArraysInstanced@16) + GL_STUB_ALIAS(DrawElementsInstancedARB, _gloffset_DrawElementsInstanced, DrawElementsInstancedARB@20, DrawElementsInstanced, DrawElementsInstanced@20) + GL_STUB_ALIAS(DrawElementsInstancedEXT, _gloffset_DrawElementsInstanced, DrawElementsInstancedEXT@20, DrawElementsInstanced, DrawElementsInstanced@20) + GL_STUB_ALIAS(LoadTransposeMatrixd, _gloffset_LoadTransposeMatrixdARB, LoadTransposeMatrixd@4, LoadTransposeMatrixdARB, LoadTransposeMatrixdARB@4) + GL_STUB_ALIAS(LoadTransposeMatrixf, _gloffset_LoadTransposeMatrixfARB, LoadTransposeMatrixf@4, LoadTransposeMatrixfARB, LoadTransposeMatrixfARB@4) + GL_STUB_ALIAS(MultTransposeMatrixd, _gloffset_MultTransposeMatrixdARB, MultTransposeMatrixd@4, MultTransposeMatrixdARB, MultTransposeMatrixdARB@4) + GL_STUB_ALIAS(MultTransposeMatrixf, _gloffset_MultTransposeMatrixfARB, MultTransposeMatrixf@4, MultTransposeMatrixfARB, MultTransposeMatrixfARB@4) + GL_STUB_ALIAS(SampleCoverage, _gloffset_SampleCoverageARB, SampleCoverage@8, SampleCoverageARB, SampleCoverageARB@8) + GL_STUB_ALIAS(CompressedTexImage1D, _gloffset_CompressedTexImage1DARB, CompressedTexImage1D@28, CompressedTexImage1DARB, CompressedTexImage1DARB@28) + GL_STUB_ALIAS(CompressedTexImage2D, _gloffset_CompressedTexImage2DARB, CompressedTexImage2D@32, CompressedTexImage2DARB, CompressedTexImage2DARB@32) + GL_STUB_ALIAS(CompressedTexImage3D, _gloffset_CompressedTexImage3DARB, CompressedTexImage3D@36, CompressedTexImage3DARB, CompressedTexImage3DARB@36) + GL_STUB_ALIAS(CompressedTexSubImage1D, _gloffset_CompressedTexSubImage1DARB, CompressedTexSubImage1D@28, CompressedTexSubImage1DARB, CompressedTexSubImage1DARB@28) + GL_STUB_ALIAS(CompressedTexSubImage2D, _gloffset_CompressedTexSubImage2DARB, CompressedTexSubImage2D@36, CompressedTexSubImage2DARB, CompressedTexSubImage2DARB@36) + GL_STUB_ALIAS(CompressedTexSubImage3D, _gloffset_CompressedTexSubImage3DARB, CompressedTexSubImage3D@44, CompressedTexSubImage3DARB, CompressedTexSubImage3DARB@44) + GL_STUB_ALIAS(GetCompressedTexImage, _gloffset_GetCompressedTexImageARB, GetCompressedTexImage@12, GetCompressedTexImageARB, GetCompressedTexImageARB@12) + GL_STUB_ALIAS(DisableVertexAttribArray, _gloffset_DisableVertexAttribArrayARB, DisableVertexAttribArray@4, DisableVertexAttribArrayARB, DisableVertexAttribArrayARB@4) + GL_STUB_ALIAS(EnableVertexAttribArray, _gloffset_EnableVertexAttribArrayARB, EnableVertexAttribArray@4, EnableVertexAttribArrayARB, EnableVertexAttribArrayARB@4) + GL_STUB_ALIAS(GetVertexAttribdv, _gloffset_GetVertexAttribdvARB, GetVertexAttribdv@12, GetVertexAttribdvARB, GetVertexAttribdvARB@12) + GL_STUB_ALIAS(GetVertexAttribfv, _gloffset_GetVertexAttribfvARB, GetVertexAttribfv@12, GetVertexAttribfvARB, GetVertexAttribfvARB@12) + GL_STUB_ALIAS(GetVertexAttribiv, _gloffset_GetVertexAttribivARB, GetVertexAttribiv@12, GetVertexAttribivARB, GetVertexAttribivARB@12) + GL_STUB_ALIAS(ProgramParameter4dNV, _gloffset_ProgramEnvParameter4dARB, ProgramParameter4dNV@40, ProgramEnvParameter4dARB, ProgramEnvParameter4dARB@40) + GL_STUB_ALIAS(ProgramParameter4dvNV, _gloffset_ProgramEnvParameter4dvARB, ProgramParameter4dvNV@12, ProgramEnvParameter4dvARB, ProgramEnvParameter4dvARB@12) + GL_STUB_ALIAS(ProgramParameter4fNV, _gloffset_ProgramEnvParameter4fARB, ProgramParameter4fNV@24, ProgramEnvParameter4fARB, ProgramEnvParameter4fARB@24) + GL_STUB_ALIAS(ProgramParameter4fvNV, _gloffset_ProgramEnvParameter4fvARB, ProgramParameter4fvNV@12, ProgramEnvParameter4fvARB, ProgramEnvParameter4fvARB@12) + GL_STUB_ALIAS(VertexAttrib1d, _gloffset_VertexAttrib1dARB, VertexAttrib1d@12, VertexAttrib1dARB, VertexAttrib1dARB@12) + GL_STUB_ALIAS(VertexAttrib1dv, _gloffset_VertexAttrib1dvARB, VertexAttrib1dv@8, VertexAttrib1dvARB, VertexAttrib1dvARB@8) + GL_STUB_ALIAS(VertexAttrib1f, _gloffset_VertexAttrib1fARB, VertexAttrib1f@8, VertexAttrib1fARB, VertexAttrib1fARB@8) + GL_STUB_ALIAS(VertexAttrib1fv, _gloffset_VertexAttrib1fvARB, VertexAttrib1fv@8, VertexAttrib1fvARB, VertexAttrib1fvARB@8) + GL_STUB_ALIAS(VertexAttrib1s, _gloffset_VertexAttrib1sARB, VertexAttrib1s@8, VertexAttrib1sARB, VertexAttrib1sARB@8) + GL_STUB_ALIAS(VertexAttrib1sv, _gloffset_VertexAttrib1svARB, VertexAttrib1sv@8, VertexAttrib1svARB, VertexAttrib1svARB@8) + GL_STUB_ALIAS(VertexAttrib2d, _gloffset_VertexAttrib2dARB, VertexAttrib2d@20, VertexAttrib2dARB, VertexAttrib2dARB@20) + GL_STUB_ALIAS(VertexAttrib2dv, _gloffset_VertexAttrib2dvARB, VertexAttrib2dv@8, VertexAttrib2dvARB, VertexAttrib2dvARB@8) + GL_STUB_ALIAS(VertexAttrib2f, _gloffset_VertexAttrib2fARB, VertexAttrib2f@12, VertexAttrib2fARB, VertexAttrib2fARB@12) + GL_STUB_ALIAS(VertexAttrib2fv, _gloffset_VertexAttrib2fvARB, VertexAttrib2fv@8, VertexAttrib2fvARB, VertexAttrib2fvARB@8) + GL_STUB_ALIAS(VertexAttrib2s, _gloffset_VertexAttrib2sARB, VertexAttrib2s@12, VertexAttrib2sARB, VertexAttrib2sARB@12) + GL_STUB_ALIAS(VertexAttrib2sv, _gloffset_VertexAttrib2svARB, VertexAttrib2sv@8, VertexAttrib2svARB, VertexAttrib2svARB@8) + GL_STUB_ALIAS(VertexAttrib3d, _gloffset_VertexAttrib3dARB, VertexAttrib3d@28, VertexAttrib3dARB, VertexAttrib3dARB@28) + GL_STUB_ALIAS(VertexAttrib3dv, _gloffset_VertexAttrib3dvARB, VertexAttrib3dv@8, VertexAttrib3dvARB, VertexAttrib3dvARB@8) + GL_STUB_ALIAS(VertexAttrib3f, _gloffset_VertexAttrib3fARB, VertexAttrib3f@16, VertexAttrib3fARB, VertexAttrib3fARB@16) + GL_STUB_ALIAS(VertexAttrib3fv, _gloffset_VertexAttrib3fvARB, VertexAttrib3fv@8, VertexAttrib3fvARB, VertexAttrib3fvARB@8) + GL_STUB_ALIAS(VertexAttrib3s, _gloffset_VertexAttrib3sARB, VertexAttrib3s@16, VertexAttrib3sARB, VertexAttrib3sARB@16) + GL_STUB_ALIAS(VertexAttrib3sv, _gloffset_VertexAttrib3svARB, VertexAttrib3sv@8, VertexAttrib3svARB, VertexAttrib3svARB@8) + GL_STUB_ALIAS(VertexAttrib4Nbv, _gloffset_VertexAttrib4NbvARB, VertexAttrib4Nbv@8, VertexAttrib4NbvARB, VertexAttrib4NbvARB@8) + GL_STUB_ALIAS(VertexAttrib4Niv, _gloffset_VertexAttrib4NivARB, VertexAttrib4Niv@8, VertexAttrib4NivARB, VertexAttrib4NivARB@8) + GL_STUB_ALIAS(VertexAttrib4Nsv, _gloffset_VertexAttrib4NsvARB, VertexAttrib4Nsv@8, VertexAttrib4NsvARB, VertexAttrib4NsvARB@8) + GL_STUB_ALIAS(VertexAttrib4Nub, _gloffset_VertexAttrib4NubARB, VertexAttrib4Nub@20, VertexAttrib4NubARB, VertexAttrib4NubARB@20) + GL_STUB_ALIAS(VertexAttrib4Nubv, _gloffset_VertexAttrib4NubvARB, VertexAttrib4Nubv@8, VertexAttrib4NubvARB, VertexAttrib4NubvARB@8) + GL_STUB_ALIAS(VertexAttrib4Nuiv, _gloffset_VertexAttrib4NuivARB, VertexAttrib4Nuiv@8, VertexAttrib4NuivARB, VertexAttrib4NuivARB@8) + GL_STUB_ALIAS(VertexAttrib4Nusv, _gloffset_VertexAttrib4NusvARB, VertexAttrib4Nusv@8, VertexAttrib4NusvARB, VertexAttrib4NusvARB@8) + GL_STUB_ALIAS(VertexAttrib4bv, _gloffset_VertexAttrib4bvARB, VertexAttrib4bv@8, VertexAttrib4bvARB, VertexAttrib4bvARB@8) + GL_STUB_ALIAS(VertexAttrib4d, _gloffset_VertexAttrib4dARB, VertexAttrib4d@36, VertexAttrib4dARB, VertexAttrib4dARB@36) + GL_STUB_ALIAS(VertexAttrib4dv, _gloffset_VertexAttrib4dvARB, VertexAttrib4dv@8, VertexAttrib4dvARB, VertexAttrib4dvARB@8) + GL_STUB_ALIAS(VertexAttrib4f, _gloffset_VertexAttrib4fARB, VertexAttrib4f@20, VertexAttrib4fARB, VertexAttrib4fARB@20) + GL_STUB_ALIAS(VertexAttrib4fv, _gloffset_VertexAttrib4fvARB, VertexAttrib4fv@8, VertexAttrib4fvARB, VertexAttrib4fvARB@8) + GL_STUB_ALIAS(VertexAttrib4iv, _gloffset_VertexAttrib4ivARB, VertexAttrib4iv@8, VertexAttrib4ivARB, VertexAttrib4ivARB@8) + GL_STUB_ALIAS(VertexAttrib4s, _gloffset_VertexAttrib4sARB, VertexAttrib4s@20, VertexAttrib4sARB, VertexAttrib4sARB@20) + GL_STUB_ALIAS(VertexAttrib4sv, _gloffset_VertexAttrib4svARB, VertexAttrib4sv@8, VertexAttrib4svARB, VertexAttrib4svARB@8) + GL_STUB_ALIAS(VertexAttrib4ubv, _gloffset_VertexAttrib4ubvARB, VertexAttrib4ubv@8, VertexAttrib4ubvARB, VertexAttrib4ubvARB@8) + GL_STUB_ALIAS(VertexAttrib4uiv, _gloffset_VertexAttrib4uivARB, VertexAttrib4uiv@8, VertexAttrib4uivARB, VertexAttrib4uivARB@8) + GL_STUB_ALIAS(VertexAttrib4usv, _gloffset_VertexAttrib4usvARB, VertexAttrib4usv@8, VertexAttrib4usvARB, VertexAttrib4usvARB@8) + GL_STUB_ALIAS(VertexAttribPointer, _gloffset_VertexAttribPointerARB, VertexAttribPointer@24, VertexAttribPointerARB, VertexAttribPointerARB@24) + GL_STUB_ALIAS(BindBuffer, _gloffset_BindBufferARB, BindBuffer@8, BindBufferARB, BindBufferARB@8) + GL_STUB_ALIAS(BufferData, _gloffset_BufferDataARB, BufferData@16, BufferDataARB, BufferDataARB@16) + GL_STUB_ALIAS(BufferSubData, _gloffset_BufferSubDataARB, BufferSubData@16, BufferSubDataARB, BufferSubDataARB@16) + GL_STUB_ALIAS(DeleteBuffers, _gloffset_DeleteBuffersARB, DeleteBuffers@8, DeleteBuffersARB, DeleteBuffersARB@8) + GL_STUB_ALIAS(GenBuffers, _gloffset_GenBuffersARB, GenBuffers@8, GenBuffersARB, GenBuffersARB@8) + GL_STUB_ALIAS(GetBufferParameteriv, _gloffset_GetBufferParameterivARB, GetBufferParameteriv@12, GetBufferParameterivARB, GetBufferParameterivARB@12) + GL_STUB_ALIAS(GetBufferPointerv, _gloffset_GetBufferPointervARB, GetBufferPointerv@12, GetBufferPointervARB, GetBufferPointervARB@12) + GL_STUB_ALIAS(GetBufferSubData, _gloffset_GetBufferSubDataARB, GetBufferSubData@16, GetBufferSubDataARB, GetBufferSubDataARB@16) + GL_STUB_ALIAS(IsBuffer, _gloffset_IsBufferARB, IsBuffer@4, IsBufferARB, IsBufferARB@4) + GL_STUB_ALIAS(MapBuffer, _gloffset_MapBufferARB, MapBuffer@8, MapBufferARB, MapBufferARB@8) + GL_STUB_ALIAS(UnmapBuffer, _gloffset_UnmapBufferARB, UnmapBuffer@4, UnmapBufferARB, UnmapBufferARB@4) + GL_STUB_ALIAS(BeginQuery, _gloffset_BeginQueryARB, BeginQuery@8, BeginQueryARB, BeginQueryARB@8) + GL_STUB_ALIAS(DeleteQueries, _gloffset_DeleteQueriesARB, DeleteQueries@8, DeleteQueriesARB, DeleteQueriesARB@8) + GL_STUB_ALIAS(EndQuery, _gloffset_EndQueryARB, EndQuery@4, EndQueryARB, EndQueryARB@4) + GL_STUB_ALIAS(GenQueries, _gloffset_GenQueriesARB, GenQueries@8, GenQueriesARB, GenQueriesARB@8) + GL_STUB_ALIAS(GetQueryObjectiv, _gloffset_GetQueryObjectivARB, GetQueryObjectiv@12, GetQueryObjectivARB, GetQueryObjectivARB@12) + GL_STUB_ALIAS(GetQueryObjectuiv, _gloffset_GetQueryObjectuivARB, GetQueryObjectuiv@12, GetQueryObjectuivARB, GetQueryObjectuivARB@12) + GL_STUB_ALIAS(GetQueryiv, _gloffset_GetQueryivARB, GetQueryiv@12, GetQueryivARB, GetQueryivARB@12) + GL_STUB_ALIAS(IsQuery, _gloffset_IsQueryARB, IsQuery@4, IsQueryARB, IsQueryARB@4) + GL_STUB_ALIAS(CompileShader, _gloffset_CompileShaderARB, CompileShader@4, CompileShaderARB, CompileShaderARB@4) + GL_STUB_ALIAS(GetActiveUniform, _gloffset_GetActiveUniformARB, GetActiveUniform@28, GetActiveUniformARB, GetActiveUniformARB@28) + GL_STUB_ALIAS(GetShaderSource, _gloffset_GetShaderSourceARB, GetShaderSource@16, GetShaderSourceARB, GetShaderSourceARB@16) + GL_STUB_ALIAS(GetUniformLocation, _gloffset_GetUniformLocationARB, GetUniformLocation@8, GetUniformLocationARB, GetUniformLocationARB@8) + GL_STUB_ALIAS(GetUniformfv, _gloffset_GetUniformfvARB, GetUniformfv@12, GetUniformfvARB, GetUniformfvARB@12) + GL_STUB_ALIAS(GetUniformiv, _gloffset_GetUniformivARB, GetUniformiv@12, GetUniformivARB, GetUniformivARB@12) + GL_STUB_ALIAS(LinkProgram, _gloffset_LinkProgramARB, LinkProgram@4, LinkProgramARB, LinkProgramARB@4) + GL_STUB_ALIAS(ShaderSource, _gloffset_ShaderSourceARB, ShaderSource@16, ShaderSourceARB, ShaderSourceARB@16) + GL_STUB_ALIAS(Uniform1f, _gloffset_Uniform1fARB, Uniform1f@8, Uniform1fARB, Uniform1fARB@8) + GL_STUB_ALIAS(Uniform1fv, _gloffset_Uniform1fvARB, Uniform1fv@12, Uniform1fvARB, Uniform1fvARB@12) + GL_STUB_ALIAS(Uniform1i, _gloffset_Uniform1iARB, Uniform1i@8, Uniform1iARB, Uniform1iARB@8) + GL_STUB_ALIAS(Uniform1iv, _gloffset_Uniform1ivARB, Uniform1iv@12, Uniform1ivARB, Uniform1ivARB@12) + GL_STUB_ALIAS(Uniform2f, _gloffset_Uniform2fARB, Uniform2f@12, Uniform2fARB, Uniform2fARB@12) + GL_STUB_ALIAS(Uniform2fv, _gloffset_Uniform2fvARB, Uniform2fv@12, Uniform2fvARB, Uniform2fvARB@12) + GL_STUB_ALIAS(Uniform2i, _gloffset_Uniform2iARB, Uniform2i@12, Uniform2iARB, Uniform2iARB@12) + GL_STUB_ALIAS(Uniform2iv, _gloffset_Uniform2ivARB, Uniform2iv@12, Uniform2ivARB, Uniform2ivARB@12) + GL_STUB_ALIAS(Uniform3f, _gloffset_Uniform3fARB, Uniform3f@16, Uniform3fARB, Uniform3fARB@16) + GL_STUB_ALIAS(Uniform3fv, _gloffset_Uniform3fvARB, Uniform3fv@12, Uniform3fvARB, Uniform3fvARB@12) + GL_STUB_ALIAS(Uniform3i, _gloffset_Uniform3iARB, Uniform3i@16, Uniform3iARB, Uniform3iARB@16) + GL_STUB_ALIAS(Uniform3iv, _gloffset_Uniform3ivARB, Uniform3iv@12, Uniform3ivARB, Uniform3ivARB@12) + GL_STUB_ALIAS(Uniform4f, _gloffset_Uniform4fARB, Uniform4f@20, Uniform4fARB, Uniform4fARB@20) + GL_STUB_ALIAS(Uniform4fv, _gloffset_Uniform4fvARB, Uniform4fv@12, Uniform4fvARB, Uniform4fvARB@12) + GL_STUB_ALIAS(Uniform4i, _gloffset_Uniform4iARB, Uniform4i@20, Uniform4iARB, Uniform4iARB@20) + GL_STUB_ALIAS(Uniform4iv, _gloffset_Uniform4ivARB, Uniform4iv@12, Uniform4ivARB, Uniform4ivARB@12) + GL_STUB_ALIAS(UniformMatrix2fv, _gloffset_UniformMatrix2fvARB, UniformMatrix2fv@16, UniformMatrix2fvARB, UniformMatrix2fvARB@16) + GL_STUB_ALIAS(UniformMatrix3fv, _gloffset_UniformMatrix3fvARB, UniformMatrix3fv@16, UniformMatrix3fvARB, UniformMatrix3fvARB@16) + GL_STUB_ALIAS(UniformMatrix4fv, _gloffset_UniformMatrix4fvARB, UniformMatrix4fv@16, UniformMatrix4fvARB, UniformMatrix4fvARB@16) + GL_STUB_ALIAS(UseProgram, _gloffset_UseProgramObjectARB, UseProgram@4, UseProgramObjectARB, UseProgramObjectARB@4) + GL_STUB_ALIAS(ValidateProgram, _gloffset_ValidateProgramARB, ValidateProgram@4, ValidateProgramARB, ValidateProgramARB@4) + GL_STUB_ALIAS(BindAttribLocation, _gloffset_BindAttribLocationARB, BindAttribLocation@12, BindAttribLocationARB, BindAttribLocationARB@12) + GL_STUB_ALIAS(GetActiveAttrib, _gloffset_GetActiveAttribARB, GetActiveAttrib@28, GetActiveAttribARB, GetActiveAttribARB@28) + GL_STUB_ALIAS(GetAttribLocation, _gloffset_GetAttribLocationARB, GetAttribLocation@8, GetAttribLocationARB, GetAttribLocationARB@8) + GL_STUB_ALIAS(DrawBuffers, _gloffset_DrawBuffersARB, DrawBuffers@8, DrawBuffersARB, DrawBuffersARB@8) + GL_STUB_ALIAS(DrawBuffersATI, _gloffset_DrawBuffersARB, DrawBuffersATI@8, DrawBuffersARB, DrawBuffersARB@8) + GL_STUB_ALIAS(RenderbufferStorageMultisampleEXT, _gloffset_RenderbufferStorageMultisample, RenderbufferStorageMultisampleEXT@20, RenderbufferStorageMultisample, RenderbufferStorageMultisample@20) + GL_STUB_ALIAS(PointParameterf, _gloffset_PointParameterfEXT, PointParameterf@8, PointParameterfEXT, PointParameterfEXT@8) + GL_STUB_ALIAS(PointParameterfARB, _gloffset_PointParameterfEXT, PointParameterfARB@8, PointParameterfEXT, PointParameterfEXT@8) + GL_STUB_ALIAS(PointParameterfv, _gloffset_PointParameterfvEXT, PointParameterfv@8, PointParameterfvEXT, PointParameterfvEXT@8) + GL_STUB_ALIAS(PointParameterfvARB, _gloffset_PointParameterfvEXT, PointParameterfvARB@8, PointParameterfvEXT, PointParameterfvEXT@8) + GL_STUB_ALIAS(SecondaryColor3b, _gloffset_SecondaryColor3bEXT, SecondaryColor3b@12, SecondaryColor3bEXT, SecondaryColor3bEXT@12) + GL_STUB_ALIAS(SecondaryColor3bv, _gloffset_SecondaryColor3bvEXT, SecondaryColor3bv@4, SecondaryColor3bvEXT, SecondaryColor3bvEXT@4) + GL_STUB_ALIAS(SecondaryColor3d, _gloffset_SecondaryColor3dEXT, SecondaryColor3d@24, SecondaryColor3dEXT, SecondaryColor3dEXT@24) + GL_STUB_ALIAS(SecondaryColor3dv, _gloffset_SecondaryColor3dvEXT, SecondaryColor3dv@4, SecondaryColor3dvEXT, SecondaryColor3dvEXT@4) + GL_STUB_ALIAS(SecondaryColor3f, _gloffset_SecondaryColor3fEXT, SecondaryColor3f@12, SecondaryColor3fEXT, SecondaryColor3fEXT@12) + GL_STUB_ALIAS(SecondaryColor3fv, _gloffset_SecondaryColor3fvEXT, SecondaryColor3fv@4, SecondaryColor3fvEXT, SecondaryColor3fvEXT@4) + GL_STUB_ALIAS(SecondaryColor3i, _gloffset_SecondaryColor3iEXT, SecondaryColor3i@12, SecondaryColor3iEXT, SecondaryColor3iEXT@12) + GL_STUB_ALIAS(SecondaryColor3iv, _gloffset_SecondaryColor3ivEXT, SecondaryColor3iv@4, SecondaryColor3ivEXT, SecondaryColor3ivEXT@4) + GL_STUB_ALIAS(SecondaryColor3s, _gloffset_SecondaryColor3sEXT, SecondaryColor3s@12, SecondaryColor3sEXT, SecondaryColor3sEXT@12) + GL_STUB_ALIAS(SecondaryColor3sv, _gloffset_SecondaryColor3svEXT, SecondaryColor3sv@4, SecondaryColor3svEXT, SecondaryColor3svEXT@4) + GL_STUB_ALIAS(SecondaryColor3ub, _gloffset_SecondaryColor3ubEXT, SecondaryColor3ub@12, SecondaryColor3ubEXT, SecondaryColor3ubEXT@12) + GL_STUB_ALIAS(SecondaryColor3ubv, _gloffset_SecondaryColor3ubvEXT, SecondaryColor3ubv@4, SecondaryColor3ubvEXT, SecondaryColor3ubvEXT@4) + GL_STUB_ALIAS(SecondaryColor3ui, _gloffset_SecondaryColor3uiEXT, SecondaryColor3ui@12, SecondaryColor3uiEXT, SecondaryColor3uiEXT@12) + GL_STUB_ALIAS(SecondaryColor3uiv, _gloffset_SecondaryColor3uivEXT, SecondaryColor3uiv@4, SecondaryColor3uivEXT, SecondaryColor3uivEXT@4) + GL_STUB_ALIAS(SecondaryColor3us, _gloffset_SecondaryColor3usEXT, SecondaryColor3us@12, SecondaryColor3usEXT, SecondaryColor3usEXT@12) + GL_STUB_ALIAS(SecondaryColor3usv, _gloffset_SecondaryColor3usvEXT, SecondaryColor3usv@4, SecondaryColor3usvEXT, SecondaryColor3usvEXT@4) + GL_STUB_ALIAS(SecondaryColorPointer, _gloffset_SecondaryColorPointerEXT, SecondaryColorPointer@16, SecondaryColorPointerEXT, SecondaryColorPointerEXT@16) + GL_STUB_ALIAS(MultiDrawArrays, _gloffset_MultiDrawArraysEXT, MultiDrawArrays@16, MultiDrawArraysEXT, MultiDrawArraysEXT@16) + GL_STUB_ALIAS(MultiDrawElements, _gloffset_MultiDrawElementsEXT, MultiDrawElements@20, MultiDrawElementsEXT, MultiDrawElementsEXT@20) + GL_STUB_ALIAS(FogCoordPointer, _gloffset_FogCoordPointerEXT, FogCoordPointer@12, FogCoordPointerEXT, FogCoordPointerEXT@12) + GL_STUB_ALIAS(FogCoordd, _gloffset_FogCoorddEXT, FogCoordd@8, FogCoorddEXT, FogCoorddEXT@8) + GL_STUB_ALIAS(FogCoorddv, _gloffset_FogCoorddvEXT, FogCoorddv@4, FogCoorddvEXT, FogCoorddvEXT@4) + GL_STUB_ALIAS(FogCoordf, _gloffset_FogCoordfEXT, FogCoordf@4, FogCoordfEXT, FogCoordfEXT@4) + GL_STUB_ALIAS(FogCoordfv, _gloffset_FogCoordfvEXT, FogCoordfv@4, FogCoordfvEXT, FogCoordfvEXT@4) + GL_STUB_ALIAS(BlendFuncSeparate, _gloffset_BlendFuncSeparateEXT, BlendFuncSeparate@16, BlendFuncSeparateEXT, BlendFuncSeparateEXT@16) + GL_STUB_ALIAS(WindowPos2d, _gloffset_WindowPos2dMESA, WindowPos2d@16, WindowPos2dMESA, WindowPos2dMESA@16) + GL_STUB_ALIAS(WindowPos2dARB, _gloffset_WindowPos2dMESA, WindowPos2dARB@16, WindowPos2dMESA, WindowPos2dMESA@16) + GL_STUB_ALIAS(WindowPos2dv, _gloffset_WindowPos2dvMESA, WindowPos2dv@4, WindowPos2dvMESA, WindowPos2dvMESA@4) + GL_STUB_ALIAS(WindowPos2dvARB, _gloffset_WindowPos2dvMESA, WindowPos2dvARB@4, WindowPos2dvMESA, WindowPos2dvMESA@4) + GL_STUB_ALIAS(WindowPos2f, _gloffset_WindowPos2fMESA, WindowPos2f@8, WindowPos2fMESA, WindowPos2fMESA@8) + GL_STUB_ALIAS(WindowPos2fARB, _gloffset_WindowPos2fMESA, WindowPos2fARB@8, WindowPos2fMESA, WindowPos2fMESA@8) + GL_STUB_ALIAS(WindowPos2fv, _gloffset_WindowPos2fvMESA, WindowPos2fv@4, WindowPos2fvMESA, WindowPos2fvMESA@4) + GL_STUB_ALIAS(WindowPos2fvARB, _gloffset_WindowPos2fvMESA, WindowPos2fvARB@4, WindowPos2fvMESA, WindowPos2fvMESA@4) + GL_STUB_ALIAS(WindowPos2i, _gloffset_WindowPos2iMESA, WindowPos2i@8, WindowPos2iMESA, WindowPos2iMESA@8) + GL_STUB_ALIAS(WindowPos2iARB, _gloffset_WindowPos2iMESA, WindowPos2iARB@8, WindowPos2iMESA, WindowPos2iMESA@8) + GL_STUB_ALIAS(WindowPos2iv, _gloffset_WindowPos2ivMESA, WindowPos2iv@4, WindowPos2ivMESA, WindowPos2ivMESA@4) + GL_STUB_ALIAS(WindowPos2ivARB, _gloffset_WindowPos2ivMESA, WindowPos2ivARB@4, WindowPos2ivMESA, WindowPos2ivMESA@4) + GL_STUB_ALIAS(WindowPos2s, _gloffset_WindowPos2sMESA, WindowPos2s@8, WindowPos2sMESA, WindowPos2sMESA@8) + GL_STUB_ALIAS(WindowPos2sARB, _gloffset_WindowPos2sMESA, WindowPos2sARB@8, WindowPos2sMESA, WindowPos2sMESA@8) + GL_STUB_ALIAS(WindowPos2sv, _gloffset_WindowPos2svMESA, WindowPos2sv@4, WindowPos2svMESA, WindowPos2svMESA@4) + GL_STUB_ALIAS(WindowPos2svARB, _gloffset_WindowPos2svMESA, WindowPos2svARB@4, WindowPos2svMESA, WindowPos2svMESA@4) + GL_STUB_ALIAS(WindowPos3d, _gloffset_WindowPos3dMESA, WindowPos3d@24, WindowPos3dMESA, WindowPos3dMESA@24) + GL_STUB_ALIAS(WindowPos3dARB, _gloffset_WindowPos3dMESA, WindowPos3dARB@24, WindowPos3dMESA, WindowPos3dMESA@24) + GL_STUB_ALIAS(WindowPos3dv, _gloffset_WindowPos3dvMESA, WindowPos3dv@4, WindowPos3dvMESA, WindowPos3dvMESA@4) + GL_STUB_ALIAS(WindowPos3dvARB, _gloffset_WindowPos3dvMESA, WindowPos3dvARB@4, WindowPos3dvMESA, WindowPos3dvMESA@4) + GL_STUB_ALIAS(WindowPos3f, _gloffset_WindowPos3fMESA, WindowPos3f@12, WindowPos3fMESA, WindowPos3fMESA@12) + GL_STUB_ALIAS(WindowPos3fARB, _gloffset_WindowPos3fMESA, WindowPos3fARB@12, WindowPos3fMESA, WindowPos3fMESA@12) + GL_STUB_ALIAS(WindowPos3fv, _gloffset_WindowPos3fvMESA, WindowPos3fv@4, WindowPos3fvMESA, WindowPos3fvMESA@4) + GL_STUB_ALIAS(WindowPos3fvARB, _gloffset_WindowPos3fvMESA, WindowPos3fvARB@4, WindowPos3fvMESA, WindowPos3fvMESA@4) + GL_STUB_ALIAS(WindowPos3i, _gloffset_WindowPos3iMESA, WindowPos3i@12, WindowPos3iMESA, WindowPos3iMESA@12) + GL_STUB_ALIAS(WindowPos3iARB, _gloffset_WindowPos3iMESA, WindowPos3iARB@12, WindowPos3iMESA, WindowPos3iMESA@12) + GL_STUB_ALIAS(WindowPos3iv, _gloffset_WindowPos3ivMESA, WindowPos3iv@4, WindowPos3ivMESA, WindowPos3ivMESA@4) + GL_STUB_ALIAS(WindowPos3ivARB, _gloffset_WindowPos3ivMESA, WindowPos3ivARB@4, WindowPos3ivMESA, WindowPos3ivMESA@4) + GL_STUB_ALIAS(WindowPos3s, _gloffset_WindowPos3sMESA, WindowPos3s@12, WindowPos3sMESA, WindowPos3sMESA@12) + GL_STUB_ALIAS(WindowPos3sARB, _gloffset_WindowPos3sMESA, WindowPos3sARB@12, WindowPos3sMESA, WindowPos3sMESA@12) + GL_STUB_ALIAS(WindowPos3sv, _gloffset_WindowPos3svMESA, WindowPos3sv@4, WindowPos3svMESA, WindowPos3svMESA@4) + GL_STUB_ALIAS(WindowPos3svARB, _gloffset_WindowPos3svMESA, WindowPos3svARB@4, WindowPos3svMESA, WindowPos3svMESA@4) + GL_STUB_ALIAS(BindProgramARB, _gloffset_BindProgramNV, BindProgramARB@8, BindProgramNV, BindProgramNV@8) + GL_STUB_ALIAS(DeleteProgramsARB, _gloffset_DeleteProgramsNV, DeleteProgramsARB@8, DeleteProgramsNV, DeleteProgramsNV@8) + GL_STUB_ALIAS(GenProgramsARB, _gloffset_GenProgramsNV, GenProgramsARB@8, GenProgramsNV, GenProgramsNV@8) + GL_STUB_ALIAS(GetVertexAttribPointerv, _gloffset_GetVertexAttribPointervNV, GetVertexAttribPointerv@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12) + GL_STUB_ALIAS(GetVertexAttribPointervARB, _gloffset_GetVertexAttribPointervNV, GetVertexAttribPointervARB@12, GetVertexAttribPointervNV, GetVertexAttribPointervNV@12) + GL_STUB_ALIAS(IsProgramARB, _gloffset_IsProgramNV, IsProgramARB@4, IsProgramNV, IsProgramNV@4) + GL_STUB_ALIAS(PointParameteri, _gloffset_PointParameteriNV, PointParameteri@8, PointParameteriNV, PointParameteriNV@8) + GL_STUB_ALIAS(PointParameteriv, _gloffset_PointParameterivNV, PointParameteriv@8, PointParameterivNV, PointParameterivNV@8) + GL_STUB_ALIAS(DeleteVertexArrays, _gloffset_DeleteVertexArraysAPPLE, DeleteVertexArrays@8, _dispatch_stub_767, _dispatch_stub_767@8) + GL_STUB_ALIAS(IsVertexArray, _gloffset_IsVertexArrayAPPLE, IsVertexArray@4, _dispatch_stub_769, _dispatch_stub_769@4) + GL_STUB_ALIAS(BlendEquationSeparate, _gloffset_BlendEquationSeparateEXT, BlendEquationSeparate@8, _dispatch_stub_777, _dispatch_stub_777@8) + GL_STUB_ALIAS(BindFramebuffer, _gloffset_BindFramebufferEXT, BindFramebuffer@8, BindFramebufferEXT, BindFramebufferEXT@8) + GL_STUB_ALIAS(BindRenderbuffer, _gloffset_BindRenderbufferEXT, BindRenderbuffer@8, BindRenderbufferEXT, BindRenderbufferEXT@8) + GL_STUB_ALIAS(CheckFramebufferStatus, _gloffset_CheckFramebufferStatusEXT, CheckFramebufferStatus@4, CheckFramebufferStatusEXT, CheckFramebufferStatusEXT@4) + GL_STUB_ALIAS(DeleteFramebuffers, _gloffset_DeleteFramebuffersEXT, DeleteFramebuffers@8, DeleteFramebuffersEXT, DeleteFramebuffersEXT@8) + GL_STUB_ALIAS(DeleteRenderbuffers, _gloffset_DeleteRenderbuffersEXT, DeleteRenderbuffers@8, DeleteRenderbuffersEXT, DeleteRenderbuffersEXT@8) + GL_STUB_ALIAS(FramebufferRenderbuffer, _gloffset_FramebufferRenderbufferEXT, FramebufferRenderbuffer@16, FramebufferRenderbufferEXT, FramebufferRenderbufferEXT@16) + GL_STUB_ALIAS(FramebufferTexture1D, _gloffset_FramebufferTexture1DEXT, FramebufferTexture1D@20, FramebufferTexture1DEXT, FramebufferTexture1DEXT@20) + GL_STUB_ALIAS(FramebufferTexture2D, _gloffset_FramebufferTexture2DEXT, FramebufferTexture2D@20, FramebufferTexture2DEXT, FramebufferTexture2DEXT@20) + GL_STUB_ALIAS(FramebufferTexture3D, _gloffset_FramebufferTexture3DEXT, FramebufferTexture3D@24, FramebufferTexture3DEXT, FramebufferTexture3DEXT@24) + GL_STUB_ALIAS(GenFramebuffers, _gloffset_GenFramebuffersEXT, GenFramebuffers@8, GenFramebuffersEXT, GenFramebuffersEXT@8) + GL_STUB_ALIAS(GenRenderbuffers, _gloffset_GenRenderbuffersEXT, GenRenderbuffers@8, GenRenderbuffersEXT, GenRenderbuffersEXT@8) + GL_STUB_ALIAS(GenerateMipmap, _gloffset_GenerateMipmapEXT, GenerateMipmap@4, GenerateMipmapEXT, GenerateMipmapEXT@4) + GL_STUB_ALIAS(GetFramebufferAttachmentParameteriv, _gloffset_GetFramebufferAttachmentParameterivEXT, GetFramebufferAttachmentParameteriv@16, GetFramebufferAttachmentParameterivEXT, GetFramebufferAttachmentParameterivEXT@16) + GL_STUB_ALIAS(GetRenderbufferParameteriv, _gloffset_GetRenderbufferParameterivEXT, GetRenderbufferParameteriv@12, GetRenderbufferParameterivEXT, GetRenderbufferParameterivEXT@12) + GL_STUB_ALIAS(IsFramebuffer, _gloffset_IsFramebufferEXT, IsFramebuffer@4, IsFramebufferEXT, IsFramebufferEXT@4) + GL_STUB_ALIAS(IsRenderbuffer, _gloffset_IsRenderbufferEXT, IsRenderbuffer@4, IsRenderbufferEXT, IsRenderbufferEXT@4) + GL_STUB_ALIAS(RenderbufferStorage, _gloffset_RenderbufferStorageEXT, RenderbufferStorage@16, RenderbufferStorageEXT, RenderbufferStorageEXT@16) + GL_STUB_ALIAS(BlitFramebuffer, _gloffset_BlitFramebufferEXT, BlitFramebuffer@40, _dispatch_stub_795, _dispatch_stub_795@40) + GL_STUB_ALIAS(FramebufferTextureLayer, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayer@20, FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) + GL_STUB_ALIAS(BeginTransformFeedback, _gloffset_BeginTransformFeedbackEXT, BeginTransformFeedback@4, BeginTransformFeedbackEXT, BeginTransformFeedbackEXT@4) + GL_STUB_ALIAS(BindBufferBase, _gloffset_BindBufferBaseEXT, BindBufferBase@12, BindBufferBaseEXT, BindBufferBaseEXT@12) + GL_STUB_ALIAS(BindBufferRange, _gloffset_BindBufferRangeEXT, BindBufferRange@20, BindBufferRangeEXT, BindBufferRangeEXT@20) + GL_STUB_ALIAS(EndTransformFeedback, _gloffset_EndTransformFeedbackEXT, EndTransformFeedback@0, EndTransformFeedbackEXT, EndTransformFeedbackEXT@0) + GL_STUB_ALIAS(GetTransformFeedbackVarying, _gloffset_GetTransformFeedbackVaryingEXT, GetTransformFeedbackVarying@28, GetTransformFeedbackVaryingEXT, GetTransformFeedbackVaryingEXT@28) + GL_STUB_ALIAS(TransformFeedbackVaryings, _gloffset_TransformFeedbackVaryingsEXT, TransformFeedbackVaryings@16, TransformFeedbackVaryingsEXT, TransformFeedbackVaryingsEXT@16) + GL_STUB_ALIAS(ProvokingVertex, _gloffset_ProvokingVertexEXT, ProvokingVertex@4, ProvokingVertexEXT, ProvokingVertexEXT@4) + + GLOBL GLNAME(gl_dispatch_functions_end) + HIDDEN(GLNAME(gl_dispatch_functions_end)) + ALIGNTEXT16 +GLNAME(gl_dispatch_functions_end): + +#if defined(GLX_USE_TLS) && defined(__linux__) + .section ".note.ABI-tag", "a" + .p2align 2 + .long 1f - 0f /* name length */ + .long 3f - 2f /* data length */ + .long 1 /* note length */ +0: .asciz "GNU" /* vendor name */ +1: .p2align 2 +2: .long 0 /* note data: the ABI tag */ + .long 2,4,20 /* Minimum kernel version w/TLS */ +3: .p2align 2 /* pad out section */ +#endif /* GLX_USE_TLS */ + +#if defined (__ELF__) && defined (__linux__) + .section .note.GNU-stack,"",%progbits +#endif diff --git a/mesalib/src/mapi/glapi/glapidispatch.h b/mesalib/src/mapi/glapi/glapidispatch.h index 7e0f21390..0c19d9029 100644 --- a/mesalib/src/mapi/glapi/glapidispatch.h +++ b/mesalib/src/mapi/glapi/glapidispatch.h @@ -1351,6 +1351,12 @@ #define CALL_UniformMatrix4x3fv(disp, parameters) (*((disp)->UniformMatrix4x3fv)) parameters #define GET_UniformMatrix4x3fv(disp) ((disp)->UniformMatrix4x3fv) #define SET_UniformMatrix4x3fv(disp, fn) ((disp)->UniformMatrix4x3fv = fn) +#define CALL_DrawArraysInstanced(disp, parameters) (*((disp)->DrawArraysInstanced)) parameters +#define GET_DrawArraysInstanced(disp) ((disp)->DrawArraysInstanced) +#define SET_DrawArraysInstanced(disp, fn) ((disp)->DrawArraysInstanced = fn) +#define CALL_DrawElementsInstanced(disp, parameters) (*((disp)->DrawElementsInstanced)) parameters +#define GET_DrawElementsInstanced(disp) ((disp)->DrawElementsInstanced) +#define SET_DrawElementsInstanced(disp, fn) ((disp)->DrawElementsInstanced = fn) #define CALL_LoadTransposeMatrixdARB(disp, parameters) (*((disp)->LoadTransposeMatrixdARB)) parameters #define GET_LoadTransposeMatrixdARB(disp) ((disp)->LoadTransposeMatrixdARB) #define SET_LoadTransposeMatrixdARB(disp, fn) ((disp)->LoadTransposeMatrixdARB = fn) @@ -1747,6 +1753,15 @@ #define CALL_RenderbufferStorageMultisample(disp, parameters) (*((disp)->RenderbufferStorageMultisample)) parameters #define GET_RenderbufferStorageMultisample(disp) ((disp)->RenderbufferStorageMultisample) #define SET_RenderbufferStorageMultisample(disp, fn) ((disp)->RenderbufferStorageMultisample = fn) +#define CALL_FramebufferTextureARB(disp, parameters) (*((disp)->FramebufferTextureARB)) parameters +#define GET_FramebufferTextureARB(disp) ((disp)->FramebufferTextureARB) +#define SET_FramebufferTextureARB(disp, fn) ((disp)->FramebufferTextureARB = fn) +#define CALL_FramebufferTextureFaceARB(disp, parameters) (*((disp)->FramebufferTextureFaceARB)) parameters +#define GET_FramebufferTextureFaceARB(disp) ((disp)->FramebufferTextureFaceARB) +#define SET_FramebufferTextureFaceARB(disp, fn) ((disp)->FramebufferTextureFaceARB = fn) +#define CALL_ProgramParameteriARB(disp, parameters) (*((disp)->ProgramParameteriARB)) parameters +#define GET_ProgramParameteriARB(disp) ((disp)->ProgramParameteriARB) +#define SET_ProgramParameteriARB(disp, fn) ((disp)->ProgramParameteriARB = fn) #define CALL_FlushMappedBufferRange(disp, parameters) (*((disp)->FlushMappedBufferRange)) parameters #define GET_FlushMappedBufferRange(disp) ((disp)->FlushMappedBufferRange) #define SET_FlushMappedBufferRange(disp, fn) ((disp)->FlushMappedBufferRange = fn) @@ -1792,6 +1807,27 @@ #define CALL_MultiDrawElementsBaseVertex(disp, parameters) (*((disp)->MultiDrawElementsBaseVertex)) parameters #define GET_MultiDrawElementsBaseVertex(disp) ((disp)->MultiDrawElementsBaseVertex) #define SET_MultiDrawElementsBaseVertex(disp, fn) ((disp)->MultiDrawElementsBaseVertex = fn) +#define CALL_BindTransformFeedback(disp, parameters) (*((disp)->BindTransformFeedback)) parameters +#define GET_BindTransformFeedback(disp) ((disp)->BindTransformFeedback) +#define SET_BindTransformFeedback(disp, fn) ((disp)->BindTransformFeedback = fn) +#define CALL_DeleteTransformFeedbacks(disp, parameters) (*((disp)->DeleteTransformFeedbacks)) parameters +#define GET_DeleteTransformFeedbacks(disp) ((disp)->DeleteTransformFeedbacks) +#define SET_DeleteTransformFeedbacks(disp, fn) ((disp)->DeleteTransformFeedbacks = fn) +#define CALL_DrawTransformFeedback(disp, parameters) (*((disp)->DrawTransformFeedback)) parameters +#define GET_DrawTransformFeedback(disp) ((disp)->DrawTransformFeedback) +#define SET_DrawTransformFeedback(disp, fn) ((disp)->DrawTransformFeedback = fn) +#define CALL_GenTransformFeedbacks(disp, parameters) (*((disp)->GenTransformFeedbacks)) parameters +#define GET_GenTransformFeedbacks(disp) ((disp)->GenTransformFeedbacks) +#define SET_GenTransformFeedbacks(disp, fn) ((disp)->GenTransformFeedbacks = fn) +#define CALL_IsTransformFeedback(disp, parameters) (*((disp)->IsTransformFeedback)) parameters +#define GET_IsTransformFeedback(disp) ((disp)->IsTransformFeedback) +#define SET_IsTransformFeedback(disp, fn) ((disp)->IsTransformFeedback = fn) +#define CALL_PauseTransformFeedback(disp, parameters) (*((disp)->PauseTransformFeedback)) parameters +#define GET_PauseTransformFeedback(disp) ((disp)->PauseTransformFeedback) +#define SET_PauseTransformFeedback(disp, fn) ((disp)->PauseTransformFeedback = fn) +#define CALL_ResumeTransformFeedback(disp, parameters) (*((disp)->ResumeTransformFeedback)) parameters +#define GET_ResumeTransformFeedback(disp) ((disp)->ResumeTransformFeedback) +#define SET_ResumeTransformFeedback(disp, fn) ((disp)->ResumeTransformFeedback = fn) #define CALL_PolygonOffsetEXT(disp, parameters) (*((disp)->PolygonOffsetEXT)) parameters #define GET_PolygonOffsetEXT(disp) ((disp)->PolygonOffsetEXT) #define SET_PolygonOffsetEXT(disp, fn) ((disp)->PolygonOffsetEXT = fn) @@ -2446,6 +2482,27 @@ #define CALL_EndConditionalRenderNV(disp, parameters) (*((disp)->EndConditionalRenderNV)) parameters #define GET_EndConditionalRenderNV(disp) ((disp)->EndConditionalRenderNV) #define SET_EndConditionalRenderNV(disp, fn) ((disp)->EndConditionalRenderNV = fn) +#define CALL_BeginTransformFeedbackEXT(disp, parameters) (*((disp)->BeginTransformFeedbackEXT)) parameters +#define GET_BeginTransformFeedbackEXT(disp) ((disp)->BeginTransformFeedbackEXT) +#define SET_BeginTransformFeedbackEXT(disp, fn) ((disp)->BeginTransformFeedbackEXT = fn) +#define CALL_BindBufferBaseEXT(disp, parameters) (*((disp)->BindBufferBaseEXT)) parameters +#define GET_BindBufferBaseEXT(disp) ((disp)->BindBufferBaseEXT) +#define SET_BindBufferBaseEXT(disp, fn) ((disp)->BindBufferBaseEXT = fn) +#define CALL_BindBufferOffsetEXT(disp, parameters) (*((disp)->BindBufferOffsetEXT)) parameters +#define GET_BindBufferOffsetEXT(disp) ((disp)->BindBufferOffsetEXT) +#define SET_BindBufferOffsetEXT(disp, fn) ((disp)->BindBufferOffsetEXT = fn) +#define CALL_BindBufferRangeEXT(disp, parameters) (*((disp)->BindBufferRangeEXT)) parameters +#define GET_BindBufferRangeEXT(disp) ((disp)->BindBufferRangeEXT) +#define SET_BindBufferRangeEXT(disp, fn) ((disp)->BindBufferRangeEXT = fn) +#define CALL_EndTransformFeedbackEXT(disp, parameters) (*((disp)->EndTransformFeedbackEXT)) parameters +#define GET_EndTransformFeedbackEXT(disp) ((disp)->EndTransformFeedbackEXT) +#define SET_EndTransformFeedbackEXT(disp, fn) ((disp)->EndTransformFeedbackEXT = fn) +#define CALL_GetTransformFeedbackVaryingEXT(disp, parameters) (*((disp)->GetTransformFeedbackVaryingEXT)) parameters +#define GET_GetTransformFeedbackVaryingEXT(disp) ((disp)->GetTransformFeedbackVaryingEXT) +#define SET_GetTransformFeedbackVaryingEXT(disp, fn) ((disp)->GetTransformFeedbackVaryingEXT = fn) +#define CALL_TransformFeedbackVaryingsEXT(disp, parameters) (*((disp)->TransformFeedbackVaryingsEXT)) parameters +#define GET_TransformFeedbackVaryingsEXT(disp) ((disp)->TransformFeedbackVaryingsEXT) +#define SET_TransformFeedbackVaryingsEXT(disp, fn) ((disp)->TransformFeedbackVaryingsEXT = fn) #define CALL_ProvokingVertexEXT(disp, parameters) (*((disp)->ProvokingVertexEXT)) parameters #define GET_ProvokingVertexEXT(disp) ((disp)->ProvokingVertexEXT) #define SET_ProvokingVertexEXT(disp, fn) ((disp)->ProvokingVertexEXT = fn) @@ -2488,7 +2545,7 @@ #else -#define driDispatchRemapTable_size 400 +#define driDispatchRemapTable_size 419 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2513,384 +2570,403 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define UniformMatrix3x4fv_remap_index 19 #define UniformMatrix4x2fv_remap_index 20 #define UniformMatrix4x3fv_remap_index 21 -#define LoadTransposeMatrixdARB_remap_index 22 -#define LoadTransposeMatrixfARB_remap_index 23 -#define MultTransposeMatrixdARB_remap_index 24 -#define MultTransposeMatrixfARB_remap_index 25 -#define SampleCoverageARB_remap_index 26 -#define CompressedTexImage1DARB_remap_index 27 -#define CompressedTexImage2DARB_remap_index 28 -#define CompressedTexImage3DARB_remap_index 29 -#define CompressedTexSubImage1DARB_remap_index 30 -#define CompressedTexSubImage2DARB_remap_index 31 -#define CompressedTexSubImage3DARB_remap_index 32 -#define GetCompressedTexImageARB_remap_index 33 -#define DisableVertexAttribArrayARB_remap_index 34 -#define EnableVertexAttribArrayARB_remap_index 35 -#define GetProgramEnvParameterdvARB_remap_index 36 -#define GetProgramEnvParameterfvARB_remap_index 37 -#define GetProgramLocalParameterdvARB_remap_index 38 -#define GetProgramLocalParameterfvARB_remap_index 39 -#define GetProgramStringARB_remap_index 40 -#define GetProgramivARB_remap_index 41 -#define GetVertexAttribdvARB_remap_index 42 -#define GetVertexAttribfvARB_remap_index 43 -#define GetVertexAttribivARB_remap_index 44 -#define ProgramEnvParameter4dARB_remap_index 45 -#define ProgramEnvParameter4dvARB_remap_index 46 -#define ProgramEnvParameter4fARB_remap_index 47 -#define ProgramEnvParameter4fvARB_remap_index 48 -#define ProgramLocalParameter4dARB_remap_index 49 -#define ProgramLocalParameter4dvARB_remap_index 50 -#define ProgramLocalParameter4fARB_remap_index 51 -#define ProgramLocalParameter4fvARB_remap_index 52 -#define ProgramStringARB_remap_index 53 -#define VertexAttrib1dARB_remap_index 54 -#define VertexAttrib1dvARB_remap_index 55 -#define VertexAttrib1fARB_remap_index 56 -#define VertexAttrib1fvARB_remap_index 57 -#define VertexAttrib1sARB_remap_index 58 -#define VertexAttrib1svARB_remap_index 59 -#define VertexAttrib2dARB_remap_index 60 -#define VertexAttrib2dvARB_remap_index 61 -#define VertexAttrib2fARB_remap_index 62 -#define VertexAttrib2fvARB_remap_index 63 -#define VertexAttrib2sARB_remap_index 64 -#define VertexAttrib2svARB_remap_index 65 -#define VertexAttrib3dARB_remap_index 66 -#define VertexAttrib3dvARB_remap_index 67 -#define VertexAttrib3fARB_remap_index 68 -#define VertexAttrib3fvARB_remap_index 69 -#define VertexAttrib3sARB_remap_index 70 -#define VertexAttrib3svARB_remap_index 71 -#define VertexAttrib4NbvARB_remap_index 72 -#define VertexAttrib4NivARB_remap_index 73 -#define VertexAttrib4NsvARB_remap_index 74 -#define VertexAttrib4NubARB_remap_index 75 -#define VertexAttrib4NubvARB_remap_index 76 -#define VertexAttrib4NuivARB_remap_index 77 -#define VertexAttrib4NusvARB_remap_index 78 -#define VertexAttrib4bvARB_remap_index 79 -#define VertexAttrib4dARB_remap_index 80 -#define VertexAttrib4dvARB_remap_index 81 -#define VertexAttrib4fARB_remap_index 82 -#define VertexAttrib4fvARB_remap_index 83 -#define VertexAttrib4ivARB_remap_index 84 -#define VertexAttrib4sARB_remap_index 85 -#define VertexAttrib4svARB_remap_index 86 -#define VertexAttrib4ubvARB_remap_index 87 -#define VertexAttrib4uivARB_remap_index 88 -#define VertexAttrib4usvARB_remap_index 89 -#define VertexAttribPointerARB_remap_index 90 -#define BindBufferARB_remap_index 91 -#define BufferDataARB_remap_index 92 -#define BufferSubDataARB_remap_index 93 -#define DeleteBuffersARB_remap_index 94 -#define GenBuffersARB_remap_index 95 -#define GetBufferParameterivARB_remap_index 96 -#define GetBufferPointervARB_remap_index 97 -#define GetBufferSubDataARB_remap_index 98 -#define IsBufferARB_remap_index 99 -#define MapBufferARB_remap_index 100 -#define UnmapBufferARB_remap_index 101 -#define BeginQueryARB_remap_index 102 -#define DeleteQueriesARB_remap_index 103 -#define EndQueryARB_remap_index 104 -#define GenQueriesARB_remap_index 105 -#define GetQueryObjectivARB_remap_index 106 -#define GetQueryObjectuivARB_remap_index 107 -#define GetQueryivARB_remap_index 108 -#define IsQueryARB_remap_index 109 -#define AttachObjectARB_remap_index 110 -#define CompileShaderARB_remap_index 111 -#define CreateProgramObjectARB_remap_index 112 -#define CreateShaderObjectARB_remap_index 113 -#define DeleteObjectARB_remap_index 114 -#define DetachObjectARB_remap_index 115 -#define GetActiveUniformARB_remap_index 116 -#define GetAttachedObjectsARB_remap_index 117 -#define GetHandleARB_remap_index 118 -#define GetInfoLogARB_remap_index 119 -#define GetObjectParameterfvARB_remap_index 120 -#define GetObjectParameterivARB_remap_index 121 -#define GetShaderSourceARB_remap_index 122 -#define GetUniformLocationARB_remap_index 123 -#define GetUniformfvARB_remap_index 124 -#define GetUniformivARB_remap_index 125 -#define LinkProgramARB_remap_index 126 -#define ShaderSourceARB_remap_index 127 -#define Uniform1fARB_remap_index 128 -#define Uniform1fvARB_remap_index 129 -#define Uniform1iARB_remap_index 130 -#define Uniform1ivARB_remap_index 131 -#define Uniform2fARB_remap_index 132 -#define Uniform2fvARB_remap_index 133 -#define Uniform2iARB_remap_index 134 -#define Uniform2ivARB_remap_index 135 -#define Uniform3fARB_remap_index 136 -#define Uniform3fvARB_remap_index 137 -#define Uniform3iARB_remap_index 138 -#define Uniform3ivARB_remap_index 139 -#define Uniform4fARB_remap_index 140 -#define Uniform4fvARB_remap_index 141 -#define Uniform4iARB_remap_index 142 -#define Uniform4ivARB_remap_index 143 -#define UniformMatrix2fvARB_remap_index 144 -#define UniformMatrix3fvARB_remap_index 145 -#define UniformMatrix4fvARB_remap_index 146 -#define UseProgramObjectARB_remap_index 147 -#define ValidateProgramARB_remap_index 148 -#define BindAttribLocationARB_remap_index 149 -#define GetActiveAttribARB_remap_index 150 -#define GetAttribLocationARB_remap_index 151 -#define DrawBuffersARB_remap_index 152 -#define RenderbufferStorageMultisample_remap_index 153 -#define FlushMappedBufferRange_remap_index 154 -#define MapBufferRange_remap_index 155 -#define BindVertexArray_remap_index 156 -#define GenVertexArrays_remap_index 157 -#define CopyBufferSubData_remap_index 158 -#define ClientWaitSync_remap_index 159 -#define DeleteSync_remap_index 160 -#define FenceSync_remap_index 161 -#define GetInteger64v_remap_index 162 -#define GetSynciv_remap_index 163 -#define IsSync_remap_index 164 -#define WaitSync_remap_index 165 -#define DrawElementsBaseVertex_remap_index 166 -#define DrawRangeElementsBaseVertex_remap_index 167 -#define MultiDrawElementsBaseVertex_remap_index 168 -#define PolygonOffsetEXT_remap_index 169 -#define GetPixelTexGenParameterfvSGIS_remap_index 170 -#define GetPixelTexGenParameterivSGIS_remap_index 171 -#define PixelTexGenParameterfSGIS_remap_index 172 -#define PixelTexGenParameterfvSGIS_remap_index 173 -#define PixelTexGenParameteriSGIS_remap_index 174 -#define PixelTexGenParameterivSGIS_remap_index 175 -#define SampleMaskSGIS_remap_index 176 -#define SamplePatternSGIS_remap_index 177 -#define ColorPointerEXT_remap_index 178 -#define EdgeFlagPointerEXT_remap_index 179 -#define IndexPointerEXT_remap_index 180 -#define NormalPointerEXT_remap_index 181 -#define TexCoordPointerEXT_remap_index 182 -#define VertexPointerEXT_remap_index 183 -#define PointParameterfEXT_remap_index 184 -#define PointParameterfvEXT_remap_index 185 -#define LockArraysEXT_remap_index 186 -#define UnlockArraysEXT_remap_index 187 -#define CullParameterdvEXT_remap_index 188 -#define CullParameterfvEXT_remap_index 189 -#define SecondaryColor3bEXT_remap_index 190 -#define SecondaryColor3bvEXT_remap_index 191 -#define SecondaryColor3dEXT_remap_index 192 -#define SecondaryColor3dvEXT_remap_index 193 -#define SecondaryColor3fEXT_remap_index 194 -#define SecondaryColor3fvEXT_remap_index 195 -#define SecondaryColor3iEXT_remap_index 196 -#define SecondaryColor3ivEXT_remap_index 197 -#define SecondaryColor3sEXT_remap_index 198 -#define SecondaryColor3svEXT_remap_index 199 -#define SecondaryColor3ubEXT_remap_index 200 -#define SecondaryColor3ubvEXT_remap_index 201 -#define SecondaryColor3uiEXT_remap_index 202 -#define SecondaryColor3uivEXT_remap_index 203 -#define SecondaryColor3usEXT_remap_index 204 -#define SecondaryColor3usvEXT_remap_index 205 -#define SecondaryColorPointerEXT_remap_index 206 -#define MultiDrawArraysEXT_remap_index 207 -#define MultiDrawElementsEXT_remap_index 208 -#define FogCoordPointerEXT_remap_index 209 -#define FogCoorddEXT_remap_index 210 -#define FogCoorddvEXT_remap_index 211 -#define FogCoordfEXT_remap_index 212 -#define FogCoordfvEXT_remap_index 213 -#define PixelTexGenSGIX_remap_index 214 -#define BlendFuncSeparateEXT_remap_index 215 -#define FlushVertexArrayRangeNV_remap_index 216 -#define VertexArrayRangeNV_remap_index 217 -#define CombinerInputNV_remap_index 218 -#define CombinerOutputNV_remap_index 219 -#define CombinerParameterfNV_remap_index 220 -#define CombinerParameterfvNV_remap_index 221 -#define CombinerParameteriNV_remap_index 222 -#define CombinerParameterivNV_remap_index 223 -#define FinalCombinerInputNV_remap_index 224 -#define GetCombinerInputParameterfvNV_remap_index 225 -#define GetCombinerInputParameterivNV_remap_index 226 -#define GetCombinerOutputParameterfvNV_remap_index 227 -#define GetCombinerOutputParameterivNV_remap_index 228 -#define GetFinalCombinerInputParameterfvNV_remap_index 229 -#define GetFinalCombinerInputParameterivNV_remap_index 230 -#define ResizeBuffersMESA_remap_index 231 -#define WindowPos2dMESA_remap_index 232 -#define WindowPos2dvMESA_remap_index 233 -#define WindowPos2fMESA_remap_index 234 -#define WindowPos2fvMESA_remap_index 235 -#define WindowPos2iMESA_remap_index 236 -#define WindowPos2ivMESA_remap_index 237 -#define WindowPos2sMESA_remap_index 238 -#define WindowPos2svMESA_remap_index 239 -#define WindowPos3dMESA_remap_index 240 -#define WindowPos3dvMESA_remap_index 241 -#define WindowPos3fMESA_remap_index 242 -#define WindowPos3fvMESA_remap_index 243 -#define WindowPos3iMESA_remap_index 244 -#define WindowPos3ivMESA_remap_index 245 -#define WindowPos3sMESA_remap_index 246 -#define WindowPos3svMESA_remap_index 247 -#define WindowPos4dMESA_remap_index 248 -#define WindowPos4dvMESA_remap_index 249 -#define WindowPos4fMESA_remap_index 250 -#define WindowPos4fvMESA_remap_index 251 -#define WindowPos4iMESA_remap_index 252 -#define WindowPos4ivMESA_remap_index 253 -#define WindowPos4sMESA_remap_index 254 -#define WindowPos4svMESA_remap_index 255 -#define MultiModeDrawArraysIBM_remap_index 256 -#define MultiModeDrawElementsIBM_remap_index 257 -#define DeleteFencesNV_remap_index 258 -#define FinishFenceNV_remap_index 259 -#define GenFencesNV_remap_index 260 -#define GetFenceivNV_remap_index 261 -#define IsFenceNV_remap_index 262 -#define SetFenceNV_remap_index 263 -#define TestFenceNV_remap_index 264 -#define AreProgramsResidentNV_remap_index 265 -#define BindProgramNV_remap_index 266 -#define DeleteProgramsNV_remap_index 267 -#define ExecuteProgramNV_remap_index 268 -#define GenProgramsNV_remap_index 269 -#define GetProgramParameterdvNV_remap_index 270 -#define GetProgramParameterfvNV_remap_index 271 -#define GetProgramStringNV_remap_index 272 -#define GetProgramivNV_remap_index 273 -#define GetTrackMatrixivNV_remap_index 274 -#define GetVertexAttribPointervNV_remap_index 275 -#define GetVertexAttribdvNV_remap_index 276 -#define GetVertexAttribfvNV_remap_index 277 -#define GetVertexAttribivNV_remap_index 278 -#define IsProgramNV_remap_index 279 -#define LoadProgramNV_remap_index 280 -#define ProgramParameters4dvNV_remap_index 281 -#define ProgramParameters4fvNV_remap_index 282 -#define RequestResidentProgramsNV_remap_index 283 -#define TrackMatrixNV_remap_index 284 -#define VertexAttrib1dNV_remap_index 285 -#define VertexAttrib1dvNV_remap_index 286 -#define VertexAttrib1fNV_remap_index 287 -#define VertexAttrib1fvNV_remap_index 288 -#define VertexAttrib1sNV_remap_index 289 -#define VertexAttrib1svNV_remap_index 290 -#define VertexAttrib2dNV_remap_index 291 -#define VertexAttrib2dvNV_remap_index 292 -#define VertexAttrib2fNV_remap_index 293 -#define VertexAttrib2fvNV_remap_index 294 -#define VertexAttrib2sNV_remap_index 295 -#define VertexAttrib2svNV_remap_index 296 -#define VertexAttrib3dNV_remap_index 297 -#define VertexAttrib3dvNV_remap_index 298 -#define VertexAttrib3fNV_remap_index 299 -#define VertexAttrib3fvNV_remap_index 300 -#define VertexAttrib3sNV_remap_index 301 -#define VertexAttrib3svNV_remap_index 302 -#define VertexAttrib4dNV_remap_index 303 -#define VertexAttrib4dvNV_remap_index 304 -#define VertexAttrib4fNV_remap_index 305 -#define VertexAttrib4fvNV_remap_index 306 -#define VertexAttrib4sNV_remap_index 307 -#define VertexAttrib4svNV_remap_index 308 -#define VertexAttrib4ubNV_remap_index 309 -#define VertexAttrib4ubvNV_remap_index 310 -#define VertexAttribPointerNV_remap_index 311 -#define VertexAttribs1dvNV_remap_index 312 -#define VertexAttribs1fvNV_remap_index 313 -#define VertexAttribs1svNV_remap_index 314 -#define VertexAttribs2dvNV_remap_index 315 -#define VertexAttribs2fvNV_remap_index 316 -#define VertexAttribs2svNV_remap_index 317 -#define VertexAttribs3dvNV_remap_index 318 -#define VertexAttribs3fvNV_remap_index 319 -#define VertexAttribs3svNV_remap_index 320 -#define VertexAttribs4dvNV_remap_index 321 -#define VertexAttribs4fvNV_remap_index 322 -#define VertexAttribs4svNV_remap_index 323 -#define VertexAttribs4ubvNV_remap_index 324 -#define GetTexBumpParameterfvATI_remap_index 325 -#define GetTexBumpParameterivATI_remap_index 326 -#define TexBumpParameterfvATI_remap_index 327 -#define TexBumpParameterivATI_remap_index 328 -#define AlphaFragmentOp1ATI_remap_index 329 -#define AlphaFragmentOp2ATI_remap_index 330 -#define AlphaFragmentOp3ATI_remap_index 331 -#define BeginFragmentShaderATI_remap_index 332 -#define BindFragmentShaderATI_remap_index 333 -#define ColorFragmentOp1ATI_remap_index 334 -#define ColorFragmentOp2ATI_remap_index 335 -#define ColorFragmentOp3ATI_remap_index 336 -#define DeleteFragmentShaderATI_remap_index 337 -#define EndFragmentShaderATI_remap_index 338 -#define GenFragmentShadersATI_remap_index 339 -#define PassTexCoordATI_remap_index 340 -#define SampleMapATI_remap_index 341 -#define SetFragmentShaderConstantATI_remap_index 342 -#define PointParameteriNV_remap_index 343 -#define PointParameterivNV_remap_index 344 -#define ActiveStencilFaceEXT_remap_index 345 -#define BindVertexArrayAPPLE_remap_index 346 -#define DeleteVertexArraysAPPLE_remap_index 347 -#define GenVertexArraysAPPLE_remap_index 348 -#define IsVertexArrayAPPLE_remap_index 349 -#define GetProgramNamedParameterdvNV_remap_index 350 -#define GetProgramNamedParameterfvNV_remap_index 351 -#define ProgramNamedParameter4dNV_remap_index 352 -#define ProgramNamedParameter4dvNV_remap_index 353 -#define ProgramNamedParameter4fNV_remap_index 354 -#define ProgramNamedParameter4fvNV_remap_index 355 -#define DepthBoundsEXT_remap_index 356 -#define BlendEquationSeparateEXT_remap_index 357 -#define BindFramebufferEXT_remap_index 358 -#define BindRenderbufferEXT_remap_index 359 -#define CheckFramebufferStatusEXT_remap_index 360 -#define DeleteFramebuffersEXT_remap_index 361 -#define DeleteRenderbuffersEXT_remap_index 362 -#define FramebufferRenderbufferEXT_remap_index 363 -#define FramebufferTexture1DEXT_remap_index 364 -#define FramebufferTexture2DEXT_remap_index 365 -#define FramebufferTexture3DEXT_remap_index 366 -#define GenFramebuffersEXT_remap_index 367 -#define GenRenderbuffersEXT_remap_index 368 -#define GenerateMipmapEXT_remap_index 369 -#define GetFramebufferAttachmentParameterivEXT_remap_index 370 -#define GetRenderbufferParameterivEXT_remap_index 371 -#define IsFramebufferEXT_remap_index 372 -#define IsRenderbufferEXT_remap_index 373 -#define RenderbufferStorageEXT_remap_index 374 -#define BlitFramebufferEXT_remap_index 375 -#define BufferParameteriAPPLE_remap_index 376 -#define FlushMappedBufferRangeAPPLE_remap_index 377 -#define FramebufferTextureLayerEXT_remap_index 378 -#define ColorMaskIndexedEXT_remap_index 379 -#define DisableIndexedEXT_remap_index 380 -#define EnableIndexedEXT_remap_index 381 -#define GetBooleanIndexedvEXT_remap_index 382 -#define GetIntegerIndexedvEXT_remap_index 383 -#define IsEnabledIndexedEXT_remap_index 384 -#define BeginConditionalRenderNV_remap_index 385 -#define EndConditionalRenderNV_remap_index 386 -#define ProvokingVertexEXT_remap_index 387 -#define GetTexParameterPointervAPPLE_remap_index 388 -#define TextureRangeAPPLE_remap_index 389 -#define GetObjectParameterivAPPLE_remap_index 390 -#define ObjectPurgeableAPPLE_remap_index 391 -#define ObjectUnpurgeableAPPLE_remap_index 392 -#define StencilFuncSeparateATI_remap_index 393 -#define ProgramEnvParameters4fvEXT_remap_index 394 -#define ProgramLocalParameters4fvEXT_remap_index 395 -#define GetQueryObjecti64vEXT_remap_index 396 -#define GetQueryObjectui64vEXT_remap_index 397 -#define EGLImageTargetRenderbufferStorageOES_remap_index 398 -#define EGLImageTargetTexture2DOES_remap_index 399 +#define DrawArraysInstanced_remap_index 22 +#define DrawElementsInstanced_remap_index 23 +#define LoadTransposeMatrixdARB_remap_index 24 +#define LoadTransposeMatrixfARB_remap_index 25 +#define MultTransposeMatrixdARB_remap_index 26 +#define MultTransposeMatrixfARB_remap_index 27 +#define SampleCoverageARB_remap_index 28 +#define CompressedTexImage1DARB_remap_index 29 +#define CompressedTexImage2DARB_remap_index 30 +#define CompressedTexImage3DARB_remap_index 31 +#define CompressedTexSubImage1DARB_remap_index 32 +#define CompressedTexSubImage2DARB_remap_index 33 +#define CompressedTexSubImage3DARB_remap_index 34 +#define GetCompressedTexImageARB_remap_index 35 +#define DisableVertexAttribArrayARB_remap_index 36 +#define EnableVertexAttribArrayARB_remap_index 37 +#define GetProgramEnvParameterdvARB_remap_index 38 +#define GetProgramEnvParameterfvARB_remap_index 39 +#define GetProgramLocalParameterdvARB_remap_index 40 +#define GetProgramLocalParameterfvARB_remap_index 41 +#define GetProgramStringARB_remap_index 42 +#define GetProgramivARB_remap_index 43 +#define GetVertexAttribdvARB_remap_index 44 +#define GetVertexAttribfvARB_remap_index 45 +#define GetVertexAttribivARB_remap_index 46 +#define ProgramEnvParameter4dARB_remap_index 47 +#define ProgramEnvParameter4dvARB_remap_index 48 +#define ProgramEnvParameter4fARB_remap_index 49 +#define ProgramEnvParameter4fvARB_remap_index 50 +#define ProgramLocalParameter4dARB_remap_index 51 +#define ProgramLocalParameter4dvARB_remap_index 52 +#define ProgramLocalParameter4fARB_remap_index 53 +#define ProgramLocalParameter4fvARB_remap_index 54 +#define ProgramStringARB_remap_index 55 +#define VertexAttrib1dARB_remap_index 56 +#define VertexAttrib1dvARB_remap_index 57 +#define VertexAttrib1fARB_remap_index 58 +#define VertexAttrib1fvARB_remap_index 59 +#define VertexAttrib1sARB_remap_index 60 +#define VertexAttrib1svARB_remap_index 61 +#define VertexAttrib2dARB_remap_index 62 +#define VertexAttrib2dvARB_remap_index 63 +#define VertexAttrib2fARB_remap_index 64 +#define VertexAttrib2fvARB_remap_index 65 +#define VertexAttrib2sARB_remap_index 66 +#define VertexAttrib2svARB_remap_index 67 +#define VertexAttrib3dARB_remap_index 68 +#define VertexAttrib3dvARB_remap_index 69 +#define VertexAttrib3fARB_remap_index 70 +#define VertexAttrib3fvARB_remap_index 71 +#define VertexAttrib3sARB_remap_index 72 +#define VertexAttrib3svARB_remap_index 73 +#define VertexAttrib4NbvARB_remap_index 74 +#define VertexAttrib4NivARB_remap_index 75 +#define VertexAttrib4NsvARB_remap_index 76 +#define VertexAttrib4NubARB_remap_index 77 +#define VertexAttrib4NubvARB_remap_index 78 +#define VertexAttrib4NuivARB_remap_index 79 +#define VertexAttrib4NusvARB_remap_index 80 +#define VertexAttrib4bvARB_remap_index 81 +#define VertexAttrib4dARB_remap_index 82 +#define VertexAttrib4dvARB_remap_index 83 +#define VertexAttrib4fARB_remap_index 84 +#define VertexAttrib4fvARB_remap_index 85 +#define VertexAttrib4ivARB_remap_index 86 +#define VertexAttrib4sARB_remap_index 87 +#define VertexAttrib4svARB_remap_index 88 +#define VertexAttrib4ubvARB_remap_index 89 +#define VertexAttrib4uivARB_remap_index 90 +#define VertexAttrib4usvARB_remap_index 91 +#define VertexAttribPointerARB_remap_index 92 +#define BindBufferARB_remap_index 93 +#define BufferDataARB_remap_index 94 +#define BufferSubDataARB_remap_index 95 +#define DeleteBuffersARB_remap_index 96 +#define GenBuffersARB_remap_index 97 +#define GetBufferParameterivARB_remap_index 98 +#define GetBufferPointervARB_remap_index 99 +#define GetBufferSubDataARB_remap_index 100 +#define IsBufferARB_remap_index 101 +#define MapBufferARB_remap_index 102 +#define UnmapBufferARB_remap_index 103 +#define BeginQueryARB_remap_index 104 +#define DeleteQueriesARB_remap_index 105 +#define EndQueryARB_remap_index 106 +#define GenQueriesARB_remap_index 107 +#define GetQueryObjectivARB_remap_index 108 +#define GetQueryObjectuivARB_remap_index 109 +#define GetQueryivARB_remap_index 110 +#define IsQueryARB_remap_index 111 +#define AttachObjectARB_remap_index 112 +#define CompileShaderARB_remap_index 113 +#define CreateProgramObjectARB_remap_index 114 +#define CreateShaderObjectARB_remap_index 115 +#define DeleteObjectARB_remap_index 116 +#define DetachObjectARB_remap_index 117 +#define GetActiveUniformARB_remap_index 118 +#define GetAttachedObjectsARB_remap_index 119 +#define GetHandleARB_remap_index 120 +#define GetInfoLogARB_remap_index 121 +#define GetObjectParameterfvARB_remap_index 122 +#define GetObjectParameterivARB_remap_index 123 +#define GetShaderSourceARB_remap_index 124 +#define GetUniformLocationARB_remap_index 125 +#define GetUniformfvARB_remap_index 126 +#define GetUniformivARB_remap_index 127 +#define LinkProgramARB_remap_index 128 +#define ShaderSourceARB_remap_index 129 +#define Uniform1fARB_remap_index 130 +#define Uniform1fvARB_remap_index 131 +#define Uniform1iARB_remap_index 132 +#define Uniform1ivARB_remap_index 133 +#define Uniform2fARB_remap_index 134 +#define Uniform2fvARB_remap_index 135 +#define Uniform2iARB_remap_index 136 +#define Uniform2ivARB_remap_index 137 +#define Uniform3fARB_remap_index 138 +#define Uniform3fvARB_remap_index 139 +#define Uniform3iARB_remap_index 140 +#define Uniform3ivARB_remap_index 141 +#define Uniform4fARB_remap_index 142 +#define Uniform4fvARB_remap_index 143 +#define Uniform4iARB_remap_index 144 +#define Uniform4ivARB_remap_index 145 +#define UniformMatrix2fvARB_remap_index 146 +#define UniformMatrix3fvARB_remap_index 147 +#define UniformMatrix4fvARB_remap_index 148 +#define UseProgramObjectARB_remap_index 149 +#define ValidateProgramARB_remap_index 150 +#define BindAttribLocationARB_remap_index 151 +#define GetActiveAttribARB_remap_index 152 +#define GetAttribLocationARB_remap_index 153 +#define DrawBuffersARB_remap_index 154 +#define RenderbufferStorageMultisample_remap_index 155 +#define FramebufferTextureARB_remap_index 156 +#define FramebufferTextureFaceARB_remap_index 157 +#define ProgramParameteriARB_remap_index 158 +#define FlushMappedBufferRange_remap_index 159 +#define MapBufferRange_remap_index 160 +#define BindVertexArray_remap_index 161 +#define GenVertexArrays_remap_index 162 +#define CopyBufferSubData_remap_index 163 +#define ClientWaitSync_remap_index 164 +#define DeleteSync_remap_index 165 +#define FenceSync_remap_index 166 +#define GetInteger64v_remap_index 167 +#define GetSynciv_remap_index 168 +#define IsSync_remap_index 169 +#define WaitSync_remap_index 170 +#define DrawElementsBaseVertex_remap_index 171 +#define DrawRangeElementsBaseVertex_remap_index 172 +#define MultiDrawElementsBaseVertex_remap_index 173 +#define BindTransformFeedback_remap_index 174 +#define DeleteTransformFeedbacks_remap_index 175 +#define DrawTransformFeedback_remap_index 176 +#define GenTransformFeedbacks_remap_index 177 +#define IsTransformFeedback_remap_index 178 +#define PauseTransformFeedback_remap_index 179 +#define ResumeTransformFeedback_remap_index 180 +#define PolygonOffsetEXT_remap_index 181 +#define GetPixelTexGenParameterfvSGIS_remap_index 182 +#define GetPixelTexGenParameterivSGIS_remap_index 183 +#define PixelTexGenParameterfSGIS_remap_index 184 +#define PixelTexGenParameterfvSGIS_remap_index 185 +#define PixelTexGenParameteriSGIS_remap_index 186 +#define PixelTexGenParameterivSGIS_remap_index 187 +#define SampleMaskSGIS_remap_index 188 +#define SamplePatternSGIS_remap_index 189 +#define ColorPointerEXT_remap_index 190 +#define EdgeFlagPointerEXT_remap_index 191 +#define IndexPointerEXT_remap_index 192 +#define NormalPointerEXT_remap_index 193 +#define TexCoordPointerEXT_remap_index 194 +#define VertexPointerEXT_remap_index 195 +#define PointParameterfEXT_remap_index 196 +#define PointParameterfvEXT_remap_index 197 +#define LockArraysEXT_remap_index 198 +#define UnlockArraysEXT_remap_index 199 +#define CullParameterdvEXT_remap_index 200 +#define CullParameterfvEXT_remap_index 201 +#define SecondaryColor3bEXT_remap_index 202 +#define SecondaryColor3bvEXT_remap_index 203 +#define SecondaryColor3dEXT_remap_index 204 +#define SecondaryColor3dvEXT_remap_index 205 +#define SecondaryColor3fEXT_remap_index 206 +#define SecondaryColor3fvEXT_remap_index 207 +#define SecondaryColor3iEXT_remap_index 208 +#define SecondaryColor3ivEXT_remap_index 209 +#define SecondaryColor3sEXT_remap_index 210 +#define SecondaryColor3svEXT_remap_index 211 +#define SecondaryColor3ubEXT_remap_index 212 +#define SecondaryColor3ubvEXT_remap_index 213 +#define SecondaryColor3uiEXT_remap_index 214 +#define SecondaryColor3uivEXT_remap_index 215 +#define SecondaryColor3usEXT_remap_index 216 +#define SecondaryColor3usvEXT_remap_index 217 +#define SecondaryColorPointerEXT_remap_index 218 +#define MultiDrawArraysEXT_remap_index 219 +#define MultiDrawElementsEXT_remap_index 220 +#define FogCoordPointerEXT_remap_index 221 +#define FogCoorddEXT_remap_index 222 +#define FogCoorddvEXT_remap_index 223 +#define FogCoordfEXT_remap_index 224 +#define FogCoordfvEXT_remap_index 225 +#define PixelTexGenSGIX_remap_index 226 +#define BlendFuncSeparateEXT_remap_index 227 +#define FlushVertexArrayRangeNV_remap_index 228 +#define VertexArrayRangeNV_remap_index 229 +#define CombinerInputNV_remap_index 230 +#define CombinerOutputNV_remap_index 231 +#define CombinerParameterfNV_remap_index 232 +#define CombinerParameterfvNV_remap_index 233 +#define CombinerParameteriNV_remap_index 234 +#define CombinerParameterivNV_remap_index 235 +#define FinalCombinerInputNV_remap_index 236 +#define GetCombinerInputParameterfvNV_remap_index 237 +#define GetCombinerInputParameterivNV_remap_index 238 +#define GetCombinerOutputParameterfvNV_remap_index 239 +#define GetCombinerOutputParameterivNV_remap_index 240 +#define GetFinalCombinerInputParameterfvNV_remap_index 241 +#define GetFinalCombinerInputParameterivNV_remap_index 242 +#define ResizeBuffersMESA_remap_index 243 +#define WindowPos2dMESA_remap_index 244 +#define WindowPos2dvMESA_remap_index 245 +#define WindowPos2fMESA_remap_index 246 +#define WindowPos2fvMESA_remap_index 247 +#define WindowPos2iMESA_remap_index 248 +#define WindowPos2ivMESA_remap_index 249 +#define WindowPos2sMESA_remap_index 250 +#define WindowPos2svMESA_remap_index 251 +#define WindowPos3dMESA_remap_index 252 +#define WindowPos3dvMESA_remap_index 253 +#define WindowPos3fMESA_remap_index 254 +#define WindowPos3fvMESA_remap_index 255 +#define WindowPos3iMESA_remap_index 256 +#define WindowPos3ivMESA_remap_index 257 +#define WindowPos3sMESA_remap_index 258 +#define WindowPos3svMESA_remap_index 259 +#define WindowPos4dMESA_remap_index 260 +#define WindowPos4dvMESA_remap_index 261 +#define WindowPos4fMESA_remap_index 262 +#define WindowPos4fvMESA_remap_index 263 +#define WindowPos4iMESA_remap_index 264 +#define WindowPos4ivMESA_remap_index 265 +#define WindowPos4sMESA_remap_index 266 +#define WindowPos4svMESA_remap_index 267 +#define MultiModeDrawArraysIBM_remap_index 268 +#define MultiModeDrawElementsIBM_remap_index 269 +#define DeleteFencesNV_remap_index 270 +#define FinishFenceNV_remap_index 271 +#define GenFencesNV_remap_index 272 +#define GetFenceivNV_remap_index 273 +#define IsFenceNV_remap_index 274 +#define SetFenceNV_remap_index 275 +#define TestFenceNV_remap_index 276 +#define AreProgramsResidentNV_remap_index 277 +#define BindProgramNV_remap_index 278 +#define DeleteProgramsNV_remap_index 279 +#define ExecuteProgramNV_remap_index 280 +#define GenProgramsNV_remap_index 281 +#define GetProgramParameterdvNV_remap_index 282 +#define GetProgramParameterfvNV_remap_index 283 +#define GetProgramStringNV_remap_index 284 +#define GetProgramivNV_remap_index 285 +#define GetTrackMatrixivNV_remap_index 286 +#define GetVertexAttribPointervNV_remap_index 287 +#define GetVertexAttribdvNV_remap_index 288 +#define GetVertexAttribfvNV_remap_index 289 +#define GetVertexAttribivNV_remap_index 290 +#define IsProgramNV_remap_index 291 +#define LoadProgramNV_remap_index 292 +#define ProgramParameters4dvNV_remap_index 293 +#define ProgramParameters4fvNV_remap_index 294 +#define RequestResidentProgramsNV_remap_index 295 +#define TrackMatrixNV_remap_index 296 +#define VertexAttrib1dNV_remap_index 297 +#define VertexAttrib1dvNV_remap_index 298 +#define VertexAttrib1fNV_remap_index 299 +#define VertexAttrib1fvNV_remap_index 300 +#define VertexAttrib1sNV_remap_index 301 +#define VertexAttrib1svNV_remap_index 302 +#define VertexAttrib2dNV_remap_index 303 +#define VertexAttrib2dvNV_remap_index 304 +#define VertexAttrib2fNV_remap_index 305 +#define VertexAttrib2fvNV_remap_index 306 +#define VertexAttrib2sNV_remap_index 307 +#define VertexAttrib2svNV_remap_index 308 +#define VertexAttrib3dNV_remap_index 309 +#define VertexAttrib3dvNV_remap_index 310 +#define VertexAttrib3fNV_remap_index 311 +#define VertexAttrib3fvNV_remap_index 312 +#define VertexAttrib3sNV_remap_index 313 +#define VertexAttrib3svNV_remap_index 314 +#define VertexAttrib4dNV_remap_index 315 +#define VertexAttrib4dvNV_remap_index 316 +#define VertexAttrib4fNV_remap_index 317 +#define VertexAttrib4fvNV_remap_index 318 +#define VertexAttrib4sNV_remap_index 319 +#define VertexAttrib4svNV_remap_index 320 +#define VertexAttrib4ubNV_remap_index 321 +#define VertexAttrib4ubvNV_remap_index 322 +#define VertexAttribPointerNV_remap_index 323 +#define VertexAttribs1dvNV_remap_index 324 +#define VertexAttribs1fvNV_remap_index 325 +#define VertexAttribs1svNV_remap_index 326 +#define VertexAttribs2dvNV_remap_index 327 +#define VertexAttribs2fvNV_remap_index 328 +#define VertexAttribs2svNV_remap_index 329 +#define VertexAttribs3dvNV_remap_index 330 +#define VertexAttribs3fvNV_remap_index 331 +#define VertexAttribs3svNV_remap_index 332 +#define VertexAttribs4dvNV_remap_index 333 +#define VertexAttribs4fvNV_remap_index 334 +#define VertexAttribs4svNV_remap_index 335 +#define VertexAttribs4ubvNV_remap_index 336 +#define GetTexBumpParameterfvATI_remap_index 337 +#define GetTexBumpParameterivATI_remap_index 338 +#define TexBumpParameterfvATI_remap_index 339 +#define TexBumpParameterivATI_remap_index 340 +#define AlphaFragmentOp1ATI_remap_index 341 +#define AlphaFragmentOp2ATI_remap_index 342 +#define AlphaFragmentOp3ATI_remap_index 343 +#define BeginFragmentShaderATI_remap_index 344 +#define BindFragmentShaderATI_remap_index 345 +#define ColorFragmentOp1ATI_remap_index 346 +#define ColorFragmentOp2ATI_remap_index 347 +#define ColorFragmentOp3ATI_remap_index 348 +#define DeleteFragmentShaderATI_remap_index 349 +#define EndFragmentShaderATI_remap_index 350 +#define GenFragmentShadersATI_remap_index 351 +#define PassTexCoordATI_remap_index 352 +#define SampleMapATI_remap_index 353 +#define SetFragmentShaderConstantATI_remap_index 354 +#define PointParameteriNV_remap_index 355 +#define PointParameterivNV_remap_index 356 +#define ActiveStencilFaceEXT_remap_index 357 +#define BindVertexArrayAPPLE_remap_index 358 +#define DeleteVertexArraysAPPLE_remap_index 359 +#define GenVertexArraysAPPLE_remap_index 360 +#define IsVertexArrayAPPLE_remap_index 361 +#define GetProgramNamedParameterdvNV_remap_index 362 +#define GetProgramNamedParameterfvNV_remap_index 363 +#define ProgramNamedParameter4dNV_remap_index 364 +#define ProgramNamedParameter4dvNV_remap_index 365 +#define ProgramNamedParameter4fNV_remap_index 366 +#define ProgramNamedParameter4fvNV_remap_index 367 +#define DepthBoundsEXT_remap_index 368 +#define BlendEquationSeparateEXT_remap_index 369 +#define BindFramebufferEXT_remap_index 370 +#define BindRenderbufferEXT_remap_index 371 +#define CheckFramebufferStatusEXT_remap_index 372 +#define DeleteFramebuffersEXT_remap_index 373 +#define DeleteRenderbuffersEXT_remap_index 374 +#define FramebufferRenderbufferEXT_remap_index 375 +#define FramebufferTexture1DEXT_remap_index 376 +#define FramebufferTexture2DEXT_remap_index 377 +#define FramebufferTexture3DEXT_remap_index 378 +#define GenFramebuffersEXT_remap_index 379 +#define GenRenderbuffersEXT_remap_index 380 +#define GenerateMipmapEXT_remap_index 381 +#define GetFramebufferAttachmentParameterivEXT_remap_index 382 +#define GetRenderbufferParameterivEXT_remap_index 383 +#define IsFramebufferEXT_remap_index 384 +#define IsRenderbufferEXT_remap_index 385 +#define RenderbufferStorageEXT_remap_index 386 +#define BlitFramebufferEXT_remap_index 387 +#define BufferParameteriAPPLE_remap_index 388 +#define FlushMappedBufferRangeAPPLE_remap_index 389 +#define FramebufferTextureLayerEXT_remap_index 390 +#define ColorMaskIndexedEXT_remap_index 391 +#define DisableIndexedEXT_remap_index 392 +#define EnableIndexedEXT_remap_index 393 +#define GetBooleanIndexedvEXT_remap_index 394 +#define GetIntegerIndexedvEXT_remap_index 395 +#define IsEnabledIndexedEXT_remap_index 396 +#define BeginConditionalRenderNV_remap_index 397 +#define EndConditionalRenderNV_remap_index 398 +#define BeginTransformFeedbackEXT_remap_index 399 +#define BindBufferBaseEXT_remap_index 400 +#define BindBufferOffsetEXT_remap_index 401 +#define BindBufferRangeEXT_remap_index 402 +#define EndTransformFeedbackEXT_remap_index 403 +#define GetTransformFeedbackVaryingEXT_remap_index 404 +#define TransformFeedbackVaryingsEXT_remap_index 405 +#define ProvokingVertexEXT_remap_index 406 +#define GetTexParameterPointervAPPLE_remap_index 407 +#define TextureRangeAPPLE_remap_index 408 +#define GetObjectParameterivAPPLE_remap_index 409 +#define ObjectPurgeableAPPLE_remap_index 410 +#define ObjectUnpurgeableAPPLE_remap_index 411 +#define StencilFuncSeparateATI_remap_index 412 +#define ProgramEnvParameters4fvEXT_remap_index 413 +#define ProgramLocalParameters4fvEXT_remap_index 414 +#define GetQueryObjecti64vEXT_remap_index 415 +#define GetQueryObjectui64vEXT_remap_index 416 +#define EGLImageTargetRenderbufferStorageOES_remap_index 417 +#define EGLImageTargetTexture2DOES_remap_index 418 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -2958,6 +3034,12 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_UniformMatrix4x3fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix4x3fv_remap_index], parameters) #define GET_UniformMatrix4x3fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x3fv_remap_index]) #define SET_UniformMatrix4x3fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x3fv_remap_index], fn) +#define CALL_DrawArraysInstanced(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLsizei, GLsizei)), driDispatchRemapTable[DrawArraysInstanced_remap_index], parameters) +#define GET_DrawArraysInstanced(disp) GET_by_offset(disp, driDispatchRemapTable[DrawArraysInstanced_remap_index]) +#define SET_DrawArraysInstanced(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawArraysInstanced_remap_index], fn) +#define CALL_DrawElementsInstanced(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei)), driDispatchRemapTable[DrawElementsInstanced_remap_index], parameters) +#define GET_DrawElementsInstanced(disp) GET_by_offset(disp, driDispatchRemapTable[DrawElementsInstanced_remap_index]) +#define SET_DrawElementsInstanced(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawElementsInstanced_remap_index], fn) #define CALL_LoadTransposeMatrixdARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], parameters) #define GET_LoadTransposeMatrixdARB(disp) GET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index]) #define SET_LoadTransposeMatrixdARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], fn) @@ -3354,6 +3436,15 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_RenderbufferStorageMultisample(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)), driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], parameters) #define GET_RenderbufferStorageMultisample(disp) GET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index]) #define SET_RenderbufferStorageMultisample(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], fn) +#define CALL_FramebufferTextureARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLuint, GLint)), driDispatchRemapTable[FramebufferTextureARB_remap_index], parameters) +#define GET_FramebufferTextureARB(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTextureARB_remap_index]) +#define SET_FramebufferTextureARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTextureARB_remap_index], fn) +#define CALL_FramebufferTextureFaceARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLuint, GLint, GLenum)), driDispatchRemapTable[FramebufferTextureFaceARB_remap_index], parameters) +#define GET_FramebufferTextureFaceARB(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTextureFaceARB_remap_index]) +#define SET_FramebufferTextureFaceARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTextureFaceARB_remap_index], fn) +#define CALL_ProgramParameteriARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint)), driDispatchRemapTable[ProgramParameteriARB_remap_index], parameters) +#define GET_ProgramParameteriARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameteriARB_remap_index]) +#define SET_ProgramParameteriARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameteriARB_remap_index], fn) #define CALL_FlushMappedBufferRange(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptr, GLsizeiptr)), driDispatchRemapTable[FlushMappedBufferRange_remap_index], parameters) #define GET_FlushMappedBufferRange(disp) GET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRange_remap_index]) #define SET_FlushMappedBufferRange(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRange_remap_index], fn) @@ -3399,6 +3490,27 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_MultiDrawElementsBaseVertex(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei, const GLint *)), driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index], parameters) #define GET_MultiDrawElementsBaseVertex(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index]) #define SET_MultiDrawElementsBaseVertex(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index], fn) +#define CALL_BindTransformFeedback(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindTransformFeedback_remap_index], parameters) +#define GET_BindTransformFeedback(disp) GET_by_offset(disp, driDispatchRemapTable[BindTransformFeedback_remap_index]) +#define SET_BindTransformFeedback(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindTransformFeedback_remap_index], fn) +#define CALL_DeleteTransformFeedbacks(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteTransformFeedbacks_remap_index], parameters) +#define GET_DeleteTransformFeedbacks(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteTransformFeedbacks_remap_index]) +#define SET_DeleteTransformFeedbacks(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteTransformFeedbacks_remap_index], fn) +#define CALL_DrawTransformFeedback(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[DrawTransformFeedback_remap_index], parameters) +#define GET_DrawTransformFeedback(disp) GET_by_offset(disp, driDispatchRemapTable[DrawTransformFeedback_remap_index]) +#define SET_DrawTransformFeedback(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawTransformFeedback_remap_index], fn) +#define CALL_GenTransformFeedbacks(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenTransformFeedbacks_remap_index], parameters) +#define GET_GenTransformFeedbacks(disp) GET_by_offset(disp, driDispatchRemapTable[GenTransformFeedbacks_remap_index]) +#define SET_GenTransformFeedbacks(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenTransformFeedbacks_remap_index], fn) +#define CALL_IsTransformFeedback(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsTransformFeedback_remap_index], parameters) +#define GET_IsTransformFeedback(disp) GET_by_offset(disp, driDispatchRemapTable[IsTransformFeedback_remap_index]) +#define SET_IsTransformFeedback(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsTransformFeedback_remap_index], fn) +#define CALL_PauseTransformFeedback(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[PauseTransformFeedback_remap_index], parameters) +#define GET_PauseTransformFeedback(disp) GET_by_offset(disp, driDispatchRemapTable[PauseTransformFeedback_remap_index]) +#define SET_PauseTransformFeedback(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PauseTransformFeedback_remap_index], fn) +#define CALL_ResumeTransformFeedback(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[ResumeTransformFeedback_remap_index], parameters) +#define GET_ResumeTransformFeedback(disp) GET_by_offset(disp, driDispatchRemapTable[ResumeTransformFeedback_remap_index]) +#define SET_ResumeTransformFeedback(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ResumeTransformFeedback_remap_index], fn) #define CALL_PolygonOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[PolygonOffsetEXT_remap_index], parameters) #define GET_PolygonOffsetEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index]) #define SET_PolygonOffsetEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index], fn) @@ -3513,7 +3625,7 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_SecondaryColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], parameters) #define GET_SecondaryColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index]) #define SET_SecondaryColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], fn) -#define CALL_MultiDrawArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *, GLsizei *, GLsizei)), driDispatchRemapTable[MultiDrawArraysEXT_remap_index], parameters) +#define CALL_MultiDrawArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *, const GLsizei *, GLsizei)), driDispatchRemapTable[MultiDrawArraysEXT_remap_index], parameters) #define GET_MultiDrawArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index]) #define SET_MultiDrawArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index], fn) #define CALL_MultiDrawElementsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei)), driDispatchRemapTable[MultiDrawElementsEXT_remap_index], parameters) @@ -4053,6 +4165,27 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_EndConditionalRenderNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[EndConditionalRenderNV_remap_index], parameters) #define GET_EndConditionalRenderNV(disp) GET_by_offset(disp, driDispatchRemapTable[EndConditionalRenderNV_remap_index]) #define SET_EndConditionalRenderNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndConditionalRenderNV_remap_index], fn) +#define CALL_BeginTransformFeedbackEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index], parameters) +#define GET_BeginTransformFeedbackEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index]) +#define SET_BeginTransformFeedbackEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index], fn) +#define CALL_BindBufferBaseEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint)), driDispatchRemapTable[BindBufferBaseEXT_remap_index], parameters) +#define GET_BindBufferBaseEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferBaseEXT_remap_index]) +#define SET_BindBufferBaseEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferBaseEXT_remap_index], fn) +#define CALL_BindBufferOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLintptr)), driDispatchRemapTable[BindBufferOffsetEXT_remap_index], parameters) +#define GET_BindBufferOffsetEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferOffsetEXT_remap_index]) +#define SET_BindBufferOffsetEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferOffsetEXT_remap_index], fn) +#define CALL_BindBufferRangeEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr)), driDispatchRemapTable[BindBufferRangeEXT_remap_index], parameters) +#define GET_BindBufferRangeEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferRangeEXT_remap_index]) +#define SET_BindBufferRangeEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferRangeEXT_remap_index], fn) +#define CALL_EndTransformFeedbackEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[EndTransformFeedbackEXT_remap_index], parameters) +#define GET_EndTransformFeedbackEXT(disp) GET_by_offset(disp, driDispatchRemapTable[EndTransformFeedbackEXT_remap_index]) +#define SET_EndTransformFeedbackEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndTransformFeedbackEXT_remap_index], fn) +#define CALL_GetTransformFeedbackVaryingEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *)), driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index], parameters) +#define GET_GetTransformFeedbackVaryingEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index]) +#define SET_GetTransformFeedbackVaryingEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index], fn) +#define CALL_TransformFeedbackVaryingsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const char **, GLenum)), driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index], parameters) +#define GET_TransformFeedbackVaryingsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index]) +#define SET_TransformFeedbackVaryingsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index], fn) #define CALL_ProvokingVertexEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[ProvokingVertexEXT_remap_index], parameters) #define GET_ProvokingVertexEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index]) #define SET_ProvokingVertexEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index], fn) diff --git a/mesalib/src/mapi/glapi/glapioffsets.h b/mesalib/src/mapi/glapi/glapioffsets.h index 6d7bc2a0f..a790d8732 100644 --- a/mesalib/src/mapi/glapi/glapioffsets.h +++ b/mesalib/src/mapi/glapi/glapioffsets.h @@ -464,385 +464,404 @@ #define _gloffset_UniformMatrix3x4fv 427 #define _gloffset_UniformMatrix4x2fv 428 #define _gloffset_UniformMatrix4x3fv 429 -#define _gloffset_LoadTransposeMatrixdARB 430 -#define _gloffset_LoadTransposeMatrixfARB 431 -#define _gloffset_MultTransposeMatrixdARB 432 -#define _gloffset_MultTransposeMatrixfARB 433 -#define _gloffset_SampleCoverageARB 434 -#define _gloffset_CompressedTexImage1DARB 435 -#define _gloffset_CompressedTexImage2DARB 436 -#define _gloffset_CompressedTexImage3DARB 437 -#define _gloffset_CompressedTexSubImage1DARB 438 -#define _gloffset_CompressedTexSubImage2DARB 439 -#define _gloffset_CompressedTexSubImage3DARB 440 -#define _gloffset_GetCompressedTexImageARB 441 -#define _gloffset_DisableVertexAttribArrayARB 442 -#define _gloffset_EnableVertexAttribArrayARB 443 -#define _gloffset_GetProgramEnvParameterdvARB 444 -#define _gloffset_GetProgramEnvParameterfvARB 445 -#define _gloffset_GetProgramLocalParameterdvARB 446 -#define _gloffset_GetProgramLocalParameterfvARB 447 -#define _gloffset_GetProgramStringARB 448 -#define _gloffset_GetProgramivARB 449 -#define _gloffset_GetVertexAttribdvARB 450 -#define _gloffset_GetVertexAttribfvARB 451 -#define _gloffset_GetVertexAttribivARB 452 -#define _gloffset_ProgramEnvParameter4dARB 453 -#define _gloffset_ProgramEnvParameter4dvARB 454 -#define _gloffset_ProgramEnvParameter4fARB 455 -#define _gloffset_ProgramEnvParameter4fvARB 456 -#define _gloffset_ProgramLocalParameter4dARB 457 -#define _gloffset_ProgramLocalParameter4dvARB 458 -#define _gloffset_ProgramLocalParameter4fARB 459 -#define _gloffset_ProgramLocalParameter4fvARB 460 -#define _gloffset_ProgramStringARB 461 -#define _gloffset_VertexAttrib1dARB 462 -#define _gloffset_VertexAttrib1dvARB 463 -#define _gloffset_VertexAttrib1fARB 464 -#define _gloffset_VertexAttrib1fvARB 465 -#define _gloffset_VertexAttrib1sARB 466 -#define _gloffset_VertexAttrib1svARB 467 -#define _gloffset_VertexAttrib2dARB 468 -#define _gloffset_VertexAttrib2dvARB 469 -#define _gloffset_VertexAttrib2fARB 470 -#define _gloffset_VertexAttrib2fvARB 471 -#define _gloffset_VertexAttrib2sARB 472 -#define _gloffset_VertexAttrib2svARB 473 -#define _gloffset_VertexAttrib3dARB 474 -#define _gloffset_VertexAttrib3dvARB 475 -#define _gloffset_VertexAttrib3fARB 476 -#define _gloffset_VertexAttrib3fvARB 477 -#define _gloffset_VertexAttrib3sARB 478 -#define _gloffset_VertexAttrib3svARB 479 -#define _gloffset_VertexAttrib4NbvARB 480 -#define _gloffset_VertexAttrib4NivARB 481 -#define _gloffset_VertexAttrib4NsvARB 482 -#define _gloffset_VertexAttrib4NubARB 483 -#define _gloffset_VertexAttrib4NubvARB 484 -#define _gloffset_VertexAttrib4NuivARB 485 -#define _gloffset_VertexAttrib4NusvARB 486 -#define _gloffset_VertexAttrib4bvARB 487 -#define _gloffset_VertexAttrib4dARB 488 -#define _gloffset_VertexAttrib4dvARB 489 -#define _gloffset_VertexAttrib4fARB 490 -#define _gloffset_VertexAttrib4fvARB 491 -#define _gloffset_VertexAttrib4ivARB 492 -#define _gloffset_VertexAttrib4sARB 493 -#define _gloffset_VertexAttrib4svARB 494 -#define _gloffset_VertexAttrib4ubvARB 495 -#define _gloffset_VertexAttrib4uivARB 496 -#define _gloffset_VertexAttrib4usvARB 497 -#define _gloffset_VertexAttribPointerARB 498 -#define _gloffset_BindBufferARB 499 -#define _gloffset_BufferDataARB 500 -#define _gloffset_BufferSubDataARB 501 -#define _gloffset_DeleteBuffersARB 502 -#define _gloffset_GenBuffersARB 503 -#define _gloffset_GetBufferParameterivARB 504 -#define _gloffset_GetBufferPointervARB 505 -#define _gloffset_GetBufferSubDataARB 506 -#define _gloffset_IsBufferARB 507 -#define _gloffset_MapBufferARB 508 -#define _gloffset_UnmapBufferARB 509 -#define _gloffset_BeginQueryARB 510 -#define _gloffset_DeleteQueriesARB 511 -#define _gloffset_EndQueryARB 512 -#define _gloffset_GenQueriesARB 513 -#define _gloffset_GetQueryObjectivARB 514 -#define _gloffset_GetQueryObjectuivARB 515 -#define _gloffset_GetQueryivARB 516 -#define _gloffset_IsQueryARB 517 -#define _gloffset_AttachObjectARB 518 -#define _gloffset_CompileShaderARB 519 -#define _gloffset_CreateProgramObjectARB 520 -#define _gloffset_CreateShaderObjectARB 521 -#define _gloffset_DeleteObjectARB 522 -#define _gloffset_DetachObjectARB 523 -#define _gloffset_GetActiveUniformARB 524 -#define _gloffset_GetAttachedObjectsARB 525 -#define _gloffset_GetHandleARB 526 -#define _gloffset_GetInfoLogARB 527 -#define _gloffset_GetObjectParameterfvARB 528 -#define _gloffset_GetObjectParameterivARB 529 -#define _gloffset_GetShaderSourceARB 530 -#define _gloffset_GetUniformLocationARB 531 -#define _gloffset_GetUniformfvARB 532 -#define _gloffset_GetUniformivARB 533 -#define _gloffset_LinkProgramARB 534 -#define _gloffset_ShaderSourceARB 535 -#define _gloffset_Uniform1fARB 536 -#define _gloffset_Uniform1fvARB 537 -#define _gloffset_Uniform1iARB 538 -#define _gloffset_Uniform1ivARB 539 -#define _gloffset_Uniform2fARB 540 -#define _gloffset_Uniform2fvARB 541 -#define _gloffset_Uniform2iARB 542 -#define _gloffset_Uniform2ivARB 543 -#define _gloffset_Uniform3fARB 544 -#define _gloffset_Uniform3fvARB 545 -#define _gloffset_Uniform3iARB 546 -#define _gloffset_Uniform3ivARB 547 -#define _gloffset_Uniform4fARB 548 -#define _gloffset_Uniform4fvARB 549 -#define _gloffset_Uniform4iARB 550 -#define _gloffset_Uniform4ivARB 551 -#define _gloffset_UniformMatrix2fvARB 552 -#define _gloffset_UniformMatrix3fvARB 553 -#define _gloffset_UniformMatrix4fvARB 554 -#define _gloffset_UseProgramObjectARB 555 -#define _gloffset_ValidateProgramARB 556 -#define _gloffset_BindAttribLocationARB 557 -#define _gloffset_GetActiveAttribARB 558 -#define _gloffset_GetAttribLocationARB 559 -#define _gloffset_DrawBuffersARB 560 -#define _gloffset_RenderbufferStorageMultisample 561 -#define _gloffset_FlushMappedBufferRange 562 -#define _gloffset_MapBufferRange 563 -#define _gloffset_BindVertexArray 564 -#define _gloffset_GenVertexArrays 565 -#define _gloffset_CopyBufferSubData 566 -#define _gloffset_ClientWaitSync 567 -#define _gloffset_DeleteSync 568 -#define _gloffset_FenceSync 569 -#define _gloffset_GetInteger64v 570 -#define _gloffset_GetSynciv 571 -#define _gloffset_IsSync 572 -#define _gloffset_WaitSync 573 -#define _gloffset_DrawElementsBaseVertex 574 -#define _gloffset_DrawRangeElementsBaseVertex 575 -#define _gloffset_MultiDrawElementsBaseVertex 576 -#define _gloffset_PolygonOffsetEXT 577 -#define _gloffset_GetPixelTexGenParameterfvSGIS 578 -#define _gloffset_GetPixelTexGenParameterivSGIS 579 -#define _gloffset_PixelTexGenParameterfSGIS 580 -#define _gloffset_PixelTexGenParameterfvSGIS 581 -#define _gloffset_PixelTexGenParameteriSGIS 582 -#define _gloffset_PixelTexGenParameterivSGIS 583 -#define _gloffset_SampleMaskSGIS 584 -#define _gloffset_SamplePatternSGIS 585 -#define _gloffset_ColorPointerEXT 586 -#define _gloffset_EdgeFlagPointerEXT 587 -#define _gloffset_IndexPointerEXT 588 -#define _gloffset_NormalPointerEXT 589 -#define _gloffset_TexCoordPointerEXT 590 -#define _gloffset_VertexPointerEXT 591 -#define _gloffset_PointParameterfEXT 592 -#define _gloffset_PointParameterfvEXT 593 -#define _gloffset_LockArraysEXT 594 -#define _gloffset_UnlockArraysEXT 595 -#define _gloffset_CullParameterdvEXT 596 -#define _gloffset_CullParameterfvEXT 597 -#define _gloffset_SecondaryColor3bEXT 598 -#define _gloffset_SecondaryColor3bvEXT 599 -#define _gloffset_SecondaryColor3dEXT 600 -#define _gloffset_SecondaryColor3dvEXT 601 -#define _gloffset_SecondaryColor3fEXT 602 -#define _gloffset_SecondaryColor3fvEXT 603 -#define _gloffset_SecondaryColor3iEXT 604 -#define _gloffset_SecondaryColor3ivEXT 605 -#define _gloffset_SecondaryColor3sEXT 606 -#define _gloffset_SecondaryColor3svEXT 607 -#define _gloffset_SecondaryColor3ubEXT 608 -#define _gloffset_SecondaryColor3ubvEXT 609 -#define _gloffset_SecondaryColor3uiEXT 610 -#define _gloffset_SecondaryColor3uivEXT 611 -#define _gloffset_SecondaryColor3usEXT 612 -#define _gloffset_SecondaryColor3usvEXT 613 -#define _gloffset_SecondaryColorPointerEXT 614 -#define _gloffset_MultiDrawArraysEXT 615 -#define _gloffset_MultiDrawElementsEXT 616 -#define _gloffset_FogCoordPointerEXT 617 -#define _gloffset_FogCoorddEXT 618 -#define _gloffset_FogCoorddvEXT 619 -#define _gloffset_FogCoordfEXT 620 -#define _gloffset_FogCoordfvEXT 621 -#define _gloffset_PixelTexGenSGIX 622 -#define _gloffset_BlendFuncSeparateEXT 623 -#define _gloffset_FlushVertexArrayRangeNV 624 -#define _gloffset_VertexArrayRangeNV 625 -#define _gloffset_CombinerInputNV 626 -#define _gloffset_CombinerOutputNV 627 -#define _gloffset_CombinerParameterfNV 628 -#define _gloffset_CombinerParameterfvNV 629 -#define _gloffset_CombinerParameteriNV 630 -#define _gloffset_CombinerParameterivNV 631 -#define _gloffset_FinalCombinerInputNV 632 -#define _gloffset_GetCombinerInputParameterfvNV 633 -#define _gloffset_GetCombinerInputParameterivNV 634 -#define _gloffset_GetCombinerOutputParameterfvNV 635 -#define _gloffset_GetCombinerOutputParameterivNV 636 -#define _gloffset_GetFinalCombinerInputParameterfvNV 637 -#define _gloffset_GetFinalCombinerInputParameterivNV 638 -#define _gloffset_ResizeBuffersMESA 639 -#define _gloffset_WindowPos2dMESA 640 -#define _gloffset_WindowPos2dvMESA 641 -#define _gloffset_WindowPos2fMESA 642 -#define _gloffset_WindowPos2fvMESA 643 -#define _gloffset_WindowPos2iMESA 644 -#define _gloffset_WindowPos2ivMESA 645 -#define _gloffset_WindowPos2sMESA 646 -#define _gloffset_WindowPos2svMESA 647 -#define _gloffset_WindowPos3dMESA 648 -#define _gloffset_WindowPos3dvMESA 649 -#define _gloffset_WindowPos3fMESA 650 -#define _gloffset_WindowPos3fvMESA 651 -#define _gloffset_WindowPos3iMESA 652 -#define _gloffset_WindowPos3ivMESA 653 -#define _gloffset_WindowPos3sMESA 654 -#define _gloffset_WindowPos3svMESA 655 -#define _gloffset_WindowPos4dMESA 656 -#define _gloffset_WindowPos4dvMESA 657 -#define _gloffset_WindowPos4fMESA 658 -#define _gloffset_WindowPos4fvMESA 659 -#define _gloffset_WindowPos4iMESA 660 -#define _gloffset_WindowPos4ivMESA 661 -#define _gloffset_WindowPos4sMESA 662 -#define _gloffset_WindowPos4svMESA 663 -#define _gloffset_MultiModeDrawArraysIBM 664 -#define _gloffset_MultiModeDrawElementsIBM 665 -#define _gloffset_DeleteFencesNV 666 -#define _gloffset_FinishFenceNV 667 -#define _gloffset_GenFencesNV 668 -#define _gloffset_GetFenceivNV 669 -#define _gloffset_IsFenceNV 670 -#define _gloffset_SetFenceNV 671 -#define _gloffset_TestFenceNV 672 -#define _gloffset_AreProgramsResidentNV 673 -#define _gloffset_BindProgramNV 674 -#define _gloffset_DeleteProgramsNV 675 -#define _gloffset_ExecuteProgramNV 676 -#define _gloffset_GenProgramsNV 677 -#define _gloffset_GetProgramParameterdvNV 678 -#define _gloffset_GetProgramParameterfvNV 679 -#define _gloffset_GetProgramStringNV 680 -#define _gloffset_GetProgramivNV 681 -#define _gloffset_GetTrackMatrixivNV 682 -#define _gloffset_GetVertexAttribPointervNV 683 -#define _gloffset_GetVertexAttribdvNV 684 -#define _gloffset_GetVertexAttribfvNV 685 -#define _gloffset_GetVertexAttribivNV 686 -#define _gloffset_IsProgramNV 687 -#define _gloffset_LoadProgramNV 688 -#define _gloffset_ProgramParameters4dvNV 689 -#define _gloffset_ProgramParameters4fvNV 690 -#define _gloffset_RequestResidentProgramsNV 691 -#define _gloffset_TrackMatrixNV 692 -#define _gloffset_VertexAttrib1dNV 693 -#define _gloffset_VertexAttrib1dvNV 694 -#define _gloffset_VertexAttrib1fNV 695 -#define _gloffset_VertexAttrib1fvNV 696 -#define _gloffset_VertexAttrib1sNV 697 -#define _gloffset_VertexAttrib1svNV 698 -#define _gloffset_VertexAttrib2dNV 699 -#define _gloffset_VertexAttrib2dvNV 700 -#define _gloffset_VertexAttrib2fNV 701 -#define _gloffset_VertexAttrib2fvNV 702 -#define _gloffset_VertexAttrib2sNV 703 -#define _gloffset_VertexAttrib2svNV 704 -#define _gloffset_VertexAttrib3dNV 705 -#define _gloffset_VertexAttrib3dvNV 706 -#define _gloffset_VertexAttrib3fNV 707 -#define _gloffset_VertexAttrib3fvNV 708 -#define _gloffset_VertexAttrib3sNV 709 -#define _gloffset_VertexAttrib3svNV 710 -#define _gloffset_VertexAttrib4dNV 711 -#define _gloffset_VertexAttrib4dvNV 712 -#define _gloffset_VertexAttrib4fNV 713 -#define _gloffset_VertexAttrib4fvNV 714 -#define _gloffset_VertexAttrib4sNV 715 -#define _gloffset_VertexAttrib4svNV 716 -#define _gloffset_VertexAttrib4ubNV 717 -#define _gloffset_VertexAttrib4ubvNV 718 -#define _gloffset_VertexAttribPointerNV 719 -#define _gloffset_VertexAttribs1dvNV 720 -#define _gloffset_VertexAttribs1fvNV 721 -#define _gloffset_VertexAttribs1svNV 722 -#define _gloffset_VertexAttribs2dvNV 723 -#define _gloffset_VertexAttribs2fvNV 724 -#define _gloffset_VertexAttribs2svNV 725 -#define _gloffset_VertexAttribs3dvNV 726 -#define _gloffset_VertexAttribs3fvNV 727 -#define _gloffset_VertexAttribs3svNV 728 -#define _gloffset_VertexAttribs4dvNV 729 -#define _gloffset_VertexAttribs4fvNV 730 -#define _gloffset_VertexAttribs4svNV 731 -#define _gloffset_VertexAttribs4ubvNV 732 -#define _gloffset_GetTexBumpParameterfvATI 733 -#define _gloffset_GetTexBumpParameterivATI 734 -#define _gloffset_TexBumpParameterfvATI 735 -#define _gloffset_TexBumpParameterivATI 736 -#define _gloffset_AlphaFragmentOp1ATI 737 -#define _gloffset_AlphaFragmentOp2ATI 738 -#define _gloffset_AlphaFragmentOp3ATI 739 -#define _gloffset_BeginFragmentShaderATI 740 -#define _gloffset_BindFragmentShaderATI 741 -#define _gloffset_ColorFragmentOp1ATI 742 -#define _gloffset_ColorFragmentOp2ATI 743 -#define _gloffset_ColorFragmentOp3ATI 744 -#define _gloffset_DeleteFragmentShaderATI 745 -#define _gloffset_EndFragmentShaderATI 746 -#define _gloffset_GenFragmentShadersATI 747 -#define _gloffset_PassTexCoordATI 748 -#define _gloffset_SampleMapATI 749 -#define _gloffset_SetFragmentShaderConstantATI 750 -#define _gloffset_PointParameteriNV 751 -#define _gloffset_PointParameterivNV 752 -#define _gloffset_ActiveStencilFaceEXT 753 -#define _gloffset_BindVertexArrayAPPLE 754 -#define _gloffset_DeleteVertexArraysAPPLE 755 -#define _gloffset_GenVertexArraysAPPLE 756 -#define _gloffset_IsVertexArrayAPPLE 757 -#define _gloffset_GetProgramNamedParameterdvNV 758 -#define _gloffset_GetProgramNamedParameterfvNV 759 -#define _gloffset_ProgramNamedParameter4dNV 760 -#define _gloffset_ProgramNamedParameter4dvNV 761 -#define _gloffset_ProgramNamedParameter4fNV 762 -#define _gloffset_ProgramNamedParameter4fvNV 763 -#define _gloffset_DepthBoundsEXT 764 -#define _gloffset_BlendEquationSeparateEXT 765 -#define _gloffset_BindFramebufferEXT 766 -#define _gloffset_BindRenderbufferEXT 767 -#define _gloffset_CheckFramebufferStatusEXT 768 -#define _gloffset_DeleteFramebuffersEXT 769 -#define _gloffset_DeleteRenderbuffersEXT 770 -#define _gloffset_FramebufferRenderbufferEXT 771 -#define _gloffset_FramebufferTexture1DEXT 772 -#define _gloffset_FramebufferTexture2DEXT 773 -#define _gloffset_FramebufferTexture3DEXT 774 -#define _gloffset_GenFramebuffersEXT 775 -#define _gloffset_GenRenderbuffersEXT 776 -#define _gloffset_GenerateMipmapEXT 777 -#define _gloffset_GetFramebufferAttachmentParameterivEXT 778 -#define _gloffset_GetRenderbufferParameterivEXT 779 -#define _gloffset_IsFramebufferEXT 780 -#define _gloffset_IsRenderbufferEXT 781 -#define _gloffset_RenderbufferStorageEXT 782 -#define _gloffset_BlitFramebufferEXT 783 -#define _gloffset_BufferParameteriAPPLE 784 -#define _gloffset_FlushMappedBufferRangeAPPLE 785 -#define _gloffset_FramebufferTextureLayerEXT 786 -#define _gloffset_ColorMaskIndexedEXT 787 -#define _gloffset_DisableIndexedEXT 788 -#define _gloffset_EnableIndexedEXT 789 -#define _gloffset_GetBooleanIndexedvEXT 790 -#define _gloffset_GetIntegerIndexedvEXT 791 -#define _gloffset_IsEnabledIndexedEXT 792 -#define _gloffset_BeginConditionalRenderNV 793 -#define _gloffset_EndConditionalRenderNV 794 -#define _gloffset_ProvokingVertexEXT 795 -#define _gloffset_GetTexParameterPointervAPPLE 796 -#define _gloffset_TextureRangeAPPLE 797 -#define _gloffset_GetObjectParameterivAPPLE 798 -#define _gloffset_ObjectPurgeableAPPLE 799 -#define _gloffset_ObjectUnpurgeableAPPLE 800 -#define _gloffset_StencilFuncSeparateATI 801 -#define _gloffset_ProgramEnvParameters4fvEXT 802 -#define _gloffset_ProgramLocalParameters4fvEXT 803 -#define _gloffset_GetQueryObjecti64vEXT 804 -#define _gloffset_GetQueryObjectui64vEXT 805 -#define _gloffset_EGLImageTargetRenderbufferStorageOES 806 -#define _gloffset_EGLImageTargetTexture2DOES 807 -#define _gloffset_FIRST_DYNAMIC 808 +#define _gloffset_DrawArraysInstanced 430 +#define _gloffset_DrawElementsInstanced 431 +#define _gloffset_LoadTransposeMatrixdARB 432 +#define _gloffset_LoadTransposeMatrixfARB 433 +#define _gloffset_MultTransposeMatrixdARB 434 +#define _gloffset_MultTransposeMatrixfARB 435 +#define _gloffset_SampleCoverageARB 436 +#define _gloffset_CompressedTexImage1DARB 437 +#define _gloffset_CompressedTexImage2DARB 438 +#define _gloffset_CompressedTexImage3DARB 439 +#define _gloffset_CompressedTexSubImage1DARB 440 +#define _gloffset_CompressedTexSubImage2DARB 441 +#define _gloffset_CompressedTexSubImage3DARB 442 +#define _gloffset_GetCompressedTexImageARB 443 +#define _gloffset_DisableVertexAttribArrayARB 444 +#define _gloffset_EnableVertexAttribArrayARB 445 +#define _gloffset_GetProgramEnvParameterdvARB 446 +#define _gloffset_GetProgramEnvParameterfvARB 447 +#define _gloffset_GetProgramLocalParameterdvARB 448 +#define _gloffset_GetProgramLocalParameterfvARB 449 +#define _gloffset_GetProgramStringARB 450 +#define _gloffset_GetProgramivARB 451 +#define _gloffset_GetVertexAttribdvARB 452 +#define _gloffset_GetVertexAttribfvARB 453 +#define _gloffset_GetVertexAttribivARB 454 +#define _gloffset_ProgramEnvParameter4dARB 455 +#define _gloffset_ProgramEnvParameter4dvARB 456 +#define _gloffset_ProgramEnvParameter4fARB 457 +#define _gloffset_ProgramEnvParameter4fvARB 458 +#define _gloffset_ProgramLocalParameter4dARB 459 +#define _gloffset_ProgramLocalParameter4dvARB 460 +#define _gloffset_ProgramLocalParameter4fARB 461 +#define _gloffset_ProgramLocalParameter4fvARB 462 +#define _gloffset_ProgramStringARB 463 +#define _gloffset_VertexAttrib1dARB 464 +#define _gloffset_VertexAttrib1dvARB 465 +#define _gloffset_VertexAttrib1fARB 466 +#define _gloffset_VertexAttrib1fvARB 467 +#define _gloffset_VertexAttrib1sARB 468 +#define _gloffset_VertexAttrib1svARB 469 +#define _gloffset_VertexAttrib2dARB 470 +#define _gloffset_VertexAttrib2dvARB 471 +#define _gloffset_VertexAttrib2fARB 472 +#define _gloffset_VertexAttrib2fvARB 473 +#define _gloffset_VertexAttrib2sARB 474 +#define _gloffset_VertexAttrib2svARB 475 +#define _gloffset_VertexAttrib3dARB 476 +#define _gloffset_VertexAttrib3dvARB 477 +#define _gloffset_VertexAttrib3fARB 478 +#define _gloffset_VertexAttrib3fvARB 479 +#define _gloffset_VertexAttrib3sARB 480 +#define _gloffset_VertexAttrib3svARB 481 +#define _gloffset_VertexAttrib4NbvARB 482 +#define _gloffset_VertexAttrib4NivARB 483 +#define _gloffset_VertexAttrib4NsvARB 484 +#define _gloffset_VertexAttrib4NubARB 485 +#define _gloffset_VertexAttrib4NubvARB 486 +#define _gloffset_VertexAttrib4NuivARB 487 +#define _gloffset_VertexAttrib4NusvARB 488 +#define _gloffset_VertexAttrib4bvARB 489 +#define _gloffset_VertexAttrib4dARB 490 +#define _gloffset_VertexAttrib4dvARB 491 +#define _gloffset_VertexAttrib4fARB 492 +#define _gloffset_VertexAttrib4fvARB 493 +#define _gloffset_VertexAttrib4ivARB 494 +#define _gloffset_VertexAttrib4sARB 495 +#define _gloffset_VertexAttrib4svARB 496 +#define _gloffset_VertexAttrib4ubvARB 497 +#define _gloffset_VertexAttrib4uivARB 498 +#define _gloffset_VertexAttrib4usvARB 499 +#define _gloffset_VertexAttribPointerARB 500 +#define _gloffset_BindBufferARB 501 +#define _gloffset_BufferDataARB 502 +#define _gloffset_BufferSubDataARB 503 +#define _gloffset_DeleteBuffersARB 504 +#define _gloffset_GenBuffersARB 505 +#define _gloffset_GetBufferParameterivARB 506 +#define _gloffset_GetBufferPointervARB 507 +#define _gloffset_GetBufferSubDataARB 508 +#define _gloffset_IsBufferARB 509 +#define _gloffset_MapBufferARB 510 +#define _gloffset_UnmapBufferARB 511 +#define _gloffset_BeginQueryARB 512 +#define _gloffset_DeleteQueriesARB 513 +#define _gloffset_EndQueryARB 514 +#define _gloffset_GenQueriesARB 515 +#define _gloffset_GetQueryObjectivARB 516 +#define _gloffset_GetQueryObjectuivARB 517 +#define _gloffset_GetQueryivARB 518 +#define _gloffset_IsQueryARB 519 +#define _gloffset_AttachObjectARB 520 +#define _gloffset_CompileShaderARB 521 +#define _gloffset_CreateProgramObjectARB 522 +#define _gloffset_CreateShaderObjectARB 523 +#define _gloffset_DeleteObjectARB 524 +#define _gloffset_DetachObjectARB 525 +#define _gloffset_GetActiveUniformARB 526 +#define _gloffset_GetAttachedObjectsARB 527 +#define _gloffset_GetHandleARB 528 +#define _gloffset_GetInfoLogARB 529 +#define _gloffset_GetObjectParameterfvARB 530 +#define _gloffset_GetObjectParameterivARB 531 +#define _gloffset_GetShaderSourceARB 532 +#define _gloffset_GetUniformLocationARB 533 +#define _gloffset_GetUniformfvARB 534 +#define _gloffset_GetUniformivARB 535 +#define _gloffset_LinkProgramARB 536 +#define _gloffset_ShaderSourceARB 537 +#define _gloffset_Uniform1fARB 538 +#define _gloffset_Uniform1fvARB 539 +#define _gloffset_Uniform1iARB 540 +#define _gloffset_Uniform1ivARB 541 +#define _gloffset_Uniform2fARB 542 +#define _gloffset_Uniform2fvARB 543 +#define _gloffset_Uniform2iARB 544 +#define _gloffset_Uniform2ivARB 545 +#define _gloffset_Uniform3fARB 546 +#define _gloffset_Uniform3fvARB 547 +#define _gloffset_Uniform3iARB 548 +#define _gloffset_Uniform3ivARB 549 +#define _gloffset_Uniform4fARB 550 +#define _gloffset_Uniform4fvARB 551 +#define _gloffset_Uniform4iARB 552 +#define _gloffset_Uniform4ivARB 553 +#define _gloffset_UniformMatrix2fvARB 554 +#define _gloffset_UniformMatrix3fvARB 555 +#define _gloffset_UniformMatrix4fvARB 556 +#define _gloffset_UseProgramObjectARB 557 +#define _gloffset_ValidateProgramARB 558 +#define _gloffset_BindAttribLocationARB 559 +#define _gloffset_GetActiveAttribARB 560 +#define _gloffset_GetAttribLocationARB 561 +#define _gloffset_DrawBuffersARB 562 +#define _gloffset_RenderbufferStorageMultisample 563 +#define _gloffset_FramebufferTextureARB 564 +#define _gloffset_FramebufferTextureFaceARB 565 +#define _gloffset_ProgramParameteriARB 566 +#define _gloffset_FlushMappedBufferRange 567 +#define _gloffset_MapBufferRange 568 +#define _gloffset_BindVertexArray 569 +#define _gloffset_GenVertexArrays 570 +#define _gloffset_CopyBufferSubData 571 +#define _gloffset_ClientWaitSync 572 +#define _gloffset_DeleteSync 573 +#define _gloffset_FenceSync 574 +#define _gloffset_GetInteger64v 575 +#define _gloffset_GetSynciv 576 +#define _gloffset_IsSync 577 +#define _gloffset_WaitSync 578 +#define _gloffset_DrawElementsBaseVertex 579 +#define _gloffset_DrawRangeElementsBaseVertex 580 +#define _gloffset_MultiDrawElementsBaseVertex 581 +#define _gloffset_BindTransformFeedback 582 +#define _gloffset_DeleteTransformFeedbacks 583 +#define _gloffset_DrawTransformFeedback 584 +#define _gloffset_GenTransformFeedbacks 585 +#define _gloffset_IsTransformFeedback 586 +#define _gloffset_PauseTransformFeedback 587 +#define _gloffset_ResumeTransformFeedback 588 +#define _gloffset_PolygonOffsetEXT 589 +#define _gloffset_GetPixelTexGenParameterfvSGIS 590 +#define _gloffset_GetPixelTexGenParameterivSGIS 591 +#define _gloffset_PixelTexGenParameterfSGIS 592 +#define _gloffset_PixelTexGenParameterfvSGIS 593 +#define _gloffset_PixelTexGenParameteriSGIS 594 +#define _gloffset_PixelTexGenParameterivSGIS 595 +#define _gloffset_SampleMaskSGIS 596 +#define _gloffset_SamplePatternSGIS 597 +#define _gloffset_ColorPointerEXT 598 +#define _gloffset_EdgeFlagPointerEXT 599 +#define _gloffset_IndexPointerEXT 600 +#define _gloffset_NormalPointerEXT 601 +#define _gloffset_TexCoordPointerEXT 602 +#define _gloffset_VertexPointerEXT 603 +#define _gloffset_PointParameterfEXT 604 +#define _gloffset_PointParameterfvEXT 605 +#define _gloffset_LockArraysEXT 606 +#define _gloffset_UnlockArraysEXT 607 +#define _gloffset_CullParameterdvEXT 608 +#define _gloffset_CullParameterfvEXT 609 +#define _gloffset_SecondaryColor3bEXT 610 +#define _gloffset_SecondaryColor3bvEXT 611 +#define _gloffset_SecondaryColor3dEXT 612 +#define _gloffset_SecondaryColor3dvEXT 613 +#define _gloffset_SecondaryColor3fEXT 614 +#define _gloffset_SecondaryColor3fvEXT 615 +#define _gloffset_SecondaryColor3iEXT 616 +#define _gloffset_SecondaryColor3ivEXT 617 +#define _gloffset_SecondaryColor3sEXT 618 +#define _gloffset_SecondaryColor3svEXT 619 +#define _gloffset_SecondaryColor3ubEXT 620 +#define _gloffset_SecondaryColor3ubvEXT 621 +#define _gloffset_SecondaryColor3uiEXT 622 +#define _gloffset_SecondaryColor3uivEXT 623 +#define _gloffset_SecondaryColor3usEXT 624 +#define _gloffset_SecondaryColor3usvEXT 625 +#define _gloffset_SecondaryColorPointerEXT 626 +#define _gloffset_MultiDrawArraysEXT 627 +#define _gloffset_MultiDrawElementsEXT 628 +#define _gloffset_FogCoordPointerEXT 629 +#define _gloffset_FogCoorddEXT 630 +#define _gloffset_FogCoorddvEXT 631 +#define _gloffset_FogCoordfEXT 632 +#define _gloffset_FogCoordfvEXT 633 +#define _gloffset_PixelTexGenSGIX 634 +#define _gloffset_BlendFuncSeparateEXT 635 +#define _gloffset_FlushVertexArrayRangeNV 636 +#define _gloffset_VertexArrayRangeNV 637 +#define _gloffset_CombinerInputNV 638 +#define _gloffset_CombinerOutputNV 639 +#define _gloffset_CombinerParameterfNV 640 +#define _gloffset_CombinerParameterfvNV 641 +#define _gloffset_CombinerParameteriNV 642 +#define _gloffset_CombinerParameterivNV 643 +#define _gloffset_FinalCombinerInputNV 644 +#define _gloffset_GetCombinerInputParameterfvNV 645 +#define _gloffset_GetCombinerInputParameterivNV 646 +#define _gloffset_GetCombinerOutputParameterfvNV 647 +#define _gloffset_GetCombinerOutputParameterivNV 648 +#define _gloffset_GetFinalCombinerInputParameterfvNV 649 +#define _gloffset_GetFinalCombinerInputParameterivNV 650 +#define _gloffset_ResizeBuffersMESA 651 +#define _gloffset_WindowPos2dMESA 652 +#define _gloffset_WindowPos2dvMESA 653 +#define _gloffset_WindowPos2fMESA 654 +#define _gloffset_WindowPos2fvMESA 655 +#define _gloffset_WindowPos2iMESA 656 +#define _gloffset_WindowPos2ivMESA 657 +#define _gloffset_WindowPos2sMESA 658 +#define _gloffset_WindowPos2svMESA 659 +#define _gloffset_WindowPos3dMESA 660 +#define _gloffset_WindowPos3dvMESA 661 +#define _gloffset_WindowPos3fMESA 662 +#define _gloffset_WindowPos3fvMESA 663 +#define _gloffset_WindowPos3iMESA 664 +#define _gloffset_WindowPos3ivMESA 665 +#define _gloffset_WindowPos3sMESA 666 +#define _gloffset_WindowPos3svMESA 667 +#define _gloffset_WindowPos4dMESA 668 +#define _gloffset_WindowPos4dvMESA 669 +#define _gloffset_WindowPos4fMESA 670 +#define _gloffset_WindowPos4fvMESA 671 +#define _gloffset_WindowPos4iMESA 672 +#define _gloffset_WindowPos4ivMESA 673 +#define _gloffset_WindowPos4sMESA 674 +#define _gloffset_WindowPos4svMESA 675 +#define _gloffset_MultiModeDrawArraysIBM 676 +#define _gloffset_MultiModeDrawElementsIBM 677 +#define _gloffset_DeleteFencesNV 678 +#define _gloffset_FinishFenceNV 679 +#define _gloffset_GenFencesNV 680 +#define _gloffset_GetFenceivNV 681 +#define _gloffset_IsFenceNV 682 +#define _gloffset_SetFenceNV 683 +#define _gloffset_TestFenceNV 684 +#define _gloffset_AreProgramsResidentNV 685 +#define _gloffset_BindProgramNV 686 +#define _gloffset_DeleteProgramsNV 687 +#define _gloffset_ExecuteProgramNV 688 +#define _gloffset_GenProgramsNV 689 +#define _gloffset_GetProgramParameterdvNV 690 +#define _gloffset_GetProgramParameterfvNV 691 +#define _gloffset_GetProgramStringNV 692 +#define _gloffset_GetProgramivNV 693 +#define _gloffset_GetTrackMatrixivNV 694 +#define _gloffset_GetVertexAttribPointervNV 695 +#define _gloffset_GetVertexAttribdvNV 696 +#define _gloffset_GetVertexAttribfvNV 697 +#define _gloffset_GetVertexAttribivNV 698 +#define _gloffset_IsProgramNV 699 +#define _gloffset_LoadProgramNV 700 +#define _gloffset_ProgramParameters4dvNV 701 +#define _gloffset_ProgramParameters4fvNV 702 +#define _gloffset_RequestResidentProgramsNV 703 +#define _gloffset_TrackMatrixNV 704 +#define _gloffset_VertexAttrib1dNV 705 +#define _gloffset_VertexAttrib1dvNV 706 +#define _gloffset_VertexAttrib1fNV 707 +#define _gloffset_VertexAttrib1fvNV 708 +#define _gloffset_VertexAttrib1sNV 709 +#define _gloffset_VertexAttrib1svNV 710 +#define _gloffset_VertexAttrib2dNV 711 +#define _gloffset_VertexAttrib2dvNV 712 +#define _gloffset_VertexAttrib2fNV 713 +#define _gloffset_VertexAttrib2fvNV 714 +#define _gloffset_VertexAttrib2sNV 715 +#define _gloffset_VertexAttrib2svNV 716 +#define _gloffset_VertexAttrib3dNV 717 +#define _gloffset_VertexAttrib3dvNV 718 +#define _gloffset_VertexAttrib3fNV 719 +#define _gloffset_VertexAttrib3fvNV 720 +#define _gloffset_VertexAttrib3sNV 721 +#define _gloffset_VertexAttrib3svNV 722 +#define _gloffset_VertexAttrib4dNV 723 +#define _gloffset_VertexAttrib4dvNV 724 +#define _gloffset_VertexAttrib4fNV 725 +#define _gloffset_VertexAttrib4fvNV 726 +#define _gloffset_VertexAttrib4sNV 727 +#define _gloffset_VertexAttrib4svNV 728 +#define _gloffset_VertexAttrib4ubNV 729 +#define _gloffset_VertexAttrib4ubvNV 730 +#define _gloffset_VertexAttribPointerNV 731 +#define _gloffset_VertexAttribs1dvNV 732 +#define _gloffset_VertexAttribs1fvNV 733 +#define _gloffset_VertexAttribs1svNV 734 +#define _gloffset_VertexAttribs2dvNV 735 +#define _gloffset_VertexAttribs2fvNV 736 +#define _gloffset_VertexAttribs2svNV 737 +#define _gloffset_VertexAttribs3dvNV 738 +#define _gloffset_VertexAttribs3fvNV 739 +#define _gloffset_VertexAttribs3svNV 740 +#define _gloffset_VertexAttribs4dvNV 741 +#define _gloffset_VertexAttribs4fvNV 742 +#define _gloffset_VertexAttribs4svNV 743 +#define _gloffset_VertexAttribs4ubvNV 744 +#define _gloffset_GetTexBumpParameterfvATI 745 +#define _gloffset_GetTexBumpParameterivATI 746 +#define _gloffset_TexBumpParameterfvATI 747 +#define _gloffset_TexBumpParameterivATI 748 +#define _gloffset_AlphaFragmentOp1ATI 749 +#define _gloffset_AlphaFragmentOp2ATI 750 +#define _gloffset_AlphaFragmentOp3ATI 751 +#define _gloffset_BeginFragmentShaderATI 752 +#define _gloffset_BindFragmentShaderATI 753 +#define _gloffset_ColorFragmentOp1ATI 754 +#define _gloffset_ColorFragmentOp2ATI 755 +#define _gloffset_ColorFragmentOp3ATI 756 +#define _gloffset_DeleteFragmentShaderATI 757 +#define _gloffset_EndFragmentShaderATI 758 +#define _gloffset_GenFragmentShadersATI 759 +#define _gloffset_PassTexCoordATI 760 +#define _gloffset_SampleMapATI 761 +#define _gloffset_SetFragmentShaderConstantATI 762 +#define _gloffset_PointParameteriNV 763 +#define _gloffset_PointParameterivNV 764 +#define _gloffset_ActiveStencilFaceEXT 765 +#define _gloffset_BindVertexArrayAPPLE 766 +#define _gloffset_DeleteVertexArraysAPPLE 767 +#define _gloffset_GenVertexArraysAPPLE 768 +#define _gloffset_IsVertexArrayAPPLE 769 +#define _gloffset_GetProgramNamedParameterdvNV 770 +#define _gloffset_GetProgramNamedParameterfvNV 771 +#define _gloffset_ProgramNamedParameter4dNV 772 +#define _gloffset_ProgramNamedParameter4dvNV 773 +#define _gloffset_ProgramNamedParameter4fNV 774 +#define _gloffset_ProgramNamedParameter4fvNV 775 +#define _gloffset_DepthBoundsEXT 776 +#define _gloffset_BlendEquationSeparateEXT 777 +#define _gloffset_BindFramebufferEXT 778 +#define _gloffset_BindRenderbufferEXT 779 +#define _gloffset_CheckFramebufferStatusEXT 780 +#define _gloffset_DeleteFramebuffersEXT 781 +#define _gloffset_DeleteRenderbuffersEXT 782 +#define _gloffset_FramebufferRenderbufferEXT 783 +#define _gloffset_FramebufferTexture1DEXT 784 +#define _gloffset_FramebufferTexture2DEXT 785 +#define _gloffset_FramebufferTexture3DEXT 786 +#define _gloffset_GenFramebuffersEXT 787 +#define _gloffset_GenRenderbuffersEXT 788 +#define _gloffset_GenerateMipmapEXT 789 +#define _gloffset_GetFramebufferAttachmentParameterivEXT 790 +#define _gloffset_GetRenderbufferParameterivEXT 791 +#define _gloffset_IsFramebufferEXT 792 +#define _gloffset_IsRenderbufferEXT 793 +#define _gloffset_RenderbufferStorageEXT 794 +#define _gloffset_BlitFramebufferEXT 795 +#define _gloffset_BufferParameteriAPPLE 796 +#define _gloffset_FlushMappedBufferRangeAPPLE 797 +#define _gloffset_FramebufferTextureLayerEXT 798 +#define _gloffset_ColorMaskIndexedEXT 799 +#define _gloffset_DisableIndexedEXT 800 +#define _gloffset_EnableIndexedEXT 801 +#define _gloffset_GetBooleanIndexedvEXT 802 +#define _gloffset_GetIntegerIndexedvEXT 803 +#define _gloffset_IsEnabledIndexedEXT 804 +#define _gloffset_BeginConditionalRenderNV 805 +#define _gloffset_EndConditionalRenderNV 806 +#define _gloffset_BeginTransformFeedbackEXT 807 +#define _gloffset_BindBufferBaseEXT 808 +#define _gloffset_BindBufferOffsetEXT 809 +#define _gloffset_BindBufferRangeEXT 810 +#define _gloffset_EndTransformFeedbackEXT 811 +#define _gloffset_GetTransformFeedbackVaryingEXT 812 +#define _gloffset_TransformFeedbackVaryingsEXT 813 +#define _gloffset_ProvokingVertexEXT 814 +#define _gloffset_GetTexParameterPointervAPPLE 815 +#define _gloffset_TextureRangeAPPLE 816 +#define _gloffset_GetObjectParameterivAPPLE 817 +#define _gloffset_ObjectPurgeableAPPLE 818 +#define _gloffset_ObjectUnpurgeableAPPLE 819 +#define _gloffset_StencilFuncSeparateATI 820 +#define _gloffset_ProgramEnvParameters4fvEXT 821 +#define _gloffset_ProgramLocalParameters4fvEXT 822 +#define _gloffset_GetQueryObjecti64vEXT 823 +#define _gloffset_GetQueryObjectui64vEXT 824 +#define _gloffset_EGLImageTargetRenderbufferStorageOES 825 +#define _gloffset_EGLImageTargetTexture2DOES 826 +#define _gloffset_FIRST_DYNAMIC 827 #else @@ -868,6 +887,8 @@ #define _gloffset_UniformMatrix3x4fv driDispatchRemapTable[UniformMatrix3x4fv_remap_index] #define _gloffset_UniformMatrix4x2fv driDispatchRemapTable[UniformMatrix4x2fv_remap_index] #define _gloffset_UniformMatrix4x3fv driDispatchRemapTable[UniformMatrix4x3fv_remap_index] +#define _gloffset_DrawArraysInstanced driDispatchRemapTable[DrawArraysInstanced_remap_index] +#define _gloffset_DrawElementsInstanced driDispatchRemapTable[DrawElementsInstanced_remap_index] #define _gloffset_LoadTransposeMatrixdARB driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index] #define _gloffset_LoadTransposeMatrixfARB driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index] #define _gloffset_MultTransposeMatrixdARB driDispatchRemapTable[MultTransposeMatrixdARB_remap_index] @@ -1000,6 +1021,9 @@ #define _gloffset_GetAttribLocationARB driDispatchRemapTable[GetAttribLocationARB_remap_index] #define _gloffset_DrawBuffersARB driDispatchRemapTable[DrawBuffersARB_remap_index] #define _gloffset_RenderbufferStorageMultisample driDispatchRemapTable[RenderbufferStorageMultisample_remap_index] +#define _gloffset_FramebufferTextureARB driDispatchRemapTable[FramebufferTextureARB_remap_index] +#define _gloffset_FramebufferTextureFaceARB driDispatchRemapTable[FramebufferTextureFaceARB_remap_index] +#define _gloffset_ProgramParameteriARB driDispatchRemapTable[ProgramParameteriARB_remap_index] #define _gloffset_FlushMappedBufferRange driDispatchRemapTable[FlushMappedBufferRange_remap_index] #define _gloffset_MapBufferRange driDispatchRemapTable[MapBufferRange_remap_index] #define _gloffset_BindVertexArray driDispatchRemapTable[BindVertexArray_remap_index] @@ -1015,6 +1039,13 @@ #define _gloffset_DrawElementsBaseVertex driDispatchRemapTable[DrawElementsBaseVertex_remap_index] #define _gloffset_DrawRangeElementsBaseVertex driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index] #define _gloffset_MultiDrawElementsBaseVertex driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index] +#define _gloffset_BindTransformFeedback driDispatchRemapTable[BindTransformFeedback_remap_index] +#define _gloffset_DeleteTransformFeedbacks driDispatchRemapTable[DeleteTransformFeedbacks_remap_index] +#define _gloffset_DrawTransformFeedback driDispatchRemapTable[DrawTransformFeedback_remap_index] +#define _gloffset_GenTransformFeedbacks driDispatchRemapTable[GenTransformFeedbacks_remap_index] +#define _gloffset_IsTransformFeedback driDispatchRemapTable[IsTransformFeedback_remap_index] +#define _gloffset_PauseTransformFeedback driDispatchRemapTable[PauseTransformFeedback_remap_index] +#define _gloffset_ResumeTransformFeedback driDispatchRemapTable[ResumeTransformFeedback_remap_index] #define _gloffset_PolygonOffsetEXT driDispatchRemapTable[PolygonOffsetEXT_remap_index] #define _gloffset_GetPixelTexGenParameterfvSGIS driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index] #define _gloffset_GetPixelTexGenParameterivSGIS driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index] @@ -1233,6 +1264,13 @@ #define _gloffset_IsEnabledIndexedEXT driDispatchRemapTable[IsEnabledIndexedEXT_remap_index] #define _gloffset_BeginConditionalRenderNV driDispatchRemapTable[BeginConditionalRenderNV_remap_index] #define _gloffset_EndConditionalRenderNV driDispatchRemapTable[EndConditionalRenderNV_remap_index] +#define _gloffset_BeginTransformFeedbackEXT driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index] +#define _gloffset_BindBufferBaseEXT driDispatchRemapTable[BindBufferBaseEXT_remap_index] +#define _gloffset_BindBufferOffsetEXT driDispatchRemapTable[BindBufferOffsetEXT_remap_index] +#define _gloffset_BindBufferRangeEXT driDispatchRemapTable[BindBufferRangeEXT_remap_index] +#define _gloffset_EndTransformFeedbackEXT driDispatchRemapTable[EndTransformFeedbackEXT_remap_index] +#define _gloffset_GetTransformFeedbackVaryingEXT driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index] +#define _gloffset_TransformFeedbackVaryingsEXT driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index] #define _gloffset_ProvokingVertexEXT driDispatchRemapTable[ProvokingVertexEXT_remap_index] #define _gloffset_GetTexParameterPointervAPPLE driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index] #define _gloffset_TextureRangeAPPLE driDispatchRemapTable[TextureRangeAPPLE_remap_index] diff --git a/mesalib/src/mapi/glapi/glapitable.h b/mesalib/src/mapi/glapi/glapitable.h index 149ff3f3c..7c8da64ab 100644 --- a/mesalib/src/mapi/glapi/glapitable.h +++ b/mesalib/src/mapi/glapi/glapitable.h @@ -470,384 +470,403 @@ struct _glapi_table void (GLAPIENTRYP UniformMatrix3x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 427 */ void (GLAPIENTRYP UniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 428 */ void (GLAPIENTRYP UniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 429 */ - void (GLAPIENTRYP LoadTransposeMatrixdARB)(const GLdouble * m); /* 430 */ - void (GLAPIENTRYP LoadTransposeMatrixfARB)(const GLfloat * m); /* 431 */ - void (GLAPIENTRYP MultTransposeMatrixdARB)(const GLdouble * m); /* 432 */ - void (GLAPIENTRYP MultTransposeMatrixfARB)(const GLfloat * m); /* 433 */ - void (GLAPIENTRYP SampleCoverageARB)(GLclampf value, GLboolean invert); /* 434 */ - void (GLAPIENTRYP CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 435 */ - void (GLAPIENTRYP CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 436 */ - void (GLAPIENTRYP CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 437 */ - void (GLAPIENTRYP CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 438 */ - void (GLAPIENTRYP CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 439 */ - void (GLAPIENTRYP CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 440 */ - void (GLAPIENTRYP GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 441 */ - void (GLAPIENTRYP DisableVertexAttribArrayARB)(GLuint index); /* 442 */ - void (GLAPIENTRYP EnableVertexAttribArrayARB)(GLuint index); /* 443 */ - void (GLAPIENTRYP GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 444 */ - void (GLAPIENTRYP GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 445 */ - void (GLAPIENTRYP GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 446 */ - void (GLAPIENTRYP GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 447 */ - void (GLAPIENTRYP GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string); /* 448 */ - void (GLAPIENTRYP GetProgramivARB)(GLenum target, GLenum pname, GLint * params); /* 449 */ - void (GLAPIENTRYP GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble * params); /* 450 */ - void (GLAPIENTRYP GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat * params); /* 451 */ - void (GLAPIENTRYP GetVertexAttribivARB)(GLuint index, GLenum pname, GLint * params); /* 452 */ - void (GLAPIENTRYP ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 453 */ - void (GLAPIENTRYP ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 454 */ - void (GLAPIENTRYP ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 455 */ - void (GLAPIENTRYP ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 456 */ - void (GLAPIENTRYP ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 457 */ - void (GLAPIENTRYP ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 458 */ - void (GLAPIENTRYP ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 459 */ - void (GLAPIENTRYP ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 460 */ - void (GLAPIENTRYP ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string); /* 461 */ - void (GLAPIENTRYP VertexAttrib1dARB)(GLuint index, GLdouble x); /* 462 */ - void (GLAPIENTRYP VertexAttrib1dvARB)(GLuint index, const GLdouble * v); /* 463 */ - void (GLAPIENTRYP VertexAttrib1fARB)(GLuint index, GLfloat x); /* 464 */ - void (GLAPIENTRYP VertexAttrib1fvARB)(GLuint index, const GLfloat * v); /* 465 */ - void (GLAPIENTRYP VertexAttrib1sARB)(GLuint index, GLshort x); /* 466 */ - void (GLAPIENTRYP VertexAttrib1svARB)(GLuint index, const GLshort * v); /* 467 */ - void (GLAPIENTRYP VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y); /* 468 */ - void (GLAPIENTRYP VertexAttrib2dvARB)(GLuint index, const GLdouble * v); /* 469 */ - void (GLAPIENTRYP VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y); /* 470 */ - void (GLAPIENTRYP VertexAttrib2fvARB)(GLuint index, const GLfloat * v); /* 471 */ - void (GLAPIENTRYP VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y); /* 472 */ - void (GLAPIENTRYP VertexAttrib2svARB)(GLuint index, const GLshort * v); /* 473 */ - void (GLAPIENTRYP VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 474 */ - void (GLAPIENTRYP VertexAttrib3dvARB)(GLuint index, const GLdouble * v); /* 475 */ - void (GLAPIENTRYP VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 476 */ - void (GLAPIENTRYP VertexAttrib3fvARB)(GLuint index, const GLfloat * v); /* 477 */ - void (GLAPIENTRYP VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z); /* 478 */ - void (GLAPIENTRYP VertexAttrib3svARB)(GLuint index, const GLshort * v); /* 479 */ - void (GLAPIENTRYP VertexAttrib4NbvARB)(GLuint index, const GLbyte * v); /* 480 */ - void (GLAPIENTRYP VertexAttrib4NivARB)(GLuint index, const GLint * v); /* 481 */ - void (GLAPIENTRYP VertexAttrib4NsvARB)(GLuint index, const GLshort * v); /* 482 */ - void (GLAPIENTRYP VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 483 */ - void (GLAPIENTRYP VertexAttrib4NubvARB)(GLuint index, const GLubyte * v); /* 484 */ - void (GLAPIENTRYP VertexAttrib4NuivARB)(GLuint index, const GLuint * v); /* 485 */ - void (GLAPIENTRYP VertexAttrib4NusvARB)(GLuint index, const GLushort * v); /* 486 */ - void (GLAPIENTRYP VertexAttrib4bvARB)(GLuint index, const GLbyte * v); /* 487 */ - void (GLAPIENTRYP VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 488 */ - void (GLAPIENTRYP VertexAttrib4dvARB)(GLuint index, const GLdouble * v); /* 489 */ - void (GLAPIENTRYP VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 490 */ - void (GLAPIENTRYP VertexAttrib4fvARB)(GLuint index, const GLfloat * v); /* 491 */ - void (GLAPIENTRYP VertexAttrib4ivARB)(GLuint index, const GLint * v); /* 492 */ - void (GLAPIENTRYP VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 493 */ - void (GLAPIENTRYP VertexAttrib4svARB)(GLuint index, const GLshort * v); /* 494 */ - void (GLAPIENTRYP VertexAttrib4ubvARB)(GLuint index, const GLubyte * v); /* 495 */ - void (GLAPIENTRYP VertexAttrib4uivARB)(GLuint index, const GLuint * v); /* 496 */ - void (GLAPIENTRYP VertexAttrib4usvARB)(GLuint index, const GLushort * v); /* 497 */ - void (GLAPIENTRYP VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); /* 498 */ - void (GLAPIENTRYP BindBufferARB)(GLenum target, GLuint buffer); /* 499 */ - void (GLAPIENTRYP BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); /* 500 */ - void (GLAPIENTRYP BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); /* 501 */ - void (GLAPIENTRYP DeleteBuffersARB)(GLsizei n, const GLuint * buffer); /* 502 */ - void (GLAPIENTRYP GenBuffersARB)(GLsizei n, GLuint * buffer); /* 503 */ - void (GLAPIENTRYP GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params); /* 504 */ - void (GLAPIENTRYP GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params); /* 505 */ - void (GLAPIENTRYP GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data); /* 506 */ - GLboolean (GLAPIENTRYP IsBufferARB)(GLuint buffer); /* 507 */ - GLvoid * (GLAPIENTRYP MapBufferARB)(GLenum target, GLenum access); /* 508 */ - GLboolean (GLAPIENTRYP UnmapBufferARB)(GLenum target); /* 509 */ - void (GLAPIENTRYP BeginQueryARB)(GLenum target, GLuint id); /* 510 */ - void (GLAPIENTRYP DeleteQueriesARB)(GLsizei n, const GLuint * ids); /* 511 */ - void (GLAPIENTRYP EndQueryARB)(GLenum target); /* 512 */ - void (GLAPIENTRYP GenQueriesARB)(GLsizei n, GLuint * ids); /* 513 */ - void (GLAPIENTRYP GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params); /* 514 */ - void (GLAPIENTRYP GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params); /* 515 */ - void (GLAPIENTRYP GetQueryivARB)(GLenum target, GLenum pname, GLint * params); /* 516 */ - GLboolean (GLAPIENTRYP IsQueryARB)(GLuint id); /* 517 */ - void (GLAPIENTRYP AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj); /* 518 */ - void (GLAPIENTRYP CompileShaderARB)(GLhandleARB shader); /* 519 */ - GLhandleARB (GLAPIENTRYP CreateProgramObjectARB)(void); /* 520 */ - GLhandleARB (GLAPIENTRYP CreateShaderObjectARB)(GLenum shaderType); /* 521 */ - void (GLAPIENTRYP DeleteObjectARB)(GLhandleARB obj); /* 522 */ - void (GLAPIENTRYP DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj); /* 523 */ - void (GLAPIENTRYP GetActiveUniformARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 524 */ - void (GLAPIENTRYP GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei * length, GLhandleARB * infoLog); /* 525 */ - GLhandleARB (GLAPIENTRYP GetHandleARB)(GLenum pname); /* 526 */ - void (GLAPIENTRYP GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog); /* 527 */ - void (GLAPIENTRYP GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat * params); /* 528 */ - void (GLAPIENTRYP GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint * params); /* 529 */ - void (GLAPIENTRYP GetShaderSourceARB)(GLhandleARB shader, GLsizei bufSize, GLsizei * length, GLcharARB * source); /* 530 */ - GLint (GLAPIENTRYP GetUniformLocationARB)(GLhandleARB program, const GLcharARB * name); /* 531 */ - void (GLAPIENTRYP GetUniformfvARB)(GLhandleARB program, GLint location, GLfloat * params); /* 532 */ - void (GLAPIENTRYP GetUniformivARB)(GLhandleARB program, GLint location, GLint * params); /* 533 */ - void (GLAPIENTRYP LinkProgramARB)(GLhandleARB program); /* 534 */ - void (GLAPIENTRYP ShaderSourceARB)(GLhandleARB shader, GLsizei count, const GLcharARB ** string, const GLint * length); /* 535 */ - void (GLAPIENTRYP Uniform1fARB)(GLint location, GLfloat v0); /* 536 */ - void (GLAPIENTRYP Uniform1fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 537 */ - void (GLAPIENTRYP Uniform1iARB)(GLint location, GLint v0); /* 538 */ - void (GLAPIENTRYP Uniform1ivARB)(GLint location, GLsizei count, const GLint * value); /* 539 */ - void (GLAPIENTRYP Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1); /* 540 */ - void (GLAPIENTRYP Uniform2fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 541 */ - void (GLAPIENTRYP Uniform2iARB)(GLint location, GLint v0, GLint v1); /* 542 */ - void (GLAPIENTRYP Uniform2ivARB)(GLint location, GLsizei count, const GLint * value); /* 543 */ - void (GLAPIENTRYP Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); /* 544 */ - void (GLAPIENTRYP Uniform3fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 545 */ - void (GLAPIENTRYP Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2); /* 546 */ - void (GLAPIENTRYP Uniform3ivARB)(GLint location, GLsizei count, const GLint * value); /* 547 */ - void (GLAPIENTRYP Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); /* 548 */ - void (GLAPIENTRYP Uniform4fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 549 */ - void (GLAPIENTRYP Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); /* 550 */ - void (GLAPIENTRYP Uniform4ivARB)(GLint location, GLsizei count, const GLint * value); /* 551 */ - void (GLAPIENTRYP UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 552 */ - void (GLAPIENTRYP UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 553 */ - void (GLAPIENTRYP UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 554 */ - void (GLAPIENTRYP UseProgramObjectARB)(GLhandleARB program); /* 555 */ - void (GLAPIENTRYP ValidateProgramARB)(GLhandleARB program); /* 556 */ - void (GLAPIENTRYP BindAttribLocationARB)(GLhandleARB program, GLuint index, const GLcharARB * name); /* 557 */ - void (GLAPIENTRYP GetActiveAttribARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 558 */ - GLint (GLAPIENTRYP GetAttribLocationARB)(GLhandleARB program, const GLcharARB * name); /* 559 */ - void (GLAPIENTRYP DrawBuffersARB)(GLsizei n, const GLenum * bufs); /* 560 */ - void (GLAPIENTRYP RenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); /* 561 */ - void (GLAPIENTRYP FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length); /* 562 */ - GLvoid * (GLAPIENTRYP MapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); /* 563 */ - void (GLAPIENTRYP BindVertexArray)(GLuint array); /* 564 */ - void (GLAPIENTRYP GenVertexArrays)(GLsizei n, GLuint * arrays); /* 565 */ - void (GLAPIENTRYP CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); /* 566 */ - GLenum (GLAPIENTRYP ClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); /* 567 */ - void (GLAPIENTRYP DeleteSync)(GLsync sync); /* 568 */ - GLsync (GLAPIENTRYP FenceSync)(GLenum condition, GLbitfield flags); /* 569 */ - void (GLAPIENTRYP GetInteger64v)(GLenum pname, GLint64 * params); /* 570 */ - void (GLAPIENTRYP GetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values); /* 571 */ - GLboolean (GLAPIENTRYP IsSync)(GLsync sync); /* 572 */ - void (GLAPIENTRYP WaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); /* 573 */ - void (GLAPIENTRYP DrawElementsBaseVertex)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); /* 574 */ - void (GLAPIENTRYP DrawRangeElementsBaseVertex)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); /* 575 */ - void (GLAPIENTRYP MultiDrawElementsBaseVertex)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount, const GLint * basevertex); /* 576 */ - void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 577 */ - void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 578 */ - void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 579 */ - void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 580 */ - void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 581 */ - void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 582 */ - void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 583 */ - void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 584 */ - void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 585 */ - void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 586 */ - void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 587 */ - void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 588 */ - void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 589 */ - void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 590 */ - void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 591 */ - void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 592 */ - void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 593 */ - void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 594 */ - void (GLAPIENTRYP UnlockArraysEXT)(void); /* 595 */ - void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 596 */ - void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 597 */ - void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 598 */ - void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 599 */ - void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 600 */ - void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 601 */ - void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 602 */ - void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 603 */ - void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 604 */ - void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 605 */ - void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 606 */ - void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 607 */ - void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 608 */ - void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 609 */ - void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 610 */ - void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 611 */ - void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 612 */ - void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 613 */ - void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 614 */ - void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 615 */ - void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 616 */ - void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 617 */ - void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 618 */ - void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 619 */ - void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 620 */ - void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 621 */ - void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 622 */ - void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 623 */ - void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 624 */ - void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 625 */ - void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 626 */ - void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 627 */ - void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 628 */ - void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 629 */ - void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 630 */ - void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 631 */ - void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 632 */ - void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 633 */ - void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 634 */ - void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 635 */ - void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 636 */ - void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 637 */ - void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 638 */ - void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 639 */ - void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 640 */ - void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 641 */ - void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 642 */ - void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 643 */ - void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 644 */ - void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 645 */ - void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 646 */ - void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 647 */ - void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 648 */ - void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 649 */ - void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 650 */ - void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 651 */ - void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 652 */ - void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 653 */ - void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 654 */ - void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 655 */ - void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 656 */ - void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 657 */ - void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 658 */ - void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 659 */ - void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 660 */ - void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 661 */ - void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 662 */ - void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 663 */ - void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 664 */ - void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 665 */ - void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 666 */ - void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 667 */ - void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 668 */ - void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 669 */ - GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 670 */ - void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 671 */ - GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 672 */ - GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 673 */ - void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 674 */ - void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 675 */ - void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 676 */ - void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 677 */ - void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 678 */ - void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 679 */ - void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 680 */ - void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 681 */ - void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 682 */ - void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 683 */ - void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 684 */ - void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 685 */ - void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 686 */ - GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 687 */ - void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 688 */ - void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 689 */ - void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 690 */ - void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 691 */ - void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 692 */ - void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 693 */ - void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 694 */ - void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 695 */ - void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 696 */ - void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 697 */ - void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 698 */ - void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 699 */ - void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 700 */ - void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 701 */ - void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 702 */ - void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 703 */ - void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 704 */ - void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 705 */ - void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 706 */ - void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 707 */ - void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 708 */ - void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 709 */ - void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 710 */ - void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 711 */ - void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 712 */ - void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 713 */ - void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 714 */ - void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 715 */ - void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 716 */ - void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 717 */ - void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 718 */ - void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 719 */ - void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 720 */ - void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 721 */ - void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 722 */ - void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 723 */ - void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 724 */ - void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 725 */ - void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 726 */ - void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 727 */ - void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 728 */ - void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 729 */ - void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 730 */ - void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 731 */ - void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 732 */ - void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 733 */ - void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 734 */ - void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 735 */ - void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 736 */ - void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 737 */ - void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 738 */ - void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 739 */ - void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 740 */ - void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 741 */ - void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 742 */ - void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 743 */ - void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 744 */ - void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 745 */ - void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 746 */ - GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 747 */ - void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 748 */ - void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 749 */ - void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 750 */ - void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 751 */ - void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 752 */ - void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 753 */ - void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 754 */ - void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 755 */ - void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 756 */ - GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 757 */ - void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 758 */ - void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 759 */ - void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 760 */ - void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 761 */ - void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 762 */ - void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 763 */ - void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 764 */ - void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 765 */ - void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 766 */ - void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 767 */ - GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 768 */ - void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 769 */ - void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 770 */ - void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 771 */ - void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 772 */ - void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 773 */ - void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 774 */ - void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 775 */ - void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 776 */ - void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 777 */ - void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 778 */ - void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 779 */ - GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 780 */ - GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 781 */ - void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 782 */ - void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 783 */ - void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 784 */ - void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 785 */ - void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 786 */ - void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 787 */ - void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 788 */ - void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 789 */ - void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 790 */ - void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 791 */ - GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 792 */ - void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 793 */ - void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 794 */ - void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 795 */ - void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 796 */ - void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 797 */ - void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 798 */ - GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 799 */ - GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 800 */ - void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 801 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 802 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 803 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 804 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 805 */ - void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 806 */ - void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 807 */ + void (GLAPIENTRYP DrawArraysInstanced)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); /* 430 */ + void (GLAPIENTRYP DrawElementsInstanced)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount); /* 431 */ + void (GLAPIENTRYP LoadTransposeMatrixdARB)(const GLdouble * m); /* 432 */ + void (GLAPIENTRYP LoadTransposeMatrixfARB)(const GLfloat * m); /* 433 */ + void (GLAPIENTRYP MultTransposeMatrixdARB)(const GLdouble * m); /* 434 */ + void (GLAPIENTRYP MultTransposeMatrixfARB)(const GLfloat * m); /* 435 */ + void (GLAPIENTRYP SampleCoverageARB)(GLclampf value, GLboolean invert); /* 436 */ + void (GLAPIENTRYP CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 437 */ + void (GLAPIENTRYP CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 438 */ + void (GLAPIENTRYP CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 439 */ + void (GLAPIENTRYP CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 440 */ + void (GLAPIENTRYP CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 441 */ + void (GLAPIENTRYP CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 442 */ + void (GLAPIENTRYP GetCompressedTexImageARB)(GLenum target, GLint level, GLvoid * img); /* 443 */ + void (GLAPIENTRYP DisableVertexAttribArrayARB)(GLuint index); /* 444 */ + void (GLAPIENTRYP EnableVertexAttribArrayARB)(GLuint index); /* 445 */ + void (GLAPIENTRYP GetProgramEnvParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 446 */ + void (GLAPIENTRYP GetProgramEnvParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 447 */ + void (GLAPIENTRYP GetProgramLocalParameterdvARB)(GLenum target, GLuint index, GLdouble * params); /* 448 */ + void (GLAPIENTRYP GetProgramLocalParameterfvARB)(GLenum target, GLuint index, GLfloat * params); /* 449 */ + void (GLAPIENTRYP GetProgramStringARB)(GLenum target, GLenum pname, GLvoid * string); /* 450 */ + void (GLAPIENTRYP GetProgramivARB)(GLenum target, GLenum pname, GLint * params); /* 451 */ + void (GLAPIENTRYP GetVertexAttribdvARB)(GLuint index, GLenum pname, GLdouble * params); /* 452 */ + void (GLAPIENTRYP GetVertexAttribfvARB)(GLuint index, GLenum pname, GLfloat * params); /* 453 */ + void (GLAPIENTRYP GetVertexAttribivARB)(GLuint index, GLenum pname, GLint * params); /* 454 */ + void (GLAPIENTRYP ProgramEnvParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 455 */ + void (GLAPIENTRYP ProgramEnvParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 456 */ + void (GLAPIENTRYP ProgramEnvParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 457 */ + void (GLAPIENTRYP ProgramEnvParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 458 */ + void (GLAPIENTRYP ProgramLocalParameter4dARB)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 459 */ + void (GLAPIENTRYP ProgramLocalParameter4dvARB)(GLenum target, GLuint index, const GLdouble * params); /* 460 */ + void (GLAPIENTRYP ProgramLocalParameter4fARB)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 461 */ + void (GLAPIENTRYP ProgramLocalParameter4fvARB)(GLenum target, GLuint index, const GLfloat * params); /* 462 */ + void (GLAPIENTRYP ProgramStringARB)(GLenum target, GLenum format, GLsizei len, const GLvoid * string); /* 463 */ + void (GLAPIENTRYP VertexAttrib1dARB)(GLuint index, GLdouble x); /* 464 */ + void (GLAPIENTRYP VertexAttrib1dvARB)(GLuint index, const GLdouble * v); /* 465 */ + void (GLAPIENTRYP VertexAttrib1fARB)(GLuint index, GLfloat x); /* 466 */ + void (GLAPIENTRYP VertexAttrib1fvARB)(GLuint index, const GLfloat * v); /* 467 */ + void (GLAPIENTRYP VertexAttrib1sARB)(GLuint index, GLshort x); /* 468 */ + void (GLAPIENTRYP VertexAttrib1svARB)(GLuint index, const GLshort * v); /* 469 */ + void (GLAPIENTRYP VertexAttrib2dARB)(GLuint index, GLdouble x, GLdouble y); /* 470 */ + void (GLAPIENTRYP VertexAttrib2dvARB)(GLuint index, const GLdouble * v); /* 471 */ + void (GLAPIENTRYP VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y); /* 472 */ + void (GLAPIENTRYP VertexAttrib2fvARB)(GLuint index, const GLfloat * v); /* 473 */ + void (GLAPIENTRYP VertexAttrib2sARB)(GLuint index, GLshort x, GLshort y); /* 474 */ + void (GLAPIENTRYP VertexAttrib2svARB)(GLuint index, const GLshort * v); /* 475 */ + void (GLAPIENTRYP VertexAttrib3dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 476 */ + void (GLAPIENTRYP VertexAttrib3dvARB)(GLuint index, const GLdouble * v); /* 477 */ + void (GLAPIENTRYP VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 478 */ + void (GLAPIENTRYP VertexAttrib3fvARB)(GLuint index, const GLfloat * v); /* 479 */ + void (GLAPIENTRYP VertexAttrib3sARB)(GLuint index, GLshort x, GLshort y, GLshort z); /* 480 */ + void (GLAPIENTRYP VertexAttrib3svARB)(GLuint index, const GLshort * v); /* 481 */ + void (GLAPIENTRYP VertexAttrib4NbvARB)(GLuint index, const GLbyte * v); /* 482 */ + void (GLAPIENTRYP VertexAttrib4NivARB)(GLuint index, const GLint * v); /* 483 */ + void (GLAPIENTRYP VertexAttrib4NsvARB)(GLuint index, const GLshort * v); /* 484 */ + void (GLAPIENTRYP VertexAttrib4NubARB)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 485 */ + void (GLAPIENTRYP VertexAttrib4NubvARB)(GLuint index, const GLubyte * v); /* 486 */ + void (GLAPIENTRYP VertexAttrib4NuivARB)(GLuint index, const GLuint * v); /* 487 */ + void (GLAPIENTRYP VertexAttrib4NusvARB)(GLuint index, const GLushort * v); /* 488 */ + void (GLAPIENTRYP VertexAttrib4bvARB)(GLuint index, const GLbyte * v); /* 489 */ + void (GLAPIENTRYP VertexAttrib4dARB)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 490 */ + void (GLAPIENTRYP VertexAttrib4dvARB)(GLuint index, const GLdouble * v); /* 491 */ + void (GLAPIENTRYP VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 492 */ + void (GLAPIENTRYP VertexAttrib4fvARB)(GLuint index, const GLfloat * v); /* 493 */ + void (GLAPIENTRYP VertexAttrib4ivARB)(GLuint index, const GLint * v); /* 494 */ + void (GLAPIENTRYP VertexAttrib4sARB)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 495 */ + void (GLAPIENTRYP VertexAttrib4svARB)(GLuint index, const GLshort * v); /* 496 */ + void (GLAPIENTRYP VertexAttrib4ubvARB)(GLuint index, const GLubyte * v); /* 497 */ + void (GLAPIENTRYP VertexAttrib4uivARB)(GLuint index, const GLuint * v); /* 498 */ + void (GLAPIENTRYP VertexAttrib4usvARB)(GLuint index, const GLushort * v); /* 499 */ + void (GLAPIENTRYP VertexAttribPointerARB)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer); /* 500 */ + void (GLAPIENTRYP BindBufferARB)(GLenum target, GLuint buffer); /* 501 */ + void (GLAPIENTRYP BufferDataARB)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); /* 502 */ + void (GLAPIENTRYP BufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); /* 503 */ + void (GLAPIENTRYP DeleteBuffersARB)(GLsizei n, const GLuint * buffer); /* 504 */ + void (GLAPIENTRYP GenBuffersARB)(GLsizei n, GLuint * buffer); /* 505 */ + void (GLAPIENTRYP GetBufferParameterivARB)(GLenum target, GLenum pname, GLint * params); /* 506 */ + void (GLAPIENTRYP GetBufferPointervARB)(GLenum target, GLenum pname, GLvoid ** params); /* 507 */ + void (GLAPIENTRYP GetBufferSubDataARB)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data); /* 508 */ + GLboolean (GLAPIENTRYP IsBufferARB)(GLuint buffer); /* 509 */ + GLvoid * (GLAPIENTRYP MapBufferARB)(GLenum target, GLenum access); /* 510 */ + GLboolean (GLAPIENTRYP UnmapBufferARB)(GLenum target); /* 511 */ + void (GLAPIENTRYP BeginQueryARB)(GLenum target, GLuint id); /* 512 */ + void (GLAPIENTRYP DeleteQueriesARB)(GLsizei n, const GLuint * ids); /* 513 */ + void (GLAPIENTRYP EndQueryARB)(GLenum target); /* 514 */ + void (GLAPIENTRYP GenQueriesARB)(GLsizei n, GLuint * ids); /* 515 */ + void (GLAPIENTRYP GetQueryObjectivARB)(GLuint id, GLenum pname, GLint * params); /* 516 */ + void (GLAPIENTRYP GetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint * params); /* 517 */ + void (GLAPIENTRYP GetQueryivARB)(GLenum target, GLenum pname, GLint * params); /* 518 */ + GLboolean (GLAPIENTRYP IsQueryARB)(GLuint id); /* 519 */ + void (GLAPIENTRYP AttachObjectARB)(GLhandleARB containerObj, GLhandleARB obj); /* 520 */ + void (GLAPIENTRYP CompileShaderARB)(GLhandleARB shader); /* 521 */ + GLhandleARB (GLAPIENTRYP CreateProgramObjectARB)(void); /* 522 */ + GLhandleARB (GLAPIENTRYP CreateShaderObjectARB)(GLenum shaderType); /* 523 */ + void (GLAPIENTRYP DeleteObjectARB)(GLhandleARB obj); /* 524 */ + void (GLAPIENTRYP DetachObjectARB)(GLhandleARB containerObj, GLhandleARB attachedObj); /* 525 */ + void (GLAPIENTRYP GetActiveUniformARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 526 */ + void (GLAPIENTRYP GetAttachedObjectsARB)(GLhandleARB containerObj, GLsizei maxLength, GLsizei * length, GLhandleARB * infoLog); /* 527 */ + GLhandleARB (GLAPIENTRYP GetHandleARB)(GLenum pname); /* 528 */ + void (GLAPIENTRYP GetInfoLogARB)(GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog); /* 529 */ + void (GLAPIENTRYP GetObjectParameterfvARB)(GLhandleARB obj, GLenum pname, GLfloat * params); /* 530 */ + void (GLAPIENTRYP GetObjectParameterivARB)(GLhandleARB obj, GLenum pname, GLint * params); /* 531 */ + void (GLAPIENTRYP GetShaderSourceARB)(GLhandleARB shader, GLsizei bufSize, GLsizei * length, GLcharARB * source); /* 532 */ + GLint (GLAPIENTRYP GetUniformLocationARB)(GLhandleARB program, const GLcharARB * name); /* 533 */ + void (GLAPIENTRYP GetUniformfvARB)(GLhandleARB program, GLint location, GLfloat * params); /* 534 */ + void (GLAPIENTRYP GetUniformivARB)(GLhandleARB program, GLint location, GLint * params); /* 535 */ + void (GLAPIENTRYP LinkProgramARB)(GLhandleARB program); /* 536 */ + void (GLAPIENTRYP ShaderSourceARB)(GLhandleARB shader, GLsizei count, const GLcharARB ** string, const GLint * length); /* 537 */ + void (GLAPIENTRYP Uniform1fARB)(GLint location, GLfloat v0); /* 538 */ + void (GLAPIENTRYP Uniform1fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 539 */ + void (GLAPIENTRYP Uniform1iARB)(GLint location, GLint v0); /* 540 */ + void (GLAPIENTRYP Uniform1ivARB)(GLint location, GLsizei count, const GLint * value); /* 541 */ + void (GLAPIENTRYP Uniform2fARB)(GLint location, GLfloat v0, GLfloat v1); /* 542 */ + void (GLAPIENTRYP Uniform2fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 543 */ + void (GLAPIENTRYP Uniform2iARB)(GLint location, GLint v0, GLint v1); /* 544 */ + void (GLAPIENTRYP Uniform2ivARB)(GLint location, GLsizei count, const GLint * value); /* 545 */ + void (GLAPIENTRYP Uniform3fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); /* 546 */ + void (GLAPIENTRYP Uniform3fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 547 */ + void (GLAPIENTRYP Uniform3iARB)(GLint location, GLint v0, GLint v1, GLint v2); /* 548 */ + void (GLAPIENTRYP Uniform3ivARB)(GLint location, GLsizei count, const GLint * value); /* 549 */ + void (GLAPIENTRYP Uniform4fARB)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); /* 550 */ + void (GLAPIENTRYP Uniform4fvARB)(GLint location, GLsizei count, const GLfloat * value); /* 551 */ + void (GLAPIENTRYP Uniform4iARB)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); /* 552 */ + void (GLAPIENTRYP Uniform4ivARB)(GLint location, GLsizei count, const GLint * value); /* 553 */ + void (GLAPIENTRYP UniformMatrix2fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 554 */ + void (GLAPIENTRYP UniformMatrix3fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 555 */ + void (GLAPIENTRYP UniformMatrix4fvARB)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 556 */ + void (GLAPIENTRYP UseProgramObjectARB)(GLhandleARB program); /* 557 */ + void (GLAPIENTRYP ValidateProgramARB)(GLhandleARB program); /* 558 */ + void (GLAPIENTRYP BindAttribLocationARB)(GLhandleARB program, GLuint index, const GLcharARB * name); /* 559 */ + void (GLAPIENTRYP GetActiveAttribARB)(GLhandleARB program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLcharARB * name); /* 560 */ + GLint (GLAPIENTRYP GetAttribLocationARB)(GLhandleARB program, const GLcharARB * name); /* 561 */ + void (GLAPIENTRYP DrawBuffersARB)(GLsizei n, const GLenum * bufs); /* 562 */ + void (GLAPIENTRYP RenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); /* 563 */ + void (GLAPIENTRYP FramebufferTextureARB)(GLenum target, GLenum attachment, GLuint texture, GLint level); /* 564 */ + void (GLAPIENTRYP FramebufferTextureFaceARB)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); /* 565 */ + void (GLAPIENTRYP ProgramParameteriARB)(GLuint program, GLenum pname, GLint value); /* 566 */ + void (GLAPIENTRYP FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length); /* 567 */ + GLvoid * (GLAPIENTRYP MapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); /* 568 */ + void (GLAPIENTRYP BindVertexArray)(GLuint array); /* 569 */ + void (GLAPIENTRYP GenVertexArrays)(GLsizei n, GLuint * arrays); /* 570 */ + void (GLAPIENTRYP CopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); /* 571 */ + GLenum (GLAPIENTRYP ClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); /* 572 */ + void (GLAPIENTRYP DeleteSync)(GLsync sync); /* 573 */ + GLsync (GLAPIENTRYP FenceSync)(GLenum condition, GLbitfield flags); /* 574 */ + void (GLAPIENTRYP GetInteger64v)(GLenum pname, GLint64 * params); /* 575 */ + void (GLAPIENTRYP GetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values); /* 576 */ + GLboolean (GLAPIENTRYP IsSync)(GLsync sync); /* 577 */ + void (GLAPIENTRYP WaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout); /* 578 */ + void (GLAPIENTRYP DrawElementsBaseVertex)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); /* 579 */ + void (GLAPIENTRYP DrawRangeElementsBaseVertex)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); /* 580 */ + void (GLAPIENTRYP MultiDrawElementsBaseVertex)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount, const GLint * basevertex); /* 581 */ + void (GLAPIENTRYP BindTransformFeedback)(GLenum target, GLuint id); /* 582 */ + void (GLAPIENTRYP DeleteTransformFeedbacks)(GLsizei n, const GLuint * ids); /* 583 */ + void (GLAPIENTRYP DrawTransformFeedback)(GLenum mode, GLuint id); /* 584 */ + void (GLAPIENTRYP GenTransformFeedbacks)(GLsizei n, GLuint * ids); /* 585 */ + GLboolean (GLAPIENTRYP IsTransformFeedback)(GLuint id); /* 586 */ + void (GLAPIENTRYP PauseTransformFeedback)(void); /* 587 */ + void (GLAPIENTRYP ResumeTransformFeedback)(void); /* 588 */ + void (GLAPIENTRYP PolygonOffsetEXT)(GLfloat factor, GLfloat bias); /* 589 */ + void (GLAPIENTRYP GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 590 */ + void (GLAPIENTRYP GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 591 */ + void (GLAPIENTRYP PixelTexGenParameterfSGIS)(GLenum pname, GLfloat param); /* 592 */ + void (GLAPIENTRYP PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 593 */ + void (GLAPIENTRYP PixelTexGenParameteriSGIS)(GLenum pname, GLint param); /* 594 */ + void (GLAPIENTRYP PixelTexGenParameterivSGIS)(GLenum pname, const GLint * params); /* 595 */ + void (GLAPIENTRYP SampleMaskSGIS)(GLclampf value, GLboolean invert); /* 596 */ + void (GLAPIENTRYP SamplePatternSGIS)(GLenum pattern); /* 597 */ + void (GLAPIENTRYP ColorPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 598 */ + void (GLAPIENTRYP EdgeFlagPointerEXT)(GLsizei stride, GLsizei count, const GLboolean * pointer); /* 599 */ + void (GLAPIENTRYP IndexPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 600 */ + void (GLAPIENTRYP NormalPointerEXT)(GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 601 */ + void (GLAPIENTRYP TexCoordPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 602 */ + void (GLAPIENTRYP VertexPointerEXT)(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); /* 603 */ + void (GLAPIENTRYP PointParameterfEXT)(GLenum pname, GLfloat param); /* 604 */ + void (GLAPIENTRYP PointParameterfvEXT)(GLenum pname, const GLfloat * params); /* 605 */ + void (GLAPIENTRYP LockArraysEXT)(GLint first, GLsizei count); /* 606 */ + void (GLAPIENTRYP UnlockArraysEXT)(void); /* 607 */ + void (GLAPIENTRYP CullParameterdvEXT)(GLenum pname, GLdouble * params); /* 608 */ + void (GLAPIENTRYP CullParameterfvEXT)(GLenum pname, GLfloat * params); /* 609 */ + void (GLAPIENTRYP SecondaryColor3bEXT)(GLbyte red, GLbyte green, GLbyte blue); /* 610 */ + void (GLAPIENTRYP SecondaryColor3bvEXT)(const GLbyte * v); /* 611 */ + void (GLAPIENTRYP SecondaryColor3dEXT)(GLdouble red, GLdouble green, GLdouble blue); /* 612 */ + void (GLAPIENTRYP SecondaryColor3dvEXT)(const GLdouble * v); /* 613 */ + void (GLAPIENTRYP SecondaryColor3fEXT)(GLfloat red, GLfloat green, GLfloat blue); /* 614 */ + void (GLAPIENTRYP SecondaryColor3fvEXT)(const GLfloat * v); /* 615 */ + void (GLAPIENTRYP SecondaryColor3iEXT)(GLint red, GLint green, GLint blue); /* 616 */ + void (GLAPIENTRYP SecondaryColor3ivEXT)(const GLint * v); /* 617 */ + void (GLAPIENTRYP SecondaryColor3sEXT)(GLshort red, GLshort green, GLshort blue); /* 618 */ + void (GLAPIENTRYP SecondaryColor3svEXT)(const GLshort * v); /* 619 */ + void (GLAPIENTRYP SecondaryColor3ubEXT)(GLubyte red, GLubyte green, GLubyte blue); /* 620 */ + void (GLAPIENTRYP SecondaryColor3ubvEXT)(const GLubyte * v); /* 621 */ + void (GLAPIENTRYP SecondaryColor3uiEXT)(GLuint red, GLuint green, GLuint blue); /* 622 */ + void (GLAPIENTRYP SecondaryColor3uivEXT)(const GLuint * v); /* 623 */ + void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 624 */ + void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 625 */ + void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 626 */ + void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 627 */ + void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 628 */ + void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 629 */ + void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 630 */ + void (GLAPIENTRYP FogCoorddvEXT)(const GLdouble * coord); /* 631 */ + void (GLAPIENTRYP FogCoordfEXT)(GLfloat coord); /* 632 */ + void (GLAPIENTRYP FogCoordfvEXT)(const GLfloat * coord); /* 633 */ + void (GLAPIENTRYP PixelTexGenSGIX)(GLenum mode); /* 634 */ + void (GLAPIENTRYP BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 635 */ + void (GLAPIENTRYP FlushVertexArrayRangeNV)(void); /* 636 */ + void (GLAPIENTRYP VertexArrayRangeNV)(GLsizei length, const GLvoid * pointer); /* 637 */ + void (GLAPIENTRYP CombinerInputNV)(GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 638 */ + void (GLAPIENTRYP CombinerOutputNV)(GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); /* 639 */ + void (GLAPIENTRYP CombinerParameterfNV)(GLenum pname, GLfloat param); /* 640 */ + void (GLAPIENTRYP CombinerParameterfvNV)(GLenum pname, const GLfloat * params); /* 641 */ + void (GLAPIENTRYP CombinerParameteriNV)(GLenum pname, GLint param); /* 642 */ + void (GLAPIENTRYP CombinerParameterivNV)(GLenum pname, const GLint * params); /* 643 */ + void (GLAPIENTRYP FinalCombinerInputNV)(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); /* 644 */ + void (GLAPIENTRYP GetCombinerInputParameterfvNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat * params); /* 645 */ + void (GLAPIENTRYP GetCombinerInputParameterivNV)(GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint * params); /* 646 */ + void (GLAPIENTRYP GetCombinerOutputParameterfvNV)(GLenum stage, GLenum portion, GLenum pname, GLfloat * params); /* 647 */ + void (GLAPIENTRYP GetCombinerOutputParameterivNV)(GLenum stage, GLenum portion, GLenum pname, GLint * params); /* 648 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterfvNV)(GLenum variable, GLenum pname, GLfloat * params); /* 649 */ + void (GLAPIENTRYP GetFinalCombinerInputParameterivNV)(GLenum variable, GLenum pname, GLint * params); /* 650 */ + void (GLAPIENTRYP ResizeBuffersMESA)(void); /* 651 */ + void (GLAPIENTRYP WindowPos2dMESA)(GLdouble x, GLdouble y); /* 652 */ + void (GLAPIENTRYP WindowPos2dvMESA)(const GLdouble * v); /* 653 */ + void (GLAPIENTRYP WindowPos2fMESA)(GLfloat x, GLfloat y); /* 654 */ + void (GLAPIENTRYP WindowPos2fvMESA)(const GLfloat * v); /* 655 */ + void (GLAPIENTRYP WindowPos2iMESA)(GLint x, GLint y); /* 656 */ + void (GLAPIENTRYP WindowPos2ivMESA)(const GLint * v); /* 657 */ + void (GLAPIENTRYP WindowPos2sMESA)(GLshort x, GLshort y); /* 658 */ + void (GLAPIENTRYP WindowPos2svMESA)(const GLshort * v); /* 659 */ + void (GLAPIENTRYP WindowPos3dMESA)(GLdouble x, GLdouble y, GLdouble z); /* 660 */ + void (GLAPIENTRYP WindowPos3dvMESA)(const GLdouble * v); /* 661 */ + void (GLAPIENTRYP WindowPos3fMESA)(GLfloat x, GLfloat y, GLfloat z); /* 662 */ + void (GLAPIENTRYP WindowPos3fvMESA)(const GLfloat * v); /* 663 */ + void (GLAPIENTRYP WindowPos3iMESA)(GLint x, GLint y, GLint z); /* 664 */ + void (GLAPIENTRYP WindowPos3ivMESA)(const GLint * v); /* 665 */ + void (GLAPIENTRYP WindowPos3sMESA)(GLshort x, GLshort y, GLshort z); /* 666 */ + void (GLAPIENTRYP WindowPos3svMESA)(const GLshort * v); /* 667 */ + void (GLAPIENTRYP WindowPos4dMESA)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 668 */ + void (GLAPIENTRYP WindowPos4dvMESA)(const GLdouble * v); /* 669 */ + void (GLAPIENTRYP WindowPos4fMESA)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 670 */ + void (GLAPIENTRYP WindowPos4fvMESA)(const GLfloat * v); /* 671 */ + void (GLAPIENTRYP WindowPos4iMESA)(GLint x, GLint y, GLint z, GLint w); /* 672 */ + void (GLAPIENTRYP WindowPos4ivMESA)(const GLint * v); /* 673 */ + void (GLAPIENTRYP WindowPos4sMESA)(GLshort x, GLshort y, GLshort z, GLshort w); /* 674 */ + void (GLAPIENTRYP WindowPos4svMESA)(const GLshort * v); /* 675 */ + void (GLAPIENTRYP MultiModeDrawArraysIBM)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); /* 676 */ + void (GLAPIENTRYP MultiModeDrawElementsIBM)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); /* 677 */ + void (GLAPIENTRYP DeleteFencesNV)(GLsizei n, const GLuint * fences); /* 678 */ + void (GLAPIENTRYP FinishFenceNV)(GLuint fence); /* 679 */ + void (GLAPIENTRYP GenFencesNV)(GLsizei n, GLuint * fences); /* 680 */ + void (GLAPIENTRYP GetFenceivNV)(GLuint fence, GLenum pname, GLint * params); /* 681 */ + GLboolean (GLAPIENTRYP IsFenceNV)(GLuint fence); /* 682 */ + void (GLAPIENTRYP SetFenceNV)(GLuint fence, GLenum condition); /* 683 */ + GLboolean (GLAPIENTRYP TestFenceNV)(GLuint fence); /* 684 */ + GLboolean (GLAPIENTRYP AreProgramsResidentNV)(GLsizei n, const GLuint * ids, GLboolean * residences); /* 685 */ + void (GLAPIENTRYP BindProgramNV)(GLenum target, GLuint program); /* 686 */ + void (GLAPIENTRYP DeleteProgramsNV)(GLsizei n, const GLuint * programs); /* 687 */ + void (GLAPIENTRYP ExecuteProgramNV)(GLenum target, GLuint id, const GLfloat * params); /* 688 */ + void (GLAPIENTRYP GenProgramsNV)(GLsizei n, GLuint * programs); /* 689 */ + void (GLAPIENTRYP GetProgramParameterdvNV)(GLenum target, GLuint index, GLenum pname, GLdouble * params); /* 690 */ + void (GLAPIENTRYP GetProgramParameterfvNV)(GLenum target, GLuint index, GLenum pname, GLfloat * params); /* 691 */ + void (GLAPIENTRYP GetProgramStringNV)(GLuint id, GLenum pname, GLubyte * program); /* 692 */ + void (GLAPIENTRYP GetProgramivNV)(GLuint id, GLenum pname, GLint * params); /* 693 */ + void (GLAPIENTRYP GetTrackMatrixivNV)(GLenum target, GLuint address, GLenum pname, GLint * params); /* 694 */ + void (GLAPIENTRYP GetVertexAttribPointervNV)(GLuint index, GLenum pname, GLvoid ** pointer); /* 695 */ + void (GLAPIENTRYP GetVertexAttribdvNV)(GLuint index, GLenum pname, GLdouble * params); /* 696 */ + void (GLAPIENTRYP GetVertexAttribfvNV)(GLuint index, GLenum pname, GLfloat * params); /* 697 */ + void (GLAPIENTRYP GetVertexAttribivNV)(GLuint index, GLenum pname, GLint * params); /* 698 */ + GLboolean (GLAPIENTRYP IsProgramNV)(GLuint program); /* 699 */ + void (GLAPIENTRYP LoadProgramNV)(GLenum target, GLuint id, GLsizei len, const GLubyte * program); /* 700 */ + void (GLAPIENTRYP ProgramParameters4dvNV)(GLenum target, GLuint index, GLuint num, const GLdouble * params); /* 701 */ + void (GLAPIENTRYP ProgramParameters4fvNV)(GLenum target, GLuint index, GLuint num, const GLfloat * params); /* 702 */ + void (GLAPIENTRYP RequestResidentProgramsNV)(GLsizei n, const GLuint * ids); /* 703 */ + void (GLAPIENTRYP TrackMatrixNV)(GLenum target, GLuint address, GLenum matrix, GLenum transform); /* 704 */ + void (GLAPIENTRYP VertexAttrib1dNV)(GLuint index, GLdouble x); /* 705 */ + void (GLAPIENTRYP VertexAttrib1dvNV)(GLuint index, const GLdouble * v); /* 706 */ + void (GLAPIENTRYP VertexAttrib1fNV)(GLuint index, GLfloat x); /* 707 */ + void (GLAPIENTRYP VertexAttrib1fvNV)(GLuint index, const GLfloat * v); /* 708 */ + void (GLAPIENTRYP VertexAttrib1sNV)(GLuint index, GLshort x); /* 709 */ + void (GLAPIENTRYP VertexAttrib1svNV)(GLuint index, const GLshort * v); /* 710 */ + void (GLAPIENTRYP VertexAttrib2dNV)(GLuint index, GLdouble x, GLdouble y); /* 711 */ + void (GLAPIENTRYP VertexAttrib2dvNV)(GLuint index, const GLdouble * v); /* 712 */ + void (GLAPIENTRYP VertexAttrib2fNV)(GLuint index, GLfloat x, GLfloat y); /* 713 */ + void (GLAPIENTRYP VertexAttrib2fvNV)(GLuint index, const GLfloat * v); /* 714 */ + void (GLAPIENTRYP VertexAttrib2sNV)(GLuint index, GLshort x, GLshort y); /* 715 */ + void (GLAPIENTRYP VertexAttrib2svNV)(GLuint index, const GLshort * v); /* 716 */ + void (GLAPIENTRYP VertexAttrib3dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z); /* 717 */ + void (GLAPIENTRYP VertexAttrib3dvNV)(GLuint index, const GLdouble * v); /* 718 */ + void (GLAPIENTRYP VertexAttrib3fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z); /* 719 */ + void (GLAPIENTRYP VertexAttrib3fvNV)(GLuint index, const GLfloat * v); /* 720 */ + void (GLAPIENTRYP VertexAttrib3sNV)(GLuint index, GLshort x, GLshort y, GLshort z); /* 721 */ + void (GLAPIENTRYP VertexAttrib3svNV)(GLuint index, const GLshort * v); /* 722 */ + void (GLAPIENTRYP VertexAttrib4dNV)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 723 */ + void (GLAPIENTRYP VertexAttrib4dvNV)(GLuint index, const GLdouble * v); /* 724 */ + void (GLAPIENTRYP VertexAttrib4fNV)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 725 */ + void (GLAPIENTRYP VertexAttrib4fvNV)(GLuint index, const GLfloat * v); /* 726 */ + void (GLAPIENTRYP VertexAttrib4sNV)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); /* 727 */ + void (GLAPIENTRYP VertexAttrib4svNV)(GLuint index, const GLshort * v); /* 728 */ + void (GLAPIENTRYP VertexAttrib4ubNV)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); /* 729 */ + void (GLAPIENTRYP VertexAttrib4ubvNV)(GLuint index, const GLubyte * v); /* 730 */ + void (GLAPIENTRYP VertexAttribPointerNV)(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 731 */ + void (GLAPIENTRYP VertexAttribs1dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 732 */ + void (GLAPIENTRYP VertexAttribs1fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 733 */ + void (GLAPIENTRYP VertexAttribs1svNV)(GLuint index, GLsizei n, const GLshort * v); /* 734 */ + void (GLAPIENTRYP VertexAttribs2dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 735 */ + void (GLAPIENTRYP VertexAttribs2fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 736 */ + void (GLAPIENTRYP VertexAttribs2svNV)(GLuint index, GLsizei n, const GLshort * v); /* 737 */ + void (GLAPIENTRYP VertexAttribs3dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 738 */ + void (GLAPIENTRYP VertexAttribs3fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 739 */ + void (GLAPIENTRYP VertexAttribs3svNV)(GLuint index, GLsizei n, const GLshort * v); /* 740 */ + void (GLAPIENTRYP VertexAttribs4dvNV)(GLuint index, GLsizei n, const GLdouble * v); /* 741 */ + void (GLAPIENTRYP VertexAttribs4fvNV)(GLuint index, GLsizei n, const GLfloat * v); /* 742 */ + void (GLAPIENTRYP VertexAttribs4svNV)(GLuint index, GLsizei n, const GLshort * v); /* 743 */ + void (GLAPIENTRYP VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 744 */ + void (GLAPIENTRYP GetTexBumpParameterfvATI)(GLenum pname, GLfloat * param); /* 745 */ + void (GLAPIENTRYP GetTexBumpParameterivATI)(GLenum pname, GLint * param); /* 746 */ + void (GLAPIENTRYP TexBumpParameterfvATI)(GLenum pname, const GLfloat * param); /* 747 */ + void (GLAPIENTRYP TexBumpParameterivATI)(GLenum pname, const GLint * param); /* 748 */ + void (GLAPIENTRYP AlphaFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 749 */ + void (GLAPIENTRYP AlphaFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 750 */ + void (GLAPIENTRYP AlphaFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 751 */ + void (GLAPIENTRYP BeginFragmentShaderATI)(void); /* 752 */ + void (GLAPIENTRYP BindFragmentShaderATI)(GLuint id); /* 753 */ + void (GLAPIENTRYP ColorFragmentOp1ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); /* 754 */ + void (GLAPIENTRYP ColorFragmentOp2ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); /* 755 */ + void (GLAPIENTRYP ColorFragmentOp3ATI)(GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); /* 756 */ + void (GLAPIENTRYP DeleteFragmentShaderATI)(GLuint id); /* 757 */ + void (GLAPIENTRYP EndFragmentShaderATI)(void); /* 758 */ + GLuint (GLAPIENTRYP GenFragmentShadersATI)(GLuint range); /* 759 */ + void (GLAPIENTRYP PassTexCoordATI)(GLuint dst, GLuint coord, GLenum swizzle); /* 760 */ + void (GLAPIENTRYP SampleMapATI)(GLuint dst, GLuint interp, GLenum swizzle); /* 761 */ + void (GLAPIENTRYP SetFragmentShaderConstantATI)(GLuint dst, const GLfloat * value); /* 762 */ + void (GLAPIENTRYP PointParameteriNV)(GLenum pname, GLint param); /* 763 */ + void (GLAPIENTRYP PointParameterivNV)(GLenum pname, const GLint * params); /* 764 */ + void (GLAPIENTRYP ActiveStencilFaceEXT)(GLenum face); /* 765 */ + void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 766 */ + void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 767 */ + void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 768 */ + GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 769 */ + void (GLAPIENTRYP GetProgramNamedParameterdvNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params); /* 770 */ + void (GLAPIENTRYP GetProgramNamedParameterfvNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params); /* 771 */ + void (GLAPIENTRYP ProgramNamedParameter4dNV)(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 772 */ + void (GLAPIENTRYP ProgramNamedParameter4dvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v); /* 773 */ + void (GLAPIENTRYP ProgramNamedParameter4fNV)(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 774 */ + void (GLAPIENTRYP ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v); /* 775 */ + void (GLAPIENTRYP DepthBoundsEXT)(GLclampd zmin, GLclampd zmax); /* 776 */ + void (GLAPIENTRYP BlendEquationSeparateEXT)(GLenum modeRGB, GLenum modeA); /* 777 */ + void (GLAPIENTRYP BindFramebufferEXT)(GLenum target, GLuint framebuffer); /* 778 */ + void (GLAPIENTRYP BindRenderbufferEXT)(GLenum target, GLuint renderbuffer); /* 779 */ + GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 780 */ + void (GLAPIENTRYP DeleteFramebuffersEXT)(GLsizei n, const GLuint * framebuffers); /* 781 */ + void (GLAPIENTRYP DeleteRenderbuffersEXT)(GLsizei n, const GLuint * renderbuffers); /* 782 */ + void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 783 */ + void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 784 */ + void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 785 */ + void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 786 */ + void (GLAPIENTRYP GenFramebuffersEXT)(GLsizei n, GLuint * framebuffers); /* 787 */ + void (GLAPIENTRYP GenRenderbuffersEXT)(GLsizei n, GLuint * renderbuffers); /* 788 */ + void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 789 */ + void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 790 */ + void (GLAPIENTRYP GetRenderbufferParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 791 */ + GLboolean (GLAPIENTRYP IsFramebufferEXT)(GLuint framebuffer); /* 792 */ + GLboolean (GLAPIENTRYP IsRenderbufferEXT)(GLuint renderbuffer); /* 793 */ + void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 794 */ + void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 795 */ + void (GLAPIENTRYP BufferParameteriAPPLE)(GLenum target, GLenum pname, GLint param); /* 796 */ + void (GLAPIENTRYP FlushMappedBufferRangeAPPLE)(GLenum target, GLintptr offset, GLsizeiptr size); /* 797 */ + void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 798 */ + void (GLAPIENTRYP ColorMaskIndexedEXT)(GLuint buf, GLboolean r, GLboolean g, GLboolean b, GLboolean a); /* 799 */ + void (GLAPIENTRYP DisableIndexedEXT)(GLenum target, GLuint index); /* 800 */ + void (GLAPIENTRYP EnableIndexedEXT)(GLenum target, GLuint index); /* 801 */ + void (GLAPIENTRYP GetBooleanIndexedvEXT)(GLenum value, GLuint index, GLboolean * data); /* 802 */ + void (GLAPIENTRYP GetIntegerIndexedvEXT)(GLenum value, GLuint index, GLint * data); /* 803 */ + GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 804 */ + void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 805 */ + void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 806 */ + void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 807 */ + void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 808 */ + void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 809 */ + void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 810 */ + void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 811 */ + void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 812 */ + void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 813 */ + void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 814 */ + void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 815 */ + void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 816 */ + void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 817 */ + GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 818 */ + GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 819 */ + void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 820 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 821 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 822 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 823 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 824 */ + void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 825 */ + void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 826 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ diff --git a/mesalib/src/mapi/glapi/glapitemp.h b/mesalib/src/mapi/glapi/glapitemp.h index ea6b61159..2050e213d 100644 --- a/mesalib/src/mapi/glapi/glapitemp.h +++ b/mesalib/src/mapi/glapi/glapitemp.h @@ -2632,6 +2632,36 @@ KEYWORD1 void KEYWORD2 NAME(UniformMatrix4x3fv)(GLint location, GLsizei count, G DISPATCH(UniformMatrix4x3fv, (location, count, transpose, value), (F, "glUniformMatrix4x3fv(%d, %d, %d, %p);\n", location, count, transpose, (const void *) value)); } +KEYWORD1 void KEYWORD2 NAME(DrawArraysInstanced)(GLenum mode, GLint first, GLsizei count, GLsizei primcount) +{ + DISPATCH(DrawArraysInstanced, (mode, first, count, primcount), (F, "glDrawArraysInstanced(0x%x, %d, %d, %d);\n", mode, first, count, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawArraysInstancedARB)(GLenum mode, GLint first, GLsizei count, GLsizei primcount) +{ + DISPATCH(DrawArraysInstanced, (mode, first, count, primcount), (F, "glDrawArraysInstancedARB(0x%x, %d, %d, %d);\n", mode, first, count, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawArraysInstancedEXT)(GLenum mode, GLint first, GLsizei count, GLsizei primcount) +{ + DISPATCH(DrawArraysInstanced, (mode, first, count, primcount), (F, "glDrawArraysInstancedEXT(0x%x, %d, %d, %d);\n", mode, first, count, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawElementsInstanced)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount) +{ + DISPATCH(DrawElementsInstanced, (mode, count, type, indices, primcount), (F, "glDrawElementsInstanced(0x%x, %d, 0x%x, %p, %d);\n", mode, count, type, (const void *) indices, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawElementsInstancedARB)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount) +{ + DISPATCH(DrawElementsInstanced, (mode, count, type, indices, primcount), (F, "glDrawElementsInstancedARB(0x%x, %d, 0x%x, %p, %d);\n", mode, count, type, (const void *) indices, primcount)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawElementsInstancedEXT)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei primcount) +{ + DISPATCH(DrawElementsInstanced, (mode, count, type, indices, primcount), (F, "glDrawElementsInstancedEXT(0x%x, %d, 0x%x, %p, %d);\n", mode, count, type, (const void *) indices, primcount)); +} + KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixd)(const GLdouble * m) { DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixd(%p);\n", (const void *) m)); @@ -3852,6 +3882,21 @@ KEYWORD1 void KEYWORD2 NAME(RenderbufferStorageMultisampleEXT)(GLenum target, GL DISPATCH(RenderbufferStorageMultisample, (target, samples, internalformat, width, height), (F, "glRenderbufferStorageMultisampleEXT(0x%x, %d, 0x%x, %d, %d);\n", target, samples, internalformat, width, height)); } +KEYWORD1 void KEYWORD2 NAME(FramebufferTextureARB)(GLenum target, GLenum attachment, GLuint texture, GLint level) +{ + DISPATCH(FramebufferTextureARB, (target, attachment, texture, level), (F, "glFramebufferTextureARB(0x%x, 0x%x, %d, %d);\n", target, attachment, texture, level)); +} + +KEYWORD1 void KEYWORD2 NAME(FramebufferTextureFaceARB)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face) +{ + DISPATCH(FramebufferTextureFaceARB, (target, attachment, texture, level, face), (F, "glFramebufferTextureFaceARB(0x%x, 0x%x, %d, %d, 0x%x);\n", target, attachment, texture, level, face)); +} + +KEYWORD1 void KEYWORD2 NAME(ProgramParameteriARB)(GLuint program, GLenum pname, GLint value) +{ + DISPATCH(ProgramParameteriARB, (program, pname, value), (F, "glProgramParameteriARB(%d, 0x%x, %d);\n", program, pname, value)); +} + KEYWORD1 void KEYWORD2 NAME(FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length) { DISPATCH(FlushMappedBufferRange, (target, offset, length), (F, "glFlushMappedBufferRange(0x%x, %d, %d);\n", target, offset, length)); @@ -3927,63 +3972,98 @@ KEYWORD1 void KEYWORD2 NAME(MultiDrawElementsBaseVertex)(GLenum mode, const GLsi DISPATCH(MultiDrawElementsBaseVertex, (mode, count, type, indices, primcount, basevertex), (F, "glMultiDrawElementsBaseVertex(0x%x, %p, 0x%x, %p, %d, %p);\n", mode, (const void *) count, type, (const void *) indices, primcount, (const void *) basevertex)); } +KEYWORD1 void KEYWORD2 NAME(BindTransformFeedback)(GLenum target, GLuint id) +{ + DISPATCH(BindTransformFeedback, (target, id), (F, "glBindTransformFeedback(0x%x, %d);\n", target, id)); +} + +KEYWORD1 void KEYWORD2 NAME(DeleteTransformFeedbacks)(GLsizei n, const GLuint * ids) +{ + DISPATCH(DeleteTransformFeedbacks, (n, ids), (F, "glDeleteTransformFeedbacks(%d, %p);\n", n, (const void *) ids)); +} + +KEYWORD1 void KEYWORD2 NAME(DrawTransformFeedback)(GLenum mode, GLuint id) +{ + DISPATCH(DrawTransformFeedback, (mode, id), (F, "glDrawTransformFeedback(0x%x, %d);\n", mode, id)); +} + +KEYWORD1 void KEYWORD2 NAME(GenTransformFeedbacks)(GLsizei n, GLuint * ids) +{ + DISPATCH(GenTransformFeedbacks, (n, ids), (F, "glGenTransformFeedbacks(%d, %p);\n", n, (const void *) ids)); +} + +KEYWORD1 GLboolean KEYWORD2 NAME(IsTransformFeedback)(GLuint id) +{ + RETURN_DISPATCH(IsTransformFeedback, (id), (F, "glIsTransformFeedback(%d);\n", id)); +} + +KEYWORD1 void KEYWORD2 NAME(PauseTransformFeedback)(void) +{ + DISPATCH(PauseTransformFeedback, (), (F, "glPauseTransformFeedback();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(ResumeTransformFeedback)(void) +{ + DISPATCH(ResumeTransformFeedback, (), (F, "glResumeTransformFeedback();\n")); +} + KEYWORD1 void KEYWORD2 NAME(PolygonOffsetEXT)(GLfloat factor, GLfloat bias) { DISPATCH(PolygonOffsetEXT, (factor, bias), (F, "glPolygonOffsetEXT(%f, %f);\n", factor, bias)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_578)(GLenum pname, GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_590)(GLenum pname, GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_578)(GLenum pname, GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_590)(GLenum pname, GLfloat * params) { DISPATCH(GetPixelTexGenParameterfvSGIS, (pname, params), (F, "glGetPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_579)(GLenum pname, GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_591)(GLenum pname, GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_579)(GLenum pname, GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_591)(GLenum pname, GLint * params) { DISPATCH(GetPixelTexGenParameterivSGIS, (pname, params), (F, "glGetPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_580)(GLenum pname, GLfloat param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_592)(GLenum pname, GLfloat param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_580)(GLenum pname, GLfloat param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_592)(GLenum pname, GLfloat param) { DISPATCH(PixelTexGenParameterfSGIS, (pname, param), (F, "glPixelTexGenParameterfSGIS(0x%x, %f);\n", pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_581)(GLenum pname, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_593)(GLenum pname, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_581)(GLenum pname, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_593)(GLenum pname, const GLfloat * params) { DISPATCH(PixelTexGenParameterfvSGIS, (pname, params), (F, "glPixelTexGenParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLint param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_594)(GLenum pname, GLint param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_582)(GLenum pname, GLint param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_594)(GLenum pname, GLint param) { DISPATCH(PixelTexGenParameteriSGIS, (pname, param), (F, "glPixelTexGenParameteriSGIS(0x%x, %d);\n", pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_583)(GLenum pname, const GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_595)(GLenum pname, const GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_583)(GLenum pname, const GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_595)(GLenum pname, const GLint * params) { DISPATCH(PixelTexGenParameterivSGIS, (pname, params), (F, "glPixelTexGenParameterivSGIS(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_584)(GLclampf value, GLboolean invert); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_596)(GLclampf value, GLboolean invert); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_584)(GLclampf value, GLboolean invert) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_596)(GLclampf value, GLboolean invert) { DISPATCH(SampleMaskSGIS, (value, invert), (F, "glSampleMaskSGIS(%f, %d);\n", value, invert)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_585)(GLenum pattern); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_597)(GLenum pattern); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_585)(GLenum pattern) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_597)(GLenum pattern) { DISPATCH(SamplePatternSGIS, (pattern), (F, "glSamplePatternSGIS(0x%x);\n", pattern)); } @@ -4033,9 +4113,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfEXT)(GLenum pname, GLfloat param) DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfEXT(0x%x, %f);\n", pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_592)(GLenum pname, GLfloat param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_604)(GLenum pname, GLfloat param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_592)(GLenum pname, GLfloat param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_604)(GLenum pname, GLfloat param) { DISPATCH(PointParameterfEXT, (pname, param), (F, "glPointParameterfSGIS(0x%x, %f);\n", pname, param)); } @@ -4055,9 +4135,9 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum pname, const GLfloat * p DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_593)(GLenum pname, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_605)(GLenum pname, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_593)(GLenum pname, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_605)(GLenum pname, const GLfloat * params) { DISPATCH(PointParameterfvEXT, (pname, params), (F, "glPointParameterfvSGIS(0x%x, %p);\n", pname, (const void *) params)); } @@ -4072,16 +4152,16 @@ KEYWORD1 void KEYWORD2 NAME(UnlockArraysEXT)(void) DISPATCH(UnlockArraysEXT, (), (F, "glUnlockArraysEXT();\n")); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_596)(GLenum pname, GLdouble * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum pname, GLdouble * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_596)(GLenum pname, GLdouble * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_608)(GLenum pname, GLdouble * params) { DISPATCH(CullParameterdvEXT, (pname, params), (F, "glCullParameterdvEXT(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_597)(GLenum pname, GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum pname, GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_597)(GLenum pname, GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_609)(GLenum pname, GLfloat * params) { DISPATCH(CullParameterfvEXT, (pname, params), (F, "glCullParameterfvEXT(0x%x, %p);\n", pname, (const void *) params)); } @@ -4256,12 +4336,12 @@ KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, G DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer)); } -KEYWORD1 void KEYWORD2 NAME(MultiDrawArrays)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) +KEYWORD1 void KEYWORD2 NAME(MultiDrawArrays)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount) { DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArrays(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount)); } -KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount) +KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount) { DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArraysEXT(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount)); } @@ -4326,9 +4406,9 @@ KEYWORD1 void KEYWORD2 NAME(FogCoordfvEXT)(const GLfloat * coord) DISPATCH(FogCoordfvEXT, (coord), (F, "glFogCoordfvEXT(%p);\n", (const void *) coord)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_622)(GLenum mode); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_634)(GLenum mode); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_622)(GLenum mode) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_634)(GLenum mode) { DISPATCH(PixelTexGenSGIX, (mode), (F, "glPixelTexGenSGIX(0x%x);\n", mode)); } @@ -4343,9 +4423,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendFuncSeparateEXT)(GLenum sfactorRGB, GLenum dfac DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateEXT(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_623)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_635)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_623)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_635)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { DISPATCH(BlendFuncSeparateEXT, (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), (F, "glBlendFuncSeparateINGR(0x%x, 0x%x, 0x%x, 0x%x);\n", sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha)); } @@ -4710,65 +4790,65 @@ KEYWORD1 void KEYWORD2 NAME(WindowPos4svMESA)(const GLshort * v) DISPATCH(WindowPos4svMESA, (v), (F, "glWindowPos4svMESA(%p);\n", (const void *) v)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_664)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_676)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_664)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_676)(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawArraysIBM, (mode, first, count, primcount, modestride), (F, "glMultiModeDrawArraysIBM(%p, %p, %p, %d, %d);\n", (const void *) mode, (const void *) first, (const void *) count, primcount, modestride)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_665)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_677)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_665)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_677)(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride) { DISPATCH(MultiModeDrawElementsIBM, (mode, count, type, indices, primcount, modestride), (F, "glMultiModeDrawElementsIBM(%p, %p, 0x%x, %p, %d, %d);\n", (const void *) mode, (const void *) count, type, (const void *) indices, primcount, modestride)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_666)(GLsizei n, const GLuint * fences); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_678)(GLsizei n, const GLuint * fences); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_666)(GLsizei n, const GLuint * fences) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_678)(GLsizei n, const GLuint * fences) { DISPATCH(DeleteFencesNV, (n, fences), (F, "glDeleteFencesNV(%d, %p);\n", n, (const void *) fences)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_667)(GLuint fence); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_679)(GLuint fence); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_667)(GLuint fence) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_679)(GLuint fence) { DISPATCH(FinishFenceNV, (fence), (F, "glFinishFenceNV(%d);\n", fence)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_668)(GLsizei n, GLuint * fences); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_680)(GLsizei n, GLuint * fences); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_668)(GLsizei n, GLuint * fences) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_680)(GLsizei n, GLuint * fences) { DISPATCH(GenFencesNV, (n, fences), (F, "glGenFencesNV(%d, %p);\n", n, (const void *) fences)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_669)(GLuint fence, GLenum pname, GLint * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_681)(GLuint fence, GLenum pname, GLint * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_669)(GLuint fence, GLenum pname, GLint * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_681)(GLuint fence, GLenum pname, GLint * params) { DISPATCH(GetFenceivNV, (fence, pname, params), (F, "glGetFenceivNV(%d, 0x%x, %p);\n", fence, pname, (const void *) params)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_670)(GLuint fence); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_682)(GLuint fence); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_670)(GLuint fence) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_682)(GLuint fence) { RETURN_DISPATCH(IsFenceNV, (fence), (F, "glIsFenceNV(%d);\n", fence)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_671)(GLuint fence, GLenum condition); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_683)(GLuint fence, GLenum condition); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_671)(GLuint fence, GLenum condition) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_683)(GLuint fence, GLenum condition) { DISPATCH(SetFenceNV, (fence, condition), (F, "glSetFenceNV(%d, 0x%x);\n", fence, condition)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_672)(GLuint fence); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_684)(GLuint fence); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_672)(GLuint fence) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_684)(GLuint fence) { RETURN_DISPATCH(TestFenceNV, (fence), (F, "glTestFenceNV(%d);\n", fence)); } @@ -5213,16 +5293,16 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterivNV)(GLenum pname, const GLint * para DISPATCH(PointParameterivNV, (pname, params), (F, "glPointParameterivNV(0x%x, %p);\n", pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_753)(GLenum face); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_765)(GLenum face); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_753)(GLenum face) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_765)(GLenum face) { DISPATCH(ActiveStencilFaceEXT, (face), (F, "glActiveStencilFaceEXT(0x%x);\n", face)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_754)(GLuint array); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_766)(GLuint array); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_754)(GLuint array) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_766)(GLuint array) { DISPATCH(BindVertexArrayAPPLE, (array), (F, "glBindVertexArrayAPPLE(%d);\n", array)); } @@ -5232,16 +5312,16 @@ KEYWORD1 void KEYWORD2 NAME(DeleteVertexArrays)(GLsizei n, const GLuint * arrays DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArrays(%d, %p);\n", n, (const void *) arrays)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_755)(GLsizei n, const GLuint * arrays); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_767)(GLsizei n, const GLuint * arrays); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_755)(GLsizei n, const GLuint * arrays) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_767)(GLsizei n, const GLuint * arrays) { DISPATCH(DeleteVertexArraysAPPLE, (n, arrays), (F, "glDeleteVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_756)(GLsizei n, GLuint * arrays); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLsizei n, GLuint * arrays); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_756)(GLsizei n, GLuint * arrays) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_768)(GLsizei n, GLuint * arrays) { DISPATCH(GenVertexArraysAPPLE, (n, arrays), (F, "glGenVertexArraysAPPLE(%d, %p);\n", n, (const void *) arrays)); } @@ -5251,9 +5331,9 @@ KEYWORD1 GLboolean KEYWORD2 NAME(IsVertexArray)(GLuint array) RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArray(%d);\n", array)); } -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_757)(GLuint array); +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_769)(GLuint array); -KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_757)(GLuint array) +KEYWORD1_ALT GLboolean KEYWORD2 NAME(_dispatch_stub_769)(GLuint array) { RETURN_DISPATCH(IsVertexArrayAPPLE, (array), (F, "glIsVertexArrayAPPLE(%d);\n", array)); } @@ -5288,9 +5368,9 @@ KEYWORD1 void KEYWORD2 NAME(ProgramNamedParameter4fvNV)(GLuint id, GLsizei len, DISPATCH(ProgramNamedParameter4fvNV, (id, len, name, v), (F, "glProgramNamedParameter4fvNV(%d, %d, %p, %p);\n", id, len, (const void *) name, (const void *) v)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_764)(GLclampd zmin, GLclampd zmax); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_776)(GLclampd zmin, GLclampd zmax); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_764)(GLclampd zmin, GLclampd zmax) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_776)(GLclampd zmin, GLclampd zmax) { DISPATCH(DepthBoundsEXT, (zmin, zmax), (F, "glDepthBoundsEXT(%f, %f);\n", zmin, zmax)); } @@ -5300,9 +5380,9 @@ KEYWORD1 void KEYWORD2 NAME(BlendEquationSeparate)(GLenum modeRGB, GLenum modeA) DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparate(0x%x, 0x%x);\n", modeRGB, modeA)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_765)(GLenum modeRGB, GLenum modeA); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_777)(GLenum modeRGB, GLenum modeA); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_765)(GLenum modeRGB, GLenum modeA) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_777)(GLenum modeRGB, GLenum modeA) { DISPATCH(BlendEquationSeparateEXT, (modeRGB, modeA), (F, "glBlendEquationSeparateEXT(0x%x, 0x%x);\n", modeRGB, modeA)); } @@ -5482,23 +5562,23 @@ KEYWORD1 void KEYWORD2 NAME(BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint src DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_783)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_795)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_783)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_795)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { DISPATCH(BlitFramebufferEXT, (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), (F, "glBlitFramebufferEXT(%d, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x);\n", srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_784)(GLenum target, GLenum pname, GLint param); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_796)(GLenum target, GLenum pname, GLint param); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_784)(GLenum target, GLenum pname, GLint param) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_796)(GLenum target, GLenum pname, GLint param) { DISPATCH(BufferParameteriAPPLE, (target, pname, param), (F, "glBufferParameteriAPPLE(0x%x, 0x%x, %d);\n", target, pname, param)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_785)(GLenum target, GLintptr offset, GLsizeiptr size); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_797)(GLenum target, GLintptr offset, GLsizeiptr size); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_785)(GLenum target, GLintptr offset, GLsizeiptr size) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_797)(GLenum target, GLintptr offset, GLsizeiptr size) { DISPATCH(FlushMappedBufferRangeAPPLE, (target, offset, size), (F, "glFlushMappedBufferRangeAPPLE(0x%x, %d, %d);\n", target, offset, size)); } @@ -5553,6 +5633,71 @@ KEYWORD1 void KEYWORD2 NAME(EndConditionalRenderNV)(void) DISPATCH(EndConditionalRenderNV, (), (F, "glEndConditionalRenderNV();\n")); } +KEYWORD1 void KEYWORD2 NAME(BeginTransformFeedbackEXT)(GLenum mode) +{ + DISPATCH(BeginTransformFeedbackEXT, (mode), (F, "glBeginTransformFeedbackEXT(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(BeginTransformFeedback)(GLenum mode) +{ + DISPATCH(BeginTransformFeedbackEXT, (mode), (F, "glBeginTransformFeedback(0x%x);\n", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer) +{ + DISPATCH(BindBufferBaseEXT, (target, index, buffer), (F, "glBindBufferBaseEXT(0x%x, %d, %d);\n", target, index, buffer)); +} + +KEYWORD1 void KEYWORD2 NAME(BindBufferBase)(GLenum target, GLuint index, GLuint buffer) +{ + DISPATCH(BindBufferBaseEXT, (target, index, buffer), (F, "glBindBufferBase(0x%x, %d, %d);\n", target, index, buffer)); +} + +KEYWORD1 void KEYWORD2 NAME(BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset) +{ + DISPATCH(BindBufferOffsetEXT, (target, index, buffer, offset), (F, "glBindBufferOffsetEXT(0x%x, %d, %d, %d);\n", target, index, buffer, offset)); +} + +KEYWORD1 void KEYWORD2 NAME(BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + DISPATCH(BindBufferRangeEXT, (target, index, buffer, offset, size), (F, "glBindBufferRangeEXT(0x%x, %d, %d, %d, %d);\n", target, index, buffer, offset, size)); +} + +KEYWORD1 void KEYWORD2 NAME(BindBufferRange)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + DISPATCH(BindBufferRangeEXT, (target, index, buffer, offset, size), (F, "glBindBufferRange(0x%x, %d, %d, %d, %d);\n", target, index, buffer, offset, size)); +} + +KEYWORD1 void KEYWORD2 NAME(EndTransformFeedbackEXT)(void) +{ + DISPATCH(EndTransformFeedbackEXT, (), (F, "glEndTransformFeedbackEXT();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(EndTransformFeedback)(void) +{ + DISPATCH(EndTransformFeedbackEXT, (), (F, "glEndTransformFeedback();\n")); +} + +KEYWORD1 void KEYWORD2 NAME(GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name) +{ + DISPATCH(GetTransformFeedbackVaryingEXT, (program, index, bufSize, length, size, type, name), (F, "glGetTransformFeedbackVaryingEXT(%d, %d, %d, %p, %p, %p, %p);\n", program, index, bufSize, (const void *) length, (const void *) size, (const void *) type, (const void *) name)); +} + +KEYWORD1 void KEYWORD2 NAME(GetTransformFeedbackVarying)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name) +{ + DISPATCH(GetTransformFeedbackVaryingEXT, (program, index, bufSize, length, size, type, name), (F, "glGetTransformFeedbackVarying(%d, %d, %d, %p, %p, %p, %p);\n", program, index, bufSize, (const void *) length, (const void *) size, (const void *) type, (const void *) name)); +} + +KEYWORD1 void KEYWORD2 NAME(TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode) +{ + DISPATCH(TransformFeedbackVaryingsEXT, (program, count, varyings, bufferMode), (F, "glTransformFeedbackVaryingsEXT(%d, %d, %p, 0x%x);\n", program, count, (const void *) varyings, bufferMode)); +} + +KEYWORD1 void KEYWORD2 NAME(TransformFeedbackVaryings)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode) +{ + DISPATCH(TransformFeedbackVaryingsEXT, (program, count, varyings, bufferMode), (F, "glTransformFeedbackVaryings(%d, %d, %p, 0x%x);\n", program, count, (const void *) varyings, bufferMode)); +} + KEYWORD1 void KEYWORD2 NAME(ProvokingVertexEXT)(GLenum mode) { DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertexEXT(0x%x);\n", mode)); @@ -5563,16 +5708,16 @@ KEYWORD1 void KEYWORD2 NAME(ProvokingVertex)(GLenum mode) DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertex(0x%x);\n", mode)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_796)(GLenum target, GLenum pname, GLvoid ** params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_815)(GLenum target, GLenum pname, GLvoid ** params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_796)(GLenum target, GLenum pname, GLvoid ** params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_815)(GLenum target, GLenum pname, GLvoid ** params) { DISPATCH(GetTexParameterPointervAPPLE, (target, pname, params), (F, "glGetTexParameterPointervAPPLE(0x%x, 0x%x, %p);\n", target, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_797)(GLenum target, GLsizei length, GLvoid * pointer); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_816)(GLenum target, GLsizei length, GLvoid * pointer); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_797)(GLenum target, GLsizei length, GLvoid * pointer) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_816)(GLenum target, GLsizei length, GLvoid * pointer) { DISPATCH(TextureRangeAPPLE, (target, length, pointer), (F, "glTextureRangeAPPLE(0x%x, %d, %p);\n", target, length, (const void *) pointer)); } @@ -5592,37 +5737,37 @@ KEYWORD1 GLenum KEYWORD2 NAME(ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint RETURN_DISPATCH(ObjectUnpurgeableAPPLE, (objectType, name, option), (F, "glObjectUnpurgeableAPPLE(0x%x, %d, 0x%x);\n", objectType, name, option)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_801)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_820)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_801)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_820)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) { DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_802)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_821)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_802)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_821)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_803)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_822)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_803)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_822)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_804)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_823)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_804)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_823)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_805)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_824)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_805)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_824)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6220,6 +6365,8 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(UniformMatrix3x4fv), TABLE_ENTRY(UniformMatrix4x2fv), TABLE_ENTRY(UniformMatrix4x3fv), + TABLE_ENTRY(DrawArraysInstanced), + TABLE_ENTRY(DrawElementsInstanced), TABLE_ENTRY(LoadTransposeMatrixdARB), TABLE_ENTRY(LoadTransposeMatrixfARB), TABLE_ENTRY(MultTransposeMatrixdARB), @@ -6352,6 +6499,9 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(GetAttribLocationARB), TABLE_ENTRY(DrawBuffersARB), TABLE_ENTRY(RenderbufferStorageMultisample), + TABLE_ENTRY(FramebufferTextureARB), + TABLE_ENTRY(FramebufferTextureFaceARB), + TABLE_ENTRY(ProgramParameteriARB), TABLE_ENTRY(FlushMappedBufferRange), TABLE_ENTRY(MapBufferRange), TABLE_ENTRY(BindVertexArray), @@ -6367,15 +6517,22 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(DrawElementsBaseVertex), TABLE_ENTRY(DrawRangeElementsBaseVertex), TABLE_ENTRY(MultiDrawElementsBaseVertex), + TABLE_ENTRY(BindTransformFeedback), + TABLE_ENTRY(DeleteTransformFeedbacks), + TABLE_ENTRY(DrawTransformFeedback), + TABLE_ENTRY(GenTransformFeedbacks), + TABLE_ENTRY(IsTransformFeedback), + TABLE_ENTRY(PauseTransformFeedback), + TABLE_ENTRY(ResumeTransformFeedback), TABLE_ENTRY(PolygonOffsetEXT), - TABLE_ENTRY(_dispatch_stub_578), - TABLE_ENTRY(_dispatch_stub_579), - TABLE_ENTRY(_dispatch_stub_580), - TABLE_ENTRY(_dispatch_stub_581), - TABLE_ENTRY(_dispatch_stub_582), - TABLE_ENTRY(_dispatch_stub_583), - TABLE_ENTRY(_dispatch_stub_584), - TABLE_ENTRY(_dispatch_stub_585), + TABLE_ENTRY(_dispatch_stub_590), + TABLE_ENTRY(_dispatch_stub_591), + TABLE_ENTRY(_dispatch_stub_592), + TABLE_ENTRY(_dispatch_stub_593), + TABLE_ENTRY(_dispatch_stub_594), + TABLE_ENTRY(_dispatch_stub_595), + TABLE_ENTRY(_dispatch_stub_596), + TABLE_ENTRY(_dispatch_stub_597), TABLE_ENTRY(ColorPointerEXT), TABLE_ENTRY(EdgeFlagPointerEXT), TABLE_ENTRY(IndexPointerEXT), @@ -6386,8 +6543,8 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(PointParameterfvEXT), TABLE_ENTRY(LockArraysEXT), TABLE_ENTRY(UnlockArraysEXT), - TABLE_ENTRY(_dispatch_stub_596), - TABLE_ENTRY(_dispatch_stub_597), + TABLE_ENTRY(_dispatch_stub_608), + TABLE_ENTRY(_dispatch_stub_609), TABLE_ENTRY(SecondaryColor3bEXT), TABLE_ENTRY(SecondaryColor3bvEXT), TABLE_ENTRY(SecondaryColor3dEXT), @@ -6412,7 +6569,7 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(FogCoorddvEXT), TABLE_ENTRY(FogCoordfEXT), TABLE_ENTRY(FogCoordfvEXT), - TABLE_ENTRY(_dispatch_stub_622), + TABLE_ENTRY(_dispatch_stub_634), TABLE_ENTRY(BlendFuncSeparateEXT), TABLE_ENTRY(FlushVertexArrayRangeNV), TABLE_ENTRY(VertexArrayRangeNV), @@ -6454,15 +6611,15 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(WindowPos4ivMESA), TABLE_ENTRY(WindowPos4sMESA), TABLE_ENTRY(WindowPos4svMESA), - TABLE_ENTRY(_dispatch_stub_664), - TABLE_ENTRY(_dispatch_stub_665), - TABLE_ENTRY(_dispatch_stub_666), - TABLE_ENTRY(_dispatch_stub_667), - TABLE_ENTRY(_dispatch_stub_668), - TABLE_ENTRY(_dispatch_stub_669), - TABLE_ENTRY(_dispatch_stub_670), - TABLE_ENTRY(_dispatch_stub_671), - TABLE_ENTRY(_dispatch_stub_672), + TABLE_ENTRY(_dispatch_stub_676), + TABLE_ENTRY(_dispatch_stub_677), + TABLE_ENTRY(_dispatch_stub_678), + TABLE_ENTRY(_dispatch_stub_679), + TABLE_ENTRY(_dispatch_stub_680), + TABLE_ENTRY(_dispatch_stub_681), + TABLE_ENTRY(_dispatch_stub_682), + TABLE_ENTRY(_dispatch_stub_683), + TABLE_ENTRY(_dispatch_stub_684), TABLE_ENTRY(AreProgramsResidentNV), TABLE_ENTRY(BindProgramNV), TABLE_ENTRY(DeleteProgramsNV), @@ -6543,19 +6700,19 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(SetFragmentShaderConstantATI), TABLE_ENTRY(PointParameteriNV), TABLE_ENTRY(PointParameterivNV), - TABLE_ENTRY(_dispatch_stub_753), - TABLE_ENTRY(_dispatch_stub_754), - TABLE_ENTRY(_dispatch_stub_755), - TABLE_ENTRY(_dispatch_stub_756), - TABLE_ENTRY(_dispatch_stub_757), + TABLE_ENTRY(_dispatch_stub_765), + TABLE_ENTRY(_dispatch_stub_766), + TABLE_ENTRY(_dispatch_stub_767), + TABLE_ENTRY(_dispatch_stub_768), + TABLE_ENTRY(_dispatch_stub_769), TABLE_ENTRY(GetProgramNamedParameterdvNV), TABLE_ENTRY(GetProgramNamedParameterfvNV), TABLE_ENTRY(ProgramNamedParameter4dNV), TABLE_ENTRY(ProgramNamedParameter4dvNV), TABLE_ENTRY(ProgramNamedParameter4fNV), TABLE_ENTRY(ProgramNamedParameter4fvNV), - TABLE_ENTRY(_dispatch_stub_764), - TABLE_ENTRY(_dispatch_stub_765), + TABLE_ENTRY(_dispatch_stub_776), + TABLE_ENTRY(_dispatch_stub_777), TABLE_ENTRY(BindFramebufferEXT), TABLE_ENTRY(BindRenderbufferEXT), TABLE_ENTRY(CheckFramebufferStatusEXT), @@ -6573,9 +6730,9 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(IsFramebufferEXT), TABLE_ENTRY(IsRenderbufferEXT), TABLE_ENTRY(RenderbufferStorageEXT), - TABLE_ENTRY(_dispatch_stub_783), - TABLE_ENTRY(_dispatch_stub_784), - TABLE_ENTRY(_dispatch_stub_785), + TABLE_ENTRY(_dispatch_stub_795), + TABLE_ENTRY(_dispatch_stub_796), + TABLE_ENTRY(_dispatch_stub_797), TABLE_ENTRY(FramebufferTextureLayerEXT), TABLE_ENTRY(ColorMaskIndexedEXT), TABLE_ENTRY(DisableIndexedEXT), @@ -6585,17 +6742,24 @@ _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(IsEnabledIndexedEXT), TABLE_ENTRY(BeginConditionalRenderNV), TABLE_ENTRY(EndConditionalRenderNV), + TABLE_ENTRY(BeginTransformFeedbackEXT), + TABLE_ENTRY(BindBufferBaseEXT), + TABLE_ENTRY(BindBufferOffsetEXT), + TABLE_ENTRY(BindBufferRangeEXT), + TABLE_ENTRY(EndTransformFeedbackEXT), + TABLE_ENTRY(GetTransformFeedbackVaryingEXT), + TABLE_ENTRY(TransformFeedbackVaryingsEXT), TABLE_ENTRY(ProvokingVertexEXT), - TABLE_ENTRY(_dispatch_stub_796), - TABLE_ENTRY(_dispatch_stub_797), + TABLE_ENTRY(_dispatch_stub_815), + TABLE_ENTRY(_dispatch_stub_816), TABLE_ENTRY(GetObjectParameterivAPPLE), TABLE_ENTRY(ObjectPurgeableAPPLE), TABLE_ENTRY(ObjectUnpurgeableAPPLE), - TABLE_ENTRY(_dispatch_stub_801), - TABLE_ENTRY(_dispatch_stub_802), - TABLE_ENTRY(_dispatch_stub_803), - TABLE_ENTRY(_dispatch_stub_804), - TABLE_ENTRY(_dispatch_stub_805), + TABLE_ENTRY(_dispatch_stub_820), + TABLE_ENTRY(_dispatch_stub_821), + TABLE_ENTRY(_dispatch_stub_822), + TABLE_ENTRY(_dispatch_stub_823), + TABLE_ENTRY(_dispatch_stub_824), TABLE_ENTRY(EGLImageTargetRenderbufferStorageOES), TABLE_ENTRY(EGLImageTargetTexture2DOES), /* A whole bunch of no-op functions. These might be called @@ -6784,6 +6948,10 @@ _glapi_proc UNUSED_TABLE_NAME[] = { TABLE_ENTRY(MultiTexCoord4s), TABLE_ENTRY(MultiTexCoord4sv), TABLE_ENTRY(_dispatch_stub_423), + TABLE_ENTRY(DrawArraysInstancedARB), + TABLE_ENTRY(DrawArraysInstancedEXT), + TABLE_ENTRY(DrawElementsInstancedARB), + TABLE_ENTRY(DrawElementsInstancedEXT), TABLE_ENTRY(LoadTransposeMatrixd), TABLE_ENTRY(LoadTransposeMatrixf), TABLE_ENTRY(MultTransposeMatrixd), @@ -6898,10 +7066,10 @@ _glapi_proc UNUSED_TABLE_NAME[] = { TABLE_ENTRY(RenderbufferStorageMultisampleEXT), TABLE_ENTRY(PointParameterf), TABLE_ENTRY(PointParameterfARB), - TABLE_ENTRY(_dispatch_stub_592), + TABLE_ENTRY(_dispatch_stub_604), TABLE_ENTRY(PointParameterfv), TABLE_ENTRY(PointParameterfvARB), - TABLE_ENTRY(_dispatch_stub_593), + TABLE_ENTRY(_dispatch_stub_605), TABLE_ENTRY(SecondaryColor3b), TABLE_ENTRY(SecondaryColor3bv), TABLE_ENTRY(SecondaryColor3d), @@ -6927,7 +7095,7 @@ _glapi_proc UNUSED_TABLE_NAME[] = { TABLE_ENTRY(FogCoordf), TABLE_ENTRY(FogCoordfv), TABLE_ENTRY(BlendFuncSeparate), - TABLE_ENTRY(_dispatch_stub_623), + TABLE_ENTRY(_dispatch_stub_635), TABLE_ENTRY(WindowPos2d), TABLE_ENTRY(WindowPos2dARB), TABLE_ENTRY(WindowPos2dv), @@ -6990,6 +7158,12 @@ _glapi_proc UNUSED_TABLE_NAME[] = { TABLE_ENTRY(RenderbufferStorage), TABLE_ENTRY(BlitFramebuffer), TABLE_ENTRY(FramebufferTextureLayer), + TABLE_ENTRY(BeginTransformFeedback), + TABLE_ENTRY(BindBufferBase), + TABLE_ENTRY(BindBufferRange), + TABLE_ENTRY(EndTransformFeedback), + TABLE_ENTRY(GetTransformFeedbackVarying), + TABLE_ENTRY(TransformFeedbackVaryings), TABLE_ENTRY(ProvokingVertex), #endif /* _GLAPI_SKIP_NORMAL_ENTRY_POINTS */ #ifndef _GLAPI_SKIP_PROTO_ENTRY_POINTS diff --git a/mesalib/src/mapi/glapi/glprocs.h b/mesalib/src/mapi/glapi/glprocs.h index 44861863e..0ddcf4bad 100644 --- a/mesalib/src/mapi/glapi/glprocs.h +++ b/mesalib/src/mapi/glapi/glprocs.h @@ -482,6 +482,8 @@ static const char gl_string_table[] = "glUniformMatrix3x4fv\0" "glUniformMatrix4x2fv\0" "glUniformMatrix4x3fv\0" + "glDrawArraysInstanced\0" + "glDrawElementsInstanced\0" "glLoadTransposeMatrixdARB\0" "glLoadTransposeMatrixfARB\0" "glMultTransposeMatrixdARB\0" @@ -614,6 +616,9 @@ static const char gl_string_table[] = "glGetAttribLocationARB\0" "glDrawBuffersARB\0" "glRenderbufferStorageMultisample\0" + "glFramebufferTextureARB\0" + "glFramebufferTextureFaceARB\0" + "glProgramParameteriARB\0" "glFlushMappedBufferRange\0" "glMapBufferRange\0" "glBindVertexArray\0" @@ -629,6 +634,13 @@ static const char gl_string_table[] = "glDrawElementsBaseVertex\0" "glDrawRangeElementsBaseVertex\0" "glMultiDrawElementsBaseVertex\0" + "glBindTransformFeedback\0" + "glDeleteTransformFeedbacks\0" + "glDrawTransformFeedback\0" + "glGenTransformFeedbacks\0" + "glIsTransformFeedback\0" + "glPauseTransformFeedback\0" + "glResumeTransformFeedback\0" "glPolygonOffsetEXT\0" "glGetPixelTexGenParameterfvSGIS\0" "glGetPixelTexGenParameterivSGIS\0" @@ -847,6 +859,13 @@ static const char gl_string_table[] = "glIsEnabledIndexedEXT\0" "glBeginConditionalRenderNV\0" "glEndConditionalRenderNV\0" + "glBeginTransformFeedbackEXT\0" + "glBindBufferBaseEXT\0" + "glBindBufferOffsetEXT\0" + "glBindBufferRangeEXT\0" + "glEndTransformFeedbackEXT\0" + "glGetTransformFeedbackVaryingEXT\0" + "glTransformFeedbackVaryingsEXT\0" "glProvokingVertexEXT\0" "glGetTexParameterPointervAPPLE\0" "glTextureRangeAPPLE\0" @@ -952,6 +971,10 @@ static const char gl_string_table[] = "glMultiTexCoord4s\0" "glMultiTexCoord4sv\0" "glStencilOpSeparateATI\0" + "glDrawArraysInstancedARB\0" + "glDrawArraysInstancedEXT\0" + "glDrawElementsInstancedARB\0" + "glDrawElementsInstancedEXT\0" "glLoadTransposeMatrixd\0" "glLoadTransposeMatrixf\0" "glMultTransposeMatrixd\0" @@ -1161,6 +1184,12 @@ static const char gl_string_table[] = "glRenderbufferStorage\0" "glBlitFramebuffer\0" "glFramebufferTextureLayer\0" + "glBeginTransformFeedback\0" + "glBindBufferBase\0" + "glBindBufferRange\0" + "glEndTransformFeedback\0" + "glGetTransformFeedbackVarying\0" + "glTransformFeedbackVaryings\0" "glProvokingVertex\0" ; @@ -1179,43 +1208,43 @@ static const char gl_string_table[] = #define gl_dispatch_stub_364 mgl_dispatch_stub_364 #define gl_dispatch_stub_365 mgl_dispatch_stub_365 #define gl_dispatch_stub_366 mgl_dispatch_stub_366 -#define gl_dispatch_stub_578 mgl_dispatch_stub_578 -#define gl_dispatch_stub_579 mgl_dispatch_stub_579 -#define gl_dispatch_stub_580 mgl_dispatch_stub_580 -#define gl_dispatch_stub_581 mgl_dispatch_stub_581 -#define gl_dispatch_stub_582 mgl_dispatch_stub_582 -#define gl_dispatch_stub_583 mgl_dispatch_stub_583 -#define gl_dispatch_stub_584 mgl_dispatch_stub_584 -#define gl_dispatch_stub_585 mgl_dispatch_stub_585 +#define gl_dispatch_stub_590 mgl_dispatch_stub_590 +#define gl_dispatch_stub_591 mgl_dispatch_stub_591 +#define gl_dispatch_stub_592 mgl_dispatch_stub_592 +#define gl_dispatch_stub_593 mgl_dispatch_stub_593 +#define gl_dispatch_stub_594 mgl_dispatch_stub_594 +#define gl_dispatch_stub_595 mgl_dispatch_stub_595 #define gl_dispatch_stub_596 mgl_dispatch_stub_596 #define gl_dispatch_stub_597 mgl_dispatch_stub_597 -#define gl_dispatch_stub_622 mgl_dispatch_stub_622 -#define gl_dispatch_stub_664 mgl_dispatch_stub_664 -#define gl_dispatch_stub_665 mgl_dispatch_stub_665 -#define gl_dispatch_stub_666 mgl_dispatch_stub_666 -#define gl_dispatch_stub_667 mgl_dispatch_stub_667 -#define gl_dispatch_stub_668 mgl_dispatch_stub_668 -#define gl_dispatch_stub_669 mgl_dispatch_stub_669 -#define gl_dispatch_stub_670 mgl_dispatch_stub_670 -#define gl_dispatch_stub_671 mgl_dispatch_stub_671 -#define gl_dispatch_stub_672 mgl_dispatch_stub_672 -#define gl_dispatch_stub_753 mgl_dispatch_stub_753 -#define gl_dispatch_stub_754 mgl_dispatch_stub_754 -#define gl_dispatch_stub_755 mgl_dispatch_stub_755 -#define gl_dispatch_stub_756 mgl_dispatch_stub_756 -#define gl_dispatch_stub_757 mgl_dispatch_stub_757 -#define gl_dispatch_stub_764 mgl_dispatch_stub_764 +#define gl_dispatch_stub_608 mgl_dispatch_stub_608 +#define gl_dispatch_stub_609 mgl_dispatch_stub_609 +#define gl_dispatch_stub_634 mgl_dispatch_stub_634 +#define gl_dispatch_stub_676 mgl_dispatch_stub_676 +#define gl_dispatch_stub_677 mgl_dispatch_stub_677 +#define gl_dispatch_stub_678 mgl_dispatch_stub_678 +#define gl_dispatch_stub_679 mgl_dispatch_stub_679 +#define gl_dispatch_stub_680 mgl_dispatch_stub_680 +#define gl_dispatch_stub_681 mgl_dispatch_stub_681 +#define gl_dispatch_stub_682 mgl_dispatch_stub_682 +#define gl_dispatch_stub_683 mgl_dispatch_stub_683 +#define gl_dispatch_stub_684 mgl_dispatch_stub_684 #define gl_dispatch_stub_765 mgl_dispatch_stub_765 -#define gl_dispatch_stub_783 mgl_dispatch_stub_783 -#define gl_dispatch_stub_784 mgl_dispatch_stub_784 -#define gl_dispatch_stub_785 mgl_dispatch_stub_785 +#define gl_dispatch_stub_766 mgl_dispatch_stub_766 +#define gl_dispatch_stub_767 mgl_dispatch_stub_767 +#define gl_dispatch_stub_768 mgl_dispatch_stub_768 +#define gl_dispatch_stub_769 mgl_dispatch_stub_769 +#define gl_dispatch_stub_776 mgl_dispatch_stub_776 +#define gl_dispatch_stub_777 mgl_dispatch_stub_777 +#define gl_dispatch_stub_795 mgl_dispatch_stub_795 #define gl_dispatch_stub_796 mgl_dispatch_stub_796 #define gl_dispatch_stub_797 mgl_dispatch_stub_797 -#define gl_dispatch_stub_801 mgl_dispatch_stub_801 -#define gl_dispatch_stub_802 mgl_dispatch_stub_802 -#define gl_dispatch_stub_803 mgl_dispatch_stub_803 -#define gl_dispatch_stub_804 mgl_dispatch_stub_804 -#define gl_dispatch_stub_805 mgl_dispatch_stub_805 +#define gl_dispatch_stub_815 mgl_dispatch_stub_815 +#define gl_dispatch_stub_816 mgl_dispatch_stub_816 +#define gl_dispatch_stub_820 mgl_dispatch_stub_820 +#define gl_dispatch_stub_821 mgl_dispatch_stub_821 +#define gl_dispatch_stub_822 mgl_dispatch_stub_822 +#define gl_dispatch_stub_823 mgl_dispatch_stub_823 +#define gl_dispatch_stub_824 mgl_dispatch_stub_824 #endif /* USE_MGL_NAMESPACE */ @@ -1233,43 +1262,43 @@ void GLAPIENTRY gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params void GLAPIENTRY gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); void GLAPIENTRY gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params); void GLAPIENTRY gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params); -void GLAPIENTRY gl_dispatch_stub_578(GLenum pname, GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_579(GLenum pname, GLint * params); -void GLAPIENTRY gl_dispatch_stub_580(GLenum pname, GLfloat param); -void GLAPIENTRY gl_dispatch_stub_581(GLenum pname, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_582(GLenum pname, GLint param); -void GLAPIENTRY gl_dispatch_stub_583(GLenum pname, const GLint * params); -void GLAPIENTRY gl_dispatch_stub_584(GLclampf value, GLboolean invert); -void GLAPIENTRY gl_dispatch_stub_585(GLenum pattern); -void GLAPIENTRY gl_dispatch_stub_596(GLenum pname, GLdouble * params); -void GLAPIENTRY gl_dispatch_stub_597(GLenum pname, GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_622(GLenum mode); -void GLAPIENTRY gl_dispatch_stub_664(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); -void GLAPIENTRY gl_dispatch_stub_665(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); -void GLAPIENTRY gl_dispatch_stub_666(GLsizei n, const GLuint * fences); -void GLAPIENTRY gl_dispatch_stub_667(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_668(GLsizei n, GLuint * fences); -void GLAPIENTRY gl_dispatch_stub_669(GLuint fence, GLenum pname, GLint * params); -GLboolean GLAPIENTRY gl_dispatch_stub_670(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_671(GLuint fence, GLenum condition); -GLboolean GLAPIENTRY gl_dispatch_stub_672(GLuint fence); -void GLAPIENTRY gl_dispatch_stub_753(GLenum face); -void GLAPIENTRY gl_dispatch_stub_754(GLuint array); -void GLAPIENTRY gl_dispatch_stub_755(GLsizei n, const GLuint * arrays); -void GLAPIENTRY gl_dispatch_stub_756(GLsizei n, GLuint * arrays); -GLboolean GLAPIENTRY gl_dispatch_stub_757(GLuint array); -void GLAPIENTRY gl_dispatch_stub_764(GLclampd zmin, GLclampd zmax); -void GLAPIENTRY gl_dispatch_stub_765(GLenum modeRGB, GLenum modeA); -void GLAPIENTRY gl_dispatch_stub_783(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -void GLAPIENTRY gl_dispatch_stub_784(GLenum target, GLenum pname, GLint param); -void GLAPIENTRY gl_dispatch_stub_785(GLenum target, GLintptr offset, GLsizeiptr size); -void GLAPIENTRY gl_dispatch_stub_796(GLenum target, GLenum pname, GLvoid ** params); -void GLAPIENTRY gl_dispatch_stub_797(GLenum target, GLsizei length, GLvoid * pointer); -void GLAPIENTRY gl_dispatch_stub_801(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -void GLAPIENTRY gl_dispatch_stub_802(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_803(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -void GLAPIENTRY gl_dispatch_stub_804(GLuint id, GLenum pname, GLint64EXT * params); -void GLAPIENTRY gl_dispatch_stub_805(GLuint id, GLenum pname, GLuint64EXT * params); +void GLAPIENTRY gl_dispatch_stub_590(GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_591(GLenum pname, GLint * params); +void GLAPIENTRY gl_dispatch_stub_592(GLenum pname, GLfloat param); +void GLAPIENTRY gl_dispatch_stub_593(GLenum pname, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_594(GLenum pname, GLint param); +void GLAPIENTRY gl_dispatch_stub_595(GLenum pname, const GLint * params); +void GLAPIENTRY gl_dispatch_stub_596(GLclampf value, GLboolean invert); +void GLAPIENTRY gl_dispatch_stub_597(GLenum pattern); +void GLAPIENTRY gl_dispatch_stub_608(GLenum pname, GLdouble * params); +void GLAPIENTRY gl_dispatch_stub_609(GLenum pname, GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_634(GLenum mode); +void GLAPIENTRY gl_dispatch_stub_676(const GLenum * mode, const GLint * first, const GLsizei * count, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_677(const GLenum * mode, const GLsizei * count, GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride); +void GLAPIENTRY gl_dispatch_stub_678(GLsizei n, const GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_679(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_680(GLsizei n, GLuint * fences); +void GLAPIENTRY gl_dispatch_stub_681(GLuint fence, GLenum pname, GLint * params); +GLboolean GLAPIENTRY gl_dispatch_stub_682(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_683(GLuint fence, GLenum condition); +GLboolean GLAPIENTRY gl_dispatch_stub_684(GLuint fence); +void GLAPIENTRY gl_dispatch_stub_765(GLenum face); +void GLAPIENTRY gl_dispatch_stub_766(GLuint array); +void GLAPIENTRY gl_dispatch_stub_767(GLsizei n, const GLuint * arrays); +void GLAPIENTRY gl_dispatch_stub_768(GLsizei n, GLuint * arrays); +GLboolean GLAPIENTRY gl_dispatch_stub_769(GLuint array); +void GLAPIENTRY gl_dispatch_stub_776(GLclampd zmin, GLclampd zmax); +void GLAPIENTRY gl_dispatch_stub_777(GLenum modeRGB, GLenum modeA); +void GLAPIENTRY gl_dispatch_stub_795(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +void GLAPIENTRY gl_dispatch_stub_796(GLenum target, GLenum pname, GLint param); +void GLAPIENTRY gl_dispatch_stub_797(GLenum target, GLintptr offset, GLsizeiptr size); +void GLAPIENTRY gl_dispatch_stub_815(GLenum target, GLenum pname, GLvoid ** params); +void GLAPIENTRY gl_dispatch_stub_816(GLenum target, GLsizei length, GLvoid * pointer); +void GLAPIENTRY gl_dispatch_stub_820(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +void GLAPIENTRY gl_dispatch_stub_821(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_822(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +void GLAPIENTRY gl_dispatch_stub_823(GLuint id, GLenum pname, GLint64EXT * params); +void GLAPIENTRY gl_dispatch_stub_824(GLuint id, GLenum pname, GLuint64EXT * params); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1703,686 +1732,715 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET( 6100, glUniformMatrix3x4fv, glUniformMatrix3x4fv, NULL, _gloffset_UniformMatrix3x4fv), NAME_FUNC_OFFSET( 6121, glUniformMatrix4x2fv, glUniformMatrix4x2fv, NULL, _gloffset_UniformMatrix4x2fv), NAME_FUNC_OFFSET( 6142, glUniformMatrix4x3fv, glUniformMatrix4x3fv, NULL, _gloffset_UniformMatrix4x3fv), - NAME_FUNC_OFFSET( 6163, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), - NAME_FUNC_OFFSET( 6189, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), - NAME_FUNC_OFFSET( 6215, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), - NAME_FUNC_OFFSET( 6241, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), - NAME_FUNC_OFFSET( 6267, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), - NAME_FUNC_OFFSET( 6287, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), - NAME_FUNC_OFFSET( 6313, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), - NAME_FUNC_OFFSET( 6339, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), - NAME_FUNC_OFFSET( 6365, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), - NAME_FUNC_OFFSET( 6394, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), - NAME_FUNC_OFFSET( 6423, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), - NAME_FUNC_OFFSET( 6452, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), - NAME_FUNC_OFFSET( 6479, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), - NAME_FUNC_OFFSET( 6509, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), - NAME_FUNC_OFFSET( 6538, glGetProgramEnvParameterdvARB, glGetProgramEnvParameterdvARB, NULL, _gloffset_GetProgramEnvParameterdvARB), - NAME_FUNC_OFFSET( 6568, glGetProgramEnvParameterfvARB, glGetProgramEnvParameterfvARB, NULL, _gloffset_GetProgramEnvParameterfvARB), - NAME_FUNC_OFFSET( 6598, glGetProgramLocalParameterdvARB, glGetProgramLocalParameterdvARB, NULL, _gloffset_GetProgramLocalParameterdvARB), - NAME_FUNC_OFFSET( 6630, glGetProgramLocalParameterfvARB, glGetProgramLocalParameterfvARB, NULL, _gloffset_GetProgramLocalParameterfvARB), - NAME_FUNC_OFFSET( 6662, glGetProgramStringARB, glGetProgramStringARB, NULL, _gloffset_GetProgramStringARB), - NAME_FUNC_OFFSET( 6684, glGetProgramivARB, glGetProgramivARB, NULL, _gloffset_GetProgramivARB), - NAME_FUNC_OFFSET( 6702, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), - NAME_FUNC_OFFSET( 6725, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), - NAME_FUNC_OFFSET( 6748, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), - NAME_FUNC_OFFSET( 6771, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), - NAME_FUNC_OFFSET( 6798, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), - NAME_FUNC_OFFSET( 6826, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), - NAME_FUNC_OFFSET( 6853, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), - NAME_FUNC_OFFSET( 6881, glProgramLocalParameter4dARB, glProgramLocalParameter4dARB, NULL, _gloffset_ProgramLocalParameter4dARB), - NAME_FUNC_OFFSET( 6910, glProgramLocalParameter4dvARB, glProgramLocalParameter4dvARB, NULL, _gloffset_ProgramLocalParameter4dvARB), - NAME_FUNC_OFFSET( 6940, glProgramLocalParameter4fARB, glProgramLocalParameter4fARB, NULL, _gloffset_ProgramLocalParameter4fARB), - NAME_FUNC_OFFSET( 6969, glProgramLocalParameter4fvARB, glProgramLocalParameter4fvARB, NULL, _gloffset_ProgramLocalParameter4fvARB), - NAME_FUNC_OFFSET( 6999, glProgramStringARB, glProgramStringARB, NULL, _gloffset_ProgramStringARB), - NAME_FUNC_OFFSET( 7018, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), - NAME_FUNC_OFFSET( 7038, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), - NAME_FUNC_OFFSET( 7059, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), - NAME_FUNC_OFFSET( 7079, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), - NAME_FUNC_OFFSET( 7100, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), - NAME_FUNC_OFFSET( 7120, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), - NAME_FUNC_OFFSET( 7141, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), - NAME_FUNC_OFFSET( 7161, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), - NAME_FUNC_OFFSET( 7182, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), - NAME_FUNC_OFFSET( 7202, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), - NAME_FUNC_OFFSET( 7223, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), - NAME_FUNC_OFFSET( 7243, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), - NAME_FUNC_OFFSET( 7264, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), - NAME_FUNC_OFFSET( 7284, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), - NAME_FUNC_OFFSET( 7305, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), - NAME_FUNC_OFFSET( 7325, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), - NAME_FUNC_OFFSET( 7346, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), - NAME_FUNC_OFFSET( 7366, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), - NAME_FUNC_OFFSET( 7387, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), - NAME_FUNC_OFFSET( 7409, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), - NAME_FUNC_OFFSET( 7431, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), - NAME_FUNC_OFFSET( 7453, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), - NAME_FUNC_OFFSET( 7475, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), - NAME_FUNC_OFFSET( 7498, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), - NAME_FUNC_OFFSET( 7521, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET( 7544, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), - NAME_FUNC_OFFSET( 7565, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET( 7585, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET( 7606, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET( 7626, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET( 7647, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), - NAME_FUNC_OFFSET( 7668, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET( 7688, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET( 7709, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), - NAME_FUNC_OFFSET( 7731, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), - NAME_FUNC_OFFSET( 7753, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), - NAME_FUNC_OFFSET( 7775, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET( 7800, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET( 7816, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET( 7832, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET( 7851, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET( 7870, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET( 7886, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET( 7912, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET( 7935, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET( 7957, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET( 7971, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET( 7986, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET( 8003, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET( 8019, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET( 8038, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET( 8052, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET( 8068, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET( 8090, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET( 8113, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET( 8129, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET( 8142, glAttachObjectARB, glAttachObjectARB, NULL, _gloffset_AttachObjectARB), - NAME_FUNC_OFFSET( 8160, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET( 8179, glCreateProgramObjectARB, glCreateProgramObjectARB, NULL, _gloffset_CreateProgramObjectARB), - NAME_FUNC_OFFSET( 8204, glCreateShaderObjectARB, glCreateShaderObjectARB, NULL, _gloffset_CreateShaderObjectARB), - NAME_FUNC_OFFSET( 8228, glDeleteObjectARB, glDeleteObjectARB, NULL, _gloffset_DeleteObjectARB), - NAME_FUNC_OFFSET( 8246, glDetachObjectARB, glDetachObjectARB, NULL, _gloffset_DetachObjectARB), - NAME_FUNC_OFFSET( 8264, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET( 8286, glGetAttachedObjectsARB, glGetAttachedObjectsARB, NULL, _gloffset_GetAttachedObjectsARB), - NAME_FUNC_OFFSET( 8310, glGetHandleARB, glGetHandleARB, NULL, _gloffset_GetHandleARB), - NAME_FUNC_OFFSET( 8325, glGetInfoLogARB, glGetInfoLogARB, NULL, _gloffset_GetInfoLogARB), - NAME_FUNC_OFFSET( 8341, glGetObjectParameterfvARB, glGetObjectParameterfvARB, NULL, _gloffset_GetObjectParameterfvARB), - NAME_FUNC_OFFSET( 8367, glGetObjectParameterivARB, glGetObjectParameterivARB, NULL, _gloffset_GetObjectParameterivARB), - NAME_FUNC_OFFSET( 8393, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET( 8414, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET( 8438, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET( 8456, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET( 8474, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET( 8491, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET( 8509, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET( 8524, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET( 8540, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET( 8555, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET( 8571, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET( 8586, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET( 8602, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET( 8617, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET( 8633, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET( 8648, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET( 8664, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET( 8679, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET( 8695, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET( 8710, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET( 8726, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET( 8741, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET( 8757, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET( 8779, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET( 8801, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET( 8823, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET( 8845, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET( 8866, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET( 8890, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET( 8911, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET( 8934, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET( 8951, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample), - NAME_FUNC_OFFSET( 8984, glFlushMappedBufferRange, glFlushMappedBufferRange, NULL, _gloffset_FlushMappedBufferRange), - NAME_FUNC_OFFSET( 9009, glMapBufferRange, glMapBufferRange, NULL, _gloffset_MapBufferRange), - NAME_FUNC_OFFSET( 9026, glBindVertexArray, glBindVertexArray, NULL, _gloffset_BindVertexArray), - NAME_FUNC_OFFSET( 9044, glGenVertexArrays, glGenVertexArrays, NULL, _gloffset_GenVertexArrays), - NAME_FUNC_OFFSET( 9062, glCopyBufferSubData, glCopyBufferSubData, NULL, _gloffset_CopyBufferSubData), - NAME_FUNC_OFFSET( 9082, glClientWaitSync, glClientWaitSync, NULL, _gloffset_ClientWaitSync), - NAME_FUNC_OFFSET( 9099, glDeleteSync, glDeleteSync, NULL, _gloffset_DeleteSync), - NAME_FUNC_OFFSET( 9112, glFenceSync, glFenceSync, NULL, _gloffset_FenceSync), - NAME_FUNC_OFFSET( 9124, glGetInteger64v, glGetInteger64v, NULL, _gloffset_GetInteger64v), - NAME_FUNC_OFFSET( 9140, glGetSynciv, glGetSynciv, NULL, _gloffset_GetSynciv), - NAME_FUNC_OFFSET( 9152, glIsSync, glIsSync, NULL, _gloffset_IsSync), - NAME_FUNC_OFFSET( 9161, glWaitSync, glWaitSync, NULL, _gloffset_WaitSync), - NAME_FUNC_OFFSET( 9172, glDrawElementsBaseVertex, glDrawElementsBaseVertex, NULL, _gloffset_DrawElementsBaseVertex), - NAME_FUNC_OFFSET( 9197, glDrawRangeElementsBaseVertex, glDrawRangeElementsBaseVertex, NULL, _gloffset_DrawRangeElementsBaseVertex), - NAME_FUNC_OFFSET( 9227, glMultiDrawElementsBaseVertex, glMultiDrawElementsBaseVertex, NULL, _gloffset_MultiDrawElementsBaseVertex), - NAME_FUNC_OFFSET( 9257, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, _gloffset_PolygonOffsetEXT), - NAME_FUNC_OFFSET( 9276, gl_dispatch_stub_578, gl_dispatch_stub_578, NULL, _gloffset_GetPixelTexGenParameterfvSGIS), - NAME_FUNC_OFFSET( 9308, gl_dispatch_stub_579, gl_dispatch_stub_579, NULL, _gloffset_GetPixelTexGenParameterivSGIS), - NAME_FUNC_OFFSET( 9340, gl_dispatch_stub_580, gl_dispatch_stub_580, NULL, _gloffset_PixelTexGenParameterfSGIS), - NAME_FUNC_OFFSET( 9368, gl_dispatch_stub_581, gl_dispatch_stub_581, NULL, _gloffset_PixelTexGenParameterfvSGIS), - NAME_FUNC_OFFSET( 9397, gl_dispatch_stub_582, gl_dispatch_stub_582, NULL, _gloffset_PixelTexGenParameteriSGIS), - NAME_FUNC_OFFSET( 9425, gl_dispatch_stub_583, gl_dispatch_stub_583, NULL, _gloffset_PixelTexGenParameterivSGIS), - NAME_FUNC_OFFSET( 9454, gl_dispatch_stub_584, gl_dispatch_stub_584, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET( 9471, gl_dispatch_stub_585, gl_dispatch_stub_585, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET( 9491, glColorPointerEXT, glColorPointerEXT, NULL, _gloffset_ColorPointerEXT), - NAME_FUNC_OFFSET( 9509, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, _gloffset_EdgeFlagPointerEXT), - NAME_FUNC_OFFSET( 9530, glIndexPointerEXT, glIndexPointerEXT, NULL, _gloffset_IndexPointerEXT), - NAME_FUNC_OFFSET( 9548, glNormalPointerEXT, glNormalPointerEXT, NULL, _gloffset_NormalPointerEXT), - NAME_FUNC_OFFSET( 9567, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, _gloffset_TexCoordPointerEXT), - NAME_FUNC_OFFSET( 9588, glVertexPointerEXT, glVertexPointerEXT, NULL, _gloffset_VertexPointerEXT), - NAME_FUNC_OFFSET( 9607, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET( 9628, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET( 9650, glLockArraysEXT, glLockArraysEXT, NULL, _gloffset_LockArraysEXT), - NAME_FUNC_OFFSET( 9666, glUnlockArraysEXT, glUnlockArraysEXT, NULL, _gloffset_UnlockArraysEXT), - NAME_FUNC_OFFSET( 9684, gl_dispatch_stub_596, gl_dispatch_stub_596, NULL, _gloffset_CullParameterdvEXT), - NAME_FUNC_OFFSET( 9705, gl_dispatch_stub_597, gl_dispatch_stub_597, NULL, _gloffset_CullParameterfvEXT), - NAME_FUNC_OFFSET( 9726, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET( 9748, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET( 9771, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET( 9793, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET( 9816, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET( 9838, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET( 9861, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET( 9883, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET( 9906, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET( 9928, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET( 9951, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET( 9974, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET( 9998, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(10021, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(10045, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(10068, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(10092, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(10119, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(10140, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(10163, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(10184, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(10199, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(10215, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(10230, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(10246, gl_dispatch_stub_622, gl_dispatch_stub_622, NULL, _gloffset_PixelTexGenSGIX), - NAME_FUNC_OFFSET(10264, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(10287, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, _gloffset_FlushVertexArrayRangeNV), - NAME_FUNC_OFFSET(10313, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, _gloffset_VertexArrayRangeNV), - NAME_FUNC_OFFSET(10334, glCombinerInputNV, glCombinerInputNV, NULL, _gloffset_CombinerInputNV), - NAME_FUNC_OFFSET(10352, glCombinerOutputNV, glCombinerOutputNV, NULL, _gloffset_CombinerOutputNV), - NAME_FUNC_OFFSET(10371, glCombinerParameterfNV, glCombinerParameterfNV, NULL, _gloffset_CombinerParameterfNV), - NAME_FUNC_OFFSET(10394, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, _gloffset_CombinerParameterfvNV), - NAME_FUNC_OFFSET(10418, glCombinerParameteriNV, glCombinerParameteriNV, NULL, _gloffset_CombinerParameteriNV), - NAME_FUNC_OFFSET(10441, glCombinerParameterivNV, glCombinerParameterivNV, NULL, _gloffset_CombinerParameterivNV), - NAME_FUNC_OFFSET(10465, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, _gloffset_FinalCombinerInputNV), - NAME_FUNC_OFFSET(10488, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, _gloffset_GetCombinerInputParameterfvNV), - NAME_FUNC_OFFSET(10520, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, _gloffset_GetCombinerInputParameterivNV), - NAME_FUNC_OFFSET(10552, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, _gloffset_GetCombinerOutputParameterfvNV), - NAME_FUNC_OFFSET(10585, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, _gloffset_GetCombinerOutputParameterivNV), - NAME_FUNC_OFFSET(10618, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, _gloffset_GetFinalCombinerInputParameterfvNV), - NAME_FUNC_OFFSET(10655, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, _gloffset_GetFinalCombinerInputParameterivNV), - NAME_FUNC_OFFSET(10692, glResizeBuffersMESA, glResizeBuffersMESA, NULL, _gloffset_ResizeBuffersMESA), - NAME_FUNC_OFFSET(10712, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(10730, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(10749, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(10767, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(10786, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(10804, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(10823, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(10841, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(10860, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(10878, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(10897, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(10915, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(10934, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(10952, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(10971, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(10989, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(11008, glWindowPos4dMESA, glWindowPos4dMESA, NULL, _gloffset_WindowPos4dMESA), - NAME_FUNC_OFFSET(11026, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, _gloffset_WindowPos4dvMESA), - NAME_FUNC_OFFSET(11045, glWindowPos4fMESA, glWindowPos4fMESA, NULL, _gloffset_WindowPos4fMESA), - NAME_FUNC_OFFSET(11063, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, _gloffset_WindowPos4fvMESA), - NAME_FUNC_OFFSET(11082, glWindowPos4iMESA, glWindowPos4iMESA, NULL, _gloffset_WindowPos4iMESA), - NAME_FUNC_OFFSET(11100, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, _gloffset_WindowPos4ivMESA), - NAME_FUNC_OFFSET(11119, glWindowPos4sMESA, glWindowPos4sMESA, NULL, _gloffset_WindowPos4sMESA), - NAME_FUNC_OFFSET(11137, glWindowPos4svMESA, glWindowPos4svMESA, NULL, _gloffset_WindowPos4svMESA), - NAME_FUNC_OFFSET(11156, gl_dispatch_stub_664, gl_dispatch_stub_664, NULL, _gloffset_MultiModeDrawArraysIBM), - NAME_FUNC_OFFSET(11181, gl_dispatch_stub_665, gl_dispatch_stub_665, NULL, _gloffset_MultiModeDrawElementsIBM), - NAME_FUNC_OFFSET(11208, gl_dispatch_stub_666, gl_dispatch_stub_666, NULL, _gloffset_DeleteFencesNV), - NAME_FUNC_OFFSET(11225, gl_dispatch_stub_667, gl_dispatch_stub_667, NULL, _gloffset_FinishFenceNV), - NAME_FUNC_OFFSET(11241, gl_dispatch_stub_668, gl_dispatch_stub_668, NULL, _gloffset_GenFencesNV), - NAME_FUNC_OFFSET(11255, gl_dispatch_stub_669, gl_dispatch_stub_669, NULL, _gloffset_GetFenceivNV), - NAME_FUNC_OFFSET(11270, gl_dispatch_stub_670, gl_dispatch_stub_670, NULL, _gloffset_IsFenceNV), - NAME_FUNC_OFFSET(11282, gl_dispatch_stub_671, gl_dispatch_stub_671, NULL, _gloffset_SetFenceNV), - NAME_FUNC_OFFSET(11295, gl_dispatch_stub_672, gl_dispatch_stub_672, NULL, _gloffset_TestFenceNV), - NAME_FUNC_OFFSET(11309, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, _gloffset_AreProgramsResidentNV), - NAME_FUNC_OFFSET(11333, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(11349, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(11368, glExecuteProgramNV, glExecuteProgramNV, NULL, _gloffset_ExecuteProgramNV), - NAME_FUNC_OFFSET(11387, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(11403, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, _gloffset_GetProgramParameterdvNV), - NAME_FUNC_OFFSET(11429, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, _gloffset_GetProgramParameterfvNV), - NAME_FUNC_OFFSET(11455, glGetProgramStringNV, glGetProgramStringNV, NULL, _gloffset_GetProgramStringNV), - NAME_FUNC_OFFSET(11476, glGetProgramivNV, glGetProgramivNV, NULL, _gloffset_GetProgramivNV), - NAME_FUNC_OFFSET(11493, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, _gloffset_GetTrackMatrixivNV), - NAME_FUNC_OFFSET(11514, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(11542, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, _gloffset_GetVertexAttribdvNV), - NAME_FUNC_OFFSET(11564, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, _gloffset_GetVertexAttribfvNV), - NAME_FUNC_OFFSET(11586, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, _gloffset_GetVertexAttribivNV), - NAME_FUNC_OFFSET(11608, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(11622, glLoadProgramNV, glLoadProgramNV, NULL, _gloffset_LoadProgramNV), - NAME_FUNC_OFFSET(11638, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, _gloffset_ProgramParameters4dvNV), - NAME_FUNC_OFFSET(11663, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, _gloffset_ProgramParameters4fvNV), - NAME_FUNC_OFFSET(11688, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, _gloffset_RequestResidentProgramsNV), - NAME_FUNC_OFFSET(11716, glTrackMatrixNV, glTrackMatrixNV, NULL, _gloffset_TrackMatrixNV), - NAME_FUNC_OFFSET(11732, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, _gloffset_VertexAttrib1dNV), - NAME_FUNC_OFFSET(11751, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, _gloffset_VertexAttrib1dvNV), - NAME_FUNC_OFFSET(11771, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, _gloffset_VertexAttrib1fNV), - NAME_FUNC_OFFSET(11790, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, _gloffset_VertexAttrib1fvNV), - NAME_FUNC_OFFSET(11810, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, _gloffset_VertexAttrib1sNV), - NAME_FUNC_OFFSET(11829, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, _gloffset_VertexAttrib1svNV), - NAME_FUNC_OFFSET(11849, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, _gloffset_VertexAttrib2dNV), - NAME_FUNC_OFFSET(11868, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, _gloffset_VertexAttrib2dvNV), - NAME_FUNC_OFFSET(11888, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, _gloffset_VertexAttrib2fNV), - NAME_FUNC_OFFSET(11907, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, _gloffset_VertexAttrib2fvNV), - NAME_FUNC_OFFSET(11927, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, _gloffset_VertexAttrib2sNV), - NAME_FUNC_OFFSET(11946, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, _gloffset_VertexAttrib2svNV), - NAME_FUNC_OFFSET(11966, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, _gloffset_VertexAttrib3dNV), - NAME_FUNC_OFFSET(11985, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, _gloffset_VertexAttrib3dvNV), - NAME_FUNC_OFFSET(12005, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, _gloffset_VertexAttrib3fNV), - NAME_FUNC_OFFSET(12024, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, _gloffset_VertexAttrib3fvNV), - NAME_FUNC_OFFSET(12044, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, _gloffset_VertexAttrib3sNV), - NAME_FUNC_OFFSET(12063, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, _gloffset_VertexAttrib3svNV), - NAME_FUNC_OFFSET(12083, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, _gloffset_VertexAttrib4dNV), - NAME_FUNC_OFFSET(12102, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, _gloffset_VertexAttrib4dvNV), - NAME_FUNC_OFFSET(12122, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, _gloffset_VertexAttrib4fNV), - NAME_FUNC_OFFSET(12141, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, _gloffset_VertexAttrib4fvNV), - NAME_FUNC_OFFSET(12161, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, _gloffset_VertexAttrib4sNV), - NAME_FUNC_OFFSET(12180, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, _gloffset_VertexAttrib4svNV), - NAME_FUNC_OFFSET(12200, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, _gloffset_VertexAttrib4ubNV), - NAME_FUNC_OFFSET(12220, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, _gloffset_VertexAttrib4ubvNV), - NAME_FUNC_OFFSET(12241, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, _gloffset_VertexAttribPointerNV), - NAME_FUNC_OFFSET(12265, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, _gloffset_VertexAttribs1dvNV), - NAME_FUNC_OFFSET(12286, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, _gloffset_VertexAttribs1fvNV), - NAME_FUNC_OFFSET(12307, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, _gloffset_VertexAttribs1svNV), - NAME_FUNC_OFFSET(12328, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, _gloffset_VertexAttribs2dvNV), - NAME_FUNC_OFFSET(12349, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, _gloffset_VertexAttribs2fvNV), - NAME_FUNC_OFFSET(12370, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, _gloffset_VertexAttribs2svNV), - NAME_FUNC_OFFSET(12391, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, _gloffset_VertexAttribs3dvNV), - NAME_FUNC_OFFSET(12412, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, _gloffset_VertexAttribs3fvNV), - NAME_FUNC_OFFSET(12433, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, _gloffset_VertexAttribs3svNV), - NAME_FUNC_OFFSET(12454, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, _gloffset_VertexAttribs4dvNV), - NAME_FUNC_OFFSET(12475, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, _gloffset_VertexAttribs4fvNV), - NAME_FUNC_OFFSET(12496, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, _gloffset_VertexAttribs4svNV), - NAME_FUNC_OFFSET(12517, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, _gloffset_VertexAttribs4ubvNV), - NAME_FUNC_OFFSET(12539, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, _gloffset_GetTexBumpParameterfvATI), - NAME_FUNC_OFFSET(12566, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, _gloffset_GetTexBumpParameterivATI), - NAME_FUNC_OFFSET(12593, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, _gloffset_TexBumpParameterfvATI), - NAME_FUNC_OFFSET(12617, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, _gloffset_TexBumpParameterivATI), - NAME_FUNC_OFFSET(12641, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI), - NAME_FUNC_OFFSET(12663, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI), - NAME_FUNC_OFFSET(12685, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI), - NAME_FUNC_OFFSET(12707, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI), - NAME_FUNC_OFFSET(12732, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI), - NAME_FUNC_OFFSET(12756, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI), - NAME_FUNC_OFFSET(12778, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI), - NAME_FUNC_OFFSET(12800, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI), - NAME_FUNC_OFFSET(12822, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI), - NAME_FUNC_OFFSET(12848, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI), - NAME_FUNC_OFFSET(12871, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI), - NAME_FUNC_OFFSET(12895, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI), - NAME_FUNC_OFFSET(12913, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI), - NAME_FUNC_OFFSET(12928, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI), - NAME_FUNC_OFFSET(12959, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(12979, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(13000, gl_dispatch_stub_753, gl_dispatch_stub_753, NULL, _gloffset_ActiveStencilFaceEXT), - NAME_FUNC_OFFSET(13023, gl_dispatch_stub_754, gl_dispatch_stub_754, NULL, _gloffset_BindVertexArrayAPPLE), - NAME_FUNC_OFFSET(13046, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_DeleteVertexArraysAPPLE), - NAME_FUNC_OFFSET(13072, gl_dispatch_stub_756, gl_dispatch_stub_756, NULL, _gloffset_GenVertexArraysAPPLE), - NAME_FUNC_OFFSET(13095, gl_dispatch_stub_757, gl_dispatch_stub_757, NULL, _gloffset_IsVertexArrayAPPLE), - NAME_FUNC_OFFSET(13116, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV), - NAME_FUNC_OFFSET(13147, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV), - NAME_FUNC_OFFSET(13178, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV), - NAME_FUNC_OFFSET(13206, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV), - NAME_FUNC_OFFSET(13235, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV), - NAME_FUNC_OFFSET(13263, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV), - NAME_FUNC_OFFSET(13292, gl_dispatch_stub_764, gl_dispatch_stub_764, NULL, _gloffset_DepthBoundsEXT), - NAME_FUNC_OFFSET(13309, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(13336, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), - NAME_FUNC_OFFSET(13357, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), - NAME_FUNC_OFFSET(13379, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), - NAME_FUNC_OFFSET(13407, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), - NAME_FUNC_OFFSET(13431, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), - NAME_FUNC_OFFSET(13456, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), - NAME_FUNC_OFFSET(13485, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), - NAME_FUNC_OFFSET(13511, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), - NAME_FUNC_OFFSET(13537, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), - NAME_FUNC_OFFSET(13563, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), - NAME_FUNC_OFFSET(13584, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), - NAME_FUNC_OFFSET(13606, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), - NAME_FUNC_OFFSET(13626, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), - NAME_FUNC_OFFSET(13667, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), - NAME_FUNC_OFFSET(13699, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), - NAME_FUNC_OFFSET(13718, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), - NAME_FUNC_OFFSET(13738, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), - NAME_FUNC_OFFSET(13763, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(13784, gl_dispatch_stub_784, gl_dispatch_stub_784, NULL, _gloffset_BufferParameteriAPPLE), - NAME_FUNC_OFFSET(13808, gl_dispatch_stub_785, gl_dispatch_stub_785, NULL, _gloffset_FlushMappedBufferRangeAPPLE), - NAME_FUNC_OFFSET(13838, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), - NAME_FUNC_OFFSET(13867, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, _gloffset_ColorMaskIndexedEXT), - NAME_FUNC_OFFSET(13889, glDisableIndexedEXT, glDisableIndexedEXT, NULL, _gloffset_DisableIndexedEXT), - NAME_FUNC_OFFSET(13909, glEnableIndexedEXT, glEnableIndexedEXT, NULL, _gloffset_EnableIndexedEXT), - NAME_FUNC_OFFSET(13928, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, _gloffset_GetBooleanIndexedvEXT), - NAME_FUNC_OFFSET(13952, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, _gloffset_GetIntegerIndexedvEXT), - NAME_FUNC_OFFSET(13976, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, _gloffset_IsEnabledIndexedEXT), - NAME_FUNC_OFFSET(13998, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, _gloffset_BeginConditionalRenderNV), - NAME_FUNC_OFFSET(14025, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, _gloffset_EndConditionalRenderNV), - NAME_FUNC_OFFSET(14050, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), - NAME_FUNC_OFFSET(14071, gl_dispatch_stub_796, gl_dispatch_stub_796, NULL, _gloffset_GetTexParameterPointervAPPLE), - NAME_FUNC_OFFSET(14102, gl_dispatch_stub_797, gl_dispatch_stub_797, NULL, _gloffset_TextureRangeAPPLE), - NAME_FUNC_OFFSET(14122, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, _gloffset_GetObjectParameterivAPPLE), - NAME_FUNC_OFFSET(14150, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, _gloffset_ObjectPurgeableAPPLE), - NAME_FUNC_OFFSET(14173, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, _gloffset_ObjectUnpurgeableAPPLE), - NAME_FUNC_OFFSET(14198, gl_dispatch_stub_801, gl_dispatch_stub_801, NULL, _gloffset_StencilFuncSeparateATI), - NAME_FUNC_OFFSET(14223, gl_dispatch_stub_802, gl_dispatch_stub_802, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(14252, gl_dispatch_stub_803, gl_dispatch_stub_803, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(14283, gl_dispatch_stub_804, gl_dispatch_stub_804, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(14307, gl_dispatch_stub_805, gl_dispatch_stub_805, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(14332, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, _gloffset_EGLImageTargetRenderbufferStorageOES), - NAME_FUNC_OFFSET(14371, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, _gloffset_EGLImageTargetTexture2DOES), - NAME_FUNC_OFFSET(14400, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(14418, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(14435, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(14451, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(14476, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(14496, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(14516, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(14539, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(14562, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(14582, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(14599, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(14616, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(14631, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(14655, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(14674, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(14693, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(14709, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(14728, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(14751, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14767, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14783, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(14810, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(14837, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(14857, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14876, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14895, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14925, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14955, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14985, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(15015, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(15034, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(15057, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(15082, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(15107, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(15134, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(15162, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(15189, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(15217, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(15246, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(15275, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(15301, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(15332, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(15363, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(15387, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(15410, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(15428, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(15457, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(15486, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(15501, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(15527, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(15553, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(15568, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(15580, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(15600, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(15617, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(15633, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(15652, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(15675, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(15691, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(15713, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(15731, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(15750, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(15768, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(15787, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(15805, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(15824, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(15842, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(15861, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(15879, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(15898, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(15916, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(15935, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(15953, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(15972, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(15990, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(16009, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(16027, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(16046, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(16064, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(16083, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(16101, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(16120, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(16138, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(16157, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(16175, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(16194, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(16212, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(16231, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(16249, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(16268, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(16286, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), - NAME_FUNC_OFFSET(16305, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), - NAME_FUNC_OFFSET(16328, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), - NAME_FUNC_OFFSET(16351, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), - NAME_FUNC_OFFSET(16374, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), - NAME_FUNC_OFFSET(16397, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), - NAME_FUNC_OFFSET(16420, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), - NAME_FUNC_OFFSET(16437, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), - NAME_FUNC_OFFSET(16460, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), - NAME_FUNC_OFFSET(16483, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), - NAME_FUNC_OFFSET(16506, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), - NAME_FUNC_OFFSET(16532, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), - NAME_FUNC_OFFSET(16558, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), - NAME_FUNC_OFFSET(16584, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), - NAME_FUNC_OFFSET(16608, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), - NAME_FUNC_OFFSET(16635, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), - NAME_FUNC_OFFSET(16661, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), - NAME_FUNC_OFFSET(16681, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), - NAME_FUNC_OFFSET(16701, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), - NAME_FUNC_OFFSET(16721, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), - NAME_FUNC_OFFSET(16744, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), - NAME_FUNC_OFFSET(16768, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), - NAME_FUNC_OFFSET(16791, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), - NAME_FUNC_OFFSET(16815, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), - NAME_FUNC_OFFSET(16832, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), - NAME_FUNC_OFFSET(16850, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), - NAME_FUNC_OFFSET(16867, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), - NAME_FUNC_OFFSET(16885, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), - NAME_FUNC_OFFSET(16902, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), - NAME_FUNC_OFFSET(16920, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), - NAME_FUNC_OFFSET(16937, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), - NAME_FUNC_OFFSET(16955, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), - NAME_FUNC_OFFSET(16972, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), - NAME_FUNC_OFFSET(16990, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), - NAME_FUNC_OFFSET(17007, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), - NAME_FUNC_OFFSET(17025, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), - NAME_FUNC_OFFSET(17042, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), - NAME_FUNC_OFFSET(17060, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), - NAME_FUNC_OFFSET(17077, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), - NAME_FUNC_OFFSET(17095, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), - NAME_FUNC_OFFSET(17112, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), - NAME_FUNC_OFFSET(17130, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), - NAME_FUNC_OFFSET(17149, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), - NAME_FUNC_OFFSET(17168, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), - NAME_FUNC_OFFSET(17187, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), - NAME_FUNC_OFFSET(17206, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), - NAME_FUNC_OFFSET(17226, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), - NAME_FUNC_OFFSET(17246, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(17266, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), - NAME_FUNC_OFFSET(17284, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(17301, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(17319, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(17336, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(17354, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), - NAME_FUNC_OFFSET(17372, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(17389, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(17407, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), - NAME_FUNC_OFFSET(17426, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), - NAME_FUNC_OFFSET(17445, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), - NAME_FUNC_OFFSET(17464, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(17486, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(17499, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(17512, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(17528, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(17544, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(17557, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(17580, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(17600, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(17619, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(17630, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(17642, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(17656, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(17669, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(17685, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(17696, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(17709, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(17728, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(17748, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(17761, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(17771, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(17787, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(17806, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(17824, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(17845, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(17860, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(17875, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(17889, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(17904, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(17916, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(17929, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(17941, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(17954, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(17966, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(17979, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(17991, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(18004, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(18016, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(18029, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(18041, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(18054, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(18066, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(18079, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(18091, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(18104, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(18123, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(18142, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(18161, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(18174, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(18192, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(18213, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(18231, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(18251, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(18265, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(18282, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample), - NAME_FUNC_OFFSET(18318, gl_dispatch_stub_584, gl_dispatch_stub_584, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(18334, gl_dispatch_stub_585, gl_dispatch_stub_585, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(18353, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(18371, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(18392, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(18414, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(18433, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(18455, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(18478, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(18497, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(18517, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(18536, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(18556, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(18575, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(18595, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(18614, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(18634, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(18653, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(18673, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(18693, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(18714, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(18734, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(18755, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(18775, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(18796, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(18820, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(18838, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(18858, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(18876, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(18888, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(18901, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(18913, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(18926, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18946, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18970, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18984, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(19001, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(19016, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(19034, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(19048, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(19065, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(19080, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(19098, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(19112, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(19129, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(19144, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(19162, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(19176, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(19193, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(19208, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(19226, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(19240, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(19257, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(19272, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(19290, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(19304, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(19321, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(19336, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(19354, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(19368, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(19385, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(19400, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(19418, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(19432, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(19449, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(19464, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(19482, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(19499, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(19519, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(19536, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(19562, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(19591, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(19606, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(19624, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(19643, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_DeleteVertexArraysAPPLE), - NAME_FUNC_OFFSET(19664, gl_dispatch_stub_757, gl_dispatch_stub_757, NULL, _gloffset_IsVertexArrayAPPLE), - NAME_FUNC_OFFSET(19680, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(19704, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(19731, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), - NAME_FUNC_OFFSET(19749, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), - NAME_FUNC_OFFSET(19768, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), - NAME_FUNC_OFFSET(19793, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), - NAME_FUNC_OFFSET(19814, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), - NAME_FUNC_OFFSET(19836, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), - NAME_FUNC_OFFSET(19862, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), - NAME_FUNC_OFFSET(19885, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), - NAME_FUNC_OFFSET(19908, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), - NAME_FUNC_OFFSET(19931, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), - NAME_FUNC_OFFSET(19949, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), - NAME_FUNC_OFFSET(19968, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), - NAME_FUNC_OFFSET(19985, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), - NAME_FUNC_OFFSET(20023, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), - NAME_FUNC_OFFSET(20052, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), - NAME_FUNC_OFFSET(20068, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), - NAME_FUNC_OFFSET(20085, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), - NAME_FUNC_OFFSET(20107, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(20125, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), - NAME_FUNC_OFFSET(20151, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), + NAME_FUNC_OFFSET( 6163, glDrawArraysInstanced, glDrawArraysInstanced, NULL, _gloffset_DrawArraysInstanced), + NAME_FUNC_OFFSET( 6185, glDrawElementsInstanced, glDrawElementsInstanced, NULL, _gloffset_DrawElementsInstanced), + NAME_FUNC_OFFSET( 6209, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), + NAME_FUNC_OFFSET( 6235, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), + NAME_FUNC_OFFSET( 6261, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), + NAME_FUNC_OFFSET( 6287, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), + NAME_FUNC_OFFSET( 6313, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), + NAME_FUNC_OFFSET( 6333, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), + NAME_FUNC_OFFSET( 6359, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), + NAME_FUNC_OFFSET( 6385, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), + NAME_FUNC_OFFSET( 6411, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), + NAME_FUNC_OFFSET( 6440, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), + NAME_FUNC_OFFSET( 6469, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), + NAME_FUNC_OFFSET( 6498, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), + NAME_FUNC_OFFSET( 6525, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), + NAME_FUNC_OFFSET( 6555, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), + NAME_FUNC_OFFSET( 6584, glGetProgramEnvParameterdvARB, glGetProgramEnvParameterdvARB, NULL, _gloffset_GetProgramEnvParameterdvARB), + NAME_FUNC_OFFSET( 6614, glGetProgramEnvParameterfvARB, glGetProgramEnvParameterfvARB, NULL, _gloffset_GetProgramEnvParameterfvARB), + NAME_FUNC_OFFSET( 6644, glGetProgramLocalParameterdvARB, glGetProgramLocalParameterdvARB, NULL, _gloffset_GetProgramLocalParameterdvARB), + NAME_FUNC_OFFSET( 6676, glGetProgramLocalParameterfvARB, glGetProgramLocalParameterfvARB, NULL, _gloffset_GetProgramLocalParameterfvARB), + NAME_FUNC_OFFSET( 6708, glGetProgramStringARB, glGetProgramStringARB, NULL, _gloffset_GetProgramStringARB), + NAME_FUNC_OFFSET( 6730, glGetProgramivARB, glGetProgramivARB, NULL, _gloffset_GetProgramivARB), + NAME_FUNC_OFFSET( 6748, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), + NAME_FUNC_OFFSET( 6771, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), + NAME_FUNC_OFFSET( 6794, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), + NAME_FUNC_OFFSET( 6817, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), + NAME_FUNC_OFFSET( 6844, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), + NAME_FUNC_OFFSET( 6872, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), + NAME_FUNC_OFFSET( 6899, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), + NAME_FUNC_OFFSET( 6927, glProgramLocalParameter4dARB, glProgramLocalParameter4dARB, NULL, _gloffset_ProgramLocalParameter4dARB), + NAME_FUNC_OFFSET( 6956, glProgramLocalParameter4dvARB, glProgramLocalParameter4dvARB, NULL, _gloffset_ProgramLocalParameter4dvARB), + NAME_FUNC_OFFSET( 6986, glProgramLocalParameter4fARB, glProgramLocalParameter4fARB, NULL, _gloffset_ProgramLocalParameter4fARB), + NAME_FUNC_OFFSET( 7015, glProgramLocalParameter4fvARB, glProgramLocalParameter4fvARB, NULL, _gloffset_ProgramLocalParameter4fvARB), + NAME_FUNC_OFFSET( 7045, glProgramStringARB, glProgramStringARB, NULL, _gloffset_ProgramStringARB), + NAME_FUNC_OFFSET( 7064, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), + NAME_FUNC_OFFSET( 7084, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), + NAME_FUNC_OFFSET( 7105, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), + NAME_FUNC_OFFSET( 7125, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), + NAME_FUNC_OFFSET( 7146, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), + NAME_FUNC_OFFSET( 7166, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), + NAME_FUNC_OFFSET( 7187, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), + NAME_FUNC_OFFSET( 7207, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), + NAME_FUNC_OFFSET( 7228, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), + NAME_FUNC_OFFSET( 7248, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), + NAME_FUNC_OFFSET( 7269, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), + NAME_FUNC_OFFSET( 7289, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), + NAME_FUNC_OFFSET( 7310, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), + NAME_FUNC_OFFSET( 7330, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), + NAME_FUNC_OFFSET( 7351, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), + NAME_FUNC_OFFSET( 7371, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), + NAME_FUNC_OFFSET( 7392, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), + NAME_FUNC_OFFSET( 7412, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), + NAME_FUNC_OFFSET( 7433, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), + NAME_FUNC_OFFSET( 7455, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), + NAME_FUNC_OFFSET( 7477, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), + NAME_FUNC_OFFSET( 7499, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), + NAME_FUNC_OFFSET( 7521, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), + NAME_FUNC_OFFSET( 7544, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), + NAME_FUNC_OFFSET( 7567, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), + NAME_FUNC_OFFSET( 7590, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET( 7611, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET( 7631, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET( 7652, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET( 7672, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET( 7693, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET( 7714, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET( 7734, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET( 7755, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET( 7777, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET( 7799, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET( 7821, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET( 7846, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET( 7862, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET( 7878, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET( 7897, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET( 7916, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET( 7932, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET( 7958, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET( 7981, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET( 8003, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET( 8017, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET( 8032, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET( 8049, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET( 8065, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET( 8084, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET( 8098, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET( 8114, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET( 8136, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET( 8159, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET( 8175, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET( 8188, glAttachObjectARB, glAttachObjectARB, NULL, _gloffset_AttachObjectARB), + NAME_FUNC_OFFSET( 8206, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET( 8225, glCreateProgramObjectARB, glCreateProgramObjectARB, NULL, _gloffset_CreateProgramObjectARB), + NAME_FUNC_OFFSET( 8250, glCreateShaderObjectARB, glCreateShaderObjectARB, NULL, _gloffset_CreateShaderObjectARB), + NAME_FUNC_OFFSET( 8274, glDeleteObjectARB, glDeleteObjectARB, NULL, _gloffset_DeleteObjectARB), + NAME_FUNC_OFFSET( 8292, glDetachObjectARB, glDetachObjectARB, NULL, _gloffset_DetachObjectARB), + NAME_FUNC_OFFSET( 8310, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET( 8332, glGetAttachedObjectsARB, glGetAttachedObjectsARB, NULL, _gloffset_GetAttachedObjectsARB), + NAME_FUNC_OFFSET( 8356, glGetHandleARB, glGetHandleARB, NULL, _gloffset_GetHandleARB), + NAME_FUNC_OFFSET( 8371, glGetInfoLogARB, glGetInfoLogARB, NULL, _gloffset_GetInfoLogARB), + NAME_FUNC_OFFSET( 8387, glGetObjectParameterfvARB, glGetObjectParameterfvARB, NULL, _gloffset_GetObjectParameterfvARB), + NAME_FUNC_OFFSET( 8413, glGetObjectParameterivARB, glGetObjectParameterivARB, NULL, _gloffset_GetObjectParameterivARB), + NAME_FUNC_OFFSET( 8439, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET( 8460, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET( 8484, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET( 8502, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET( 8520, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET( 8537, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET( 8555, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET( 8570, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET( 8586, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET( 8601, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET( 8617, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET( 8632, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET( 8648, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET( 8663, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET( 8679, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET( 8694, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET( 8710, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET( 8725, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET( 8741, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET( 8756, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET( 8772, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET( 8787, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET( 8803, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET( 8825, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET( 8847, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET( 8869, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET( 8891, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET( 8912, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET( 8936, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET( 8957, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET( 8980, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET( 8997, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample), + NAME_FUNC_OFFSET( 9030, glFramebufferTextureARB, glFramebufferTextureARB, NULL, _gloffset_FramebufferTextureARB), + NAME_FUNC_OFFSET( 9054, glFramebufferTextureFaceARB, glFramebufferTextureFaceARB, NULL, _gloffset_FramebufferTextureFaceARB), + NAME_FUNC_OFFSET( 9082, glProgramParameteriARB, glProgramParameteriARB, NULL, _gloffset_ProgramParameteriARB), + NAME_FUNC_OFFSET( 9105, glFlushMappedBufferRange, glFlushMappedBufferRange, NULL, _gloffset_FlushMappedBufferRange), + NAME_FUNC_OFFSET( 9130, glMapBufferRange, glMapBufferRange, NULL, _gloffset_MapBufferRange), + NAME_FUNC_OFFSET( 9147, glBindVertexArray, glBindVertexArray, NULL, _gloffset_BindVertexArray), + NAME_FUNC_OFFSET( 9165, glGenVertexArrays, glGenVertexArrays, NULL, _gloffset_GenVertexArrays), + NAME_FUNC_OFFSET( 9183, glCopyBufferSubData, glCopyBufferSubData, NULL, _gloffset_CopyBufferSubData), + NAME_FUNC_OFFSET( 9203, glClientWaitSync, glClientWaitSync, NULL, _gloffset_ClientWaitSync), + NAME_FUNC_OFFSET( 9220, glDeleteSync, glDeleteSync, NULL, _gloffset_DeleteSync), + NAME_FUNC_OFFSET( 9233, glFenceSync, glFenceSync, NULL, _gloffset_FenceSync), + NAME_FUNC_OFFSET( 9245, glGetInteger64v, glGetInteger64v, NULL, _gloffset_GetInteger64v), + NAME_FUNC_OFFSET( 9261, glGetSynciv, glGetSynciv, NULL, _gloffset_GetSynciv), + NAME_FUNC_OFFSET( 9273, glIsSync, glIsSync, NULL, _gloffset_IsSync), + NAME_FUNC_OFFSET( 9282, glWaitSync, glWaitSync, NULL, _gloffset_WaitSync), + NAME_FUNC_OFFSET( 9293, glDrawElementsBaseVertex, glDrawElementsBaseVertex, NULL, _gloffset_DrawElementsBaseVertex), + NAME_FUNC_OFFSET( 9318, glDrawRangeElementsBaseVertex, glDrawRangeElementsBaseVertex, NULL, _gloffset_DrawRangeElementsBaseVertex), + NAME_FUNC_OFFSET( 9348, glMultiDrawElementsBaseVertex, glMultiDrawElementsBaseVertex, NULL, _gloffset_MultiDrawElementsBaseVertex), + NAME_FUNC_OFFSET( 9378, glBindTransformFeedback, glBindTransformFeedback, NULL, _gloffset_BindTransformFeedback), + NAME_FUNC_OFFSET( 9402, glDeleteTransformFeedbacks, glDeleteTransformFeedbacks, NULL, _gloffset_DeleteTransformFeedbacks), + NAME_FUNC_OFFSET( 9429, glDrawTransformFeedback, glDrawTransformFeedback, NULL, _gloffset_DrawTransformFeedback), + NAME_FUNC_OFFSET( 9453, glGenTransformFeedbacks, glGenTransformFeedbacks, NULL, _gloffset_GenTransformFeedbacks), + NAME_FUNC_OFFSET( 9477, glIsTransformFeedback, glIsTransformFeedback, NULL, _gloffset_IsTransformFeedback), + NAME_FUNC_OFFSET( 9499, glPauseTransformFeedback, glPauseTransformFeedback, NULL, _gloffset_PauseTransformFeedback), + NAME_FUNC_OFFSET( 9524, glResumeTransformFeedback, glResumeTransformFeedback, NULL, _gloffset_ResumeTransformFeedback), + NAME_FUNC_OFFSET( 9550, glPolygonOffsetEXT, glPolygonOffsetEXT, NULL, _gloffset_PolygonOffsetEXT), + NAME_FUNC_OFFSET( 9569, gl_dispatch_stub_590, gl_dispatch_stub_590, NULL, _gloffset_GetPixelTexGenParameterfvSGIS), + NAME_FUNC_OFFSET( 9601, gl_dispatch_stub_591, gl_dispatch_stub_591, NULL, _gloffset_GetPixelTexGenParameterivSGIS), + NAME_FUNC_OFFSET( 9633, gl_dispatch_stub_592, gl_dispatch_stub_592, NULL, _gloffset_PixelTexGenParameterfSGIS), + NAME_FUNC_OFFSET( 9661, gl_dispatch_stub_593, gl_dispatch_stub_593, NULL, _gloffset_PixelTexGenParameterfvSGIS), + NAME_FUNC_OFFSET( 9690, gl_dispatch_stub_594, gl_dispatch_stub_594, NULL, _gloffset_PixelTexGenParameteriSGIS), + NAME_FUNC_OFFSET( 9718, gl_dispatch_stub_595, gl_dispatch_stub_595, NULL, _gloffset_PixelTexGenParameterivSGIS), + NAME_FUNC_OFFSET( 9747, gl_dispatch_stub_596, gl_dispatch_stub_596, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET( 9764, gl_dispatch_stub_597, gl_dispatch_stub_597, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET( 9784, glColorPointerEXT, glColorPointerEXT, NULL, _gloffset_ColorPointerEXT), + NAME_FUNC_OFFSET( 9802, glEdgeFlagPointerEXT, glEdgeFlagPointerEXT, NULL, _gloffset_EdgeFlagPointerEXT), + NAME_FUNC_OFFSET( 9823, glIndexPointerEXT, glIndexPointerEXT, NULL, _gloffset_IndexPointerEXT), + NAME_FUNC_OFFSET( 9841, glNormalPointerEXT, glNormalPointerEXT, NULL, _gloffset_NormalPointerEXT), + NAME_FUNC_OFFSET( 9860, glTexCoordPointerEXT, glTexCoordPointerEXT, NULL, _gloffset_TexCoordPointerEXT), + NAME_FUNC_OFFSET( 9881, glVertexPointerEXT, glVertexPointerEXT, NULL, _gloffset_VertexPointerEXT), + NAME_FUNC_OFFSET( 9900, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET( 9921, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET( 9943, glLockArraysEXT, glLockArraysEXT, NULL, _gloffset_LockArraysEXT), + NAME_FUNC_OFFSET( 9959, glUnlockArraysEXT, glUnlockArraysEXT, NULL, _gloffset_UnlockArraysEXT), + NAME_FUNC_OFFSET( 9977, gl_dispatch_stub_608, gl_dispatch_stub_608, NULL, _gloffset_CullParameterdvEXT), + NAME_FUNC_OFFSET( 9998, gl_dispatch_stub_609, gl_dispatch_stub_609, NULL, _gloffset_CullParameterfvEXT), + NAME_FUNC_OFFSET(10019, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(10041, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(10064, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(10086, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(10109, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(10131, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(10154, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(10176, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(10199, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(10221, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(10244, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(10267, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(10291, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(10314, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(10338, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(10361, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(10385, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(10412, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(10433, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(10456, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(10477, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(10492, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(10508, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(10523, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(10539, gl_dispatch_stub_634, gl_dispatch_stub_634, NULL, _gloffset_PixelTexGenSGIX), + NAME_FUNC_OFFSET(10557, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(10580, glFlushVertexArrayRangeNV, glFlushVertexArrayRangeNV, NULL, _gloffset_FlushVertexArrayRangeNV), + NAME_FUNC_OFFSET(10606, glVertexArrayRangeNV, glVertexArrayRangeNV, NULL, _gloffset_VertexArrayRangeNV), + NAME_FUNC_OFFSET(10627, glCombinerInputNV, glCombinerInputNV, NULL, _gloffset_CombinerInputNV), + NAME_FUNC_OFFSET(10645, glCombinerOutputNV, glCombinerOutputNV, NULL, _gloffset_CombinerOutputNV), + NAME_FUNC_OFFSET(10664, glCombinerParameterfNV, glCombinerParameterfNV, NULL, _gloffset_CombinerParameterfNV), + NAME_FUNC_OFFSET(10687, glCombinerParameterfvNV, glCombinerParameterfvNV, NULL, _gloffset_CombinerParameterfvNV), + NAME_FUNC_OFFSET(10711, glCombinerParameteriNV, glCombinerParameteriNV, NULL, _gloffset_CombinerParameteriNV), + NAME_FUNC_OFFSET(10734, glCombinerParameterivNV, glCombinerParameterivNV, NULL, _gloffset_CombinerParameterivNV), + NAME_FUNC_OFFSET(10758, glFinalCombinerInputNV, glFinalCombinerInputNV, NULL, _gloffset_FinalCombinerInputNV), + NAME_FUNC_OFFSET(10781, glGetCombinerInputParameterfvNV, glGetCombinerInputParameterfvNV, NULL, _gloffset_GetCombinerInputParameterfvNV), + NAME_FUNC_OFFSET(10813, glGetCombinerInputParameterivNV, glGetCombinerInputParameterivNV, NULL, _gloffset_GetCombinerInputParameterivNV), + NAME_FUNC_OFFSET(10845, glGetCombinerOutputParameterfvNV, glGetCombinerOutputParameterfvNV, NULL, _gloffset_GetCombinerOutputParameterfvNV), + NAME_FUNC_OFFSET(10878, glGetCombinerOutputParameterivNV, glGetCombinerOutputParameterivNV, NULL, _gloffset_GetCombinerOutputParameterivNV), + NAME_FUNC_OFFSET(10911, glGetFinalCombinerInputParameterfvNV, glGetFinalCombinerInputParameterfvNV, NULL, _gloffset_GetFinalCombinerInputParameterfvNV), + NAME_FUNC_OFFSET(10948, glGetFinalCombinerInputParameterivNV, glGetFinalCombinerInputParameterivNV, NULL, _gloffset_GetFinalCombinerInputParameterivNV), + NAME_FUNC_OFFSET(10985, glResizeBuffersMESA, glResizeBuffersMESA, NULL, _gloffset_ResizeBuffersMESA), + NAME_FUNC_OFFSET(11005, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(11023, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(11042, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(11060, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(11079, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(11097, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(11116, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(11134, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(11153, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(11171, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(11190, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(11208, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(11227, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(11245, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(11264, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(11282, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(11301, glWindowPos4dMESA, glWindowPos4dMESA, NULL, _gloffset_WindowPos4dMESA), + NAME_FUNC_OFFSET(11319, glWindowPos4dvMESA, glWindowPos4dvMESA, NULL, _gloffset_WindowPos4dvMESA), + NAME_FUNC_OFFSET(11338, glWindowPos4fMESA, glWindowPos4fMESA, NULL, _gloffset_WindowPos4fMESA), + NAME_FUNC_OFFSET(11356, glWindowPos4fvMESA, glWindowPos4fvMESA, NULL, _gloffset_WindowPos4fvMESA), + NAME_FUNC_OFFSET(11375, glWindowPos4iMESA, glWindowPos4iMESA, NULL, _gloffset_WindowPos4iMESA), + NAME_FUNC_OFFSET(11393, glWindowPos4ivMESA, glWindowPos4ivMESA, NULL, _gloffset_WindowPos4ivMESA), + NAME_FUNC_OFFSET(11412, glWindowPos4sMESA, glWindowPos4sMESA, NULL, _gloffset_WindowPos4sMESA), + NAME_FUNC_OFFSET(11430, glWindowPos4svMESA, glWindowPos4svMESA, NULL, _gloffset_WindowPos4svMESA), + NAME_FUNC_OFFSET(11449, gl_dispatch_stub_676, gl_dispatch_stub_676, NULL, _gloffset_MultiModeDrawArraysIBM), + NAME_FUNC_OFFSET(11474, gl_dispatch_stub_677, gl_dispatch_stub_677, NULL, _gloffset_MultiModeDrawElementsIBM), + NAME_FUNC_OFFSET(11501, gl_dispatch_stub_678, gl_dispatch_stub_678, NULL, _gloffset_DeleteFencesNV), + NAME_FUNC_OFFSET(11518, gl_dispatch_stub_679, gl_dispatch_stub_679, NULL, _gloffset_FinishFenceNV), + NAME_FUNC_OFFSET(11534, gl_dispatch_stub_680, gl_dispatch_stub_680, NULL, _gloffset_GenFencesNV), + NAME_FUNC_OFFSET(11548, gl_dispatch_stub_681, gl_dispatch_stub_681, NULL, _gloffset_GetFenceivNV), + NAME_FUNC_OFFSET(11563, gl_dispatch_stub_682, gl_dispatch_stub_682, NULL, _gloffset_IsFenceNV), + NAME_FUNC_OFFSET(11575, gl_dispatch_stub_683, gl_dispatch_stub_683, NULL, _gloffset_SetFenceNV), + NAME_FUNC_OFFSET(11588, gl_dispatch_stub_684, gl_dispatch_stub_684, NULL, _gloffset_TestFenceNV), + NAME_FUNC_OFFSET(11602, glAreProgramsResidentNV, glAreProgramsResidentNV, NULL, _gloffset_AreProgramsResidentNV), + NAME_FUNC_OFFSET(11626, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(11642, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(11661, glExecuteProgramNV, glExecuteProgramNV, NULL, _gloffset_ExecuteProgramNV), + NAME_FUNC_OFFSET(11680, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(11696, glGetProgramParameterdvNV, glGetProgramParameterdvNV, NULL, _gloffset_GetProgramParameterdvNV), + NAME_FUNC_OFFSET(11722, glGetProgramParameterfvNV, glGetProgramParameterfvNV, NULL, _gloffset_GetProgramParameterfvNV), + NAME_FUNC_OFFSET(11748, glGetProgramStringNV, glGetProgramStringNV, NULL, _gloffset_GetProgramStringNV), + NAME_FUNC_OFFSET(11769, glGetProgramivNV, glGetProgramivNV, NULL, _gloffset_GetProgramivNV), + NAME_FUNC_OFFSET(11786, glGetTrackMatrixivNV, glGetTrackMatrixivNV, NULL, _gloffset_GetTrackMatrixivNV), + NAME_FUNC_OFFSET(11807, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(11835, glGetVertexAttribdvNV, glGetVertexAttribdvNV, NULL, _gloffset_GetVertexAttribdvNV), + NAME_FUNC_OFFSET(11857, glGetVertexAttribfvNV, glGetVertexAttribfvNV, NULL, _gloffset_GetVertexAttribfvNV), + NAME_FUNC_OFFSET(11879, glGetVertexAttribivNV, glGetVertexAttribivNV, NULL, _gloffset_GetVertexAttribivNV), + NAME_FUNC_OFFSET(11901, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(11915, glLoadProgramNV, glLoadProgramNV, NULL, _gloffset_LoadProgramNV), + NAME_FUNC_OFFSET(11931, glProgramParameters4dvNV, glProgramParameters4dvNV, NULL, _gloffset_ProgramParameters4dvNV), + NAME_FUNC_OFFSET(11956, glProgramParameters4fvNV, glProgramParameters4fvNV, NULL, _gloffset_ProgramParameters4fvNV), + NAME_FUNC_OFFSET(11981, glRequestResidentProgramsNV, glRequestResidentProgramsNV, NULL, _gloffset_RequestResidentProgramsNV), + NAME_FUNC_OFFSET(12009, glTrackMatrixNV, glTrackMatrixNV, NULL, _gloffset_TrackMatrixNV), + NAME_FUNC_OFFSET(12025, glVertexAttrib1dNV, glVertexAttrib1dNV, NULL, _gloffset_VertexAttrib1dNV), + NAME_FUNC_OFFSET(12044, glVertexAttrib1dvNV, glVertexAttrib1dvNV, NULL, _gloffset_VertexAttrib1dvNV), + NAME_FUNC_OFFSET(12064, glVertexAttrib1fNV, glVertexAttrib1fNV, NULL, _gloffset_VertexAttrib1fNV), + NAME_FUNC_OFFSET(12083, glVertexAttrib1fvNV, glVertexAttrib1fvNV, NULL, _gloffset_VertexAttrib1fvNV), + NAME_FUNC_OFFSET(12103, glVertexAttrib1sNV, glVertexAttrib1sNV, NULL, _gloffset_VertexAttrib1sNV), + NAME_FUNC_OFFSET(12122, glVertexAttrib1svNV, glVertexAttrib1svNV, NULL, _gloffset_VertexAttrib1svNV), + NAME_FUNC_OFFSET(12142, glVertexAttrib2dNV, glVertexAttrib2dNV, NULL, _gloffset_VertexAttrib2dNV), + NAME_FUNC_OFFSET(12161, glVertexAttrib2dvNV, glVertexAttrib2dvNV, NULL, _gloffset_VertexAttrib2dvNV), + NAME_FUNC_OFFSET(12181, glVertexAttrib2fNV, glVertexAttrib2fNV, NULL, _gloffset_VertexAttrib2fNV), + NAME_FUNC_OFFSET(12200, glVertexAttrib2fvNV, glVertexAttrib2fvNV, NULL, _gloffset_VertexAttrib2fvNV), + NAME_FUNC_OFFSET(12220, glVertexAttrib2sNV, glVertexAttrib2sNV, NULL, _gloffset_VertexAttrib2sNV), + NAME_FUNC_OFFSET(12239, glVertexAttrib2svNV, glVertexAttrib2svNV, NULL, _gloffset_VertexAttrib2svNV), + NAME_FUNC_OFFSET(12259, glVertexAttrib3dNV, glVertexAttrib3dNV, NULL, _gloffset_VertexAttrib3dNV), + NAME_FUNC_OFFSET(12278, glVertexAttrib3dvNV, glVertexAttrib3dvNV, NULL, _gloffset_VertexAttrib3dvNV), + NAME_FUNC_OFFSET(12298, glVertexAttrib3fNV, glVertexAttrib3fNV, NULL, _gloffset_VertexAttrib3fNV), + NAME_FUNC_OFFSET(12317, glVertexAttrib3fvNV, glVertexAttrib3fvNV, NULL, _gloffset_VertexAttrib3fvNV), + NAME_FUNC_OFFSET(12337, glVertexAttrib3sNV, glVertexAttrib3sNV, NULL, _gloffset_VertexAttrib3sNV), + NAME_FUNC_OFFSET(12356, glVertexAttrib3svNV, glVertexAttrib3svNV, NULL, _gloffset_VertexAttrib3svNV), + NAME_FUNC_OFFSET(12376, glVertexAttrib4dNV, glVertexAttrib4dNV, NULL, _gloffset_VertexAttrib4dNV), + NAME_FUNC_OFFSET(12395, glVertexAttrib4dvNV, glVertexAttrib4dvNV, NULL, _gloffset_VertexAttrib4dvNV), + NAME_FUNC_OFFSET(12415, glVertexAttrib4fNV, glVertexAttrib4fNV, NULL, _gloffset_VertexAttrib4fNV), + NAME_FUNC_OFFSET(12434, glVertexAttrib4fvNV, glVertexAttrib4fvNV, NULL, _gloffset_VertexAttrib4fvNV), + NAME_FUNC_OFFSET(12454, glVertexAttrib4sNV, glVertexAttrib4sNV, NULL, _gloffset_VertexAttrib4sNV), + NAME_FUNC_OFFSET(12473, glVertexAttrib4svNV, glVertexAttrib4svNV, NULL, _gloffset_VertexAttrib4svNV), + NAME_FUNC_OFFSET(12493, glVertexAttrib4ubNV, glVertexAttrib4ubNV, NULL, _gloffset_VertexAttrib4ubNV), + NAME_FUNC_OFFSET(12513, glVertexAttrib4ubvNV, glVertexAttrib4ubvNV, NULL, _gloffset_VertexAttrib4ubvNV), + NAME_FUNC_OFFSET(12534, glVertexAttribPointerNV, glVertexAttribPointerNV, NULL, _gloffset_VertexAttribPointerNV), + NAME_FUNC_OFFSET(12558, glVertexAttribs1dvNV, glVertexAttribs1dvNV, NULL, _gloffset_VertexAttribs1dvNV), + NAME_FUNC_OFFSET(12579, glVertexAttribs1fvNV, glVertexAttribs1fvNV, NULL, _gloffset_VertexAttribs1fvNV), + NAME_FUNC_OFFSET(12600, glVertexAttribs1svNV, glVertexAttribs1svNV, NULL, _gloffset_VertexAttribs1svNV), + NAME_FUNC_OFFSET(12621, glVertexAttribs2dvNV, glVertexAttribs2dvNV, NULL, _gloffset_VertexAttribs2dvNV), + NAME_FUNC_OFFSET(12642, glVertexAttribs2fvNV, glVertexAttribs2fvNV, NULL, _gloffset_VertexAttribs2fvNV), + NAME_FUNC_OFFSET(12663, glVertexAttribs2svNV, glVertexAttribs2svNV, NULL, _gloffset_VertexAttribs2svNV), + NAME_FUNC_OFFSET(12684, glVertexAttribs3dvNV, glVertexAttribs3dvNV, NULL, _gloffset_VertexAttribs3dvNV), + NAME_FUNC_OFFSET(12705, glVertexAttribs3fvNV, glVertexAttribs3fvNV, NULL, _gloffset_VertexAttribs3fvNV), + NAME_FUNC_OFFSET(12726, glVertexAttribs3svNV, glVertexAttribs3svNV, NULL, _gloffset_VertexAttribs3svNV), + NAME_FUNC_OFFSET(12747, glVertexAttribs4dvNV, glVertexAttribs4dvNV, NULL, _gloffset_VertexAttribs4dvNV), + NAME_FUNC_OFFSET(12768, glVertexAttribs4fvNV, glVertexAttribs4fvNV, NULL, _gloffset_VertexAttribs4fvNV), + NAME_FUNC_OFFSET(12789, glVertexAttribs4svNV, glVertexAttribs4svNV, NULL, _gloffset_VertexAttribs4svNV), + NAME_FUNC_OFFSET(12810, glVertexAttribs4ubvNV, glVertexAttribs4ubvNV, NULL, _gloffset_VertexAttribs4ubvNV), + NAME_FUNC_OFFSET(12832, glGetTexBumpParameterfvATI, glGetTexBumpParameterfvATI, NULL, _gloffset_GetTexBumpParameterfvATI), + NAME_FUNC_OFFSET(12859, glGetTexBumpParameterivATI, glGetTexBumpParameterivATI, NULL, _gloffset_GetTexBumpParameterivATI), + NAME_FUNC_OFFSET(12886, glTexBumpParameterfvATI, glTexBumpParameterfvATI, NULL, _gloffset_TexBumpParameterfvATI), + NAME_FUNC_OFFSET(12910, glTexBumpParameterivATI, glTexBumpParameterivATI, NULL, _gloffset_TexBumpParameterivATI), + NAME_FUNC_OFFSET(12934, glAlphaFragmentOp1ATI, glAlphaFragmentOp1ATI, NULL, _gloffset_AlphaFragmentOp1ATI), + NAME_FUNC_OFFSET(12956, glAlphaFragmentOp2ATI, glAlphaFragmentOp2ATI, NULL, _gloffset_AlphaFragmentOp2ATI), + NAME_FUNC_OFFSET(12978, glAlphaFragmentOp3ATI, glAlphaFragmentOp3ATI, NULL, _gloffset_AlphaFragmentOp3ATI), + NAME_FUNC_OFFSET(13000, glBeginFragmentShaderATI, glBeginFragmentShaderATI, NULL, _gloffset_BeginFragmentShaderATI), + NAME_FUNC_OFFSET(13025, glBindFragmentShaderATI, glBindFragmentShaderATI, NULL, _gloffset_BindFragmentShaderATI), + NAME_FUNC_OFFSET(13049, glColorFragmentOp1ATI, glColorFragmentOp1ATI, NULL, _gloffset_ColorFragmentOp1ATI), + NAME_FUNC_OFFSET(13071, glColorFragmentOp2ATI, glColorFragmentOp2ATI, NULL, _gloffset_ColorFragmentOp2ATI), + NAME_FUNC_OFFSET(13093, glColorFragmentOp3ATI, glColorFragmentOp3ATI, NULL, _gloffset_ColorFragmentOp3ATI), + NAME_FUNC_OFFSET(13115, glDeleteFragmentShaderATI, glDeleteFragmentShaderATI, NULL, _gloffset_DeleteFragmentShaderATI), + NAME_FUNC_OFFSET(13141, glEndFragmentShaderATI, glEndFragmentShaderATI, NULL, _gloffset_EndFragmentShaderATI), + NAME_FUNC_OFFSET(13164, glGenFragmentShadersATI, glGenFragmentShadersATI, NULL, _gloffset_GenFragmentShadersATI), + NAME_FUNC_OFFSET(13188, glPassTexCoordATI, glPassTexCoordATI, NULL, _gloffset_PassTexCoordATI), + NAME_FUNC_OFFSET(13206, glSampleMapATI, glSampleMapATI, NULL, _gloffset_SampleMapATI), + NAME_FUNC_OFFSET(13221, glSetFragmentShaderConstantATI, glSetFragmentShaderConstantATI, NULL, _gloffset_SetFragmentShaderConstantATI), + NAME_FUNC_OFFSET(13252, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(13272, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(13293, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_ActiveStencilFaceEXT), + NAME_FUNC_OFFSET(13316, gl_dispatch_stub_766, gl_dispatch_stub_766, NULL, _gloffset_BindVertexArrayAPPLE), + NAME_FUNC_OFFSET(13339, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_DeleteVertexArraysAPPLE), + NAME_FUNC_OFFSET(13365, gl_dispatch_stub_768, gl_dispatch_stub_768, NULL, _gloffset_GenVertexArraysAPPLE), + NAME_FUNC_OFFSET(13388, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_IsVertexArrayAPPLE), + NAME_FUNC_OFFSET(13409, glGetProgramNamedParameterdvNV, glGetProgramNamedParameterdvNV, NULL, _gloffset_GetProgramNamedParameterdvNV), + NAME_FUNC_OFFSET(13440, glGetProgramNamedParameterfvNV, glGetProgramNamedParameterfvNV, NULL, _gloffset_GetProgramNamedParameterfvNV), + NAME_FUNC_OFFSET(13471, glProgramNamedParameter4dNV, glProgramNamedParameter4dNV, NULL, _gloffset_ProgramNamedParameter4dNV), + NAME_FUNC_OFFSET(13499, glProgramNamedParameter4dvNV, glProgramNamedParameter4dvNV, NULL, _gloffset_ProgramNamedParameter4dvNV), + NAME_FUNC_OFFSET(13528, glProgramNamedParameter4fNV, glProgramNamedParameter4fNV, NULL, _gloffset_ProgramNamedParameter4fNV), + NAME_FUNC_OFFSET(13556, glProgramNamedParameter4fvNV, glProgramNamedParameter4fvNV, NULL, _gloffset_ProgramNamedParameter4fvNV), + NAME_FUNC_OFFSET(13585, gl_dispatch_stub_776, gl_dispatch_stub_776, NULL, _gloffset_DepthBoundsEXT), + NAME_FUNC_OFFSET(13602, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(13629, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), + NAME_FUNC_OFFSET(13650, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), + NAME_FUNC_OFFSET(13672, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), + NAME_FUNC_OFFSET(13700, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), + NAME_FUNC_OFFSET(13724, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), + NAME_FUNC_OFFSET(13749, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), + NAME_FUNC_OFFSET(13778, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), + NAME_FUNC_OFFSET(13804, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), + NAME_FUNC_OFFSET(13830, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), + NAME_FUNC_OFFSET(13856, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), + NAME_FUNC_OFFSET(13877, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), + NAME_FUNC_OFFSET(13899, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), + NAME_FUNC_OFFSET(13919, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), + NAME_FUNC_OFFSET(13960, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), + NAME_FUNC_OFFSET(13992, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), + NAME_FUNC_OFFSET(14011, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), + NAME_FUNC_OFFSET(14031, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), + NAME_FUNC_OFFSET(14056, gl_dispatch_stub_795, gl_dispatch_stub_795, NULL, _gloffset_BlitFramebufferEXT), + NAME_FUNC_OFFSET(14077, gl_dispatch_stub_796, gl_dispatch_stub_796, NULL, _gloffset_BufferParameteriAPPLE), + NAME_FUNC_OFFSET(14101, gl_dispatch_stub_797, gl_dispatch_stub_797, NULL, _gloffset_FlushMappedBufferRangeAPPLE), + NAME_FUNC_OFFSET(14131, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET(14160, glColorMaskIndexedEXT, glColorMaskIndexedEXT, NULL, _gloffset_ColorMaskIndexedEXT), + NAME_FUNC_OFFSET(14182, glDisableIndexedEXT, glDisableIndexedEXT, NULL, _gloffset_DisableIndexedEXT), + NAME_FUNC_OFFSET(14202, glEnableIndexedEXT, glEnableIndexedEXT, NULL, _gloffset_EnableIndexedEXT), + NAME_FUNC_OFFSET(14221, glGetBooleanIndexedvEXT, glGetBooleanIndexedvEXT, NULL, _gloffset_GetBooleanIndexedvEXT), + NAME_FUNC_OFFSET(14245, glGetIntegerIndexedvEXT, glGetIntegerIndexedvEXT, NULL, _gloffset_GetIntegerIndexedvEXT), + NAME_FUNC_OFFSET(14269, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, _gloffset_IsEnabledIndexedEXT), + NAME_FUNC_OFFSET(14291, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, _gloffset_BeginConditionalRenderNV), + NAME_FUNC_OFFSET(14318, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, _gloffset_EndConditionalRenderNV), + NAME_FUNC_OFFSET(14343, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, _gloffset_BeginTransformFeedbackEXT), + NAME_FUNC_OFFSET(14371, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, _gloffset_BindBufferBaseEXT), + NAME_FUNC_OFFSET(14391, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, _gloffset_BindBufferOffsetEXT), + NAME_FUNC_OFFSET(14413, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, _gloffset_BindBufferRangeEXT), + NAME_FUNC_OFFSET(14434, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, _gloffset_EndTransformFeedbackEXT), + NAME_FUNC_OFFSET(14460, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, _gloffset_GetTransformFeedbackVaryingEXT), + NAME_FUNC_OFFSET(14493, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, _gloffset_TransformFeedbackVaryingsEXT), + NAME_FUNC_OFFSET(14524, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), + NAME_FUNC_OFFSET(14545, gl_dispatch_stub_815, gl_dispatch_stub_815, NULL, _gloffset_GetTexParameterPointervAPPLE), + NAME_FUNC_OFFSET(14576, gl_dispatch_stub_816, gl_dispatch_stub_816, NULL, _gloffset_TextureRangeAPPLE), + NAME_FUNC_OFFSET(14596, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, _gloffset_GetObjectParameterivAPPLE), + NAME_FUNC_OFFSET(14624, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, _gloffset_ObjectPurgeableAPPLE), + NAME_FUNC_OFFSET(14647, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, _gloffset_ObjectUnpurgeableAPPLE), + NAME_FUNC_OFFSET(14672, gl_dispatch_stub_820, gl_dispatch_stub_820, NULL, _gloffset_StencilFuncSeparateATI), + NAME_FUNC_OFFSET(14697, gl_dispatch_stub_821, gl_dispatch_stub_821, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(14726, gl_dispatch_stub_822, gl_dispatch_stub_822, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(14757, gl_dispatch_stub_823, gl_dispatch_stub_823, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(14781, gl_dispatch_stub_824, gl_dispatch_stub_824, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(14806, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, _gloffset_EGLImageTargetRenderbufferStorageOES), + NAME_FUNC_OFFSET(14845, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, _gloffset_EGLImageTargetTexture2DOES), + NAME_FUNC_OFFSET(14874, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(14892, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(14909, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(14925, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(14950, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(14970, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(14990, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(15013, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(15036, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(15056, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(15073, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(15090, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(15105, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(15129, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(15148, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(15167, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(15183, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(15202, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(15225, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(15241, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(15257, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(15284, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(15311, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(15331, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(15350, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(15369, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(15399, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(15429, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(15459, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(15489, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(15508, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(15531, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(15556, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(15581, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(15608, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(15636, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(15663, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(15691, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(15720, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(15749, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(15775, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(15806, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(15837, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(15861, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(15884, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(15902, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(15931, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(15960, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(15975, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(16001, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(16027, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(16042, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(16054, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(16074, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(16091, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(16107, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(16126, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(16149, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(16165, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(16187, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(16205, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(16224, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(16242, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(16261, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(16279, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(16298, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(16316, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(16335, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(16353, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(16372, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(16390, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(16409, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(16427, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(16446, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(16464, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(16483, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(16501, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(16520, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(16538, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(16557, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(16575, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(16594, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(16612, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(16631, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(16649, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(16668, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(16686, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(16705, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(16723, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(16742, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(16760, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(16779, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), + NAME_FUNC_OFFSET(16802, glDrawArraysInstanced, glDrawArraysInstanced, NULL, _gloffset_DrawArraysInstanced), + NAME_FUNC_OFFSET(16827, glDrawArraysInstanced, glDrawArraysInstanced, NULL, _gloffset_DrawArraysInstanced), + NAME_FUNC_OFFSET(16852, glDrawElementsInstanced, glDrawElementsInstanced, NULL, _gloffset_DrawElementsInstanced), + NAME_FUNC_OFFSET(16879, glDrawElementsInstanced, glDrawElementsInstanced, NULL, _gloffset_DrawElementsInstanced), + NAME_FUNC_OFFSET(16906, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), + NAME_FUNC_OFFSET(16929, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), + NAME_FUNC_OFFSET(16952, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), + NAME_FUNC_OFFSET(16975, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), + NAME_FUNC_OFFSET(16998, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), + NAME_FUNC_OFFSET(17015, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), + NAME_FUNC_OFFSET(17038, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), + NAME_FUNC_OFFSET(17061, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), + NAME_FUNC_OFFSET(17084, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), + NAME_FUNC_OFFSET(17110, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), + NAME_FUNC_OFFSET(17136, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), + NAME_FUNC_OFFSET(17162, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), + NAME_FUNC_OFFSET(17186, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), + NAME_FUNC_OFFSET(17213, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), + NAME_FUNC_OFFSET(17239, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), + NAME_FUNC_OFFSET(17259, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), + NAME_FUNC_OFFSET(17279, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), + NAME_FUNC_OFFSET(17299, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB), + NAME_FUNC_OFFSET(17322, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB), + NAME_FUNC_OFFSET(17346, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB), + NAME_FUNC_OFFSET(17369, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB), + NAME_FUNC_OFFSET(17393, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), + NAME_FUNC_OFFSET(17410, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), + NAME_FUNC_OFFSET(17428, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), + NAME_FUNC_OFFSET(17445, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), + NAME_FUNC_OFFSET(17463, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), + NAME_FUNC_OFFSET(17480, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), + NAME_FUNC_OFFSET(17498, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), + NAME_FUNC_OFFSET(17515, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), + NAME_FUNC_OFFSET(17533, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), + NAME_FUNC_OFFSET(17550, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), + NAME_FUNC_OFFSET(17568, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), + NAME_FUNC_OFFSET(17585, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), + NAME_FUNC_OFFSET(17603, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), + NAME_FUNC_OFFSET(17620, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), + NAME_FUNC_OFFSET(17638, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), + NAME_FUNC_OFFSET(17655, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), + NAME_FUNC_OFFSET(17673, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), + NAME_FUNC_OFFSET(17690, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), + NAME_FUNC_OFFSET(17708, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), + NAME_FUNC_OFFSET(17727, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), + NAME_FUNC_OFFSET(17746, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), + NAME_FUNC_OFFSET(17765, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), + NAME_FUNC_OFFSET(17784, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), + NAME_FUNC_OFFSET(17804, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), + NAME_FUNC_OFFSET(17824, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), + NAME_FUNC_OFFSET(17844, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(17862, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(17879, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(17897, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(17914, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(17932, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(17950, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(17967, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(17985, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(18004, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(18023, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(18042, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(18064, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(18077, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(18090, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(18106, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(18122, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(18135, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(18158, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(18178, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(18197, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(18208, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(18220, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(18234, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(18247, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(18263, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(18274, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(18287, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(18306, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(18326, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(18339, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(18349, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(18365, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(18384, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(18402, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(18423, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(18438, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(18453, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(18467, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(18482, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(18494, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(18507, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(18519, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(18532, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(18544, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(18557, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(18569, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(18582, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(18594, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(18607, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(18619, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(18632, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(18644, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(18657, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(18669, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(18682, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(18701, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(18720, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(18739, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(18752, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(18770, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(18791, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(18809, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(18829, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(18843, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(18860, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample), + NAME_FUNC_OFFSET(18896, gl_dispatch_stub_596, gl_dispatch_stub_596, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(18912, gl_dispatch_stub_597, gl_dispatch_stub_597, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(18931, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(18949, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(18970, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(18992, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(19011, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(19033, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(19056, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(19075, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(19095, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(19114, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(19134, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(19153, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(19173, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(19192, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(19212, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(19231, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(19251, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(19271, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(19292, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(19312, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(19333, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(19353, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(19374, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(19398, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(19416, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(19436, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(19454, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(19466, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(19479, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(19491, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(19504, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(19524, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(19548, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(19562, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(19579, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(19594, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(19612, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(19626, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(19643, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(19658, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(19676, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(19690, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(19707, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(19722, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(19740, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(19754, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(19771, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(19786, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(19804, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(19818, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(19835, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(19850, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(19868, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(19882, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(19899, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(19914, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(19932, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(19946, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(19963, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(19978, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(19996, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(20010, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(20027, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(20042, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(20060, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(20077, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(20097, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(20114, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(20140, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(20169, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(20184, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(20202, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(20221, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_DeleteVertexArraysAPPLE), + NAME_FUNC_OFFSET(20242, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_IsVertexArrayAPPLE), + NAME_FUNC_OFFSET(20258, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(20282, gl_dispatch_stub_777, gl_dispatch_stub_777, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(20309, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), + NAME_FUNC_OFFSET(20327, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), + NAME_FUNC_OFFSET(20346, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), + NAME_FUNC_OFFSET(20371, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), + NAME_FUNC_OFFSET(20392, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), + NAME_FUNC_OFFSET(20414, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), + NAME_FUNC_OFFSET(20440, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), + NAME_FUNC_OFFSET(20463, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), + NAME_FUNC_OFFSET(20486, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), + NAME_FUNC_OFFSET(20509, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), + NAME_FUNC_OFFSET(20527, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), + NAME_FUNC_OFFSET(20546, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), + NAME_FUNC_OFFSET(20563, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), + NAME_FUNC_OFFSET(20601, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), + NAME_FUNC_OFFSET(20630, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), + NAME_FUNC_OFFSET(20646, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), + NAME_FUNC_OFFSET(20663, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), + NAME_FUNC_OFFSET(20685, gl_dispatch_stub_795, gl_dispatch_stub_795, NULL, _gloffset_BlitFramebufferEXT), + NAME_FUNC_OFFSET(20703, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET(20729, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, _gloffset_BeginTransformFeedbackEXT), + NAME_FUNC_OFFSET(20754, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, _gloffset_BindBufferBaseEXT), + NAME_FUNC_OFFSET(20771, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, _gloffset_BindBufferRangeEXT), + NAME_FUNC_OFFSET(20789, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, _gloffset_EndTransformFeedbackEXT), + NAME_FUNC_OFFSET(20812, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, _gloffset_GetTransformFeedbackVaryingEXT), + NAME_FUNC_OFFSET(20842, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, _gloffset_TransformFeedbackVaryingsEXT), + NAME_FUNC_OFFSET(20870, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; diff --git a/mesalib/src/mapi/glapi/glthread.c b/mesalib/src/mapi/glapi/glthread.c index f365d17bd..239090ecf 100644 --- a/mesalib/src/mapi/glapi/glthread.c +++ b/mesalib/src/mapi/glapi/glthread.c @@ -1,263 +1,7 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.1 - * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +#include "glapi/glapi.h" - -/* - * XXX There's probably some work to do in order to make this file - * truly reusable outside of Mesa. First, the glheader.h include must go. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include "glapi/mesa.h" -#else -#include "main/compiler.h" -#endif - -#include "glapi/glthread.h" - - -/* - * This file should still compile even when THREADS is not defined. - * This is to make things easier to deal with on the makefile scene.. - */ -#ifdef THREADS -#include <errno.h> - -/* - * Error messages - */ -#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data" -#define GET_TSD_ERROR "_glthread_: failed to get thread specific data" -#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data" - - -/* - * Magic number to determine if a TSD object has been initialized. - * Kind of a hack but there doesn't appear to be a better cross-platform - * solution. - */ -#define INIT_MAGIC 0xff8adc98 - - - -/* - * POSIX Threads -- The best way to go if your platform supports them. - * Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly - * has them, and many of the free Unixes now have them. - * Be sure to use appropriate -mt or -D_REENTRANT type - * compile flags when building. - */ -#ifdef PTHREADS - -PUBLIC unsigned long -_glthread_GetID(void) -{ - return (unsigned long) pthread_self(); -} - - -void -_glthread_InitTSD(_glthread_TSD *tsd) -{ - if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) { - perror(INIT_TSD_ERROR); - exit(-1); - } - tsd->initMagic = INIT_MAGIC; -} - - -void * -_glthread_GetTSD(_glthread_TSD *tsd) -{ - if (tsd->initMagic != (int) INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - return pthread_getspecific(tsd->key); -} - - -void -_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) -{ - if (tsd->initMagic != (int) INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - if (pthread_setspecific(tsd->key, ptr) != 0) { - perror(SET_TSD_ERROR); - exit(-1); - } -} - -#endif /* PTHREADS */ - - - -/* - * Win32 Threads. The only available option for Windows 95/NT. - * Be sure that you compile using the Multithreaded runtime, otherwise - * bad things will happen. - */ -#ifdef WIN32_THREADS - -static void InsteadOf_exit(int nCode) -{ - DWORD dwErr = GetLastError(); -} - -PUBLIC unsigned long -_glthread_GetID(void) -{ - return GetCurrentThreadId(); -} - - -void -_glthread_InitTSD(_glthread_TSD *tsd) -{ - tsd->key = TlsAlloc(); - if (tsd->key == TLS_OUT_OF_INDEXES) { - perror(INIT_TSD_ERROR); - InsteadOf_exit(-1); - } - tsd->initMagic = INIT_MAGIC; -} - - -void -_glthread_DestroyTSD(_glthread_TSD *tsd) -{ - if (tsd->initMagic != INIT_MAGIC) { - return; - } - TlsFree(tsd->key); - tsd->initMagic = 0x0; -} - - -void * -_glthread_GetTSD(_glthread_TSD *tsd) -{ - if (tsd->initMagic != INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - return TlsGetValue(tsd->key); -} - - -void -_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) -{ - /* the following code assumes that the _glthread_TSD has been initialized - to zero at creation */ - if (tsd->initMagic != INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - if (TlsSetValue(tsd->key, ptr) == 0) { - perror(SET_TSD_ERROR); - InsteadOf_exit(-1); - } -} - -#endif /* WIN32_THREADS */ - -/* - * BeOS threads - */ -#ifdef BEOS_THREADS - -PUBLIC unsigned long +unsigned long _GLAPI_EXPORT _glthread_GetID(void) { - return (unsigned long) find_thread(NULL); + return u_thread_self(); } - -void -_glthread_InitTSD(_glthread_TSD *tsd) -{ - tsd->key = tls_allocate(); - tsd->initMagic = INIT_MAGIC; -} - -void * -_glthread_GetTSD(_glthread_TSD *tsd) -{ - if (tsd->initMagic != (int) INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - return tls_get(tsd->key); -} - -void -_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) -{ - if (tsd->initMagic != (int) INIT_MAGIC) { - _glthread_InitTSD(tsd); - } - tls_set(tsd->key, ptr); -} - -#endif /* BEOS_THREADS */ - - - -#else /* THREADS */ - - -/* - * no-op functions - */ - -PUBLIC unsigned long -_glthread_GetID(void) -{ - return 0; -} - - -void -_glthread_InitTSD(_glthread_TSD *tsd) -{ - (void) tsd; -} - - -void * -_glthread_GetTSD(_glthread_TSD *tsd) -{ - (void) tsd; - return NULL; -} - - -void -_glthread_SetTSD(_glthread_TSD *tsd, void *ptr) -{ - (void) tsd; - (void) ptr; -} - - -#endif /* THREADS */ diff --git a/mesalib/src/mapi/glapi/glthread.h b/mesalib/src/mapi/glapi/glthread.h index 4fe99284a..fc4ece7c3 100644 --- a/mesalib/src/mapi/glapi/glthread.h +++ b/mesalib/src/mapi/glapi/glthread.h @@ -1,255 +1,20 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/* - * Thread support for gl dispatch. - * - * Initial version by John Stone (j.stone@acm.org) (johns@cs.umr.edu) - * and Christoph Poliwoda (poliwoda@volumegraphics.com) - * Revised by Keith Whitwell - * Adapted for new gl dispatcher by Brian Paul - * - * - * - * DOCUMENTATION - * - * This thread module exports the following types: - * _glthread_TSD Thread-specific data area - * _glthread_Thread Thread datatype - * _glthread_Mutex Mutual exclusion lock - * - * Macros: - * _glthread_DECLARE_STATIC_MUTEX(name) Declare a non-local mutex - * _glthread_INIT_MUTEX(name) Initialize a mutex - * _glthread_LOCK_MUTEX(name) Lock a mutex - * _glthread_UNLOCK_MUTEX(name) Unlock a mutex - * - * Functions: - * _glthread_GetID(v) Get integer thread ID - * _glthread_InitTSD() Initialize thread-specific data - * _glthread_GetTSD() Get thread-specific data - * _glthread_SetTSD() Set thread-specific data - * - */ - -/* - * If this file is accidentally included by a non-threaded build, - * it should not cause the build to fail, or otherwise cause problems. - * In general, it should only be included when needed however. - */ - #ifndef GLTHREAD_H #define GLTHREAD_H +#include "mapi/u_thread.h" -#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS) -#ifndef THREADS -#define THREADS -#endif -#endif - - -/* - * POSIX threads. This should be your choice in the Unix world - * whenever possible. When building with POSIX threads, be sure - * to enable any compiler flags which will cause the MT-safe - * libc (if one exists) to be used when linking, as well as any - * header macros for MT-safe errno, etc. For Solaris, this is the -mt - * compiler flag. On Solaris with gcc, use -D_REENTRANT to enable - * proper compiling for MT-safe libc etc. - */ -#if defined(PTHREADS) -#include <pthread.h> /* POSIX threads headers */ - -typedef struct { - pthread_key_t key; - int initMagic; -} _glthread_TSD; - -typedef pthread_t _glthread_Thread; - -typedef pthread_mutex_t _glthread_Mutex; - -#define _glthread_DECLARE_STATIC_MUTEX(name) \ - static _glthread_Mutex name = PTHREAD_MUTEX_INITIALIZER - -#define _glthread_INIT_MUTEX(name) \ - pthread_mutex_init(&(name), NULL) - -#define _glthread_DESTROY_MUTEX(name) \ - pthread_mutex_destroy(&(name)) - -#define _glthread_LOCK_MUTEX(name) \ - (void) pthread_mutex_lock(&(name)) - -#define _glthread_UNLOCK_MUTEX(name) \ - (void) pthread_mutex_unlock(&(name)) - -#endif /* PTHREADS */ - - -/* - * Windows threads. Should work with Windows NT and 95. - * IMPORTANT: Link with multithreaded runtime library when THREADS are - * used! - */ -#ifdef WIN32_THREADS -#include <windows.h> - -typedef struct { - DWORD key; - int initMagic; -} _glthread_TSD; - -typedef HANDLE _glthread_Thread; - -typedef CRITICAL_SECTION _glthread_Mutex; - -#define _glthread_DECLARE_STATIC_MUTEX(name) \ - /* static */ _glthread_Mutex name = { 0, 0, 0, 0, 0, 0 } - -#define _glthread_INIT_MUTEX(name) \ - InitializeCriticalSection(&name) - -#define _glthread_DESTROY_MUTEX(name) \ - DeleteCriticalSection(&name) - -#define _glthread_LOCK_MUTEX(name) \ - EnterCriticalSection(&name) - -#define _glthread_UNLOCK_MUTEX(name) \ - LeaveCriticalSection(&name) - -#endif /* WIN32_THREADS */ - - -/* - * BeOS threads. R5.x required. - */ -#ifdef BEOS_THREADS - -/* Problem with OS.h and this file on haiku */ -#ifndef __HAIKU__ -#include <kernel/OS.h> -#endif - -#include <support/TLS.h> - -/* The only two typedefs required here - * this is cause of the OS.h problem - */ -#ifdef __HAIKU__ -typedef int32 thread_id; -typedef int32 sem_id; -#endif - -typedef struct { - int32 key; - int initMagic; -} _glthread_TSD; - -typedef thread_id _glthread_Thread; - -/* Use Benaphore, aka speeder semaphore */ -typedef struct { - int32 lock; - sem_id sem; -} benaphore; -typedef benaphore _glthread_Mutex; - -#define _glthread_DECLARE_STATIC_MUTEX(name) \ - static _glthread_Mutex name = { 0, 0 } - -#define _glthread_INIT_MUTEX(name) \ - name.sem = create_sem(0, #name"_benaphore"), \ - name.lock = 0 - -#define _glthread_DESTROY_MUTEX(name) \ - delete_sem(name.sem), \ - name.lock = 0 - -#define _glthread_LOCK_MUTEX(name) \ - if (name.sem == 0) \ - _glthread_INIT_MUTEX(name); \ - if (atomic_add(&(name.lock), 1) >= 1) \ - acquire_sem(name.sem) - -#define _glthread_UNLOCK_MUTEX(name) \ - if (atomic_add(&(name.lock), -1) > 1) \ - release_sem(name.sem) - -#endif /* BEOS_THREADS */ - - -/* - * THREADS not defined - */ -#ifndef THREADS - -typedef unsigned _glthread_TSD; - -typedef unsigned _glthread_Thread; - -typedef unsigned _glthread_Mutex; - -#define _glthread_DECLARE_STATIC_MUTEX(name) static _glthread_Mutex name = 0 - -#define _glthread_INIT_MUTEX(name) (void) name - -#define _glthread_DESTROY_MUTEX(name) (void) name - -#define _glthread_LOCK_MUTEX(name) (void) name - -#define _glthread_UNLOCK_MUTEX(name) (void) name - -#endif /* THREADS */ - - - -/* - * Platform independent thread specific data API. - */ - -extern unsigned long -_glthread_GetID(void); - - -extern void -_glthread_InitTSD(_glthread_TSD *); - - -extern void -_glthread_DestroyTSD(_glthread_TSD *); /* WIN32 only */ - - -extern void * -_glthread_GetTSD(_glthread_TSD *); - +#define _glthread_DECLARE_STATIC_MUTEX(name) u_mutex_declare_static(name) +#define _glthread_INIT_MUTEX(name) u_mutex_init(name) +#define _glthread_DESTROY_MUTEX(name) u_mutex_destroy(name) +#define _glthread_LOCK_MUTEX(name) u_mutex_lock(name) +#define _glthread_UNLOCK_MUTEX(name) u_mutex_unlock(name) -extern void -_glthread_SetTSD(_glthread_TSD *, void *); +#define _glthread_InitTSD(tsd) u_tsd_init(tsd); +#define _glthread_DestroyTSD(tsd) u_tsd_destroy(tsd); +#define _glthread_GetTSD(tsd) u_tsd_get(tsd); +#define _glthread_SetTSD(tsd, ptr) u_tsd_set(tsd, ptr); +typedef struct u_tsd _glthread_TSD; +typedef u_mutex _glthread_Mutex; -#endif /* THREADS_H */ +#endif /* GLTHREAD_H */ diff --git a/mesalib/src/mapi/glapi/sources.mak b/mesalib/src/mapi/glapi/sources.mak new file mode 100644 index 000000000..cdcfa36e5 --- /dev/null +++ b/mesalib/src/mapi/glapi/sources.mak @@ -0,0 +1,17 @@ +# src/mapi/glapi/sources.mak + +GLAPI_SOURCES = \ + glapi_dispatch.c \ + glapi_entrypoint.c \ + glapi_getproc.c \ + glapi_nop.c \ + glthread.c + +X86_API = \ + glapi_x86.S + +X86-64_API = \ + glapi_x86-64.S + +SPARC_API = \ + glapi_sparc.S diff --git a/mesalib/src/mapi/mapi/entry.c b/mesalib/src/mapi/mapi/entry.c new file mode 100644 index 000000000..fdf2a89c5 --- /dev/null +++ b/mesalib/src/mapi/mapi/entry.c @@ -0,0 +1,65 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#include "entry.h" + +#if defined(USE_X86_ASM) && defined(__GNUC__) +# ifdef GLX_USE_TLS +# include "entry_x86_tls.h" +# else +# include "entry_x86_tsd.h" +# endif +#elif defined(USE_X86_64_ASM) && defined(__GNUC__) && defined(GLX_USE_TLS) +# include "entry_x86-64_tls.h" +#else + +#include <stdlib.h> +#include "u_current.h" +#include "table.h" + +/* C version of the public entries */ +#define MAPI_TMP_PUBLIC_ENTRIES +#include "mapi_tmp.h" + +void +entry_patch_public(void) +{ +} + +mapi_func +entry_generate(int slot) +{ + return NULL; +} + +void +entry_patch(mapi_func entry, int slot) +{ +} + +#endif /* asm */ diff --git a/mesalib/src/mapi/mapi/entry.h b/mesalib/src/mapi/mapi/entry.h new file mode 100644 index 000000000..48ed3f9ec --- /dev/null +++ b/mesalib/src/mapi/mapi/entry.h @@ -0,0 +1,49 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#ifndef _ENTRY_H_ +#define _ENTRY_H_ + +#include "u_compiler.h" +#include "stub.h" + +/* declare public entries */ +#define MAPI_TMP_DEFINES +#define MAPI_TMP_PUBLIC_DECLARES +#include "mapi_tmp.h" + +void +entry_patch_public(void); + +mapi_func +entry_generate(int slot); + +void +entry_patch(mapi_func entry, int slot); + +#endif /* _ENTRY_H_ */ diff --git a/mesalib/src/mapi/mapi/entry_x86-64_tls.h b/mesalib/src/mapi/mapi/entry_x86-64_tls.h new file mode 100644 index 000000000..2fbe73b5b --- /dev/null +++ b/mesalib/src/mapi/mapi/entry_x86-64_tls.h @@ -0,0 +1,97 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#include <string.h> +#include "u_execmem.h" +#include "u_macros.h" + +__asm__(".text"); + +__asm__("x86_64_current_tls:\n\t" + "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t" + "ret"); + +#define STUB_ASM_ENTRY(func) \ + ".globl " func "\n" \ + ".type " func ", @function\n" \ + ".balign 32\n" \ + func ":" + +#define STUB_ASM_CODE(slot) \ + "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t" \ + "movq %fs:(%rax), %r11\n\t" \ + "jmp *(8 * " slot ")(%r11)" + +#define MAPI_TMP_STUB_ASM_GCC +#include "mapi_tmp.h" + +extern unsigned long +x86_64_current_tls(); + +void +entry_patch_public(void) +{ +} + +void +entry_patch(mapi_func entry, int slot) +{ + char *code = (char *) entry; + *((unsigned int *) (code + 12)) = slot * sizeof(mapi_func); +} + +mapi_func +entry_generate(int slot) +{ + const char code_templ[16] = { + /* movq %fs:0, %r11 */ + 0x64, 0x4c, 0x8b, 0x1c, 0x25, 0x00, 0x00, 0x00, 0x00, + /* jmp *0x1234(%r11) */ + 0x41, 0xff, 0xa3, 0x34, 0x12, 0x00, 0x00, + }; + unsigned long addr; + void *code; + mapi_func entry; + + addr = x86_64_current_tls(); + if ((addr >> 32) != 0xffffffff) + return NULL; + addr &= 0xffffffff; + + code = u_execmem_alloc(sizeof(code_templ)); + if (!code) + return NULL; + + memcpy(code, code_templ, sizeof(code_templ)); + + *((unsigned int *) (code + 5)) = addr; + entry = (mapi_func) code; + entry_patch(entry, slot); + + return entry; +} diff --git a/mesalib/src/mapi/mapi/entry_x86_tls.h b/mesalib/src/mapi/mapi/entry_x86_tls.h new file mode 100644 index 000000000..d4f7d98cf --- /dev/null +++ b/mesalib/src/mapi/mapi/entry_x86_tls.h @@ -0,0 +1,120 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#include <string.h> +#include "u_execmem.h" +#include "u_macros.h" + +__asm__(".text"); + +__asm__("x86_current_tls:\n\t" + "call 1f\n" + "1:\n\t" + "popl %eax\n\t" + "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" + "movl u_current_table_tls@GOTNTPOFF(%eax), %eax\n\t" + "ret"); + +#ifndef GLX_X86_READONLY_TEXT +__asm__(".section wtext, \"awx\", @progbits\n" + ".balign 16\n" + "x86_entry_start:"); +#endif /* GLX_X86_READONLY_TEXT */ + +#define STUB_ASM_ENTRY(func) \ + ".globl " func "\n" \ + ".type " func ", @function\n" \ + ".balign 16\n" \ + func ":" + +#define STUB_ASM_CODE(slot) \ + "call x86_current_tls\n\t" \ + "movl %gs:(%eax), %eax\n\t" \ + "jmp *(4 * " slot ")(%eax)" + +#define MAPI_TMP_STUB_ASM_GCC +#include "mapi_tmp.h" + +#ifndef GLX_X86_READONLY_TEXT +__asm__(".balign 16\n" + "x86_entry_end:"); +__asm__(".text"); +#endif /* GLX_X86_READONLY_TEXT */ + +extern unsigned long +x86_current_tls(); + +void +entry_patch_public(void) +{ +#ifndef GLX_X86_READONLY_TEXT + extern char x86_entry_start[]; + extern char x86_entry_end[]; + char patch[8] = { + 0x65, 0xa1, 0x00, 0x00, 0x00, 0x00, /* movl %gs:0x0, %eax */ + 0x90, 0x90 /* nop's */ + }; + char *entry; + + *((unsigned long *) (patch + 2)) = x86_current_tls(); + + for (entry = x86_entry_start; entry < x86_entry_end; entry += 16) + memcpy(entry, patch, sizeof(patch)); +#endif +} + +void +entry_patch(mapi_func entry, int slot) +{ + char *code = (char *) entry; + *((unsigned long *) (code + 8)) = slot * sizeof(mapi_func); +} + +mapi_func +entry_generate(int slot) +{ + const char code_templ[16] = { + 0x65, 0xa1, 0x00, 0x00, 0x00, 0x00, /* movl %gs:0x0, %eax */ + 0xff, 0xa0, 0x34, 0x12, 0x00, 0x00, /* jmp *0x1234(%eax) */ + 0x90, 0x90, 0x90, 0x90 /* nop's */ + }; + void *code; + mapi_func entry; + + code = u_execmem_alloc(sizeof(code_templ)); + if (!code) + return NULL; + + memcpy(code, code_templ, sizeof(code_templ)); + + *((unsigned long *) (code + 2)) = x86_current_tls(); + entry = (mapi_func) code; + entry_patch(entry, slot); + + return entry; +} diff --git a/mesalib/src/mapi/mapi/entry_x86_tsd.h b/mesalib/src/mapi/mapi/entry_x86_tsd.h new file mode 100644 index 000000000..f37c7473a --- /dev/null +++ b/mesalib/src/mapi/mapi/entry_x86_tsd.h @@ -0,0 +1,89 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#include <string.h> +#include "u_execmem.h" +#include "u_macros.h" + +#define X86_ENTRY_SIZE 32 + +__asm__(".text"); + +#define STUB_ASM_ENTRY(func) \ + ".globl " func "\n" \ + ".type " func ", @function\n" \ + ".balign 32\n" \ + func ":" + +#define STUB_ASM_CODE(slot) \ + "movl u_current_table, %eax\n\t" \ + "testl %eax, %eax\n\t" \ + "je 1f\n\t" \ + "jmp *(4 * " slot ")(%eax)\n" \ + "1:\n\t" \ + "call u_current_get_internal\n\t"\ + "jmp *(4 * " slot ")(%eax)" + +#define MAPI_TMP_STUB_ASM_GCC +#include "mapi_tmp.h" + +__asm__(".balign 32\n" + "x86_entry_end:"); + +void +entry_patch_public(void) +{ +} + +void +entry_patch(mapi_func entry, int slot) +{ + char *code = (char *) entry; + + *((unsigned long *) (code + 11)) = slot * sizeof(mapi_func); + *((unsigned long *) (code + 22)) = slot * sizeof(mapi_func); +} + +mapi_func +entry_generate(int slot) +{ + extern const char x86_entry_end[]; + const char *code_templ = x86_entry_end - X86_ENTRY_SIZE; + void *code; + mapi_func entry; + + code = u_execmem_alloc(X86_ENTRY_SIZE); + if (!code) + return NULL; + + memcpy(code, code_templ, X86_ENTRY_SIZE); + entry = (mapi_func) code; + entry_patch(entry, slot); + + return entry; +} diff --git a/mesalib/src/mapi/mapi/mapi.c b/mesalib/src/mapi/mapi/mapi.c new file mode 100644 index 000000000..2f1c3fff6 --- /dev/null +++ b/mesalib/src/mapi/mapi/mapi.c @@ -0,0 +1,191 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#include <stdlib.h> +#include <string.h> + +#include "u_current.h" +#include "u_thread.h" +#include "mapi.h" +#include "stub.h" +#include "table.h" + +/* dynamic stubs will run out before this array */ +#define MAPI_MAX_STUBS (sizeof(struct mapi_table) / sizeof(mapi_func)) +static const struct mapi_stub *mapi_stub_map[MAPI_MAX_STUBS]; +static int mapi_num_stubs; + +static const struct mapi_stub * +get_stub(const char *name, const struct mapi_stub *alias) +{ + const struct mapi_stub *stub; + + stub = stub_find_public(name); + if (!stub) { + struct mapi_stub *dyn = stub_find_dynamic(name, 1); + if (dyn) { + stub_fix_dynamic(dyn, alias); + stub = dyn; + } + } + + return stub; +} + +/** + * Initialize mapi. spec consists of NULL-separated strings. The first string + * denotes the version. It is followed by variable numbers of entries. Each + * entry can have multiple names. An empty name terminates an entry. An empty + * entry terminates the spec. A spec of two entries, Foo and Bar, is as + * follows + * + * "1\0" + * "Foo\0" + * "FooEXT\0" + * "\0" + * "Bar\0" + * "\0" + */ +void +mapi_init(const char *spec) +{ + u_mutex_declare_static(mutex); + const char *p; + int ver, count; + + u_mutex_lock(mutex); + + /* already initialized */ + if (mapi_num_stubs) { + u_mutex_unlock(mutex); + return; + } + + count = 0; + p = spec; + + /* parse version string */ + ver = atoi(p); + if (ver != 1) { + u_mutex_unlock(mutex); + return; + } + p += strlen(p) + 1; + + while (*p) { + const struct mapi_stub *stub; + + stub = get_stub(p, NULL); + /* out of dynamic entries */ + if (!stub) + break; + p += strlen(p) + 1; + + while (*p) { + get_stub(p, stub); + p += strlen(p) + 1; + } + + mapi_stub_map[count++] = stub; + p++; + } + + mapi_num_stubs = count; + + u_mutex_unlock(mutex); +} + +/** + * Return the address of an entry. Optionally generate the entry if it does + * not exist. + */ +mapi_proc +mapi_get_proc_address(const char *name) +{ + const struct mapi_stub *stub; + + stub = stub_find_public(name); + if (!stub) + stub = stub_find_dynamic(name, 0); + + return (stub) ? (mapi_proc) stub->addr : NULL; +} + +/** + * Create a dispatch table. + */ +struct mapi_table * +mapi_table_create(void) +{ + const struct mapi_table *noop = table_get_noop(); + struct mapi_table *tbl; + + tbl = malloc(sizeof(*tbl)); + if (tbl) + memcpy(tbl, noop, sizeof(*tbl)); + + return tbl; +} + +/** + * Destroy a dispatch table. + */ +void +mapi_table_destroy(struct mapi_table *tbl) +{ + free(tbl); +} + +/** + * Fill a dispatch table. The order of the procs is determined when mapi_init + * is called. + */ +void +mapi_table_fill(struct mapi_table *tbl, const mapi_proc *procs) +{ + const struct mapi_table *noop = table_get_noop(); + int i; + + for (i = 0; i < mapi_num_stubs; i++) { + const struct mapi_stub *stub = mapi_stub_map[i]; + mapi_func func = (mapi_func) procs[i]; + + if (!func) + func = table_get_func(noop, stub); + table_set_func(tbl, stub, func); + } +} + +/** + * Make a dispatch table current. + */ +void +mapi_table_make_current(const struct mapi_table *tbl) +{ + u_current_set(tbl); +} diff --git a/mesalib/src/mapi/mapi/mapi.h b/mesalib/src/mapi/mapi/mapi.h new file mode 100644 index 000000000..c7e43e22e --- /dev/null +++ b/mesalib/src/mapi/mapi/mapi.h @@ -0,0 +1,66 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#ifndef _MAPI_H_ +#define _MAPI_H_ + +#include "u_compiler.h" + +#ifdef _WIN32 +#ifdef MAPI_DLL_EXPORTS +#define MAPI_EXPORT __declspec(dllexport) +#else +#define MAPI_EXPORT __declspec(dllimport) +#endif +#else /* _WIN32 */ +#define MAPI_EXPORT PUBLIC +#endif + +typedef void (*mapi_proc)(void); + +struct mapi_table; + +MAPI_EXPORT void +mapi_init(const char *spec); + +MAPI_EXPORT mapi_proc +mapi_get_proc_address(const char *name); + +MAPI_EXPORT struct mapi_table * +mapi_table_create(void); + +MAPI_EXPORT void +mapi_table_destroy(struct mapi_table *tbl); + +MAPI_EXPORT void +mapi_table_fill(struct mapi_table *tbl, const mapi_proc *procs); + +MAPI_EXPORT void +mapi_table_make_current(const struct mapi_table *tbl); + +#endif /* _MAPI_H_ */ diff --git a/mesalib/src/mapi/mapi/mapi_abi.py b/mesalib/src/mapi/mapi/mapi_abi.py new file mode 100644 index 000000000..440eb4bb9 --- /dev/null +++ b/mesalib/src/mapi/mapi/mapi_abi.py @@ -0,0 +1,402 @@ +#!/usr/bin/env python + +# Mesa 3-D graphics library +# Version: 7.9 +# +# Copyright (C) 2010 LunarG Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +# Authors: +# Chia-I Wu <olv@lunarg.com> + +import sys +import re +from optparse import OptionParser + +# number of dynamic entries +ABI_NUM_DYNAMIC_ENTRIES = 256 + +class ABIEntry(object): + """Represent an ABI entry.""" + + _match_c_param = re.compile( + '^(?P<type>[\w\s*]+?)(?P<name>\w+)(\[(?P<array>\d+)\])?$') + + def __init__(self, cols, attrs): + self._parse(cols) + + self.slot = attrs['slot'] + self.hidden = attrs['hidden'] + self.alias = attrs['alias'] + + def c_prototype(self): + return '%s %s(%s)' % (self.c_return(), self.name, self.c_params()) + + def c_return(self): + ret = self.ret + if not ret: + ret = 'void' + + return ret + + def c_params(self): + """Return the parameter list used in the entry prototype.""" + c_params = [] + for t, n, a in self.params: + sep = '' if t.endswith('*') else ' ' + arr = '[%d]' % a if a else '' + c_params.append(t + sep + n + arr) + if not c_params: + c_params.append('void') + + return ", ".join(c_params) + + def c_args(self): + """Return the argument list used in the entry invocation.""" + c_args = [] + for t, n, a in self.params: + c_args.append(n) + + return ", ".join(c_args) + + def _parse(self, cols): + ret = cols.pop(0) + if ret == 'void': + ret = None + + name = cols.pop(0) + + params = [] + if not cols: + raise Exception(cols) + elif len(cols) == 1 and cols[0] == 'void': + pass + else: + for val in cols: + params.append(self._parse_param(val)) + + self.ret = ret + self.name = name + self.params = params + + def _parse_param(self, c_param): + m = self._match_c_param.match(c_param) + if not m: + raise Exception('unrecognized param ' + c_param) + + c_type = m.group('type').strip() + c_name = m.group('name') + c_array = m.group('array') + c_array = int(c_array) if c_array else 0 + + return (c_type, c_name, c_array) + + def __str__(self): + return self.c_prototype() + + def __cmp__(self, other): + # compare slot, alias, and then name + res = cmp(self.slot, other.slot) + if not res: + if not self.alias: + res = -1 + elif not other.alias: + res = 1 + + if not res: + res = cmp(self.name, other.name) + + return res + +def abi_parse_line(line): + cols = [col.strip() for col in line.split(',')] + + attrs = { + 'slot': -1, + 'hidden': False, + 'alias': None, + } + + # extract attributes from the first column + vals = cols[0].split(':') + while len(vals) > 1: + val = vals.pop(0) + if val.startswith('slot='): + attrs['slot'] = int(val[5:]) + elif val == 'hidden': + attrs['hidden'] = True + elif val.startswith('alias='): + attrs['alias'] = val[6:] + elif not val: + pass + else: + raise Exception('unknown attribute %s' % val) + cols[0] = vals[0] + + return (attrs, cols) + +def abi_parse(filename): + """Parse a CSV file for ABI entries.""" + fp = open(filename) if filename != '-' else sys.stdin + lines = [line.strip() for line in fp.readlines() + if not line.startswith('#') and line.strip()] + + entry_dict = {} + next_slot = 0 + for line in lines: + attrs, cols = abi_parse_line(line) + + # post-process attributes + if attrs['alias']: + try: + ent = entry_dict[attrs['alias']] + slot = ent.slot + except KeyError: + raise Exception('failed to alias %s' % attrs['alias']) + else: + slot = next_slot + next_slot += 1 + + if attrs['slot'] < 0: + attrs['slot'] = slot + elif attrs['slot'] != slot: + raise Exception('invalid slot in %s' % (line)) + + ent = ABIEntry(cols, attrs) + if entry_dict.has_key(ent.name): + raise Exception('%s is duplicated' % (ent.name)) + entry_dict[ent.name] = ent + + entries = entry_dict.values() + entries.sort() + + # sanity check + i = 0 + for slot in xrange(next_slot): + if entries[i].slot != slot: + raise Exception('entries are not ordered by slots') + if entries[i].alias: + raise Exception('first entry of slot %d aliases %s' + % (slot, entries[i].alias)) + while i < len(entries) and entries[i].slot == slot: + i += 1 + if i < len(entries): + raise Exception('there are %d invalid entries' % (len(entries) - 1)) + + return entries + +def abi_dynamics(): + """Return the dynamic entries.""" + entries = [] + for i in xrange(ABI_NUM_DYNAMIC_ENTRIES): + cols = ['void', 'dynamic%d' % (i), 'void'] + attrs = { 'slot': -1, 'hidden': False, 'alias': None } + entries.append(ABIEntry(cols, attrs)) + return entries + +class ABIPrinter(object): + """ABIEntry Printer""" + + def __init__(self, entries, options): + self.entries = entries + self.options = options + self._undefs = [] + + def _add_undefs(self, undefs): + self._undefs.extend(undefs) + + def output_header(self): + print '/* This file is automatically generated. Do not modify. */' + print + + def output_footer(self): + print '/* clean up */' + for m in self._undefs: + print '#undef %s' % (m) + + def output_entry(self, ent): + if ent.slot < 0: + out_ent = 'MAPI_DYNAMIC_ENTRY(%s, %s, (%s))' % \ + (ent.c_return(), ent.name, ent.c_params()) + out_code = '' + else: + if ent.alias: + macro_ent = 'MAPI_ALIAS_ENTRY' + macro_code = 'MAPI_ALIAS_CODE' + else: + macro_ent = 'MAPI_ABI_ENTRY' + macro_code = 'MAPI_ABI_CODE' + + if ent.ret: + macro_code += '_RETURN' + if ent.hidden: + macro_ent += '_HIDDEN' + macro_code += '_HIDDEN' + + if ent.alias: + out_ent = '%s(%s, %s, %s, (%s))' % (macro_ent, + ent.alias, ent.c_return(), ent.name, ent.c_params()) + out_code = '%s(%s, %s, %s, (%s))' % (macro_code, + ent.alias, ent.c_return(), ent.name, ent.c_args()) + else: + out_ent = '%s(%s, %s, (%s))' % (macro_ent, + ent.c_return(), ent.name, ent.c_params()) + out_code = '%s(%s, %s, (%s))' % (macro_code, + ent.c_return(), ent.name, ent.c_args()) + + print out_ent + if out_code: + print ' ' + out_code + + def output_entries(self, pool_offsets): + defs = [ + # normal entries + ('MAPI_ABI_ENTRY', '(ret, name, params)', ''), + ('MAPI_ABI_CODE', '(ret, name, args)', ''), + ('MAPI_ABI_CODE_RETURN', '', 'MAPI_ABI_CODE'), + # alias entries + ('MAPI_ALIAS_ENTRY', '(alias, ret, name, params)', ''), + ('MAPI_ALIAS_CODE', '(alias, ret, name, args)', ''), + ('MAPI_ALIAS_CODE_RETURN', '', 'MAPI_ALIAS_CODE'), + # hidden normal entries + ('MAPI_ABI_ENTRY_HIDDEN', '', 'MAPI_ABI_ENTRY'), + ('MAPI_ABI_CODE_HIDDEN', '', 'MAPI_ABI_CODE'), + ('MAPI_ABI_CODE_RETURN_HIDDEN', '', 'MAPI_ABI_CODE_RETURN'), + # hidden alias entries + ('MAPI_ALIAS_ENTRY_HIDDEN', '', 'MAPI_ALIAS_ENTRY'), + ('MAPI_ALIAS_CODE_HIDDEN', '', 'MAPI_ALIAS_CODE'), + ('MAPI_ALIAS_CODE_RETURN_HIDDEN', '', 'MAPI_ALIAS_CODE_RETURN'), + # dynamic entries + ('MAPI_DYNAMIC_ENTRY', '(ret, name, params)', ''), + ] + undefs = [d[0] for d in defs] + + print '#if defined(MAPI_ABI_ENTRY) || defined(MAPI_ABI_ENTRY_HIDDEN)' + print + for d in defs: + print '#ifndef %s' % (d[0]) + if d[2]: + print '#define %s%s %s' % d + else: + print '#define %s%s' % d[:2] + + print '#endif' + print + + print '/* see MAPI_TMP_TABLE */' + for ent in self.entries: + print '#define MAPI_SLOT_%s %d' % (ent.name, ent.slot) + print + print '/* see MAPI_TMP_PUBLIC_STUBS */' + for ent in self.entries: + print '#define MAPI_POOL_%s %d' % (ent.name, pool_offsets[ent]) + print + + # define macros that generate code + for ent in self.entries: + self.output_entry(ent) + print + dynamics = abi_dynamics() + for ent in dynamics: + self.output_entry(ent) + print + + for ent in self.entries: + print '#undef MAPI_SLOT_%s' % (ent.name) + for ent in self.entries: + print '#undef MAPI_POOL_%s' % (ent.name) + print + print '#endif /* defined(MAPI_ABI_ENTRY) || defined(MAPI_ABI_ENTRY_HIDDEN) */' + print + + self._add_undefs(undefs) + + def _get_string_pool(self): + """Get the string pool.""" + pool = [] + offsets = {} + + count = 0 + for ent in self.entries: + offsets[ent] = count + pool.append(ent.name + '\\0') + count += len(ent.name) + 1 + + return (pool, offsets) + + def output_sorted_indices(self): + entry_index_pairs = [] + for i in xrange(len(self.entries)): + entry_index_pairs.append((self.entries[i], i)) + entry_index_pairs.sort(lambda x, y: cmp(x[0].name, y[0].name)) + + print '/* see MAPI_TMP_PUBLIC_STUBS */' + print '#ifdef MAPI_ABI_SORTED_INDICES' + print + print 'static const int MAPI_ABI_SORTED_INDICES[] = {' + for ent, idx in entry_index_pairs: + print ' %d, /* %s */' % (idx, ent.name) + print ' -1' + print '};' + print + print '#endif /* MAPI_ABI_SORTED_INDICES */' + print + + self._add_undefs(['MAPI_ABI_SORTED_INDICES']) + + def output_defines(self): + print '/* ABI defines */' + print '#ifdef MAPI_ABI_DEFINES' + print '#include "%s"' % (self.options.include) + print '#endif /* MAPI_ABI_DEFINES */' + print + + self._add_undefs(['MAPI_ABI_DEFINES']) + + def output(self): + pool, pool_offsets = self._get_string_pool() + + self.output_header() + self.output_defines() + self.output_entries(pool_offsets) + self.output_sorted_indices() + self.output_footer() + +def parse_args(): + parser = OptionParser(usage='usage: %prog [options] <filename>') + parser.add_option('-i', '--include', dest='include', + help='include the header for API defines') + + options, args = parser.parse_args() + if not args or not options.include: + parser.print_help() + sys.exit(1) + + return (args[0], options) + +def main(): + filename, options = parse_args() + + entries = abi_parse(filename) + printer = ABIPrinter(entries, options) + printer.output() + +if __name__ == '__main__': + main() diff --git a/mesalib/src/mapi/mapi/mapi_tmp.h b/mesalib/src/mapi/mapi/mapi_tmp.h new file mode 100644 index 000000000..79beca47d --- /dev/null +++ b/mesalib/src/mapi/mapi/mapi_tmp.h @@ -0,0 +1,211 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#include "u_macros.h" + +#ifndef MAPI_ABI_HEADER +#error "MAPI_ABI_HEADER must be defined" +#endif + + +/** + * Get API defines. + */ +#ifdef MAPI_TMP_DEFINES +# define MAPI_ABI_DEFINES +# include MAPI_ABI_HEADER + +#ifndef MAPI_ABI_PREFIX +#error "MAPI_ABI_PREFIX must be defined" +#endif +#ifndef MAPI_ABI_PUBLIC +#error "MAPI_ABI_PUBLIC must be defined" +#endif +#ifndef MAPI_ABI_ATTR +#error "MAPI_ABI_ATTR must be defined" +#endif + +#undef MAPI_TMP_DEFINES +#endif /* MAPI_TMP_DEFINES */ + + +/** + * Generate fields of struct mapi_table. + */ +#ifdef MAPI_TMP_TABLE +# define MAPI_ABI_ENTRY(ret, name, params) \ + ret (MAPI_ABI_ATTR *name) params; +# define MAPI_DYNAMIC_ENTRY(ret, name, params) \ + ret (MAPI_ABI_ATTR *name) params; +# include MAPI_ABI_HEADER +#undef MAPI_TMP_TABLE +#endif /* MAPI_TMP_TABLE */ + + +/** + * Declare public entries. + */ +#ifdef MAPI_TMP_PUBLIC_DECLARES +# define MAPI_ABI_ENTRY(ret, name, params) \ + MAPI_ABI_PUBLIC ret MAPI_ABI_ATTR U_CONCAT(MAPI_ABI_PREFIX, name) params; +# define MAPI_ALIAS_ENTRY(alias, ret, name, params) \ + MAPI_ABI_ENTRY(ret, name, params); +# define MAPI_ABI_ENTRY_HIDDEN(ret, name, params) \ + HIDDEN ret MAPI_ABI_ATTR U_CONCAT(MAPI_ABI_PREFIX, name) params; +# define MAPI_ALIAS_ENTRY_HIDDEN(alias, ret, name, params) \ + MAPI_ABI_ENTRY_HIDDEN(ret, name, params) +# include MAPI_ABI_HEADER +#undef MAPI_TMP_PUBLIC_DECLARES +#endif /* MAPI_TMP_PUBLIC_DECLARES */ + + +/** + * Generate string pool and public stubs. + */ +#ifdef MAPI_TMP_PUBLIC_STUBS +/* define the string pool */ +static const char public_string_pool[] = +# define MAPI_ABI_ENTRY(ret, name, params) \ + U_STRINGIFY(name) "\0" +# define MAPI_ALIAS_ENTRY(alias, ret, name, params) \ + MAPI_ABI_ENTRY(ret, name, params) +# include MAPI_ABI_HEADER + ; +/* define public_sorted_indices */ +# define MAPI_ABI_SORTED_INDICES public_sorted_indices +# include MAPI_ABI_HEADER + +/* define public_stubs */ +static const struct mapi_stub public_stubs[] = { +# define MAPI_ABI_ENTRY(ret, name, params) \ + { (mapi_func) U_CONCAT(MAPI_ABI_PREFIX, name), \ + MAPI_SLOT_ ## name, (void *) MAPI_POOL_ ## name }, +# define MAPI_ALIAS_ENTRY(alias, ret, name, params) \ + MAPI_ABI_ENTRY(ret, name, params) +# include MAPI_ABI_HEADER + { NULL, -1, (void *) -1 } +}; + +#undef MAPI_TMP_PUBLIC_STUBS +#endif /* MAPI_TMP_PUBLIC_STUBS */ + + +/** + * Generate public entries. + */ +#ifdef MAPI_TMP_PUBLIC_ENTRIES +# define MAPI_ABI_ENTRY(ret, name, params) \ + ret MAPI_ABI_ATTR U_CONCAT(MAPI_ABI_PREFIX, name) params +# define MAPI_ABI_CODE(ret, name, args) \ + { \ + const struct mapi_table *tbl = u_current_get(); \ + tbl->name args; \ + } +# define MAPI_ABI_CODE_RETURN(ret, name, args) \ + { \ + const struct mapi_table *tbl = u_current_get(); \ + return tbl->name args; \ + } +# define MAPI_ALIAS_ENTRY(alias, ret, name, params) \ + MAPI_ABI_ENTRY(ret, name, params) +# define MAPI_ALIAS_CODE(alias, ret, name, args) \ + MAPI_ABI_CODE(ret, alias, args) +# define MAPI_ALIAS_CODE_RETURN(alias, ret, name, args) \ + MAPI_ABI_CODE_RETURN(ret, alias, args) +# include MAPI_ABI_HEADER +#undef MAPI_TMP_PUBLIC_ENTRIES +#endif /* MAPI_TMP_PUBLIC_ENTRIES */ + + +/** + * Generate noop entries. + */ +#ifdef MAPI_TMP_NOOP_ARRAY +#ifdef DEBUG +# define MAPI_ABI_ENTRY(ret, name, params) \ + static ret MAPI_ABI_ATTR U_CONCAT(noop_, name) params +# define MAPI_ABI_CODE(ret, name, args) \ + { \ + noop_warn(U_CONCAT_STR(MAPI_ABI_PREFIX, name)); \ + } +# define MAPI_ABI_CODE_RETURN(ret, name, args) \ + { \ + noop_warn(U_CONCAT_STR(MAPI_ABI_PREFIX, name)); \ + return (ret) 0; \ + } +# include MAPI_ABI_HEADER + +/* define the noop function array that may be casted to mapi_table */ +const mapi_func table_noop_array[] = { +# define MAPI_ABI_ENTRY(ret, name, params) \ + (mapi_func) U_CONCAT(noop_, name), +# define MAPI_DYNAMIC_ENTRY(ret, name, params) \ + (mapi_func) noop_generic, +# include MAPI_ABI_HEADER + (mapi_func) noop_generic +}; + +#else /* DEBUG */ + +const mapi_func table_noop_array[] = { +# define MAPI_ABI_ENTRY(ret, name, params) \ + (mapi_func) noop_generic, +# define MAPI_DYNAMIC_ENTRY(ret, name, params) \ + (mapi_func) noop_generic, +# include MAPI_ABI_HEADER + (mapi_func) noop_generic +}; + +#endif /* DEBUG */ +#undef MAPI_TMP_NOOP_ARRAY +#endif /* MAPI_TMP_NOOP_ARRAY */ + + +#ifdef MAPI_TMP_STUB_ASM_GCC +# define STUB_ASM_ALIAS(func, to) \ + ".globl " func "\n" \ + ".set " func ", " to +# define STUB_ASM_HIDE(func) \ + ".hidden " func + +# define MAPI_ABI_ENTRY(ret, name, params) \ + __asm__(STUB_ASM_ENTRY(U_CONCAT_STR(MAPI_ABI_PREFIX, name))); +# define MAPI_ABI_CODE(ret, name, args) \ + __asm__(STUB_ASM_CODE(U_STRINGIFY(MAPI_SLOT_ ## name))); +# define MAPI_ALIAS_ENTRY(alias, ret, name, params) \ + __asm__(STUB_ASM_ALIAS(U_CONCAT_STR(MAPI_ABI_PREFIX, name), \ + U_CONCAT_STR(MAPI_ABI_PREFIX, alias))); +# define MAPI_ABI_ENTRY_HIDDEN(ret, name, params) \ + __asm__(STUB_ASM_HIDE(U_CONCAT_STR(MAPI_ABI_PREFIX, name))); \ + MAPI_ABI_ENTRY(ret, name, params); +# define MAPI_ALIAS_ENTRY_HIDDEN(alias, ret, name, params) \ + __asm__(STUB_ASM_HIDE(U_CONCAT_STR(MAPI_ABI_PREFIX, name))); \ + MAPI_ALIAS_ENTRY(alias, ret, name, params); +# include MAPI_ABI_HEADER +#undef MAPI_TMP_STUB_ASM_GCC +#endif /* MAPI_TMP_STUB_ASM_GCC */ diff --git a/mesalib/src/mapi/mapi/sources.mak b/mesalib/src/mapi/mapi/sources.mak new file mode 100644 index 000000000..5f327f3df --- /dev/null +++ b/mesalib/src/mapi/mapi/sources.mak @@ -0,0 +1,19 @@ +# src/mapi/mapi/sources.mak +# +# When MAPI_GLAPI_CURRENT is defined, MAPI_GLAPI_SOURCES can be built without +# MAPI_SOURCES and it is used by glapi. +# +# Otherwise, MAPI_ABI_HEADER must be defined. It should expand to the header +# generated by mapi_abi.py. + +MAPI_GLAPI_SOURCES = \ + u_current.c \ + u_execmem.c \ + u_thread.c + +MAPI_SOURCES = \ + entry.c \ + mapi.c \ + stub.c \ + table.c \ + $(MAPI_GLAPI_SOURCES) diff --git a/mesalib/src/mapi/mapi/stub.c b/mesalib/src/mapi/mapi/stub.c new file mode 100644 index 000000000..8ceaec313 --- /dev/null +++ b/mesalib/src/mapi/mapi/stub.c @@ -0,0 +1,180 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#include <stdlib.h> +#include <stddef.h> /* for offsetof */ +#include <string.h> +#include <assert.h> + +#include "u_current.h" +#include "u_thread.h" +#include "entry.h" +#include "stub.h" +#include "table.h" + +#define MAPI_TABLE_FIRST_DYNAMIC \ + (offsetof(struct mapi_table, dynamic0) / sizeof(mapi_func)) +#define MAPI_TABLE_NUM_DYNAMIC \ + ((offsetof(struct mapi_table, last) - \ + offsetof(struct mapi_table, dynamic0)) / sizeof(mapi_func)) +#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) + +/* + * This will define public_string_pool, public_sorted_indices, and + * public_stubs. + */ +#define MAPI_TMP_PUBLIC_STUBS +#include "mapi_tmp.h" + +static struct mapi_stub dynamic_stubs[MAPI_TABLE_NUM_DYNAMIC]; +static int num_dynamic_stubs; +static int next_dynamic_slot = MAPI_TABLE_FIRST_DYNAMIC; + +void +stub_init_once(void) +{ +#ifdef PTHREADS + static pthread_once_t once = PTHREAD_ONCE_INIT; + pthread_once(&once, entry_patch_public); +#else + static int first = 1; + if (first) { + first = 0; + entry_patch_public(); + } +#endif +} + +static int +stub_compare(const void *key, const void *elem) +{ + const char *name = (const char *) key; + const int *index = (const int *) elem; + const struct mapi_stub *stub; + const char *stub_name; + + stub = &public_stubs[*index]; + stub_name = &public_string_pool[(unsigned long) stub->name]; + + return strcmp(name, stub_name); +} + +/** + * Return the public stub with the given name. + */ +const struct mapi_stub * +stub_find_public(const char *name) +{ + const int *index; + + index = (const int *) bsearch(name, public_sorted_indices, + ARRAY_SIZE(public_sorted_indices) - 1, + sizeof(public_sorted_indices[0]), stub_compare); + + return (index) ? &public_stubs[*index] : NULL; +} + +/** + * Add a dynamic stub. + */ +static struct mapi_stub * +stub_add_dynamic(const char *name) +{ + struct mapi_stub *stub; + int idx; + + idx = num_dynamic_stubs; + if (idx >= MAPI_TABLE_NUM_DYNAMIC) + return NULL; + + stub = &dynamic_stubs[idx]; + + /* dispatch to mapi_table->last, which is always no-op */ + stub->addr = + entry_generate(MAPI_TABLE_FIRST_DYNAMIC + MAPI_TABLE_NUM_DYNAMIC); + if (!stub->addr) + return NULL; + + stub->name = (const void *) name; + /* to be fixed later */ + stub->slot = -1; + + num_dynamic_stubs = idx + 1; + + return stub; +} + +/** + * Return the dynamic stub with the given name. If no such stub exists and + * generate is true, a new stub is generated. + */ +struct mapi_stub * +stub_find_dynamic(const char *name, int generate) +{ + u_mutex_declare_static(dynamic_mutex); + struct mapi_stub *stub = NULL; + int count, i; + + u_mutex_lock(dynamic_mutex); + + if (generate) + assert(!stub_find_public(name)); + + count = num_dynamic_stubs; + for (i = 0; i < count; i++) { + if (strcmp(name, (const char *) dynamic_stubs[i].name) == 0) { + stub = &dynamic_stubs[i]; + break; + } + } + + /* generate a dynamic stub */ + if (generate && !stub) + stub = stub_add_dynamic(name); + + u_mutex_unlock(dynamic_mutex); + + return stub; +} + +void +stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias) +{ + int slot; + + if (stub->slot >= 0) + return; + + if (alias) + slot = alias->slot; + else + slot = next_dynamic_slot++; + + entry_patch(stub->addr, slot); + stub->slot = slot; +} diff --git a/mesalib/src/mapi/mapi/stub.h b/mesalib/src/mapi/mapi/stub.h new file mode 100644 index 000000000..c7e194cf4 --- /dev/null +++ b/mesalib/src/mapi/mapi/stub.h @@ -0,0 +1,52 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#ifndef _STUB_H_ +#define _STUB_H_ + +typedef void (*mapi_func)(void); + +struct mapi_stub { + mapi_func addr; + int slot; + const void *name; +}; + +void +stub_init_once(void); + +const struct mapi_stub * +stub_find_public(const char *name); + +struct mapi_stub * +stub_find_dynamic(const char *name, int generate); + +void +stub_fix_dynamic(struct mapi_stub *stub, const struct mapi_stub *alias); + +#endif /* _STUB_H_ */ diff --git a/mesalib/src/mapi/mapi/table.c b/mesalib/src/mapi/mapi/table.c new file mode 100644 index 000000000..8f4f700b9 --- /dev/null +++ b/mesalib/src/mapi/mapi/table.c @@ -0,0 +1,56 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#include <stdlib.h> +#include <stdio.h> + +#include "stub.h" +#include "table.h" + +static void +noop_warn(const char *name) +{ + static int debug = -1; + + if (debug < 0) + debug = (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")); + + if (debug) + fprintf(stderr, "%s is no-op", name); +} + +static int +noop_generic(void) +{ + noop_warn("function"); + return 0; +} + +/* define noop_array */ +#define MAPI_TMP_NOOP_ARRAY +#include "mapi_tmp.h" diff --git a/mesalib/src/mapi/mapi/table.h b/mesalib/src/mapi/mapi/table.h new file mode 100644 index 000000000..48c99018a --- /dev/null +++ b/mesalib/src/mapi/mapi/table.h @@ -0,0 +1,76 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + +#ifndef _TABLE_H_ +#define _TABLE_H_ + +#include "u_compiler.h" +#include "stub.h" + +#define MAPI_TMP_DEFINES +#include "mapi_tmp.h" + +struct mapi_table { +#define MAPI_TMP_TABLE +#include "mapi_tmp.h" + mapi_func last; +}; + +extern const mapi_func table_noop_array[]; + +/** + * Get the no-op dispatch table. + */ +static INLINE const struct mapi_table * +table_get_noop(void) +{ + return (const struct mapi_table *) table_noop_array; +} + +/** + * Update the dispatch table to dispatch a stub to the given function. + */ +static INLINE void +table_set_func(struct mapi_table *tbl, + const struct mapi_stub *stub, mapi_func func) +{ + mapi_func *funcs = (mapi_func *) tbl; + funcs[stub->slot] = func; +} + +/** + * Return the dispatched function of a stub. + */ +static INLINE mapi_func +table_get_func(const struct mapi_table *tbl, const struct mapi_stub *stub) +{ + const mapi_func *funcs = (const mapi_func *) tbl; + return funcs[stub->slot]; +} + +#endif /* _TABLE_H_ */ diff --git a/mesalib/src/mapi/mapi/u_compiler.h b/mesalib/src/mapi/mapi/u_compiler.h new file mode 100644 index 000000000..f1752d16f --- /dev/null +++ b/mesalib/src/mapi/mapi/u_compiler.h @@ -0,0 +1,48 @@ +#ifndef _U_COMPILER_H_ +#define _U_COMPILER_H_ + +/* Function inlining */ +#ifndef INLINE +# ifdef __cplusplus +# define INLINE inline +# elif defined(__GNUC__) +# define INLINE __inline__ +# elif defined(_MSC_VER) +# define INLINE __inline +# elif defined(__ICL) +# define INLINE __inline +# elif defined(__INTEL_COMPILER) +# define INLINE inline +# elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) +# define INLINE __inline +# elif defined(__SUNPRO_C) && defined(__C99FEATURES__) +# define INLINE inline +# elif (__STDC_VERSION__ >= 199901L) /* C99 */ +# define INLINE inline +# else +# define INLINE +# endif +#endif + +/* Function visibility */ +#ifndef PUBLIC +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define PUBLIC __attribute__((visibility("default"))) +# elif defined(_MSC_VER) +# define PUBLIC __declspec(dllexport) +# else +# define PUBLIC +# endif +#endif + +#ifndef likely +# if defined(__GNUC__) +# define likely(x) __builtin_expect(!!(x), 1) +# define unlikely(x) __builtin_expect(!!(x), 0) +# else +# define likely(x) (x) +# define unlikely(x) (x) +# endif +#endif + +#endif /* _U_COMPILER_H_ */ diff --git a/mesalib/src/mapi/glapi/glapi.c b/mesalib/src/mapi/mapi/u_current.c index b913dc254..ed9ccfe22 100644 --- a/mesalib/src/mapi/glapi/glapi.c +++ b/mesalib/src/mapi/mapi/u_current.c @@ -48,21 +48,23 @@ * drivers! No changes to the public glapi interface. */ +#include "u_current.h" +#include "u_thread.h" +#ifndef MAPI_GLAPI_CURRENT + +#include "table.h" +#include "stub.h" -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#include "glapi/mesa.h" #else -#include "main/glheader.h" -#include "main/compiler.h" -#endif -#include "glapi/glapi.h" -#include "glapi/glapitable.h" +extern void init_glapi_relocs_once(void); +extern void (*__glapi_noop_table[])(void); -extern _glapi_proc __glapi_noop_table[]; +#define table_noop_array __glapi_noop_table +#define stub_init_once() init_glapi_relocs_once() +#endif /** * \name Current dispatch and current context control variables @@ -97,57 +99,49 @@ extern _glapi_proc __glapi_noop_table[]; /*@{*/ #if defined(GLX_USE_TLS) -PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch +__thread struct mapi_table *u_current_table_tls __attribute__((tls_model("initial-exec"))) - = (struct _glapi_table *) __glapi_noop_table; + = (struct mapi_table *) table_noop_array; -PUBLIC __thread void * _glapi_tls_Context +__thread void *u_current_user_tls __attribute__((tls_model("initial-exec"))); -PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL; - -PUBLIC const void *_glapi_Context = NULL; +const struct mapi_table *u_current_table; +const void *u_current_user; #else -#if defined(THREADS) - -static GLboolean ThreadSafe = GL_FALSE; /**< In thread-safe mode? */ +struct mapi_table *u_current_table = + (struct mapi_table *) table_noop_array; +void *u_current_user; -_glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */ - -static _glthread_TSD ContextTSD; /**< Per-thread context pointer */ - -#endif /* defined(THREADS) */ - -#ifndef INSERVER -PUBLIC struct _glapi_table *_glapi_Dispatch = (struct _glapi_table *) __glapi_noop_table; - -PUBLIC void *_glapi_Context = NULL; -#endif +#ifdef THREADS +struct u_tsd u_current_table_tsd; +static struct u_tsd u_current_user_tsd; +static int ThreadSafe; +#endif /* THREADS */ #endif /* defined(GLX_USE_TLS) */ /*@}*/ - -#ifndef INSERVER -#if defined(THREADS) && !defined(GLX_USE_TLS) - void -_glapi_init_multithread(void) +u_current_destroy(void) { - _glthread_InitTSD(&_gl_DispatchTSD); - _glthread_InitTSD(&ContextTSD); +#if defined(THREADS) && defined(WIN32_THREADS) + u_tsd_destroy(&u_current_table_tsd); + u_tsd_destroy(&u_current_user_tsd); +#endif } -void -_glapi_destroy_multithread(void) + +#if defined(THREADS) && !defined(GLX_USE_TLS) + +static void +u_current_init_tsd(void) { -#ifdef WIN32_THREADS - _glthread_DestroyTSD(&_gl_DispatchTSD); - _glthread_DestroyTSD(&ContextTSD); -#endif + u_tsd_init(&u_current_table_tsd); + u_tsd_init(&u_current_user_tsd); } /** @@ -158,52 +152,48 @@ _glapi_destroy_multithread(void) #define CHECK_MULTITHREAD_LOCK() #define CHECK_MULTITHREAD_UNLOCK() #else -_glthread_DECLARE_STATIC_MUTEX(ThreadCheckMutex); -#define CHECK_MULTITHREAD_LOCK() _glthread_LOCK_MUTEX(ThreadCheckMutex) -#define CHECK_MULTITHREAD_UNLOCK() _glthread_UNLOCK_MUTEX(ThreadCheckMutex) +u_mutex_declare_static(ThreadCheckMutex); +#define CHECK_MULTITHREAD_LOCK() u_mutex_lock(ThreadCheckMutex) +#define CHECK_MULTITHREAD_UNLOCK() u_mutex_unlock(ThreadCheckMutex) #endif + /** * We should call this periodically from a function such as glXMakeCurrent * in order to test if multiple threads are being used. */ -PUBLIC void -_glapi_check_multithread(void) +void +u_current_init(void) { static unsigned long knownID; - static GLboolean firstCall = GL_TRUE; + static int firstCall = 1; if (ThreadSafe) return; CHECK_MULTITHREAD_LOCK(); if (firstCall) { - _glapi_init_multithread(); + u_current_init_tsd(); - knownID = _glthread_GetID(); - firstCall = GL_FALSE; + knownID = u_thread_self(); + firstCall = 0; } - else if (knownID != _glthread_GetID()) { - ThreadSafe = GL_TRUE; - _glapi_set_dispatch(NULL); - _glapi_set_context(NULL); + else if (knownID != u_thread_self()) { + ThreadSafe = 1; + u_current_set_internal(NULL); + u_current_set_user_internal(NULL); } CHECK_MULTITHREAD_UNLOCK(); } -#else -void -_glapi_init_multithread(void) { } +#else void -_glapi_destroy_multithread(void) { } - -PUBLIC void -_glapi_check_multithread(void) { } +u_current_init(void) +{ +} #endif -#endif /* INSERVER */ - /** @@ -211,128 +201,77 @@ _glapi_check_multithread(void) { } * The context pointer is an opaque type which should be cast to * void from the real context pointer type. */ -PUBLIC void -_glapi_set_context(void *context) +void +u_current_set_user_internal(void *ptr) { + u_current_init(); + #if defined(GLX_USE_TLS) - _glapi_tls_Context = context; + u_current_user_tls = ptr; #elif defined(THREADS) - _glthread_SetTSD(&ContextTSD, context); - _glapi_Context = (ThreadSafe) ? NULL : context; + u_tsd_set(&u_current_user_tsd, ptr); + u_current_user = (ThreadSafe) ? NULL : ptr; #else - _glapi_Context = context; + u_current_user = ptr; #endif } - - /** * Get the current context pointer for this thread. * The context pointer is an opaque type which should be cast from * void to the real context pointer type. */ -PUBLIC void * -_glapi_get_context(void) +void * +u_current_get_user_internal(void) { #if defined(GLX_USE_TLS) - return _glapi_tls_Context; + return u_current_user_tls; #elif defined(THREADS) - return (ThreadSafe) ? _glthread_GetTSD(&ContextTSD) : _glapi_Context; + return (ThreadSafe) + ? u_tsd_get(&u_current_user_tsd) + : u_current_user; #else - return _glapi_Context; + return u_current_user; #endif } - - /** * Set the global or per-thread dispatch table pointer. * If the dispatch parameter is NULL we'll plug in the no-op dispatch * table (__glapi_noop_table). */ -PUBLIC void -_glapi_set_dispatch(struct _glapi_table *dispatch) +void +u_current_set_internal(struct mapi_table *tbl) { - init_glapi_relocs_once(); + u_current_init(); - if (dispatch == NULL) { - /* use the no-op functions */ - dispatch = (struct _glapi_table *) __glapi_noop_table; - } -#ifdef DEBUG - else { - _glapi_check_table_not_null(dispatch); - _glapi_check_table(dispatch); - } -#endif + stub_init_once(); + + if (!tbl) + tbl = (struct mapi_table *) table_noop_array; #if defined(GLX_USE_TLS) - _glapi_tls_Dispatch = dispatch; + u_current_table_tls = tbl; #elif defined(THREADS) - _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch); - _glapi_Dispatch = (ThreadSafe) ? NULL : dispatch; + u_tsd_set(&u_current_table_tsd, (void *) tbl); + u_current_table = (ThreadSafe) ? NULL : tbl; #else - _glapi_Dispatch = dispatch; + u_current_table = tbl; #endif } - - /** * Return pointer to current dispatch table for calling thread. */ -PUBLIC struct _glapi_table * -_glapi_get_dispatch(void) +struct mapi_table * +u_current_get_internal(void) { #if defined(GLX_USE_TLS) - return _glapi_tls_Dispatch; + return u_current_table_tls; #elif defined(THREADS) - return (ThreadSafe) - ? (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD) - : _glapi_Dispatch; -#else - return _glapi_Dispatch; -#endif -} - - - - -/* - * The dispatch table size (number of entries) is the size of the - * _glapi_table struct plus the number of dynamic entries we can add. - * The extra slots can be filled in by DRI drivers that register new extension - * functions. - */ -#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS) - - -/** - * Return size of dispatch table struct as number of functions (or - * slots). - */ -PUBLIC GLuint -_glapi_get_dispatch_table_size(void) -{ - return DISPATCH_TABLE_SIZE; -} - - -/** - * Make sure there are no NULL pointers in the given dispatch table. - * Intended for debugging purposes. - */ -void -_glapi_check_table_not_null(const struct _glapi_table *table) -{ -#if 0 /* enable this for extra DEBUG */ - const GLuint entries = _glapi_get_dispatch_table_size(); - const void **tab = (const void **) table; - GLuint i; - for (i = 1; i < entries; i++) { - assert(tab[i]); - } + return (struct mapi_table *) ((ThreadSafe) ? + u_tsd_get(&u_current_table_tsd) : (void *) u_current_table); #else - (void) table; + return u_current_table; #endif } diff --git a/mesalib/src/mapi/mapi/u_current.h b/mesalib/src/mapi/mapi/u_current.h new file mode 100644 index 000000000..62e54c6c9 --- /dev/null +++ b/mesalib/src/mapi/mapi/u_current.h @@ -0,0 +1,102 @@ +#ifndef _U_CURRENT_H_ +#define _U_CURRENT_H_ + +#ifdef MAPI_GLAPI_CURRENT + +#include "glapi/glapi.h" + +/* ugly renames to match glapi.h */ +#define mapi_table _glapi_table + +#define u_current_table_tls _glapi_tls_Dispatch +#define u_current_user_tls _glapi_tls_Context +#define u_current_table _glapi_Dispatch +#define u_current_user _glapi_Context + +#define u_current_destroy _glapi_destroy_multithread +#define u_current_init _glapi_check_multithread +#define u_current_set_internal _glapi_set_dispatch +#define u_current_get_internal _glapi_get_dispatch +#define u_current_set_user_internal _glapi_set_context +#define u_current_get_user_internal _glapi_get_context + +#define u_current_table_tsd _gl_DispatchTSD + +#else /* MAPI_GLAPI_CURRENT */ + +#include "u_compiler.h" + +struct mapi_table; + +#ifdef GLX_USE_TLS + +extern __thread struct mapi_table *u_current_table_tls + __attribute__((tls_model("initial-exec"))); + +extern __thread void *u_current_user_tls + __attribute__((tls_model("initial-exec"))); + +extern const struct mapi_table *u_current_table; +extern const void *u_current_user; + +#else /* GLX_USE_TLS */ + +extern struct mapi_table *u_current_table; +extern void *u_current_user; + +#endif /* GLX_USE_TLS */ + +void +u_current_init(void); + +void +u_current_destroy(void); + +void +u_current_set_internal(struct mapi_table *tbl); + +struct mapi_table * +u_current_get_internal(void); + +void +u_current_set_user_internal(void *ptr); + +void * +u_current_get_user_internal(void); + +static INLINE void +u_current_set(const struct mapi_table *tbl) +{ + u_current_set_internal((struct mapi_table *) tbl); +} + +static INLINE const struct mapi_table * +u_current_get(void) +{ +#ifdef GLX_USE_TLS + return (const struct mapi_table *) u_current_table_tls; +#else + return (likely(u_current_table) ? + (const struct mapi_table *) u_current_table : u_current_get_internal()); +#endif +} + +static INLINE void +u_current_set_user(void *ptr) +{ + u_current_set_internal(ptr); +} + +static INLINE void * +u_current_get_user(void) +{ +#ifdef GLX_USE_TLS + return u_current_user_tls; +#else + return likely(u_current_user) ? u_current_user : u_current_get_user_internal(); +#endif +} + +#endif /* MAPI_GLAPI_CURRENT */ + +#endif /* _U_CURRENT_H_ */ diff --git a/mesalib/src/mapi/mapi/u_execmem.c b/mesalib/src/mapi/mapi/u_execmem.c new file mode 100644 index 000000000..e5072e06e --- /dev/null +++ b/mesalib/src/mapi/mapi/u_execmem.c @@ -0,0 +1,145 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file glapi_execmem.c + * + * Function for allocating executable memory for dispatch stubs. + * + * Copied from main/execmem.c and simplified for dispatch stubs. + */ + + +#include "u_compiler.h" +#include "u_thread.h" +#include "u_execmem.h" + + +#define EXEC_MAP_SIZE (4*1024) + +u_mutex_declare_static(exec_mutex); + +static unsigned int head = 0; + +static unsigned char *exec_mem = (unsigned char *)0; + + +#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) + +#include <unistd.h> +#include <sys/mman.h> + +#ifdef MESA_SELINUX +#include <selinux/selinux.h> +#endif + + +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + + +/* + * Dispatch stubs are of fixed size and never freed. Thus, we do not need to + * overlay a heap, we just mmap a page and manage through an index. + */ + +static int +init_map(void) +{ +#ifdef MESA_SELINUX + if (is_selinux_enabled()) { + if (!security_get_boolean_active("allow_execmem") || + !security_get_boolean_pending("allow_execmem")) + return 0; + } +#endif + + if (!exec_mem) + exec_mem = mmap(NULL, EXEC_MAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + + return (exec_mem != MAP_FAILED); +} + + +#elif defined(_WIN32) + +#include <windows.h> + + +/* + * Avoid Data Execution Prevention. + */ + +static int +init_map(void) +{ + exec_mem = VirtualAlloc(NULL, EXEC_MAP_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE); + + return (exec_mem != NULL); +} + + +#else + +#include <stdlib.h> + +static int +init_map(void) +{ + exec_mem = malloc(EXEC_MAP_SIZE); + + return (exec_mem != NULL); +} + + +#endif + +void * +u_execmem_alloc(unsigned int size) +{ + void *addr = NULL; + + u_mutex_lock(exec_mutex); + + if (!init_map()) + goto bail; + + /* free space check, assumes no integer overflow */ + if (head + size > EXEC_MAP_SIZE) + goto bail; + + /* allocation, assumes proper addr and size alignement */ + addr = exec_mem + head; + head += size; + +bail: + u_mutex_unlock(exec_mutex); + + return addr; +} + + diff --git a/mesalib/src/mapi/mapi/u_execmem.h b/mesalib/src/mapi/mapi/u_execmem.h new file mode 100644 index 000000000..13fff8df2 --- /dev/null +++ b/mesalib/src/mapi/mapi/u_execmem.h @@ -0,0 +1,7 @@ +#ifndef _U_EXECMEM_H_ +#define _U_EXECMEM_H_ + +void * +u_execmem_alloc(unsigned int size); + +#endif /* _U_EXECMEM_H_ */ diff --git a/mesalib/src/mapi/mapi/u_macros.h b/mesalib/src/mapi/mapi/u_macros.h new file mode 100644 index 000000000..72345b5f1 --- /dev/null +++ b/mesalib/src/mapi/mapi/u_macros.h @@ -0,0 +1,12 @@ +#ifndef _U_MACROS_ +#define _U_MACROS_ + +#define _U_STRINGIFY(x) #x +#define _U_CONCAT(x, y) x ## y +#define _U_CONCAT_STR(x, y) #x#y + +#define U_STRINGIFY(x) _U_STRINGIFY(x) +#define U_CONCAT(x, y) _U_CONCAT(x, y) +#define U_CONCAT_STR(x, y) _U_CONCAT_STR(x, y) + +#endif /* _U_MACROS_ */ diff --git a/mesalib/src/mapi/mapi/u_thread.c b/mesalib/src/mapi/mapi/u_thread.c new file mode 100644 index 000000000..e0fa64ae0 --- /dev/null +++ b/mesalib/src/mapi/mapi/u_thread.c @@ -0,0 +1,254 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5.1 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include <stdio.h> +#include <stdlib.h> +#include "u_compiler.h" +#include "u_thread.h" + + +/* + * This file should still compile even when THREADS is not defined. + * This is to make things easier to deal with on the makefile scene.. + */ +#ifdef THREADS +#include <errno.h> + +/* + * Error messages + */ +#define INIT_TSD_ERROR "_glthread_: failed to allocate key for thread specific data" +#define GET_TSD_ERROR "_glthread_: failed to get thread specific data" +#define SET_TSD_ERROR "_glthread_: thread failed to set thread specific data" + + +/* + * Magic number to determine if a TSD object has been initialized. + * Kind of a hack but there doesn't appear to be a better cross-platform + * solution. + */ +#define INIT_MAGIC 0xff8adc98 + + + +/* + * POSIX Threads -- The best way to go if your platform supports them. + * Solaris >= 2.5 have POSIX threads, IRIX >= 6.4 reportedly + * has them, and many of the free Unixes now have them. + * Be sure to use appropriate -mt or -D_REENTRANT type + * compile flags when building. + */ +#ifdef PTHREADS + +unsigned long +u_thread_self(void) +{ + return (unsigned long) pthread_self(); +} + + +void +u_tsd_init(struct u_tsd *tsd) +{ + if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) { + perror(INIT_TSD_ERROR); + exit(-1); + } + tsd->initMagic = INIT_MAGIC; +} + + +void * +u_tsd_get(struct u_tsd *tsd) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + u_tsd_init(tsd); + } + return pthread_getspecific(tsd->key); +} + + +void +u_tsd_set(struct u_tsd *tsd, void *ptr) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + u_tsd_init(tsd); + } + if (pthread_setspecific(tsd->key, ptr) != 0) { + perror(SET_TSD_ERROR); + exit(-1); + } +} + +#endif /* PTHREADS */ + + + +/* + * Win32 Threads. The only available option for Windows 95/NT. + * Be sure that you compile using the Multithreaded runtime, otherwise + * bad things will happen. + */ +#ifdef WIN32_THREADS + +static void InsteadOf_exit(int nCode) +{ + DWORD dwErr = GetLastError(); +} + +unsigned long +u_thread_self(void) +{ + return GetCurrentThreadId(); +} + + +void +u_tsd_init(struct u_tsd *tsd) +{ + tsd->key = TlsAlloc(); + if (tsd->key == TLS_OUT_OF_INDEXES) { + perror(INIT_TSD_ERROR); + InsteadOf_exit(-1); + } + tsd->initMagic = INIT_MAGIC; +} + + +void +u_tsd_destroy(struct u_tsd *tsd) +{ + if (tsd->initMagic != INIT_MAGIC) { + return; + } + TlsFree(tsd->key); + tsd->initMagic = 0x0; +} + + +void * +u_tsd_get(struct u_tsd *tsd) +{ + if (tsd->initMagic != INIT_MAGIC) { + u_tsd_init(tsd); + } + return TlsGetValue(tsd->key); +} + + +void +u_tsd_set(struct u_tsd *tsd, void *ptr) +{ + /* the following code assumes that the struct u_tsd has been initialized + to zero at creation */ + if (tsd->initMagic != INIT_MAGIC) { + u_tsd_init(tsd); + } + if (TlsSetValue(tsd->key, ptr) == 0) { + perror(SET_TSD_ERROR); + InsteadOf_exit(-1); + } +} + +#endif /* WIN32_THREADS */ + +/* + * BeOS threads + */ +#ifdef BEOS_THREADS + +unsigned long +u_thread_self(void) +{ + return (unsigned long) find_thread(NULL); +} + +void +u_tsd_init(struct u_tsd *tsd) +{ + tsd->key = tls_allocate(); + tsd->initMagic = INIT_MAGIC; +} + +void * +u_tsd_get(struct u_tsd *tsd) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + u_tsd_init(tsd); + } + return tls_get(tsd->key); +} + +void +u_tsd_set(struct u_tsd *tsd, void *ptr) +{ + if (tsd->initMagic != (int) INIT_MAGIC) { + u_tsd_init(tsd); + } + tls_set(tsd->key, ptr); +} + +#endif /* BEOS_THREADS */ + + + +#else /* THREADS */ + + +/* + * no-op functions + */ + +unsigned long +_glthread_GetID(void) +{ + return 0; +} + + +void +u_tsd_init(struct u_tsd *tsd) +{ + (void) tsd; +} + + +void * +u_tsd_get(struct u_tsd *tsd) +{ + (void) tsd; + return NULL; +} + + +void +u_tsd_set(struct u_tsd *tsd, void *ptr) +{ + (void) tsd; + (void) ptr; +} + + +#endif /* THREADS */ diff --git a/mesalib/src/mapi/mapi/u_thread.h b/mesalib/src/mapi/mapi/u_thread.h new file mode 100644 index 000000000..b4487a340 --- /dev/null +++ b/mesalib/src/mapi/mapi/u_thread.h @@ -0,0 +1,201 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5.2 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * Thread support for gl dispatch. + * + * Initial version by John Stone (j.stone@acm.org) (johns@cs.umr.edu) + * and Christoph Poliwoda (poliwoda@volumegraphics.com) + * Revised by Keith Whitwell + * Adapted for new gl dispatcher by Brian Paul + * Modified for use in mapi by Chia-I Wu + */ + +/* + * If this file is accidentally included by a non-threaded build, + * it should not cause the build to fail, or otherwise cause problems. + * In general, it should only be included when needed however. + */ + +#ifndef _U_THREAD_H_ +#define _U_THREAD_H_ + +#include "u_compiler.h" + +#if defined(PTHREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS) +#ifndef THREADS +#define THREADS +#endif +#endif + +/* + * POSIX threads. This should be your choice in the Unix world + * whenever possible. When building with POSIX threads, be sure + * to enable any compiler flags which will cause the MT-safe + * libc (if one exists) to be used when linking, as well as any + * header macros for MT-safe errno, etc. For Solaris, this is the -mt + * compiler flag. On Solaris with gcc, use -D_REENTRANT to enable + * proper compiling for MT-safe libc etc. + */ +#if defined(PTHREADS) +#include <pthread.h> /* POSIX threads headers */ + +struct u_tsd { + pthread_key_t key; + int initMagic; +}; + +typedef pthread_mutex_t u_mutex; + +#define u_mutex_declare_static(name) \ + static u_mutex name = PTHREAD_MUTEX_INITIALIZER + +#define u_mutex_init(name) pthread_mutex_init(&(name), NULL) +#define u_mutex_destroy(name) pthread_mutex_destroy(&(name)) +#define u_mutex_lock(name) (void) pthread_mutex_lock(&(name)) +#define u_mutex_unlock(name) (void) pthread_mutex_unlock(&(name)) + +#endif /* PTHREADS */ + + +/* + * Windows threads. Should work with Windows NT and 95. + * IMPORTANT: Link with multithreaded runtime library when THREADS are + * used! + */ +#ifdef WIN32_THREADS +#include <windows.h> + +struct u_tsd { + DWORD key; + int initMagic; +}; + +typedef CRITICAL_SECTION u_mutex; + +/* http://locklessinc.com/articles/pthreads_on_windows/ */ +#define u_mutex_declare_static(name) \ + /* static */ u_mutex name = {(void*)-1, -1, 0, 0, 0, 0} + +#define u_mutex_init(name) InitializeCriticalSection(&name) +#define u_mutex_destroy(name) DeleteCriticalSection(&name) +#define u_mutex_lock(name) EnterCriticalSection(&name) +#define u_mutex_unlock(name) LeaveCriticalSection(&name) + +#endif /* WIN32_THREADS */ + + +/* + * BeOS threads. R5.x required. + */ +#ifdef BEOS_THREADS + +/* Problem with OS.h and this file on haiku */ +#ifndef __HAIKU__ +#include <kernel/OS.h> +#endif + +#include <support/TLS.h> + +/* The only two typedefs required here + * this is cause of the OS.h problem + */ +#ifdef __HAIKU__ +typedef int32 thread_id; +typedef int32 sem_id; +#endif + +struct u_tsd { + int32 key; + int initMagic; +}; + +/* Use Benaphore, aka speeder semaphore */ +typedef struct { + int32 lock; + sem_id sem; +} benaphore; +typedef benaphore u_mutex; + +#define u_mutex_declare_static(name) \ + static u_mutex name = { 0, 0 } + +#define u_mutex_init(name) \ + name.sem = create_sem(0, #name"_benaphore"), \ + name.lock = 0 + +#define u_mutex_destroy(name) \ + delete_sem(name.sem), \ + name.lock = 0 + +#define u_mutex_lock(name) \ + if (name.sem == 0) \ + u_mutex_init(name); \ + if (atomic_add(&(name.lock), 1) >= 1) \ + acquire_sem(name.sem) + +#define u_mutex_unlock(name) \ + if (atomic_add(&(name.lock), -1) > 1) \ + release_sem(name.sem) + +#endif /* BEOS_THREADS */ + + +/* + * THREADS not defined + */ +#ifndef THREADS + +struct u_tsd { + int initMagic; +}; + +typedef unsigned u_mutex; + +#define u_mutex_declare_static(name) static u_mutex name = 0 +#define u_mutex_init(name) (void) name +#define u_mutex_destroy(name) (void) name +#define u_mutex_lock(name) (void) name +#define u_mutex_unlock(name) (void) name + +#endif /* THREADS */ + + +unsigned long +u_thread_self(void); + +void +u_tsd_init(struct u_tsd *tsd); + +void +u_tsd_destroy(struct u_tsd *tsd); /* WIN32 only */ + +void * +u_tsd_get(struct u_tsd *tsd); + +void +u_tsd_set(struct u_tsd *tsd, void *ptr); + +#endif /* _U_THREAD_H_ */ diff --git a/mesalib/src/mesa/Makefile b/mesalib/src/mesa/Makefile index 8c0ebf84c..c41c38cba 100644 --- a/mesalib/src/mesa/Makefile +++ b/mesalib/src/mesa/Makefile @@ -3,27 +3,98 @@ TOP = ../.. include $(TOP)/configs/current +MESA_LIBS := libmesa.a libmesagallium.a +DEPENDS := depend + +ifeq ($(GLES_OVERLAY),1) +ES1_LIBS := libes1gallium.a +ES2_LIBS := libes2gallium.a +DEPENDS += depend.es1 depend.es2 +endif + +MESA_OBJ_DIR := . +ES1_OBJ_DIR := objs-es1 +ES2_OBJ_DIR := objs-es2 + + include sources.mak -.SUFFIXES : .cpp +# adjust object dirs +ES1_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_OBJECTS)) +ES2_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_OBJECTS)) +MESA_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_OBJECTS)) + +ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS)) +ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS)) +MESA_GALLIUM_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS)) + +# define preprocessor flags +MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES) +ES1_CPPFLAGS := -DFEATURE_ES1=1 $(DEFINES) +ES2_CPPFLAGS := -DFEATURE_ES2=1 $(DEFINES) + +# append include dirs +MESA_CPPFLAGS += $(INCLUDE_DIRS) +ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS) +ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS) + +# tidy compiler flags +CFLAGS := $(filter-out $(DEFINES), $(CFLAGS)) +CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS)) + +# LLVM is needed for the state tracker +MESA_CFLAGS := $(LLVM_CFLAGS) +ES1_CFLAGS := $(LLVM_CFLAGS) +ES2_CFLAGS := $(LLVM_CFLAGS) -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ +define mesa-cc-c + @mkdir -p $(dir $@) + $(CC) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_CFLAGS) $(CFLAGS) +endef -.cpp.o: - $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@ +define mesa-cxx-c + @mkdir -p $(dir $@) + $(CXX) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_CFLAGS) $(CXXFLAGS) +endef -.S.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ +$(MESA_OBJ_DIR)/%.o: %.c + $(call mesa-cc-c,MESA) +$(MESA_OBJ_DIR)/%.o: %.cpp + $(call mesa-cxx-c,MESA) + +$(MESA_OBJ_DIR)/%.o: %.S + $(call mesa-cc-c,MESA) + +$(ES1_OBJ_DIR)/%.o: %.c + $(call mesa-cc-c,ES1) + +$(ES1_OBJ_DIR)/%.o: %.cpp + $(call mesa-cxx-c,ES1) + +$(ES1_OBJ_DIR)/%.o: %.S + $(call mesa-cc-c,ES1) + +$(ES2_OBJ_DIR)/%.o: %.c + $(call mesa-cc-c,ES2) + +$(ES2_OBJ_DIR)/%.o: %.cpp + $(call mesa-cxx-c,ES2) + +$(ES2_OBJ_DIR)/%.o: %.S + $(call mesa-cc-c,ES2) # Default: build dependencies, then asm_subdirs, GLSL built-in lib, # then convenience libs (.a) and finally the device drivers: -default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \ - libglapi.a driver_subdirs +default: $(DEPENDS) asm_subdirs \ + $(MESA_LIBS) $(ES1_LIBS) $(ES2_LIBS) driver_subdirs +main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py + $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@ +main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py + $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@ ###################################################################### # Helper libraries used by many drivers: @@ -32,17 +103,25 @@ default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \ libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS) @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS) +libes1.a: $(ES1_OBJECTS) $(GLSL_LIBS) + @$(MKLIB) -o es1 -static $(ES1_OBJECTS) $(GLSL_LIBS) + +libes2.a: $(ES2_OBJECTS) $(GLSL_LIBS) + @$(MKLIB) -o es2 -static $(ES2_OBJECTS) $(GLSL_LIBS) + # Make archive of subset of core mesa object files for gallium libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS) @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS) -# Make archive of gl* API dispatcher functions only -libglapi.a: $(GLAPI_OBJECTS) - @ $(MKLIB) -o glapi -static $(GLAPI_OBJECTS) +libes1gallium.a: $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS) + @$(MKLIB) -o es1gallium -static $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS) + +libes2gallium.a: $(ES2_GALLIUM_OBJECTS) $(GLSL_LIBS) + @$(MKLIB) -o es2gallium -static $(ES2_GALLIUM_OBJECTS) $(GLSL_LIBS) ###################################################################### # Device drivers -driver_subdirs: libmesa.a libglapi.a libmesagallium.a +driver_subdirs: $(MESA_LIBS) @ (cd drivers && $(MAKE)) @@ -59,20 +138,25 @@ asm_subdirs: ###################################################################### -# GLSL built-in library -glsl_builtin: - (cd shader/slang/library && $(MAKE)) || exit 1 ; - - -###################################################################### # Dependency generation depend: $(ALL_SOURCES) @ echo "running $(MKDEP)" @ touch depend - @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \ - > /dev/null 2>/dev/null + @$(MKDEP) $(MKDEP_OPTIONS) -p$(MESA_OBJ_DIR)/ $(MESA_CPPFLAGS) \ + $(ALL_SOURCES) > /dev/null 2>/dev/null + +depend.es1: $(ALL_SOURCES) + @echo "running $(MKDEP) for ES1" + @touch $@ + @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES1_OBJ_DIR)/ $(ES1_CPPFLAGS) \ + $(ALL_SOURCES) > /dev/null 2>/dev/null +depend.es2: $(ALL_SOURCES) + @echo "running $(MKDEP) for ES2" + @touch $@ + @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES2_OBJ_DIR)/ $(ES2_CPPFLAGS) \ + $(ALL_SOURCES) > /dev/null 2>/dev/null ###################################################################### # Installation rules @@ -96,12 +180,15 @@ install: default esac ; \ done - -gl_pcedit = sed \ +pcedit = \ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + + +gl_pcedit = sed \ + $(pcedit) \ -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \ -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \ -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \ @@ -111,10 +198,7 @@ gl.pc: gl.pc.in $(gl_pcedit) $< > $@ osmesa_pcedit = sed \ - -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ - -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ - -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + $(pcedit) \ -e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \ -e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \ -e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),' @@ -150,14 +234,22 @@ install-dri: default tags: etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h +clean-es1: + -rm -f $(ES1_LIBS) + -rm -rf $(ES1_OBJ_DIR) + -rm -f depend.es1 depend.es1.bak + +clean-es2: + -rm -f $(ES2_LIBS) + -rm -rf $(ES2_OBJ_DIR) + -rm -f depend.es2 depend.es2.bak -clean: +clean: clean-es1 clean-es2 -rm -f */*.o -rm -f */*/*.o - -rm -f depend depend.bak libmesa.a libglapi.a libmesagallium.a + -rm -f depend depend.bak libmesa.a libmesagallium.a -rm -f drivers/*/*.o -rm -f *.pc - -rm -f shader/slang/library/*_gc.h -@cd drivers/dri && $(MAKE) clean -@cd drivers/x11 && $(MAKE) clean -@cd drivers/osmesa && $(MAKE) clean @@ -165,4 +257,4 @@ clean: -@cd x86-64 && $(MAKE) clean --include depend +-include $(DEPENDS) diff --git a/mesalib/src/mesa/Makefile.mgw b/mesalib/src/mesa/Makefile.mgw index b90384d04..fc0ff28d6 100644 --- a/mesalib/src/mesa/Makefile.mgw +++ b/mesalib/src/mesa/Makefile.mgw @@ -216,8 +216,8 @@ clean: -$(call UNLINK,main/*.o) -$(call UNLINK,math/*.o) -$(call UNLINK,vbo/*.o) - -$(call UNLINK,shader/*.o) - -$(call UNLINK,shader/slang/*.o) + -$(call UNLINK,program/*.o) + -$(call UNLINK,slang/*.o) -$(call UNLINK,sparc/*.o) -$(call UNLINK,ppc/*.o) -$(call UNLINK,swrast/*.o) diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c index ebfaa2f07..f92cdc5a7 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.c +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -31,25 +31,20 @@ #include "main/mipmap.h" #include "main/queryobj.h" #include "main/renderbuffer.h" +#include "main/shaderobj.h" #include "main/texcompress.h" #include "main/texformat.h" #include "main/texgetimage.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/texstore.h" -#if FEATURE_ARB_vertex_buffer_object #include "main/bufferobj.h" -#endif -#if FEATURE_EXT_framebuffer_object #include "main/fbobject.h" #include "main/texrender.h" -#endif -#if FEATURE_ARB_sync #include "main/syncobj.h" -#endif +#include "main/transformfeedback.h" -#include "shader/program.h" -#include "shader/shader_api.h" +#include "program/program.h" #include "tnl/tnl.h" #include "swrast/swrast.h" @@ -178,41 +173,31 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->TexParameter = NULL; driver->Viewport = NULL; - /* state queries */ - driver->GetBooleanv = NULL; - driver->GetDoublev = NULL; - driver->GetFloatv = NULL; - driver->GetIntegerv = NULL; - driver->GetInteger64v = NULL; - driver->GetPointerv = NULL; - /* buffer objects */ _mesa_init_buffer_object_functions(driver); /* query objects */ _mesa_init_query_object_functions(driver); -#if FEATURE_ARB_sync _mesa_init_sync_object_functions(driver); -#endif -#if FEATURE_EXT_framebuffer_object driver->NewFramebuffer = _mesa_new_framebuffer; driver->NewRenderbuffer = _mesa_new_soft_renderbuffer; driver->RenderTexture = _mesa_render_texture; driver->FinishRenderTexture = _mesa_finish_render_texture; driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer; -#endif -#if FEATURE_EXT_framebuffer_blit driver->BlitFramebuffer = _swrast_BlitFramebuffer; -#endif /* APPLE_vertex_array_object */ driver->NewArrayObject = _mesa_new_array_object; driver->DeleteArrayObject = _mesa_delete_array_object; driver->BindArrayObject = NULL; + _mesa_init_shader_object_functions(driver); + + _mesa_init_transform_feedback_functions(driver); + /* T&L stuff */ driver->NeedValidate = GL_FALSE; driver->ValidateTnlModule = NULL; @@ -232,10 +217,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->EndList = NULL; driver->BeginCallList = NULL; driver->EndCallList = NULL; - - - /* XXX temporary here */ - _mesa_init_glsl_driver_functions(driver); } diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 89ca476f9..a03cb68ec 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -34,6 +34,7 @@ #include "main/glheader.h" #include "main/mtypes.h" #include "main/imports.h" +#include "main/arbprogram.h" #include "main/arrayobj.h" #include "main/blend.h" #include "main/bufferobj.h" @@ -51,7 +52,7 @@ #include "main/polygon.h" #include "main/readpix.h" #include "main/scissor.h" -#include "main/shaders.h" +#include "main/shaderapi.h" #include "main/state.h" #include "main/stencil.h" #include "main/texobj.h" @@ -61,8 +62,7 @@ #include "main/texstate.h" #include "main/varray.h" #include "main/viewport.h" -#include "shader/program.h" -#include "shader/arbprogram.h" +#include "program/program.h" #include "swrast/swrast.h" #include "drivers/common/meta.h" @@ -430,13 +430,15 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state) if (state & META_SHADER) { if (ctx->Extensions.ARB_vertex_program) { save->VertexProgramEnabled = ctx->VertexProgram.Enabled; - save->VertexProgram = ctx->VertexProgram.Current; + _mesa_reference_vertprog(ctx, &save->VertexProgram, + ctx->VertexProgram.Current); _mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE); } if (ctx->Extensions.ARB_fragment_program) { save->FragmentProgramEnabled = ctx->FragmentProgram.Enabled; - save->FragmentProgram = ctx->FragmentProgram.Current; + _mesa_reference_fragprog(ctx, &save->FragmentProgram, + ctx->FragmentProgram.Current); _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_FALSE); } @@ -664,6 +666,7 @@ _mesa_meta_end(GLcontext *ctx) save->VertexProgramEnabled); _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, save->VertexProgram); + _mesa_reference_vertprog(ctx, &save->VertexProgram, NULL); } if (ctx->Extensions.ARB_fragment_program) { @@ -671,6 +674,7 @@ _mesa_meta_end(GLcontext *ctx) save->FragmentProgramEnabled); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, save->FragmentProgram); + _mesa_reference_fragprog(ctx, &save->FragmentProgram, NULL); } if (ctx->Extensions.ARB_shader_objects) { @@ -721,6 +725,7 @@ _mesa_meta_end(GLcontext *ctx) for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { _mesa_reference_texobj(&ctx->Texture.Unit[0].CurrentTex[tgt], save->CurrentTexture[tgt]); + _mesa_reference_texobj(&save->CurrentTexture[tgt], NULL); } /* Re-enable textures, texgen */ @@ -2082,8 +2087,10 @@ _mesa_meta_Bitmap(GLcontext *ctx, } bitmap1 = _mesa_map_pbo_source(ctx, &unpackSave, bitmap1); - if (!bitmap1) + if (!bitmap1) { + _mesa_meta_end(ctx); return; + } bitmap8 = (GLubyte *) calloc(1, width * height); if (bitmap8) { @@ -2393,6 +2400,9 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, break; } + /* Set MaxLevel large enough to hold the new level when we allocate it */ + _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, dstLevel); + /* Create empty dest image */ if (target == GL_TEXTURE_1D) { _mesa_TexImage1D(target, dstLevel, srcImage->InternalFormat, @@ -2560,12 +2570,6 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, return; } - if (texImage->TexFormat == MESA_FORMAT_NONE) - texImage->TexFormat = ctx->Driver.ChooseTextureFormat(ctx, - internalFormat, - format, - type); - _mesa_unlock_texture(ctx, texObj); /* need to unlock first */ /* @@ -2579,12 +2583,10 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, /* * Prepare for new texture image size/data */ -#if FEATURE_convolve if (_mesa_is_color_format(internalFormat)) { _mesa_adjust_image_for_convolution(ctx, 2, &postConvWidth, &postConvHeight); } -#endif if (texImage->Data) { ctx->Driver.FreeTexImageData(ctx, texImage); @@ -2594,6 +2596,9 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, postConvWidth, postConvHeight, 1, border, internalFormat); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); + /* * Store texture data (with pixel transfer ops) */ diff --git a/mesalib/src/mesa/drivers/dri/Makefile.template b/mesalib/src/mesa/drivers/dri/Makefile.template index a0c25d26c..a00018caf 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile.template +++ b/mesalib/src/mesa/drivers/dri/Makefile.template @@ -17,6 +17,7 @@ COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) OBJECTS = $(C_SOURCES:.c=.o) \ + $(CXX_SOURCES:.cpp=.o) \ $(ASM_SOURCES:.S=.o) @@ -26,17 +27,23 @@ SHARED_INCLUDES = \ -I$(TOP)/src/mesa/drivers/dri/common \ -Iserver \ -I$(TOP)/include \ + -I$(TOP)/src/mapi \ -I$(TOP)/src/mesa \ -I$(TOP)/src/egl/main \ -I$(TOP)/src/egl/drivers/dri \ $(LIBDRM_CFLAGS) +CFLAGS += $(API_DEFINES) +CXXFLAGS += $(API_DEFINES) ##### RULES ##### .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ +.cpp.o: + $(CC) -c $(INCLUDES) $(CXXFLAGS) $(DRIVER_DEFINES) $< -o $@ + .S.o: $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ @@ -51,9 +58,12 @@ lib: symlinks subdirs depend @$(MAKE) $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) Makefile \ - $(TOP)/src/mesa/drivers/dri/Makefile.template - $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + $(TOP)/src/mesa/drivers/dri/Makefile.template $(TOP)/src/mesa/drivers/dri/common/dri_test.o + $(MKLIB) -o $@.tmp -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(DRI_LIB_DEPS) + $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS) + @rm -f $@.test + mv -f $@.tmp $@ $(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME) diff --git a/mesalib/src/mesa/drivers/dri/common/dri_metaops.c b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c index dfb7d6404..a2f404b61 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_metaops.c +++ b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c @@ -26,15 +26,16 @@ * **************************************************************************/ +#include "main/arbprogram.h" #include "main/arrayobj.h" #include "main/bufferobj.h" +#include "main/context.h" #include "main/enable.h" #include "main/matrix.h" #include "main/texstate.h" #include "main/varray.h" #include "main/viewport.h" -#include "shader/arbprogram.h" -#include "shader/program.h" +#include "program/program.h" #include "dri_metaops.h" void diff --git a/mesalib/src/mesa/drivers/dri/common/dri_test.c b/mesalib/src/mesa/drivers/dri/common/dri_test.c new file mode 100644 index 000000000..793f0c37d --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/dri_test.c @@ -0,0 +1,89 @@ +#include "main/glheader.h" +#include "main/compiler.h" +#include "glapi/glapi.h" + +/* This is just supposed to make sure we get a reference to + the driver entry symbol that the compiler doesn't optimize away */ + +extern char __driDriverExtensions[]; + +/* provide glapi symbols */ + +#if defined(GLX_USE_TLS) + +PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch + __attribute__((tls_model("initial-exec"))); + +PUBLIC __thread void * _glapi_tls_Context + __attribute__((tls_model("initial-exec"))); + +PUBLIC const struct _glapi_table *_glapi_Dispatch; +PUBLIC const void *_glapi_Context; + +#else + +PUBLIC struct _glapi_table *_glapi_Dispatch; +PUBLIC void *_glapi_Context; + +#endif + +PUBLIC void +_glapi_check_multithread(void) +{} + +PUBLIC void +_glapi_set_context(void *context) +{} + +PUBLIC void * +_glapi_get_context(void) +{ + return 0; +} + +PUBLIC void +_glapi_set_dispatch(struct _glapi_table *dispatch) +{} + +PUBLIC struct _glapi_table * +_glapi_get_dispatch(void) +{ + return 0; +} + +PUBLIC int +_glapi_add_dispatch( const char * const * function_names, + const char * parameter_signature ) +{ + return 0; +} + +PUBLIC GLint +_glapi_get_proc_offset(const char *funcName) +{ + return 0; +} + +PUBLIC _glapi_proc +_glapi_get_proc_address(const char *funcName) +{ + return 0; +} + +PUBLIC GLuint +_glapi_get_dispatch_table_size(void) +{ + return 0; +} + +PUBLIC unsigned long +_glthread_GetID(void) +{ + return 0; +} + +int main(int argc, char** argv) +{ + void* p = __driDriverExtensions; + return (int)(unsigned long)p; +} diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c index 75c98825b..d46f622d5 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.c +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c @@ -31,6 +31,17 @@ #include "dri_util.h" #include "drm_sarea.h" #include "utils.h" +#include "xmlpool.h" +#include "../glsl/glsl_parser_extras.h" + +PUBLIC const char __dri2ConfigOptions[] = + DRI_CONF_BEGIN + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_1) + DRI_CONF_SECTION_END + DRI_CONF_END; + +static const uint __dri2NConfigOptions = 1; #ifndef GLX_OML_sync_control typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); @@ -47,28 +58,6 @@ const __DRIextension driReadDrawableExtension = { __DRI_READ_DRAWABLE, __DRI_READ_DRAWABLE_VERSION }; -/** - * Print message to \c stderr if the \c LIBGL_DEBUG environment variable - * is set. - * - * Is called from the drivers. - * - * \param f \c printf like format string. - */ -void -__driUtilMessage(const char *f, ...) -{ - va_list args; - - if (getenv("LIBGL_DEBUG")) { - fprintf(stderr, "libGL: "); - va_start(args, f); - vfprintf(stderr, f, args); - va_end(args); - fprintf(stderr, "\n"); - } -} - GLint driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ) { @@ -151,11 +140,6 @@ static int driUnbindContext(__DRIcontext *pcp) */ pcp->driDrawablePriv = pcp->driReadablePriv = NULL; -#if 0 - /* Unbind the drawable */ - pdp->driContextPriv = &psp->dummyContextPriv; -#endif - return GL_TRUE; } @@ -170,19 +154,24 @@ static int driBindContext(__DRIcontext *pcp, { __DRIscreen *psp = NULL; - /* Bind the drawable to the context */ + /* + ** Assume error checking is done properly in glXMakeCurrent before + ** calling driUnbindContext. + */ - if (pcp) { - psp = pcp->driScreenPriv; - pcp->driDrawablePriv = pdp; - pcp->driReadablePriv = prp; - if (pdp) { - pdp->driContextPriv = pcp; - dri_get_drawable(pdp); - } - if ( prp && pdp != prp ) { - dri_get_drawable(prp); - } + if (!pcp) + return GL_FALSE; + + /* Bind the drawable to the context */ + psp = pcp->driScreenPriv; + pcp->driDrawablePriv = pdp; + pcp->driReadablePriv = prp; + if (pdp) { + pdp->driContextPriv = pcp; + dri_get_drawable(pdp); + } + if (prp && pdp != prp) { + dri_get_drawable(prp); } /* @@ -190,7 +179,6 @@ static int driBindContext(__DRIcontext *pcp, ** initialize the drawable information if has not been done before. */ - assert(psp); if (!psp->dri2.enabled) { if (pdp && !pdp->pStamp) { DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); @@ -205,7 +193,6 @@ static int driBindContext(__DRIcontext *pcp, } /* Call device-specific MakeCurrent */ - return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp); } @@ -437,6 +424,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, return NULL; } + pdp->driContextPriv = NULL; pdp->loaderPrivate = data; pdp->hHWDrawable = hwDrawable; pdp->refcount = 1; @@ -455,7 +443,6 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, pdp->vblFlags = 0; pdp->driScreenPriv = psp; - pdp->driContextPriv = &psp->dummyContextPriv; if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, renderType == GLX_PIXMAP_BIT)) { @@ -495,6 +482,41 @@ dri2CreateNewDrawable(__DRIscreen *screen, return pdraw; } +static int +dri2ConfigQueryb(__DRIscreen *screen, const char *var, GLboolean *val) +{ + if (!driCheckOption(&screen->optionCache, var, DRI_BOOL)) + return -1; + + *val = driQueryOptionb(&screen->optionCache, var); + + return 0; +} + +static int +dri2ConfigQueryi(__DRIscreen *screen, const char *var, GLint *val) +{ + if (!driCheckOption(&screen->optionCache, var, DRI_INT) && + !driCheckOption(&screen->optionCache, var, DRI_ENUM)) + return -1; + + *val = driQueryOptioni(&screen->optionCache, var); + + return 0; +} + +static int +dri2ConfigQueryf(__DRIscreen *screen, const char *var, GLfloat *val) +{ + if (!driCheckOption(&screen->optionCache, var, DRI_FLOAT)) + return -1; + + *val = driQueryOptionf(&screen->optionCache, var); + + return 0; +} + + static void dri_get_drawable(__DRIdrawable *pdp) { pdp->refcount++; @@ -589,21 +611,11 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, pcp->dri2.draw_stamp = 0; pcp->dri2.read_stamp = 0; - /* When the first context is created for a screen, initialize a "dummy" - * context. - */ - - if (!psp->dri2.enabled && !psp->dummyContextPriv.driScreenPriv) { - psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context; - psp->dummyContextPriv.driScreenPriv = psp; - psp->dummyContextPriv.driDrawablePriv = NULL; - psp->dummyContextPriv.driverPrivate = NULL; - /* No other fields should be used! */ - } pcp->hHWContext = hwContext; - if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) { + if ( !(*psp->DriverAPI.CreateContext)(API_OPENGL, + &config->modes, pcp, shareCtx) ) { free(pcp); return NULL; } @@ -611,15 +623,65 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, return pcp; } +static unsigned int +dri2GetAPIMask(__DRIscreen *screen) +{ + return screen->api_mask; +} + +static __DRIcontext * +dri2CreateNewContextForAPI(__DRIscreen *screen, int api, + const __DRIconfig *config, + __DRIcontext *shared, void *data) +{ + __DRIcontext *context; + const __GLcontextModes *modes = (config != NULL) ? &config->modes : NULL; + void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; + gl_api mesa_api; + + if (!(screen->api_mask & (1 << api))) + return NULL; + + switch (api) { + case __DRI_API_OPENGL: + mesa_api = API_OPENGL; + break; + case __DRI_API_GLES: + mesa_api = API_OPENGLES; + break; + case __DRI_API_GLES2: + mesa_api = API_OPENGLES2; + break; + default: + return NULL; + } + + context = malloc(sizeof *context); + if (!context) + return NULL; + + context->driScreenPriv = screen; + context->driDrawablePriv = NULL; + context->loaderPrivate = data; + + if (!(*screen->DriverAPI.CreateContext)(mesa_api, modes, + context, shareCtx) ) { + free(context); + return NULL; + } + + return context; +} + static __DRIcontext * dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config, __DRIcontext *shared, void *data) { - return driCreateNewContext(screen, config, 0, shared, 0, data); + return dri2CreateNewContextForAPI(screen, __DRI_API_OPENGL, + config, shared, data); } - static int driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask) { @@ -649,6 +711,8 @@ static void driDestroyScreen(__DRIscreen *psp) * stream open to the X-server anymore. */ + _mesa_destroy_shader_compiler(); + if (psp->DriverAPI.DestroyScreen) (*psp->DriverAPI.DestroyScreen)(psp); @@ -656,6 +720,9 @@ static void driDestroyScreen(__DRIscreen *psp) (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); (void)drmCloseOnce(psp->fd); + } else { + driDestroyOptionCache(&psp->optionCache); + driDestroyOptionInfo(&psp->optionInfo); } free(psp); @@ -679,6 +746,8 @@ setupLoaderExtensions(__DRIscreen *psp, psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i]; if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0) psp->dri2.image = (__DRIimageLookupExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_USE_INVALIDATE) == 0) + psp->dri2.useInvalidate = (__DRIuseInvalidateExtension *) extensions[i]; } } @@ -756,14 +825,8 @@ driCreateNewScreen(int scrn, psp->myNum = scrn; psp->dri2.enabled = GL_FALSE; - /* - ** Do not init dummy context here; actual initialization will be - ** done when the first DRI context is created. Init screen priv ptr - ** to NULL to let CreateContext routine that it needs to be inited. - */ - psp->dummyContextPriv.driScreenPriv = NULL; - psp->DriverAPI = driDriverAPI; + psp->api_mask = (1 << __DRI_API_OPENGL); *driver_modes = driDriverAPI.InitScreen(psp); if (*driver_modes == NULL) { @@ -809,6 +872,7 @@ dri2CreateNewScreen(int scrn, int fd, psp->dri2.enabled = GL_TRUE; psp->DriverAPI = driDriverAPI; + psp->api_mask = (1 << __DRI_API_OPENGL); *driver_configs = driDriverAPI.InitScreen2(psp); if (*driver_configs == NULL) { free(psp); @@ -816,6 +880,12 @@ dri2CreateNewScreen(int scrn, int fd, } psp->DriverAPI = driDriverAPI; + psp->loaderPrivate = data; + + driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions, + __dri2NConfigOptions); + driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum, + "dri2"); return psp; } @@ -857,41 +927,15 @@ const __DRIdri2Extension driDRI2Extension = { dri2CreateNewScreen, dri2CreateNewDrawable, dri2CreateNewContext, + dri2GetAPIMask, + dri2CreateNewContextForAPI }; -static int -driFrameTracking(__DRIdrawable *drawable, GLboolean enable) -{ - return GLX_BAD_CONTEXT; -} - -static int -driQueryFrameTracking(__DRIdrawable *dpriv, - int64_t * sbc, int64_t * missedFrames, - float * lastMissedUsage, float * usage) -{ - __DRIswapInfo sInfo; - int status; - int64_t ust; - __DRIscreen *psp = dpriv->driScreenPriv; - - status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo ); - if ( status == 0 ) { - *sbc = sInfo.swap_count; - *missedFrames = sInfo.swap_missed_count; - *lastMissedUsage = sInfo.swap_missed_usage; - - (*psp->systemTime->getUST)( & ust ); - *usage = driCalculateSwapUsage( dpriv, sInfo.swap_ust, ust ); - } - - return status; -} - -const __DRIframeTrackingExtension driFrameTrackingExtension = { - { __DRI_FRAME_TRACKING, __DRI_FRAME_TRACKING_VERSION }, - driFrameTracking, - driQueryFrameTracking +const __DRI2configQueryExtension dri2ConfigQueryExtension = { + { __DRI2_CONFIG_QUERY, __DRI2_CONFIG_QUERY_VERSION }, + dri2ConfigQueryb, + dri2ConfigQueryi, + dri2ConfigQueryf, }; /** diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h index 99c0f1e44..785beacd8 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.h +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h @@ -51,7 +51,9 @@ #include <drm.h> #include <drm_sarea.h> #include <xf86drm.h> +#include "xmlconfig.h" #include "main/glheader.h" +#include "main/mtypes.h" #include "GL/internal/glcore.h" #include "GL/internal/dri_interface.h" @@ -68,8 +70,8 @@ extern const __DRIdri2Extension driDRI2Extension; extern const __DRIextension driReadDrawableExtension; extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; -extern const __DRIframeTrackingExtension driFrameTrackingExtension; extern const __DRImediaStreamCounterExtension driMediaStreamCounterExtension; +extern const __DRI2configQueryExtension dri2ConfigQueryExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO @@ -146,8 +148,9 @@ struct __DriverAPIRec { /** * Context creation callback */ - GLboolean (*CreateContext)(const __GLcontextModes *glVis, - __DRIcontext *driContextPriv, + GLboolean (*CreateContext)(gl_api api, + const __GLcontextModes *glVis, + __DRIcontext *driContextPriv, void *sharedContextPrivate); /** @@ -399,11 +402,6 @@ struct __DRIcontextRec { void *driverPrivate; /** - * Pointer back to the \c __DRIcontext that contains this structure. - */ - __DRIcontext *pctx; - - /** * Pointer to drawable currently bound to this context for drawing. */ __DRIdrawable *driDrawablePriv; @@ -511,28 +509,15 @@ struct __DRIscreenRec { /*@}*/ /** - * Dummy context to which drawables are bound when not bound to any - * other context. - * - * A dummy hHWContext is created for this context, and is used by the GL - * core when a hardware lock is required but the drawable is not currently - * bound (e.g., potentially during a SwapBuffers request). The dummy - * context is created when the first "real" context is created on this - * screen. - */ - __DRIcontext dummyContextPriv; - - /** * Device-dependent private information (not stored in the SAREA). * * This pointer is never touched by the DRI layer. */ +#ifdef __cplusplus + void *priv; +#else void *private; - - /** - * Pointer back to the \c __DRIscreen that contains this structure. - */ - __DRIscreen *psc; +#endif /* Extensions provided by the loader. */ const __DRIgetDrawableInfoExtension *getDrawableInfo; @@ -545,15 +530,17 @@ struct __DRIscreenRec { int enabled; __DRIdri2LoaderExtension *loader; __DRIimageLookupExtension *image; + __DRIuseInvalidateExtension *useInvalidate; } dri2; /* The lock actually in use, old sarea or DRI2 */ drmLock *lock; -}; - -extern void -__driUtilMessage(const char *f, ...); + driOptionCache optionInfo; + driOptionCache optionCache; + unsigned int api_mask; + void *loaderPrivate; +}; extern void __driUtilUpdateDrawableInfo(__DRIdrawable *pdp); diff --git a/mesalib/src/mesa/drivers/dri/common/drisw_util.c b/mesalib/src/mesa/drivers/dri/common/drisw_util.c new file mode 100644 index 000000000..1529c23b1 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/drisw_util.c @@ -0,0 +1,273 @@ +/* + * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * Copyright 2010 George Sapountzis <gsapountzis@gmail.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file drisw_util.c + * + * DRISW utility functions, i.e. dri_util.c stripped from drm-specific bits. + */ + +#include "drisw_util.h" +#include "utils.h" + + +/** + * Screen functions + */ + +static void +setupLoaderExtensions(__DRIscreen *psp, + const __DRIextension **extensions) +{ + int i; + + for (i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]->name, __DRI_SWRAST_LOADER) == 0) + psp->swrast_loader = (__DRIswrastLoaderExtension *) extensions[i]; + } +} + +static __DRIscreen * +driCreateNewScreen(int scrn, const __DRIextension **extensions, + const __DRIconfig ***driver_configs, void *data) +{ + static const __DRIextension *emptyExtensionList[] = { NULL }; + __DRIscreen *psp; + + (void) data; + + psp = CALLOC_STRUCT(__DRIscreenRec); + if (!psp) + return NULL; + + setupLoaderExtensions(psp, extensions); + + psp->extensions = emptyExtensionList; + psp->fd = -1; + psp->myNum = scrn; + + *driver_configs = driDriverAPI.InitScreen(psp); + + if (*driver_configs == NULL) { + FREE(psp); + return NULL; + } + + return psp; +} + +static void driDestroyScreen(__DRIscreen *psp) +{ + if (psp) { + driDriverAPI.DestroyScreen(psp); + + FREE(psp); + } +} + +static const __DRIextension **driGetExtensions(__DRIscreen *psp) +{ + return psp->extensions; +} + + +/** + * Context functions + */ + +static __DRIcontext * +driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, + __DRIcontext *shared, void *data) +{ + __DRIcontext *pcp; + void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; + + pcp = CALLOC_STRUCT(__DRIcontextRec); + if (!pcp) + return NULL; + + pcp->loaderPrivate = data; + + pcp->driScreenPriv = psp; + pcp->driDrawablePriv = NULL; + pcp->driReadablePriv = NULL; + + if (!driDriverAPI.CreateContext(API_OPENGL, + &config->modes, pcp, shareCtx)) { + FREE(pcp); + return NULL; + } + + return pcp; +} + +static void +driDestroyContext(__DRIcontext *pcp) +{ + if (pcp) { + driDriverAPI.DestroyContext(pcp); + FREE(pcp); + } +} + +static int +driCopyContext(__DRIcontext *dst, __DRIcontext *src, unsigned long mask) +{ + return GL_FALSE; +} + +static void dri_get_drawable(__DRIdrawable *pdp); +static void dri_put_drawable(__DRIdrawable *pdp); + +static int driBindContext(__DRIcontext *pcp, + __DRIdrawable *pdp, + __DRIdrawable *prp) +{ + /* Bind the drawable to the context */ + if (pcp) { + pcp->driDrawablePriv = pdp; + pcp->driReadablePriv = prp; + if (pdp) { + pdp->driContextPriv = pcp; + dri_get_drawable(pdp); + } + if ( prp && pdp != prp ) { + dri_get_drawable(prp); + } + } + + return driDriverAPI.MakeCurrent(pcp, pdp, prp); +} + +static int driUnbindContext(__DRIcontext *pcp) +{ + __DRIdrawable *pdp; + __DRIdrawable *prp; + + if (pcp == NULL) + return GL_FALSE; + + pdp = pcp->driDrawablePriv; + prp = pcp->driReadablePriv; + + /* already unbound */ + if (!pdp && !prp) + return GL_TRUE; + + driDriverAPI.UnbindContext(pcp); + + dri_put_drawable(pdp); + + if (prp != pdp) { + dri_put_drawable(prp); + } + + pcp->driDrawablePriv = NULL; + pcp->driReadablePriv = NULL; + + return GL_TRUE; +} + + +/** + * Drawable functions + */ + +static void dri_get_drawable(__DRIdrawable *pdp) +{ + pdp->refcount++; +} + +static void dri_put_drawable(__DRIdrawable *pdp) +{ + if (pdp) { + pdp->refcount--; + if (pdp->refcount) + return; + + driDriverAPI.DestroyBuffer(pdp); + + FREE(pdp); + } +} + +static __DRIdrawable * +driCreateNewDrawable(__DRIscreen *psp, + const __DRIconfig *config, void *data) +{ + __DRIdrawable *pdp; + + pdp = CALLOC_STRUCT(__DRIdrawableRec); + if (!pdp) + return NULL; + + pdp->loaderPrivate = data; + + pdp->driScreenPriv = psp; + pdp->driContextPriv = NULL; + + dri_get_drawable(pdp); + + if (!driDriverAPI.CreateBuffer(psp, pdp, &config->modes, GL_FALSE)) { + FREE(pdp); + return NULL; + } + + pdp->lastStamp = 1; /* const */ + + return pdp; +} + +static void +driDestroyDrawable(__DRIdrawable *pdp) +{ + dri_put_drawable(pdp); +} + +static void driSwapBuffers(__DRIdrawable *pdp) +{ + driDriverAPI.SwapBuffers(pdp); +} + +const __DRIcoreExtension driCoreExtension = { + { __DRI_CORE, __DRI_CORE_VERSION }, + NULL, /* driCreateNewScreen */ + driDestroyScreen, + driGetExtensions, + driGetConfigAttrib, + driIndexConfigAttrib, + NULL, /* driCreateNewDrawable */ + driDestroyDrawable, + driSwapBuffers, + driCreateNewContext, + driCopyContext, + driDestroyContext, + driBindContext, + driUnbindContext +}; + +const __DRIswrastExtension driSWRastExtension = { + { __DRI_SWRAST, __DRI_SWRAST_VERSION }, + driCreateNewScreen, + driCreateNewDrawable +}; diff --git a/mesalib/src/mesa/drivers/dri/common/drisw_util.h b/mesalib/src/mesa/drivers/dri/common/drisw_util.h new file mode 100644 index 000000000..9c3d01c99 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/drisw_util.h @@ -0,0 +1,135 @@ +/* + * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * Copyright 2010 George Sapountzis <gsapountzis@gmail.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * @file + * Binding of the DRI interface (dri_interface.h) for DRISW. + * + * The DRISW structs are 'base classes' of the corresponding DRI1 / DRI2 (DRM) + * structs. The bindings for SW and DRM can be unified by making the DRM structs + * 'sub-classes' of the SW structs, either proper or with field re-ordering. + * + * The code can also be unified but that requires cluttering the common code + * with ifdef's and guarding with (__DRIscreen::fd >= 0) for DRM. + */ + +#ifndef _DRISW_UTIL_H +#define _DRISW_UTIL_H + +#include "main/mtypes.h" + +#include <GL/gl.h> +#include <GL/internal/glcore.h> +#include <GL/internal/dri_interface.h> +typedef struct _drmLock drmLock; + + +/** + * Extensions + */ +extern const __DRIcoreExtension driCoreExtension; +extern const __DRIswrastExtension driSWRastExtension; + + +/** + * Driver callback functions + */ +struct __DriverAPIRec { + const __DRIconfig **(*InitScreen) (__DRIscreen * priv); + + void (*DestroyScreen)(__DRIscreen *driScrnPriv); + + GLboolean (*CreateContext)(gl_api glapi, + const __GLcontextModes *glVis, + __DRIcontext *driContextPriv, + void *sharedContextPrivate); + + void (*DestroyContext)(__DRIcontext *driContextPriv); + + GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, + __DRIdrawable *driDrawPriv, + const __GLcontextModes *glVis, + GLboolean pixmapBuffer); + + void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); + + void (*SwapBuffers)(__DRIdrawable *driDrawPriv); + + GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv, + __DRIdrawable *driDrawPriv, + __DRIdrawable *driReadPriv); + + GLboolean (*UnbindContext)(__DRIcontext *driContextPriv); +}; + +extern const struct __DriverAPIRec driDriverAPI; + + +/** + * Data types + */ +struct __DRIscreenRec { + int myNum; + + int fd; + + void *private; + + const __DRIextension **extensions; + + const __DRIswrastLoaderExtension *swrast_loader; +}; + +struct __DRIcontextRec { + + void *driverPrivate; + + void *loaderPrivate; + + __DRIdrawable *driDrawablePriv; + + __DRIdrawable *driReadablePriv; + + __DRIscreen *driScreenPriv; +}; + +struct __DRIdrawableRec { + + void *driverPrivate; + + void *loaderPrivate; + + __DRIcontext *driContextPriv; + + __DRIscreen *driScreenPriv; + + int refcount; + + /* gallium */ + unsigned int lastStamp; + + int w; + int h; +}; + +#endif /* _DRISW_UTIL_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp2.h b/mesalib/src/mesa/drivers/dri/common/spantmp2.h index 98422a856..1dab7336b 100644 --- a/mesalib/src/mesa/drivers/dri/common/spantmp2.h +++ b/mesalib/src/mesa/drivers/dri/common/spantmp2.h @@ -413,6 +413,38 @@ } while (0) # endif +#elif (SPANTMP_PIXEL_FMT == GL_ALPHA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_BYTE) + +/** + ** GL_ALPHA, GL_UNSIGNED_BYTE + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) ( buf + (_x) + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLubyte *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLubyte *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +# define INIT_MONO_PIXEL(p, color) \ + p = color[3] + +# define WRITE_RGBA(_x, _y, r, g, b, a) \ + PUT_VALUE(_x, _y, a | (r & 0 /* quiet warnings */)) + +#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLubyte p = GET_VALUE(_x, _y); \ + rgba[0] = 0; \ + rgba[1] = 0; \ + rgba[2] = 0; \ + rgba[3] = p; \ + } while (0) + #else #error SPANTMP_PIXEL_FMT must be set to a valid value! #endif diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c index b85b364c5..771cb64ca 100644 --- a/mesalib/src/mesa/drivers/dri/common/utils.c +++ b/mesalib/src/mesa/drivers/dri/common/utils.c @@ -37,6 +37,29 @@ #include "utils.h" +/** + * Print message to \c stderr if the \c LIBGL_DEBUG environment variable + * is set. + * + * Is called from the drivers. + * + * \param f \c printf like format string. + */ +void +__driUtilMessage(const char *f, ...) +{ + va_list args; + + if (getenv("LIBGL_DEBUG")) { + fprintf(stderr, "libGL: "); + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + fprintf(stderr, "\n"); + } +} + + unsigned driParseDebugString( const char * debug, const struct dri_debug_control * control ) @@ -194,7 +217,9 @@ void driInitExtensions( GLcontext * ctx, /* Map the static functions. Together with those mapped by remap * table, this should cover everything mesa core knows. */ +#ifdef _GLAPI_USE_REMAP_TABLE _mesa_map_static_functions(); +#endif return; } @@ -230,9 +255,6 @@ void driInitSingleExtension( GLcontext * ctx, /** * Utility function used by drivers to test the verions of other components. * - * If one of the version requirements is not met, a message is logged using - * \c __driUtilMessage. - * * \param driver_name Name of the driver. Used in error messages. * \param driActual Actual DRI version supplied __driCreateNewScreen. * \param driExpected Minimum DRI version required by the driver. @@ -244,7 +266,7 @@ void driInitSingleExtension( GLcontext * ctx, * \returns \c GL_TRUE if all version requirements are met. Otherwise, * \c GL_FALSE is returned. * - * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions2, __driUtilMessage + * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions2 * * \todo * Now that the old \c driCheckDriDdxDrmVersions function is gone, this diff --git a/mesalib/src/mesa/drivers/dri/common/utils.h b/mesalib/src/mesa/drivers/dri/common/utils.h index 02ca3feb7..de6070c39 100644 --- a/mesalib/src/mesa/drivers/dri/common/utils.h +++ b/mesalib/src/mesa/drivers/dri/common/utils.h @@ -69,6 +69,9 @@ struct __DRIutilversionRec2 { int patch; /**< Patch-level. */ }; +extern void +__driUtilMessage(const char *f, ...); + extern unsigned driParseDebugString( const char * debug, const struct dri_debug_control * control ); diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c index a6d6c999a..738b1ae97 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c +++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c @@ -36,7 +36,7 @@ #include <unistd.h> #include <errno.h> #include "main/imports.h" -#include "dri_util.h" +#include "utils.h" #include "xmlconfig.h" #undef GET_PROGRAM_NAME diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile b/mesalib/src/mesa/drivers/dri/swrast/Makefile index 771169c1f..d2cf6dbc5 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/Makefile +++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile @@ -5,6 +5,8 @@ include $(TOP)/configs/current LIBNAME = swrast_dri.so +DRIVER_DEFINES = -D__NOT_HAVE_DRM_H + DRIVER_SOURCES = \ swrast.c \ swrast_span.c @@ -17,7 +19,8 @@ ASM_SOURCES = SWRAST_COMMON_SOURCES = \ ../../common/driverfuncs.c \ - ../common/utils.c + ../common/utils.c \ + ../common/drisw_util.c include ../Makefile.template diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c index e968ce4ba..fcb785f4c 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 George Sapountzis <gsap7@yahoo.gr> + * Copyright 2008, 2010 George Sapountzis <gsapountzis@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -52,6 +52,11 @@ #include "drivers/common/meta.h" #include "utils.h" +#include "main/teximage.h" +#include "main/texfetch.h" +#include "main/texformat.h" +#include "main/texstate.h" + #include "swrast_priv.h" @@ -59,18 +64,62 @@ * Screen and config-related functions */ -static void -setupLoaderExtensions(__DRIscreen *psp, - const __DRIextension **extensions) +static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, + GLint texture_format, __DRIdrawable *dPriv) { - int i; + struct dri_context *dri_ctx; + int x, y, w, h; + __DRIscreen *sPriv = dPriv->driScreenPriv; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + uint32_t internalFormat; - for (i = 0; extensions[i]; i++) { - if (strcmp(extensions[i]->name, __DRI_SWRAST_LOADER) == 0) - psp->swrast_loader = (__DRIswrastLoaderExtension *) extensions[i]; - } + dri_ctx = pDRICtx->driverPrivate; + + internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4); + + texUnit = _mesa_get_current_tex_unit(&dri_ctx->Base); + texObj = _mesa_select_tex_object(&dri_ctx->Base, texUnit, target); + texImage = _mesa_get_tex_image(&dri_ctx->Base, texObj, target, 0); + + _mesa_lock_texture(&dri_ctx->Base, texObj); + + sPriv->swrast_loader->getDrawableInfo(dPriv, &x, &y, &w, &h, dPriv->loaderPrivate); + + _mesa_init_teximage_fields(&dri_ctx->Base, target, texImage, + w, h, 1, 0, internalFormat); + + if (texture_format == __DRI_TEXTURE_FORMAT_RGB) + texImage->TexFormat = MESA_FORMAT_XRGB8888; + else + texImage->TexFormat = MESA_FORMAT_ARGB8888; + + _mesa_set_fetch_functions(texImage, 2); + + sPriv->swrast_loader->getImage(dPriv, x, y, w, h, (char *)texImage->Data, + dPriv->loaderPrivate); + + _mesa_unlock_texture(&dri_ctx->Base, texObj); } +static void swrastSetTexBuffer(__DRIcontext *pDRICtx, GLint target, + __DRIdrawable *dPriv) +{ + swrastSetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv); +} + +static const __DRItexBufferExtension swrastTexBufferExtension = { + { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION }, + swrastSetTexBuffer, + swrastSetTexBuffer2, +}; + +static const __DRIextension *dri_screen_extensions[] = { + &swrastTexBufferExtension.base, + NULL +}; + static __DRIconfig ** swrastFillInModes(__DRIscreen *psp, unsigned pixel_bits, unsigned depth_bits, @@ -148,26 +197,14 @@ swrastFillInModes(__DRIscreen *psp, return configs; } -static __DRIscreen * -driCreateNewScreen(int scrn, const __DRIextension **extensions, - const __DRIconfig ***driver_configs, void *data) +static const __DRIconfig ** +dri_init_screen(__DRIscreen * psp) { - static const __DRIextension *emptyExtensionList[] = { NULL }; - __DRIscreen *psp; __DRIconfig **configs8, **configs16, **configs24, **configs32; - (void) data; - TRACE; - psp = calloc(1, sizeof(*psp)); - if (!psp) - return NULL; - - setupLoaderExtensions(psp, extensions); - - psp->num = scrn; - psp->extensions = emptyExtensionList; + psp->extensions = dri_screen_extensions; configs8 = swrastFillInModes(psp, 8, 8, 0, 1); configs16 = swrastFillInModes(psp, 16, 16, 0, 1); @@ -176,28 +213,15 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions, configs16 = driConcatConfigs(configs8, configs16); configs24 = driConcatConfigs(configs16, configs24); - *driver_configs = (const __DRIconfig **) - driConcatConfigs(configs24, configs32); - - driInitExtensions( NULL, NULL, GL_FALSE ); - - return psp; -} + configs32 = driConcatConfigs(configs24, configs32); -static void driDestroyScreen(__DRIscreen *psp) -{ - TRACE; - - if (psp) { - free(psp); - } + return (const __DRIconfig **)configs32; } -static const __DRIextension **driGetExtensions(__DRIscreen *psp) +static void +dri_destroy_screen(__DRIscreen * sPriv) { TRACE; - - return psp->extensions; } @@ -244,12 +268,20 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb) free(rb); } +/* see bytes_per_line in libGL */ +static INLINE int +bytes_per_line(unsigned pitch_bits, unsigned mul) +{ + unsigned mask = mul - 1; + + return ((pitch_bits + mask) & ~mask) / 8; +} + static GLboolean swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); - unsigned mask = PITCH_ALIGN_BITS - 1; TRACE; @@ -257,8 +289,7 @@ swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->Width = width; rb->Height = height; - /* always pad to PITCH_ALIGN_BITS */ - xrb->pitch = ((width * xrb->bpp + mask) & ~mask) / 8; + xrb->pitch = bytes_per_line(width * xrb->bpp, 32); return GL_TRUE; } @@ -341,94 +372,118 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) return xrb; } -static __DRIdrawable * -driCreateNewDrawable(__DRIscreen *screen, - const __DRIconfig *config, void *data) +static GLboolean +dri_create_buffer(__DRIscreen * sPriv, + __DRIdrawable * dPriv, + const __GLcontextModes * visual, GLboolean isPixmap) { - __DRIdrawable *buf; + struct dri_drawable *drawable = NULL; + GLframebuffer *fb; struct swrast_renderbuffer *frontrb, *backrb; TRACE; - buf = calloc(1, sizeof *buf); - if (!buf) - return NULL; + drawable = CALLOC_STRUCT(dri_drawable); + if (drawable == NULL) + goto drawable_fail; - buf->loaderPrivate = data; + dPriv->driverPrivate = drawable; + drawable->dPriv = dPriv; - buf->driScreenPriv = screen; + drawable->row = malloc(MAX_WIDTH * 4); + if (drawable->row == NULL) + goto drawable_fail; - buf->row = malloc(MAX_WIDTH * 4); + fb = &drawable->Base; /* basic framebuffer setup */ - _mesa_initialize_window_framebuffer(&buf->Base, &config->modes); + _mesa_initialize_window_framebuffer(fb, visual); /* add front renderbuffer */ - frontrb = swrast_new_renderbuffer(&config->modes, GL_TRUE); - _mesa_add_renderbuffer(&buf->Base, BUFFER_FRONT_LEFT, &frontrb->Base); + frontrb = swrast_new_renderbuffer(visual, GL_TRUE); + _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontrb->Base); /* add back renderbuffer */ - if (config->modes.doubleBufferMode) { - backrb = swrast_new_renderbuffer(&config->modes, GL_FALSE); - _mesa_add_renderbuffer(&buf->Base, BUFFER_BACK_LEFT, &backrb->Base); + if (visual->doubleBufferMode) { + backrb = swrast_new_renderbuffer(visual, GL_FALSE); + _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backrb->Base); } /* add software renderbuffers */ - _mesa_add_soft_renderbuffers(&buf->Base, + _mesa_add_soft_renderbuffers(fb, GL_FALSE, /* color */ - config->modes.haveDepthBuffer, - config->modes.haveStencilBuffer, - config->modes.haveAccumBuffer, + visual->haveDepthBuffer, + visual->haveStencilBuffer, + visual->haveAccumBuffer, GL_FALSE, /* alpha */ GL_FALSE /* aux bufs */); - return buf; + return GL_TRUE; + +drawable_fail: + + if (drawable) + free(drawable->row); + + FREE(drawable); + + return GL_FALSE; } static void -driDestroyDrawable(__DRIdrawable *buf) +dri_destroy_buffer(__DRIdrawable * dPriv) { TRACE; - if (buf) { - struct gl_framebuffer *fb = &buf->Base; + if (dPriv) { + struct dri_drawable *drawable = dri_drawable(dPriv); + GLframebuffer *fb; - free(buf->row); + free(drawable->row); + + fb = &drawable->Base; fb->DeletePending = GL_TRUE; _mesa_reference_framebuffer(&fb, NULL); } } -static void driSwapBuffers(__DRIdrawable *buf) +static void +dri_swap_buffers(__DRIdrawable * dPriv) { - GET_CURRENT_CONTEXT(ctx); + __DRIscreen *sPriv = dPriv->driScreenPriv; - struct swrast_renderbuffer *frontrb = - swrast_renderbuffer(buf->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer); - struct swrast_renderbuffer *backrb = - swrast_renderbuffer(buf->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer); + GET_CURRENT_CONTEXT(ctx); - __DRIscreen *screen = buf->driScreenPriv; + struct dri_drawable *drawable = dri_drawable(dPriv); + GLframebuffer *fb; + struct swrast_renderbuffer *frontrb, *backrb; TRACE; + fb = &drawable->Base; + + frontrb = + swrast_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); + backrb = + swrast_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer); + /* check for signle-buffered */ if (backrb == NULL) return; /* check if swapping currently bound buffer */ - if (ctx && ctx->DrawBuffer == &(buf->Base)) { + if (ctx && ctx->DrawBuffer == fb) { /* flush pending rendering */ _mesa_notifySwapBuffers(ctx); } - screen->swrast_loader->putImage(buf, __DRI_SWRAST_IMAGE_OP_SWAP, - 0, 0, - frontrb->Base.Width, - frontrb->Base.Height, - backrb->Base.Data, - buf->loaderPrivate); + sPriv->swrast_loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP, + 0, 0, + frontrb->Base.Width, + frontrb->Base.Height, + backrb->Base.Data, + dPriv->loaderPrivate); } @@ -439,13 +494,13 @@ static void driSwapBuffers(__DRIdrawable *buf) static void get_window_size( GLframebuffer *fb, GLsizei *w, GLsizei *h ) { - __DRIdrawable *buf = swrast_drawable(fb); - __DRIscreen *screen = buf->driScreenPriv; + __DRIdrawable *dPriv = swrast_drawable(fb)->dPriv; + __DRIscreen *sPriv = dPriv->driScreenPriv; int x, y; - screen->swrast_loader->getDrawableInfo(buf, - &x, &y, w, h, - buf->loaderPrivate); + sPriv->swrast_loader->getDrawableInfo(dPriv, + &x, &y, w, h, + dPriv->loaderPrivate); } static void @@ -493,6 +548,16 @@ viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) swrast_check_and_update_window_size(ctx, read); } +static gl_format swrastChooseTextureFormat(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type) +{ + if (internalFormat == GL_RGB) + return MESA_FORMAT_XRGB8888; + return _mesa_choose_tex_format(ctx, internalFormat, format, type); +} + static void swrast_init_driver_functions(struct dd_function_table *driver) { @@ -500,6 +565,7 @@ swrast_init_driver_functions(struct dd_function_table *driver) driver->UpdateState = update_state; driver->GetBufferSize = NULL; driver->Viewport = viewport; + driver->ChooseTextureFormat = swrastChooseTextureFormat; } @@ -507,37 +573,41 @@ swrast_init_driver_functions(struct dd_function_table *driver) * Context-related functions. */ -static __DRIcontext * -driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config, - __DRIcontext *shared, void *data) +static GLboolean +dri_create_context(gl_api api, + const __GLcontextModes * visual, + __DRIcontext * cPriv, void *sharedContextPrivate) { - __DRIcontext *ctx; - GLcontext *mesaCtx; + struct dri_context *ctx = NULL; + struct dri_context *share = (struct dri_context *)sharedContextPrivate; + GLcontext *mesaCtx = NULL; + GLcontext *sharedCtx = NULL; struct dd_function_table functions; TRACE; - ctx = calloc(1, sizeof *ctx); - if (!ctx) - return NULL; - - ctx->loaderPrivate = data; + ctx = CALLOC_STRUCT(dri_context); + if (ctx == NULL) + goto context_fail; - ctx->driScreenPriv = screen; + cPriv->driverPrivate = ctx; + ctx->cPriv = cPriv; /* build table of device driver functions */ _mesa_init_driver_functions(&functions); swrast_init_driver_functions(&functions); - if (!_mesa_initialize_context(&ctx->Base, &config->modes, - shared ? &shared->Base : NULL, - &functions, (void *) ctx)) { - free(ctx); - return NULL; + if (share) { + sharedCtx = &share->Base; } mesaCtx = &ctx->Base; + /* basic context setup */ + if (!_mesa_initialize_context(mesaCtx, visual, sharedCtx, &functions, (void *) cPriv)) { + goto context_fail; + } + /* do bounds checking to prevent segfaults and server crashes! */ mesaCtx->Const.CheckArrayBounds = GL_TRUE; @@ -563,17 +633,28 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config, _mesa_meta_init(mesaCtx); - return ctx; + driInitExtensions( mesaCtx, NULL, GL_FALSE ); + + return GL_TRUE; + +context_fail: + + FREE(ctx); + + return GL_FALSE; } static void -driDestroyContext(__DRIcontext *ctx) +dri_destroy_context(__DRIcontext * cPriv) { - GLcontext *mesaCtx; TRACE; - if (ctx) { + if (cPriv) { + struct dri_context *ctx = dri_context(cPriv); + GLcontext *mesaCtx; + mesaCtx = &ctx->Base; + _mesa_meta_free(mesaCtx); _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); @@ -583,28 +664,26 @@ driDestroyContext(__DRIcontext *ctx) } } -static int -driCopyContext(__DRIcontext *dst, __DRIcontext *src, unsigned long mask) -{ - TRACE; - - _mesa_copy_context(&src->Base, &dst->Base, mask); - return GL_TRUE; -} - -static int driBindContext(__DRIcontext *ctx, - __DRIdrawable *draw, - __DRIdrawable *read) +static GLboolean +dri_make_current(__DRIcontext * cPriv, + __DRIdrawable * driDrawPriv, + __DRIdrawable * driReadPriv) { GLcontext *mesaCtx; GLframebuffer *mesaDraw; GLframebuffer *mesaRead; TRACE; - if (ctx) { - if (!draw || !read) + if (cPriv) { + struct dri_context *ctx = dri_context(cPriv); + struct dri_drawable *draw; + struct dri_drawable *read; + + if (!driDrawPriv || !driReadPriv) return GL_FALSE; + draw = dri_drawable(driDrawPriv); + read = dri_drawable(driReadPriv); mesaCtx = &ctx->Base; mesaDraw = &draw->Base; mesaRead = &read->Base; @@ -619,7 +698,7 @@ static int driBindContext(__DRIcontext *ctx, _glapi_check_multithread(); swrast_check_and_update_window_size(mesaCtx, mesaDraw); - if (read != draw) + if (mesaRead != mesaDraw) swrast_check_and_update_window_size(mesaCtx, mesaRead); _mesa_make_current( mesaCtx, @@ -634,35 +713,29 @@ static int driBindContext(__DRIcontext *ctx, return GL_TRUE; } -static int driUnbindContext(__DRIcontext *ctx) +static GLboolean +dri_unbind_context(__DRIcontext * cPriv) { TRACE; - (void) ctx; + (void) cPriv; + + /* Unset current context and dispath table */ + _mesa_make_current(NULL, NULL, NULL); + return GL_TRUE; } -static const __DRIcoreExtension driCoreExtension = { - { __DRI_CORE, __DRI_CORE_VERSION }, - NULL, /* driCreateNewScreen */ - driDestroyScreen, - driGetExtensions, - driGetConfigAttrib, - driIndexConfigAttrib, - NULL, /* driCreateNewDrawable */ - driDestroyDrawable, - driSwapBuffers, - driCreateNewContext, - driCopyContext, - driDestroyContext, - driBindContext, - driUnbindContext -}; - -static const __DRIswrastExtension driSWRastExtension = { - { __DRI_SWRAST, __DRI_SWRAST_VERSION }, - driCreateNewScreen, - driCreateNewDrawable +const struct __DriverAPIRec driDriverAPI = { + /*.InitScreen = */dri_init_screen, + /*.DestroyScreen = */dri_destroy_screen, + /*.CreateContext = */dri_create_context, + /*.DestroyContext = */dri_destroy_context, + /*.CreateBuffer = */dri_create_buffer, + /*.DestroyBuffer = */dri_destroy_buffer, + /*.SwapBuffers = */dri_swap_buffers, + /*.MakeCurrent = */dri_make_current, + /*.UnbindContext = */dri_unbind_context, }; /* This is the table of extensions that the loader will dlsym() for. */ diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h index 17212be83..ebef8455a 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -3,6 +3,7 @@ * Version: 7.1 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright 2008, 2010 George Sapountzis <gsapountzis@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -22,11 +23,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* - * Authors: - * George Sapountzis <gsap7@yahoo.gr> - */ - #ifndef _SWRAST_PRIV_H #define _SWRAST_PRIV_H @@ -34,6 +30,7 @@ #include <GL/gl.h> #include <GL/internal/dri_interface.h> #include "main/mtypes.h" +#include "drisw_util.h" #ifdef _MSC_VER #ifdef PUBLIC @@ -65,33 +62,51 @@ /** * Data types */ -struct __DRIscreenRec { - int num; - - const __DRIextension **extensions; +struct dri_context +{ + /* mesa, base class, must be first */ + GLcontext Base; - const __DRIswrastLoaderExtension *swrast_loader; + /* dri */ + __DRIcontext *cPriv; }; -struct __DRIcontextRec { - GLcontext Base; - - void *loaderPrivate; +static INLINE struct dri_context * +dri_context(__DRIcontext * driContextPriv) +{ + return (struct dri_context *)driContextPriv->driverPrivate; +} - __DRIscreen *driScreenPriv; -}; +static INLINE struct dri_context * +swrast_context(GLcontext *ctx) +{ + return (struct dri_context *) ctx; +} -struct __DRIdrawableRec { +struct dri_drawable +{ + /* mesa, base class, must be first */ GLframebuffer Base; - void *loaderPrivate; - - __DRIscreen *driScreenPriv; + /* dri */ + __DRIdrawable *dPriv; /* scratch row for optimized front-buffer rendering */ char *row; }; +static INLINE struct dri_drawable * +dri_drawable(__DRIdrawable * driDrawPriv) +{ + return (struct dri_drawable *)driDrawPriv->driverPrivate; +} + +static INLINE struct dri_drawable * +swrast_drawable(GLframebuffer *fb) +{ + return (struct dri_drawable *) fb; +} + struct swrast_renderbuffer { struct gl_renderbuffer Base; @@ -101,18 +116,6 @@ struct swrast_renderbuffer { GLuint bpp; }; -static INLINE __DRIcontext * -swrast_context(GLcontext *ctx) -{ - return (__DRIcontext *) ctx; -} - -static INLINE __DRIdrawable * -swrast_drawable(GLframebuffer *fb) -{ - return (__DRIdrawable *) fb; -} - static INLINE struct swrast_renderbuffer * swrast_renderbuffer(struct gl_renderbuffer *rb) { @@ -128,14 +131,6 @@ swrast_renderbuffer(struct gl_renderbuffer *rb) #define PF_R3G3B2 3 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */ #define PF_X8R8G8B8 4 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */ -/** - * Renderbuffer pitch alignment (in bits). - * - * The xorg loader requires padding images to 32 bits. However, this should - * become a screen/drawable parameter XXX - */ -#define PITCH_ALIGN_BITS 32 - /* swrast_span.c */ diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c index d896e154f..c7d0bfdac 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c @@ -3,6 +3,7 @@ * Version: 7.1 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright 2008, 2010 George Sapountzis <gsapountzis@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -22,11 +23,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* - * Authors: - * George Sapountzis <gsap7@yahoo.gr> - */ - #include "swrast_priv.h" #define YFLIP(_xrb, Y) ((_xrb)->Base.Height - (Y) - 1) diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h index 848736171..1e9405eeb 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h @@ -39,8 +39,8 @@ static INLINE void PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p ) { - __DRIcontext *ctx = swrast_context(glCtx); - __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer); + __DRIcontext *ctx = swrast_context(glCtx)->cPriv; + __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv; __DRIscreen *screen = ctx->driScreenPriv; @@ -53,8 +53,8 @@ PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p ) static INLINE void GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) { - __DRIcontext *ctx = swrast_context(glCtx); - __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer); + __DRIcontext *ctx = swrast_context(glCtx)->cPriv; + __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv; __DRIscreen *screen = ctx->driScreenPriv; @@ -65,8 +65,8 @@ GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p ) static INLINE void PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) { - __DRIcontext *ctx = swrast_context(glCtx); - __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer); + __DRIcontext *ctx = swrast_context(glCtx)->cPriv; + __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv; __DRIscreen *screen = ctx->driScreenPriv; @@ -78,8 +78,8 @@ PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) static INLINE void GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row ) { - __DRIcontext *ctx = swrast_context(glCtx); - __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer); + __DRIcontext *ctx = swrast_context(glCtx)->cPriv; + __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv; __DRIscreen *screen = ctx->driScreenPriv; diff --git a/mesalib/src/mesa/main/APIspec.dtd b/mesalib/src/mesa/main/APIspec.dtd new file mode 100644 index 000000000..efcfa31f1 --- /dev/null +++ b/mesalib/src/mesa/main/APIspec.dtd @@ -0,0 +1,52 @@ +<!ELEMENT apispec (template|api)+> + +<!ELEMENT api (category*, function*)> +<!ELEMENT category EMPTY> +<!ELEMENT function EMPTY> + +<!ELEMENT template (proto, desc*)> +<!ELEMENT proto (return, (param|vector)*)> +<!ELEMENT return EMPTY> +<!ELEMENT param EMPTY> +<!ELEMENT vector (param*)> +<!ELEMENT desc ((value|range)*, desc*)> +<!ELEMENT value EMPTY> +<!ELEMENT range EMPTY> + +<!ATTLIST api name NMTOKEN #REQUIRED + implementation (true | false) "false"> +<!ATTLIST category name NMTOKEN #REQUIRED> +<!ATTLIST function name NMTOKEN #REQUIRED + default_prefix NMTOKEN "_mesa_" + external (true | false) "false" + template NMTOKEN #REQUIRED + gltype CDATA #IMPLIED + vector_size NMTOKEN #IMPLIED + expand_vector (true | false) "false" + skip_desc (true | false) "false"> + +<!ATTLIST template name NMTOKEN #REQUIRED + direction (set | get) "set"> + +<!ATTLIST return type CDATA #REQUIRED> +<!ATTLIST param name NMTOKEN #REQUIRED + type CDATA #REQUIRED + hide_if_expanded (true | false) "false" + category NMTOKEN #IMPLIED> +<!ATTLIST vector name NMTOKEN #REQUIRED + type CDATA #REQUIRED + size NMTOKEN #REQUIRED + category NMTOKEN #IMPLIED> + +<!ATTLIST desc name NMTOKEN #REQUIRED + vector_size CDATA #IMPLIED + convert (true | false) #IMPLIED + error NMTOKEN "GL_INVALID_ENUM" + category NMTOKEN #IMPLIED> + +<!ATTLIST value name CDATA #REQUIRED + category NMTOKEN #IMPLIED> +<!ATTLIST range from NMTOKEN #REQUIRED + to NMTOKEN #REQUIRED + base NMTOKEN #IMPLIED + category NMTOKEN #IMPLIED> diff --git a/mesalib/src/mesa/main/APIspec.py b/mesalib/src/mesa/main/APIspec.py new file mode 100644 index 000000000..6947f7301 --- /dev/null +++ b/mesalib/src/mesa/main/APIspec.py @@ -0,0 +1,617 @@ +#!/usr/bin/python +# +# Copyright (C) 2009 Chia-I Wu <olv@0xlab.org> +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +""" +A parser for APIspec. +""" + +class SpecError(Exception): + """Error in the spec file.""" + + +class Spec(object): + """A Spec is an abstraction of the API spec.""" + + def __init__(self, doc): + self.doc = doc + + self.spec_node = doc.getRootElement() + self.tmpl_nodes = {} + self.api_nodes = {} + self.impl_node = None + + # parse <apispec> + node = self.spec_node.children + while node: + if node.type == "element": + if node.name == "template": + self.tmpl_nodes[node.prop("name")] = node + elif node.name == "api": + self.api_nodes[node.prop("name")] = node + else: + raise SpecError("unexpected node %s in apispec" % + node.name) + node = node.next + + # find an implementation + for name, node in self.api_nodes.iteritems(): + if node.prop("implementation") == "true": + self.impl_node = node + break + if not self.impl_node: + raise SpecError("unable to find an implementation") + + def get_impl(self): + """Return the implementation.""" + return API(self, self.impl_node) + + def get_api(self, name): + """Return an API.""" + return API(self, self.api_nodes[name]) + + +class API(object): + """An API consists of categories and functions.""" + + def __init__(self, spec, api_node): + self.name = api_node.prop("name") + self.is_impl = (api_node.prop("implementation") == "true") + + self.categories = [] + self.functions = [] + + # parse <api> + func_nodes = [] + node = api_node.children + while node: + if node.type == "element": + if node.name == "category": + cat = node.prop("name") + self.categories.append(cat) + elif node.name == "function": + func_nodes.append(node) + else: + raise SpecError("unexpected node %s in api" % node.name) + node = node.next + + # realize functions + for func_node in func_nodes: + tmpl_node = spec.tmpl_nodes[func_node.prop("template")] + try: + func = Function(tmpl_node, func_node, self.is_impl, + self.categories) + except SpecError, e: + func_name = func_node.prop("name") + raise SpecError("failed to parse %s: %s" % (func_name, e)) + self.functions.append(func) + + def match(self, func, conversions={}): + """Find a matching function in the API.""" + match = None + need_conv = False + for f in self.functions: + matched, conv = f.match(func, conversions) + if matched: + match = f + need_conv = conv + # exact match + if not need_conv: + break + return (match, need_conv) + + +class Function(object): + """Parse and realize a <template> node.""" + + def __init__(self, tmpl_node, func_node, force_skip_desc=False, categories=[]): + self.tmpl_name = tmpl_node.prop("name") + self.direction = tmpl_node.prop("direction") + + self.name = func_node.prop("name") + self.prefix = func_node.prop("default_prefix") + self.is_external = (func_node.prop("external") == "true") + + if force_skip_desc: + self._skip_desc = True + else: + self._skip_desc = (func_node.prop("skip_desc") == "true") + + self._categories = categories + + # these attributes decide how the template is realized + self._gltype = func_node.prop("gltype") + if func_node.hasProp("vector_size"): + self._vector_size = int(func_node.prop("vector_size")) + else: + self._vector_size = 0 + self._expand_vector = (func_node.prop("expand_vector") == "true") + + self.return_type = "void" + param_nodes = [] + + # find <proto> + proto_node = tmpl_node.children + while proto_node: + if proto_node.type == "element" and proto_node.name == "proto": + break + proto_node = proto_node.next + if not proto_node: + raise SpecError("no proto") + # and parse it + node = proto_node.children + while node: + if node.type == "element": + if node.name == "return": + self.return_type = node.prop("type") + elif node.name == "param" or node.name == "vector": + if self.support_node(node): + # make sure the node is not hidden + if not (self._expand_vector and + (node.prop("hide_if_expanded") == "true")): + param_nodes.append(node) + else: + raise SpecError("unexpected node %s in proto" % node.name) + node = node.next + + self._init_params(param_nodes) + self._init_descs(tmpl_node, param_nodes) + + def __str__(self): + return "%s %s%s(%s)" % (self.return_type, self.prefix, self.name, + self.param_string(True)) + + def _init_params(self, param_nodes): + """Parse and initialize parameters.""" + self.params = [] + + for param_node in param_nodes: + size = self.param_node_size(param_node) + # when no expansion, vector is just like param + if param_node.name == "param" or not self._expand_vector: + param = Parameter(param_node, self._gltype, size) + self.params.append(param) + continue + + if not size or size > param_node.lsCountNode(): + raise SpecError("could not expand %s with unknown or " + "mismatch sizes" % param.name) + + # expand the vector + expanded_params = [] + child = param_node.children + while child: + if (child.type == "element" and child.name == "param" and + self.support_node(child)): + expanded_params.append(Parameter(child, self._gltype)) + if len(expanded_params) == size: + break + child = child.next + # just in case that lsCountNode counts unknown nodes + if len(expanded_params) < size: + raise SpecError("not enough named parameters") + + self.params.extend(expanded_params) + + def _init_descs(self, tmpl_node, param_nodes): + """Parse and initialize parameter descriptions.""" + self.checker = Checker() + if self._skip_desc: + return + + node = tmpl_node.children + while node: + if node.type == "element" and node.name == "desc": + if self.support_node(node): + # parse <desc> + desc = Description(node, self._categories) + self.checker.add_desc(desc) + node = node.next + + self.checker.validate(self, param_nodes) + + def support_node(self, node): + """Return true if a node is in the supported category.""" + return (not node.hasProp("category") or + node.prop("category") in self._categories) + + def get_param(self, name): + """Return the named parameter.""" + for param in self.params: + if param.name == name: + return param + return None + + def param_node_size(self, param): + """Return the size of a vector.""" + if param.name != "vector": + return 0 + + size = param.prop("size") + if size.isdigit(): + size = int(size) + else: + size = 0 + if not size: + size = self._vector_size + if not size and self._expand_vector: + # return the number of named parameters + size = param.lsCountNode() + return size + + def param_string(self, declaration): + """Return the C code of the parameters.""" + args = [] + if declaration: + for param in self.params: + sep = "" if param.type.endswith("*") else " " + args.append("%s%s%s" % (param.type, sep, param.name)) + if not args: + args.append("void") + else: + for param in self.params: + args.append(param.name) + return ", ".join(args) + + def match(self, other, conversions={}): + """Return true if the functions match, probably with a conversion.""" + if (self.tmpl_name != other.tmpl_name or + self.return_type != other.return_type or + len(self.params) != len(other.params)): + return (False, False) + + need_conv = False + for i in xrange(len(self.params)): + src = other.params[i] + dst = self.params[i] + if (src.is_vector != dst.is_vector or src.size != dst.size): + return (False, False) + if src.type != dst.type: + if dst.base_type() in conversions.get(src.base_type(), []): + need_conv = True + else: + # unable to convert + return (False, False) + + return (True, need_conv) + + +class Parameter(object): + """A parameter of a function.""" + + def __init__(self, param_node, gltype=None, size=0): + self.is_vector = (param_node.name == "vector") + + self.name = param_node.prop("name") + self.size = size + + type = param_node.prop("type") + if gltype: + type = type.replace("GLtype", gltype) + elif type.find("GLtype") != -1: + raise SpecError("parameter %s has unresolved type" % self.name) + + self.type = type + + def base_type(self): + """Return the base GL type by stripping qualifiers.""" + return [t for t in self.type.split(" ") if t.startswith("GL")][0] + + +class Checker(object): + """A checker is the collection of all descriptions on the same level. + Descriptions of the same parameter are concatenated. + """ + + def __init__(self): + self.switches = {} + self.switch_constants = {} + + def add_desc(self, desc): + """Add a description.""" + # TODO allow index to vary + const_attrs = ["index", "error", "convert", "size_str"] + if desc.name not in self.switches: + self.switches[desc.name] = [] + self.switch_constants[desc.name] = {} + for attr in const_attrs: + self.switch_constants[desc.name][attr] = None + + # some attributes, like error code, should be the same for all descs + consts = self.switch_constants[desc.name] + for attr in const_attrs: + if getattr(desc, attr) is not None: + if (consts[attr] is not None and + consts[attr] != getattr(desc, attr)): + raise SpecError("mismatch %s for %s" % (attr, desc.name)) + consts[attr] = getattr(desc, attr) + + self.switches[desc.name].append(desc) + + def validate(self, func, param_nodes): + """Validate the checker against a function.""" + tmp = Checker() + + for switch in self.switches.itervalues(): + valid_descs = [] + for desc in switch: + if desc.validate(func, param_nodes): + valid_descs.append(desc) + # no possible values + if not valid_descs: + return False + for desc in valid_descs: + if not desc._is_noop: + tmp.add_desc(desc) + + self.switches = tmp.switches + self.switch_constants = tmp.switch_constants + return True + + def flatten(self, name=None): + """Return a flat list of all descriptions of the named parameter.""" + flat_list = [] + for switch in self.switches.itervalues(): + for desc in switch: + if not name or desc.name == name: + flat_list.append(desc) + flat_list.extend(desc.checker.flatten(name)) + return flat_list + + def always_check(self, name): + """Return true if the parameter is checked in all possible pathes.""" + if name in self.switches: + return True + + # a param is always checked if any of the switch always checks it + for switch in self.switches.itervalues(): + # a switch always checks it if all of the descs always check it + always = True + for desc in switch: + if not desc.checker.always_check(name): + always = False + break + if always: + return True + return False + + def _c_switch(self, name, indent="\t"): + """Output C switch-statement for the named parameter, for debug.""" + switch = self.switches.get(name, []) + # make sure there are valid values + need_switch = False + for desc in switch: + if desc.values: + need_switch = True + if not need_switch: + return [] + + stmts = [] + var = switch[0].name + if switch[0].index >= 0: + var += "[%d]" % switch[0].index + stmts.append("switch (%s) { /* assume GLenum */" % var) + + for desc in switch: + if desc.values: + for val in desc.values: + stmts.append("case %s:" % val) + for dep_name in desc.checker.switches.iterkeys(): + dep_stmts = [indent + s for s in desc.checker._c_switch(dep_name, indent)] + stmts.extend(dep_stmts) + stmts.append(indent + "break;") + + stmts.append("default:") + stmts.append(indent + "ON_ERROR(%s);" % switch[0].error); + stmts.append(indent + "break;") + stmts.append("}") + + return stmts + + def dump(self, indent="\t"): + """Dump the descriptions in C code.""" + stmts = [] + for name in self.switches.iterkeys(): + c_switch = self._c_switch(name) + print "\n".join(c_switch) + + +class Description(object): + """A description desribes a parameter and its relationship with other + parameters. + """ + + def __init__(self, desc_node, categories=[]): + self._categories = categories + self._is_noop = False + + self.name = desc_node.prop("name") + self.index = -1 + + self.error = desc_node.prop("error") or "GL_INVALID_ENUM" + # vector_size may be C code + self.size_str = desc_node.prop("vector_size") + + self._has_enum = False + self.values = [] + dep_nodes = [] + + # parse <desc> + valid_names = ["value", "range", "desc"] + node = desc_node.children + while node: + if node.type == "element": + if node.name in valid_names: + # ignore nodes that require unsupported categories + if (node.prop("category") and + node.prop("category") not in self._categories): + node = node.next + continue + else: + raise SpecError("unexpected node %s in desc" % node.name) + + if node.name == "value": + val = node.prop("name") + if not self._has_enum and val.startswith("GL_"): + self._has_enum = True + self.values.append(val) + elif node.name == "range": + first = int(node.prop("from")) + last = int(node.prop("to")) + base = node.prop("base") or "" + if not self._has_enum and base.startswith("GL_"): + self._has_enum = True + # expand range + for i in xrange(first, last + 1): + self.values.append("%s%d" % (base, i)) + else: # dependent desc + dep_nodes.append(node) + node = node.next + + # default to convert if there is no enum + self.convert = not self._has_enum + if desc_node.hasProp("convert"): + self.convert = (desc_node.prop("convert") == "true") + + self._init_deps(dep_nodes) + + def _init_deps(self, dep_nodes): + """Parse and initialize dependents.""" + self.checker = Checker() + + for dep_node in dep_nodes: + # recursion! + dep = Description(dep_node, self._categories) + self.checker.add_desc(dep) + + def _search_param_node(self, param_nodes, name=None): + """Search the template parameters for the named node.""" + param_node = None + param_index = -1 + + if not name: + name = self.name + for node in param_nodes: + if name == node.prop("name"): + param_node = node + elif node.name == "vector": + child = node.children + idx = 0 + while child: + if child.type == "element" and child.name == "param": + if name == child.prop("name"): + param_node = node + param_index = idx + break + idx += 1 + child = child.next + if param_node: + break + return (param_node, param_index) + + def _find_final(self, func, param_nodes): + """Find the final parameter.""" + param = func.get_param(self.name) + param_index = -1 + + # the described param is not in the final function + if not param: + # search the template parameters + node, index = self._search_param_node(param_nodes) + if not node: + raise SpecError("invalid desc %s in %s" % + (self.name, func.name)) + + # a named parameter of a vector + if index >= 0: + param = func.get_param(node.prop("name")) + param_index = index + elif node.name == "vector": + # must be an expanded vector, check its size + if self.size_str and self.size_str.isdigit(): + size = int(self.size_str) + expanded_size = func.param_node_size(node) + if size != expanded_size: + return (False, None, -1) + # otherwise, it is a valid, but no-op, description + + return (True, param, param_index) + + def validate(self, func, param_nodes): + """Validate a description against certain function.""" + if self.checker.switches and not self.values: + raise SpecError("no valid values for %s" % self.name) + + valid, param, param_index = self._find_final(func, param_nodes) + if not valid: + return False + + # the description is valid, but the param is gone + # mark it no-op so that it will be skipped + if not param: + self._is_noop = True + return True + + if param.is_vector: + # if param was known, this should have been done in __init__ + if self._has_enum: + self.size_str = "1" + # size mismatch + if (param.size and self.size_str and self.size_str.isdigit() and + param.size != int(self.size_str)): + return False + elif self.size_str: + # only vector accepts vector_size + raise SpecError("vector_size is invalid for %s" % param.name) + + if not self.checker.validate(func, param_nodes): + return False + + # update the description + self.name = param.name + self.index = param_index + + return True + + +def main(): + import libxml2 + + filename = "APIspec.xml" + apinames = ["GLES1.1", "GLES2.0"] + + doc = libxml2.readFile(filename, None, + libxml2.XML_PARSE_DTDLOAD + + libxml2.XML_PARSE_DTDVALID + + libxml2.XML_PARSE_NOBLANKS) + + spec = Spec(doc) + impl = spec.get_impl() + for apiname in apinames: + spec.get_api(apiname) + + doc.freeDoc() + + print "%s is successfully parsed" % filename + + +if __name__ == "__main__": + main() diff --git a/mesalib/src/mesa/main/APIspec.xml b/mesalib/src/mesa/main/APIspec.xml new file mode 100644 index 000000000..4c5fd59d4 --- /dev/null +++ b/mesalib/src/mesa/main/APIspec.xml @@ -0,0 +1,4332 @@ +<?xml version="1.0"?> +<!DOCTYPE apispec SYSTEM "APIspec.dtd"> + +<!-- A function is generated from a template. Multiple functions can be + generated from a single template with different arguments. For example, + glColor3f can be generated from + + <function name="Color3f" template="Color" gltype="GLfloat" vector_size="3" expand_vector="true"/> + + and glColor4iv can be generated from + + <function name="Color4iv" template="Color" gltype="GLint" vector_size="4"/> + + In a template, there are <desc>s that describe the properties of + parameters. A <desc> can enumerate the valid values of a parameter. It + can also specify the error code when an invalid value is given, and etc. + By nesting <desc>s, they can create dependency between parameters. + + A function can be marked as external. It means that the function cannot + be dispatched to the corresponding mesa function, if one exists, directly, + and requires an external implementation. +--> + +<apispec> + +<template name="Color"> + <proto> + <return type="void"/> + <vector name="v" type="const GLtype *" size="dynamic"> + <param name="red" type="GLtype"/> + <param name="green" type="GLtype"/> + <param name="blue" type="GLtype"/> + <param name="alpha" type="GLtype"/> + </vector> + </proto> +</template> + +<template name="ClipPlane"> + <proto> + <return type="void"/> + <param name="plane" type="GLenum"/> + <vector name="equation" type="const GLtype *" size="4"/> + </proto> + + <desc name="plane"> + <range base="GL_CLIP_PLANE" from="0" to="5"/> + </desc> +</template> + +<template name="CullFace"> + <proto> + <return type="void"/> + <param name="mode" type="GLenum"/> + </proto> + + <desc name="mode"> + <value name="GL_FRONT"/> + <value name="GL_BACK"/> + <value name="GL_FRONT_AND_BACK"/> + </desc> +</template> + +<template name="Fog"> + <proto> + <return type="void"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="const GLtype *" size="dynamic"> + <param name="param" type="GLtype"/> + </vector> + </proto> + + <desc name="pname"> + <value name="GL_FOG_MODE"/> + <desc name="param"> + <value name="GL_EXP"/> + <value name="GL_EXP2"/> + <value name="GL_LINEAR"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_FOG_COLOR"/> + + <desc name="params" vector_size="4"/> + </desc> + + <desc name="pname"> + <value name="GL_FOG_DENSITY"/> + <value name="GL_FOG_START"/> + <value name="GL_FOG_END"/> + + <desc name="params" vector_size="1"/> + </desc> +</template> + +<template name="FrontFace"> + <proto> + <return type="void"/> + <param name="mode" type="GLenum"/> + </proto> + + <desc name="mode"> + <value name="GL_CW"/> + <value name="GL_CCW"/> + </desc> +</template> + +<template name="Hint"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="mode" type="GLenum"/> + </proto> + + <desc name="target" category="GLES1.1"> + <value name="GL_FOG_HINT"/> + <value name="GL_LINE_SMOOTH_HINT"/> + <value name="GL_PERSPECTIVE_CORRECTION_HINT"/> + <value name="GL_POINT_SMOOTH_HINT"/> + </desc> + <desc name="target" category="OES_standard_derivatives"> + <value name="GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES"/> + </desc> + <desc name="target"> + <value name="GL_GENERATE_MIPMAP_HINT"/> + </desc> + + <desc name="mode"> + <value name="GL_FASTEST"/> + <value name="GL_NICEST"/> + <value name="GL_DONT_CARE"/> + </desc> +</template> + +<template name="Light"> + <proto> + <return type="void"/> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="const GLtype *" size="dynamic"> + <param name="param" type="GLtype"/> + </vector> + </proto> + + <desc name="light"> + <range base="GL_LIGHT" from="0" to="7"/> + </desc> + + <desc name="pname"> + <value name="GL_AMBIENT"/> + <value name="GL_DIFFUSE"/> + <value name="GL_SPECULAR"/> + <value name="GL_POSITION"/> + + <desc name="params" vector_size="4"/> + </desc> + + <desc name="pname"> + <value name="GL_SPOT_DIRECTION"/> + + <desc name="params" vector_size="3"/> + </desc> + + <desc name="pname"> + <value name="GL_SPOT_EXPONENT"/> + <value name="GL_SPOT_CUTOFF"/> + <value name="GL_CONSTANT_ATTENUATION"/> + <value name="GL_LINEAR_ATTENUATION"/> + <value name="GL_QUADRATIC_ATTENUATION"/> + + <desc name="params" vector_size="1"/> + </desc> +</template> + +<template name="LightModel"> + <proto> + <return type="void"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="const GLtype *" size="dynamic"> + <param name="param" type="GLtype"/> + </vector> + </proto> + + <desc name="pname"> + <value name="GL_LIGHT_MODEL_AMBIENT"/> + + <desc name="params" vector_size="4"/> + </desc> + + <desc name="pname"> + <value name="GL_LIGHT_MODEL_TWO_SIDE"/> + <desc name="param"> + <value name="GL_TRUE"/> + <value name="GL_FALSE"/> + </desc> + </desc> +</template> + +<template name="LineWidth"> + <proto> + <return type="void"/> + <param name="width" type="GLtype"/> + </proto> +</template> + +<template name="Material"> + <proto> + <return type="void"/> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="const GLtype *" size="dynamic"> + <param name="param" type="GLtype"/> + </vector> + </proto> + + <desc name="face"> + <value name="GL_FRONT_AND_BACK"/> + </desc> + + <desc name="pname"> + <value name="GL_AMBIENT"/> + <value name="GL_DIFFUSE"/> + <value name="GL_AMBIENT_AND_DIFFUSE"/> + <value name="GL_SPECULAR"/> + <value name="GL_EMISSION"/> + + <desc name="params" vector_size="4"/> + </desc> + + <desc name="pname"> + <value name="GL_SHININESS"/> + + <desc name="params" vector_size="1"/> + </desc> +</template> + +<template name="PointSize"> + <proto> + <return type="void"/> + <param name="size" type="GLtype"/> + </proto> +</template> + +<template name="PointSizePointer"> + <proto> + <return type="void"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </proto> + + <desc name="type"> + <value name="GL_FLOAT"/> + <value name="GL_FIXED"/> + </desc> +</template> + +<template name="Scissor"> + <proto> + <return type="void"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </proto> +</template> + +<template name="ShadeModel"> + <proto> + <return type="void"/> + <param name="mode" type="GLenum"/> + </proto> + + <desc name="mode"> + <value name="GL_FLAT"/> + <value name="GL_SMOOTH"/> + </desc> +</template> + +<template name="TexParameter"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="const GLtype *" size="dynamic"> + <param name="param" type="GLtype"/> + </vector> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/> + </desc> + + <desc name="pname"> + <value name="GL_TEXTURE_WRAP_S"/> + <value name="GL_TEXTURE_WRAP_T"/> + <value name="GL_TEXTURE_WRAP_R_OES" category="OES_texture_3D"/> + + <desc name="param"> + <value name="GL_CLAMP_TO_EDGE"/> + <value name="GL_REPEAT"/> + <value name="GL_MIRRORED_REPEAT" category="GLES2.0"/> + <value name="GL_MIRRORED_REPEAT_OES" category="OES_texture_mirrored_repeat"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_TEXTURE_MIN_FILTER"/> + + <desc name="param"> + <value name="GL_NEAREST"/> + <value name="GL_LINEAR"/> + <value name="GL_NEAREST_MIPMAP_NEAREST"/> + <value name="GL_NEAREST_MIPMAP_LINEAR"/> + <value name="GL_LINEAR_MIPMAP_NEAREST"/> + <value name="GL_LINEAR_MIPMAP_LINEAR"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_TEXTURE_MAG_FILTER"/> + + <desc name="param"> + <value name="GL_NEAREST"/> + <value name="GL_LINEAR"/> + </desc> + </desc> + + <desc name="pname" category="GLES1.1"> + <value name="GL_GENERATE_MIPMAP"/> + + <desc name="param"> + <value name="GL_TRUE"/> + <value name="GL_FALSE"/> + </desc> + </desc> + + <desc name="pname" category="EXT_texture_filter_anisotropic"> + <value name="GL_TEXTURE_MAX_ANISOTROPY_EXT"/> + <desc name="params" vector_size="1"/> + </desc> + + <desc name="pname" category="OES_draw_texture"> + <value name="GL_TEXTURE_CROP_RECT_OES"/> + <desc name="params" vector_size="4"/> + </desc> +</template> + +<template name="TexImage2D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalFormat" type="GLint"/> <!-- should be GLenum --> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/> + </desc> + + <desc name="internalFormat" error="GL_INVALID_VALUE"> + <value name="GL_ALPHA"/> + <value name="GL_RGB"/> + <value name="GL_RGBA"/> + <value name="GL_LUMINANCE"/> + <value name="GL_LUMINANCE_ALPHA"/> + <value name="GL_DEPTH_COMPONENT" category="OES_depth_texture"/> + <value name="GL_DEPTH_STENCIL_OES" category="OES_packed_depth_stencil"/> + </desc> + + <desc name="border" error="GL_INVALID_VALUE"> + <value name="0"/> + </desc> + + <desc name="format"> + <value name="GL_ALPHA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGB"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_5_6_5"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGBA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_4_4_4_4"/> + <value name="GL_UNSIGNED_SHORT_5_5_5_1"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE_ALPHA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format" category="OES_depth_texture"> + <value name="GL_DEPTH_COMPONENT"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_SHORT"/> + <value name="GL_UNSIGNED_INT"/> + </desc> + </desc> + + <desc name="format" category="OES_packed_depth_stencil"> + <value name="GL_DEPTH_STENCIL_OES"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_INT_24_8_OES"/> + </desc> + </desc> +</template> + +<template name="TexEnv"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="const GLtype *" size="dynamic"> + <param name="param" type="GLtype"/> + </vector> + </proto> + + <desc name="target" category="OES_point_sprite"> + <value name="GL_POINT_SPRITE_OES"/> + + <desc name="pname"> + <value name="GL_COORD_REPLACE_OES"/> + </desc> + </desc> + + <desc name="pname" category="OES_point_sprite"> + <value name="GL_COORD_REPLACE_OES"/> + + <desc name="param"> + <value name="GL_TRUE"/> + <value name="GL_FALSE"/> + </desc> + </desc> + + <desc name="target" category="EXT_texture_lod_bias"> + <value name="GL_TEXTURE_FILTER_CONTROL_EXT"/> + + <desc name="pname"> + <value name="GL_TEXTURE_LOD_BIAS_EXT"/> + </desc> + </desc> + + <desc name="pname" category="EXT_texture_lod_bias"> + <value name="GL_TEXTURE_LOD_BIAS_EXT"/> + <desc name="params" vector_size="1"/> + </desc> + + <desc name="target"> + <value name="GL_TEXTURE_ENV"/> + + <desc name="pname"> + <value name="GL_TEXTURE_ENV_MODE"/> + <value name="GL_COMBINE_RGB"/> + <value name="GL_COMBINE_ALPHA"/> + <value name="GL_RGB_SCALE"/> + <value name="GL_ALPHA_SCALE"/> + <value name="GL_SRC0_RGB"/> + <value name="GL_SRC1_RGB"/> + <value name="GL_SRC2_RGB"/> + <value name="GL_SRC0_ALPHA"/> + <value name="GL_SRC1_ALPHA"/> + <value name="GL_SRC2_ALPHA"/> + <value name="GL_OPERAND0_RGB"/> + <value name="GL_OPERAND1_RGB"/> + <value name="GL_OPERAND2_RGB"/> + <value name="GL_OPERAND0_ALPHA"/> + <value name="GL_OPERAND1_ALPHA"/> + <value name="GL_OPERAND2_ALPHA"/> + <value name="GL_TEXTURE_ENV_COLOR"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_TEXTURE_ENV_MODE"/> + + <desc name="param"> + <value name="GL_REPLACE"/> + <value name="GL_MODULATE"/> + <value name="GL_DECAL"/> + <value name="GL_BLEND"/> + <value name="GL_ADD"/> + <value name="GL_COMBINE"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_COMBINE_RGB"/> + + <desc name="param"> + <value name="GL_REPLACE"/> + <value name="GL_MODULATE"/> + <value name="GL_ADD"/> + <value name="GL_ADD_SIGNED"/> + <value name="GL_INTERPOLATE"/> + <value name="GL_SUBTRACT"/> + <value name="GL_DOT3_RGB"/> + <value name="GL_DOT3_RGBA"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_COMBINE_ALPHA"/> + + <desc name="param"> + <value name="GL_REPLACE"/> + <value name="GL_MODULATE"/> + <value name="GL_ADD"/> + <value name="GL_ADD_SIGNED"/> + <value name="GL_INTERPOLATE"/> + <value name="GL_SUBTRACT"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_RGB_SCALE"/> + <value name="GL_ALPHA_SCALE"/> + + <desc name="param" convert="true" error="GL_INVALID_VALUE"> + <value name="1.0"/> + <value name="2.0"/> + <value name="4.0"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_SRC0_RGB"/> + <value name="GL_SRC1_RGB"/> + <value name="GL_SRC2_RGB"/> + <value name="GL_SRC0_ALPHA"/> + <value name="GL_SRC1_ALPHA"/> + <value name="GL_SRC2_ALPHA"/> + + <desc name="param"> + <value name="GL_TEXTURE"/> + <value name="GL_CONSTANT"/> + <value name="GL_PRIMARY_COLOR"/> + <value name="GL_PREVIOUS"/> + + <range base="GL_TEXTURE" from="0" to="31" category="OES_texture_env_crossbar"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_OPERAND0_RGB"/> + <value name="GL_OPERAND1_RGB"/> + <value name="GL_OPERAND2_RGB"/> + + <desc name="param"> + <value name="GL_SRC_COLOR"/> + <value name="GL_ONE_MINUS_SRC_COLOR"/> + <value name="GL_SRC_ALPHA"/> + <value name="GL_ONE_MINUS_SRC_ALPHA"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_OPERAND0_ALPHA"/> + <value name="GL_OPERAND1_ALPHA"/> + <value name="GL_OPERAND2_ALPHA"/> + + <desc name="param"> + <value name="GL_SRC_ALPHA"/> + <value name="GL_ONE_MINUS_SRC_ALPHA"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_TEXTURE_ENV_COLOR"/> + + <desc name="params" vector_size="4"/> + </desc> +</template> + +<template name="TexGen"> + <proto> + <return type="void"/> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="const GLtype *" size="dynamic"> + <param name="param" type="GLtype"/> + </vector> + </proto> + + <desc name="coord" category="OES_texture_cube_map"> + <value name="GL_TEXTURE_GEN_STR_OES"/> + </desc> + + <desc name="pname" category="OES_texture_cube_map"> + <value name="GL_TEXTURE_GEN_MODE_OES"/> + + <desc name="param"> + <value name="GL_NORMAL_MAP_OES"/> + <value name="GL_REFLECTION_MAP_OES"/> + </desc> + </desc> +</template> + +<template name="Clear"> + <proto> + <return type="void"/> + <param name="mask" type="GLbitfield"/> + </proto> + + <desc name="mask" error="GL_INVALID_VALUE"> + <value name="0"/> + <value name="(GL_COLOR_BUFFER_BIT)"/> + <value name="(GL_DEPTH_BUFFER_BIT)"/> + <value name="(GL_STENCIL_BUFFER_BIT)"/> + <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)"/> + <value name="(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/> + <value name="(GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/> + <value name="(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)"/> + </desc> +</template> + +<template name="ClearColor"> + <proto> + <return type="void"/> + <param name="red" type="GLtype"/> + <param name="green" type="GLtype"/> + <param name="blue" type="GLtype"/> + <param name="alpha" type="GLtype"/> + </proto> +</template> + +<template name="ClearStencil"> + <proto> + <return type="void"/> + <param name="s" type="GLint"/> + </proto> +</template> + +<template name="ClearDepth"> + <proto> + <return type="void"/> + <param name="depth" type="GLtype"/> + </proto> +</template> + +<template name="StencilMask"> + <proto> + <return type="void"/> + <param name="mask" type="GLuint"/> + </proto> +</template> + +<template name="StencilMaskSeparate"> + <proto> + <return type="void"/> + <param name="face" type="GLenum"/> + <param name="mask" type="GLuint"/> + </proto> + + <desc name="face"> + <value name="GL_FRONT"/> + <value name="GL_BACK"/> + <value name="GL_FRONT_AND_BACK"/> + </desc> +</template> + +<template name="ColorMask"> + <proto> + <return type="void"/> + <param name="red" type="GLboolean"/> + <param name="green" type="GLboolean"/> + <param name="blue" type="GLboolean"/> + <param name="alpha" type="GLboolean"/> + </proto> +</template> + +<template name="DepthMask"> + <proto> + <return type="void"/> + <param name="flag" type="GLboolean"/> + </proto> +</template> + +<template name="Disable"> + <proto> + <return type="void"/> + <param name="cap" type="GLenum"/> + </proto> + + <desc name="cap" category="GLES1.1"> + <value name="GL_NORMALIZE"/> + <value name="GL_RESCALE_NORMAL"/> + + <range base="GL_CLIP_PLANE" from="0" to="5"/> + + <value name="GL_FOG"/> + <value name="GL_LIGHTING"/> + <value name="GL_COLOR_MATERIAL"/> + + <range base="GL_LIGHT" from="0" to="7"/> + + <value name="GL_POINT_SMOOTH"/> + <value name="GL_LINE_SMOOTH"/> + <value name="GL_CULL_FACE"/> + <value name="GL_POLYGON_OFFSET_FILL"/> + <value name="GL_MULTISAMPLE"/> + <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/> + <value name="GL_SAMPLE_ALPHA_TO_ONE"/> + <value name="GL_SAMPLE_COVERAGE"/> + <value name="GL_TEXTURE_2D"/> + <value name="GL_SCISSOR_TEST"/> + <value name="GL_ALPHA_TEST"/> + <value name="GL_STENCIL_TEST"/> + <value name="GL_DEPTH_TEST"/> + <value name="GL_BLEND"/> + <value name="GL_DITHER"/> + <value name="GL_COLOR_LOGIC_OP"/> + + <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/> + <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/> + <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/> + </desc> + + <desc name="cap" category="GLES2.0"> + <value name="GL_CULL_FACE"/> + <value name="GL_SCISSOR_TEST"/> + <value name="GL_POLYGON_OFFSET_FILL"/> + <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/> + <value name="GL_SAMPLE_COVERAGE"/> + <value name="GL_STENCIL_TEST"/> + <value name="GL_DEPTH_TEST"/> + <value name="GL_DITHER"/> + <value name="GL_BLEND"/> + </desc> +</template> + +<!-- it is exactly the same as Disable --> +<template name="Enable"> + <proto> + <return type="void"/> + <param name="cap" type="GLenum"/> + </proto> + + <desc name="cap" category="GLES1.1"> + <value name="GL_NORMALIZE"/> + <value name="GL_RESCALE_NORMAL"/> + + <range base="GL_CLIP_PLANE" from="0" to="5"/> + + <value name="GL_FOG"/> + <value name="GL_LIGHTING"/> + <value name="GL_COLOR_MATERIAL"/> + + <range base="GL_LIGHT" from="0" to="7"/> + + <value name="GL_POINT_SMOOTH"/> + <value name="GL_LINE_SMOOTH"/> + <value name="GL_CULL_FACE"/> + <value name="GL_POLYGON_OFFSET_FILL"/> + <value name="GL_MULTISAMPLE"/> + <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/> + <value name="GL_SAMPLE_ALPHA_TO_ONE"/> + <value name="GL_SAMPLE_COVERAGE"/> + <value name="GL_TEXTURE_2D"/> + <value name="GL_SCISSOR_TEST"/> + <value name="GL_ALPHA_TEST"/> + <value name="GL_STENCIL_TEST"/> + <value name="GL_DEPTH_TEST"/> + <value name="GL_BLEND"/> + <value name="GL_DITHER"/> + <value name="GL_COLOR_LOGIC_OP"/> + + <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/> + <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/> + <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/> + </desc> + + <desc name="cap" category="GLES2.0"> + <value name="GL_CULL_FACE"/> + <value name="GL_SCISSOR_TEST"/> + <value name="GL_POLYGON_OFFSET_FILL"/> + <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/> + <value name="GL_SAMPLE_COVERAGE"/> + <value name="GL_STENCIL_TEST"/> + <value name="GL_DEPTH_TEST"/> + <value name="GL_DITHER"/> + <value name="GL_BLEND"/> + </desc> +</template> + +<template name="Finish"> + <proto> + <return type="void"/> + </proto> +</template> + +<template name="Flush"> + <proto> + <return type="void"/> + </proto> +</template> + +<template name="AlphaFunc"> + <proto> + <return type="void"/> + <param name="func" type="GLenum"/> + <param name="ref" type="GLtype"/> + </proto> + <desc name="func"> + <value name="GL_NEVER"/> + <value name="GL_LESS"/> + <value name="GL_EQUAL"/> + <value name="GL_LEQUAL"/> + <value name="GL_GREATER"/> + <value name="GL_NOTEQUAL"/> + <value name="GL_GEQUAL"/> + <value name="GL_ALWAYS"/> + </desc> +</template> + +<template name="BlendFunc"> + <proto> + <return type="void"/> + <param name="sfactor" type="GLenum"/> + <param name="dfactor" type="GLenum"/> + </proto> + + <desc name="sfactor"> + <value name="GL_ZERO"/> + <value name="GL_ONE"/> + <value name="GL_SRC_COLOR"/> + <value name="GL_ONE_MINUS_SRC_COLOR"/> + <value name="GL_SRC_ALPHA"/> + <value name="GL_ONE_MINUS_SRC_ALPHA"/> + <value name="GL_DST_ALPHA"/> + <value name="GL_ONE_MINUS_DST_ALPHA"/> + <value name="GL_DST_COLOR"/> + <value name="GL_ONE_MINUS_DST_COLOR"/> + <value name="GL_SRC_ALPHA_SATURATE"/> + + <value name="GL_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/> + </desc> + + <desc name="dfactor"> + <value name="GL_ZERO"/> + <value name="GL_ONE"/> + <value name="GL_SRC_COLOR"/> + <value name="GL_ONE_MINUS_SRC_COLOR"/> + <value name="GL_SRC_ALPHA"/> + <value name="GL_ONE_MINUS_SRC_ALPHA"/> + <value name="GL_DST_ALPHA"/> + <value name="GL_ONE_MINUS_DST_ALPHA"/> + <value name="GL_DST_COLOR"/> + <value name="GL_ONE_MINUS_DST_COLOR"/> + + <value name="GL_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/> + </desc> +</template> + +<template name="LogicOp"> + <proto> + <return type="void"/> + <param name="opcode" type="GLenum"/> + </proto> + + <desc name="opcode"> + <value name="GL_CLEAR"/> + <value name="GL_SET"/> + <value name="GL_COPY"/> + <value name="GL_COPY_INVERTED"/> + <value name="GL_NOOP"/> + <value name="GL_INVERT"/> + <value name="GL_AND"/> + <value name="GL_NAND"/> + <value name="GL_OR"/> + <value name="GL_NOR"/> + <value name="GL_XOR"/> + <value name="GL_EQUIV"/> + <value name="GL_AND_REVERSE"/> + <value name="GL_AND_INVERTED"/> + <value name="GL_OR_REVERSE"/> + <value name="GL_OR_INVERTED"/> + </desc> +</template> + +<template name="StencilFunc"> + <proto> + <return type="void"/> + <param name="func" type="GLenum"/> + <param name="ref" type="GLint"/> + <param name="mask" type="GLuint"/> + </proto> + + <desc name="func"> + <value name="GL_NEVER"/> + <value name="GL_LESS"/> + <value name="GL_LEQUAL"/> + <value name="GL_GREATER"/> + <value name="GL_GEQUAL"/> + <value name="GL_EQUAL"/> + <value name="GL_NOTEQUAL"/> + <value name="GL_ALWAYS"/> + </desc> +</template> + +<template name="StencilFuncSeparate"> + <proto> + <return type="void"/> + <param name="face" type="GLenum"/> + <param name="func" type="GLenum"/> + <param name="ref" type="GLint"/> + <param name="mask" type="GLuint"/> + </proto> + + <desc name="face"> + <value name="GL_FRONT"/> + <value name="GL_BACK"/> + <value name="GL_FRONT_AND_BACK"/> + </desc> + + <desc name="func"> + <value name="GL_NEVER"/> + <value name="GL_LESS"/> + <value name="GL_LEQUAL"/> + <value name="GL_GREATER"/> + <value name="GL_GEQUAL"/> + <value name="GL_EQUAL"/> + <value name="GL_NOTEQUAL"/> + <value name="GL_ALWAYS"/> + </desc> +</template> + +<template name="StencilOp"> + <proto> + <return type="void"/> + <param name="fail" type="GLenum"/> + <param name="zfail" type="GLenum"/> + <param name="zpass" type="GLenum"/> + </proto> + + <desc name="fail"> + <value name="GL_KEEP"/> + <value name="GL_ZERO"/> + <value name="GL_REPLACE"/> + <value name="GL_INCR"/> + <value name="GL_DECR"/> + <value name="GL_INVERT"/> + <value name="GL_INCR_WRAP" category="GLES2.0"/> + <value name="GL_DECR_WRAP" category="GLES2.0"/> + <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/> + <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/> + </desc> + + <desc name="zfail"> + <value name="GL_KEEP"/> + <value name="GL_ZERO"/> + <value name="GL_REPLACE"/> + <value name="GL_INCR"/> + <value name="GL_DECR"/> + <value name="GL_INVERT"/> + <value name="GL_INCR_WRAP" category="GLES2.0"/> + <value name="GL_DECR_WRAP" category="GLES2.0"/> + <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/> + <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/> + </desc> + + <desc name="zpass"> + <value name="GL_KEEP"/> + <value name="GL_ZERO"/> + <value name="GL_REPLACE"/> + <value name="GL_INCR"/> + <value name="GL_DECR"/> + <value name="GL_INVERT"/> + <value name="GL_INCR_WRAP" category="GLES2.0"/> + <value name="GL_DECR_WRAP" category="GLES2.0"/> + <value name="GL_INCR_WRAP_OES" category="OES_stencil_wrap"/> + <value name="GL_DECR_WRAP_OES" category="OES_stencil_wrap"/> + </desc> +</template> + +<template name="StencilOpSeparate"> + <proto> + <return type="void"/> + <param name="face" type="GLenum"/> + <param name="fail" type="GLenum"/> + <param name="zfail" type="GLenum"/> + <param name="zpass" type="GLenum"/> + </proto> + + <desc name="face"> + <value name="GL_FRONT"/> + <value name="GL_BACK"/> + <value name="GL_FRONT_AND_BACK"/> + </desc> + + <desc name="fail"> + <value name="GL_KEEP"/> + <value name="GL_ZERO"/> + <value name="GL_REPLACE"/> + <value name="GL_INCR"/> + <value name="GL_DECR"/> + <value name="GL_INVERT"/> + <value name="GL_INCR_WRAP"/> + <value name="GL_DECR_WRAP"/> + </desc> + + <desc name="zfail"> + <value name="GL_KEEP"/> + <value name="GL_ZERO"/> + <value name="GL_REPLACE"/> + <value name="GL_INCR"/> + <value name="GL_DECR"/> + <value name="GL_INVERT"/> + <value name="GL_INCR_WRAP"/> + <value name="GL_DECR_WRAP"/> + </desc> + + <desc name="zpass"> + <value name="GL_KEEP"/> + <value name="GL_ZERO"/> + <value name="GL_REPLACE"/> + <value name="GL_INCR"/> + <value name="GL_DECR"/> + <value name="GL_INVERT"/> + <value name="GL_INCR_WRAP"/> + <value name="GL_DECR_WRAP"/> + </desc> +</template> + +<template name="DepthFunc"> + <proto> + <return type="void"/> + <param name="func" type="GLenum"/> + </proto> + + <desc name="func"> + <value name="GL_NEVER"/> + <value name="GL_LESS"/> + <value name="GL_EQUAL"/> + <value name="GL_LEQUAL"/> + <value name="GL_GREATER"/> + <value name="GL_NOTEQUAL"/> + <value name="GL_GEQUAL"/> + <value name="GL_ALWAYS"/> + </desc> +</template> + +<template name="PixelStore"> + <proto> + <return type="void"/> + <param name="pname" type="GLenum"/> + <param name="param" type="GLtype"/> + </proto> + + <desc name="pname"> + <value name="GL_PACK_ALIGNMENT"/> + <value name="GL_UNPACK_ALIGNMENT"/> + </desc> + + <desc name="param" error="GL_INVALID_VALUE"> + <value name="1"/> + <value name="2"/> + <value name="4"/> + <value name="8"/> + </desc> +</template> + +<template name="ReadPixels" direction="get"> + <proto> + <return type="void"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="GLvoid *"/> + </proto> + + <!-- Technically, only two combinations are actually allowed: + GL_RGBA/GL_UNSIGNED_BYTE, and some implementation-specific + internal preferred combination. I don't know what that is, so I'm + allowing any valid combination for now; the underlying support + should fail when necessary.--> + <desc name="format"> + <value name="GL_ALPHA"/> + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGB"/> + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_5_6_5"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGBA"/> + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_4_4_4_4"/> + <value name="GL_UNSIGNED_SHORT_5_5_5_1"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE"/> + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE_ALPHA"/> + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + </desc> + </desc> + + <desc name="format" category="EXT_read_format_bgra"> + <value name="GL_BGRA_EXT"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT"/> + <value name="GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT"/> + </desc> + </desc> +</template> + +<template name="GetClipPlane" direction="get"> + <proto> + <return type="void"/> + <param name="plane" type="GLenum"/> + <vector name="equation" type="GLtype *" size="4"/> + </proto> + + <desc name="plane"> + <range base="GL_CLIP_PLANE" from="0" to="5"/> + </desc> +</template> + +<template name="GetError" direction="get"> + <proto> + <return type="GLenum"/> + </proto> +</template> + +<!-- template for GetFloatv, GetIntegerv, GetBoolean, and GetFixedv --> +<template name="GetState" direction="get"> + <proto> + <return type="void"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + <!-- param checking is done in mesa --> +</template> + +<template name="GetLight" direction="get"> + <proto> + <return type="void"/> + <param name="light" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="light"> + <range base="GL_LIGHT" from="0" to="7"/> + </desc> + + <desc name="pname"> + <value name="GL_AMBIENT"/> + <value name="GL_DIFFUSE"/> + <value name="GL_SPECULAR"/> + <value name="GL_POSITION"/> + + <desc name="params" vector_size="4"/> + </desc> + + <desc name="pname"> + <value name="GL_SPOT_DIRECTION"/> + + <desc name="params" vector_size="3"/> + </desc> + + <desc name="pname"> + <value name="GL_SPOT_EXPONENT"/> + <value name="GL_SPOT_CUTOFF"/> + <value name="GL_CONSTANT_ATTENUATION"/> + <value name="GL_LINEAR_ATTENUATION"/> + <value name="GL_QUADRATIC_ATTENUATION"/> + + <desc name="params" vector_size="1"/> + </desc> +</template> + +<template name="GetMaterial" direction="get"> + <proto> + <return type="void"/> + <param name="face" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"> + <param name="param" type="GLtype"/> + </vector> + </proto> + + <desc name="face"> + <value name="GL_FRONT"/> + <value name="GL_BACK"/> + </desc> + + <desc name="pname"> + <value name="GL_SHININESS"/> + <desc name="params" vector_size="1"/> + </desc> + + <desc name="pname"> + <value name="GL_AMBIENT"/> + <value name="GL_DIFFUSE"/> + <value name="GL_AMBIENT_AND_DIFFUSE"/> + <value name="GL_SPECULAR"/> + <value name="GL_EMISSION"/> + + <desc name="params" vector_size="4"/> + </desc> +</template> + +<template name="GetString" direction="get"> + <proto> + <return type="const GLubyte *"/> + <param name="name" type="GLenum"/> + </proto> + + <desc name="name"> + <value name="GL_VENDOR"/> + <value name="GL_RENDERER"/> + <value name="GL_VERSION"/> + <value name="GL_EXTENSIONS"/> + <value name="GL_SHADING_LANGUAGE_VERSION" category="GLES2.0"/> + </desc> +</template> + +<template name="GetTexEnv" direction="get"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="target" category="OES_point_sprite"> + <value name="GL_POINT_SPRITE_OES"/> + <desc name="pname"> + <value name="GL_COORD_REPLACE_OES"/> + </desc> + </desc> + + <desc name="pname" category="OES_point_sprite"> + <value name="GL_COORD_REPLACE_OES"/> + <desc name="params" vector_size="1" convert="false"/> + </desc> + + <desc name="target" category="EXT_texture_lod_bias"> + <value name="GL_TEXTURE_FILTER_CONTROL_EXT"/> + + <desc name="pname"> + <value name="GL_TEXTURE_LOD_BIAS_EXT"/> + </desc> + </desc> + + <desc name="pname" category="EXT_texture_lod_bias"> + <value name="GL_TEXTURE_LOD_BIAS_EXT"/> + <desc name="params" vector_size="1"/> + </desc> + + <desc name="target"> + <value name="GL_TEXTURE_ENV"/> + + <desc name="pname"> + <value name="GL_TEXTURE_ENV_COLOR"/> + <value name="GL_RGB_SCALE"/> + <value name="GL_ALPHA_SCALE"/> + <value name="GL_TEXTURE_ENV_MODE"/> + <value name="GL_COMBINE_RGB"/> + <value name="GL_COMBINE_ALPHA"/> + <value name="GL_SRC0_RGB"/> + <value name="GL_SRC1_RGB"/> + <value name="GL_SRC2_RGB"/> + <value name="GL_SRC0_ALPHA"/> + <value name="GL_SRC1_ALPHA"/> + <value name="GL_SRC2_ALPHA"/> + <value name="GL_OPERAND0_RGB"/> + <value name="GL_OPERAND1_RGB"/> + <value name="GL_OPERAND2_RGB"/> + <value name="GL_OPERAND0_ALPHA"/> + <value name="GL_OPERAND1_ALPHA"/> + <value name="GL_OPERAND2_ALPHA"/> + </desc> + </desc> + + <desc name="pname"> + <value name="GL_TEXTURE_ENV_COLOR"/> + <desc name="params" vector_size="4"/> + </desc> + + <desc name="pname"> + <value name="GL_RGB_SCALE"/> + <value name="GL_ALPHA_SCALE"/> + + <desc name="params" vector_size="1"/> + </desc> + + <desc name="pname"> + <value name="GL_TEXTURE_ENV_MODE"/> + <value name="GL_COMBINE_RGB"/> + <value name="GL_COMBINE_ALPHA"/> + <value name="GL_SRC0_RGB"/> + <value name="GL_SRC1_RGB"/> + <value name="GL_SRC2_RGB"/> + <value name="GL_SRC0_ALPHA"/> + <value name="GL_SRC1_ALPHA"/> + <value name="GL_SRC2_ALPHA"/> + <value name="GL_OPERAND0_RGB"/> + <value name="GL_OPERAND1_RGB"/> + <value name="GL_OPERAND2_RGB"/> + <value name="GL_OPERAND0_ALPHA"/> + <value name="GL_OPERAND1_ALPHA"/> + <value name="GL_OPERAND2_ALPHA"/> + + <desc name="params" vector_size="1" convert="false"/> + </desc> +</template> + +<template name="GetTexGen" direction="get"> + <proto> + <return type="void"/> + <param name="coord" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="coord"> + <value name="GL_TEXTURE_GEN_STR_OES"/> + </desc> + <desc name="pname"> + <value name="GL_TEXTURE_GEN_MODE_OES"/> + <desc name="params" vector_size="1" convert="false"/> + </desc> +</template> + +<template name="GetTexParameter" direction="get"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/> + </desc> + + <desc name="pname"> + <value name="GL_TEXTURE_WRAP_S"/> + <value name="GL_TEXTURE_WRAP_T"/> + <value name="GL_TEXTURE_WRAP_R_OES" category="OES_texture_3D"/> + <value name="GL_TEXTURE_MIN_FILTER"/> + <value name="GL_TEXTURE_MAG_FILTER"/> + <value name="GL_GENERATE_MIPMAP" category="GLES1.1"/> + + <desc name="params" vector_size="1" convert="false"/> + </desc> + + <desc name="pname" category="OES_draw_texture"> + <value name="GL_TEXTURE_CROP_RECT_OES"/> + <desc name="params" vector_size="4"/> + </desc> +</template> + +<template name="IsEnabled" direction="get"> + <proto> + <return type="GLboolean"/> + <param name="cap" type="GLenum"/> + </proto> + + <desc name="cap" category="GLES1.1"> + <value name="GL_NORMALIZE"/> + <value name="GL_RESCALE_NORMAL"/> + + <range base="GL_CLIP_PLANE" from="0" to="5"/> + + <value name="GL_FOG"/> + <value name="GL_LIGHTING"/> + <value name="GL_COLOR_MATERIAL"/> + + <range base="GL_LIGHT" from="0" to="7"/> + + <value name="GL_POINT_SMOOTH"/> + <value name="GL_LINE_SMOOTH"/> + <value name="GL_CULL_FACE"/> + <value name="GL_POLYGON_OFFSET_FILL"/> + <value name="GL_MULTISAMPLE"/> + <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/> + <value name="GL_SAMPLE_ALPHA_TO_ONE"/> + <value name="GL_SAMPLE_COVERAGE"/> + <value name="GL_TEXTURE_2D"/> + <value name="GL_SCISSOR_TEST"/> + <value name="GL_ALPHA_TEST"/> + <value name="GL_STENCIL_TEST"/> + <value name="GL_DEPTH_TEST"/> + <value name="GL_BLEND"/> + <value name="GL_DITHER"/> + <value name="GL_COLOR_LOGIC_OP"/> + + <value name="GL_POINT_SPRITE_OES" category="OES_point_sprite"/> + <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/> + + <value name="GL_VERTEX_ARRAY"/> + <value name="GL_NORMAL_ARRAY"/> + <value name="GL_COLOR_ARRAY"/> + <value name="GL_TEXTURE_COORD_ARRAY"/> + <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/> + <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/> + <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/> + </desc> + + <desc name="cap" category="GLES2.0"> + <value name="GL_CULL_FACE"/> + <value name="GL_SCISSOR_TEST"/> + <value name="GL_POLYGON_OFFSET_FILL"/> + <value name="GL_SAMPLE_ALPHA_TO_COVERAGE"/> + <value name="GL_SAMPLE_COVERAGE"/> + <value name="GL_STENCIL_TEST"/> + <value name="GL_DEPTH_TEST"/> + <value name="GL_DITHER"/> + <value name="GL_BLEND"/> + </desc> +</template> + +<template name="DepthRange"> + <proto> + <return type="void"/> + <param name="zNear" type="GLtype"/> + <param name="zFar" type="GLtype"/> + </proto> +</template> + +<template name="Frustum"> + <proto> + <return type="void"/> + <param name="left" type="GLtype"/> + <param name="right" type="GLtype"/> + <param name="bottom" type="GLtype"/> + <param name="top" type="GLtype"/> + <param name="zNear" type="GLtype"/> + <param name="zFar" type="GLtype"/> + </proto> +</template> + +<template name="LoadIdentity"> + <proto> + <return type="void"/> + </proto> +</template> + +<template name="LoadMatrix"> + <proto> + <return type="void"/> + <vector name="m" type="const GLtype *" size="16"/> + </proto> +</template> + +<template name="MatrixMode"> + <proto> + <return type="void"/> + <param name="mode" type="GLenum"/> + </proto> + + <desc name="mode"> + <value name="GL_MODELVIEW"/> + <value name="GL_PROJECTION"/> + <value name="GL_TEXTURE"/> + <value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/> + </desc> +</template> + +<template name="MultMatrix"> + <proto> + <return type="void"/> + <vector name="m" type="const GLtype *" size="16"/> + </proto> +</template> + +<template name="Ortho"> + <proto> + <return type="void"/> + <param name="left" type="GLtype"/> + <param name="right" type="GLtype"/> + <param name="bottom" type="GLtype"/> + <param name="top" type="GLtype"/> + <param name="zNear" type="GLtype"/> + <param name="zFar" type="GLtype"/> + </proto> +</template> + +<template name="PopMatrix"> + <proto> + <return type="void"/> + </proto> +</template> + +<template name="PushMatrix"> + <proto> + <return type="void"/> + </proto> +</template> + +<template name="Rotate"> + <proto> + <return type="void"/> + <param name="angle" type="GLtype"/> + <param name="x" type="GLtype"/> + <param name="y" type="GLtype"/> + <param name="z" type="GLtype"/> + </proto> +</template> + +<template name="Scale"> + <proto> + <return type="void"/> + <param name="x" type="GLtype"/> + <param name="y" type="GLtype"/> + <param name="z" type="GLtype"/> + </proto> +</template> + +<template name="Translate"> + <proto> + <return type="void"/> + <param name="x" type="GLtype"/> + <param name="y" type="GLtype"/> + <param name="z" type="GLtype"/> + </proto> +</template> + +<template name="Viewport"> + <proto> + <return type="void"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </proto> +</template> + +<template name="ColorPointer"> + <proto> + <return type="void"/> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </proto> + + <desc name="size" error="GL_INVALID_VALUE"> + <value name="4"/> + </desc> + + <desc name="type"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT"/> + <value name="GL_FIXED"/> + <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/> + </desc> +</template> + +<template name="DisableClientState"> + <proto> + <return type="void"/> + <param name="array" type="GLenum"/> + </proto> + + <desc name="array"> + <value name="GL_VERTEX_ARRAY"/> + <value name="GL_NORMAL_ARRAY"/> + <value name="GL_COLOR_ARRAY"/> + <value name="GL_TEXTURE_COORD_ARRAY"/> + <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/> + <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/> + <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/> + </desc> +</template> + +<template name="DrawArrays"> + <proto> + <return type="void"/> + <param name="mode" type="GLenum"/> + <param name="first" type="GLint"/> + <param name="count" type="GLsizei"/> + </proto> + + <desc name="mode"> + <value name="GL_POINTS"/> + <value name="GL_LINES"/> + <value name="GL_LINE_LOOP"/> + <value name="GL_LINE_STRIP"/> + <value name="GL_TRIANGLES"/> + <value name="GL_TRIANGLE_STRIP"/> + <value name="GL_TRIANGLE_FAN"/> + </desc> +</template> + +<template name="DrawElements"> + <proto> + <return type="void"/> + <param name="mode" type="GLenum"/> + <param name="count" type="GLsizei"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid *"/> + </proto> + + <desc name="mode"> + <value name="GL_POINTS"/> + <value name="GL_LINES"/> + <value name="GL_LINE_LOOP"/> + <value name="GL_LINE_STRIP"/> + <value name="GL_TRIANGLES"/> + <value name="GL_TRIANGLE_STRIP"/> + <value name="GL_TRIANGLE_FAN"/> + </desc> + + <desc name="type"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT"/> + <value name="GL_UNSIGNED_INT" category="OES_element_index_uint"/> + </desc> +</template> + +<template name="EnableClientState"> + <proto> + <return type="void"/> + <param name="array" type="GLenum"/> + </proto> + + <desc name="array"> + <value name="GL_VERTEX_ARRAY"/> + <value name="GL_NORMAL_ARRAY"/> + <value name="GL_COLOR_ARRAY"/> + <value name="GL_TEXTURE_COORD_ARRAY"/> + <value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/> + <value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/> + <value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/> + </desc> +</template> + +<template name="GetPointer" direction="get"> + <proto> + <return type="void"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLvoid **" size="dynamic"/> + </proto> + + <desc name="pname"> + <value name="GL_VERTEX_ARRAY_POINTER"/> + <value name="GL_NORMAL_ARRAY_POINTER"/> + <value name="GL_COLOR_ARRAY_POINTER"/> + <value name="GL_TEXTURE_COORD_ARRAY_POINTER"/> + <value name="GL_MATRIX_INDEX_ARRAY_POINTER_OES" category="OES_matrix_palette"/> + <value name="GL_WEIGHT_ARRAY_POINTER_OES" category="OES_matrix_palette"/> + <value name="GL_POINT_SIZE_ARRAY_POINTER_OES" category="OES_point_size_array"/> + </desc> +</template> + +<template name="Normal"> + <proto> + <return type="void"/> + <vector name="v" type="const GLtype *" size="3"> + <param name="nx" type="GLtype"/> + <param name="ny" type="GLtype"/> + <param name="nz" type="GLtype"/> + </vector> + </proto> +</template> + +<template name="NormalPointer"> + <proto> + <return type="void"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </proto> + + <desc name="type"> + <value name="GL_BYTE"/> + <value name="GL_SHORT"/> + <value name="GL_FLOAT"/> + <value name="GL_FIXED"/> + <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/> + </desc> +</template> + +<template name="TexCoordPointer"> + <proto> + <return type="void"/> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </proto> + + <desc name="size" error="GL_INVALID_VALUE"> + <value name="2"/> + <value name="3"/> + <value name="4"/> + </desc> + + <desc name="type"> + <value name="GL_BYTE"/> + <value name="GL_SHORT"/> + <value name="GL_FLOAT"/> + <value name="GL_FIXED"/> + <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/> + </desc> +</template> + +<template name="VertexPointer"> + <proto> + <return type="void"/> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </proto> + + <desc name="size" error="GL_INVALID_VALUE"> + <value name="2"/> + <value name="3"/> + <value name="4"/> + </desc> + + <desc name="type"> + <value name="GL_BYTE"/> + <value name="GL_SHORT"/> + <value name="GL_FLOAT"/> + <value name="GL_FIXED"/> + <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/> + </desc> +</template> + +<template name="PolygonOffset"> + <proto> + <return type="void"/> + <param name="factor" type="GLtype"/> + <param name="units" type="GLtype"/> + </proto> +</template> + +<template name="CopyTexImage2D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalFormat" type="GLenum"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="border" type="GLint"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/> + </desc> + + <desc name="internalFormat" error="GL_INVALID_VALUE"> + <value name="GL_ALPHA"/> + <value name="GL_RGB"/> + <value name="GL_RGBA"/> + <value name="GL_LUMINANCE"/> + <value name="GL_LUMINANCE_ALPHA"/> + </desc> + + <desc name="border" error="GL_INVALID_VALUE"> + <value name="0"/> + </desc> +</template> + +<template name="CopyTexSubImage2D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/> + </desc> +</template> + +<template name="TexSubImage2D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/> + </desc> + + <desc name="format"> + <value name="GL_ALPHA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGB"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_5_6_5"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGBA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_4_4_4_4"/> + <value name="GL_UNSIGNED_SHORT_5_5_5_1"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE_ALPHA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format" category="OES_depth_texture"> + <value name="GL_DEPTH_COMPONENT"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_SHORT"/> + <value name="GL_UNSIGNED_INT"/> + </desc> + </desc> + + <desc name="format" category="OES_packed_depth_stencil"> + <value name="GL_DEPTH_STENCIL_OES"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_INT_24_8_OES"/> + </desc> + </desc> +</template> + +<template name="BindTexture"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="texture" type="GLuint"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/> + </desc> +</template> + +<template name="DeleteTextures"> + <proto> + <return type="void"/> + <param name="n" type="GLsizei"/> + <param name="textures" type="const GLuint *"/> + </proto> +</template> + +<template name="GenTextures" direction="get"> + <proto> + <return type="void"/> + <param name="n" type="GLsizei"/> + <param name="textures" type="GLuint *"/> + </proto> +</template> + +<template name="IsTexture" direction="get"> + <proto> + <return type="GLboolean"/> + <param name="texture" type="GLuint"/> + </proto> +</template> + +<template name="BlendColor"> + <proto> + <return type="void"/> + <param name="red" type="GLtype"/> + <param name="green" type="GLtype"/> + <param name="blue" type="GLtype"/> + <param name="alpha" type="GLtype"/> + </proto> +</template> + +<template name="BlendEquation"> + <proto> + <return type="void"/> + <param name="mode" type="GLenum"/> + </proto> + + <desc name="mode"> + <value name="GL_FUNC_ADD" category="GLES2.0"/> + <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/> + <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/> + <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/> + <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/> + <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/> + + <value name="GL_MIN_EXT" category="EXT_blend_minmax"/> + <value name="GL_MAX_EXT" category="EXT_blend_minmax"/> + </desc> +</template> + +<template name="BlendEquationSeparate"> + <proto> + <return type="void"/> + <param name="modeRGB" type="GLenum"/> + <param name="modeAlpha" type="GLenum"/> + </proto> + + <desc name="modeRGB"> + <value name="GL_FUNC_ADD" category="GLES2.0"/> + <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/> + <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/> + <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/> + <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/> + <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/> + + <value name="GL_MIN_EXT" category="EXT_blend_minmax"/> + <value name="GL_MAX_EXT" category="EXT_blend_minmax"/> + </desc> + + <desc name="modeAlpha"> + <value name="GL_FUNC_ADD" category="GLES2.0"/> + <value name="GL_FUNC_SUBTRACT" category="GLES2.0"/> + <value name="GL_FUNC_REVERSE_SUBTRACT" category="GLES2.0"/> + <value name="GL_FUNC_ADD_OES" category="OES_blend_subtract"/> + <value name="GL_FUNC_SUBTRACT_OES" category="OES_blend_subtract"/> + <value name="GL_FUNC_REVERSE_SUBTRACT_OES" category="OES_blend_subtract"/> + + <value name="GL_MIN_EXT" category="EXT_blend_minmax"/> + <value name="GL_MAX_EXT" category="EXT_blend_minmax"/> + </desc> +</template> + +<template name="TexImage3D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalFormat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_3D_OES"/> + </desc> + + <desc name="internalFormat"> + <value name="GL_ALPHA"/> + <value name="GL_RGB"/> + <value name="GL_RGBA"/> + <value name="GL_LUMINANCE"/> + <value name="GL_LUMINANCE_ALPHA"/> + </desc> + + <desc name="format"> + <value name="GL_ALPHA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGB"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_5_6_5"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGBA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_4_4_4_4"/> + <value name="GL_UNSIGNED_SHORT_5_5_5_1"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE_ALPHA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> +</template> + +<template name="TexSubImage3D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="pixels" type="const GLvoid *"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_3D_OES"/> + </desc> + + <desc name="format"> + <value name="GL_ALPHA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGB"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_5_6_5"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_RGBA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT_4_4_4_4"/> + <value name="GL_UNSIGNED_SHORT_5_5_5_1"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> + + <desc name="format"> + <value name="GL_LUMINANCE_ALPHA"/> + + <desc name="type" error="GL_INVALID_OPERATION"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_FLOAT" category="OES_texture_float"/> + <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/> + </desc> + </desc> +</template> + +<template name="CopyTexSubImage3D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="x" type="GLint"/> + <param name="y" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_3D_OES"/> + </desc> +</template> + +<template name="MultiTexCoord"> + <proto> + <return type="void"/> + <param name="texture" type="GLenum"/> + <vector name="v" type="const GLtype *" size="dynamic"> + <param name="s" type="GLtype"/> + <param name="t" type="GLtype"/> + <param name="r" type="GLtype"/> + <param name="q" type="GLtype"/> + </vector> + </proto> + + <desc name="texture"> + <range base="GL_TEXTURE" from="0" to="31"/> + </desc> +</template> + +<template name="CompressedTexImage3D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalFormat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="imagesize" type="GLsizei"/> + <param name="data" type="const GLvoid *"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_3D_OES"/> + </desc> + + <desc name="internalFormat"> + <value name="GL_3DC_X_AMD" category="AMD_compressed_3DC_texture"/> + <value name="GL_3DC_XY_AMD" category="AMD_compressed_3DC_texture"/> + <value name="GL_ATC_RGB_AMD" category="AMD_compressed_ATC_texture"/> + <value name="GL_ATC_RGBA_EXPLICIT_ALPHA_AMD" category="AMD_compressed_ATC_texture"/> + <value name="GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD" category="AMD_compressed_ATC_texture"/> + </desc> +</template> + +<template name="CompressedTexSubImage3D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="zoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="imagesize" type="GLsizei"/> + <param name="data" type="const GLvoid *"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_3D_OES"/> + </desc> +</template> + +<template name="ActiveTexture"> + <proto> + <return type="void"/> + <param name="texture" type="GLenum"/> + </proto> + + <desc name="texture"> + <range base="GL_TEXTURE" from="0" to="31"/> + </desc> +</template> + +<template name="ClientActiveTexture"> + <proto> + <return type="void"/> + <param name="texture" type="GLenum"/> + </proto> + + <desc name="texture"> + <range base="GL_TEXTURE" from="0" to="31"/> + </desc> +</template> + +<template name="SampleCoverage"> + <proto> + <return type="void"/> + <param name="value" type="GLtype"/> + <param name="invert" type="GLboolean"/> + </proto> +</template> + +<template name="CompressedTexImage2D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="internalFormat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="border" type="GLint"/> + <param name="imageSize" type="GLsizei"/> + <param name="data" type="const GLvoid *"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/> + </desc> + + <desc name="internalFormat"> + <value name="GL_ETC1_RGB8_OES" category="OES_compressed_ETC1_RGB8_texture"/> + + <value name="GL_PALETTE4_RGB8_OES" category="OES_compressed_paletted_texture"/> + <value name="GL_PALETTE4_RGBA8_OES" category="OES_compressed_paletted_texture"/> + <value name="GL_PALETTE4_R5_G6_B5_OES" category="OES_compressed_paletted_texture"/> + <value name="GL_PALETTE4_RGBA4_OES" category="OES_compressed_paletted_texture"/> + <value name="GL_PALETTE4_RGB5_A1_OES" category="OES_compressed_paletted_texture"/> + <value name="GL_PALETTE8_RGB8_OES" category="OES_compressed_paletted_texture"/> + <value name="GL_PALETTE8_RGBA8_OES" category="OES_compressed_paletted_texture"/> + <value name="GL_PALETTE8_R5_G6_B5_OES" category="OES_compressed_paletted_texture"/> + <value name="GL_PALETTE8_RGBA4_OES" category="OES_compressed_paletted_texture"/> + <value name="GL_PALETTE8_RGB5_A1_OES" category="OES_compressed_paletted_texture"/> + + <value name="GL_3DC_X_AMD" category="AMD_compressed_3DC_texture"/> + <value name="GL_3DC_XY_AMD" category="AMD_compressed_3DC_texture"/> + + <value name="GL_ATC_RGB_AMD" category="AMD_compressed_ATC_texture"/> + <value name="GL_ATC_RGBA_EXPLICIT_ALPHA_AMD" category="AMD_compressed_ATC_texture"/> + <value name="GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD" category="AMD_compressed_ATC_texture"/> + + <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/> + <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/> + </desc> + + <desc name="border" error="GL_INVALID_VALUE"> + <value name="0"/> + </desc> +</template> + +<template name="CompressedTexSubImage2D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="level" type="GLint"/> + <param name="xoffset" type="GLint"/> + <param name="yoffset" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="format" type="GLenum"/> + <param name="imageSize" type="GLsizei"/> + <param name="data" type="const GLvoid *"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/> + </desc> + + <desc name="format"> + <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/> + <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/> + </desc> +</template> + +<template name="BlendFuncSeparate"> + <proto> + <return type="void"/> + <param name="srcRGB" type="GLenum"/> + <param name="dstRGB" type="GLenum"/> + <param name="srcAlpha" type="GLenum"/> + <param name="dstAlpha" type="GLenum"/> + </proto> + + <desc name="srcRGB"> + <value name="GL_ZERO"/> + <value name="GL_ONE"/> + <value name="GL_SRC_COLOR"/> + <value name="GL_ONE_MINUS_SRC_COLOR"/> + <value name="GL_SRC_ALPHA"/> + <value name="GL_ONE_MINUS_SRC_ALPHA"/> + <value name="GL_DST_ALPHA"/> + <value name="GL_ONE_MINUS_DST_ALPHA"/> + <value name="GL_DST_COLOR"/> + <value name="GL_ONE_MINUS_DST_COLOR"/> + <value name="GL_SRC_ALPHA_SATURATE"/> + + <value name="GL_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/> + </desc> + + <desc name="dstRGB"> + <value name="GL_ZERO"/> + <value name="GL_ONE"/> + <value name="GL_SRC_COLOR"/> + <value name="GL_ONE_MINUS_SRC_COLOR"/> + <value name="GL_SRC_ALPHA"/> + <value name="GL_ONE_MINUS_SRC_ALPHA"/> + <value name="GL_DST_ALPHA"/> + <value name="GL_ONE_MINUS_DST_ALPHA"/> + <value name="GL_DST_COLOR"/> + <value name="GL_ONE_MINUS_DST_COLOR"/> + + <value name="GL_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/> + </desc> + + <desc name="srcAlpha"> + <value name="GL_ZERO"/> + <value name="GL_ONE"/> + <value name="GL_SRC_COLOR"/> + <value name="GL_ONE_MINUS_SRC_COLOR"/> + <value name="GL_SRC_ALPHA"/> + <value name="GL_ONE_MINUS_SRC_ALPHA"/> + <value name="GL_DST_ALPHA"/> + <value name="GL_ONE_MINUS_DST_ALPHA"/> + <value name="GL_DST_COLOR"/> + <value name="GL_ONE_MINUS_DST_COLOR"/> + <value name="GL_SRC_ALPHA_SATURATE"/> + + <value name="GL_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/> + </desc> + + <desc name="dstAlpha"> + <value name="GL_ZERO"/> + <value name="GL_ONE"/> + <value name="GL_SRC_COLOR"/> + <value name="GL_ONE_MINUS_SRC_COLOR"/> + <value name="GL_SRC_ALPHA"/> + <value name="GL_ONE_MINUS_SRC_ALPHA"/> + <value name="GL_DST_ALPHA"/> + <value name="GL_ONE_MINUS_DST_ALPHA"/> + <value name="GL_DST_COLOR"/> + <value name="GL_ONE_MINUS_DST_COLOR"/> + + <value name="GL_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_COLOR" category="GLES2.0"/> + <value name="GL_CONSTANT_ALPHA" category="GLES2.0"/> + <value name="GL_ONE_MINUS_CONSTANT_ALPHA" category="GLES2.0"/> + </desc> +</template> + +<template name="PointParameter"> + <proto> + <return type="void"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="const GLtype *" size="dynamic"> + <param name="param" type="GLtype"/> + </vector> + </proto> + + <desc name="pname"> + <value name="GL_POINT_SIZE_MIN"/> + <value name="GL_POINT_SIZE_MAX"/> + <value name="GL_POINT_FADE_THRESHOLD_SIZE"/> + + <desc name="params" vector_size="1"/> + </desc> + + <desc name="pname"> + <value name="GL_POINT_DISTANCE_ATTENUATION"/> + <desc name="params" vector_size="3"/> + </desc> +</template> + +<template name="VertexAttrib"> + <proto> + <return type="void"/> + <param name="index" type="GLuint"/> + <vector name="v" type="const GLtype *" size="dynamic"> + <param name="x" type="GLtype"/> + <param name="y" type="GLtype"/> + <param name="z" type="GLtype"/> + <param name="w" type="GLtype"/> + </vector> + </proto> +</template> + +<template name="VertexAttribPointer"> + <proto> + <return type="void"/> + <param name="index" type="GLuint"/> + <param name="size" type="GLint"/> + <param name="type" type="GLenum"/> + <param name="normalized" type="GLboolean"/> + <param name="stride" type="GLsizei"/> + <param name="pointer" type="const GLvoid *"/> + </proto> + + <desc name="size" error="GL_INVALID_VALUE"> + <value name="1"/> + <value name="2"/> + <value name="3"/> + <value name="4"/> + </desc> + + <desc name="type" error="GL_INVALID_VALUE"> + <value name="GL_BYTE"/> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_SHORT"/> + <value name="GL_UNSIGNED_SHORT"/> + <value name="GL_FLOAT"/> + <value name="GL_FIXED"/> + <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/> + <value name="GL_UNSIGNED_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/> + <value name="GL_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/> + </desc> + + <desc name="type" category="OES_vertex_type_10_10_10_2"> + <value name="GL_UNSIGNED_INT_10_10_10_2_OES"/> + <value name="GL_INT_10_10_10_2_OES"/> + + <desc name="size"> + <value name="3"/> + <value name="4"/> + </desc> + </desc> +</template> + +<template name="EnableVertexAttribArray"> + <proto> + <return type="void"/> + <param name="index" type="GLuint"/> + </proto> +</template> + +<template name="DisableVertexAttribArray"> + <proto> + <return type="void"/> + <param name="index" type="GLuint"/> + </proto> +</template> + +<template name="IsProgram" direction="get"> + <proto> + <return type="GLboolean"/> + <param name="program" type="GLuint"/> + </proto> +</template> + +<template name="GetProgram" direction="get"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="pname"> + <value name="GL_DELETE_STATUS"/> + <value name="GL_LINK_STATUS"/> + <value name="GL_VALIDATE_STATUS"/> + <value name="GL_INFO_LOG_LENGTH"/> + <value name="GL_ATTACHED_SHADERS"/> + <value name="GL_ACTIVE_ATTRIBUTES"/> + <value name="GL_ACTIVE_ATTRIBUTE_MAX_LENGTH"/> + <value name="GL_ACTIVE_UNIFORMS"/> + <value name="GL_ACTIVE_UNIFORM_MAX_LENGTH"/> + <value name="GL_PROGRAM_BINARY_LENGTH_OES" category="OES_get_program_binary"/> + + <desc name="params" convert="false"/> + </desc> +</template> + +<template name="GetVertexAttrib" direction="get"> + <proto> + <return type="void"/> + <param name="index" type="GLuint"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="pname"> + <value name="GL_VERTEX_ATTRIB_ARRAY_ENABLED"/> + <value name="GL_VERTEX_ATTRIB_ARRAY_SIZE"/> + <value name="GL_VERTEX_ATTRIB_ARRAY_STRIDE"/> + <value name="GL_VERTEX_ATTRIB_ARRAY_TYPE"/> + <value name="GL_VERTEX_ATTRIB_ARRAY_NORMALIZED"/> + <value name="GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"/> + + <desc name="params" vector_size="1" convert="false"/> + </desc> + + <desc name="pname"> + <value name="GL_CURRENT_VERTEX_ATTRIB"/> + <desc name="params" vector_size="16?" convert="false"/> + </desc> +</template> + +<template name="GetVertexAttribPointer" direction="get"> + <proto> + <return type="void"/> + <param name="index" type="GLuint"/> + <param name="pname" type="GLenum"/> + <vector name="pointer" type="GLvoid **" size="dynamic"/> + </proto> + + <desc name="pname"> + <value name="GL_VERTEX_ATTRIB_ARRAY_POINTER"/> + </desc> +</template> + +<template name="GetBufferPointer" direction="get"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLvoid **" size="dynamic"/> + </proto> + + <desc name="target"> + <value name="GL_ARRAY_BUFFER"/> + <value name="GL_ELEMENT_ARRAY_BUFFER"/> + </desc> + + <desc name="pname"> + <value name="GL_BUFFER_MAP_POINTER_OES"/> + </desc> +</template> + +<template name="MapBuffer" direction="get"> + <proto> + <return type="void *"/> + <param name="target" type="GLenum"/> + <param name="access" type="GLenum"/> + </proto> + + <desc name="target"> + <value name="GL_ARRAY_BUFFER"/> + <value name="GL_ELEMENT_ARRAY_BUFFER"/> + </desc> + + <desc name="access"> + <value name="GL_WRITE_ONLY_OES"/> + </desc> +</template> + +<template name="UnmapBuffer" direction="get"> + <proto> + <return type="GLboolean"/> + <param name="target" type="GLenum"/> + </proto> + + <desc name="target"> + <value name="GL_ARRAY_BUFFER"/> + <value name="GL_ELEMENT_ARRAY_BUFFER"/> + </desc> +</template> + +<template name="BindBuffer"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="buffer" type="GLuint"/> + </proto> + + <desc name="target"> + <value name="GL_ARRAY_BUFFER"/> + <value name="GL_ELEMENT_ARRAY_BUFFER"/> + </desc> +</template> + +<template name="BufferData"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="size" type="GLsizeiptr"/> + <param name="data" type="const GLvoid *"/> + <param name="usage" type="GLenum"/> + </proto> + + <desc name="target"> + <value name="GL_ARRAY_BUFFER"/> + <value name="GL_ELEMENT_ARRAY_BUFFER"/> + </desc> + + <desc name="usage"> + <value name="GL_STATIC_DRAW"/> + <value name="GL_DYNAMIC_DRAW"/> + <value name="GL_STREAM_DRAW" category="GLES2.0"/> + </desc> +</template> + +<template name="BufferSubData"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="offset" type="GLintptr"/> + <param name="size" type="GLsizeiptr"/> + <param name="data" type="const GLvoid *"/> + </proto> + + <desc name="target"> + <value name="GL_ARRAY_BUFFER"/> + <value name="GL_ELEMENT_ARRAY_BUFFER"/> + </desc> +</template> + +<template name="DeleteBuffers"> + <proto> + <return type="void"/> + <param name="n" type="GLsizei"/> + <param name="buffer" type="const GLuint *"/> + </proto> +</template> + +<template name="GenBuffers" direction="get"> + <proto> + <return type="void"/> + <param name="n" type="GLsizei"/> + <param name="buffer" type="GLuint *"/> + </proto> +</template> + +<template name="GetBufferParameter" direction="get"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="target"> + <value name="GL_ARRAY_BUFFER"/> + <value name="GL_ELEMENT_ARRAY_BUFFER"/> + </desc> + + <desc name="pname"> + <value name="GL_BUFFER_SIZE"/> + <value name="GL_BUFFER_USAGE"/> + <value name="GL_BUFFER_ACCESS_OES" category="OES_mapbuffer"/> + <value name="GL_BUFFER_MAPPED_OES" category="OES_mapbuffer"/> + </desc> +</template> + +<template name="IsBuffer" direction="get"> + <proto> + <return type="GLboolean"/> + <param name="buffer" type="GLuint"/> + </proto> +</template> + +<template name="CreateShader"> + <proto> + <return type="GLuint"/> + <param name="type" type="GLenum"/> + </proto> + + <desc name="type"> + <value name="GL_VERTEX_SHADER"/> + <value name="GL_FRAGMENT_SHADER"/> + </desc> +</template> + +<template name="ShaderSource"> + <proto> + <return type="void"/> + <param name="shader" type="GLuint"/> + <param name="count" type="GLsizei"/> + <param name="string" type="const GLchar **"/> + <param name="length" type="const int *"/> + </proto> +</template> + +<template name="CompileShader"> + <proto> + <return type="void"/> + <param name="shader" type="GLuint"/> + </proto> +</template> + +<template name="ReleaseShaderCompiler"> + <proto> + <return type="void"/> + </proto> +</template> + +<template name="DeleteShader"> + <proto> + <return type="void"/> + <param name="shader" type="GLuint"/> + </proto> +</template> + +<template name="ShaderBinary"> + <proto> + <return type="void"/> + <param name="n" type="GLsizei"/> + <param name="shaders" type="const GLuint *"/> + <param name="binaryformat" type="GLenum"/> + <param name="binary" type="const GLvoid *"/> + <param name="length" type="GLsizei"/> + </proto> +</template> + +<template name="CreateProgram"> + <proto> + <return type="GLuint"/> + </proto> +</template> + +<template name="AttachShader"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + <param name="shader" type="GLuint"/> + </proto> +</template> + +<template name="DetachShader"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + <param name="shader" type="GLuint"/> + </proto> +</template> + +<template name="LinkProgram"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + </proto> +</template> + +<template name="UseProgram"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + </proto> +</template> + +<template name="DeleteProgram"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + </proto> +</template> + +<template name="GetActiveAttrib" direction="get"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + <param name="index" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="size" type="GLint *"/> + <param name="type" type="GLenum *"/> + <param name="name" type="GLchar *"/> + </proto> +</template> + +<template name="GetAttribLocation" direction="get"> + <proto> + <return type="GLint"/> + <param name="program" type="GLuint"/> + <param name="name" type="const char *"/> + </proto> +</template> + +<template name="BindAttribLocation"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + <param name="index" type="GLuint"/> + <param name="name" type="const char *"/> + </proto> +</template> + +<template name="GetUniformLocation" direction="get"> + <proto> + <return type="GLint"/> + <param name="program" type="GLuint"/> + <param name="name" type="const char *"/> + </proto> +</template> + +<template name="GetActiveUniform" direction="get"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + <param name="index" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="size" type="GLint *"/> + <param name="type" type="GLenum *"/> + <param name="name" type="GLchar *"/> + </proto> +</template> + +<template name="Uniform"> + <proto> + <return type="void"/> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei" hide_if_expanded="true"/> + <vector name="values" type="const GLtype *" size="dynamic"> + <param name="v0" type="GLtype"/> + <param name="v1" type="GLtype"/> + <param name="v2" type="GLtype"/> + <param name="v3" type="GLtype"/> + </vector> + </proto> +</template> + +<template name="UniformMatrix"> + <proto> + <return type="void"/> + <param name="location" type="GLint"/> + <param name="count" type="GLsizei"/> + <param name="transpose" type="GLboolean"/> + <vector name="value" type="const GLtype *" size="dynamic"/> + </proto> +</template> + +<template name="ValidateProgram"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + </proto> +</template> + +<template name="GenerateMipmap"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/> + </desc> +</template> + +<template name="BindFramebuffer"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="framebuffer" type="GLuint"/> + </proto> + + <desc name="target"> + <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_FRAMEBUFFER" category="GLES2.0"/> + </desc> +</template> + +<template name="DeleteFramebuffers"> + <proto> + <return type="void"/> + <param name="n" type="GLsizei"/> + <param name="framebuffers" type="const GLuint *"/> + </proto> +</template> + +<template name="GenFramebuffers"> + <proto> + <return type="void"/> + <param name="n" type="GLsizei"/> + <param name="ids" type="GLuint *"/> + </proto> +</template> + +<template name="BindRenderbuffer"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="renderbuffer" type="GLuint"/> + </proto> + + <desc name="target"> + <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_RENDERBUFFER" category="GLES2.0"/> + </desc> +</template> + +<template name="DeleteRenderbuffers"> + <proto> + <return type="void"/> + <param name="n" type="GLsizei"/> + <param name="renderbuffers" type="const GLuint *"/> + </proto> +</template> + +<template name="GenRenderbuffers"> + <proto> + <return type="void"/> + <param name="n" type="GLsizei"/> + <param name="renderbuffers" type="GLuint *"/> + </proto> +</template> + +<template name="RenderbufferStorage"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="internalFormat" type="GLenum"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + </proto> + + <desc name="target"> + <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_RENDERBUFFER" category="GLES2.0"/> + </desc> + + <desc name="internalFormat"> + <value name="GL_DEPTH_COMPONENT16_OES" category="OES_framebuffer_object"/> + <value name="GL_RGBA4_OES" category="OES_framebuffer_object"/> + <value name="GL_RGB5_A1_OES" category="OES_framebuffer_object"/> + <value name="GL_RGB565_OES" category="OES_framebuffer_object"/> + <value name="GL_STENCIL_INDEX8_OES" category="OES_stencil8"/> + + <value name="GL_DEPTH_COMPONENT16" category="GLES2.0"/> + <value name="GL_RGBA4" category="GLES2.0"/> + <value name="GL_RGB5_A1" category="GLES2.0"/> + <value name="GL_RGB565" category="GLES2.0"/> + <value name="GL_STENCIL_INDEX8" category="GLES2.0"/> + + <value name="GL_DEPTH_COMPONENT24_OES" category="OES_depth24"/> + <value name="GL_DEPTH_COMPONENT32_OES" category="OES_depth32"/> + <value name="GL_RGB8_OES" category="OES_rgb8_rgba8"/> + <value name="GL_RGBA8_OES" category="OES_rgb8_rgba8"/> + <value name="GL_STENCIL_INDEX1_OES" category="OES_stencil1"/> + <value name="GL_STENCIL_INDEX4_OES" category="OES_stencil4"/> + <value name="GL_DEPTH24_STENCIL8_OES" category="OES_packed_depth_stencil"/> + </desc> +</template> + +<template name="FramebufferRenderbuffer"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="renderbuffertarget" type="GLenum"/> + <param name="renderbuffer" type="GLuint"/> + </proto> + + <desc name="target"> + <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_FRAMEBUFFER" category="GLES2.0"/> + </desc> + + <desc name="attachment"> + <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/> + <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/> + <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/> + <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/> + <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/> + <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/> + </desc> + + <desc name="renderbuffertarget"> + <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_RENDERBUFFER" category="GLES2.0"/> + </desc> +</template> + +<template name="FramebufferTexture2D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="textarget" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + </proto> + + <desc name="target"> + <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_FRAMEBUFFER" category="GLES2.0"/> + </desc> + + <desc name="attachment"> + <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/> + <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/> + <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/> + <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/> + <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/> + <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/> + </desc> + + <desc name="textarget" error="GL_INVALID_OPERATION"> + <value name="GL_TEXTURE_2D"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/> + <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/> + </desc> + <!-- According to the base specification, "level" must be 0. But + extension GL_OES_fbo_render_mipmap lifts that restriction, + so no restriction is placed here. --> +</template> + +<template name="FramebufferTexture3D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="textarget" type="GLenum"/> + <param name="texture" type="GLuint"/> + <param name="level" type="GLint"/> + <param name="zoffset" type="GLint"/> + </proto> + + <desc name="target"> + <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_FRAMEBUFFER" category="GLES2.0"/> + </desc> + + <desc name="attachment"> + <value name="GL_COLOR_ATTACHMENT0_OES" category="OES_framebuffer_object"/> + <value name="GL_DEPTH_ATTACHMENT_OES" category="OES_framebuffer_object"/> + <value name="GL_STENCIL_ATTACHMENT_OES" category="OES_framebuffer_object"/> + <value name="GL_COLOR_ATTACHMENT0" category="GLES2.0"/> + <value name="GL_DEPTH_ATTACHMENT" category="GLES2.0"/> + <value name="GL_STENCIL_ATTACHMENT" category="GLES2.0"/> + </desc> + + <desc name="textarget" error="GL_INVALID_OPERATION"> + <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/> + </desc> +</template> + +<template name="CheckFramebufferStatus" direction="get"> + <proto> + <return type="GLenum"/> + <param name="target" type="GLenum"/> + </proto> + + <desc name="target"> + <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_FRAMEBUFFER" category="GLES2.0"/> + </desc> +</template> + +<template name="GetFramebufferAttachmentParameter" direction="get"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="attachment" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="target"> + <value name="GL_FRAMEBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_FRAMEBUFFER" category="GLES2.0"/> + </desc> + + <desc name="pname"> + <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES" category="OES_framebuffer_object"/> + <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES" category="OES_framebuffer_object"/> + <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES" category="OES_framebuffer_object"/> + <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES" category="OES_framebuffer_object"/> + + <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE" category="GLES2.0"/> + <value name="GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME" category="GLES2.0"/> + <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL" category="GLES2.0"/> + <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE" category="GLES2.0"/> + <value name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" category="OES_texture_3D"/> + + <desc name="params" vector_size="1" convert="false"/> + </desc> +</template> + +<template name="GetRenderbufferParameter" direction="get"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="target"> + <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_RENDERBUFFER" category="GLES2.0"/> + </desc> + + <desc name="pname" category="OES_framebuffer_object"> + <value name="GL_RENDERBUFFER_WIDTH_OES"/> + <value name="GL_RENDERBUFFER_HEIGHT_OES"/> + <value name="GL_RENDERBUFFER_INTERNAL_FORMAT_OES"/> + <value name="GL_RENDERBUFFER_RED_SIZE_OES"/> + <value name="GL_RENDERBUFFER_GREEN_SIZE_OES"/> + <value name="GL_RENDERBUFFER_BLUE_SIZE_OES"/> + <value name="GL_RENDERBUFFER_ALPHA_SIZE_OES"/> + <value name="GL_RENDERBUFFER_DEPTH_SIZE_OES"/> + <value name="GL_RENDERBUFFER_STENCIL_SIZE_OES"/> + + <desc name="params" vector_size="1" convert="false"/> + </desc> + + <desc name="pname" category="GLES2.0"> + <value name="GL_RENDERBUFFER_WIDTH"/> + <value name="GL_RENDERBUFFER_HEIGHT"/> + <value name="GL_RENDERBUFFER_INTERNAL_FORMAT"/> + <value name="GL_RENDERBUFFER_RED_SIZE"/> + <value name="GL_RENDERBUFFER_GREEN_SIZE"/> + <value name="GL_RENDERBUFFER_BLUE_SIZE"/> + <value name="GL_RENDERBUFFER_ALPHA_SIZE"/> + <value name="GL_RENDERBUFFER_DEPTH_SIZE"/> + <value name="GL_RENDERBUFFER_STENCIL_SIZE"/> + + <desc name="params" vector_size="1" convert="false"/> + </desc> +</template> + +<template name="IsRenderbuffer" direction="get"> + <proto> + <return type="GLboolean"/> + <param name="renderbuffer" type="GLuint"/> + </proto> +</template> + +<template name="IsFramebuffer" direction="get"> + <proto> + <return type="GLboolean"/> + <param name="framebuffer" type="GLuint"/> + </proto> +</template> + +<template name="IsShader" direction="get"> + <proto> + <return type="GLboolean"/> + <param name="shader" type="GLuint"/> + </proto> +</template> + +<template name="GetShader" direction="get"> + <proto> + <return type="void"/> + <param name="shader" type="GLuint"/> + <param name="pname" type="GLenum"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> + + <desc name="pname"> + <value name="GL_SHADER_TYPE"/> + <value name="GL_COMPILE_STATUS"/> + <value name="GL_DELETE_STATUS"/> + <value name="GL_INFO_LOG_LENGTH"/> + <value name="GL_SHADER_SOURCE_LENGTH"/> + </desc> +</template> + +<template name="GetAttachedShaders" direction="get"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + <param name="maxCount" type="GLsizei"/> + <param name="count" type="GLsizei *"/> + <param name="shaders" type="GLuint *"/> + </proto> +</template> + +<template name="GetShaderInfoLog" direction="get"> + <proto> + <return type="void"/> + <param name="shader" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="infoLog" type="GLchar *"/> + </proto> +</template> + +<template name="GetProgramInfoLog" direction="get"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="infoLog" type="GLchar *"/> + </proto> +</template> + +<template name="GetShaderSource" direction="get"> + <proto> + <return type="void"/> + <param name="shader" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="source" type="GLchar *"/> + </proto> +</template> + +<template name="GetShaderPrecisionFormat" direction="get"> + <proto> + <return type="void"/> + <param name="shadertype" type="GLenum"/> + <param name="precisiontype" type="GLenum"/> + <param name="range" type="GLint *"/> + <param name="precision" type="GLint *"/> + </proto> + + <desc name="shadertype"> + <value name="GL_VERTEX_SHADER"/> + <value name="GL_FRAGMENT_SHADER"/> + </desc> + + <desc name="precisiontype"> + <value name="GL_LOW_FLOAT"/> + <value name="GL_MEDIUM_FLOAT"/> + <value name="GL_HIGH_FLOAT"/> + <value name="GL_LOW_INT"/> + <value name="GL_MEDIUM_INT"/> + <value name="GL_HIGH_INT"/> + </desc> +</template> + +<template name="GetUniform" direction="get"> + <proto> + <return type="void"/> + <param name="program" type="GLuint"/> + <param name="location" type="GLint"/> + <vector name="params" type="GLtype *" size="dynamic"/> + </proto> +</template> + +<template name="QueryMatrix" direction="get"> + <proto> + <return type="GLbitfield"/> + <vector name="mantissa" type="GLtype *" size="16"/> + <vector name="exponent" type="GLint *" size="16"/> + </proto> +</template> + +<template name="DrawTex"> + <proto> + <return type="void"/> + <vector name="coords" type="const GLtype *" size="5"> + <param name="x" type="GLtype"/> + <param name="y" type="GLtype"/> + <param name="z" type="GLtype"/> + <param name="w" type="GLtype"/> + <param name="h" type="GLtype"/> + </vector> + </proto> +</template> + +<template name="MultiDrawArrays"> + <proto> + <return type="void"/> + <param name="mode" type="GLenum"/> + <param name="first" type="const GLint *"/> + <param name="count" type="const GLsizei *"/> + <param name="primcount" type="GLsizei"/> + </proto> + + <desc name="mode"> + <value name="GL_POINTS"/> + <value name="GL_LINES"/> + <value name="GL_LINE_LOOP"/> + <value name="GL_LINE_STRIP"/> + <value name="GL_TRIANGLES"/> + <value name="GL_TRIANGLE_STRIP"/> + <value name="GL_TRIANGLE_FAN"/> + </desc> +</template> + +<template name="MultiDrawElements"> + <proto> + <return type="void"/> + <param name="mode" type="GLenum"/> + <param name="count" type="const GLsizei *"/> + <param name="type" type="GLenum"/> + <param name="indices" type="const GLvoid **"/> + <param name="primcount" type="GLsizei"/> + </proto> + + <desc name="mode"> + <value name="GL_POINTS"/> + <value name="GL_LINES"/> + <value name="GL_LINE_LOOP"/> + <value name="GL_LINE_STRIP"/> + <value name="GL_TRIANGLES"/> + <value name="GL_TRIANGLE_STRIP"/> + <value name="GL_TRIANGLE_FAN"/> + </desc> + + <desc name="type"> + <value name="GL_UNSIGNED_BYTE"/> + <value name="GL_UNSIGNED_SHORT"/> + <value name="GL_UNSIGNED_INT" category="OES_element_index_uint"/> + </desc> +</template> + +<template name="EGLImageTargetTexture2D"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="image" type="GLeglImageOES"/> + </proto> + + <desc name="target"> + <value name="GL_TEXTURE_2D"/> + </desc> +</template> + +<template name="EGLImageTargetRenderbufferStorage"> + <proto> + <return type="void"/> + <param name="target" type="GLenum"/> + <param name="image" type="GLeglImageOES"/> + </proto> + + <desc name="target"> + <value name="GL_RENDERBUFFER_OES" category="OES_framebuffer_object"/> + <value name="GL_RENDERBUFFER" category="GLES2.0"/> + </desc> +</template> + +<api name="mesa" implementation="true"> + <category name="MESA"/> + + <function name="Color4f" default_prefix="_vbo_" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/> + <function name="ClipPlane" template="ClipPlane" gltype="GLdouble"/> + <function name="CullFace" template="CullFace"/> + + <function name="Fogf" template="Fog" gltype="GLfloat" expand_vector="true"/> + <function name="Fogfv" template="Fog" gltype="GLfloat"/> + + <function name="FrontFace" template="FrontFace"/> + <function name="Hint" template="Hint"/> + + <function name="Lightf" template="Light" gltype="GLfloat" expand_vector="true"/> + <function name="Lightfv" template="Light" gltype="GLfloat"/> + + <function name="LightModelf" template="LightModel" gltype="GLfloat" expand_vector="true"/> + <function name="LightModelfv" template="LightModel" gltype="GLfloat"/> + + <function name="LineWidth" template="LineWidth" gltype="GLfloat"/> + + <function name="Materialf" default_prefix="_vbo_" template="Material" gltype="GLfloat" expand_vector="true"/> + <function name="Materialfv" default_prefix="_vbo_" template="Material" gltype="GLfloat"/> + + <function name="PointSize" template="PointSize" gltype="GLfloat"/> + <function name="PointSizePointer" template="PointSizePointer"/> + + <function name="Scissor" template="Scissor"/> + <function name="ShadeModel" template="ShadeModel"/> + + <function name="TexParameterf" template="TexParameter" gltype="GLfloat" expand_vector="true"/> + <function name="TexParameterfv" template="TexParameter" gltype="GLfloat"/> + <function name="TexParameteri" template="TexParameter" gltype="GLint" expand_vector="true"/> + <function name="TexParameteriv" template="TexParameter" gltype="GLint"/> + + <function name="TexImage2D" template="TexImage2D"/> + + <function name="TexEnvf" template="TexEnv" gltype="GLfloat" expand_vector="true"/> + <function name="TexEnvi" template="TexEnv" gltype="GLint" expand_vector="true"/> + <function name="TexEnvfv" template="TexEnv" gltype="GLfloat"/> + <function name="TexEnviv" template="TexEnv" gltype="GLint"/> + + <function name="TexGenf" template="TexGen" gltype="GLfloat" expand_vector="true"/> + <function name="TexGenfv" template="TexGen" gltype="GLfloat"/> + + <function name="Clear" template="Clear"/> + <function name="ClearColor" template="ClearColor" gltype="GLclampf"/> + <function name="ClearStencil" template="ClearStencil"/> + <function name="ClearDepth" template="ClearDepth" gltype="GLclampd"/> + + <function name="StencilMask" template="StencilMask"/> + <function name="StencilMaskSeparate" template="StencilMaskSeparate"/> + <function name="ColorMask" template="ColorMask"/> + <function name="DepthMask" template="DepthMask"/> + <function name="Disable" template="Disable"/> + <function name="Enable" template="Enable"/> + <function name="Finish" template="Finish"/> + <function name="Flush" template="Flush"/> + + <function name="AlphaFunc" template="AlphaFunc" gltype="GLclampf"/> + + <function name="BlendFunc" template="BlendFunc"/> + <function name="LogicOp" template="LogicOp"/> + <function name="StencilFunc" template="StencilFunc"/> + <function name="StencilFuncSeparate" template="StencilFuncSeparate"/> + <function name="StencilOp" template="StencilOp"/> + <function name="StencilOpSeparate" template="StencilOpSeparate"/> + <function name="DepthFunc" template="DepthFunc"/> + <function name="PixelStorei" template="PixelStore" gltype="GLint"/> + + <function name="ReadPixels" template="ReadPixels"/> + <function name="GetBooleanv" template="GetState" gltype="GLboolean"/> + <function name="GetClipPlane" template="GetClipPlane" gltype="GLdouble"/> + <function name="GetError" template="GetError"/> + <function name="GetFloatv" template="GetState" gltype="GLfloat"/> + <function name="GetFixedv" template="GetState" gltype="GLfixed"/> + <function name="GetIntegerv" template="GetState" gltype="GLint"/> + + <function name="GetLightfv" template="GetLight" gltype="GLfloat"/> + <function name="GetMaterialfv" template="GetMaterial" gltype="GLfloat"/> + <function name="GetMaterialiv" template="GetMaterial" gltype="GLint"/> + + <function name="GetString" template="GetString"/> + + <function name="GetTexEnvfv" template="GetTexEnv" gltype="GLfloat"/> + <function name="GetTexEnviv" template="GetTexEnv" gltype="GLint"/> + <function name="GetTexGenfv" template="GetTexGen" gltype="GLfloat"/> + <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/> + <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/> + + <function name="IsEnabled" template="IsEnabled"/> + + <function name="DepthRange" template="DepthRange" gltype="GLclampd"/> + <function name="Frustum" template="Frustum" gltype="GLdouble"/> + + <function name="LoadIdentity" template="LoadIdentity"/> + <function name="LoadMatrixf" template="LoadMatrix" gltype="GLfloat"/> + <function name="MatrixMode" template="MatrixMode"/> + + <function name="MultMatrixf" template="MultMatrix" gltype="GLfloat"/> + <function name="Ortho" template="Ortho" gltype="GLdouble"/> + <function name="PopMatrix" template="PopMatrix"/> + <function name="PushMatrix" template="PushMatrix"/> + + <function name="Rotatef" template="Rotate" gltype="GLfloat"/> + <function name="Scalef" template="Scale" gltype="GLfloat"/> + <function name="Translatef" template="Translate" gltype="GLfloat"/> + + <function name="Viewport" template="Viewport"/> + + <function name="ColorPointer" template="ColorPointer"/> + <function name="DisableClientState" template="DisableClientState"/> + <function name="DrawArrays" template="DrawArrays"/> + <function name="DrawElements" template="DrawElements"/> + <function name="EnableClientState" template="EnableClientState"/> + + <function name="GetPointerv" template="GetPointer"/> + <function name="Normal3f" default_prefix="_vbo_" template="Normal" gltype="GLfloat" expand_vector="true"/> + <function name="NormalPointer" template="NormalPointer"/> + <function name="TexCoordPointer" template="TexCoordPointer"/> + <function name="VertexPointer" template="VertexPointer"/> + + <function name="PolygonOffset" template="PolygonOffset" gltype="GLfloat"/> + <function name="CopyTexImage2D" template="CopyTexImage2D"/> + <function name="CopyTexSubImage2D" template="CopyTexSubImage2D"/> + <function name="TexSubImage2D" template="TexSubImage2D"/> + + <function name="BindTexture" template="BindTexture"/> + <function name="DeleteTextures" template="DeleteTextures"/> + <function name="GenTextures" template="GenTextures"/> + <function name="IsTexture" template="IsTexture"/> + + <function name="BlendColor" template="BlendColor" gltype="GLclampf"/> + <function name="BlendEquation" template="BlendEquation"/> + <function name="BlendEquationSeparateEXT" template="BlendEquationSeparate"/> + + <function name="TexImage3D" template="TexImage3D"/> + <function name="TexSubImage3D" template="TexSubImage3D"/> + <function name="CopyTexSubImage3D" template="CopyTexSubImage3D"/> + + <function name="CompressedTexImage3DARB" template="CompressedTexImage3D"/> + <function name="CompressedTexSubImage3DARB" template="CompressedTexSubImage3D"/> + + <function name="ActiveTextureARB" template="ActiveTexture"/> + <function name="ClientActiveTextureARB" template="ClientActiveTexture"/> + + <function name="MultiTexCoord4f" default_prefix="_vbo_" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/> + + <function name="SampleCoverageARB" template="SampleCoverage" gltype="GLclampf"/> + + <function name="CompressedTexImage2DARB" template="CompressedTexImage2D"/> + <function name="CompressedTexSubImage2DARB" template="CompressedTexSubImage2D"/> + + <function name="BlendFuncSeparateEXT" template="BlendFuncSeparate"/> + + <function name="PointParameterf" template="PointParameter" gltype="GLfloat" expand_vector="true"/> + <function name="PointParameterfv" template="PointParameter" gltype="GLfloat"/> + + <function name="VertexAttrib1f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/> + <function name="VertexAttrib2f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/> + <function name="VertexAttrib3f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/> + <function name="VertexAttrib4f" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/> + <function name="VertexAttrib1fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="1"/> + <function name="VertexAttrib2fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="2"/> + <function name="VertexAttrib3fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="3"/> + <function name="VertexAttrib4fv" default_prefix="_vbo_" template="VertexAttrib" gltype="GLfloat" vector_size="4"/> + + <function name="VertexAttribPointerARB" template="VertexAttribPointer"/> + <function name="EnableVertexAttribArrayARB" template="EnableVertexAttribArray"/> + <function name="DisableVertexAttribArrayARB" template="DisableVertexAttribArray"/> + + <function name="IsProgram" template="IsProgram"/> + <function name="GetProgramiv" template="GetProgram" gltype="GLint"/> + + <function name="GetVertexAttribfvARB" template="GetVertexAttrib" gltype="GLfloat"/> + <function name="GetVertexAttribivARB" template="GetVertexAttrib" gltype="GLint"/> + <function name="GetVertexAttribPointervARB" template="GetVertexAttribPointer"/> + + <function name="GetBufferPointervARB" template="GetBufferPointer"/> + <function name="MapBufferARB" template="MapBuffer"/> + <function name="UnmapBufferARB" template="UnmapBuffer"/> + <function name="BindBufferARB" template="BindBuffer"/> + <function name="BufferDataARB" template="BufferData"/> + <function name="BufferSubDataARB" template="BufferSubData"/> + <function name="DeleteBuffersARB" template="DeleteBuffers"/> + <function name="GenBuffersARB" template="GenBuffers"/> + <function name="GetBufferParameterivARB" template="GetBufferParameter" gltype="GLint"/> + <function name="IsBufferARB" template="IsBuffer"/> + + <function name="CreateShader" template="CreateShader"/> + <function name="ShaderSourceARB" template="ShaderSource"/> + <function name="CompileShaderARB" template="CompileShader"/> + <function name="ReleaseShaderCompiler" template="ReleaseShaderCompiler"/> + <function name="DeleteShader" template="DeleteShader"/> + <function name="ShaderBinary" template="ShaderBinary"/> + <function name="CreateProgram" template="CreateProgram"/> + <function name="AttachShader" template="AttachShader"/> + <function name="DetachShader" template="DetachShader"/> + <function name="LinkProgramARB" template="LinkProgram"/> + <function name="UseProgramObjectARB" template="UseProgram"/> + <function name="DeleteProgram" template="DeleteProgram"/> + + <function name="GetActiveAttribARB" template="GetActiveAttrib"/> + <function name="GetAttribLocationARB" template="GetAttribLocation"/> + <function name="BindAttribLocationARB" template="BindAttribLocation"/> + <function name="GetUniformLocationARB" template="GetUniformLocation"/> + <function name="GetActiveUniformARB" template="GetActiveUniform"/> + + <function name="Uniform1fARB" template="Uniform" gltype="GLfloat" vector_size="1" expand_vector="true"/> + <function name="Uniform2fARB" template="Uniform" gltype="GLfloat" vector_size="2" expand_vector="true"/> + <function name="Uniform3fARB" template="Uniform" gltype="GLfloat" vector_size="3" expand_vector="true"/> + <function name="Uniform4fARB" template="Uniform" gltype="GLfloat" vector_size="4" expand_vector="true"/> + <function name="Uniform1iARB" template="Uniform" gltype="GLint" vector_size="1" expand_vector="true"/> + <function name="Uniform2iARB" template="Uniform" gltype="GLint" vector_size="2" expand_vector="true"/> + <function name="Uniform3iARB" template="Uniform" gltype="GLint" vector_size="3" expand_vector="true"/> + <function name="Uniform4iARB" template="Uniform" gltype="GLint" vector_size="4" expand_vector="true"/> + <function name="Uniform1fvARB" template="Uniform" gltype="GLfloat" vector_size="1"/> + <function name="Uniform2fvARB" template="Uniform" gltype="GLfloat" vector_size="2"/> + <function name="Uniform3fvARB" template="Uniform" gltype="GLfloat" vector_size="3"/> + <function name="Uniform4fvARB" template="Uniform" gltype="GLfloat" vector_size="4"/> + <function name="Uniform1ivARB" template="Uniform" gltype="GLint" vector_size="1"/> + <function name="Uniform2ivARB" template="Uniform" gltype="GLint" vector_size="2"/> + <function name="Uniform3ivARB" template="Uniform" gltype="GLint" vector_size="3"/> + <function name="Uniform4ivARB" template="Uniform" gltype="GLint" vector_size="4"/> + + <function name="UniformMatrix2fvARB" template="UniformMatrix" gltype="GLfloat" vector_size="2"/> + <function name="UniformMatrix3fvARB" template="UniformMatrix" gltype="GLfloat" vector_size="3"/> + <function name="UniformMatrix4fvARB" template="UniformMatrix" gltype="GLfloat" vector_size="4"/> + + <function name="ValidateProgramARB" template="ValidateProgram"/> + + <function name="GenerateMipmapEXT" template="GenerateMipmap"/> + <function name="BindFramebufferEXT" template="BindFramebuffer"/> + <function name="DeleteFramebuffersEXT" template="DeleteFramebuffers"/> + <function name="GenFramebuffersEXT" template="GenFramebuffers"/> + <function name="BindRenderbufferEXT" template="BindRenderbuffer"/> + <function name="DeleteRenderbuffersEXT" template="DeleteRenderbuffers"/> + <function name="GenRenderbuffersEXT" template="GenRenderbuffers"/> + <function name="RenderbufferStorageEXT" template="RenderbufferStorage"/> + <function name="FramebufferRenderbufferEXT" template="FramebufferRenderbuffer"/> + <function name="FramebufferTexture2DEXT" template="FramebufferTexture2D"/> + <function name="FramebufferTexture3DEXT" template="FramebufferTexture3D"/> + <function name="CheckFramebufferStatusEXT" template="CheckFramebufferStatus"/> + <function name="GetFramebufferAttachmentParameterivEXT" template="GetFramebufferAttachmentParameter" gltype="GLint"/> + <function name="GetRenderbufferParameterivEXT" template="GetRenderbufferParameter" gltype="GLint"/> + <function name="IsRenderbufferEXT" template="IsRenderbuffer"/> + <function name="IsFramebufferEXT" template="IsFramebuffer"/> + + <function name="IsShader" template="IsShader"/> + <function name="GetShaderiv" template="GetShader" gltype="GLint"/> + <function name="GetAttachedShaders" template="GetAttachedShaders"/> + <function name="GetShaderInfoLog" template="GetShaderInfoLog"/> + <function name="GetProgramInfoLog" template="GetProgramInfoLog"/> + <function name="GetShaderSourceARB" template="GetShaderSource"/> + <function name="GetShaderPrecisionFormat" template="GetShaderPrecisionFormat"/> + <function name="GetUniformfvARB" template="GetUniform" gltype="GLfloat"/> + <function name="GetUniformivARB" template="GetUniform" gltype="GLint"/> + + <function name="DrawTexf" template="DrawTex" gltype="GLfloat" expand_vector="true"/> + <function name="DrawTexfv" template="DrawTex" gltype="GLfloat"/> + <function name="DrawTexi" template="DrawTex" gltype="GLint" expand_vector="true"/> + <function name="DrawTexiv" template="DrawTex" gltype="GLint"/> + <function name="DrawTexs" template="DrawTex" gltype="GLshort" expand_vector="true"/> + <function name="DrawTexsv" template="DrawTex" gltype="GLshort"/> + + <!-- EXT_multi_draw_arrays --> + <function name="MultiDrawArraysEXT" template="MultiDrawArrays"/> + <function name="MultiDrawElementsEXT" template="MultiDrawElements"/> + + <!-- OES_EGL_image --> + <function name="EGLImageTargetTexture2DOES" template="EGLImageTargetTexture2D"/> + <function name="EGLImageTargetRenderbufferStorageOES" template="EGLImageTargetRenderbufferStorage"/> +</api> + +<api name="GLES1.1"> + <category name="GLES1.1"/> + + <category name="OES_byte_coordinates"/> + <category name="OES_fixed_point"/> + <category name="OES_single_precision"/> + <category name="OES_matrix_get"/> + <category name="OES_read_format"/> + <category name="OES_compressed_paletted_texture"/> + <category name="OES_point_size_array"/> + <category name="OES_point_sprite"/> + <category name="OES_query_matrix"/> + <category name="OES_draw_texture"/> + <category name="OES_blend_equation_separate"/> + <category name="OES_blend_func_separate"/> + <category name="OES_blend_subtract"/> + <category name="OES_stencil_wrap"/> + <category name="OES_texture_cube_map"/> + <category name="OES_texture_env_crossbar"/> + <category name="OES_texture_mirrored_repeat"/> + <category name="OES_framebuffer_object"/> + <category name="OES_depth24"/> + <category name="OES_depth32"/> + <category name="OES_fbo_render_mipmap"/> + <category name="OES_rgb8_rgba8"/> + <category name="OES_stencil1"/> + <category name="OES_stencil4"/> + <category name="OES_stencil8"/> + <category name="OES_element_index_uint"/> + <category name="OES_mapbuffer"/> + <category name="EXT_texture_filter_anisotropic"/> + + <category name="ARB_texture_non_power_of_two"/> + <!-- disabled due to missing enums + <category name="EXT_texture_compression_dxt1"/> + --> + <category name="EXT_texture_lod_bias"/> + <category name="EXT_blend_minmax"/> + <category name="EXT_multi_draw_arrays"/> + <category name="OES_EGL_image"/> + + <category name="OES_matrix_palette"/> + + <function name="Color4f" template="Color" gltype="GLfloat" vector_size="4" expand_vector="true"/> + <function name="Color4ub" template="Color" gltype="GLubyte" vector_size="4" expand_vector="true"/> + <function name="Color4x" template="Color" gltype="GLfixed" vector_size="4" expand_vector="true"/> + + <function name="ClipPlanef" template="ClipPlane" gltype="GLfloat"/> + <function name="ClipPlanex" template="ClipPlane" gltype="GLfixed"/> + + <function name="CullFace" template="CullFace"/> + + <function name="Fogf" template="Fog" gltype="GLfloat" expand_vector="true"/> + <function name="Fogx" template="Fog" gltype="GLfixed" expand_vector="true"/> + <function name="Fogfv" template="Fog" gltype="GLfloat"/> + <function name="Fogxv" template="Fog" gltype="GLfixed"/> + + <function name="FrontFace" template="FrontFace"/> + <function name="Hint" template="Hint"/> + + <function name="Lightf" template="Light" gltype="GLfloat" expand_vector="true"/> + <function name="Lightx" template="Light" gltype="GLfixed" expand_vector="true"/> + <function name="Lightfv" template="Light" gltype="GLfloat"/> + <function name="Lightxv" template="Light" gltype="GLfixed"/> + + <function name="LightModelf" template="LightModel" gltype="GLfloat" expand_vector="true"/> + <function name="LightModelx" template="LightModel" gltype="GLfixed" expand_vector="true"/> + <function name="LightModelfv" template="LightModel" gltype="GLfloat"/> + <function name="LightModelxv" template="LightModel" gltype="GLfixed"/> + + <function name="LineWidth" template="LineWidth" gltype="GLfloat"/> + <function name="LineWidthx" template="LineWidth" gltype="GLfixed"/> + + <function name="Materialf" template="Material" gltype="GLfloat" expand_vector="true"/> + <function name="Materialfv" template="Material" gltype="GLfloat"/> + <function name="Materialx" template="Material" gltype="GLfixed" expand_vector="true"/> + <function name="Materialxv" template="Material" gltype="GLfixed"/> + + <function name="PointSize" template="PointSize" gltype="GLfloat"/> + <function name="PointSizex" template="PointSize" gltype="GLfixed"/> + <function name="PointSizePointerOES" template="PointSizePointer"/> + + <function name="Scissor" template="Scissor"/> + <function name="ShadeModel" template="ShadeModel"/> + + <function name="TexParameterf" template="TexParameter" gltype="GLfloat" expand_vector="true"/> + <function name="TexParameterfv" template="TexParameter" gltype="GLfloat"/> + <function name="TexParameteri" template="TexParameter" gltype="GLint" expand_vector="true"/> + <function name="TexParameteriv" template="TexParameter" gltype="GLint"/> + <function name="TexParameterx" template="TexParameter" gltype="GLfixed" expand_vector="true"/> + <function name="TexParameterxv" template="TexParameter" gltype="GLfixed"/> + + <function name="TexImage2D" template="TexImage2D"/> + + <function name="TexEnvf" template="TexEnv" gltype="GLfloat" expand_vector="true"/> + <function name="TexEnvfv" template="TexEnv" gltype="GLfloat"/> + <function name="TexEnvi" template="TexEnv" gltype="GLint" expand_vector="true"/> + <function name="TexEnviv" template="TexEnv" gltype="GLint"/> + <function name="TexEnvx" template="TexEnv" gltype="GLfixed" expand_vector="true"/> + <function name="TexEnvxv" template="TexEnv" gltype="GLfixed"/> + + <function name="TexGenfOES" external="true" template="TexGen" gltype="GLfloat" expand_vector="true"/> + <function name="TexGenfvOES" external="true" template="TexGen" gltype="GLfloat"/> + <function name="TexGeniOES" external="true" template="TexGen" gltype="GLint" expand_vector="true"/> + <function name="TexGenivOES" external="true" template="TexGen" gltype="GLint"/> + <function name="TexGenxOES" external="true" template="TexGen" gltype="GLfixed" expand_vector="true"/> + <function name="TexGenxvOES" external="true" template="TexGen" gltype="GLfixed"/> + + <function name="Clear" template="Clear"/> + <function name="ClearColor" template="ClearColor" gltype="GLclampf"/> + <function name="ClearColorx" template="ClearColor" gltype="GLclampx"/> + + <function name="ClearStencil" template="ClearStencil"/> + <function name="ClearDepthf" template="ClearDepth" gltype="GLclampf"/> + <function name="ClearDepthx" template="ClearDepth" gltype="GLclampx"/> + + <function name="StencilMask" template="StencilMask"/> + <function name="ColorMask" template="ColorMask"/> + <function name="DepthMask" template="DepthMask"/> + + <function name="Disable" template="Disable"/> + <function name="Enable" template="Enable"/> + <function name="Finish" template="Finish"/> + <function name="Flush" template="Flush"/> + + <function name="AlphaFunc" template="AlphaFunc" gltype="GLclampf"/> + <function name="AlphaFuncx" template="AlphaFunc" gltype="GLclampx"/> + + <function name="BlendFunc" template="BlendFunc"/> + <function name="LogicOp" template="LogicOp"/> + <function name="StencilFunc" template="StencilFunc"/> + + <function name="StencilOp" template="StencilOp"/> + <function name="DepthFunc" template="DepthFunc"/> + + <function name="PixelStorei" template="PixelStore" gltype="GLint"/> + <function name="ReadPixels" template="ReadPixels"/> + + <function name="GetBooleanv" template="GetState" gltype="GLboolean"/> + + <function name="GetClipPlanef" template="GetClipPlane" gltype="GLfloat"/> + <function name="GetClipPlanex" template="GetClipPlane" gltype="GLfixed"/> + + <function name="GetError" template="GetError"/> + <function name="GetFloatv" template="GetState" gltype="GLfloat"/> + <function name="GetFixedv" template="GetState" gltype="GLfixed"/> + <function name="GetIntegerv" template="GetState" gltype="GLint"/> + + <function name="GetLightfv" template="GetLight" gltype="GLfloat"/> + <function name="GetLightxv" template="GetLight" gltype="GLfixed"/> + + <function name="GetMaterialfv" template="GetMaterial" gltype="GLfloat"/> + <function name="GetMaterialxv" template="GetMaterial" gltype="GLfixed"/> + + <function name="GetString" template="GetString"/> + + <function name="GetTexEnvfv" template="GetTexEnv" gltype="GLfloat"/> + <function name="GetTexEnviv" template="GetTexEnv" gltype="GLint"/> + <function name="GetTexEnvxv" template="GetTexEnv" gltype="GLfixed"/> + + <function name="GetTexGenfvOES" external="true" template="GetTexGen" gltype="GLfloat"/> + <function name="GetTexGenivOES" external="true" template="GetTexGen" gltype="GLint"/> + <function name="GetTexGenxvOES" external="true" template="GetTexGen" gltype="GLfixed"/> + + <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/> + <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/> + <function name="GetTexParameterxv" template="GetTexParameter" gltype="GLfixed"/> + + <function name="IsEnabled" template="IsEnabled"/> + + <function name="DepthRangef" template="DepthRange" gltype="GLclampf"/> + <function name="DepthRangex" template="DepthRange" gltype="GLclampx"/> + + <function name="Frustumf" template="Frustum" gltype="GLfloat"/> + <function name="Frustumx" template="Frustum" gltype="GLfixed"/> + + <function name="LoadIdentity" template="LoadIdentity"/> + <function name="LoadMatrixf" template="LoadMatrix" gltype="GLfloat"/> + <function name="LoadMatrixx" template="LoadMatrix" gltype="GLfixed"/> + <function name="MatrixMode" template="MatrixMode"/> + + <function name="MultMatrixf" template="MultMatrix" gltype="GLfloat"/> + <function name="MultMatrixx" template="MultMatrix" gltype="GLfixed"/> + <function name="Orthof" template="Ortho" gltype="GLfloat"/> + <function name="Orthox" template="Ortho" gltype="GLfixed"/> + + <function name="PopMatrix" template="PopMatrix"/> + <function name="PushMatrix" template="PushMatrix"/> + + <function name="Rotatef" template="Rotate" gltype="GLfloat"/> + <function name="Rotatex" template="Rotate" gltype="GLfixed"/> + <function name="Scalef" template="Scale" gltype="GLfloat"/> + <function name="Scalex" template="Scale" gltype="GLfixed"/> + <function name="Translatef" template="Translate" gltype="GLfloat"/> + <function name="Translatex" template="Translate" gltype="GLfixed"/> + + <function name="Viewport" template="Viewport"/> + <function name="ColorPointer" template="ColorPointer"/> + <function name="DisableClientState" template="DisableClientState"/> + <function name="DrawArrays" template="DrawArrays"/> + <function name="DrawElements" template="DrawElements"/> + <function name="EnableClientState" template="EnableClientState"/> + + <function name="GetPointerv" template="GetPointer"/> + + <function name="Normal3f" template="Normal" gltype="GLfloat" expand_vector="true"/> + <function name="Normal3x" template="Normal" gltype="GLfixed" expand_vector="true"/> + <function name="NormalPointer" template="NormalPointer"/> + <function name="TexCoordPointer" template="TexCoordPointer"/> + <function name="VertexPointer" template="VertexPointer"/> + + <function name="PolygonOffset" template="PolygonOffset" gltype="GLfloat"/> + <function name="PolygonOffsetx" template="PolygonOffset" gltype="GLfixed"/> + + <function name="CopyTexImage2D" template="CopyTexImage2D"/> + <function name="CopyTexSubImage2D" template="CopyTexSubImage2D"/> + + <function name="TexSubImage2D" template="TexSubImage2D"/> + + <function name="BindTexture" template="BindTexture"/> + <function name="DeleteTextures" template="DeleteTextures"/> + <function name="GenTextures" template="GenTextures"/> + <function name="IsTexture" template="IsTexture"/> + + <function name="BlendEquationOES" template="BlendEquation"/> + <function name="BlendEquationSeparateOES" template="BlendEquationSeparate"/> + + <function name="MultiTexCoord4x" template="MultiTexCoord" gltype="GLfixed" vector_size="4" expand_vector="true"/> + + <function name="ActiveTexture" template="ActiveTexture"/> + <function name="ClientActiveTexture" template="ClientActiveTexture"/> + + <function name="MultiTexCoord4f" template="MultiTexCoord" gltype="GLfloat" vector_size="4" expand_vector="true"/> + + <function name="SampleCoverage" template="SampleCoverage" gltype="GLclampf"/> + <function name="SampleCoveragex" template="SampleCoverage" gltype="GLclampx"/> + + <!-- CompressedTexImage2D calls out to two different functions based on + whether the image is a paletted image or not --> + <function name="CompressedTexImage2D" template="CompressedTexImage2D"/> + <function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/> + + <function name="BlendFuncSeparateOES" template="BlendFuncSeparate"/> + + <function name="PointParameterf" template="PointParameter" gltype="GLfloat" expand_vector="true"/> + <function name="PointParameterfv" template="PointParameter" gltype="GLfloat"/> + <function name="PointParameterx" template="PointParameter" gltype="GLfixed" expand_vector="true"/> + <function name="PointParameterxv" template="PointParameter" gltype="GLfixed"/> + + <!-- OES_mapbuffer --> + <function name="GetBufferPointervOES" template="GetBufferPointer"/> + <function name="MapBufferOES" template="MapBuffer"/> + <function name="UnmapBufferOES" template="UnmapBuffer"/> + + <function name="BindBuffer" template="BindBuffer"/> + <function name="BufferData" template="BufferData"/> + <function name="BufferSubData" template="BufferSubData"/> + <function name="DeleteBuffers" template="DeleteBuffers"/> + <function name="GenBuffers" template="GenBuffers"/> + <function name="GetBufferParameteriv" template="GetBufferParameter" gltype="GLint"/> + <function name="IsBuffer" template="IsBuffer"/> + + <!-- OES_framebuffer_object --> + <function name="GenerateMipmapOES" template="GenerateMipmap"/> + <function name="BindFramebufferOES" template="BindFramebuffer"/> + <function name="DeleteFramebuffersOES" template="DeleteFramebuffers"/> + <function name="GenFramebuffersOES" template="GenFramebuffers"/> + <function name="BindRenderbufferOES" template="BindRenderbuffer"/> + <function name="DeleteRenderbuffersOES" template="DeleteRenderbuffers"/> + <function name="GenRenderbuffersOES" template="GenRenderbuffers"/> + <function name="RenderbufferStorageOES" external="true" template="RenderbufferStorage"/> + <function name="FramebufferRenderbufferOES" template="FramebufferRenderbuffer"/> + <function name="FramebufferTexture2DOES" template="FramebufferTexture2D"/> + <function name="CheckFramebufferStatusOES" template="CheckFramebufferStatus"/> + <function name="GetFramebufferAttachmentParameterivOES" template="GetFramebufferAttachmentParameter" gltype="GLint"/> + <function name="GetRenderbufferParameterivOES" template="GetRenderbufferParameter" gltype="GLint"/> + <function name="IsRenderbufferOES" template="IsRenderbuffer"/> + <function name="IsFramebufferOES" template="IsFramebuffer"/> + + <!-- OES_query_matrix --> + <!-- QueryMatrixx returns values in an unusual, decomposed, fixed-value + form; it has its own code for this --> + <function name="QueryMatrixxOES" external="true" template="QueryMatrix" gltype="GLfixed"/> + + <!-- OES_draw_texture --> + <function name="DrawTexfOES" template="DrawTex" gltype="GLfloat" expand_vector="true"/> + <function name="DrawTexiOES" template="DrawTex" gltype="GLint" expand_vector="true"/> + <function name="DrawTexsOES" template="DrawTex" gltype="GLshort" expand_vector="true"/> + <function name="DrawTexxOES" template="DrawTex" gltype="GLfixed" expand_vector="true"/> + <function name="DrawTexfvOES" template="DrawTex" gltype="GLfloat"/> + <function name="DrawTexivOES" template="DrawTex" gltype="GLint"/> + <function name="DrawTexsvOES" template="DrawTex" gltype="GLshort"/> + <function name="DrawTexxvOES" template="DrawTex" gltype="GLfixed"/> + + <!-- EXT_multi_draw_arrays --> + <function name="MultiDrawArraysEXT" template="MultiDrawArrays"/> + <function name="MultiDrawElementsEXT" template="MultiDrawElements"/> + + <!-- OES_EGL_image --> + <function name="EGLImageTargetTexture2DOES" template="EGLImageTargetTexture2D"/> + <function name="EGLImageTargetRenderbufferStorageOES" template="EGLImageTargetRenderbufferStorage"/> +</api> + +<api name="GLES2.0"> + <category name="GLES2.0"/> + + <category name="OES_compressed_paletted_texture"/> + <category name="OES_depth24"/> + <category name="OES_depth32"/> + <category name="OES_fbo_render_mipmap"/> + <category name="OES_rgb8_rgba8"/> + <category name="OES_stencil1"/> + <category name="OES_stencil4"/> + <category name="OES_element_index_uint"/> + <category name="OES_mapbuffer"/> + <category name="OES_texture_3D"/> + <category name="OES_texture_npot"/> + <category name="EXT_texture_filter_anisotropic"/> + <category name="EXT_texture_type_2_10_10_10_REV"/> + <category name="OES_depth_texture"/> + <category name="OES_packed_depth_stencil"/> + <category name="OES_standard_derivatives"/> + + <category name="EXT_texture_compression_dxt1"/> + <category name="EXT_blend_minmax"/> + <category name="EXT_multi_draw_arrays"/> + <category name="OES_EGL_image"/> + + <function name="CullFace" template="CullFace"/> + + <function name="FrontFace" template="FrontFace"/> + <function name="Hint" template="Hint"/> + + <function name="LineWidth" template="LineWidth" gltype="GLfloat"/> + + <function name="Scissor" template="Scissor"/> + + <function name="TexParameterf" template="TexParameter" gltype="GLfloat" expand_vector="true"/> + <function name="TexParameterfv" template="TexParameter" gltype="GLfloat"/> + <function name="TexParameteri" template="TexParameter" gltype="GLint" expand_vector="true"/> + <function name="TexParameteriv" template="TexParameter" gltype="GLint"/> + + <function name="TexImage2D" template="TexImage2D"/> + + <function name="Clear" template="Clear"/> + <function name="ClearColor" template="ClearColor" gltype="GLclampf"/> + <function name="ClearStencil" template="ClearStencil"/> + <function name="ClearDepthf" template="ClearDepth" gltype="GLclampf"/> + + <function name="StencilMask" template="StencilMask"/> + <function name="StencilMaskSeparate" template="StencilMaskSeparate"/> + <function name="ColorMask" template="ColorMask"/> + <function name="DepthMask" template="DepthMask"/> + <function name="Disable" template="Disable"/> + <function name="Enable" template="Enable"/> + <function name="Finish" template="Finish"/> + <function name="Flush" template="Flush"/> + + <function name="BlendFunc" template="BlendFunc"/> + + <function name="StencilFunc" template="StencilFunc"/> + <function name="StencilFuncSeparate" template="StencilFuncSeparate"/> + <function name="StencilOp" template="StencilOp"/> + <function name="StencilOpSeparate" template="StencilOpSeparate"/> + + <function name="DepthFunc" template="DepthFunc"/> + + <function name="PixelStorei" template="PixelStore" gltype="GLint"/> + <function name="ReadPixels" template="ReadPixels"/> + + <function name="GetBooleanv" template="GetState" gltype="GLboolean"/> + <function name="GetError" template="GetError"/> + <function name="GetFloatv" template="GetState" gltype="GLfloat"/> + <function name="GetIntegerv" template="GetState" gltype="GLint"/> + + <function name="GetString" template="GetString"/> + + <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/> + <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/> + + <function name="IsEnabled" template="IsEnabled"/> + + <function name="DepthRangef" template="DepthRange" gltype="GLclampf"/> + + <function name="Viewport" template="Viewport"/> + + <function name="DrawArrays" template="DrawArrays"/> + <function name="DrawElements" template="DrawElements"/> + + <function name="PolygonOffset" template="PolygonOffset" gltype="GLfloat"/> + <function name="CopyTexImage2D" template="CopyTexImage2D"/> + <function name="CopyTexSubImage2D" template="CopyTexSubImage2D"/> + <function name="TexSubImage2D" template="TexSubImage2D"/> + + <function name="BindTexture" template="BindTexture"/> + <function name="DeleteTextures" template="DeleteTextures"/> + <function name="GenTextures" template="GenTextures"/> + <function name="IsTexture" template="IsTexture"/> + + <function name="BlendColor" template="BlendColor" gltype="GLclampf"/> + <function name="BlendEquation" template="BlendEquation"/> + <function name="BlendEquationSeparate" template="BlendEquationSeparate"/> + + <function name="TexImage3DOES" template="TexImage3D"/> + <function name="TexSubImage3DOES" template="TexSubImage3D"/> + <function name="CopyTexSubImage3DOES" template="CopyTexSubImage3D"/> + + <function name="CompressedTexImage3DOES" template="CompressedTexImage3D"/> + <function name="CompressedTexSubImage3DOES" template="CompressedTexSubImage3D"/> + + <function name="ActiveTexture" template="ActiveTexture"/> + + <function name="SampleCoverage" template="SampleCoverage" gltype="GLclampf"/> + + <function name="CompressedTexImage2D" template="CompressedTexImage2D"/> + <function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/> + + <function name="BlendFuncSeparate" template="BlendFuncSeparate"/> + + <function name="VertexAttrib1f" template="VertexAttrib" gltype="GLfloat" vector_size="1" expand_vector="true"/> + <function name="VertexAttrib2f" template="VertexAttrib" gltype="GLfloat" vector_size="2" expand_vector="true"/> + <function name="VertexAttrib3f" template="VertexAttrib" gltype="GLfloat" vector_size="3" expand_vector="true"/> + <function name="VertexAttrib4f" template="VertexAttrib" gltype="GLfloat" vector_size="4" expand_vector="true"/> + <function name="VertexAttrib1fv" template="VertexAttrib" gltype="GLfloat" vector_size="1"/> + <function name="VertexAttrib2fv" template="VertexAttrib" gltype="GLfloat" vector_size="2"/> + <function name="VertexAttrib3fv" template="VertexAttrib" gltype="GLfloat" vector_size="3"/> + <function name="VertexAttrib4fv" template="VertexAttrib" gltype="GLfloat" vector_size="4"/> + + <function name="VertexAttribPointer" template="VertexAttribPointer"/> + + <function name="EnableVertexAttribArray" template="EnableVertexAttribArray"/> + <function name="DisableVertexAttribArray" template="DisableVertexAttribArray"/> + + <function name="IsProgram" template="IsProgram"/> + <function name="GetProgramiv" template="GetProgram" gltype="GLint"/> + + <function name="GetVertexAttribfv" template="GetVertexAttrib" gltype="GLfloat"/> + <function name="GetVertexAttribiv" template="GetVertexAttrib" gltype="GLint"/> + <function name="GetVertexAttribPointerv" template="GetVertexAttribPointer"/> + + <function name="GetBufferPointervOES" template="GetBufferPointer"/> + <function name="MapBufferOES" template="MapBuffer"/> + <function name="UnmapBufferOES" template="UnmapBuffer"/> + <function name="BindBuffer" template="BindBuffer"/> + <function name="BufferData" template="BufferData"/> + <function name="BufferSubData" template="BufferSubData"/> + <function name="DeleteBuffers" template="DeleteBuffers"/> + <function name="GenBuffers" template="GenBuffers"/> + <function name="GetBufferParameteriv" template="GetBufferParameter" gltype="GLint"/> + <function name="IsBuffer" template="IsBuffer"/> + + <function name="CreateShader" template="CreateShader"/> + <function name="ShaderSource" template="ShaderSource"/> + <function name="CompileShader" template="CompileShader"/> + <function name="ReleaseShaderCompiler" template="ReleaseShaderCompiler"/> + <function name="DeleteShader" template="DeleteShader"/> + <function name="ShaderBinary" template="ShaderBinary"/> + <function name="CreateProgram" template="CreateProgram"/> + <function name="AttachShader" template="AttachShader"/> + <function name="DetachShader" template="DetachShader"/> + <function name="LinkProgram" template="LinkProgram"/> + <function name="UseProgram" template="UseProgram"/> + <function name="DeleteProgram" template="DeleteProgram"/> + + <function name="GetActiveAttrib" template="GetActiveAttrib"/> + <function name="GetAttribLocation" template="GetAttribLocation"/> + <function name="BindAttribLocation" template="BindAttribLocation"/> + <function name="GetUniformLocation" template="GetUniformLocation"/> + <function name="GetActiveUniform" template="GetActiveUniform"/> + + <function name="Uniform1f" template="Uniform" gltype="GLfloat" vector_size="1" expand_vector="true"/> + <function name="Uniform2f" template="Uniform" gltype="GLfloat" vector_size="2" expand_vector="true"/> + <function name="Uniform3f" template="Uniform" gltype="GLfloat" vector_size="3" expand_vector="true"/> + <function name="Uniform4f" template="Uniform" gltype="GLfloat" vector_size="4" expand_vector="true"/> + <function name="Uniform1i" template="Uniform" gltype="GLint" vector_size="1" expand_vector="true"/> + <function name="Uniform2i" template="Uniform" gltype="GLint" vector_size="2" expand_vector="true"/> + <function name="Uniform3i" template="Uniform" gltype="GLint" vector_size="3" expand_vector="true"/> + <function name="Uniform4i" template="Uniform" gltype="GLint" vector_size="4" expand_vector="true"/> + + <function name="Uniform1fv" template="Uniform" gltype="GLfloat" vector_size="1"/> + <function name="Uniform2fv" template="Uniform" gltype="GLfloat" vector_size="2"/> + <function name="Uniform3fv" template="Uniform" gltype="GLfloat" vector_size="3"/> + <function name="Uniform4fv" template="Uniform" gltype="GLfloat" vector_size="4"/> + <function name="Uniform1iv" template="Uniform" gltype="GLint" vector_size="1"/> + <function name="Uniform2iv" template="Uniform" gltype="GLint" vector_size="2"/> + <function name="Uniform3iv" template="Uniform" gltype="GLint" vector_size="3"/> + <function name="Uniform4iv" template="Uniform" gltype="GLint" vector_size="4"/> + + <function name="UniformMatrix2fv" template="UniformMatrix" gltype="GLfloat" vector_size="2"/> + <function name="UniformMatrix3fv" template="UniformMatrix" gltype="GLfloat" vector_size="3"/> + <function name="UniformMatrix4fv" template="UniformMatrix" gltype="GLfloat" vector_size="4"/> + + <function name="ValidateProgram" template="ValidateProgram"/> + + <function name="GenerateMipmap" template="GenerateMipmap"/> + <function name="BindFramebuffer" template="BindFramebuffer"/> + <function name="DeleteFramebuffers" template="DeleteFramebuffers"/> + <function name="GenFramebuffers" template="GenFramebuffers"/> + <function name="BindRenderbuffer" template="BindRenderbuffer"/> + <function name="DeleteRenderbuffers" template="DeleteRenderbuffers"/> + <function name="GenRenderbuffers" template="GenRenderbuffers"/> + <function name="RenderbufferStorage" external="true" template="RenderbufferStorage"/> + <function name="FramebufferRenderbuffer" template="FramebufferRenderbuffer"/> + <function name="FramebufferTexture2D" template="FramebufferTexture2D"/> + <function name="FramebufferTexture3DOES" template="FramebufferTexture3D"/> + <function name="CheckFramebufferStatus" template="CheckFramebufferStatus"/> + <function name="GetFramebufferAttachmentParameteriv" template="GetFramebufferAttachmentParameter" gltype="GLint"/> + <function name="GetRenderbufferParameteriv" template="GetRenderbufferParameter" gltype="GLint"/> + <function name="IsRenderbuffer" template="IsRenderbuffer"/> + <function name="IsFramebuffer" template="IsFramebuffer"/> + + <function name="IsShader" template="IsShader"/> + <function name="GetShaderiv" template="GetShader" gltype="GLint"/> + <function name="GetAttachedShaders" template="GetAttachedShaders"/> + <function name="GetShaderInfoLog" template="GetShaderInfoLog"/> + <function name="GetProgramInfoLog" template="GetProgramInfoLog"/> + <function name="GetShaderSource" template="GetShaderSource"/> + <function name="GetShaderPrecisionFormat" template="GetShaderPrecisionFormat"/> + <function name="GetUniformfv" template="GetUniform" gltype="GLfloat"/> + <function name="GetUniformiv" template="GetUniform" gltype="GLint"/> + + <!-- EXT_multi_draw_arrays --> + <function name="MultiDrawArraysEXT" template="MultiDrawArrays"/> + <function name="MultiDrawElementsEXT" template="MultiDrawElements"/> + + <!-- OES_EGL_image --> + <function name="EGLImageTargetTexture2DOES" template="EGLImageTargetTexture2D"/> + <function name="EGLImageTargetRenderbufferStorageOES" template="EGLImageTargetRenderbufferStorage"/> +</api> + +</apispec> diff --git a/mesalib/src/mesa/main/APIspecutil.py b/mesalib/src/mesa/main/APIspecutil.py new file mode 100644 index 000000000..9e604bb84 --- /dev/null +++ b/mesalib/src/mesa/main/APIspecutil.py @@ -0,0 +1,272 @@ +#!/usr/bin/python +# +# Copyright (C) 2009 Chia-I Wu <olv@0xlab.org> +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +""" +Minimal apiutil.py interface for use by es_generator.py. +""" + +import sys +import libxml2 + +import APIspec + +__spec = {} +__functions = {} +__aliases = {} + +def _ParseXML(filename, apiname): + conversions = { + # from to + 'GLfloat': [ 'GLdouble' ], + 'GLclampf': [ 'GLclampd' ], + 'GLubyte': [ 'GLfloat', 'GLdouble' ], + 'GLint': [ 'GLfloat', 'GLdouble' ], + 'GLfixed': [ 'GLfloat', 'GLdouble' ], + 'GLclampx': [ 'GLclampf', 'GLclampd' ], + } + + doc = libxml2.readFile(filename, None, + libxml2.XML_PARSE_DTDLOAD + + libxml2.XML_PARSE_DTDVALID + + libxml2.XML_PARSE_NOBLANKS) + spec = APIspec.Spec(doc) + impl = spec.get_impl() + api = spec.get_api(apiname) + doc.freeDoc() + + __spec["impl"] = impl + __spec["api"] = api + + for func in api.functions: + alias, need_conv = impl.match(func, conversions) + if not alias: + # external functions are manually dispatched + if not func.is_external: + print >>sys.stderr, "Error: unable to dispatch %s" % func.name + alias = func + need_conv = False + + __functions[func.name] = func + __aliases[func.name] = (alias, need_conv) + + +def AllSpecials(notused=None): + """Return a list of all external functions in the API.""" + api = __spec["api"] + + specials = [] + for func in api.functions: + if func.is_external: + specials.append(func.name) + + return specials + + +def GetAllFunctions(filename, api): + """Return sorted list of all functions in the API.""" + if not __spec: + _ParseXML(filename, api) + + api = __spec["api"] + names = [] + for func in api.functions: + names.append(func.name) + names.sort() + return names + + +def ReturnType(funcname): + """Return the C return type of named function.""" + func = __functions[funcname] + return func.return_type + + +def Properties(funcname): + """Return list of properties of the named GL function.""" + func = __functions[funcname] + return [func.direction] + + +def _ValidValues(func, param): + """Return the valid values of a parameter.""" + valid_values = [] + switch = func.checker.switches.get(param.name, []) + for desc in switch: + # no dependent vector + if not desc.checker.switches: + for val in desc.values: + valid_values.append((val, None, None, [], desc.error, None)) + continue + + items = desc.checker.switches.items() + if len(items) > 1: + print >>sys.stderr, "%s: more than one parameter depend on %s" % \ + (func.name, desc.name) + dep_name, dep_switch = items[0] + + for dep_desc in dep_switch: + if dep_desc.index >= 0 and dep_desc.index != 0: + print >>sys.stderr, "%s: not first element of a vector" % func.name + if dep_desc.checker.switches: + print >>sys.stderr, "%s: deep nested dependence" % func.name + + convert = None if dep_desc.convert else "noconvert" + for val in desc.values: + valid_values.append((val, dep_desc.size_str, dep_desc.name, + dep_desc.values, dep_desc.error, convert)) + return valid_values + + +def _Conversion(func, src_param): + """Return the destination type of the conversion, or None.""" + alias, need_conv = __aliases[func.name] + if need_conv: + dst_param = alias.get_param(src_param.name) + if src_param.type == dst_param.type: + need_conv = False + if not need_conv: + return (None, "none") + + converts = { True: 0, False: 0 } + + # In Fogx, for example, pname may be GL_FOG_DENSITY/GL_FOG_START/GL_FOG_END + # or GL_FOG_MODE. In the former three cases, param is not checked and the + # default is to convert. + if not func.checker.always_check(src_param.name): + converts[True] += 1 + + for desc in func.checker.flatten(src_param.name): + converts[desc.convert] += 1 + if converts[True] and converts[False]: + break + + # it should be "never", "sometimes", and "always"... + if converts[False]: + if converts[True]: + conversion = "some" + else: + conversion = "none" + else: + conversion = "all" + + return (dst_param.base_type(), conversion) + + +def _MaxVecSize(func, param): + """Return the largest possible size of a vector.""" + if not param.is_vector: + return 0 + if param.size: + return param.size + + # need to look at all descriptions + size = 0 + for desc in func.checker.flatten(param.name): + if desc.size_str and desc.size_str.isdigit(): + s = int(desc.size_str) + if s > size: + size = s + if not size: + need_conv = __aliases[func.name][1] + if need_conv: + print >>sys.stderr, \ + "Error: unable to dicide the max size of %s in %s" % \ + (param.name, func.name) + return size + + +def _ParameterTuple(func, param): + """Return a parameter tuple. + + [0] -- parameter name + [1] -- parameter type + [2] -- max vector size or 0 + [3] -- dest type the parameter converts to, or None + [4] -- valid values + [5] -- how often does the conversion happen + + """ + vec_size = _MaxVecSize(func, param) + dst_type, conversion = _Conversion(func, param) + valid_values = _ValidValues(func, param) + + return (param.name, param.type, vec_size, dst_type, valid_values, conversion) + + +def Parameters(funcname): + """Return list of tuples of function parameters.""" + func = __functions[funcname] + params = [] + for param in func.params: + params.append(_ParameterTuple(func, param)) + + return params + + +def FunctionPrefix(funcname): + """Return function specific prefix.""" + func = __functions[funcname] + + return func.prefix + + +def FindParamIndex(params, paramname): + """Find the index of a named parameter.""" + for i in xrange(len(params)): + if params[i][0] == paramname: + return i + return None + + +def MakeDeclarationString(params): + """Return a C-style parameter declaration string.""" + string = [] + for p in params: + sep = "" if p[1].endswith("*") else " " + string.append("%s%s%s" % (p[1], sep, p[0])) + if not string: + return "void" + return ", ".join(string) + + +def AliasPrefix(funcname): + """Return the prefix of the function the named function is an alias of.""" + alias = __aliases[funcname][0] + return alias.prefix + + +def Alias(funcname): + """Return the name of the function the named function is an alias of.""" + alias, need_conv = __aliases[funcname] + return alias.name if not need_conv else None + + +def ConversionFunction(funcname): + """Return the name of the function the named function converts to.""" + alias, need_conv = __aliases[funcname] + return alias.name if need_conv else None + + +def Categories(funcname): + """Return all the categories of the named GL function.""" + api = __spec["api"] + return [api.name] diff --git a/mesalib/src/mesa/main/accum.h b/mesalib/src/mesa/main/accum.h index 63740f07e..4b628bafa 100644 --- a/mesalib/src/mesa/main/accum.h +++ b/mesalib/src/mesa/main/accum.h @@ -42,11 +42,6 @@ #if FEATURE_accum -#define _MESA_INIT_ACCUM_FUNCTIONS(driver, impl) \ - do { \ - (driver)->Accum = impl ## Accum; \ - } while (0) - extern void GLAPIENTRY _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); @@ -55,7 +50,7 @@ _mesa_init_accum_dispatch(struct _glapi_table *disp); #else /* FEATURE_accum */ -#define _MESA_INIT_ACCUM_FUNCTIONS(driver, impl) do { } while (0) +#include "main/compiler.h" static INLINE void _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c index fa8d409ca..ae918bf7e 100644 --- a/mesalib/src/mesa/main/api_exec.c +++ b/mesalib/src/mesa/main/api_exec.c @@ -34,11 +34,9 @@ #include "api_loopback.h" #include "api_exec.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program -#include "shader/arbprogram.h" -#endif -#if FEATURE_ATI_fragment_shader -#include "shader/atifragshader.h" +#include "arbprogram.h" #endif +#include "atifragshader.h" #include "attrib.h" #include "blend.h" #if FEATURE_ARB_vertex_buffer_object @@ -89,24 +87,65 @@ #include "texobj.h" #include "texparam.h" #include "texstate.h" +#include "transformfeedback.h" #include "mtypes.h" #include "varray.h" #include "viewport.h" #if FEATURE_NV_vertex_program -#include "shader/nvprogram.h" +#include "nvprogram.h" #endif #if FEATURE_NV_fragment_program -#include "shader/nvprogram.h" +#include "nvprogram.h" #endif #if FEATURE_ARB_shader_objects -#include "shaders.h" +#include "shaderapi.h" +#include "uniforms.h" #endif -#if FEATURE_ARB_sync #include "syncobj.h" -#endif #include "main/dispatch.h" +#if FEATURE_GL + +#ifdef _GLAPI_USE_REMAP_TABLE + +#define need_MESA_remap_table +#include "main/remap.h" +#include "main/remap_helper.h" + +/* This is shared across all APIs but We define this here since + * desktop GL has the biggest remap table. */ +int driDispatchRemapTable[driDispatchRemapTable_size]; + +/** + * Map the functions which are already static. + * + * When a extension function are incorporated into the ABI, the + * extension suffix is usually stripped. Mapping such functions + * makes sure the alternative names are available. + * + * Note that functions mapped by _mesa_init_remap_table() are + * excluded. + */ +void +_mesa_map_static_functions(void) +{ + /* Remap static functions which have alternative names and are in the ABI. + * This is to be on the safe side. glapi should have defined those names. + */ + _mesa_map_function_array(MESA_alt_functions); +} + +void +_mesa_init_remap_table(void) +{ + _mesa_do_init_remap_table(_mesa_function_pool, + driDispatchRemapTable_size, + MESA_remap_table_functions); +} + +#endif /* _GLAPI_USE_REMAP_TABLE */ + /** * Initialize a dispatch table with pointers to Mesa's immediate-mode @@ -118,9 +157,15 @@ * \param ctx GL context to which \c exec belongs. * \param exec dispatch table. */ -void -_mesa_init_exec_table(struct _glapi_table *exec) +struct _glapi_table * +_mesa_create_exec_table(void) { + struct _glapi_table *exec; + + exec = _mesa_alloc_dispatch_table(sizeof *exec); + if (exec == NULL) + return NULL; + #if _HAVE_FULL_GL _mesa_loopback_init_api_table( exec ); #endif @@ -297,33 +342,12 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate); SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate); + #if FEATURE_ARB_shader_objects - SET_AttachShader(exec, _mesa_AttachShader); - SET_CreateProgram(exec, _mesa_CreateProgram); - SET_CreateShader(exec, _mesa_CreateShader); - SET_DeleteProgram(exec, _mesa_DeleteProgram); - SET_DeleteShader(exec, _mesa_DeleteShader); - SET_DetachShader(exec, _mesa_DetachShader); - SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders); - SET_GetProgramiv(exec, _mesa_GetProgramiv); - SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog); - SET_GetShaderiv(exec, _mesa_GetShaderiv); - SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog); - SET_IsProgram(exec, _mesa_IsProgram); - SET_IsShader(exec, _mesa_IsShader); -#endif - - /* OpenGL 2.1 */ -#if FEATURE_ARB_shader_objects - SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv); - SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv); - SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv); - SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv); - SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv); - SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv); + _mesa_init_shader_dispatch(exec); + _mesa_init_shader_uniform_dispatch(exec); #endif - /* 2. GL_EXT_blend_color */ #if 0 /* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */ @@ -477,6 +501,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) /* ???. GL_EXT_depth_bounds_test */ SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT); + /* 352. GL_EXT_transform_feedback */ + _mesa_init_transform_feedback_dispatch(exec); + + /* 364. GL_EXT_provoking_vertex */ SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT); /* ARB 1. GL_ARB_multitexture */ @@ -602,82 +630,11 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB); #endif -#if FEATURE_ARB_shader_objects - SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); - SET_GetHandleARB(exec, _mesa_GetHandleARB); - SET_DetachObjectARB(exec, _mesa_DetachObjectARB); - SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB); - SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB); - SET_CompileShaderARB(exec, _mesa_CompileShaderARB); - SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB); - SET_AttachObjectARB(exec, _mesa_AttachObjectARB); - SET_LinkProgramARB(exec, _mesa_LinkProgramARB); - SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB); - SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB); - SET_Uniform1fARB(exec, _mesa_Uniform1fARB); - SET_Uniform2fARB(exec, _mesa_Uniform2fARB); - SET_Uniform3fARB(exec, _mesa_Uniform3fARB); - SET_Uniform4fARB(exec, _mesa_Uniform4fARB); - SET_Uniform1iARB(exec, _mesa_Uniform1iARB); - SET_Uniform2iARB(exec, _mesa_Uniform2iARB); - SET_Uniform3iARB(exec, _mesa_Uniform3iARB); - SET_Uniform4iARB(exec, _mesa_Uniform4iARB); - SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB); - SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB); - SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB); - SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB); - SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB); - SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB); - SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB); - SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB); - SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB); - SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB); - SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB); - SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB); - SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB); - SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB); - SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB); - SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB); - SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB); - SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB); - SET_GetUniformivARB(exec, _mesa_GetUniformivARB); - SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB); -#endif /* FEATURE_ARB_shader_objects */ - -#if FEATURE_ARB_vertex_shader - SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB); - SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB); - SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB); -#endif /* FEATURE_ARB_vertex_shader */ - /* GL_ARB_sync */ -#if FEATURE_ARB_sync - SET_IsSync(exec, _mesa_IsSync); - SET_DeleteSync(exec, _mesa_DeleteSync); - SET_FenceSync(exec, _mesa_FenceSync); - SET_ClientWaitSync(exec, _mesa_ClientWaitSync); - SET_WaitSync(exec, _mesa_WaitSync); - SET_GetInteger64v(exec, _mesa_GetInteger64v); - SET_GetSynciv(exec, _mesa_GetSynciv); -#endif + _mesa_init_sync_dispatch(exec); /* GL_ATI_fragment_shader */ -#if FEATURE_ATI_fragment_shader - SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI); - SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI); - SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI); - SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI); - SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI); - SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI); - SET_SampleMapATI(exec, _mesa_SampleMapATI); - SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI); - SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI); - SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI); - SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI); - SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI); - SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI); - SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI); -#endif + _mesa_init_ati_fragment_shader_dispatch(exec); /* GL_ATI_envmap_bumpmap */ SET_GetTexBumpParameterivATI(exec, _mesa_GetTexBumpParameterivATI); @@ -764,4 +721,14 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE); SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE); #endif + +#if FEATURE_ARB_geometry_shader4 + SET_FramebufferTextureARB(exec, _mesa_FramebufferTextureARB); + SET_FramebufferTextureFaceARB(exec, _mesa_FramebufferTextureFaceARB); +#endif + + + return exec; } + +#endif /* FEATURE_GL */ diff --git a/mesalib/src/mesa/main/api_exec.h b/mesalib/src/mesa/main/api_exec.h index 4bd715053..29c953f31 100644 --- a/mesalib/src/mesa/main/api_exec.h +++ b/mesalib/src/mesa/main/api_exec.h @@ -29,9 +29,17 @@ struct _glapi_table; +extern struct _glapi_table * +_mesa_alloc_dispatch_table(int size); -extern void -_mesa_init_exec_table(struct _glapi_table *exec); +extern struct _glapi_table * +_mesa_create_exec_table(void); + +extern struct _glapi_table * +_mesa_create_exec_table_es1(void); + +extern struct _glapi_table * +_mesa_create_exec_table_es2(void); #endif diff --git a/mesalib/src/mesa/main/api_loopback.c b/mesalib/src/mesa/main/api_loopback.c index aedc509fb..d1789069c 100644 --- a/mesalib/src/mesa/main/api_loopback.c +++ b/mesalib/src/mesa/main/api_loopback.c @@ -1443,6 +1443,135 @@ loopback_VertexAttrib4NuivARB(GLuint index, const GLuint * v) +/** GL 3.0 Integer-valued attributes **/ + +static void GLAPIENTRY +loopback_VertexAttribI1i(GLuint index, GLint x) +{ + ATTRIB1ARB(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttribI2i(GLuint index, GLint x, GLint y) +{ + ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y); +} + +static void GLAPIENTRY +loopback_VertexAttribI3i(GLuint index, GLint x, GLint y, GLint z) +{ + ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void GLAPIENTRY +loopback_VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttribI1ui(GLuint index, GLuint x) +{ + ATTRIB1ARB(index, (GLfloat) x); +} + +static void GLAPIENTRY +loopback_VertexAttribI2ui(GLuint index, GLuint x, GLuint y) +{ + ATTRIB2ARB(index, (GLfloat) x, (GLfloat) y); +} + +static void GLAPIENTRY +loopback_VertexAttribI3ui(GLuint index, GLuint x, GLuint y, GLuint z) +{ + ATTRIB3ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z); +} + +static void GLAPIENTRY +loopback_VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) +{ + ATTRIB4ARB(index, (GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); +} + +static void GLAPIENTRY +loopback_VertexAttribI1iv(GLuint index, const GLint *v) +{ + ATTRIB1ARB(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttribI2iv (GLuint index, const GLint *v) +{ + ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttribI3iv(GLuint index, const GLint *v) +{ + ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4iv(GLuint index, const GLint *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI1uiv(GLuint index, const GLuint *v) +{ + ATTRIB1ARB(index, (GLfloat) v[0]); +} + +static void GLAPIENTRY +loopback_VertexAttribI2uiv(GLuint index, const GLuint *v) +{ + ATTRIB2ARB(index, (GLfloat) v[0], (GLfloat) v[1]); +} + +static void GLAPIENTRY +loopback_VertexAttribI3uiv(GLuint index, const GLuint *v) +{ + ATTRIB3ARB(index, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4uiv(GLuint index, const GLuint *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4bv(GLuint index, const GLbyte *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4sv(GLuint index, const GLshort *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4ubv(GLuint index, const GLubyte *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + +static void GLAPIENTRY +loopback_VertexAttribI4usv(GLuint index, const GLushort *v) +{ + ATTRIB4ARB(index, (GLfloat) v[0], (GLfloat) v[1], + (GLfloat) v[2], (GLfloat) v[3]); +} + + /* * This code never registers handlers for any of the entry points @@ -1658,6 +1787,51 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest ) SET_VertexAttrib4NivARB(dest, loopback_VertexAttrib4NivARB); SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB); SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB); + + /* GL 3.0 */ +#if 0 + SET_VertexAttribI1i(dest, loopback_VertexAttribI1i); + SET_VertexAttribI2i(dest, loopback_VertexAttribI2i); + SET_VertexAttribI3i(dest, loopback_VertexAttribI3i); + SET_VertexAttribI4i(dest, loopback_VertexAttribI4i); + SET_VertexAttribI1ui(dest, loopback_VertexAttribI1ui); + SET_VertexAttribI2ui(dest, loopback_VertexAttribI2ui); + SET_VertexAttribI3ui(dest, loopback_VertexAttribI3ui); + SET_VertexAttribI4ui(dest, loopback_VertexAttribI4ui); + SET_VertexAttribI1iv(dest, loopback_VertexAttribI1iv); + SET_VertexAttribI2iv(dest, loopback_VertexAttribI2iv); + SET_VertexAttribI3iv(dest, loopback_VertexAttribI3iv); + SET_VertexAttribI4iv(dest, loopback_VertexAttribI4iv); + SET_VertexAttribI1uiv(dest, loopback_VertexAttribI1uiv); + SET_VertexAttribI2uiv(dest, loopback_VertexAttribI2uiv); + SET_VertexAttribI3uiv(dest, loopback_VertexAttribI3uiv); + SET_VertexAttribI4uiv(dest, loopback_VertexAttribI4uiv); + SET_VertexAttribI4bv(dest, loopback_VertexAttribI4bv); + SET_VertexAttribI4sv(dest, loopback_VertexAttribI4sv); + SET_VertexAttribI4ubv(dest, loopback_VertexAttribI4ubv); + SET_VertexAttribI4usv(dest, loopback_VertexAttribI4usv); +#else + (void) loopback_VertexAttribI1i; + (void) loopback_VertexAttribI2i; + (void) loopback_VertexAttribI3i; + (void) loopback_VertexAttribI4i; + (void) loopback_VertexAttribI1ui; + (void) loopback_VertexAttribI2ui; + (void) loopback_VertexAttribI3ui; + (void) loopback_VertexAttribI4ui; + (void) loopback_VertexAttribI1iv; + (void) loopback_VertexAttribI2iv; + (void) loopback_VertexAttribI3iv; + (void) loopback_VertexAttribI4iv; + (void) loopback_VertexAttribI1uiv; + (void) loopback_VertexAttribI2uiv; + (void) loopback_VertexAttribI3uiv; + (void) loopback_VertexAttribI4uiv; + (void) loopback_VertexAttribI4bv; + (void) loopback_VertexAttribI4sv; + (void) loopback_VertexAttribI4ubv; + (void) loopback_VertexAttribI4usv; +#endif } diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index 4fb7b5ad6..b3b5c6cc0 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -105,21 +105,31 @@ check_valid_to_render(GLcontext *ctx, const char *function) return GL_FALSE; } + switch (ctx->API) { #if FEATURE_es2_glsl - /* For ES2, we can draw if any vertex array is enabled (and we should - * always have a vertex program/shader). - */ - if (ctx->Array.ArrayObj->_Enabled == 0x0 || !ctx->VertexProgram._Current) - return GL_FALSE; -#else - /* For regular OpenGL, only draw if we have vertex positions (regardless - * of whether or not we have a vertex program/shader). - */ - if (!ctx->Array.ArrayObj->Vertex.Enabled && - !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) - return GL_FALSE; + case API_OPENGLES2: + /* For ES2, we can draw if any vertex array is enabled (and we + * should always have a vertex program/shader). */ + if (ctx->Array.ArrayObj->_Enabled == 0x0 || !ctx->VertexProgram._Current) + return GL_FALSE; + break; +#endif + +#if FEATURE_ES1 || FEATURE_GL + case API_OPENGLES: + case API_OPENGL: + /* For regular OpenGL, only draw if we have vertex positions + * (regardless of whether or not we have a vertex program/shader). */ + if (!ctx->Array.ArrayObj->Vertex.Enabled && + !ctx->Array.ArrayObj->VertexAttrib[0].Enabled) + return GL_FALSE; + break; #endif + default: + ASSERT_NO_FEATURE(); + } + return GL_TRUE; } @@ -175,7 +185,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) { - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (count <= 0) { if (count < 0) @@ -183,7 +193,7 @@ _mesa_validate_DrawElements(GLcontext *ctx, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" ); return GL_FALSE; } @@ -240,7 +250,7 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" ); return GL_FALSE; } @@ -299,7 +309,7 @@ _mesa_validate_DrawArrays(GLcontext *ctx, return GL_FALSE; } - if (mode > GL_POLYGON) { + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" ); return GL_FALSE; } @@ -314,3 +324,108 @@ _mesa_validate_DrawArrays(GLcontext *ctx, return GL_TRUE; } + + +GLboolean +_mesa_validate_DrawArraysInstanced(GLcontext *ctx, GLenum mode, GLint first, + GLsizei count, GLsizei primcount) +{ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (count <= 0) { + if (count < 0) + _mesa_error(ctx, GL_INVALID_VALUE, + "glDrawArraysInstanced(count=%d)", count); + return GL_FALSE; + } + + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glDrawArraysInstanced(mode=0x%x)", mode); + return GL_FALSE; + } + + if (primcount <= 0) { + if (primcount < 0) + _mesa_error(ctx, GL_INVALID_VALUE, + "glDrawArraysInstanced(primcount=%d)", primcount); + return GL_FALSE; + } + + if (!check_valid_to_render(ctx, "glDrawArraysInstanced(invalid to render)")) + return GL_FALSE; + + if (ctx->CompileFlag) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawArraysInstanced(display list"); + return GL_FALSE; + } + + if (ctx->Const.CheckArrayBounds) { + if (first + count > (GLint) ctx->Array.ArrayObj->_MaxElement) + return GL_FALSE; + } + + return GL_TRUE; +} + + +GLboolean +_mesa_validate_DrawElementsInstanced(GLcontext *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices, GLsizei primcount) +{ + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (count <= 0) { + if (count < 0) + _mesa_error(ctx, GL_INVALID_VALUE, + "glDrawElementsInstanced(count=%d)", count); + return GL_FALSE; + } + + if (mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glDrawElementsInstanced(mode = 0x%x)", mode); + return GL_FALSE; + } + + if (type != GL_UNSIGNED_INT && + type != GL_UNSIGNED_BYTE && + type != GL_UNSIGNED_SHORT) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glDrawElementsInstanced(type=0x%x)", type); + return GL_FALSE; + } + + if (primcount <= 0) { + if (primcount < 0) + _mesa_error(ctx, GL_INVALID_VALUE, + "glDrawElementsInstanced(primcount=%d)", primcount); + return GL_FALSE; + } + + if (!check_valid_to_render(ctx, "glDrawElementsInstanced")) + return GL_FALSE; + + /* Vertex buffer object tests */ + if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) { + /* use indices in the buffer object */ + /* make sure count doesn't go outside buffer bounds */ + if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) { + _mesa_warning(ctx, + "glDrawElementsInstanced index out of buffer bounds"); + return GL_FALSE; + } + } + else { + /* not using a VBO */ + if (!indices) + return GL_FALSE; + } + + if (!check_index_bounds(ctx, count, type, indices, 0)) + return GL_FALSE; + + return GL_TRUE; +} diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h index 6064d15fe..cd27d58aa 100644 --- a/mesalib/src/mesa/main/api_validate.h +++ b/mesalib/src/mesa/main/api_validate.h @@ -52,4 +52,14 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, const GLvoid *indices, GLint basevertex); +extern GLboolean +_mesa_validate_DrawArraysInstanced(GLcontext *ctx, GLenum mode, GLint first, + GLsizei count, GLsizei primcount); + +extern GLboolean +_mesa_validate_DrawElementsInstanced(GLcontext *ctx, + GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices, GLsizei primcount); + + #endif diff --git a/mesalib/src/mesa/shader/arbprogram.c b/mesalib/src/mesa/main/arbprogram.c index 75b4274bf..26d781954 100644 --- a/mesalib/src/mesa/shader/arbprogram.c +++ b/mesalib/src/mesa/main/arbprogram.c @@ -35,11 +35,11 @@ #include "main/imports.h" #include "main/macros.h" #include "main/mtypes.h" -#include "arbprogram.h" -#include "arbprogparse.h" -#include "nvfragparse.h" -#include "nvvertparse.h" -#include "program.h" +#include "main/arbprogram.h" +#include "program/arbprogparse.h" +#include "program/nvfragparse.h" +#include "program/nvvertparse.h" +#include "program/program.h" @@ -245,163 +245,6 @@ _mesa_GenPrograms(GLsizei n, GLuint *ids) } -void GLAPIENTRY -_mesa_EnableVertexAttribArrayARB(GLuint index) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (index >= ctx->Const.VertexProgram.MaxAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glEnableVertexAttribArrayARB(index)"); - return; - } - - ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); - - FLUSH_VERTICES(ctx, _NEW_ARRAY); - ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_TRUE; - ctx->Array.ArrayObj->_Enabled |= _NEW_ARRAY_ATTRIB(index); - ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); -} - - -void GLAPIENTRY -_mesa_DisableVertexAttribArrayARB(GLuint index) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (index >= ctx->Const.VertexProgram.MaxAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glEnableVertexAttribArrayARB(index)"); - return; - } - - ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); - - FLUSH_VERTICES(ctx, _NEW_ARRAY); - ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_FALSE; - ctx->Array.ArrayObj->_Enabled &= ~_NEW_ARRAY_ATTRIB(index); - ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); -} - - -void GLAPIENTRY -_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params) -{ - GLfloat fparams[4]; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - _mesa_GetVertexAttribfvARB(index, pname, fparams); - if (ctx->ErrorValue == GL_NO_ERROR) { - if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { - COPY_4V(params, fparams); - } - else { - params[0] = fparams[0]; - } - } -} - - -/** - * Return info for a generic vertex attribute array (no alias with - * legacy vertex attributes (pos, normal, color, etc)). - */ -void GLAPIENTRY -_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) -{ - const struct gl_client_array *array; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (index >= MAX_VERTEX_GENERIC_ATTRIBS) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribfvARB(index)"); - return; - } - - ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); - - array = &ctx->Array.ArrayObj->VertexAttrib[index]; - - switch (pname) { - case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: - params[0] = (GLfloat) array->Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: - params[0] = (GLfloat) array->Size; - break; - case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: - params[0] = (GLfloat) array->Stride; - break; - case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: - params[0] = (GLfloat) array->Type; - break; - case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB: - params[0] = array->Normalized; - break; - case GL_CURRENT_VERTEX_ATTRIB_ARB: - if (index == 0) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetVertexAttribfvARB(index==0)"); - return; - } - FLUSH_CURRENT(ctx, 0); - COPY_4V(params, ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]); - break; - case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat) array->BufferObj->Name; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribfvARB(pname)"); - return; - } -} - - -void GLAPIENTRY -_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params) -{ - GLfloat fparams[4]; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - _mesa_GetVertexAttribfvARB(index, pname, fparams); - if (ctx->ErrorValue == GL_NO_ERROR) { - if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { - COPY_4V_CAST(params, fparams, GLint); /* float to int */ - } - else { - params[0] = (GLint) fparams[0]; - } - } -} - - -void GLAPIENTRY -_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (index >= ctx->Const.VertexProgram.MaxAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)"); - return; - } - - if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerARB(pname)"); - return; - } - - ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); - - *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr; -} - - /** * Determine if id names a vertex or fragment program. * \note Not compiled into display lists. diff --git a/mesalib/src/mesa/shader/arbprogram.h b/mesalib/src/mesa/main/arbprogram.h index 6fe76267b..e2e535e91 100644 --- a/mesalib/src/mesa/shader/arbprogram.h +++ b/mesalib/src/mesa/main/arbprogram.h @@ -27,6 +27,9 @@ #define ARBPROGRAM_H +#include "glheader.h" + + extern void GLAPIENTRY _mesa_BindProgram(GLenum target, GLuint id); @@ -37,30 +40,6 @@ extern void GLAPIENTRY _mesa_GenPrograms(GLsizei n, GLuint *ids); -extern void GLAPIENTRY -_mesa_EnableVertexAttribArrayARB(GLuint index); - - -extern void GLAPIENTRY -_mesa_DisableVertexAttribArrayARB(GLuint index); - - -extern void GLAPIENTRY -_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params); - - -extern void GLAPIENTRY -_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params); - - -extern void GLAPIENTRY -_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params); - - -extern void GLAPIENTRY -_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer); - - extern GLboolean GLAPIENTRY _mesa_IsProgramARB(GLuint id); diff --git a/mesalib/src/mesa/main/arrayobj.h b/mesalib/src/mesa/main/arrayobj.h index 8999edc72..fdf7e2bca 100644 --- a/mesalib/src/mesa/main/arrayobj.h +++ b/mesalib/src/mesa/main/arrayobj.h @@ -28,7 +28,7 @@ #ifndef ARRAYOBJ_H #define ARRAYOBJ_H -#include "context.h" +#include "mtypes.h" /** * \file arrayobj.h diff --git a/mesalib/src/mesa/shader/atifragshader.c b/mesalib/src/mesa/main/atifragshader.c index 870f77e30..550f50b7a 100644 --- a/mesalib/src/mesa/shader/atifragshader.c +++ b/mesalib/src/mesa/main/atifragshader.c @@ -28,13 +28,36 @@ #include "main/macros.h" #include "main/enums.h" #include "main/mtypes.h" -#include "atifragshader.h" +#include "main/dispatch.h" +#include "main/atifragshader.h" + +#if FEATURE_ATI_fragment_shader #define MESA_DEBUG_ATI_FS 0 static struct ati_fragment_shader DummyShader; +void +_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) +{ + SET_GenFragmentShadersATI(disp, _mesa_GenFragmentShadersATI); + SET_BindFragmentShaderATI(disp, _mesa_BindFragmentShaderATI); + SET_DeleteFragmentShaderATI(disp, _mesa_DeleteFragmentShaderATI); + SET_BeginFragmentShaderATI(disp, _mesa_BeginFragmentShaderATI); + SET_EndFragmentShaderATI(disp, _mesa_EndFragmentShaderATI); + SET_PassTexCoordATI(disp, _mesa_PassTexCoordATI); + SET_SampleMapATI(disp, _mesa_SampleMapATI); + SET_ColorFragmentOp1ATI(disp, _mesa_ColorFragmentOp1ATI); + SET_ColorFragmentOp2ATI(disp, _mesa_ColorFragmentOp2ATI); + SET_ColorFragmentOp3ATI(disp, _mesa_ColorFragmentOp3ATI); + SET_AlphaFragmentOp1ATI(disp, _mesa_AlphaFragmentOp1ATI); + SET_AlphaFragmentOp2ATI(disp, _mesa_AlphaFragmentOp2ATI); + SET_AlphaFragmentOp3ATI(disp, _mesa_AlphaFragmentOp3ATI); + SET_SetFragmentShaderConstantATI(disp, _mesa_SetFragmentShaderConstantATI); +} + + /** * Allocate and initialize a new ATI fragment shader object. */ @@ -767,3 +790,5 @@ _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value) COPY_4V(ctx->ATIFragmentShader.GlobalConstants[dstindex], value); } } + +#endif /* FEATURE_ATI_fragment_shader */ diff --git a/mesalib/src/mesa/shader/atifragshader.h b/mesalib/src/mesa/main/atifragshader.h index e1dc20e60..31c335ec8 100644 --- a/mesalib/src/mesa/shader/atifragshader.h +++ b/mesalib/src/mesa/main/atifragshader.h @@ -60,6 +60,11 @@ struct atifs_setupinst }; +#if FEATURE_ATI_fragment_shader + +extern void +_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp); + extern struct ati_fragment_shader * _mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id); @@ -120,4 +125,25 @@ _mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, extern void GLAPIENTRY _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value); -#endif +#else /* FEATURE_ATI_fragment_shader */ + +static INLINE void +_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp) +{ +} + +static INLINE struct ati_fragment_shader * +_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id) +{ + return NULL; +} + +static INLINE void +_mesa_delete_ati_fragment_shader(GLcontext *ctx, + struct ati_fragment_shader *s) +{ +} + +#endif /* FEATURE_ATI_fragment_shader */ + +#endif /* ATIFRAGSHADER_H */ diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index 92fb8d289..753949be5 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -41,12 +41,12 @@ #include "hint.h" #include "light.h" #include "lines.h" +#include "macros.h" #include "matrix.h" #include "multisample.h" #include "points.h" #include "polygon.h" #include "scissor.h" -#include "simple_list.h" #include "stencil.h" #include "texenv.h" #include "texgen.h" diff --git a/mesalib/src/mesa/main/attrib.h b/mesalib/src/mesa/main/attrib.h index 6b48a1766..83b28a65b 100644 --- a/mesalib/src/mesa/main/attrib.h +++ b/mesalib/src/mesa/main/attrib.h @@ -48,6 +48,8 @@ _mesa_init_attrib_dispatch(struct _glapi_table *disp); #else /* FEATURE_attrib_stack */ +#include "main/compiler.h" + static INLINE void _mesa_PushClientAttrib( GLbitfield mask ) { diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index 56dfdae3d..b21654890 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -32,6 +32,7 @@ #include "glheader.h" +#include "enums.h" #include "hash.h" #include "imports.h" #include "image.h" @@ -46,7 +47,7 @@ /*#define BOUNDS_CHECK*/ -#ifdef FEATURE_OES_mapbuffer +#if FEATURE_OES_mapbuffer #define DEFAULT_ACCESS GL_MAP_WRITE_BIT #else #define DEFAULT_ACCESS (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT) @@ -82,6 +83,13 @@ get_buffer_target(GLcontext *ctx, GLenum target) return &ctx->CopyWriteBuffer; } break; +#if FEATURE_EXT_transform_feedback + case GL_TRANSFORM_FEEDBACK_BUFFER: + if (ctx->Extensions.EXT_transform_feedback) { + return &ctx->TransformFeedback.CurrentBuffer; + } + break; +#endif default: return NULL; } @@ -582,7 +590,7 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) bindTarget = get_buffer_target(ctx, target); if (!bindTarget) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)", target); return; } @@ -1376,31 +1384,49 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params) bufObj = get_buffer(ctx, target); if (!bufObj) { - _mesa_error(ctx, GL_INVALID_ENUM, "GetBufferParameterivARB(target)" ); + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(target)" ); return; } if (!_mesa_is_bufferobj(bufObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "GetBufferParameterivARB" ); + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferParameterivARB" ); return; } switch (pname) { case GL_BUFFER_SIZE_ARB: *params = (GLint) bufObj->Size; - break; + return; case GL_BUFFER_USAGE_ARB: *params = bufObj->Usage; - break; + return; case GL_BUFFER_ACCESS_ARB: *params = simplified_access_mode(bufObj->AccessFlags); - break; + return; case GL_BUFFER_MAPPED_ARB: *params = _mesa_bufferobj_mapped(bufObj); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname)"); return; + case GL_BUFFER_ACCESS_FLAGS: + if (ctx->VersionMajor < 3) + goto invalid_pname; + *params = bufObj->AccessFlags; + return; + case GL_BUFFER_MAP_OFFSET: + if (ctx->VersionMajor < 3) + goto invalid_pname; + *params = (GLint) bufObj->Offset; + return; + case GL_BUFFER_MAP_LENGTH: + if (ctx->VersionMajor < 3) + goto invalid_pname; + *params = (GLint) bufObj->Length; + return; + default: + ; /* fall-through */ } + +invalid_pname: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname=%s)", + _mesa_lookup_enum_by_nr(pname)); } @@ -1418,31 +1444,49 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params) bufObj = get_buffer(ctx, target); if (!bufObj) { - _mesa_error(ctx, GL_INVALID_ENUM, "GetBufferParameteri64v(target)" ); + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(target)" ); return; } if (!_mesa_is_bufferobj(bufObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "GetBufferParameteri64v" ); + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferParameteri64v" ); return; } switch (pname) { case GL_BUFFER_SIZE_ARB: *params = bufObj->Size; - break; + return; case GL_BUFFER_USAGE_ARB: *params = bufObj->Usage; - break; + return; case GL_BUFFER_ACCESS_ARB: *params = simplified_access_mode(bufObj->AccessFlags); - break; + return; + case GL_BUFFER_ACCESS_FLAGS: + if (ctx->VersionMajor < 3) + goto invalid_pname; + *params = bufObj->AccessFlags; + return; case GL_BUFFER_MAPPED_ARB: *params = _mesa_bufferobj_mapped(bufObj); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(pname)"); return; + case GL_BUFFER_MAP_OFFSET: + if (ctx->VersionMajor < 3) + goto invalid_pname; + *params = bufObj->Offset; + return; + case GL_BUFFER_MAP_LENGTH: + if (ctx->VersionMajor < 3) + goto invalid_pname; + *params = bufObj->Length; + return; + default: + ; /* fall-through */ } + +invalid_pname: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(pname=%s)", + _mesa_lookup_enum_by_nr(pname)); } @@ -1509,27 +1553,27 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget, if (readOffset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyBuffserSubData(readOffset = %d)", readOffset); + "glCopyBuffserSubData(readOffset = %d)", (int) readOffset); return; } if (writeOffset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyBuffserSubData(writeOffset = %d)", writeOffset); + "glCopyBuffserSubData(writeOffset = %d)", (int) writeOffset); return; } if (readOffset + size > src->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyBuffserSubData(readOffset + size = %d)", - readOffset, size); + (int) (readOffset + size)); return; } if (writeOffset + size > dst->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glCopyBuffserSubData(writeOffset + size = %d)", - writeOffset, size); + (int) (writeOffset + size)); return; } @@ -1573,13 +1617,13 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, if (offset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(offset = %ld)", offset); + "glMapBufferRange(offset = %ld)", (long)offset); return NULL; } if (length < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(length = %ld)", length); + "glMapBufferRange(length = %ld)", (long)length); return NULL; } @@ -1664,13 +1708,13 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) if (offset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(offset = %ld)", offset); + "glMapBufferRange(offset = %ld)", (long)offset); return; } if (length < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(length = %ld)", length); + "glMapBufferRange(length = %ld)", (long)length); return; } @@ -1702,8 +1746,8 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) if (offset + length > bufObj->Length) { _mesa_error(ctx, GL_INVALID_VALUE, - "glMapBufferRange(offset %ld + length %ld > mapped length %ld)", - offset, length, bufObj->Length); + "glMapBufferRange(offset %ld + length %ld > mapped length %ld)", + (long)offset, (long)length, (long)bufObj->Length); return; } @@ -1880,7 +1924,7 @@ _mesa_BufferObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) bufObj->Purgeable = GL_FALSE; - retval = GL_RETAINED_APPLE; + retval = option; if (ctx->Driver.BufferObjectUnpurgeable) retval = ctx->Driver.BufferObjectUnpurgeable(ctx, bufObj, option); @@ -1910,11 +1954,11 @@ _mesa_RenderObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) bufObj->Purgeable = GL_FALSE; - retval = GL_RETAINED_APPLE; + retval = option; if (ctx->Driver.RenderObjectUnpurgeable) retval = ctx->Driver.RenderObjectUnpurgeable(ctx, bufObj, option); - return option; + return retval; } @@ -1940,7 +1984,7 @@ _mesa_TextureObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option) bufObj->Purgeable = GL_FALSE; - retval = GL_RETAINED_APPLE; + retval = option; if (ctx->Driver.TextureObjectUnpurgeable) retval = ctx->Driver.TextureObjectUnpurgeable(ctx, bufObj, option); diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h index 912529cfd..f234d06c6 100644 --- a/mesalib/src/mesa/main/bufferobj.h +++ b/mesalib/src/mesa/main/bufferobj.h @@ -29,7 +29,7 @@ #define BUFFEROBJ_H -#include "context.h" +#include "mtypes.h" /* diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c index e76ab5527..49d86b3b1 100644 --- a/mesalib/src/mesa/main/clear.c +++ b/mesalib/src/mesa/main/clear.c @@ -35,6 +35,7 @@ #include "context.h" #include "colormac.h" #include "enums.h" +#include "macros.h" #include "state.h" diff --git a/mesalib/src/mesa/main/clear.h b/mesalib/src/mesa/main/clear.h index 4c78eeda4..6657370c4 100644 --- a/mesalib/src/mesa/main/clear.h +++ b/mesalib/src/mesa/main/clear.h @@ -27,7 +27,7 @@ #define CLEAR_H -#include "main/mtypes.h" +#include "glheader.h" extern void GLAPIENTRY diff --git a/mesalib/src/mesa/main/clip.h b/mesalib/src/mesa/main/clip.h index d53afb45b..ac472d66e 100644 --- a/mesalib/src/mesa/main/clip.h +++ b/mesalib/src/mesa/main/clip.h @@ -31,7 +31,7 @@ #ifndef CLIP_H #define CLIP_H -#include "mtypes.h" +#include "glheader.h" extern void GLAPIENTRY _mesa_ClipPlane( GLenum plane, const GLdouble *equation ); diff --git a/mesalib/src/mesa/main/colormac.h b/mesalib/src/mesa/main/colormac.h index 905f4e228..245fb658b 100644 --- a/mesalib/src/mesa/main/colormac.h +++ b/mesalib/src/mesa/main/colormac.h @@ -33,9 +33,9 @@ #define COLORMAC_H -#include "imports.h" #include "config.h" #include "macros.h" +#include "mtypes.h" /** \def BYTE_TO_CHAN diff --git a/mesalib/src/mesa/main/colortab.h b/mesalib/src/mesa/main/colortab.h index 652fb5824..303c9fb30 100644 --- a/mesalib/src/mesa/main/colortab.h +++ b/mesalib/src/mesa/main/colortab.h @@ -31,13 +31,6 @@ #if FEATURE_colortable -#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) \ - do { \ - (driver)->CopyColorTable = impl ## CopyColorTable; \ - (driver)->CopyColorSubTable = impl ## CopyColorSubTable; \ - (driver)->UpdateTexturePalette = impl ## UpdateTexturePalette; \ - } while (0) - extern void GLAPIENTRY _mesa_ColorTable( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, @@ -53,7 +46,7 @@ _mesa_init_colortable_dispatch(struct _glapi_table *disp); #else /* FEATURE_colortable */ -#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) do { } while (0) +#include "main/compiler.h" static INLINE void GLAPIENTRY _mesa_ColorTable( GLenum target, GLenum internalformat, diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h index 81704ae2c..800eb8390 100644 --- a/mesalib/src/mesa/main/compiler.h +++ b/mesalib/src/mesa/main/compiler.h @@ -65,9 +65,7 @@ extern "C" { typedef unsigned __int8 uint8_t; typedef __int16 int16_t; typedef unsigned __int16 uint16_t; -# ifndef __eglplatform_h_ - typedef __int32 int32_t; -# endif + typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; @@ -200,6 +198,13 @@ extern "C" { # define __builtin_expect(x, y) x #endif +#ifdef __GNUC__ +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define likely(x) !!(x) +#define unlikely(x) !!(x) +#endif /** * The __FUNCTION__ gcc variable is generally only used for debugging. @@ -219,6 +224,18 @@ extern "C" { # endif # endif #endif +#ifndef __func__ +# if (__STDC_VERSION__ >= 199901L) || \ + (defined(__SUNPRO_C) && defined(__C99FEATURES__)) + /* __func__ is part of C99 */ +# elif defined(_MSC_VER) +# if _MSC_VER >= 1300 +# define __func__ __FUNCTION__ +# else +# define __func__ "<unknown>" +# endif +# endif +#endif /** @@ -311,6 +328,11 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) #endif #endif +#if (__GNUC__ >= 3) +#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a))) +#else +#define PRINTFLIKE(f, a) +#endif #ifndef NULL #define NULL 0 diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h index 2eac1cc2e..0f2d1a8f8 100644 --- a/mesalib/src/mesa/main/config.h +++ b/mesalib/src/mesa/main/config.h @@ -177,7 +177,7 @@ /** * Per-program constants (power of two) * - * \c MAX_PROGRAM_LOCAL_PARAMS and \c MAX_UNIFORMS are just the assmebly shader + * \c MAX_PROGRAM_LOCAL_PARAMS and \c MAX_UNIFORMS are just the assembly shader * and GLSL shader names for the same thing. They should \b always have the * same value. Each refers to the number of vec4 values supplied as * per-program parameters. @@ -250,7 +250,7 @@ /** For GL_ARB_draw_buffers */ /*@{*/ -#define MAX_DRAW_BUFFERS 4 +#define MAX_DRAW_BUFFERS 8 /*@}*/ @@ -262,6 +262,20 @@ /** For GL_ATI_envmap_bump - support bump mapping on first 8 units */ #define SUPPORTED_ATI_BUMP_UNITS 0xff +/** For GL_EXT_transform_feedback */ +#define MAX_FEEDBACK_ATTRIBS 32 + +/** For GL_ARB_geometry_shader4 */ +/*@{*/ +#define MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 8 +#define MAX_GEOMETRY_VARYING_COMPONENTS 32 +#define MAX_VERTEX_VARYING_COMPONENTS 32 +#define MAX_GEOMETRY_UNIFORM_COMPONENTS 512 +#define MAX_GEOMETRY_OUTPUT_VERTICES 256 +#define MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 1024 +/*@}*/ + + /** * \name Mesa-specific parameters */ diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 73126b957..3bddf2570 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -111,28 +111,25 @@ #include "points.h" #include "polygon.h" #include "queryobj.h" -#if FEATURE_ARB_sync #include "syncobj.h" -#endif #include "rastpos.h" #include "remap.h" #include "scissor.h" #include "shared.h" +#include "shaderobj.h" #include "simple_list.h" #include "state.h" #include "stencil.h" #include "texcompress_s3tc.h" #include "texstate.h" +#include "transformfeedback.h" #include "mtypes.h" #include "varray.h" #include "version.h" #include "viewport.h" #include "vtxfmt.h" -#include "glapi/glthread.h" -#include "glapi/glapitable.h" -#include "shader/program.h" -#include "shader/prog_print.h" -#include "shader/shader_api.h" +#include "program/program.h" +#include "program/prog_print.h" #if _HAVE_FULL_GL #include "math/m_matrix.h" #endif @@ -141,6 +138,10 @@ #include "sparc/sparc.h" #endif +#include "glsl_parser_extras.h" + + + #ifndef MESA_VERBOSE int MESA_VERBOSE = 0; #endif @@ -340,14 +341,16 @@ _mesa_destroy_visual( GLvisual *vis ) static void dummy_enum_func(void) { - gl_buffer_index bi; - gl_colortable_index ci; - gl_face_index fi; - gl_frag_attrib fa; - gl_frag_result fr; - gl_texture_index ti; - gl_vert_attrib va; - gl_vert_result vr; + gl_buffer_index bi = BUFFER_FRONT_LEFT; + gl_colortable_index ci = COLORTABLE_PRECONVOLUTION; + gl_face_index fi = FACE_POS_X; + gl_frag_attrib fa = FRAG_ATTRIB_WPOS; + gl_frag_result fr = FRAG_RESULT_DEPTH; + gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX; + gl_vert_attrib va = VERT_ATTRIB_POS; + gl_vert_result vr = VERT_RESULT_HPOS; + gl_geom_attrib ga = GEOM_ATTRIB_POSITION; + gl_geom_result gr = GEOM_RESULT_POS; (void) bi; (void) ci; @@ -357,6 +360,8 @@ dummy_enum_func(void) (void) ti; (void) va; (void) vr; + (void) ga; + (void) gr; } @@ -395,9 +400,28 @@ one_time_init( GLcontext *ctx ) _mesa_get_cpu_features(); - _mesa_init_remap_table(); + switch (ctx->API) { +#if FEATURE_GL + case API_OPENGL: + _mesa_init_remap_table(); + break; +#endif +#if FEATURE_ES1 + case API_OPENGLES: + _mesa_init_remap_table_es1(); + break; +#endif +#if FEATURE_ES2 + case API_OPENGLES2: + _mesa_init_remap_table_es2(); + break; +#endif + default: + break; + } _mesa_init_sqrt_table(); + _mesa_init_get_hash(ctx); for (i = 0; i < 256; i++) { _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; @@ -412,6 +436,11 @@ one_time_init( GLcontext *ctx ) } _glthread_UNLOCK_MUTEX(OneTimeLock); + /* Hopefully atexit() is widely available. If not, we may need some + * #ifdef tests here. + */ + atexit(_mesa_destroy_shader_compiler); + dummy_enum_func(); } @@ -440,7 +469,7 @@ _mesa_init_current(GLcontext *ctx) /** - * Init vertex/fragment program limits. + * Init vertex/fragment/geometry program limits. * Important: drivers should override these with actual limits. */ static void @@ -455,15 +484,31 @@ init_program_limits(GLenum type, struct gl_program_constants *prog) prog->MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS; prog->MaxUniformComponents = 4 * MAX_UNIFORMS; - if (type == GL_VERTEX_PROGRAM_ARB) { + switch (type) { + case GL_VERTEX_PROGRAM_ARB: prog->MaxParameters = MAX_VERTEX_PROGRAM_PARAMS; prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; - } - else { + break; + case GL_FRAGMENT_PROGRAM_ARB: prog->MaxParameters = MAX_NV_FRAGMENT_PROGRAM_PARAMS; prog->MaxAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; prog->MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; + break; + case MESA_GEOMETRY_PROGRAM: + prog->MaxParameters = MAX_NV_VERTEX_PROGRAM_PARAMS; + prog->MaxAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; + prog->MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; + + prog->MaxGeometryTextureImageUnits = MAX_GEOMETRY_TEXTURE_IMAGE_UNITS; + prog->MaxGeometryVaryingComponents = MAX_GEOMETRY_VARYING_COMPONENTS; + prog->MaxVertexVaryingComponents = MAX_VERTEX_VARYING_COMPONENTS; + prog->MaxGeometryUniformComponents = MAX_GEOMETRY_UNIFORM_COMPONENTS; + prog->MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES; + prog->MaxGeometryTotalOutputComponents = MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS; + break; + default: + assert(0 && "Bad program type in init_program_limits()"); } /* Set the native limits to zero. This implies that there is no native @@ -529,6 +574,9 @@ _mesa_init_constants(GLcontext *ctx) #if FEATURE_ARB_fragment_program init_program_limits(GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram); #endif +#if FEATURE_ARB_geometry_shader4 + init_program_limits(MESA_GEOMETRY_PROGRAM, &ctx->Const.GeometryProgram); +#endif ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; @@ -549,6 +597,21 @@ _mesa_init_constants(GLcontext *ctx) ctx->Const.MaxVarying = MAX_VARYING; #endif + /* Shading language version */ + if (ctx->API == API_OPENGL) { +#if FEATURE_ARB_shading_language_120 + ctx->Const.GLSLVersion = 120; +#else + ctx->Const.GLSLVersion = 110; +#endif + } + else if (ctx->API == API_OPENGLES2) { + ctx->Const.GLSLVersion = 100; + } + else if (ctx->API == API_OPENGLES) { + ctx->Const.GLSLVersion = 0; /* GLSL not supported */ + } + /* GL_ARB_framebuffer_object */ ctx->Const.MaxSamples = 0; @@ -560,6 +623,14 @@ _mesa_init_constants(GLcontext *ctx) /* GL_EXT_provoking_vertex */ ctx->Const.QuadsFollowProvokingVertexConvention = GL_TRUE; + + /* GL_EXT_transform_feedback */ + ctx->Const.MaxTransformFeedbackSeparateAttribs = MAX_FEEDBACK_ATTRIBS; + ctx->Const.MaxTransformFeedbackSeparateComponents = 4 * MAX_FEEDBACK_ATTRIBS; + ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS; + + /* GL 3.2: hard-coded for now: */ + ctx->Const.ProfileMask = GL_CONTEXT_COMPATIBILITY_PROFILE_BIT; } @@ -627,6 +698,9 @@ check_context_limits(GLcontext *ctx) assert(ctx->Const.MaxDrawBuffers <= MAX_DRAW_BUFFERS); + /* if this fails, add more enum values to gl_buffer_index */ + assert(BUFFER_COLOR0 + MAX_DRAW_BUFFERS <= BUFFER_COUNT); + /* XXX probably add more tests */ } @@ -676,14 +750,13 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_polygon( ctx ); _mesa_init_program( ctx ); _mesa_init_queryobj( ctx ); -#if FEATURE_ARB_sync _mesa_init_sync( ctx ); -#endif _mesa_init_rastpos( ctx ); _mesa_init_scissor( ctx ); _mesa_init_shader_state( ctx ); _mesa_init_stencil( ctx ); _mesa_init_transform( ctx ); + _mesa_init_transform_feedback( ctx ); _mesa_init_varray( ctx ); _mesa_init_viewport( ctx ); @@ -739,8 +812,8 @@ generic_nop(void) /** * Allocate and initialize a new dispatch table. */ -static struct _glapi_table * -alloc_dispatch_table(void) +struct _glapi_table * +_mesa_alloc_dispatch_table(int size) { /* Find the larger of Mesa's dispatch table and libGL's dispatch table. * In practice, this'll be the same for stand-alone Mesa. But for DRI @@ -748,7 +821,7 @@ alloc_dispatch_table(void) * DRI drivers. */ GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), - sizeof(struct _glapi_table) / sizeof(_glapi_proc)); + size / sizeof(_glapi_proc)); struct _glapi_table *table = (struct _glapi_table *) malloc(numEntries * sizeof(_glapi_proc)); if (table) { @@ -781,6 +854,7 @@ alloc_dispatch_table(void) * for debug flags. * * \param ctx the context to initialize + * \param api the GL API type to create the context for * \param visual describes the visual attributes for this context * \param share_list points to context to share textures, display lists, * etc with, or NULL @@ -789,27 +863,30 @@ alloc_dispatch_table(void) * \param driverContext pointer to driver-specific context data */ GLboolean -_mesa_initialize_context(GLcontext *ctx, - const GLvisual *visual, - GLcontext *share_list, - const struct dd_function_table *driverFunctions, - void *driverContext) +_mesa_initialize_context_for_api(GLcontext *ctx, + gl_api api, + const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext) { struct gl_shared_state *shared; + int i; /*ASSERT(driverContext);*/ assert(driverFunctions->NewTextureObject); assert(driverFunctions->FreeTexImageData); - /* misc one-time initializations */ - one_time_init(ctx); - + ctx->API = api; ctx->Visual = *visual; ctx->DrawBuffer = NULL; ctx->ReadBuffer = NULL; ctx->WinSysDrawBuffer = NULL; ctx->WinSysReadBuffer = NULL; + /* misc one-time initializations */ + one_time_init(ctx); + /* Plug in driver functions and context pointer here. * This is important because when we call alloc_shared_state() below * we'll call ctx->Driver.NewTextureObject() to create the default @@ -839,30 +916,36 @@ _mesa_initialize_context(GLcontext *ctx, return GL_FALSE; } +#if FEATURE_dispatch /* setup the API dispatch tables */ - ctx->Exec = alloc_dispatch_table(); - ctx->Save = alloc_dispatch_table(); - if (!ctx->Exec || !ctx->Save) { + switch (ctx->API) { +#if FEATURE_GL + case API_OPENGL: + ctx->Exec = _mesa_create_exec_table(); + break; +#endif +#if FEATURE_ES1 + case API_OPENGLES: + ctx->Exec = _mesa_create_exec_table_es1(); + break; +#endif +#if FEATURE_ES2 + case API_OPENGLES2: + ctx->Exec = _mesa_create_exec_table_es2(); + break; +#endif + default: + _mesa_problem(ctx, "unknown or unsupported API"); + break; + } + + if (!ctx->Exec) { _mesa_release_shared_state(ctx, ctx->Shared); - if (ctx->Exec) - free(ctx->Exec); return GL_FALSE; } -#if FEATURE_dispatch - _mesa_init_exec_table(ctx->Exec); #endif ctx->CurrentDispatch = ctx->Exec; -#if FEATURE_dlist - _mesa_init_save_table(ctx->Save); - _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); -#endif - - /* Neutral tnl module stuff */ - _mesa_init_exec_vtxfmt( ctx ); - ctx->TnlModule.Current = NULL; - ctx->TnlModule.SwapCount = 0; - ctx->FragmentProgram._MaintainTexEnvProgram = (_mesa_getenv("MESA_TEX_PROG") != NULL); @@ -873,15 +956,65 @@ _mesa_initialize_context(GLcontext *ctx, ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; } -#ifdef FEATURE_extra_context_init - _mesa_initialize_context_extra(ctx); + switch (ctx->API) { + case API_OPENGL: + /* Neutral tnl module stuff */ + _mesa_init_exec_vtxfmt( ctx ); + ctx->TnlModule.Current = NULL; + ctx->TnlModule.SwapCount = 0; + +#if FEATURE_dlist + ctx->Save = _mesa_create_save_table(); + if (!ctx->Save) { + _mesa_release_shared_state(ctx, ctx->Shared); + free(ctx->Exec); + return GL_FALSE; + } + + _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); #endif + break; + case API_OPENGLES: + /** + * GL_OES_texture_cube_map says + * "Initially all texture generation modes are set to REFLECTION_MAP_OES" + */ + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + texUnit->GenS.Mode = GL_REFLECTION_MAP_NV; + texUnit->GenT.Mode = GL_REFLECTION_MAP_NV; + texUnit->GenR.Mode = GL_REFLECTION_MAP_NV; + texUnit->GenS._ModeBit = TEXGEN_REFLECTION_MAP_NV; + texUnit->GenT._ModeBit = TEXGEN_REFLECTION_MAP_NV; + texUnit->GenR._ModeBit = TEXGEN_REFLECTION_MAP_NV; + } + break; + case API_OPENGLES2: + ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; + ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; + ctx->Point.PointSprite = GL_TRUE; /* always on for ES 2.x */ + break; + } ctx->FirstTimeCurrent = GL_TRUE; return GL_TRUE; } +GLboolean +_mesa_initialize_context(GLcontext *ctx, + const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext) +{ + return _mesa_initialize_context_for_api(ctx, + API_OPENGL, + visual, + share_list, + driverFunctions, + driverContext); +} /** * Allocate and initialize a GLcontext structure. @@ -889,6 +1022,7 @@ _mesa_initialize_context(GLcontext *ctx, * we need to at least call driverFunctions->NewTextureObject to initialize * the rendering context. * + * \param api the GL API type to create the context for * \param visual a GLvisual pointer (we copy the struct contents) * \param share_list another context to share display lists with or NULL * \param driverFunctions points to the dd_function_table into which the @@ -898,10 +1032,11 @@ _mesa_initialize_context(GLcontext *ctx, * \return pointer to a new __GLcontextRec or NULL if error. */ GLcontext * -_mesa_create_context(const GLvisual *visual, - GLcontext *share_list, - const struct dd_function_table *driverFunctions, - void *driverContext) +_mesa_create_context_for_api(gl_api api, + const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext) { GLcontext *ctx; @@ -912,8 +1047,8 @@ _mesa_create_context(const GLvisual *visual, if (!ctx) return NULL; - if (_mesa_initialize_context(ctx, visual, share_list, - driverFunctions, driverContext)) { + if (_mesa_initialize_context_for_api(ctx, api, visual, share_list, + driverFunctions, driverContext)) { return ctx; } else { @@ -922,6 +1057,17 @@ _mesa_create_context(const GLvisual *visual, } } +GLcontext * +_mesa_create_context(const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext) +{ + return _mesa_create_context_for_api(API_OPENGL, visual, + share_list, + driverFunctions, + driverContext); +} /** * Free the data associated with the given context. @@ -965,10 +1111,9 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_program_data(ctx); _mesa_free_shader_state(ctx); _mesa_free_queryobj_data(ctx); -#if FEATURE_ARB_sync _mesa_free_sync_data(ctx); -#endif _mesa_free_varray_data(ctx); + _mesa_free_transform_feedback(ctx); _mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj); @@ -1164,6 +1309,9 @@ check_compatible(const GLcontext *ctx, const GLframebuffer *buffer) if (ctxvis == bufvis) return GL_TRUE; + if (buffer == _mesa_get_incomplete_framebuffer()) + return GL_TRUE; + #if 0 /* disabling this fixes the fgl_glxgears pbuffer demo */ if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode) @@ -1358,6 +1506,8 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, if (newCtx->FirstTimeCurrent) { _mesa_compute_version(newCtx); + newCtx->Extensions.String = _mesa_make_extension_string(newCtx); + check_context_limits(newCtx); /* We can use this to help debug user's problems. Tell them to set @@ -1566,7 +1716,7 @@ _mesa_valid_to_render(GLcontext *ctx, const char *where) /* using shaders */ if (!ctx->Shader.CurrentProgram->LinkStatus) { _mesa_error(ctx, GL_INVALID_OPERATION, - "%s(shader not linked), where"); + "%s(shader not linked)", where); return GL_FALSE; } #if 0 /* not normally enabled */ diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h index 09bf1777d..c61da6282 100644 --- a/mesalib/src/mesa/main/context.h +++ b/mesalib/src/mesa/main/context.h @@ -112,8 +112,20 @@ _mesa_initialize_context( GLcontext *ctx, const struct dd_function_table *driverFunctions, void *driverContext ); -extern void -_mesa_initialize_context_extra(GLcontext *ctx); +extern GLcontext * +_mesa_create_context_for_api(gl_api api, + const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext); + +extern GLboolean +_mesa_initialize_context_for_api(GLcontext *ctx, + gl_api api, + const GLvisual *visual, + GLcontext *share_list, + const struct dd_function_table *driverFunctions, + void *driverContext); extern void _mesa_free_context_data( GLcontext *ctx ); @@ -141,6 +153,8 @@ _mesa_get_current_context(void); /*@}*/ +extern void +_mesa_init_get_hash(GLcontext *ctx); extern void _mesa_notifySwapBuffers(__GLcontext *gc); diff --git a/mesalib/src/mesa/main/convolve.c b/mesalib/src/mesa/main/convolve.c index 15e8dffc2..f63bddc44 100644 --- a/mesalib/src/mesa/main/convolve.c +++ b/mesalib/src/mesa/main/convolve.c @@ -37,6 +37,7 @@ #include "convolve.h" #include "context.h" #include "image.h" +#include "macros.h" #include "mtypes.h" #include "state.h" #include "main/dispatch.h" diff --git a/mesalib/src/mesa/main/convolve.h b/mesalib/src/mesa/main/convolve.h index 59492bc7c..80caf942f 100644 --- a/mesalib/src/mesa/main/convolve.h +++ b/mesalib/src/mesa/main/convolve.h @@ -33,12 +33,6 @@ #if FEATURE_convolve -#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) \ - do { \ - (driver)->CopyConvolutionFilter1D = impl ## CopyConvolutionFilter1D; \ - (driver)->CopyConvolutionFilter2D = impl ## CopyConvolutionFilter2D; \ - } while (0) - extern void GLAPIENTRY _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); @@ -70,7 +64,7 @@ _mesa_init_convolve_dispatch(struct _glapi_table *disp); #else /* FEATURE_convolve */ -#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) do { } while (0) +#include "main/compiler.h" static INLINE void GLAPIENTRY _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, diff --git a/mesalib/src/mesa/main/core.h b/mesalib/src/mesa/main/core.h new file mode 100644 index 000000000..ea6e6bf11 --- /dev/null +++ b/mesalib/src/mesa/main/core.h @@ -0,0 +1,66 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Chia-I Wu <olv@lunarg.com> + */ + + +/** + * \file core.h + * The public header of core mesa. + * + * This file is the (only) public header of core mesa. It is supposed to be + * used by GLX, WGL, and GLSL. It is important that headers directly or + * indirectly included here do not perform feature tests (#if FEATURE_xxx). + */ + + +#ifndef CORE_H +#define CORE_H + + +#include "main/glheader.h" +#include "main/compiler.h" +#include "main/imports.h" +#include "main/macros.h" + +#include "main/version.h" /* for MESA_VERSION_STRING */ +#include "main/context.h" /* for _mesa_share_state */ +#include "main/mtypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* for GLSL */ +#include "program/prog_parameter.h" +#include "program/prog_uniform.h" + +#ifdef __cplusplus +} +#endif + + +#endif /* CORE_H */ diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 7c02faaa5..8a20a6636 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -36,7 +36,7 @@ struct gl_pixelstore_attrib; struct gl_display_list; -#if FEATURE_ARB_vertex_buffer_object +/* GL_ARB_vertex_buffer_object */ /* Modifies GL_MAP_UNSYNCHRONIZED_BIT to allow driver to fail (return * NULL) if buffer is unavailable for immediate mapping. * @@ -49,7 +49,6 @@ struct gl_display_list; * respect the contents of already referenced data. */ #define MESA_MAP_NOWAIT_BIT 0x0040 -#endif /** @@ -595,6 +594,27 @@ struct dd_function_table { /*@}*/ + /** + * \name GLSL shader/program functions. + */ + /*@{*/ + /** + * Called when a shader is compiled. + * + * Note that not all shader objects get ShaderCompile called on + * them. Notably, the shaders containing builtin functions do not + * have CompileShader() called, so if lowering passes are done they + * need to also be performed in LinkShader(). + */ + GLboolean (*CompileShader)(GLcontext *ctx, struct gl_shader *shader); + /** + * Called when a shader program is linked. + * + * This gives drivers an opportunity to clone the IR and make their + * own transformations on it for the purposes of code generation. + */ + GLboolean (*LinkShader)(GLcontext *ctx, struct gl_shader_program *shader); + /*@}*/ /** * \name State-changing functions. @@ -706,31 +726,9 @@ struct dd_function_table { /*@}*/ - /** - * \name State-query functions - * - * Return GL_TRUE if query was completed, GL_FALSE otherwise. - */ - /*@{*/ - /** Return the value or values of a selected parameter */ - GLboolean (*GetBooleanv)(GLcontext *ctx, GLenum pname, GLboolean *result); - /** Return the value or values of a selected parameter */ - GLboolean (*GetDoublev)(GLcontext *ctx, GLenum pname, GLdouble *result); - /** Return the value or values of a selected parameter */ - GLboolean (*GetFloatv)(GLcontext *ctx, GLenum pname, GLfloat *result); - /** Return the value or values of a selected parameter */ - GLboolean (*GetIntegerv)(GLcontext *ctx, GLenum pname, GLint *result); - /** Return the value or values of a selected parameter */ - GLboolean (*GetInteger64v)(GLcontext *ctx, GLenum pname, GLint64 *result); - /** Return the value or values of a selected parameter */ - GLboolean (*GetPointerv)(GLcontext *ctx, GLenum pname, GLvoid **result); - /*@}*/ - - /** * \name Vertex/pixel buffer object functions */ -#if FEATURE_ARB_vertex_buffer_object /*@{*/ void (*BindBuffer)( GLcontext *ctx, GLenum target, struct gl_buffer_object *obj ); @@ -774,12 +772,10 @@ struct dd_function_table { GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target, struct gl_buffer_object *obj ); /*@}*/ -#endif /** * \name Functions for GL_APPLE_object_purgeable */ -#if FEATURE_APPLE_object_purgeable /*@{*/ /* variations on ObjectPurgeable */ GLenum (*BufferObjectPurgeable)( GLcontext *ctx, struct gl_buffer_object *obj, GLenum option ); @@ -791,12 +787,10 @@ struct dd_function_table { GLenum (*RenderObjectUnpurgeable)( GLcontext *ctx, struct gl_renderbuffer *obj, GLenum option ); GLenum (*TextureObjectUnpurgeable)( GLcontext *ctx, struct gl_texture_object *obj, GLenum option ); /*@}*/ -#endif /** - * \name Functions for GL_EXT_framebuffer_object + * \name Functions for GL_EXT_framebuffer_{object,blit}. */ -#if FEATURE_EXT_framebuffer_object /*@{*/ struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name); struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name); @@ -815,13 +809,10 @@ struct dd_function_table { void (*ValidateFramebuffer)(GLcontext *ctx, struct gl_framebuffer *fb); /*@}*/ -#endif -#if FEATURE_EXT_framebuffer_blit void (*BlitFramebuffer)(GLcontext *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif /** * \name Query objects @@ -849,54 +840,12 @@ struct dd_function_table { * \name GLSL-related functions (ARB extensions and OpenGL 2.x) */ /*@{*/ - void (*AttachShader)(GLcontext *ctx, GLuint program, GLuint shader); - void (*BindAttribLocation)(GLcontext *ctx, GLuint program, GLuint index, - const GLcharARB *name); - void (*CompileShader)(GLcontext *ctx, GLuint shader); - GLuint (*CreateShader)(GLcontext *ctx, GLenum type); - GLuint (*CreateProgram)(GLcontext *ctx); - void (*DeleteProgram2)(GLcontext *ctx, GLuint program); - void (*DeleteShader)(GLcontext *ctx, GLuint shader); - void (*DetachShader)(GLcontext *ctx, GLuint program, GLuint shader); - void (*GetActiveAttrib)(GLcontext *ctx, GLuint program, GLuint index, - GLsizei maxLength, GLsizei * length, GLint * size, - GLenum * type, GLcharARB * name); - void (*GetActiveUniform)(GLcontext *ctx, GLuint program, GLuint index, - GLsizei maxLength, GLsizei *length, GLint *size, - GLenum *type, GLcharARB *name); - void (*GetAttachedShaders)(GLcontext *ctx, GLuint program, GLsizei maxCount, - GLsizei *count, GLuint *obj); - GLint (*GetAttribLocation)(GLcontext *ctx, GLuint program, - const GLcharARB *name); - GLuint (*GetHandle)(GLcontext *ctx, GLenum pname); - void (*GetProgramiv)(GLcontext *ctx, GLuint program, - GLenum pname, GLint *params); - void (*GetProgramInfoLog)(GLcontext *ctx, GLuint program, GLsizei bufSize, - GLsizei *length, GLchar *infoLog); - void (*GetShaderiv)(GLcontext *ctx, GLuint shader, - GLenum pname, GLint *params); - void (*GetShaderInfoLog)(GLcontext *ctx, GLuint shader, GLsizei bufSize, - GLsizei *length, GLchar *infoLog); - void (*GetShaderSource)(GLcontext *ctx, GLuint shader, GLsizei maxLength, - GLsizei *length, GLcharARB *sourceOut); - void (*GetUniformfv)(GLcontext *ctx, GLuint program, GLint location, - GLfloat *params); - void (*GetUniformiv)(GLcontext *ctx, GLuint program, GLint location, - GLint *params); - GLint (*GetUniformLocation)(GLcontext *ctx, GLuint program, - const GLcharARB *name); - GLboolean (*IsProgram)(GLcontext *ctx, GLuint name); - GLboolean (*IsShader)(GLcontext *ctx, GLuint name); - void (*LinkProgram)(GLcontext *ctx, GLuint program); - void (*ShaderSource)(GLcontext *ctx, GLuint shader, const GLchar *source); - void (*Uniform)(GLcontext *ctx, GLint location, GLsizei count, - const GLvoid *values, GLenum type); - void (*UniformMatrix)(GLcontext *ctx, GLint cols, GLint rows, - GLint location, GLsizei count, - GLboolean transpose, const GLfloat *values); - void (*UseProgram)(GLcontext *ctx, GLuint program); - void (*ValidateProgram)(GLcontext *ctx, GLuint program); - /* XXX many more to come */ + struct gl_shader *(*NewShader)(GLcontext *ctx, GLuint name, GLenum type); + void (*DeleteShader)(GLcontext *ctx, struct gl_shader *shader); + struct gl_shader_program *(*NewShaderProgram)(GLcontext *ctx, GLuint name); + void (*DeleteShaderProgram)(GLcontext *ctx, + struct gl_shader_program *shProg); + void (*UseProgram)(GLcontext *ctx, struct gl_shader_program *shProg); /*@}*/ @@ -1018,7 +967,6 @@ struct dd_function_table { void (*EndCallList)( GLcontext *ctx ); -#if FEATURE_ARB_sync /** * \name GL_ARB_sync interfaces */ @@ -1032,14 +980,12 @@ struct dd_function_table { void (*ServerWaitSync)(GLcontext *, struct gl_sync_object *, GLbitfield, GLuint64); /*@}*/ -#endif /** GL_NV_conditional_render */ void (*BeginConditionalRender)(GLcontext *ctx, struct gl_query_object *q, GLenum mode); void (*EndConditionalRender)(GLcontext *ctx, struct gl_query_object *q); -#if FEATURE_OES_draw_texture /** * \name GL_OES_draw_texture interface */ @@ -1047,9 +993,10 @@ struct dd_function_table { void (*DrawTex)(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); /*@}*/ -#endif -#if FEATURE_OES_EGL_image + /** + * \name GL_OES_EGL_image interface + */ void (*EGLImageTargetTexture2D)(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj, struct gl_texture_image *texImage, @@ -1057,8 +1004,24 @@ struct dd_function_table { void (*EGLImageTargetRenderbufferStorage)(GLcontext *ctx, struct gl_renderbuffer *rb, void *image_handle); -#endif + /** + * \name GL_EXT_transform_feedback interface + */ + struct gl_transform_feedback_object * + (*NewTransformFeedback)(GLcontext *ctx, GLuint name); + void (*DeleteTransformFeedback)(GLcontext *ctx, + struct gl_transform_feedback_object *obj); + void (*BeginTransformFeedback)(GLcontext *ctx, GLenum mode, + struct gl_transform_feedback_object *obj); + void (*EndTransformFeedback)(GLcontext *ctx, + struct gl_transform_feedback_object *obj); + void (*PauseTransformFeedback)(GLcontext *ctx, + struct gl_transform_feedback_object *obj); + void (*ResumeTransformFeedback)(GLcontext *ctx, + struct gl_transform_feedback_object *obj); + void (*DrawTransformFeedback)(GLcontext *ctx, GLenum mode, + struct gl_transform_feedback_object *obj); }; @@ -1085,23 +1048,23 @@ typedef struct { * \name Vertex */ /*@{*/ - void (GLAPIENTRYP ArrayElement)( GLint ); /* NOTE */ + void (GLAPIENTRYP ArrayElement)( GLint ); void (GLAPIENTRYP Color3f)( GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Color3fv)( const GLfloat * ); void (GLAPIENTRYP Color4f)( GLfloat, GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Color4fv)( const GLfloat * ); void (GLAPIENTRYP EdgeFlag)( GLboolean ); - void (GLAPIENTRYP EvalCoord1f)( GLfloat ); /* NOTE */ - void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); /* NOTE */ - void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); /* NOTE */ - void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); /* NOTE */ - void (GLAPIENTRYP EvalPoint1)( GLint ); /* NOTE */ - void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); /* NOTE */ + void (GLAPIENTRYP EvalCoord1f)( GLfloat ); + void (GLAPIENTRYP EvalCoord1fv)( const GLfloat * ); + void (GLAPIENTRYP EvalCoord2f)( GLfloat, GLfloat ); + void (GLAPIENTRYP EvalCoord2fv)( const GLfloat * ); + void (GLAPIENTRYP EvalPoint1)( GLint ); + void (GLAPIENTRYP EvalPoint2)( GLint, GLint ); void (GLAPIENTRYP FogCoordfEXT)( GLfloat ); void (GLAPIENTRYP FogCoordfvEXT)( const GLfloat * ); void (GLAPIENTRYP Indexf)( GLfloat ); void (GLAPIENTRYP Indexfv)( const GLfloat * ); - void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); /* NOTE */ + void (GLAPIENTRYP Materialfv)( GLenum face, GLenum pname, const GLfloat * ); void (GLAPIENTRYP MultiTexCoord1fARB)( GLenum, GLfloat ); void (GLAPIENTRYP MultiTexCoord1fvARB)( GLenum, const GLfloat * ); void (GLAPIENTRYP MultiTexCoord2fARB)( GLenum, GLfloat, GLfloat ); @@ -1128,8 +1091,8 @@ typedef struct { void (GLAPIENTRYP Vertex3fv)( const GLfloat * ); void (GLAPIENTRYP Vertex4f)( GLfloat, GLfloat, GLfloat, GLfloat ); void (GLAPIENTRYP Vertex4fv)( const GLfloat * ); - void (GLAPIENTRYP CallList)( GLuint ); /* NOTE */ - void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); /* NOTE */ + void (GLAPIENTRYP CallList)( GLuint ); + void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * ); void (GLAPIENTRYP Begin)( GLenum ); void (GLAPIENTRYP End)( void ); /* GL_NV_vertex_program */ @@ -1141,7 +1104,7 @@ typedef struct { void (GLAPIENTRYP VertexAttrib3fvNV)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fNV)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvNV)( GLuint index, const GLfloat *v ); -#if FEATURE_ARB_vertex_program + /* GL_ARB_vertex_program */ void (GLAPIENTRYP VertexAttrib1fARB)( GLuint index, GLfloat x ); void (GLAPIENTRYP VertexAttrib1fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib2fARB)( GLuint index, GLfloat x, GLfloat y ); @@ -1150,11 +1113,8 @@ typedef struct { void (GLAPIENTRYP VertexAttrib3fvARB)( GLuint index, const GLfloat *v ); void (GLAPIENTRYP VertexAttrib4fARB)( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); void (GLAPIENTRYP VertexAttrib4fvARB)( GLuint index, const GLfloat *v ); -#endif /*@}*/ - /* - */ void (GLAPIENTRYP Rectf)( GLfloat, GLfloat, GLfloat, GLfloat ); /** @@ -1186,6 +1146,11 @@ typedef struct { const GLvoid **indices, GLsizei primcount, const GLint *basevertex); + void (GLAPIENTRYP DrawArraysInstanced)(GLenum mode, GLint first, + GLsizei count, GLsizei primcount); + void (GLAPIENTRYP DrawElementsInstanced)(GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices, + GLsizei primcount); /*@}*/ /** diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c index 33b35e03c..526145aec 100644 --- a/mesalib/src/mesa/main/debug.c +++ b/mesalib/src/mesa/main/debug.c @@ -85,7 +85,7 @@ void _mesa_print_state( const char *msg, GLuint state ) { _mesa_debug(NULL, - "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, state, (state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "", @@ -105,6 +105,7 @@ _mesa_print_state( const char *msg, GLuint state ) (state & _NEW_POLYGON) ? "ctx->Polygon, " : "", (state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "", (state & _NEW_SCISSOR) ? "ctx->Scissor, " : "", + (state & _NEW_STENCIL) ? "ctx->Stencil, " : "", (state & _NEW_TEXTURE) ? "ctx->Texture, " : "", (state & _NEW_TRANSFORM) ? "ctx->Transform, " : "", (state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "", @@ -314,7 +315,7 @@ write_texture_image(struct gl_texture_object *texObj, buffer, texObj, img); /* make filename */ - sprintf(s, "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); + _mesa_snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); printf(" Writing image level %u to %s\n", level, s); write_ppm(s, buffer, img->Width, img->Height, 4, 0, 1, 2, GL_FALSE); @@ -356,7 +357,7 @@ write_renderbuffer_image(const struct gl_renderbuffer *rb) format, type, &ctx->DefaultPacking, buffer); /* make filename */ - sprintf(s, "/tmp/renderbuffer%u.ppm", rb->Name); + _mesa_snprintf(s, sizeof(s), "/tmp/renderbuffer%u.ppm", rb->Name); printf(" Writing renderbuffer image to %s\n", s); write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE); diff --git a/mesalib/src/mesa/main/debug.h b/mesalib/src/mesa/main/debug.h index 0449cb179..b517cc825 100644 --- a/mesalib/src/mesa/main/debug.h +++ b/mesalib/src/mesa/main/debug.h @@ -36,6 +36,9 @@ #ifndef _DEBUG_H #define _DEBUG_H +#include "glheader.h" +#include "mtypes.h" + #if _HAVE_FULL_GL extern void _mesa_print_tri_caps( const char *name, GLuint flags ); diff --git a/mesalib/src/mesa/main/depthstencil.c b/mesalib/src/mesa/main/depthstencil.c index 892520b69..dbaa84164 100644 --- a/mesalib/src/mesa/main/depthstencil.c +++ b/mesalib/src/mesa/main/depthstencil.c @@ -62,8 +62,8 @@ nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) static void delete_wrapper(struct gl_renderbuffer *rb) { - ASSERT(rb->Format == MESA_FORMAT_Z24_S8 || - rb->Format == MESA_FORMAT_S8_Z24); + ASSERT(rb->Format == MESA_FORMAT_S8 || + rb->Format == MESA_FORMAT_X8_Z24); _mesa_reference_renderbuffer(&rb->Wrapped, NULL); free(rb); } @@ -83,7 +83,9 @@ alloc_wrapper_storage(GLcontext *ctx, struct gl_renderbuffer *rb, (void) internalFormat; ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 || - dsrb->Format == MESA_FORMAT_S8_Z24); + dsrb->Format == MESA_FORMAT_Z24_X8 || + dsrb->Format == MESA_FORMAT_S8_Z24 || + dsrb->Format == MESA_FORMAT_X8_Z24); retVal = dsrb->AllocStorage(ctx, dsrb, dsrb->InternalFormat, width, height); if (retVal) { @@ -352,16 +354,21 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *z24rb; ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 || - dsrb->Format == MESA_FORMAT_S8_Z24); + dsrb->Format == MESA_FORMAT_Z24_X8 || + dsrb->Format == MESA_FORMAT_S8_Z24 || + dsrb->Format == MESA_FORMAT_X8_Z24); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); - z24rb = _mesa_new_renderbuffer(ctx, 0); + z24rb = ctx->Driver.NewRenderbuffer(ctx, 0); if (!z24rb) return NULL; + /* NOTE: need to do manual refcounting here */ z24rb->Wrapped = dsrb; + dsrb->RefCount++; + z24rb->Name = dsrb->Name; - z24rb->RefCount = 1; + z24rb->RefCount = 0; z24rb->Width = dsrb->Width; z24rb->Height = dsrb->Height; z24rb->InternalFormat = GL_DEPTH_COMPONENT24; @@ -638,13 +645,16 @@ _mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb) dsrb->Format == MESA_FORMAT_S8_Z24); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); - s8rb = _mesa_new_renderbuffer(ctx, 0); + s8rb = ctx->Driver.NewRenderbuffer(ctx, 0); if (!s8rb) return NULL; + /* NOTE: need to do manual refcounting here */ s8rb->Wrapped = dsrb; + dsrb->RefCount++; + s8rb->Name = dsrb->Name; - s8rb->RefCount = 1; + s8rb->RefCount = 0; s8rb->Width = dsrb->Width; s8rb->Height = dsrb->Height; s8rb->InternalFormat = GL_STENCIL_INDEX8_EXT; diff --git a/mesalib/src/mesa/main/depthstencil.h b/mesalib/src/mesa/main/depthstencil.h index 3dde081f5..afbac77f0 100644 --- a/mesalib/src/mesa/main/depthstencil.h +++ b/mesalib/src/mesa/main/depthstencil.h @@ -26,6 +26,7 @@ #ifndef DEPTHSTENCIL_H #define DEPTHSTENCIL_H +#include "mtypes.h" extern struct gl_renderbuffer * _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index 43aadb1de..d847d4d5d 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -32,7 +32,11 @@ #include "glheader.h" #include "imports.h" #include "api_arrayelt.h" +#include "api_exec.h" #include "api_loopback.h" +#if FEATURE_ATI_fragment_shader +#include "atifragshader.h" +#endif #include "config.h" #include "mfeatures.h" #if FEATURE_ARB_vertex_buffer_object @@ -55,13 +59,10 @@ #include "mtypes.h" #include "varray.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program -#include "shader/arbprogram.h" +#include "arbprogram.h" #endif #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program -#include "shader/nvprogram.h" -#endif -#if FEATURE_ATI_fragment_shader -#include "shader/atifragshader.h" +#include "nvprogram.h" #endif #include "math/m_matrix.h" @@ -370,6 +371,16 @@ typedef enum OPCODE_UNIFORM_MATRIX34, OPCODE_UNIFORM_MATRIX43, + /* OpenGL 3.0 */ + OPCODE_UNIFORM_1UI, + OPCODE_UNIFORM_2UI, + OPCODE_UNIFORM_3UI, + OPCODE_UNIFORM_4UI, + OPCODE_UNIFORM_1UIV, + OPCODE_UNIFORM_2UIV, + OPCODE_UNIFORM_3UIV, + OPCODE_UNIFORM_4UIV, + /* GL_EXT_framebuffer_blit */ OPCODE_BLIT_FRAMEBUFFER, @@ -396,6 +407,10 @@ typedef enum /* GL_EXT_provoking_vertex */ OPCODE_PROVOKING_VERTEX, + /* GL_EXT_transform_feedback */ + OPCODE_BEGIN_TRANSFORM_FEEDBACK, + OPCODE_END_TRANSFORM_FEEDBACK, + /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_CONTINUE, @@ -670,6 +685,10 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) case OPCODE_UNIFORM_2IV: case OPCODE_UNIFORM_3IV: case OPCODE_UNIFORM_4IV: + case OPCODE_UNIFORM_1UIV: + case OPCODE_UNIFORM_2UIV: + case OPCODE_UNIFORM_3UIV: + case OPCODE_UNIFORM_4UIV: free(n[3].data); n += InstSize[n[0].opcode]; break; @@ -6051,8 +6070,15 @@ exec_GetAttribLocationARB(GLuint program, const GLchar *name) FLUSH_VERTICES(ctx, 0); return CALL_GetAttribLocationARB(ctx->Exec, (program, name)); } -/* XXX more shader functions needed here */ +static GLint GLAPIENTRY +exec_GetUniformLocationARB(GLuint program, const GLchar *name) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + return CALL_GetUniformLocationARB(ctx->Exec, (program, name)); +} +/* XXX more shader functions needed here */ #if FEATURE_EXT_framebuffer_blit @@ -6104,6 +6130,36 @@ save_ProvokingVertexEXT(GLenum mode) } +/** GL_EXT_transform_feedback */ +static void GLAPIENTRY +save_BeginTransformFeedback(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1); + if (n) { + n[1].e = mode; + } + if (ctx->ExecuteFlag) { + CALL_BeginTransformFeedbackEXT(ctx->Exec, (mode)); + } +} + + +/** GL_EXT_transform_feedback */ +static void GLAPIENTRY +save_EndTransformFeedback(void) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + (void) alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0); + if (ctx->ExecuteFlag) { + CALL_EndTransformFeedbackEXT(ctx->Exec, ()); + } +} + + /* aka UseProgram() */ static void GLAPIENTRY save_UseProgramObjectARB(GLhandleARB program) @@ -6416,6 +6472,149 @@ save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v) } + +static void GLAPIENTRY +save_Uniform1ui(GLint location, GLuint x) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_1UI, 2); + if (n) { + n[1].i = location; + n[2].i = x; + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform1ui(ctx->Exec, (location, x));*/ + } +} + +static void GLAPIENTRY +save_Uniform2ui(GLint location, GLuint x, GLuint y) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_2UI, 3); + if (n) { + n[1].i = location; + n[2].i = x; + n[3].i = y; + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform2ui(ctx->Exec, (location, x, y));*/ + } +} + +static void GLAPIENTRY +save_Uniform3ui(GLint location, GLuint x, GLuint y, GLuint z) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_3UI, 4); + if (n) { + n[1].i = location; + n[2].i = x; + n[3].i = y; + n[4].i = z; + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform3ui(ctx->Exec, (location, x, y, z));*/ + } +} + +static void GLAPIENTRY +save_Uniform4ui(GLint location, GLuint x, GLuint y, GLuint z, GLuint w) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_4UI, 5); + if (n) { + n[1].i = location; + n[2].i = x; + n[3].i = y; + n[4].i = z; + n[5].i = w; + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform4ui(ctx->Exec, (location, x, y, z, w));*/ + } +} + + + +static void GLAPIENTRY +save_Uniform1uiv(GLint location, GLsizei count, const GLuint *v) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_1UIV, 3); + if (n) { + n[1].i = location; + n[2].i = count; + n[3].data = memdup(v, count * 1 * sizeof(*v)); + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform1uiv(ctx->Exec, (location, count, v));*/ + } +} + +static void GLAPIENTRY +save_Uniform2uiv(GLint location, GLsizei count, const GLuint *v) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_2UIV, 3); + if (n) { + n[1].i = location; + n[2].i = count; + n[3].data = memdup(v, count * 2 * sizeof(*v)); + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform2uiv(ctx->Exec, (location, count, v));*/ + } +} + +static void GLAPIENTRY +save_Uniform3uiv(GLint location, GLsizei count, const GLuint *v) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_3UIV, 3); + if (n) { + n[1].i = location; + n[2].i = count; + n[3].data = memdup(v, count * 3 * sizeof(*v)); + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform3uiv(ctx->Exec, (location, count, v));*/ + } +} + +static void GLAPIENTRY +save_Uniform4uiv(GLint location, GLsizei count, const GLuint *v) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_UNIFORM_4UIV, 3); + if (n) { + n[1].i = location; + n[2].i = count; + n[3].data = memdup(v, count * 4 * sizeof(*v)); + } + if (ctx->ExecuteFlag) { + /*CALL_Uniform4uiv(ctx->Exec, (location, count, v));*/ + } +} + + + static void GLAPIENTRY save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose, const GLfloat *m) @@ -6619,7 +6818,7 @@ _mesa_compile_error(GLcontext *ctx, GLenum error, const char *s) if (ctx->CompileFlag) save_error(ctx, error, s); if (ctx->ExecuteFlag) - _mesa_error(ctx, error, s); + _mesa_error(ctx, error, "%s", s); } @@ -6686,7 +6885,7 @@ execute_list(GLcontext *ctx, GLuint list) else { switch (opcode) { case OPCODE_ERROR: - _mesa_error(ctx, n[1].e, (const char *) n[2].data); + _mesa_error(ctx, n[1].e, "%s", (const char *) n[2].data); break; case OPCODE_ACCUM: CALL_Accum(ctx->Exec, (n[1].e, n[2].f)); @@ -7199,6 +7398,12 @@ execute_list(GLcontext *ctx, GLuint list) case OPCODE_PROVOKING_VERTEX: CALL_ProvokingVertexEXT(ctx->Exec, (n[1].e)); break; + case OPCODE_BEGIN_TRANSFORM_FEEDBACK: + CALL_BeginTransformFeedbackEXT(ctx->Exec, (n[1].e)); + break; + case OPCODE_END_TRANSFORM_FEEDBACK: + CALL_EndTransformFeedbackEXT(ctx->Exec, ()); + break; case OPCODE_STENCIL_FUNC: CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui)); break; @@ -7521,7 +7726,32 @@ execute_list(GLcontext *ctx, GLuint list) case OPCODE_UNIFORM_4IV: CALL_Uniform4ivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data)); break; - + case OPCODE_UNIFORM_1UI: + /*CALL_Uniform1uiARB(ctx->Exec, (n[1].i, n[2].i));*/ + break; + case OPCODE_UNIFORM_2UI: + /*CALL_Uniform2uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i));*/ + break; + case OPCODE_UNIFORM_3UI: + /*CALL_Uniform3uiARB(ctx->Exec, (n[1].i, n[2].i, n[3].i, n[4].i));*/ + break; + case OPCODE_UNIFORM_4UI: + /*CALL_Uniform4uiARB(ctx->Exec, + (n[1].i, n[2].i, n[3].i, n[4].i, n[5].i)); + */ + break; + case OPCODE_UNIFORM_1UIV: + /*CALL_Uniform1uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/ + break; + case OPCODE_UNIFORM_2UIV: + /*CALL_Uniform2uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/ + break; + case OPCODE_UNIFORM_3UIV: + /*CALL_Uniform3uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/ + break; + case OPCODE_UNIFORM_4UIV: + /*CALL_Uniform4uivARB(ctx->Exec, (n[1].i, n[2].i, n[3].data));*/ + break; case OPCODE_UNIFORM_MATRIX22: CALL_UniformMatrix2fvARB(ctx->Exec, (n[1].i, n[2].i, n[3].b, n[4].data)); @@ -7685,9 +7915,9 @@ execute_list(GLcontext *ctx, GLuint list) default: { char msg[1000]; - sprintf(msg, "Error in execute_list: opcode=%d", + _mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d", (int) opcode); - _mesa_problem(ctx, msg); + _mesa_problem(ctx, "%s", msg); } done = GL_TRUE; } @@ -8662,8 +8892,8 @@ exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) /* GL_EXT_multi_draw_arrays */ static void GLAPIENTRY -exec_MultiDrawArraysEXT(GLenum mode, GLint * first, - GLsizei * count, GLsizei primcount) +exec_MultiDrawArraysEXT(GLenum mode, const GLint *first, + const GLsizei *count, GLsizei primcount) { GET_CURRENT_CONTEXT(ctx); FLUSH_VERTICES(ctx, 0); @@ -8707,9 +8937,15 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode, * initialized from _mesa_init_api_defaults and from the active vtxfmt * struct. */ -void -_mesa_init_save_table(struct _glapi_table *table) +struct _glapi_table * +_mesa_create_save_table(void) { + struct _glapi_table *table; + + table = _mesa_alloc_dispatch_table(sizeof *table); + if (table == NULL) + return NULL; + _mesa_loopback_init_api_table(table); /* GL 1.0 */ @@ -9262,12 +9498,13 @@ _mesa_init_save_table(struct _glapi_table *table) /* ARB 30/31/32. GL_ARB_shader_objects, GL_ARB_vertex/fragment_shader */ SET_BindAttribLocationARB(table, exec_BindAttribLocationARB); SET_GetAttribLocationARB(table, exec_GetAttribLocationARB); + SET_GetUniformLocationARB(table, exec_GetUniformLocationARB); /* XXX additional functions need to be implemented here! */ /* 299. GL_EXT_blend_equation_separate */ SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT); - /* GL_EXT_gpu_program_parmaeters */ + /* GL_EXT_gpu_program_parameters */ #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT); SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT); @@ -9282,6 +9519,12 @@ _mesa_init_save_table(struct _glapi_table *table) /* ARB 59. GL_ARB_copy_buffer */ SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */ + /* 352. GL_EXT_transform_feedback */ +#if FEATURE_EXT_transform_feedback + SET_BeginTransformFeedbackEXT(table, save_BeginTransformFeedback); + SET_EndTransformFeedbackEXT(table, save_EndTransformFeedback); +#endif + /* 364. GL_EXT_provoking_vertex */ SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT); @@ -9297,12 +9540,30 @@ _mesa_init_save_table(struct _glapi_table *table) SET_ClearBufferuiv(table, save_ClearBufferuiv); SET_ClearBufferfv(table, save_ClearBufferfv); SET_ClearBufferfi(table, save_ClearBufferfi); + SET_Uniform1ui(table, save_Uniform1ui); + SET_Uniform2ui(table, save_Uniform2ui); + SET_Uniform3ui(table, save_Uniform3ui); + SET_Uniform4ui(table, save_Uniform4ui); + SET_Uniform1uiv(table, save_Uniform1uiv); + SET_Uniform2uiv(table, save_Uniform2uiv); + SET_Uniform3uiv(table, save_Uniform3uiv); + SET_Uniform4uiv(table, save_Uniform4uiv); #else (void) save_ClearBufferiv; (void) save_ClearBufferuiv; (void) save_ClearBufferfv; (void) save_ClearBufferfi; + (void) save_Uniform1ui; + (void) save_Uniform2ui; + (void) save_Uniform3ui; + (void) save_Uniform4ui; + (void) save_Uniform1uiv; + (void) save_Uniform2uiv; + (void) save_Uniform3uiv; + (void) save_Uniform4uiv; #endif + + return table; } diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h index f37a93a7f..86bb132e5 100644 --- a/mesalib/src/mesa/main/dlist.h +++ b/mesalib/src/mesa/main/dlist.h @@ -38,16 +38,6 @@ #if FEATURE_dlist -#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) \ - do { \ - (driver)->NewList = impl ## NewList; \ - (driver)->EndList = impl ## EndList; \ - (driver)->BeginCallList = impl ## BeginCallList; \ - (driver)->EndCallList = impl ## EndCallList; \ - (driver)->SaveFlushVertices = impl ## SaveFlushVertices; \ - (driver)->NotifySaveBegin = impl ## NotifyBegin; \ - } while (0) - #define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) \ do { \ (vfmt)->CallList = impl ## CallList; \ @@ -72,7 +62,7 @@ extern void _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist); extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); -extern void _mesa_init_save_table( struct _glapi_table *table ); +extern struct _glapi_table *_mesa_create_save_table(void); extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp, const GLvertexformat *vfmt); @@ -81,7 +71,8 @@ extern void _mesa_init_dlist_dispatch(struct _glapi_table *disp); #else /* FEATURE_dlist */ -#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) do { } while (0) +#include "main/compiler.h" + #define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) do { } while (0) static INLINE void diff --git a/mesalib/src/mesa/main/dlopen.c b/mesalib/src/mesa/main/dlopen.c index 658ac9e40..57a33292e 100644 --- a/mesalib/src/mesa/main/dlopen.c +++ b/mesalib/src/mesa/main/dlopen.c @@ -67,22 +67,27 @@ _mesa_dlopen(const char *libname, int flags) GenericFunc _mesa_dlsym(void *handle, const char *fname) { + union { + void *v; + GenericFunc f; + } u; #if defined(__blrts) - return (GenericFunc) NULL; + u.v = NULL; #elif defined(__DJGPP__) /* need '_' prefix on symbol names */ char fname2[1000]; fname2[0] = '_'; strncpy(fname2 + 1, fname, 998); fname2[999] = 0; - return (GenericFunc) dlsym(handle, fname2); + u.v = dlsym(handle, fname2); #elif defined(_GNU_SOURCE) - return (GenericFunc) dlsym(handle, fname); + u.v = dlsym(handle, fname); #elif defined(__MINGW32__) - return (GenericFunc) GetProcAddress(handle, fname); + u.v = (void *) GetProcAddress(handle, fname); #else - return (GenericFunc) NULL; + u.v = NULL; #endif + return u.f; } diff --git a/mesalib/src/mesa/main/drawpix.h b/mesalib/src/mesa/main/drawpix.h index 8ffb1a6d8..1f95ff529 100644 --- a/mesalib/src/mesa/main/drawpix.h +++ b/mesalib/src/mesa/main/drawpix.h @@ -31,20 +31,11 @@ #if FEATURE_drawpix -#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) \ - do { \ - (driver)->DrawPixels = impl ## DrawPixels; \ - (driver)->CopyPixels = impl ## CopyPixels; \ - (driver)->Bitmap = impl ## Bitmap; \ - } while (0) - extern void _mesa_init_drawpix_dispatch(struct _glapi_table *disp); #else /* FEATURE_drawpix */ -#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) do { } while (0) - static INLINE void _mesa_init_drawpix_dispatch(struct _glapi_table *disp) { diff --git a/mesalib/src/mesa/main/drawtex.c b/mesalib/src/mesa/main/drawtex.c new file mode 100644 index 000000000..c2ad5f238 --- /dev/null +++ b/mesalib/src/mesa/main/drawtex.c @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "main/drawtex.h" +#include "main/state.h" +#include "main/imports.h" + + +#if FEATURE_OES_draw_texture + + +static void +draw_texture(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, + GLfloat width, GLfloat height) +{ + if (!ctx->Extensions.OES_draw_texture) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDrawTex(unsupported)"); + return; + } + if (width <= 0.0f || height <= 0.0f) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTex(width or height <= 0)"); + return; + } + + if (ctx->NewState) + _mesa_update_state(ctx); + + ASSERT(ctx->Driver.DrawTex); + ctx->Driver.DrawTex(ctx, x, y, z, width, height); +} + + +void GLAPIENTRY +_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, x, y, z, width, height); +} + + +void GLAPIENTRY +_mesa_DrawTexfv(const GLfloat *coords) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, coords[0], coords[1], coords[2], coords[3], coords[4]); +} + + +void GLAPIENTRY +_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, (GLfloat) x, (GLfloat) y, (GLfloat) z, + (GLfloat) width, (GLfloat) height); +} + + +void GLAPIENTRY +_mesa_DrawTexiv(const GLint *coords) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, (GLfloat) coords[0], (GLfloat) coords[1], + (GLfloat) coords[2], (GLfloat) coords[3], (GLfloat) coords[4]); +} + + +void GLAPIENTRY +_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, (GLfloat) x, (GLfloat) y, (GLfloat) z, + (GLfloat) width, (GLfloat) height); +} + + +void GLAPIENTRY +_mesa_DrawTexsv(const GLshort *coords) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, (GLfloat) coords[0], (GLfloat) coords[1], + (GLfloat) coords[2], (GLfloat) coords[3], (GLfloat) coords[4]); +} + + +void GLAPIENTRY +_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, + (GLfloat) x / 65536.0f, + (GLfloat) y / 65536.0f, + (GLfloat) z / 65536.0f, + (GLfloat) width / 65536.0f, + (GLfloat) height / 65536.0f); +} + + +void GLAPIENTRY +_mesa_DrawTexxv(const GLfixed *coords) +{ + GET_CURRENT_CONTEXT(ctx); + draw_texture(ctx, + (GLfloat) coords[0] / 65536.0f, + (GLfloat) coords[1] / 65536.0f, + (GLfloat) coords[2] / 65536.0f, + (GLfloat) coords[3] / 65536.0f, + (GLfloat) coords[4] / 65536.0f); +} + +#endif /* FEATURE_OES_draw_texture */ diff --git a/mesalib/src/mesa/main/drawtex.h b/mesalib/src/mesa/main/drawtex.h new file mode 100644 index 000000000..d7d507566 --- /dev/null +++ b/mesalib/src/mesa/main/drawtex.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef DRAWTEX_H +#define DRAWTEX_H + + +#include "main/mtypes.h" + + +#if FEATURE_OES_draw_texture + +extern void GLAPIENTRY +_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); + +extern void GLAPIENTRY +_mesa_DrawTexfv(const GLfloat *coords); + +extern void GLAPIENTRY +_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height); + +extern void GLAPIENTRY +_mesa_DrawTexiv(const GLint *coords); + +extern void GLAPIENTRY +_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); + +extern void GLAPIENTRY +_mesa_DrawTexsv(const GLshort *coords); + +extern void GLAPIENTRY +_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); + +extern void GLAPIENTRY +_mesa_DrawTexxv(const GLfixed *coords); + +#endif /* FEATURE_OES_draw_texture */ + + +#endif /* DRAWTEX_H */ diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index f5c88a63e..db30123c0 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -42,9 +42,7 @@ #define CHECK_EXTENSION(EXTNAME, CAP) \ if (!ctx->Extensions.EXTNAME) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \ - state ? "Enable" : "Disable", CAP); \ - return; \ + goto invalid_enum_error; \ } @@ -127,9 +125,7 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state) #endif /* FEATURE_NV_vertex_program */ default: - _mesa_error( ctx, GL_INVALID_ENUM, - "glEnable/DisableClientState(0x%x)", cap); - return; + goto invalid_enum_error; } if (*var == state) @@ -150,6 +146,12 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state) if (ctx->Driver.Enable) { ctx->Driver.Enable( ctx, cap, state ); } + + return; + +invalid_enum_error: + _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", + state ? "Enable" : "Disable", cap); } @@ -188,16 +190,12 @@ _mesa_DisableClientState( GLenum cap ) #undef CHECK_EXTENSION #define CHECK_EXTENSION(EXTNAME, CAP) \ if (!ctx->Extensions.EXTNAME) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ - state ? "Enable" : "Disable", CAP); \ - return; \ + goto invalid_enum_error; \ } #define CHECK_EXTENSION2(EXT1, EXT2, CAP) \ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ - state ? "Enable" : "Disable", CAP); \ - return; \ + goto invalid_enum_error; \ } @@ -684,6 +682,25 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) } break; +#if FEATURE_ES1 + case GL_TEXTURE_GEN_STR_OES: + /* disable S, T, and R at the same time */ + { + struct gl_texture_unit *texUnit = get_texcoord_unit(ctx); + if (texUnit) { + GLuint newenabled = + texUnit->TexGenEnabled & ~STR_BITS; + if (state) + newenabled |= STR_BITS; + if (texUnit->TexGenEnabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->TexGenEnabled = newenabled; + } + } + break; +#endif + /* * CLIENT STATE!!! */ @@ -982,15 +999,40 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) ctx->Texture.CubeMapSeamless = state; break; +#if FEATURE_EXT_transform_feedback + case GL_RASTERIZER_DISCARD: + CHECK_EXTENSION(EXT_transform_feedback, cap); + if (ctx->TransformFeedback.RasterDiscard != state) { + ctx->TransformFeedback.RasterDiscard = state; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + } + break; +#endif + + /* GL 3.1 primitive restart */ + case GL_PRIMITIVE_RESTART: + if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) { + goto invalid_enum_error; + } + if (ctx->Array.PrimitiveRestart != state) { + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Array.PrimitiveRestart = state; + } + break; + default: - _mesa_error(ctx, GL_INVALID_ENUM, - "%s(0x%x)", state ? "glEnable" : "glDisable", cap); - return; + goto invalid_enum_error; } if (ctx->Driver.Enable) { ctx->Driver.Enable( ctx, cap, state ); } + + return; + +invalid_enum_error: + _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", + state ? "Enable" : "Disable", cap); } @@ -1033,7 +1075,7 @@ _mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state) switch (cap) { case GL_BLEND: if (!ctx->Extensions.EXT_draw_buffers2) { - goto bad_cap_error; + goto invalid_enum_error; } if (index >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)", @@ -1049,11 +1091,11 @@ _mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state) } break; default: - goto bad_cap_error; + goto invalid_enum_error; } return; -bad_cap_error: +invalid_enum_error: _mesa_error(ctx, GL_INVALID_ENUM, "%s(cap=%s)", state ? "glEnablei" : "glDisablei", _mesa_lookup_enum_by_nr(cap)); @@ -1103,15 +1145,13 @@ _mesa_IsEnabledIndexed( GLenum cap, GLuint index ) #undef CHECK_EXTENSION #define CHECK_EXTENSION(EXTNAME) \ if (!ctx->Extensions.EXTNAME) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ - return GL_FALSE; \ + goto invalid_enum_error; \ } #undef CHECK_EXTENSION2 #define CHECK_EXTENSION2(EXT1, EXT2) \ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); \ - return GL_FALSE; \ + goto invalid_enum_error; \ } @@ -1280,6 +1320,15 @@ _mesa_IsEnabled( GLenum cap ) } } return GL_FALSE; +#if FEATURE_ES1 + case GL_TEXTURE_GEN_STR_OES: + { + const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx); + if (texUnit) { + return (texUnit->TexGenEnabled & STR_BITS) == STR_BITS ? GL_TRUE : GL_FALSE; + } + } +#endif /* * CLIENT STATE!!! @@ -1493,8 +1542,26 @@ _mesa_IsEnabled( GLenum cap ) CHECK_EXTENSION(ARB_seamless_cube_map); return ctx->Texture.CubeMapSeamless; +#if FEATURE_EXT_transform_feedback + case GL_RASTERIZER_DISCARD: + CHECK_EXTENSION(EXT_transform_feedback); + return ctx->TransformFeedback.RasterDiscard; +#endif + + /* GL 3.1 primitive restart */ + case GL_PRIMITIVE_RESTART: + if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) { + goto invalid_enum_error; + } + return ctx->Array.PrimitiveRestart; + default: - _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); - return GL_FALSE; + goto invalid_enum_error; } + + return GL_FALSE; + +invalid_enum_error: + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); + return GL_FALSE; } diff --git a/mesalib/src/mesa/main/enums.c b/mesalib/src/mesa/main/enums.c index 06d51d4e5..bc18e1b11 100644 --- a/mesalib/src/mesa/main/enums.c +++ b/mesalib/src/mesa/main/enums.c @@ -109,6 +109,7 @@ LONGSTRING static const char enum_string_table[] = "GL_BACK_RIGHT\0" "GL_BGR\0" "GL_BGRA\0" + "GL_BGRA_EXT\0" "GL_BITMAP\0" "GL_BITMAP_TOKEN\0" "GL_BLEND\0" @@ -116,16 +117,23 @@ LONGSTRING static const char enum_string_table[] = "GL_BLEND_COLOR_EXT\0" "GL_BLEND_DST\0" "GL_BLEND_DST_ALPHA\0" + "GL_BLEND_DST_ALPHA_OES\0" "GL_BLEND_DST_RGB\0" + "GL_BLEND_DST_RGB_OES\0" "GL_BLEND_EQUATION\0" "GL_BLEND_EQUATION_ALPHA\0" "GL_BLEND_EQUATION_ALPHA_EXT\0" + "GL_BLEND_EQUATION_ALPHA_OES\0" "GL_BLEND_EQUATION_EXT\0" + "GL_BLEND_EQUATION_OES\0" "GL_BLEND_EQUATION_RGB\0" "GL_BLEND_EQUATION_RGB_EXT\0" + "GL_BLEND_EQUATION_RGB_OES\0" "GL_BLEND_SRC\0" "GL_BLEND_SRC_ALPHA\0" + "GL_BLEND_SRC_ALPHA_OES\0" "GL_BLEND_SRC_RGB\0" + "GL_BLEND_SRC_RGB_OES\0" "GL_BLUE\0" "GL_BLUE_BIAS\0" "GL_BLUE_BITS\0" @@ -140,11 +148,14 @@ LONGSTRING static const char enum_string_table[] = "GL_BOOL_VEC4_ARB\0" "GL_BUFFER_ACCESS\0" "GL_BUFFER_ACCESS_ARB\0" + "GL_BUFFER_ACCESS_OES\0" "GL_BUFFER_FLUSHING_UNMAP_APPLE\0" "GL_BUFFER_MAPPED\0" "GL_BUFFER_MAPPED_ARB\0" + "GL_BUFFER_MAPPED_OES\0" "GL_BUFFER_MAP_POINTER\0" "GL_BUFFER_MAP_POINTER_ARB\0" + "GL_BUFFER_MAP_POINTER_OES\0" "GL_BUFFER_OBJECT_APPLE\0" "GL_BUFFER_SERIALIZED_MODIFY_APPLE\0" "GL_BUFFER_SIZE\0" @@ -194,6 +205,7 @@ LONGSTRING static const char enum_string_table[] = "GL_COLOR_ARRAY_TYPE\0" "GL_COLOR_ATTACHMENT0\0" "GL_COLOR_ATTACHMENT0_EXT\0" + "GL_COLOR_ATTACHMENT0_OES\0" "GL_COLOR_ATTACHMENT1\0" "GL_COLOR_ATTACHMENT10\0" "GL_COLOR_ATTACHMENT10_EXT\0" @@ -336,6 +348,7 @@ LONGSTRING static const char enum_string_table[] = "GL_COORD_REPLACE\0" "GL_COORD_REPLACE_ARB\0" "GL_COORD_REPLACE_NV\0" + "GL_COORD_REPLACE_OES\0" "GL_COPY\0" "GL_COPY_INVERTED\0" "GL_COPY_PIXEL_TOKEN\0" @@ -359,6 +372,7 @@ LONGSTRING static const char enum_string_table[] = "GL_CURRENT_MATRIX_STACK_DEPTH_NV\0" "GL_CURRENT_NORMAL\0" "GL_CURRENT_PALETTE_MATRIX_ARB\0" + "GL_CURRENT_PALETTE_MATRIX_OES\0" "GL_CURRENT_PROGRAM\0" "GL_CURRENT_QUERY\0" "GL_CURRENT_QUERY_ARB\0" @@ -386,8 +400,10 @@ LONGSTRING static const char enum_string_table[] = "GL_DEPTH\0" "GL_DEPTH24_STENCIL8\0" "GL_DEPTH24_STENCIL8_EXT\0" + "GL_DEPTH24_STENCIL8_OES\0" "GL_DEPTH_ATTACHMENT\0" "GL_DEPTH_ATTACHMENT_EXT\0" + "GL_DEPTH_ATTACHMENT_OES\0" "GL_DEPTH_BIAS\0" "GL_DEPTH_BITS\0" "GL_DEPTH_BOUNDS_EXT\0" @@ -399,12 +415,15 @@ LONGSTRING static const char enum_string_table[] = "GL_DEPTH_COMPONENT\0" "GL_DEPTH_COMPONENT16\0" "GL_DEPTH_COMPONENT16_ARB\0" + "GL_DEPTH_COMPONENT16_OES\0" "GL_DEPTH_COMPONENT16_SGIX\0" "GL_DEPTH_COMPONENT24\0" "GL_DEPTH_COMPONENT24_ARB\0" + "GL_DEPTH_COMPONENT24_OES\0" "GL_DEPTH_COMPONENT24_SGIX\0" "GL_DEPTH_COMPONENT32\0" "GL_DEPTH_COMPONENT32_ARB\0" + "GL_DEPTH_COMPONENT32_OES\0" "GL_DEPTH_COMPONENT32_SGIX\0" "GL_DEPTH_FUNC\0" "GL_DEPTH_RANGE\0" @@ -413,6 +432,7 @@ LONGSTRING static const char enum_string_table[] = "GL_DEPTH_STENCIL_ATTACHMENT\0" "GL_DEPTH_STENCIL_EXT\0" "GL_DEPTH_STENCIL_NV\0" + "GL_DEPTH_STENCIL_OES\0" "GL_DEPTH_STENCIL_TO_BGRA_NV\0" "GL_DEPTH_STENCIL_TO_RGBA_NV\0" "GL_DEPTH_TEST\0" @@ -525,6 +545,8 @@ LONGSTRING static const char enum_string_table[] = "GL_FILL\0" "GL_FIRST_VERTEX_CONVENTION\0" "GL_FIRST_VERTEX_CONVENTION_EXT\0" + "GL_FIXED\0" + "GL_FIXED_OES\0" "GL_FLAT\0" "GL_FLOAT\0" "GL_FLOAT_MAT2\0" @@ -577,6 +599,7 @@ LONGSTRING static const char enum_string_table[] = "GL_FRAGMENT_SHADER\0" "GL_FRAGMENT_SHADER_ARB\0" "GL_FRAGMENT_SHADER_DERIVATIVE_HINT\0" + "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES\0" "GL_FRAMEBUFFER\0" "GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE\0" "GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE\0" @@ -584,42 +607,61 @@ LONGSTRING static const char enum_string_table[] = "GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE\0" "GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE\0" "GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE\0" + "GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB\0" "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME\0" "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES\0" "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE\0" "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES\0" "GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE\0" "GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT\0" + "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES\0" "GL_FRAMEBUFFER_BINDING\0" "GL_FRAMEBUFFER_BINDING_EXT\0" + "GL_FRAMEBUFFER_BINDING_OES\0" "GL_FRAMEBUFFER_COMPLETE\0" "GL_FRAMEBUFFER_COMPLETE_EXT\0" + "GL_FRAMEBUFFER_COMPLETE_OES\0" "GL_FRAMEBUFFER_DEFAULT\0" "GL_FRAMEBUFFER_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\0" "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES\0" + "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS\0" "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES\0" "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\0" "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES\0" "GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES\0" + "GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB\0" + "GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB\0" "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\0" "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES\0" "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\0" "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\0" "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES\0" + "GL_FRAMEBUFFER_OES\0" "GL_FRAMEBUFFER_STATUS_ERROR_EXT\0" "GL_FRAMEBUFFER_UNDEFINED\0" "GL_FRAMEBUFFER_UNSUPPORTED\0" "GL_FRAMEBUFFER_UNSUPPORTED_EXT\0" + "GL_FRAMEBUFFER_UNSUPPORTED_OES\0" "GL_FRONT\0" "GL_FRONT_AND_BACK\0" "GL_FRONT_FACE\0" @@ -627,14 +669,21 @@ LONGSTRING static const char enum_string_table[] = "GL_FRONT_RIGHT\0" "GL_FUNC_ADD\0" "GL_FUNC_ADD_EXT\0" + "GL_FUNC_ADD_OES\0" "GL_FUNC_REVERSE_SUBTRACT\0" "GL_FUNC_REVERSE_SUBTRACT_EXT\0" + "GL_FUNC_REVERSE_SUBTRACT_OES\0" "GL_FUNC_SUBTRACT\0" "GL_FUNC_SUBTRACT_EXT\0" + "GL_FUNC_SUBTRACT_OES\0" "GL_GENERATE_MIPMAP\0" "GL_GENERATE_MIPMAP_HINT\0" "GL_GENERATE_MIPMAP_HINT_SGIS\0" "GL_GENERATE_MIPMAP_SGIS\0" + "GL_GEOMETRY_INPUT_TYPE_ARB\0" + "GL_GEOMETRY_OUTPUT_TYPE_ARB\0" + "GL_GEOMETRY_SHADER_ARB\0" + "GL_GEOMETRY_VERTICES_OUT_ARB\0" "GL_GEQUAL\0" "GL_GREATER\0" "GL_GREEN\0" @@ -642,6 +691,9 @@ LONGSTRING static const char enum_string_table[] = "GL_GREEN_BITS\0" "GL_GREEN_SCALE\0" "GL_HALF_FLOAT\0" + "GL_HALF_FLOAT_OES\0" + "GL_HIGH_FLOAT\0" + "GL_HIGH_INT\0" "GL_HINT_BIT\0" "GL_HISTOGRAM\0" "GL_HISTOGRAM_ALPHA_SIZE\0" @@ -663,7 +715,9 @@ LONGSTRING static const char enum_string_table[] = "GL_HISTOGRAM_WIDTH_EXT\0" "GL_IDENTITY_NV\0" "GL_IGNORE_BORDER_HP\0" + "GL_IMPLEMENTATION_COLOR_READ_FORMAT\0" "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES\0" + "GL_IMPLEMENTATION_COLOR_READ_TYPE\0" "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES\0" "GL_INCR\0" "GL_INCR_WRAP\0" @@ -694,9 +748,11 @@ LONGSTRING static const char enum_string_table[] = "GL_INTENSITY8\0" "GL_INTENSITY8_EXT\0" "GL_INTENSITY_EXT\0" + "GL_INTERLEAVED_ATTRIBS_EXT\0" "GL_INTERPOLATE\0" "GL_INTERPOLATE_ARB\0" "GL_INTERPOLATE_EXT\0" + "GL_INT_10_10_10_2_OES\0" "GL_INT_VEC2\0" "GL_INT_VEC2_ARB\0" "GL_INT_VEC3\0" @@ -706,6 +762,7 @@ LONGSTRING static const char enum_string_table[] = "GL_INVALID_ENUM\0" "GL_INVALID_FRAMEBUFFER_OPERATION\0" "GL_INVALID_FRAMEBUFFER_OPERATION_EXT\0" + "GL_INVALID_FRAMEBUFFER_OPERATION_OES\0" "GL_INVALID_OPERATION\0" "GL_INVALID_VALUE\0" "GL_INVERSE_NV\0" @@ -740,6 +797,7 @@ LONGSTRING static const char enum_string_table[] = "GL_LINEAR_MIPMAP_LINEAR\0" "GL_LINEAR_MIPMAP_NEAREST\0" "GL_LINES\0" + "GL_LINES_ADJACENCY_ARB\0" "GL_LINE_BIT\0" "GL_LINE_LOOP\0" "GL_LINE_RESET_TOKEN\0" @@ -749,6 +807,7 @@ LONGSTRING static const char enum_string_table[] = "GL_LINE_STIPPLE_PATTERN\0" "GL_LINE_STIPPLE_REPEAT\0" "GL_LINE_STRIP\0" + "GL_LINE_STRIP_ADJACENCY_ARB\0" "GL_LINE_TOKEN\0" "GL_LINE_WIDTH\0" "GL_LINE_WIDTH_GRANULARITY\0" @@ -762,6 +821,8 @@ LONGSTRING static const char enum_string_table[] = "GL_LOGIC_OP\0" "GL_LOGIC_OP_MODE\0" "GL_LOWER_LEFT\0" + "GL_LOW_FLOAT\0" + "GL_LOW_INT\0" "GL_LUMINANCE\0" "GL_LUMINANCE12\0" "GL_LUMINANCE12_ALPHA12\0" @@ -887,14 +948,22 @@ LONGSTRING static const char enum_string_table[] = "GL_MATRIX8_ARB\0" "GL_MATRIX9_ARB\0" "GL_MATRIX_INDEX_ARRAY_ARB\0" + "GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES\0" + "GL_MATRIX_INDEX_ARRAY_OES\0" "GL_MATRIX_INDEX_ARRAY_POINTER_ARB\0" + "GL_MATRIX_INDEX_ARRAY_POINTER_OES\0" "GL_MATRIX_INDEX_ARRAY_SIZE_ARB\0" + "GL_MATRIX_INDEX_ARRAY_SIZE_OES\0" "GL_MATRIX_INDEX_ARRAY_STRIDE_ARB\0" + "GL_MATRIX_INDEX_ARRAY_STRIDE_OES\0" "GL_MATRIX_INDEX_ARRAY_TYPE_ARB\0" + "GL_MATRIX_INDEX_ARRAY_TYPE_OES\0" "GL_MATRIX_MODE\0" "GL_MATRIX_PALETTE_ARB\0" + "GL_MATRIX_PALETTE_OES\0" "GL_MAX\0" "GL_MAX_3D_TEXTURE_SIZE\0" + "GL_MAX_3D_TEXTURE_SIZE_OES\0" "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT\0" "GL_MAX_ATTRIB_STACK_DEPTH\0" "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH\0" @@ -913,6 +982,7 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_CONVOLUTION_WIDTH_EXT\0" "GL_MAX_CUBE_MAP_TEXTURE_SIZE\0" "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB\0" + "GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES\0" "GL_MAX_DRAW_BUFFERS\0" "GL_MAX_DRAW_BUFFERS_ARB\0" "GL_MAX_DRAW_BUFFERS_ATI\0" @@ -922,12 +992,19 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_EXT\0" "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS\0" "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB\0" + "GL_MAX_FRAGMENT_UNIFORM_VECTORS\0" + "GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB\0" + "GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB\0" + "GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB\0" + "GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB\0" + "GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB\0" "GL_MAX_LIGHTS\0" "GL_MAX_LIST_NESTING\0" "GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB\0" "GL_MAX_MODELVIEW_STACK_DEPTH\0" "GL_MAX_NAME_STACK_DEPTH\0" "GL_MAX_PALETTE_MATRICES_ARB\0" + "GL_MAX_PALETTE_MATRICES_OES\0" "GL_MAX_PIXEL_MAP_TABLE\0" "GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB\0" "GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB\0" @@ -959,6 +1036,7 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV\0" "GL_MAX_RENDERBUFFER_SIZE\0" "GL_MAX_RENDERBUFFER_SIZE_EXT\0" + "GL_MAX_RENDERBUFFER_SIZE_OES\0" "GL_MAX_SAMPLES\0" "GL_MAX_SAMPLES_EXT\0" "GL_MAX_SERVER_WAIT_TIMEOUT\0" @@ -969,6 +1047,7 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_TEXTURE_IMAGE_UNITS\0" "GL_MAX_TEXTURE_IMAGE_UNITS_ARB\0" "GL_MAX_TEXTURE_LOD_BIAS\0" + "GL_MAX_TEXTURE_LOD_BIAS_EXT\0" "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT\0" "GL_MAX_TEXTURE_SIZE\0" "GL_MAX_TEXTURE_STACK_DEPTH\0" @@ -976,16 +1055,26 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_TEXTURE_UNITS_ARB\0" "GL_MAX_TRACK_MATRICES_NV\0" "GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV\0" + "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT\0" + "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT\0" + "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT\0" + "GL_MAX_VARYING_COMPONENTS\0" "GL_MAX_VARYING_FLOATS\0" "GL_MAX_VARYING_FLOATS_ARB\0" + "GL_MAX_VARYING_VECTORS\0" "GL_MAX_VERTEX_ATTRIBS\0" "GL_MAX_VERTEX_ATTRIBS_ARB\0" "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS\0" "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB\0" "GL_MAX_VERTEX_UNIFORM_COMPONENTS\0" "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB\0" + "GL_MAX_VERTEX_UNIFORM_VECTORS\0" "GL_MAX_VERTEX_UNITS_ARB\0" + "GL_MAX_VERTEX_UNITS_OES\0" + "GL_MAX_VERTEX_VARYING_COMPONENTS_ARB\0" "GL_MAX_VIEWPORT_DIMS\0" + "GL_MEDIUM_FLOAT\0" + "GL_MEDIUM_INT\0" "GL_MIN\0" "GL_MINMAX\0" "GL_MINMAX_EXT\0" @@ -1036,6 +1125,7 @@ LONGSTRING static const char enum_string_table[] = "GL_MODELVIEW8_ARB\0" "GL_MODELVIEW9_ARB\0" "GL_MODELVIEW_MATRIX\0" + "GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES\0" "GL_MODELVIEW_PROJECTION_NV\0" "GL_MODELVIEW_STACK_DEPTH\0" "GL_MODULATE\0" @@ -1061,6 +1151,7 @@ LONGSTRING static const char enum_string_table[] = "GL_NEVER\0" "GL_NICEST\0" "GL_NONE\0" + "GL_NONE_OES\0" "GL_NOOP\0" "GL_NOR\0" "GL_NORMALIZE\0" @@ -1073,10 +1164,13 @@ LONGSTRING static const char enum_string_table[] = "GL_NORMAL_MAP\0" "GL_NORMAL_MAP_ARB\0" "GL_NORMAL_MAP_NV\0" + "GL_NORMAL_MAP_OES\0" "GL_NOTEQUAL\0" "GL_NO_ERROR\0" "GL_NUM_COMPRESSED_TEXTURE_FORMATS\0" "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB\0" + "GL_NUM_PROGRAM_BINARY_FORMATS_OES\0" + "GL_NUM_SHADER_BINARY_FORMATS\0" "GL_OBJECT_ACTIVE_ATTRIBUTES_ARB\0" "GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB\0" "GL_OBJECT_ACTIVE_UNIFORMS_ARB\0" @@ -1191,6 +1285,11 @@ LONGSTRING static const char enum_string_table[] = "GL_POINT_FADE_THRESHOLD_SIZE_EXT\0" "GL_POINT_FADE_THRESHOLD_SIZE_SGIS\0" "GL_POINT_SIZE\0" + "GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES\0" + "GL_POINT_SIZE_ARRAY_OES\0" + "GL_POINT_SIZE_ARRAY_POINTER_OES\0" + "GL_POINT_SIZE_ARRAY_STRIDE_OES\0" + "GL_POINT_SIZE_ARRAY_TYPE_OES\0" "GL_POINT_SIZE_GRANULARITY\0" "GL_POINT_SIZE_MAX\0" "GL_POINT_SIZE_MAX_ARB\0" @@ -1207,6 +1306,7 @@ LONGSTRING static const char enum_string_table[] = "GL_POINT_SPRITE_ARB\0" "GL_POINT_SPRITE_COORD_ORIGIN\0" "GL_POINT_SPRITE_NV\0" + "GL_POINT_SPRITE_OES\0" "GL_POINT_SPRITE_R_MODE_NV\0" "GL_POINT_TOKEN\0" "GL_POLYGON\0" @@ -1268,9 +1368,12 @@ LONGSTRING static const char enum_string_table[] = "GL_PRIMARY_COLOR\0" "GL_PRIMARY_COLOR_ARB\0" "GL_PRIMARY_COLOR_EXT\0" + "GL_PRIMITIVES_GENERATED_EXT\0" "GL_PROGRAM_ADDRESS_REGISTERS_ARB\0" "GL_PROGRAM_ALU_INSTRUCTIONS_ARB\0" "GL_PROGRAM_ATTRIBS_ARB\0" + "GL_PROGRAM_BINARY_FORMATS_OES\0" + "GL_PROGRAM_BINARY_LENGTH_OES\0" "GL_PROGRAM_BINDING_ARB\0" "GL_PROGRAM_ERROR_POSITION_ARB\0" "GL_PROGRAM_ERROR_POSITION_NV\0" @@ -1291,6 +1394,7 @@ LONGSTRING static const char enum_string_table[] = "GL_PROGRAM_OBJECT_ARB\0" "GL_PROGRAM_PARAMETERS_ARB\0" "GL_PROGRAM_PARAMETER_NV\0" + "GL_PROGRAM_POINT_SIZE_ARB\0" "GL_PROGRAM_RESIDENT_NV\0" "GL_PROGRAM_STRING_ARB\0" "GL_PROGRAM_STRING_NV\0" @@ -1301,6 +1405,7 @@ LONGSTRING static const char enum_string_table[] = "GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB\0" "GL_PROJECTION\0" "GL_PROJECTION_MATRIX\0" + "GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES\0" "GL_PROJECTION_STACK_DEPTH\0" "GL_PROVOKING_VERTEX\0" "GL_PROVOKING_VERTEX_EXT\0" @@ -1341,6 +1446,7 @@ LONGSTRING static const char enum_string_table[] = "GL_QUERY_WAIT_NV\0" "GL_R\0" "GL_R3_G3_B2\0" + "GL_RASTERIZER_DISCARD_EXT\0" "GL_RASTER_POSITION_UNCLIPPED_IBM\0" "GL_READ_BUFFER\0" "GL_READ_FRAMEBUFFER\0" @@ -1360,26 +1466,38 @@ LONGSTRING static const char enum_string_table[] = "GL_REFLECTION_MAP\0" "GL_REFLECTION_MAP_ARB\0" "GL_REFLECTION_MAP_NV\0" + "GL_REFLECTION_MAP_OES\0" "GL_RELEASED_APPLE\0" "GL_RENDER\0" "GL_RENDERBUFFER\0" "GL_RENDERBUFFER_ALPHA_SIZE\0" + "GL_RENDERBUFFER_ALPHA_SIZE_OES\0" "GL_RENDERBUFFER_BINDING\0" "GL_RENDERBUFFER_BINDING_EXT\0" + "GL_RENDERBUFFER_BINDING_OES\0" "GL_RENDERBUFFER_BLUE_SIZE\0" + "GL_RENDERBUFFER_BLUE_SIZE_OES\0" "GL_RENDERBUFFER_DEPTH_SIZE\0" + "GL_RENDERBUFFER_DEPTH_SIZE_OES\0" "GL_RENDERBUFFER_EXT\0" "GL_RENDERBUFFER_GREEN_SIZE\0" + "GL_RENDERBUFFER_GREEN_SIZE_OES\0" "GL_RENDERBUFFER_HEIGHT\0" "GL_RENDERBUFFER_HEIGHT_EXT\0" + "GL_RENDERBUFFER_HEIGHT_OES\0" "GL_RENDERBUFFER_INTERNAL_FORMAT\0" "GL_RENDERBUFFER_INTERNAL_FORMAT_EXT\0" + "GL_RENDERBUFFER_INTERNAL_FORMAT_OES\0" + "GL_RENDERBUFFER_OES\0" "GL_RENDERBUFFER_RED_SIZE\0" + "GL_RENDERBUFFER_RED_SIZE_OES\0" "GL_RENDERBUFFER_SAMPLES\0" "GL_RENDERBUFFER_SAMPLES_EXT\0" "GL_RENDERBUFFER_STENCIL_SIZE\0" + "GL_RENDERBUFFER_STENCIL_SIZE_OES\0" "GL_RENDERBUFFER_WIDTH\0" "GL_RENDERBUFFER_WIDTH_EXT\0" + "GL_RENDERBUFFER_WIDTH_OES\0" "GL_RENDERER\0" "GL_RENDER_MODE\0" "GL_REPEAT\0" @@ -1404,11 +1522,15 @@ LONGSTRING static const char enum_string_table[] = "GL_RGB4_EXT\0" "GL_RGB4_S3TC\0" "GL_RGB5\0" + "GL_RGB565\0" + "GL_RGB565_OES\0" "GL_RGB5_A1\0" "GL_RGB5_A1_EXT\0" + "GL_RGB5_A1_OES\0" "GL_RGB5_EXT\0" "GL_RGB8\0" "GL_RGB8_EXT\0" + "GL_RGB8_OES\0" "GL_RGBA\0" "GL_RGBA12\0" "GL_RGBA12_EXT\0" @@ -1419,9 +1541,11 @@ LONGSTRING static const char enum_string_table[] = "GL_RGBA4\0" "GL_RGBA4_DXT5_S3TC\0" "GL_RGBA4_EXT\0" + "GL_RGBA4_OES\0" "GL_RGBA4_S3TC\0" "GL_RGBA8\0" "GL_RGBA8_EXT\0" + "GL_RGBA8_OES\0" "GL_RGBA8_SNORM\0" "GL_RGBA_DXT5_S3TC\0" "GL_RGBA_MODE\0" @@ -1438,6 +1562,7 @@ LONGSTRING static const char enum_string_table[] = "GL_SAMPLER_2D\0" "GL_SAMPLER_2D_SHADOW\0" "GL_SAMPLER_3D\0" + "GL_SAMPLER_3D_OES\0" "GL_SAMPLER_CUBE\0" "GL_SAMPLES\0" "GL_SAMPLES_3DFX\0" @@ -1471,9 +1596,12 @@ LONGSTRING static const char enum_string_table[] = "GL_SELECTION_BUFFER_POINTER\0" "GL_SELECTION_BUFFER_SIZE\0" "GL_SEPARABLE_2D\0" + "GL_SEPARATE_ATTRIBS_EXT\0" "GL_SEPARATE_SPECULAR_COLOR\0" "GL_SEPARATE_SPECULAR_COLOR_EXT\0" "GL_SET\0" + "GL_SHADER_BINARY_FORMATS\0" + "GL_SHADER_COMPILER\0" "GL_SHADER_OBJECT_ARB\0" "GL_SHADER_SOURCE_LENGTH\0" "GL_SHADER_TYPE\0" @@ -1546,6 +1674,7 @@ LONGSTRING static const char enum_string_table[] = "GL_STENCIL\0" "GL_STENCIL_ATTACHMENT\0" "GL_STENCIL_ATTACHMENT_EXT\0" + "GL_STENCIL_ATTACHMENT_OES\0" "GL_STENCIL_BACK_FAIL\0" "GL_STENCIL_BACK_FAIL_ATI\0" "GL_STENCIL_BACK_FUNC\0" @@ -1567,10 +1696,13 @@ LONGSTRING static const char enum_string_table[] = "GL_STENCIL_INDEX16\0" "GL_STENCIL_INDEX16_EXT\0" "GL_STENCIL_INDEX1_EXT\0" + "GL_STENCIL_INDEX1_OES\0" "GL_STENCIL_INDEX4\0" "GL_STENCIL_INDEX4_EXT\0" + "GL_STENCIL_INDEX4_OES\0" "GL_STENCIL_INDEX8\0" "GL_STENCIL_INDEX8_EXT\0" + "GL_STENCIL_INDEX8_OES\0" "GL_STENCIL_INDEX_EXT\0" "GL_STENCIL_PASS_DEPTH_FAIL\0" "GL_STENCIL_PASS_DEPTH_PASS\0" @@ -1677,6 +1809,7 @@ LONGSTRING static const char enum_string_table[] = "GL_TEXTURE_2D\0" "GL_TEXTURE_2D_ARRAY_EXT\0" "GL_TEXTURE_3D\0" + "GL_TEXTURE_3D_OES\0" "GL_TEXTURE_ALPHA_SIZE\0" "GL_TEXTURE_ALPHA_SIZE_EXT\0" "GL_TEXTURE_BASE_LEVEL\0" @@ -1685,8 +1818,10 @@ LONGSTRING static const char enum_string_table[] = "GL_TEXTURE_BINDING_2D\0" "GL_TEXTURE_BINDING_2D_ARRAY_EXT\0" "GL_TEXTURE_BINDING_3D\0" + "GL_TEXTURE_BINDING_3D_OES\0" "GL_TEXTURE_BINDING_CUBE_MAP\0" "GL_TEXTURE_BINDING_CUBE_MAP_ARB\0" + "GL_TEXTURE_BINDING_CUBE_MAP_OES\0" "GL_TEXTURE_BINDING_RECTANGLE_ARB\0" "GL_TEXTURE_BINDING_RECTANGLE_NV\0" "GL_TEXTURE_BIT\0" @@ -1724,20 +1859,28 @@ LONGSTRING static const char enum_string_table[] = "GL_TEXTURE_COORD_ARRAY_SIZE\0" "GL_TEXTURE_COORD_ARRAY_STRIDE\0" "GL_TEXTURE_COORD_ARRAY_TYPE\0" + "GL_TEXTURE_CROP_RECT_OES\0" "GL_TEXTURE_CUBE_MAP\0" "GL_TEXTURE_CUBE_MAP_ARB\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_X\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z\0" "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB\0" + "GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES\0" + "GL_TEXTURE_CUBE_MAP_OES\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_X\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_Y\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_Z\0" "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB\0" + "GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES\0" "GL_TEXTURE_CUBE_MAP_SEAMLESS\0" "GL_TEXTURE_DEPTH\0" "GL_TEXTURE_DEPTH_SIZE\0" @@ -1746,10 +1889,13 @@ LONGSTRING static const char enum_string_table[] = "GL_TEXTURE_ENV_COLOR\0" "GL_TEXTURE_ENV_MODE\0" "GL_TEXTURE_FILTER_CONTROL\0" + "GL_TEXTURE_FILTER_CONTROL_EXT\0" "GL_TEXTURE_GEN_MODE\0" + "GL_TEXTURE_GEN_MODE_OES\0" "GL_TEXTURE_GEN_Q\0" "GL_TEXTURE_GEN_R\0" "GL_TEXTURE_GEN_S\0" + "GL_TEXTURE_GEN_STR_OES\0" "GL_TEXTURE_GEN_T\0" "GL_TEXTURE_GEQUAL_R_SGIX\0" "GL_TEXTURE_GREEN_SIZE\0" @@ -1769,6 +1915,7 @@ LONGSTRING static const char enum_string_table[] = "GL_TEXTURE_LUMINANCE_SIZE_EXT\0" "GL_TEXTURE_MAG_FILTER\0" "GL_TEXTURE_MATRIX\0" + "GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES\0" "GL_TEXTURE_MAX_ANISOTROPY_EXT\0" "GL_TEXTURE_MAX_CLAMP_R_SGIX\0" "GL_TEXTURE_MAX_CLAMP_S_SGIX\0" @@ -1793,6 +1940,7 @@ LONGSTRING static const char enum_string_table[] = "GL_TEXTURE_UNSIGNED_REMAP_MODE_NV\0" "GL_TEXTURE_WIDTH\0" "GL_TEXTURE_WRAP_R\0" + "GL_TEXTURE_WRAP_R_OES\0" "GL_TEXTURE_WRAP_S\0" "GL_TEXTURE_WRAP_T\0" "GL_TIMEOUT_EXPIRED\0" @@ -1800,6 +1948,18 @@ LONGSTRING static const char enum_string_table[] = "GL_TRACK_MATRIX_NV\0" "GL_TRACK_MATRIX_TRANSFORM_NV\0" "GL_TRANSFORM_BIT\0" + "GL_TRANSFORM_FEEDBACK\0" + "GL_TRANSFORM_FEEDBACK_BINDING\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_EXT\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT\0" + "GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT\0" + "GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT\0" + "GL_TRANSFORM_FEEDBACK_VARYINGS_EXT\0" + "GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT\0" "GL_TRANSPOSE_COLOR_MATRIX\0" "GL_TRANSPOSE_COLOR_MATRIX_ARB\0" "GL_TRANSPOSE_CURRENT_MATRIX_ARB\0" @@ -1811,9 +1971,11 @@ LONGSTRING static const char enum_string_table[] = "GL_TRANSPOSE_TEXTURE_MATRIX\0" "GL_TRANSPOSE_TEXTURE_MATRIX_ARB\0" "GL_TRIANGLES\0" + "GL_TRIANGLES_ADJACENCY_ARB\0" "GL_TRIANGLE_FAN\0" "GL_TRIANGLE_MESH_SUN\0" "GL_TRIANGLE_STRIP\0" + "GL_TRIANGLE_STRIP_ADJACENCY_ARB\0" "GL_TRUE\0" "GL_UNDEFINED_APPLE\0" "GL_UNPACK_ALIGNMENT\0" @@ -1830,17 +1992,22 @@ LONGSTRING static const char enum_string_table[] = "GL_UNSIGNED_BYTE_3_3_2\0" "GL_UNSIGNED_INT\0" "GL_UNSIGNED_INT_10_10_10_2\0" + "GL_UNSIGNED_INT_10_10_10_2_OES\0" "GL_UNSIGNED_INT_24_8\0" "GL_UNSIGNED_INT_24_8_EXT\0" "GL_UNSIGNED_INT_24_8_NV\0" + "GL_UNSIGNED_INT_24_8_OES\0" "GL_UNSIGNED_INT_2_10_10_10_REV\0" + "GL_UNSIGNED_INT_2_10_10_10_REV_EXT\0" "GL_UNSIGNED_INT_8_8_8_8\0" "GL_UNSIGNED_INT_8_8_8_8_REV\0" "GL_UNSIGNED_NORMALIZED\0" "GL_UNSIGNED_SHORT\0" "GL_UNSIGNED_SHORT_1_5_5_5_REV\0" + "GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT\0" "GL_UNSIGNED_SHORT_4_4_4_4\0" "GL_UNSIGNED_SHORT_4_4_4_4_REV\0" + "GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT\0" "GL_UNSIGNED_SHORT_5_5_5_1\0" "GL_UNSIGNED_SHORT_5_6_5\0" "GL_UNSIGNED_SHORT_5_6_5_REV\0" @@ -1913,14 +2080,21 @@ LONGSTRING static const char enum_string_table[] = "GL_WEIGHT_ARRAY_ARB\0" "GL_WEIGHT_ARRAY_BUFFER_BINDING\0" "GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB\0" + "GL_WEIGHT_ARRAY_BUFFER_BINDING_OES\0" + "GL_WEIGHT_ARRAY_OES\0" "GL_WEIGHT_ARRAY_POINTER_ARB\0" + "GL_WEIGHT_ARRAY_POINTER_OES\0" "GL_WEIGHT_ARRAY_SIZE_ARB\0" + "GL_WEIGHT_ARRAY_SIZE_OES\0" "GL_WEIGHT_ARRAY_STRIDE_ARB\0" + "GL_WEIGHT_ARRAY_STRIDE_OES\0" "GL_WEIGHT_ARRAY_TYPE_ARB\0" + "GL_WEIGHT_ARRAY_TYPE_OES\0" "GL_WEIGHT_SUM_UNITY_ARB\0" "GL_WRAP_BORDER_SUN\0" "GL_WRITE_ONLY\0" "GL_WRITE_ONLY_ARB\0" + "GL_WRITE_ONLY_OES\0" "GL_XOR\0" "GL_YCBCR_422_APPLE\0" "GL_YCBCR_MESA\0" @@ -1929,7 +2103,7 @@ LONGSTRING static const char enum_string_table[] = "GL_ZOOM_Y\0" ; -static const enum_elt all_enums[1891] = +static const enum_elt all_enums[2065] = { { 0, 0x00000600 }, /* GL_2D */ { 6, 0x00001407 }, /* GL_2_BYTES */ @@ -2004,3184 +2178,3424 @@ static const enum_elt all_enums[1891] = { 1175, 0x00000403 }, /* GL_BACK_RIGHT */ { 1189, 0x000080E0 }, /* GL_BGR */ { 1196, 0x000080E1 }, /* GL_BGRA */ - { 1204, 0x00001A00 }, /* GL_BITMAP */ - { 1214, 0x00000704 }, /* GL_BITMAP_TOKEN */ - { 1230, 0x00000BE2 }, /* GL_BLEND */ - { 1239, 0x00008005 }, /* GL_BLEND_COLOR */ - { 1254, 0x00008005 }, /* GL_BLEND_COLOR_EXT */ - { 1273, 0x00000BE0 }, /* GL_BLEND_DST */ - { 1286, 0x000080CA }, /* GL_BLEND_DST_ALPHA */ - { 1305, 0x000080C8 }, /* GL_BLEND_DST_RGB */ - { 1322, 0x00008009 }, /* GL_BLEND_EQUATION */ - { 1340, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA */ - { 1364, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_EXT */ - { 1392, 0x00008009 }, /* GL_BLEND_EQUATION_EXT */ - { 1414, 0x00008009 }, /* GL_BLEND_EQUATION_RGB */ - { 1436, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */ - { 1462, 0x00000BE1 }, /* GL_BLEND_SRC */ - { 1475, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */ - { 1494, 0x000080C9 }, /* GL_BLEND_SRC_RGB */ - { 1511, 0x00001905 }, /* GL_BLUE */ - { 1519, 0x00000D1B }, /* GL_BLUE_BIAS */ - { 1532, 0x00000D54 }, /* GL_BLUE_BITS */ - { 1545, 0x00000D1A }, /* GL_BLUE_SCALE */ - { 1559, 0x00008B56 }, /* GL_BOOL */ - { 1567, 0x00008B56 }, /* GL_BOOL_ARB */ - { 1579, 0x00008B57 }, /* GL_BOOL_VEC2 */ - { 1592, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */ - { 1609, 0x00008B58 }, /* GL_BOOL_VEC3 */ - { 1622, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */ - { 1639, 0x00008B59 }, /* GL_BOOL_VEC4 */ - { 1652, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */ - { 1669, 0x000088BB }, /* GL_BUFFER_ACCESS */ - { 1686, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */ - { 1707, 0x00008A13 }, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ - { 1738, 0x000088BC }, /* GL_BUFFER_MAPPED */ - { 1755, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */ - { 1776, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */ - { 1798, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */ - { 1824, 0x000085B3 }, /* GL_BUFFER_OBJECT_APPLE */ - { 1847, 0x00008A12 }, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ - { 1881, 0x00008764 }, /* GL_BUFFER_SIZE */ - { 1896, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */ - { 1915, 0x00008765 }, /* GL_BUFFER_USAGE */ - { 1931, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */ - { 1951, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */ - { 1970, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */ - { 1996, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */ - { 2019, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ - { 2047, 0x0000877C }, /* GL_BUMP_TARGET_ATI */ - { 2066, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */ - { 2088, 0x00001400 }, /* GL_BYTE */ - { 2096, 0x00002A24 }, /* GL_C3F_V3F */ - { 2107, 0x00002A26 }, /* GL_C4F_N3F_V3F */ - { 2122, 0x00002A22 }, /* GL_C4UB_V2F */ - { 2134, 0x00002A23 }, /* GL_C4UB_V3F */ - { 2146, 0x00000901 }, /* GL_CCW */ - { 2153, 0x00002900 }, /* GL_CLAMP */ - { 2162, 0x0000812D }, /* GL_CLAMP_TO_BORDER */ - { 2181, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */ - { 2204, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */ - { 2228, 0x0000812F }, /* GL_CLAMP_TO_EDGE */ - { 2245, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */ - { 2267, 0x00001500 }, /* GL_CLEAR */ - { 2276, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */ - { 2301, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */ - { 2330, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */ - { 2356, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ - { 2385, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */ - { 2411, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */ - { 2438, 0x00003000 }, /* GL_CLIP_PLANE0 */ - { 2453, 0x00003001 }, /* GL_CLIP_PLANE1 */ - { 2468, 0x00003002 }, /* GL_CLIP_PLANE2 */ - { 2483, 0x00003003 }, /* GL_CLIP_PLANE3 */ - { 2498, 0x00003004 }, /* GL_CLIP_PLANE4 */ - { 2513, 0x00003005 }, /* GL_CLIP_PLANE5 */ - { 2528, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - { 2561, 0x00000A00 }, /* GL_COEFF */ - { 2570, 0x00001800 }, /* GL_COLOR */ - { 2579, 0x00008076 }, /* GL_COLOR_ARRAY */ - { 2594, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - { 2624, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 2658, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */ - { 2681, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */ - { 2701, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */ - { 2723, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */ - { 2743, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */ - { 2764, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */ - { 2789, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */ - { 2810, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */ - { 2832, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */ - { 2858, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */ - { 2880, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */ - { 2906, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */ - { 2928, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */ - { 2954, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */ - { 2976, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */ - { 3002, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */ - { 3024, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */ - { 3050, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */ - { 3072, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */ - { 3098, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */ - { 3123, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */ - { 3144, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */ - { 3169, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */ - { 3190, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */ - { 3215, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */ - { 3236, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */ - { 3261, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */ - { 3282, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */ - { 3307, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */ - { 3328, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */ - { 3353, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */ - { 3374, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */ - { 3399, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */ - { 3420, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */ - { 3445, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */ - { 3466, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */ - { 3491, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */ - { 3511, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */ - { 3532, 0x00001900 }, /* GL_COLOR_INDEX */ - { 3547, 0x00001603 }, /* GL_COLOR_INDEXES */ - { 3564, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */ - { 3582, 0x00000B57 }, /* GL_COLOR_MATERIAL */ - { 3600, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */ - { 3623, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */ - { 3651, 0x000080B1 }, /* GL_COLOR_MATRIX */ - { 3667, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */ - { 3687, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */ - { 3715, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 3747, 0x00008458 }, /* GL_COLOR_SUM */ - { 3760, 0x00008458 }, /* GL_COLOR_SUM_ARB */ - { 3777, 0x000080D0 }, /* GL_COLOR_TABLE */ - { 3792, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */ - { 3818, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */ - { 3848, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */ - { 3878, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */ - { 3898, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */ - { 3922, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */ - { 3947, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */ - { 3976, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */ - { 4005, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */ - { 4027, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */ - { 4053, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */ - { 4079, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */ - { 4105, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */ - { 4135, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */ - { 4165, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */ - { 4195, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */ - { 4229, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */ - { 4263, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ - { 4293, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */ - { 4327, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */ - { 4361, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */ - { 4385, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */ - { 4413, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */ - { 4441, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */ - { 4462, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */ - { 4487, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */ - { 4508, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */ - { 4533, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */ - { 4558, 0x00000C23 }, /* GL_COLOR_WRITEMASK */ - { 4577, 0x00008570 }, /* GL_COMBINE */ - { 4588, 0x00008503 }, /* GL_COMBINE4 */ - { 4600, 0x00008572 }, /* GL_COMBINE_ALPHA */ - { 4617, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */ - { 4638, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */ - { 4659, 0x00008570 }, /* GL_COMBINE_ARB */ - { 4674, 0x00008570 }, /* GL_COMBINE_EXT */ - { 4689, 0x00008571 }, /* GL_COMBINE_RGB */ - { 4704, 0x00008571 }, /* GL_COMBINE_RGB_ARB */ - { 4723, 0x00008571 }, /* GL_COMBINE_RGB_EXT */ - { 4742, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */ - { 4778, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */ - { 4802, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */ - { 4830, 0x00001300 }, /* GL_COMPILE */ - { 4841, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */ - { 4864, 0x00008B81 }, /* GL_COMPILE_STATUS */ - { 4882, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */ - { 4902, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */ - { 4926, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */ - { 4950, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */ - { 4978, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */ - { 5002, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */ - { 5032, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */ - { 5066, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */ - { 5094, 0x000084ED }, /* GL_COMPRESSED_RGB */ - { 5112, 0x000084EE }, /* GL_COMPRESSED_RGBA */ - { 5131, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */ - { 5154, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - { 5183, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ - { 5216, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ - { 5249, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - { 5282, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */ - { 5304, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */ - { 5332, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ - { 5364, 0x00008C4A }, /* GL_COMPRESSED_SLUMINANCE */ - { 5389, 0x00008C4B }, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ - { 5420, 0x00008C48 }, /* GL_COMPRESSED_SRGB */ - { 5439, 0x00008C49 }, /* GL_COMPRESSED_SRGB_ALPHA */ - { 5464, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */ - { 5494, 0x0000911C }, /* GL_CONDITION_SATISFIED */ - { 5517, 0x00008576 }, /* GL_CONSTANT */ - { 5529, 0x00008003 }, /* GL_CONSTANT_ALPHA */ - { 5547, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */ - { 5569, 0x00008576 }, /* GL_CONSTANT_ARB */ - { 5585, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */ - { 5609, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */ - { 5631, 0x00008001 }, /* GL_CONSTANT_COLOR */ - { 5649, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */ - { 5671, 0x00008576 }, /* GL_CONSTANT_EXT */ - { 5687, 0x00008010 }, /* GL_CONVOLUTION_1D */ - { 5705, 0x00008011 }, /* GL_CONVOLUTION_2D */ - { 5723, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */ - { 5751, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */ - { 5782, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */ - { 5809, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */ - { 5840, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */ - { 5867, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */ - { 5898, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */ - { 5926, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */ - { 5958, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */ - { 5980, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */ - { 6006, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */ - { 6028, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */ - { 6054, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */ - { 6075, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */ - { 6100, 0x00008862 }, /* GL_COORD_REPLACE */ - { 6117, 0x00008862 }, /* GL_COORD_REPLACE_ARB */ - { 6138, 0x00008862 }, /* GL_COORD_REPLACE_NV */ - { 6158, 0x00001503 }, /* GL_COPY */ - { 6166, 0x0000150C }, /* GL_COPY_INVERTED */ - { 6183, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */ - { 6203, 0x00008F36 }, /* GL_COPY_READ_BUFFER */ - { 6223, 0x00008F37 }, /* GL_COPY_WRITE_BUFFER */ - { 6244, 0x00000B44 }, /* GL_CULL_FACE */ - { 6257, 0x00000B45 }, /* GL_CULL_FACE_MODE */ - { 6275, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ - { 6294, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - { 6326, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ - { 6361, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ - { 6382, 0x00000001 }, /* GL_CURRENT_BIT */ - { 6397, 0x00000B00 }, /* GL_CURRENT_COLOR */ - { 6414, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ - { 6435, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ - { 6461, 0x00000B01 }, /* GL_CURRENT_INDEX */ - { 6478, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ - { 6500, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ - { 6528, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ - { 6549, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ - { 6583, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ - { 6616, 0x00000B02 }, /* GL_CURRENT_NORMAL */ - { 6634, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - { 6664, 0x00008B8D }, /* GL_CURRENT_PROGRAM */ - { 6683, 0x00008865 }, /* GL_CURRENT_QUERY */ - { 6700, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ - { 6721, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ - { 6745, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ - { 6772, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ - { 6796, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ - { 6823, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ - { 6856, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ - { 6890, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ - { 6923, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ - { 6950, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ - { 6976, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */ - { 7001, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ - { 7030, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ - { 7052, 0x00000900 }, /* GL_CW */ - { 7058, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */ - { 7079, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */ - { 7100, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */ - { 7120, 0x00002101 }, /* GL_DECAL */ - { 7129, 0x00001E03 }, /* GL_DECR */ - { 7137, 0x00008508 }, /* GL_DECR_WRAP */ - { 7150, 0x00008508 }, /* GL_DECR_WRAP_EXT */ - { 7167, 0x00008B80 }, /* GL_DELETE_STATUS */ - { 7184, 0x00001801 }, /* GL_DEPTH */ - { 7193, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */ - { 7213, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */ - { 7237, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ - { 7257, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ - { 7281, 0x00000D1F }, /* GL_DEPTH_BIAS */ - { 7295, 0x00000D56 }, /* GL_DEPTH_BITS */ - { 7309, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ - { 7329, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ - { 7354, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ - { 7374, 0x0000864F }, /* GL_DEPTH_CLAMP */ - { 7389, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ - { 7407, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ - { 7428, 0x00001902 }, /* GL_DEPTH_COMPONENT */ - { 7447, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ - { 7468, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ - { 7493, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ - { 7519, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ - { 7540, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ - { 7565, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ - { 7591, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ - { 7612, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ - { 7637, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ - { 7663, 0x00000B74 }, /* GL_DEPTH_FUNC */ - { 7677, 0x00000B70 }, /* GL_DEPTH_RANGE */ - { 7692, 0x00000D1E }, /* GL_DEPTH_SCALE */ - { 7707, 0x000084F9 }, /* GL_DEPTH_STENCIL */ - { 7724, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ - { 7752, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */ - { 7773, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ - { 7793, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - { 7821, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - { 7849, 0x00000B71 }, /* GL_DEPTH_TEST */ - { 7863, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ - { 7885, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ - { 7911, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ - { 7930, 0x00001201 }, /* GL_DIFFUSE */ - { 7941, 0x00000BD0 }, /* GL_DITHER */ - { 7951, 0x00000A02 }, /* GL_DOMAIN */ - { 7961, 0x00001100 }, /* GL_DONT_CARE */ - { 7974, 0x000086AE }, /* GL_DOT3_RGB */ - { 7986, 0x000086AF }, /* GL_DOT3_RGBA */ - { 7999, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ - { 8016, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ - { 8033, 0x000086AE }, /* GL_DOT3_RGB_ARB */ - { 8049, 0x00008740 }, /* GL_DOT3_RGB_EXT */ - { 8065, 0x0000140A }, /* GL_DOUBLE */ - { 8075, 0x00000C32 }, /* GL_DOUBLEBUFFER */ - { 8091, 0x00000C01 }, /* GL_DRAW_BUFFER */ - { 8106, 0x00008825 }, /* GL_DRAW_BUFFER0 */ - { 8122, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ - { 8142, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ - { 8162, 0x00008826 }, /* GL_DRAW_BUFFER1 */ - { 8178, 0x0000882F }, /* GL_DRAW_BUFFER10 */ - { 8195, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ - { 8216, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ - { 8237, 0x00008830 }, /* GL_DRAW_BUFFER11 */ - { 8254, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ - { 8275, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ - { 8296, 0x00008831 }, /* GL_DRAW_BUFFER12 */ - { 8313, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ - { 8334, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ - { 8355, 0x00008832 }, /* GL_DRAW_BUFFER13 */ - { 8372, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ - { 8393, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ - { 8414, 0x00008833 }, /* GL_DRAW_BUFFER14 */ - { 8431, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ - { 8452, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ - { 8473, 0x00008834 }, /* GL_DRAW_BUFFER15 */ - { 8490, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ - { 8511, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ - { 8532, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ - { 8552, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ - { 8572, 0x00008827 }, /* GL_DRAW_BUFFER2 */ - { 8588, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ - { 8608, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ - { 8628, 0x00008828 }, /* GL_DRAW_BUFFER3 */ - { 8644, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ - { 8664, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ - { 8684, 0x00008829 }, /* GL_DRAW_BUFFER4 */ - { 8700, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ - { 8720, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ - { 8740, 0x0000882A }, /* GL_DRAW_BUFFER5 */ - { 8756, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ - { 8776, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ - { 8796, 0x0000882B }, /* GL_DRAW_BUFFER6 */ - { 8812, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ - { 8832, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ - { 8852, 0x0000882C }, /* GL_DRAW_BUFFER7 */ - { 8868, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ - { 8888, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ - { 8908, 0x0000882D }, /* GL_DRAW_BUFFER8 */ - { 8924, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ - { 8944, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ - { 8964, 0x0000882E }, /* GL_DRAW_BUFFER9 */ - { 8980, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ - { 9000, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ - { 9020, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ - { 9040, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */ - { 9068, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - { 9100, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ - { 9124, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ - { 9144, 0x00000304 }, /* GL_DST_ALPHA */ - { 9157, 0x00000306 }, /* GL_DST_COLOR */ - { 9170, 0x0000877A }, /* GL_DU8DV8_ATI */ - { 9184, 0x00008779 }, /* GL_DUDV_ATI */ - { 9196, 0x000088EA }, /* GL_DYNAMIC_COPY */ - { 9212, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ - { 9232, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ - { 9248, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ - { 9268, 0x000088E9 }, /* GL_DYNAMIC_READ */ - { 9284, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ - { 9304, 0x00000B43 }, /* GL_EDGE_FLAG */ - { 9317, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ - { 9336, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - { 9370, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ - { 9408, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ - { 9435, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - { 9461, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ - { 9485, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - { 9517, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ - { 9553, 0x00001600 }, /* GL_EMISSION */ - { 9565, 0x00002000 }, /* GL_ENABLE_BIT */ - { 9579, 0x00000202 }, /* GL_EQUAL */ - { 9588, 0x00001509 }, /* GL_EQUIV */ - { 9597, 0x00010000 }, /* GL_EVAL_BIT */ - { 9609, 0x00000800 }, /* GL_EXP */ - { 9616, 0x00000801 }, /* GL_EXP2 */ - { 9624, 0x00001F03 }, /* GL_EXTENSIONS */ - { 9638, 0x00002400 }, /* GL_EYE_LINEAR */ - { 9652, 0x00002502 }, /* GL_EYE_PLANE */ - { 9665, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ - { 9690, 0x0000855B }, /* GL_EYE_RADIAL_NV */ - { 9707, 0x00000000 }, /* GL_FALSE */ - { 9716, 0x00001101 }, /* GL_FASTEST */ - { 9727, 0x00001C01 }, /* GL_FEEDBACK */ - { 9739, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ - { 9766, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ - { 9790, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ - { 9814, 0x00001B02 }, /* GL_FILL */ - { 9822, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */ - { 9849, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */ - { 9880, 0x00001D00 }, /* GL_FLAT */ - { 9888, 0x00001406 }, /* GL_FLOAT */ - { 9897, 0x00008B5A }, /* GL_FLOAT_MAT2 */ - { 9911, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ - { 9929, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ - { 9945, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ - { 9961, 0x00008B5B }, /* GL_FLOAT_MAT3 */ - { 9975, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ - { 9993, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ - { 10009, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ - { 10025, 0x00008B5C }, /* GL_FLOAT_MAT4 */ - { 10039, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ - { 10057, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ - { 10073, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ - { 10089, 0x00008B50 }, /* GL_FLOAT_VEC2 */ - { 10103, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ - { 10121, 0x00008B51 }, /* GL_FLOAT_VEC3 */ - { 10135, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ - { 10153, 0x00008B52 }, /* GL_FLOAT_VEC4 */ - { 10167, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ - { 10185, 0x00000B60 }, /* GL_FOG */ - { 10192, 0x00000080 }, /* GL_FOG_BIT */ - { 10203, 0x00000B66 }, /* GL_FOG_COLOR */ - { 10216, 0x00008451 }, /* GL_FOG_COORD */ - { 10229, 0x00008451 }, /* GL_FOG_COORDINATE */ - { 10247, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ - { 10271, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - { 10310, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ - { 10353, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - { 10385, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - { 10416, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - { 10445, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ - { 10470, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ - { 10489, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ - { 10523, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ - { 10550, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ - { 10576, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ - { 10600, 0x00008450 }, /* GL_FOG_COORD_SRC */ - { 10617, 0x00000B62 }, /* GL_FOG_DENSITY */ - { 10632, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ - { 10656, 0x00000B64 }, /* GL_FOG_END */ - { 10667, 0x00000C54 }, /* GL_FOG_HINT */ - { 10679, 0x00000B61 }, /* GL_FOG_INDEX */ - { 10692, 0x00000B65 }, /* GL_FOG_MODE */ - { 10704, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ - { 10723, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ - { 10748, 0x00000B63 }, /* GL_FOG_START */ - { 10761, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ - { 10779, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ - { 10803, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ - { 10822, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ - { 10845, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - { 10880, 0x00008D40 }, /* GL_FRAMEBUFFER */ - { 10895, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - { 10932, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - { 10968, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - { 11009, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - { 11050, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - { 11087, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - { 11124, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - { 11162, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ - { 11204, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - { 11242, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ - { 11284, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - { 11319, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - { 11358, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ - { 11407, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - { 11455, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ - { 11507, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - { 11547, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ - { 11591, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - { 11631, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ - { 11675, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */ - { 11698, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ - { 11725, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ - { 11749, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ - { 11777, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ - { 11800, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ - { 11819, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - { 11856, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ - { 11897, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - { 11938, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ - { 11976, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - { 12018, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - { 12069, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - { 12107, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - { 12152, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ - { 12201, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - { 12239, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */ - { 12281, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ - { 12319, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - { 12361, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - { 12393, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ - { 12418, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ - { 12445, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ - { 12476, 0x00000404 }, /* GL_FRONT */ - { 12485, 0x00000408 }, /* GL_FRONT_AND_BACK */ - { 12503, 0x00000B46 }, /* GL_FRONT_FACE */ - { 12517, 0x00000400 }, /* GL_FRONT_LEFT */ - { 12531, 0x00000401 }, /* GL_FRONT_RIGHT */ - { 12546, 0x00008006 }, /* GL_FUNC_ADD */ - { 12558, 0x00008006 }, /* GL_FUNC_ADD_EXT */ - { 12574, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ - { 12599, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ - { 12628, 0x0000800A }, /* GL_FUNC_SUBTRACT */ - { 12645, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ - { 12666, 0x00008191 }, /* GL_GENERATE_MIPMAP */ - { 12685, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ - { 12709, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ - { 12738, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ - { 12762, 0x00000206 }, /* GL_GEQUAL */ - { 12772, 0x00000204 }, /* GL_GREATER */ - { 12783, 0x00001904 }, /* GL_GREEN */ - { 12792, 0x00000D19 }, /* GL_GREEN_BIAS */ - { 12806, 0x00000D53 }, /* GL_GREEN_BITS */ - { 12820, 0x00000D18 }, /* GL_GREEN_SCALE */ - { 12835, 0x0000140B }, /* GL_HALF_FLOAT */ - { 12849, 0x00008000 }, /* GL_HINT_BIT */ - { 12861, 0x00008024 }, /* GL_HISTOGRAM */ - { 12874, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ - { 12898, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ - { 12926, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ - { 12949, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ - { 12976, 0x00008024 }, /* GL_HISTOGRAM_EXT */ - { 12993, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ - { 13013, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ - { 13037, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ - { 13061, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ - { 13089, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - { 13117, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ - { 13149, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ - { 13171, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ - { 13197, 0x0000802D }, /* GL_HISTOGRAM_SINK */ - { 13215, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ - { 13237, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ - { 13256, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ - { 13279, 0x0000862A }, /* GL_IDENTITY_NV */ - { 13294, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ - { 13314, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - { 13354, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - { 13392, 0x00001E02 }, /* GL_INCR */ - { 13400, 0x00008507 }, /* GL_INCR_WRAP */ - { 13413, 0x00008507 }, /* GL_INCR_WRAP_EXT */ - { 13430, 0x00008222 }, /* GL_INDEX */ - { 13439, 0x00008077 }, /* GL_INDEX_ARRAY */ - { 13454, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - { 13484, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ - { 13518, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ - { 13541, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ - { 13563, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ - { 13583, 0x00000D51 }, /* GL_INDEX_BITS */ - { 13597, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ - { 13618, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ - { 13636, 0x00000C30 }, /* GL_INDEX_MODE */ - { 13650, 0x00000D13 }, /* GL_INDEX_OFFSET */ - { 13666, 0x00000D12 }, /* GL_INDEX_SHIFT */ - { 13681, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ - { 13700, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ - { 13719, 0x00001404 }, /* GL_INT */ - { 13726, 0x00008049 }, /* GL_INTENSITY */ - { 13739, 0x0000804C }, /* GL_INTENSITY12 */ - { 13754, 0x0000804C }, /* GL_INTENSITY12_EXT */ - { 13773, 0x0000804D }, /* GL_INTENSITY16 */ - { 13788, 0x0000804D }, /* GL_INTENSITY16_EXT */ - { 13807, 0x0000804A }, /* GL_INTENSITY4 */ - { 13821, 0x0000804A }, /* GL_INTENSITY4_EXT */ - { 13839, 0x0000804B }, /* GL_INTENSITY8 */ - { 13853, 0x0000804B }, /* GL_INTENSITY8_EXT */ - { 13871, 0x00008049 }, /* GL_INTENSITY_EXT */ - { 13888, 0x00008575 }, /* GL_INTERPOLATE */ - { 13903, 0x00008575 }, /* GL_INTERPOLATE_ARB */ - { 13922, 0x00008575 }, /* GL_INTERPOLATE_EXT */ - { 13941, 0x00008B53 }, /* GL_INT_VEC2 */ - { 13953, 0x00008B53 }, /* GL_INT_VEC2_ARB */ - { 13969, 0x00008B54 }, /* GL_INT_VEC3 */ - { 13981, 0x00008B54 }, /* GL_INT_VEC3_ARB */ - { 13997, 0x00008B55 }, /* GL_INT_VEC4 */ - { 14009, 0x00008B55 }, /* GL_INT_VEC4_ARB */ - { 14025, 0x00000500 }, /* GL_INVALID_ENUM */ - { 14041, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ - { 14074, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ - { 14111, 0x00000502 }, /* GL_INVALID_OPERATION */ - { 14132, 0x00000501 }, /* GL_INVALID_VALUE */ - { 14149, 0x0000862B }, /* GL_INVERSE_NV */ - { 14163, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ - { 14187, 0x0000150A }, /* GL_INVERT */ - { 14197, 0x00001E00 }, /* GL_KEEP */ - { 14205, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */ - { 14231, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */ - { 14261, 0x00000406 }, /* GL_LEFT */ - { 14269, 0x00000203 }, /* GL_LEQUAL */ - { 14279, 0x00000201 }, /* GL_LESS */ - { 14287, 0x00004000 }, /* GL_LIGHT0 */ - { 14297, 0x00004001 }, /* GL_LIGHT1 */ - { 14307, 0x00004002 }, /* GL_LIGHT2 */ - { 14317, 0x00004003 }, /* GL_LIGHT3 */ - { 14327, 0x00004004 }, /* GL_LIGHT4 */ - { 14337, 0x00004005 }, /* GL_LIGHT5 */ - { 14347, 0x00004006 }, /* GL_LIGHT6 */ - { 14357, 0x00004007 }, /* GL_LIGHT7 */ - { 14367, 0x00000B50 }, /* GL_LIGHTING */ - { 14379, 0x00000040 }, /* GL_LIGHTING_BIT */ - { 14395, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ - { 14418, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - { 14447, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ - { 14480, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - { 14508, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ - { 14532, 0x00001B01 }, /* GL_LINE */ - { 14540, 0x00002601 }, /* GL_LINEAR */ - { 14550, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ - { 14572, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - { 14602, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - { 14633, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ - { 14657, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ - { 14682, 0x00000001 }, /* GL_LINES */ - { 14691, 0x00000004 }, /* GL_LINE_BIT */ - { 14703, 0x00000002 }, /* GL_LINE_LOOP */ - { 14716, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ - { 14736, 0x00000B20 }, /* GL_LINE_SMOOTH */ - { 14751, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ - { 14771, 0x00000B24 }, /* GL_LINE_STIPPLE */ - { 14787, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ - { 14811, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ - { 14834, 0x00000003 }, /* GL_LINE_STRIP */ - { 14848, 0x00000702 }, /* GL_LINE_TOKEN */ - { 14862, 0x00000B21 }, /* GL_LINE_WIDTH */ - { 14876, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ - { 14902, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ - { 14922, 0x00008B82 }, /* GL_LINK_STATUS */ - { 14937, 0x00000B32 }, /* GL_LIST_BASE */ - { 14950, 0x00020000 }, /* GL_LIST_BIT */ - { 14962, 0x00000B33 }, /* GL_LIST_INDEX */ - { 14976, 0x00000B30 }, /* GL_LIST_MODE */ - { 14989, 0x00000101 }, /* GL_LOAD */ - { 14997, 0x00000BF1 }, /* GL_LOGIC_OP */ - { 15009, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ - { 15026, 0x00008CA1 }, /* GL_LOWER_LEFT */ - { 15040, 0x00001909 }, /* GL_LUMINANCE */ - { 15053, 0x00008041 }, /* GL_LUMINANCE12 */ - { 15068, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ - { 15091, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ - { 15118, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ - { 15140, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ - { 15166, 0x00008041 }, /* GL_LUMINANCE12_EXT */ - { 15185, 0x00008042 }, /* GL_LUMINANCE16 */ - { 15200, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ - { 15223, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ - { 15250, 0x00008042 }, /* GL_LUMINANCE16_EXT */ - { 15269, 0x0000803F }, /* GL_LUMINANCE4 */ - { 15283, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ - { 15304, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ - { 15329, 0x0000803F }, /* GL_LUMINANCE4_EXT */ - { 15347, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ - { 15368, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ - { 15393, 0x00008040 }, /* GL_LUMINANCE8 */ - { 15407, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ - { 15428, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ - { 15453, 0x00008040 }, /* GL_LUMINANCE8_EXT */ - { 15471, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ - { 15490, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ - { 15506, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ - { 15526, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ - { 15548, 0x00000D91 }, /* GL_MAP1_INDEX */ - { 15562, 0x00000D92 }, /* GL_MAP1_NORMAL */ - { 15577, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ - { 15601, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ - { 15625, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ - { 15649, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ - { 15673, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ - { 15690, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ - { 15707, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - { 15735, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - { 15764, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - { 15793, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - { 15822, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - { 15851, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - { 15880, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - { 15909, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - { 15937, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - { 15965, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - { 15993, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - { 16021, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - { 16049, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - { 16077, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - { 16105, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - { 16133, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - { 16161, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ - { 16177, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ - { 16197, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ - { 16219, 0x00000DB1 }, /* GL_MAP2_INDEX */ - { 16233, 0x00000DB2 }, /* GL_MAP2_NORMAL */ - { 16248, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ - { 16272, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ - { 16296, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ - { 16320, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ - { 16344, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ - { 16361, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ - { 16378, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - { 16406, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - { 16435, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - { 16464, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - { 16493, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - { 16522, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - { 16551, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - { 16580, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - { 16608, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - { 16636, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - { 16664, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - { 16692, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - { 16720, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - { 16748, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ - { 16776, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - { 16804, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - { 16832, 0x00000D10 }, /* GL_MAP_COLOR */ - { 16845, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */ - { 16871, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */ - { 16900, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */ - { 16928, 0x00000001 }, /* GL_MAP_READ_BIT */ - { 16944, 0x00000D11 }, /* GL_MAP_STENCIL */ - { 16959, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */ - { 16985, 0x00000002 }, /* GL_MAP_WRITE_BIT */ - { 17002, 0x000088C0 }, /* GL_MATRIX0_ARB */ - { 17017, 0x00008630 }, /* GL_MATRIX0_NV */ - { 17031, 0x000088CA }, /* GL_MATRIX10_ARB */ - { 17047, 0x000088CB }, /* GL_MATRIX11_ARB */ - { 17063, 0x000088CC }, /* GL_MATRIX12_ARB */ - { 17079, 0x000088CD }, /* GL_MATRIX13_ARB */ - { 17095, 0x000088CE }, /* GL_MATRIX14_ARB */ - { 17111, 0x000088CF }, /* GL_MATRIX15_ARB */ - { 17127, 0x000088D0 }, /* GL_MATRIX16_ARB */ - { 17143, 0x000088D1 }, /* GL_MATRIX17_ARB */ - { 17159, 0x000088D2 }, /* GL_MATRIX18_ARB */ - { 17175, 0x000088D3 }, /* GL_MATRIX19_ARB */ - { 17191, 0x000088C1 }, /* GL_MATRIX1_ARB */ - { 17206, 0x00008631 }, /* GL_MATRIX1_NV */ - { 17220, 0x000088D4 }, /* GL_MATRIX20_ARB */ - { 17236, 0x000088D5 }, /* GL_MATRIX21_ARB */ - { 17252, 0x000088D6 }, /* GL_MATRIX22_ARB */ - { 17268, 0x000088D7 }, /* GL_MATRIX23_ARB */ - { 17284, 0x000088D8 }, /* GL_MATRIX24_ARB */ - { 17300, 0x000088D9 }, /* GL_MATRIX25_ARB */ - { 17316, 0x000088DA }, /* GL_MATRIX26_ARB */ - { 17332, 0x000088DB }, /* GL_MATRIX27_ARB */ - { 17348, 0x000088DC }, /* GL_MATRIX28_ARB */ - { 17364, 0x000088DD }, /* GL_MATRIX29_ARB */ - { 17380, 0x000088C2 }, /* GL_MATRIX2_ARB */ - { 17395, 0x00008632 }, /* GL_MATRIX2_NV */ - { 17409, 0x000088DE }, /* GL_MATRIX30_ARB */ - { 17425, 0x000088DF }, /* GL_MATRIX31_ARB */ - { 17441, 0x000088C3 }, /* GL_MATRIX3_ARB */ - { 17456, 0x00008633 }, /* GL_MATRIX3_NV */ - { 17470, 0x000088C4 }, /* GL_MATRIX4_ARB */ - { 17485, 0x00008634 }, /* GL_MATRIX4_NV */ - { 17499, 0x000088C5 }, /* GL_MATRIX5_ARB */ - { 17514, 0x00008635 }, /* GL_MATRIX5_NV */ - { 17528, 0x000088C6 }, /* GL_MATRIX6_ARB */ - { 17543, 0x00008636 }, /* GL_MATRIX6_NV */ - { 17557, 0x000088C7 }, /* GL_MATRIX7_ARB */ - { 17572, 0x00008637 }, /* GL_MATRIX7_NV */ - { 17586, 0x000088C8 }, /* GL_MATRIX8_ARB */ - { 17601, 0x000088C9 }, /* GL_MATRIX9_ARB */ - { 17616, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ - { 17642, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - { 17676, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - { 17707, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - { 17740, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - { 17771, 0x00000BA0 }, /* GL_MATRIX_MODE */ - { 17786, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ - { 17808, 0x00008008 }, /* GL_MAX */ - { 17815, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ - { 17838, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - { 17870, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ - { 17896, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - { 17929, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - { 17955, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 17989, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ - { 18008, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */ - { 18033, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ - { 18062, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - { 18094, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 18130, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - { 18166, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ - { 18206, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ - { 18232, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ - { 18262, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ - { 18287, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ - { 18316, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - { 18345, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ - { 18378, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ - { 18398, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ - { 18422, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ - { 18446, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ - { 18470, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ - { 18495, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ - { 18513, 0x00008008 }, /* GL_MAX_EXT */ - { 18524, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - { 18559, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ - { 18598, 0x00000D31 }, /* GL_MAX_LIGHTS */ - { 18612, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ - { 18632, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - { 18670, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - { 18699, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ - { 18723, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ - { 18751, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ - { 18774, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 18811, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 18847, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - { 18874, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - { 18903, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - { 18937, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - { 18973, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - { 19000, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - { 19032, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - { 19068, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - { 19097, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - { 19126, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ - { 19154, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - { 19192, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 19236, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 19279, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 19313, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 19352, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 19389, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 19427, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 19470, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 19513, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - { 19543, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - { 19574, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 19610, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 19646, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ - { 19676, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - { 19710, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ - { 19743, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */ - { 19768, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ - { 19797, 0x00008D57 }, /* GL_MAX_SAMPLES */ - { 19812, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */ - { 19831, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */ - { 19858, 0x00008504 }, /* GL_MAX_SHININESS_NV */ - { 19878, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ - { 19902, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ - { 19924, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ - { 19950, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - { 19977, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ - { 20008, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ - { 20032, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - { 20066, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ - { 20086, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ - { 20113, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ - { 20134, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ - { 20159, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ - { 20184, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ - { 20219, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ - { 20241, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ - { 20267, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ - { 20289, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ - { 20315, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - { 20349, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ - { 20387, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - { 20420, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ - { 20457, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ - { 20481, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ - { 20502, 0x00008007 }, /* GL_MIN */ - { 20509, 0x0000802E }, /* GL_MINMAX */ - { 20519, 0x0000802E }, /* GL_MINMAX_EXT */ - { 20533, 0x0000802F }, /* GL_MINMAX_FORMAT */ - { 20550, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ - { 20571, 0x00008030 }, /* GL_MINMAX_SINK */ - { 20586, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ - { 20605, 0x00008007 }, /* GL_MIN_EXT */ - { 20616, 0x00008370 }, /* GL_MIRRORED_REPEAT */ - { 20635, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ - { 20658, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ - { 20681, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ - { 20701, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ - { 20721, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - { 20751, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ - { 20779, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - { 20807, 0x00001700 }, /* GL_MODELVIEW */ - { 20820, 0x00001700 }, /* GL_MODELVIEW0_ARB */ - { 20838, 0x0000872A }, /* GL_MODELVIEW10_ARB */ - { 20857, 0x0000872B }, /* GL_MODELVIEW11_ARB */ - { 20876, 0x0000872C }, /* GL_MODELVIEW12_ARB */ - { 20895, 0x0000872D }, /* GL_MODELVIEW13_ARB */ - { 20914, 0x0000872E }, /* GL_MODELVIEW14_ARB */ - { 20933, 0x0000872F }, /* GL_MODELVIEW15_ARB */ - { 20952, 0x00008730 }, /* GL_MODELVIEW16_ARB */ - { 20971, 0x00008731 }, /* GL_MODELVIEW17_ARB */ - { 20990, 0x00008732 }, /* GL_MODELVIEW18_ARB */ - { 21009, 0x00008733 }, /* GL_MODELVIEW19_ARB */ - { 21028, 0x0000850A }, /* GL_MODELVIEW1_ARB */ - { 21046, 0x00008734 }, /* GL_MODELVIEW20_ARB */ - { 21065, 0x00008735 }, /* GL_MODELVIEW21_ARB */ - { 21084, 0x00008736 }, /* GL_MODELVIEW22_ARB */ - { 21103, 0x00008737 }, /* GL_MODELVIEW23_ARB */ - { 21122, 0x00008738 }, /* GL_MODELVIEW24_ARB */ - { 21141, 0x00008739 }, /* GL_MODELVIEW25_ARB */ - { 21160, 0x0000873A }, /* GL_MODELVIEW26_ARB */ - { 21179, 0x0000873B }, /* GL_MODELVIEW27_ARB */ - { 21198, 0x0000873C }, /* GL_MODELVIEW28_ARB */ - { 21217, 0x0000873D }, /* GL_MODELVIEW29_ARB */ - { 21236, 0x00008722 }, /* GL_MODELVIEW2_ARB */ - { 21254, 0x0000873E }, /* GL_MODELVIEW30_ARB */ - { 21273, 0x0000873F }, /* GL_MODELVIEW31_ARB */ - { 21292, 0x00008723 }, /* GL_MODELVIEW3_ARB */ - { 21310, 0x00008724 }, /* GL_MODELVIEW4_ARB */ - { 21328, 0x00008725 }, /* GL_MODELVIEW5_ARB */ - { 21346, 0x00008726 }, /* GL_MODELVIEW6_ARB */ - { 21364, 0x00008727 }, /* GL_MODELVIEW7_ARB */ - { 21382, 0x00008728 }, /* GL_MODELVIEW8_ARB */ - { 21400, 0x00008729 }, /* GL_MODELVIEW9_ARB */ - { 21418, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ - { 21438, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ - { 21465, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ - { 21490, 0x00002100 }, /* GL_MODULATE */ - { 21502, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ - { 21522, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ - { 21549, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ - { 21574, 0x00000103 }, /* GL_MULT */ - { 21582, 0x0000809D }, /* GL_MULTISAMPLE */ - { 21597, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ - { 21617, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ - { 21636, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ - { 21655, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ - { 21679, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ - { 21702, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - { 21732, 0x00002A25 }, /* GL_N3F_V3F */ - { 21743, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ - { 21763, 0x0000150E }, /* GL_NAND */ - { 21771, 0x00002600 }, /* GL_NEAREST */ - { 21782, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - { 21813, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - { 21845, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ - { 21870, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ - { 21896, 0x00000200 }, /* GL_NEVER */ - { 21905, 0x00001102 }, /* GL_NICEST */ - { 21915, 0x00000000 }, /* GL_NONE */ - { 21923, 0x00001505 }, /* GL_NOOP */ - { 21931, 0x00001508 }, /* GL_NOR */ - { 21938, 0x00000BA1 }, /* GL_NORMALIZE */ - { 21951, 0x00008075 }, /* GL_NORMAL_ARRAY */ - { 21967, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - { 21998, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ - { 22033, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ - { 22057, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ - { 22080, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ - { 22101, 0x00008511 }, /* GL_NORMAL_MAP */ - { 22115, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ - { 22133, 0x00008511 }, /* GL_NORMAL_MAP_NV */ - { 22150, 0x00000205 }, /* GL_NOTEQUAL */ - { 22162, 0x00000000 }, /* GL_NO_ERROR */ - { 22174, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - { 22208, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ - { 22246, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ - { 22278, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ - { 22320, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ - { 22350, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ - { 22390, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ - { 22421, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ - { 22450, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ - { 22478, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ - { 22508, 0x00002401 }, /* GL_OBJECT_LINEAR */ - { 22525, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ - { 22551, 0x00002501 }, /* GL_OBJECT_PLANE */ - { 22567, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ - { 22602, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ - { 22624, 0x00009112 }, /* GL_OBJECT_TYPE */ - { 22639, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ - { 22658, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ - { 22688, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ - { 22709, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ - { 22737, 0x00000001 }, /* GL_ONE */ - { 22744, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ - { 22772, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ - { 22804, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ - { 22832, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ - { 22864, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ - { 22887, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ - { 22910, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ - { 22933, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ - { 22956, 0x00008598 }, /* GL_OPERAND0_ALPHA */ - { 22974, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ - { 22996, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ - { 23018, 0x00008590 }, /* GL_OPERAND0_RGB */ - { 23034, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ - { 23054, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ - { 23074, 0x00008599 }, /* GL_OPERAND1_ALPHA */ - { 23092, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ - { 23114, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ - { 23136, 0x00008591 }, /* GL_OPERAND1_RGB */ - { 23152, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ - { 23172, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ - { 23192, 0x0000859A }, /* GL_OPERAND2_ALPHA */ - { 23210, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ - { 23232, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ - { 23254, 0x00008592 }, /* GL_OPERAND2_RGB */ - { 23270, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ - { 23290, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ - { 23310, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ - { 23331, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ - { 23350, 0x00001507 }, /* GL_OR */ - { 23356, 0x00000A01 }, /* GL_ORDER */ - { 23365, 0x0000150D }, /* GL_OR_INVERTED */ - { 23380, 0x0000150B }, /* GL_OR_REVERSE */ - { 23394, 0x00000505 }, /* GL_OUT_OF_MEMORY */ - { 23411, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ - { 23429, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ - { 23450, 0x00008758 }, /* GL_PACK_INVERT_MESA */ - { 23470, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ - { 23488, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ - { 23507, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ - { 23527, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ - { 23547, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ - { 23565, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ - { 23584, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ - { 23609, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ - { 23633, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ - { 23654, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ - { 23676, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ - { 23698, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ - { 23723, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ - { 23747, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ - { 23768, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ - { 23790, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ - { 23812, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ - { 23834, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ - { 23865, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ - { 23885, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - { 23910, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ - { 23930, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - { 23955, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ - { 23975, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - { 24000, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ - { 24020, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - { 24045, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ - { 24065, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - { 24090, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ - { 24110, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - { 24135, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ - { 24155, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - { 24180, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ - { 24200, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - { 24225, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ - { 24245, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - { 24270, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ - { 24290, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - { 24315, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ - { 24333, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ - { 24354, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ - { 24383, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ - { 24416, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ - { 24441, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ - { 24464, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ - { 24495, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ - { 24530, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ - { 24557, 0x00001B00 }, /* GL_POINT */ - { 24566, 0x00000000 }, /* GL_POINTS */ - { 24576, 0x00000002 }, /* GL_POINT_BIT */ - { 24589, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ - { 24619, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ - { 24653, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ - { 24687, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ - { 24722, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ - { 24751, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ - { 24784, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ - { 24817, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ - { 24851, 0x00000B11 }, /* GL_POINT_SIZE */ - { 24865, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ - { 24891, 0x00008127 }, /* GL_POINT_SIZE_MAX */ - { 24909, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ - { 24931, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ - { 24953, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ - { 24976, 0x00008126 }, /* GL_POINT_SIZE_MIN */ - { 24994, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ - { 25016, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ - { 25038, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ - { 25061, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ - { 25081, 0x00000B10 }, /* GL_POINT_SMOOTH */ - { 25097, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ - { 25118, 0x00008861 }, /* GL_POINT_SPRITE */ - { 25134, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ - { 25154, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ - { 25183, 0x00008861 }, /* GL_POINT_SPRITE_NV */ - { 25202, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ - { 25228, 0x00000701 }, /* GL_POINT_TOKEN */ - { 25243, 0x00000009 }, /* GL_POLYGON */ - { 25254, 0x00000008 }, /* GL_POLYGON_BIT */ - { 25269, 0x00000B40 }, /* GL_POLYGON_MODE */ - { 25285, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ - { 25308, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ - { 25333, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ - { 25356, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ - { 25379, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ - { 25403, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ - { 25427, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ - { 25445, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ - { 25468, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ - { 25487, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ - { 25510, 0x00000703 }, /* GL_POLYGON_TOKEN */ - { 25527, 0x00001203 }, /* GL_POSITION */ - { 25539, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - { 25571, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ - { 25607, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - { 25640, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ - { 25677, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - { 25708, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ - { 25743, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - { 25775, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ - { 25811, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - { 25844, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - { 25876, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ - { 25912, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - { 25945, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ - { 25982, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - { 26012, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ - { 26046, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - { 26077, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ - { 26112, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - { 26143, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ - { 26178, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - { 26210, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ - { 26246, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - { 26276, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ - { 26310, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - { 26341, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ - { 26376, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - { 26408, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - { 26439, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ - { 26474, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - { 26506, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ - { 26542, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ - { 26571, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ - { 26604, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ - { 26634, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ - { 26668, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - { 26707, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - { 26740, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - { 26780, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - { 26814, 0x00008578 }, /* GL_PREVIOUS */ - { 26826, 0x00008578 }, /* GL_PREVIOUS_ARB */ - { 26842, 0x00008578 }, /* GL_PREVIOUS_EXT */ - { 26858, 0x00008577 }, /* GL_PRIMARY_COLOR */ - { 26875, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ - { 26896, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ - { 26917, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 26950, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 26982, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ - { 27005, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ - { 27028, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ - { 27058, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ - { 27087, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ - { 27115, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ - { 27137, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - { 27165, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - { 27193, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ - { 27215, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ - { 27236, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 27276, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 27315, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 27345, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 27380, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 27413, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 27447, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 27486, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 27525, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ - { 27547, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ - { 27573, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ - { 27597, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ - { 27620, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ - { 27642, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ - { 27663, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ - { 27684, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ - { 27711, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 27743, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 27775, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - { 27810, 0x00001701 }, /* GL_PROJECTION */ - { 27824, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ - { 27845, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ - { 27871, 0x00008E4F }, /* GL_PROVOKING_VERTEX */ - { 27891, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */ - { 27915, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ - { 27936, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ - { 27955, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ - { 27978, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - { 28017, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - { 28055, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ - { 28075, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - { 28105, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ - { 28129, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ - { 28149, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - { 28179, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ - { 28203, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ - { 28223, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - { 28256, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ - { 28282, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ - { 28312, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - { 28343, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ - { 28373, 0x00008A1D }, /* GL_PURGEABLE_APPLE */ - { 28392, 0x00002003 }, /* GL_Q */ - { 28397, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ - { 28422, 0x00000007 }, /* GL_QUADS */ - { 28431, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ - { 28475, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ - { 28523, 0x00008614 }, /* GL_QUAD_MESH_SUN */ - { 28540, 0x00000008 }, /* GL_QUAD_STRIP */ - { 28554, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */ - { 28584, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */ - { 28611, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ - { 28633, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ - { 28659, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */ - { 28679, 0x00008866 }, /* GL_QUERY_RESULT */ - { 28695, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ - { 28715, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ - { 28741, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ - { 28771, 0x00008E13 }, /* GL_QUERY_WAIT_NV */ - { 28788, 0x00002002 }, /* GL_R */ - { 28793, 0x00002A10 }, /* GL_R3_G3_B2 */ - { 28805, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - { 28838, 0x00000C02 }, /* GL_READ_BUFFER */ - { 28853, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ - { 28873, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */ - { 28901, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - { 28933, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ - { 28957, 0x000088B8 }, /* GL_READ_ONLY */ - { 28970, 0x000088B8 }, /* GL_READ_ONLY_ARB */ - { 28987, 0x000088BA }, /* GL_READ_WRITE */ - { 29001, 0x000088BA }, /* GL_READ_WRITE_ARB */ - { 29019, 0x00001903 }, /* GL_RED */ - { 29026, 0x00008016 }, /* GL_REDUCE */ - { 29036, 0x00008016 }, /* GL_REDUCE_EXT */ - { 29050, 0x00000D15 }, /* GL_RED_BIAS */ - { 29062, 0x00000D52 }, /* GL_RED_BITS */ - { 29074, 0x00000D14 }, /* GL_RED_SCALE */ - { 29087, 0x00008512 }, /* GL_REFLECTION_MAP */ - { 29105, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ - { 29127, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ - { 29148, 0x00008A19 }, /* GL_RELEASED_APPLE */ - { 29166, 0x00001C00 }, /* GL_RENDER */ - { 29176, 0x00008D41 }, /* GL_RENDERBUFFER */ - { 29192, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ - { 29219, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */ - { 29243, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ - { 29271, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ - { 29297, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ - { 29324, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ - { 29344, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ - { 29371, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ - { 29394, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ - { 29421, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - { 29453, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ - { 29489, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ - { 29514, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ - { 29538, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */ - { 29566, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ - { 29595, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ - { 29617, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ - { 29643, 0x00001F01 }, /* GL_RENDERER */ - { 29655, 0x00000C40 }, /* GL_RENDER_MODE */ - { 29670, 0x00002901 }, /* GL_REPEAT */ - { 29680, 0x00001E01 }, /* GL_REPLACE */ - { 29691, 0x00008062 }, /* GL_REPLACE_EXT */ - { 29706, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ - { 29729, 0x0000803A }, /* GL_RESCALE_NORMAL */ - { 29747, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ - { 29769, 0x00008A1B }, /* GL_RETAINED_APPLE */ - { 29787, 0x00000102 }, /* GL_RETURN */ - { 29797, 0x00001907 }, /* GL_RGB */ - { 29804, 0x00008052 }, /* GL_RGB10 */ - { 29813, 0x00008059 }, /* GL_RGB10_A2 */ - { 29825, 0x00008059 }, /* GL_RGB10_A2_EXT */ - { 29841, 0x00008052 }, /* GL_RGB10_EXT */ - { 29854, 0x00008053 }, /* GL_RGB12 */ - { 29863, 0x00008053 }, /* GL_RGB12_EXT */ - { 29876, 0x00008054 }, /* GL_RGB16 */ - { 29885, 0x00008054 }, /* GL_RGB16_EXT */ - { 29898, 0x0000804E }, /* GL_RGB2_EXT */ - { 29910, 0x0000804F }, /* GL_RGB4 */ - { 29918, 0x0000804F }, /* GL_RGB4_EXT */ - { 29930, 0x000083A1 }, /* GL_RGB4_S3TC */ - { 29943, 0x00008050 }, /* GL_RGB5 */ - { 29951, 0x00008057 }, /* GL_RGB5_A1 */ - { 29962, 0x00008057 }, /* GL_RGB5_A1_EXT */ - { 29977, 0x00008050 }, /* GL_RGB5_EXT */ - { 29989, 0x00008051 }, /* GL_RGB8 */ - { 29997, 0x00008051 }, /* GL_RGB8_EXT */ - { 30009, 0x00001908 }, /* GL_RGBA */ - { 30017, 0x0000805A }, /* GL_RGBA12 */ - { 30027, 0x0000805A }, /* GL_RGBA12_EXT */ - { 30041, 0x0000805B }, /* GL_RGBA16 */ - { 30051, 0x0000805B }, /* GL_RGBA16_EXT */ - { 30065, 0x00008055 }, /* GL_RGBA2 */ - { 30074, 0x00008055 }, /* GL_RGBA2_EXT */ - { 30087, 0x00008056 }, /* GL_RGBA4 */ - { 30096, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ - { 30115, 0x00008056 }, /* GL_RGBA4_EXT */ - { 30128, 0x000083A3 }, /* GL_RGBA4_S3TC */ - { 30142, 0x00008058 }, /* GL_RGBA8 */ - { 30151, 0x00008058 }, /* GL_RGBA8_EXT */ - { 30164, 0x00008F97 }, /* GL_RGBA8_SNORM */ - { 30179, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ - { 30197, 0x00000C31 }, /* GL_RGBA_MODE */ - { 30210, 0x000083A2 }, /* GL_RGBA_S3TC */ - { 30223, 0x00008F93 }, /* GL_RGBA_SNORM */ - { 30237, 0x000083A0 }, /* GL_RGB_S3TC */ - { 30249, 0x00008573 }, /* GL_RGB_SCALE */ - { 30262, 0x00008573 }, /* GL_RGB_SCALE_ARB */ - { 30279, 0x00008573 }, /* GL_RGB_SCALE_EXT */ - { 30296, 0x00000407 }, /* GL_RIGHT */ - { 30305, 0x00002000 }, /* GL_S */ - { 30310, 0x00008B5D }, /* GL_SAMPLER_1D */ - { 30324, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ - { 30345, 0x00008B5E }, /* GL_SAMPLER_2D */ - { 30359, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ - { 30380, 0x00008B5F }, /* GL_SAMPLER_3D */ - { 30394, 0x00008B60 }, /* GL_SAMPLER_CUBE */ - { 30410, 0x000080A9 }, /* GL_SAMPLES */ - { 30421, 0x000086B4 }, /* GL_SAMPLES_3DFX */ - { 30437, 0x000080A9 }, /* GL_SAMPLES_ARB */ - { 30452, 0x00008914 }, /* GL_SAMPLES_PASSED */ - { 30470, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ - { 30492, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - { 30520, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ - { 30552, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ - { 30575, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ - { 30602, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ - { 30620, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ - { 30643, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ - { 30665, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ - { 30684, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ - { 30707, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ - { 30733, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ - { 30763, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ - { 30788, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ - { 30817, 0x00080000 }, /* GL_SCISSOR_BIT */ - { 30832, 0x00000C10 }, /* GL_SCISSOR_BOX */ - { 30847, 0x00000C11 }, /* GL_SCISSOR_TEST */ - { 30863, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ - { 30888, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - { 30928, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 30972, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - { 31005, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - { 31035, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - { 31067, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - { 31097, 0x00001C02 }, /* GL_SELECT */ - { 31107, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ - { 31135, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ - { 31160, 0x00008012 }, /* GL_SEPARABLE_2D */ - { 31176, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ - { 31203, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ - { 31234, 0x0000150F }, /* GL_SET */ - { 31241, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ - { 31262, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ - { 31286, 0x00008B4F }, /* GL_SHADER_TYPE */ - { 31301, 0x00000B54 }, /* GL_SHADE_MODEL */ - { 31316, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ - { 31344, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ - { 31367, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - { 31397, 0x00001601 }, /* GL_SHININESS */ - { 31410, 0x00001402 }, /* GL_SHORT */ - { 31419, 0x00009119 }, /* GL_SIGNALED */ - { 31431, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ - { 31452, 0x000081F9 }, /* GL_SINGLE_COLOR */ - { 31468, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ - { 31488, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ - { 31507, 0x00008C46 }, /* GL_SLUMINANCE */ - { 31521, 0x00008C47 }, /* GL_SLUMINANCE8 */ - { 31536, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ - { 31558, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ - { 31578, 0x00001D01 }, /* GL_SMOOTH */ - { 31588, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ - { 31621, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ - { 31648, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ - { 31681, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ - { 31708, 0x00008588 }, /* GL_SOURCE0_ALPHA */ - { 31725, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ - { 31746, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ - { 31767, 0x00008580 }, /* GL_SOURCE0_RGB */ - { 31782, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ - { 31801, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ - { 31820, 0x00008589 }, /* GL_SOURCE1_ALPHA */ - { 31837, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ - { 31858, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ - { 31879, 0x00008581 }, /* GL_SOURCE1_RGB */ - { 31894, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ - { 31913, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ - { 31932, 0x0000858A }, /* GL_SOURCE2_ALPHA */ - { 31949, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ - { 31970, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ - { 31991, 0x00008582 }, /* GL_SOURCE2_RGB */ - { 32006, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ - { 32025, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ - { 32044, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ - { 32064, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ - { 32082, 0x00001202 }, /* GL_SPECULAR */ - { 32094, 0x00002402 }, /* GL_SPHERE_MAP */ - { 32108, 0x00001206 }, /* GL_SPOT_CUTOFF */ - { 32123, 0x00001204 }, /* GL_SPOT_DIRECTION */ - { 32141, 0x00001205 }, /* GL_SPOT_EXPONENT */ - { 32158, 0x00008588 }, /* GL_SRC0_ALPHA */ - { 32172, 0x00008580 }, /* GL_SRC0_RGB */ - { 32184, 0x00008589 }, /* GL_SRC1_ALPHA */ - { 32198, 0x00008581 }, /* GL_SRC1_RGB */ - { 32210, 0x0000858A }, /* GL_SRC2_ALPHA */ - { 32224, 0x00008582 }, /* GL_SRC2_RGB */ - { 32236, 0x00000302 }, /* GL_SRC_ALPHA */ - { 32249, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ - { 32271, 0x00000300 }, /* GL_SRC_COLOR */ - { 32284, 0x00008C40 }, /* GL_SRGB */ - { 32292, 0x00008C41 }, /* GL_SRGB8 */ - { 32301, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ - { 32317, 0x00008C42 }, /* GL_SRGB_ALPHA */ - { 32331, 0x00000503 }, /* GL_STACK_OVERFLOW */ - { 32349, 0x00000504 }, /* GL_STACK_UNDERFLOW */ - { 32368, 0x000088E6 }, /* GL_STATIC_COPY */ - { 32383, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ - { 32402, 0x000088E4 }, /* GL_STATIC_DRAW */ - { 32417, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ - { 32436, 0x000088E5 }, /* GL_STATIC_READ */ - { 32451, 0x000088E5 }, /* GL_STATIC_READ_ARB */ - { 32470, 0x00001802 }, /* GL_STENCIL */ - { 32481, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ - { 32503, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ - { 32529, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ - { 32550, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ - { 32575, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ - { 32596, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ - { 32621, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - { 32653, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ - { 32689, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - { 32721, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ - { 32757, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ - { 32777, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ - { 32804, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ - { 32830, 0x00000D57 }, /* GL_STENCIL_BITS */ - { 32846, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ - { 32868, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ - { 32891, 0x00000B94 }, /* GL_STENCIL_FAIL */ - { 32907, 0x00000B92 }, /* GL_STENCIL_FUNC */ - { 32923, 0x00001901 }, /* GL_STENCIL_INDEX */ - { 32940, 0x00008D46 }, /* GL_STENCIL_INDEX1 */ - { 32958, 0x00008D49 }, /* GL_STENCIL_INDEX16 */ - { 32977, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ - { 33000, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ - { 33022, 0x00008D47 }, /* GL_STENCIL_INDEX4 */ - { 33040, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ - { 33062, 0x00008D48 }, /* GL_STENCIL_INDEX8 */ - { 33080, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ - { 33102, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ - { 33123, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ - { 33150, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ - { 33177, 0x00000B97 }, /* GL_STENCIL_REF */ - { 33192, 0x00000B90 }, /* GL_STENCIL_TEST */ - { 33208, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - { 33237, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ - { 33259, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ - { 33280, 0x00000C33 }, /* GL_STEREO */ - { 33290, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */ - { 33314, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */ - { 33339, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */ - { 33363, 0x000088E2 }, /* GL_STREAM_COPY */ - { 33378, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ - { 33397, 0x000088E0 }, /* GL_STREAM_DRAW */ - { 33412, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ - { 33431, 0x000088E1 }, /* GL_STREAM_READ */ - { 33446, 0x000088E1 }, /* GL_STREAM_READ_ARB */ - { 33465, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ - { 33482, 0x000084E7 }, /* GL_SUBTRACT */ - { 33494, 0x000084E7 }, /* GL_SUBTRACT_ARB */ - { 33510, 0x00009113 }, /* GL_SYNC_CONDITION */ - { 33528, 0x00009116 }, /* GL_SYNC_FENCE */ - { 33542, 0x00009115 }, /* GL_SYNC_FLAGS */ - { 33556, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */ - { 33583, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ - { 33613, 0x00009114 }, /* GL_SYNC_STATUS */ - { 33628, 0x00002001 }, /* GL_T */ - { 33633, 0x00002A2A }, /* GL_T2F_C3F_V3F */ - { 33648, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ - { 33667, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ - { 33683, 0x00002A2B }, /* GL_T2F_N3F_V3F */ - { 33698, 0x00002A27 }, /* GL_T2F_V3F */ - { 33709, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ - { 33728, 0x00002A28 }, /* GL_T4F_V4F */ - { 33739, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ - { 33762, 0x00001702 }, /* GL_TEXTURE */ - { 33773, 0x000084C0 }, /* GL_TEXTURE0 */ - { 33785, 0x000084C0 }, /* GL_TEXTURE0_ARB */ - { 33801, 0x000084C1 }, /* GL_TEXTURE1 */ - { 33813, 0x000084CA }, /* GL_TEXTURE10 */ - { 33826, 0x000084CA }, /* GL_TEXTURE10_ARB */ - { 33843, 0x000084CB }, /* GL_TEXTURE11 */ - { 33856, 0x000084CB }, /* GL_TEXTURE11_ARB */ - { 33873, 0x000084CC }, /* GL_TEXTURE12 */ - { 33886, 0x000084CC }, /* GL_TEXTURE12_ARB */ - { 33903, 0x000084CD }, /* GL_TEXTURE13 */ - { 33916, 0x000084CD }, /* GL_TEXTURE13_ARB */ - { 33933, 0x000084CE }, /* GL_TEXTURE14 */ - { 33946, 0x000084CE }, /* GL_TEXTURE14_ARB */ - { 33963, 0x000084CF }, /* GL_TEXTURE15 */ - { 33976, 0x000084CF }, /* GL_TEXTURE15_ARB */ - { 33993, 0x000084D0 }, /* GL_TEXTURE16 */ - { 34006, 0x000084D0 }, /* GL_TEXTURE16_ARB */ - { 34023, 0x000084D1 }, /* GL_TEXTURE17 */ - { 34036, 0x000084D1 }, /* GL_TEXTURE17_ARB */ - { 34053, 0x000084D2 }, /* GL_TEXTURE18 */ - { 34066, 0x000084D2 }, /* GL_TEXTURE18_ARB */ - { 34083, 0x000084D3 }, /* GL_TEXTURE19 */ - { 34096, 0x000084D3 }, /* GL_TEXTURE19_ARB */ - { 34113, 0x000084C1 }, /* GL_TEXTURE1_ARB */ - { 34129, 0x000084C2 }, /* GL_TEXTURE2 */ - { 34141, 0x000084D4 }, /* GL_TEXTURE20 */ - { 34154, 0x000084D4 }, /* GL_TEXTURE20_ARB */ - { 34171, 0x000084D5 }, /* GL_TEXTURE21 */ - { 34184, 0x000084D5 }, /* GL_TEXTURE21_ARB */ - { 34201, 0x000084D6 }, /* GL_TEXTURE22 */ - { 34214, 0x000084D6 }, /* GL_TEXTURE22_ARB */ - { 34231, 0x000084D7 }, /* GL_TEXTURE23 */ - { 34244, 0x000084D7 }, /* GL_TEXTURE23_ARB */ - { 34261, 0x000084D8 }, /* GL_TEXTURE24 */ - { 34274, 0x000084D8 }, /* GL_TEXTURE24_ARB */ - { 34291, 0x000084D9 }, /* GL_TEXTURE25 */ - { 34304, 0x000084D9 }, /* GL_TEXTURE25_ARB */ - { 34321, 0x000084DA }, /* GL_TEXTURE26 */ - { 34334, 0x000084DA }, /* GL_TEXTURE26_ARB */ - { 34351, 0x000084DB }, /* GL_TEXTURE27 */ - { 34364, 0x000084DB }, /* GL_TEXTURE27_ARB */ - { 34381, 0x000084DC }, /* GL_TEXTURE28 */ - { 34394, 0x000084DC }, /* GL_TEXTURE28_ARB */ - { 34411, 0x000084DD }, /* GL_TEXTURE29 */ - { 34424, 0x000084DD }, /* GL_TEXTURE29_ARB */ - { 34441, 0x000084C2 }, /* GL_TEXTURE2_ARB */ - { 34457, 0x000084C3 }, /* GL_TEXTURE3 */ - { 34469, 0x000084DE }, /* GL_TEXTURE30 */ - { 34482, 0x000084DE }, /* GL_TEXTURE30_ARB */ - { 34499, 0x000084DF }, /* GL_TEXTURE31 */ - { 34512, 0x000084DF }, /* GL_TEXTURE31_ARB */ - { 34529, 0x000084C3 }, /* GL_TEXTURE3_ARB */ - { 34545, 0x000084C4 }, /* GL_TEXTURE4 */ - { 34557, 0x000084C4 }, /* GL_TEXTURE4_ARB */ - { 34573, 0x000084C5 }, /* GL_TEXTURE5 */ - { 34585, 0x000084C5 }, /* GL_TEXTURE5_ARB */ - { 34601, 0x000084C6 }, /* GL_TEXTURE6 */ - { 34613, 0x000084C6 }, /* GL_TEXTURE6_ARB */ - { 34629, 0x000084C7 }, /* GL_TEXTURE7 */ - { 34641, 0x000084C7 }, /* GL_TEXTURE7_ARB */ - { 34657, 0x000084C8 }, /* GL_TEXTURE8 */ - { 34669, 0x000084C8 }, /* GL_TEXTURE8_ARB */ - { 34685, 0x000084C9 }, /* GL_TEXTURE9 */ - { 34697, 0x000084C9 }, /* GL_TEXTURE9_ARB */ - { 34713, 0x00000DE0 }, /* GL_TEXTURE_1D */ - { 34727, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ - { 34751, 0x00000DE1 }, /* GL_TEXTURE_2D */ - { 34765, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ - { 34789, 0x0000806F }, /* GL_TEXTURE_3D */ - { 34803, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ - { 34825, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ - { 34851, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ - { 34873, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ - { 34895, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - { 34927, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ - { 34949, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - { 34981, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ - { 35003, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ - { 35031, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ - { 35063, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - { 35096, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ - { 35128, 0x00040000 }, /* GL_TEXTURE_BIT */ - { 35143, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ - { 35164, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ - { 35189, 0x00001005 }, /* GL_TEXTURE_BORDER */ - { 35207, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ - { 35231, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - { 35262, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - { 35292, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - { 35322, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - { 35357, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - { 35388, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 35426, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ - { 35453, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - { 35485, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - { 35519, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ - { 35543, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ - { 35571, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ - { 35595, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ - { 35623, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - { 35656, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ - { 35680, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ - { 35702, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ - { 35724, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ - { 35750, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ - { 35784, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - { 35817, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ - { 35854, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ - { 35882, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ - { 35914, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ - { 35937, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - { 35975, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ - { 36017, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - { 36048, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - { 36076, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - { 36106, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - { 36134, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ - { 36154, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ - { 36178, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - { 36209, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ - { 36244, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - { 36275, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ - { 36310, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - { 36341, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ - { 36376, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - { 36407, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ - { 36442, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - { 36473, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ - { 36508, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - { 36539, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ - { 36574, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ - { 36603, 0x00008071 }, /* GL_TEXTURE_DEPTH */ - { 36620, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ - { 36642, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ - { 36668, 0x00002300 }, /* GL_TEXTURE_ENV */ - { 36683, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ - { 36704, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ - { 36724, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ - { 36750, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ - { 36770, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ - { 36787, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ - { 36804, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ - { 36821, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ - { 36838, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ - { 36863, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ - { 36885, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ - { 36911, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ - { 36929, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ - { 36955, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ - { 36981, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ - { 37011, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ - { 37038, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ - { 37063, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ - { 37083, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ - { 37107, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - { 37134, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - { 37161, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - { 37188, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ - { 37214, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ - { 37244, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ - { 37266, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ - { 37284, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - { 37314, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - { 37342, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - { 37370, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - { 37398, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ - { 37419, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ - { 37438, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ - { 37460, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ - { 37479, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ - { 37499, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ - { 37529, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */ - { 37560, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ - { 37585, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ - { 37609, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ - { 37629, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ - { 37653, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ - { 37673, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ - { 37696, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ - { 37720, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */ - { 37748, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */ - { 37778, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ - { 37803, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - { 37837, 0x00001000 }, /* GL_TEXTURE_WIDTH */ - { 37854, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ - { 37872, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ - { 37890, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ - { 37908, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */ - { 37927, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ - { 37947, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ - { 37966, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - { 37995, 0x00001000 }, /* GL_TRANSFORM_BIT */ - { 38012, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ - { 38038, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ - { 38068, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - { 38100, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - { 38130, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ - { 38164, 0x0000862C }, /* GL_TRANSPOSE_NV */ - { 38180, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - { 38211, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ - { 38246, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - { 38274, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ - { 38306, 0x00000004 }, /* GL_TRIANGLES */ - { 38319, 0x00000006 }, /* GL_TRIANGLE_FAN */ - { 38335, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ - { 38356, 0x00000005 }, /* GL_TRIANGLE_STRIP */ - { 38374, 0x00000001 }, /* GL_TRUE */ - { 38382, 0x00008A1C }, /* GL_UNDEFINED_APPLE */ - { 38401, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ - { 38421, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ - { 38444, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ - { 38464, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ - { 38485, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ - { 38507, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ - { 38529, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ - { 38549, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ - { 38570, 0x00009118 }, /* GL_UNSIGNALED */ - { 38584, 0x00001401 }, /* GL_UNSIGNED_BYTE */ - { 38601, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - { 38628, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ - { 38651, 0x00001405 }, /* GL_UNSIGNED_INT */ - { 38667, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ - { 38694, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ - { 38715, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */ - { 38740, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ - { 38764, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - { 38795, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ - { 38819, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - { 38847, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ - { 38870, 0x00001403 }, /* GL_UNSIGNED_SHORT */ - { 38888, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - { 38918, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - { 38944, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - { 38974, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - { 39000, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ - { 39024, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - { 39052, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - { 39080, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ - { 39107, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - { 39139, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ - { 39170, 0x00008CA2 }, /* GL_UPPER_LEFT */ - { 39184, 0x00002A20 }, /* GL_V2F */ - { 39191, 0x00002A21 }, /* GL_V3F */ - { 39198, 0x00008B83 }, /* GL_VALIDATE_STATUS */ - { 39217, 0x00001F00 }, /* GL_VENDOR */ - { 39227, 0x00001F02 }, /* GL_VERSION */ - { 39238, 0x00008074 }, /* GL_VERTEX_ARRAY */ - { 39254, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */ - { 39278, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - { 39308, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - { 39339, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ - { 39374, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ - { 39398, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ - { 39419, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ - { 39442, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ - { 39463, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - { 39490, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - { 39518, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - { 39546, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - { 39574, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - { 39602, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - { 39630, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - { 39658, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - { 39685, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - { 39712, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - { 39739, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - { 39766, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - { 39793, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - { 39820, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - { 39847, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - { 39874, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - { 39901, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - { 39939, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ - { 39981, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - { 40012, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ - { 40047, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - { 40081, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ - { 40119, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - { 40150, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ - { 40185, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - { 40213, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ - { 40245, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - { 40275, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ - { 40309, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - { 40337, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ - { 40369, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ - { 40389, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ - { 40411, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ - { 40440, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ - { 40461, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - { 40490, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ - { 40523, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - { 40555, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - { 40582, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ - { 40613, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - { 40643, 0x00008B31 }, /* GL_VERTEX_SHADER */ - { 40660, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ - { 40681, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ - { 40708, 0x00000BA2 }, /* GL_VIEWPORT */ - { 40720, 0x00000800 }, /* GL_VIEWPORT_BIT */ - { 40736, 0x00008A1A }, /* GL_VOLATILE_APPLE */ - { 40754, 0x0000911D }, /* GL_WAIT_FAILED */ - { 40769, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ - { 40789, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - { 40820, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ - { 40855, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - { 40883, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - { 40908, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - { 40935, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - { 40960, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ - { 40984, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ - { 41003, 0x000088B9 }, /* GL_WRITE_ONLY */ - { 41017, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ - { 41035, 0x00001506 }, /* GL_XOR */ - { 41042, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ - { 41061, 0x00008757 }, /* GL_YCBCR_MESA */ - { 41075, 0x00000000 }, /* GL_ZERO */ - { 41083, 0x00000D16 }, /* GL_ZOOM_X */ - { 41093, 0x00000D17 }, /* GL_ZOOM_Y */ + { 1204, 0x000080E1 }, /* GL_BGRA_EXT */ + { 1216, 0x00001A00 }, /* GL_BITMAP */ + { 1226, 0x00000704 }, /* GL_BITMAP_TOKEN */ + { 1242, 0x00000BE2 }, /* GL_BLEND */ + { 1251, 0x00008005 }, /* GL_BLEND_COLOR */ + { 1266, 0x00008005 }, /* GL_BLEND_COLOR_EXT */ + { 1285, 0x00000BE0 }, /* GL_BLEND_DST */ + { 1298, 0x000080CA }, /* GL_BLEND_DST_ALPHA */ + { 1317, 0x000080CA }, /* GL_BLEND_DST_ALPHA_OES */ + { 1340, 0x000080C8 }, /* GL_BLEND_DST_RGB */ + { 1357, 0x000080C8 }, /* GL_BLEND_DST_RGB_OES */ + { 1378, 0x00008009 }, /* GL_BLEND_EQUATION */ + { 1396, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA */ + { 1420, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_EXT */ + { 1448, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_OES */ + { 1476, 0x00008009 }, /* GL_BLEND_EQUATION_EXT */ + { 1498, 0x00008009 }, /* GL_BLEND_EQUATION_OES */ + { 1520, 0x00008009 }, /* GL_BLEND_EQUATION_RGB */ + { 1542, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */ + { 1568, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_OES */ + { 1594, 0x00000BE1 }, /* GL_BLEND_SRC */ + { 1607, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */ + { 1626, 0x000080CB }, /* GL_BLEND_SRC_ALPHA_OES */ + { 1649, 0x000080C9 }, /* GL_BLEND_SRC_RGB */ + { 1666, 0x000080C9 }, /* GL_BLEND_SRC_RGB_OES */ + { 1687, 0x00001905 }, /* GL_BLUE */ + { 1695, 0x00000D1B }, /* GL_BLUE_BIAS */ + { 1708, 0x00000D54 }, /* GL_BLUE_BITS */ + { 1721, 0x00000D1A }, /* GL_BLUE_SCALE */ + { 1735, 0x00008B56 }, /* GL_BOOL */ + { 1743, 0x00008B56 }, /* GL_BOOL_ARB */ + { 1755, 0x00008B57 }, /* GL_BOOL_VEC2 */ + { 1768, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */ + { 1785, 0x00008B58 }, /* GL_BOOL_VEC3 */ + { 1798, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */ + { 1815, 0x00008B59 }, /* GL_BOOL_VEC4 */ + { 1828, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */ + { 1845, 0x000088BB }, /* GL_BUFFER_ACCESS */ + { 1862, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */ + { 1883, 0x000088BB }, /* GL_BUFFER_ACCESS_OES */ + { 1904, 0x00008A13 }, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ + { 1935, 0x000088BC }, /* GL_BUFFER_MAPPED */ + { 1952, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */ + { 1973, 0x000088BC }, /* GL_BUFFER_MAPPED_OES */ + { 1994, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */ + { 2016, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */ + { 2042, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_OES */ + { 2068, 0x000085B3 }, /* GL_BUFFER_OBJECT_APPLE */ + { 2091, 0x00008A12 }, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ + { 2125, 0x00008764 }, /* GL_BUFFER_SIZE */ + { 2140, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */ + { 2159, 0x00008765 }, /* GL_BUFFER_USAGE */ + { 2175, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */ + { 2195, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */ + { 2214, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */ + { 2240, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */ + { 2263, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ + { 2291, 0x0000877C }, /* GL_BUMP_TARGET_ATI */ + { 2310, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */ + { 2332, 0x00001400 }, /* GL_BYTE */ + { 2340, 0x00002A24 }, /* GL_C3F_V3F */ + { 2351, 0x00002A26 }, /* GL_C4F_N3F_V3F */ + { 2366, 0x00002A22 }, /* GL_C4UB_V2F */ + { 2378, 0x00002A23 }, /* GL_C4UB_V3F */ + { 2390, 0x00000901 }, /* GL_CCW */ + { 2397, 0x00002900 }, /* GL_CLAMP */ + { 2406, 0x0000812D }, /* GL_CLAMP_TO_BORDER */ + { 2425, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */ + { 2448, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */ + { 2472, 0x0000812F }, /* GL_CLAMP_TO_EDGE */ + { 2489, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */ + { 2511, 0x00001500 }, /* GL_CLEAR */ + { 2520, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */ + { 2545, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */ + { 2574, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */ + { 2600, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ + { 2629, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */ + { 2655, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */ + { 2682, 0x00003000 }, /* GL_CLIP_PLANE0 */ + { 2697, 0x00003001 }, /* GL_CLIP_PLANE1 */ + { 2712, 0x00003002 }, /* GL_CLIP_PLANE2 */ + { 2727, 0x00003003 }, /* GL_CLIP_PLANE3 */ + { 2742, 0x00003004 }, /* GL_CLIP_PLANE4 */ + { 2757, 0x00003005 }, /* GL_CLIP_PLANE5 */ + { 2772, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ + { 2805, 0x00000A00 }, /* GL_COEFF */ + { 2814, 0x00001800 }, /* GL_COLOR */ + { 2823, 0x00008076 }, /* GL_COLOR_ARRAY */ + { 2838, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */ + { 2868, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 2902, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */ + { 2925, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */ + { 2945, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */ + { 2967, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */ + { 2987, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */ + { 3008, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */ + { 3033, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_OES */ + { 3058, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */ + { 3079, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */ + { 3101, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */ + { 3127, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */ + { 3149, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */ + { 3175, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */ + { 3197, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */ + { 3223, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */ + { 3245, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */ + { 3271, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */ + { 3293, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */ + { 3319, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */ + { 3341, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */ + { 3367, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */ + { 3392, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */ + { 3413, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */ + { 3438, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */ + { 3459, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */ + { 3484, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */ + { 3505, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */ + { 3530, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */ + { 3551, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */ + { 3576, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */ + { 3597, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */ + { 3622, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */ + { 3643, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */ + { 3668, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */ + { 3689, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */ + { 3714, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */ + { 3735, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */ + { 3760, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */ + { 3780, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */ + { 3801, 0x00001900 }, /* GL_COLOR_INDEX */ + { 3816, 0x00001603 }, /* GL_COLOR_INDEXES */ + { 3833, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */ + { 3851, 0x00000B57 }, /* GL_COLOR_MATERIAL */ + { 3869, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */ + { 3892, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */ + { 3920, 0x000080B1 }, /* GL_COLOR_MATRIX */ + { 3936, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */ + { 3956, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */ + { 3984, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 4016, 0x00008458 }, /* GL_COLOR_SUM */ + { 4029, 0x00008458 }, /* GL_COLOR_SUM_ARB */ + { 4046, 0x000080D0 }, /* GL_COLOR_TABLE */ + { 4061, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */ + { 4087, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */ + { 4117, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */ + { 4147, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */ + { 4167, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */ + { 4191, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */ + { 4216, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */ + { 4245, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */ + { 4274, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */ + { 4296, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */ + { 4322, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */ + { 4348, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */ + { 4374, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */ + { 4404, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */ + { 4434, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */ + { 4464, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */ + { 4498, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */ + { 4532, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ + { 4562, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */ + { 4596, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */ + { 4630, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */ + { 4654, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */ + { 4682, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */ + { 4710, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */ + { 4731, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */ + { 4756, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */ + { 4777, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */ + { 4802, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */ + { 4827, 0x00000C23 }, /* GL_COLOR_WRITEMASK */ + { 4846, 0x00008570 }, /* GL_COMBINE */ + { 4857, 0x00008503 }, /* GL_COMBINE4 */ + { 4869, 0x00008572 }, /* GL_COMBINE_ALPHA */ + { 4886, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */ + { 4907, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */ + { 4928, 0x00008570 }, /* GL_COMBINE_ARB */ + { 4943, 0x00008570 }, /* GL_COMBINE_EXT */ + { 4958, 0x00008571 }, /* GL_COMBINE_RGB */ + { 4973, 0x00008571 }, /* GL_COMBINE_RGB_ARB */ + { 4992, 0x00008571 }, /* GL_COMBINE_RGB_EXT */ + { 5011, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */ + { 5047, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */ + { 5071, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */ + { 5099, 0x00001300 }, /* GL_COMPILE */ + { 5110, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */ + { 5133, 0x00008B81 }, /* GL_COMPILE_STATUS */ + { 5151, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */ + { 5171, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */ + { 5195, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */ + { 5219, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */ + { 5247, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */ + { 5271, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */ + { 5301, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */ + { 5335, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */ + { 5363, 0x000084ED }, /* GL_COMPRESSED_RGB */ + { 5381, 0x000084EE }, /* GL_COMPRESSED_RGBA */ + { 5400, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */ + { 5423, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ + { 5452, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ + { 5485, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ + { 5518, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ + { 5551, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */ + { 5573, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */ + { 5601, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ + { 5633, 0x00008C4A }, /* GL_COMPRESSED_SLUMINANCE */ + { 5658, 0x00008C4B }, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ + { 5689, 0x00008C48 }, /* GL_COMPRESSED_SRGB */ + { 5708, 0x00008C49 }, /* GL_COMPRESSED_SRGB_ALPHA */ + { 5733, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */ + { 5763, 0x0000911C }, /* GL_CONDITION_SATISFIED */ + { 5786, 0x00008576 }, /* GL_CONSTANT */ + { 5798, 0x00008003 }, /* GL_CONSTANT_ALPHA */ + { 5816, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */ + { 5838, 0x00008576 }, /* GL_CONSTANT_ARB */ + { 5854, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */ + { 5878, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */ + { 5900, 0x00008001 }, /* GL_CONSTANT_COLOR */ + { 5918, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */ + { 5940, 0x00008576 }, /* GL_CONSTANT_EXT */ + { 5956, 0x00008010 }, /* GL_CONVOLUTION_1D */ + { 5974, 0x00008011 }, /* GL_CONVOLUTION_2D */ + { 5992, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */ + { 6020, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */ + { 6051, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */ + { 6078, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */ + { 6109, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */ + { 6136, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */ + { 6167, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */ + { 6195, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */ + { 6227, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */ + { 6249, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */ + { 6275, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */ + { 6297, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */ + { 6323, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */ + { 6344, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */ + { 6369, 0x00008862 }, /* GL_COORD_REPLACE */ + { 6386, 0x00008862 }, /* GL_COORD_REPLACE_ARB */ + { 6407, 0x00008862 }, /* GL_COORD_REPLACE_NV */ + { 6427, 0x00008862 }, /* GL_COORD_REPLACE_OES */ + { 6448, 0x00001503 }, /* GL_COPY */ + { 6456, 0x0000150C }, /* GL_COPY_INVERTED */ + { 6473, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */ + { 6493, 0x00008F36 }, /* GL_COPY_READ_BUFFER */ + { 6513, 0x00008F37 }, /* GL_COPY_WRITE_BUFFER */ + { 6534, 0x00000B44 }, /* GL_CULL_FACE */ + { 6547, 0x00000B45 }, /* GL_CULL_FACE_MODE */ + { 6565, 0x000081AA }, /* GL_CULL_VERTEX_EXT */ + { 6584, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + { 6616, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + { 6651, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */ + { 6672, 0x00000001 }, /* GL_CURRENT_BIT */ + { 6687, 0x00000B00 }, /* GL_CURRENT_COLOR */ + { 6704, 0x00008453 }, /* GL_CURRENT_FOG_COORD */ + { 6725, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */ + { 6751, 0x00000B01 }, /* GL_CURRENT_INDEX */ + { 6768, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */ + { 6790, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */ + { 6818, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */ + { 6839, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + { 6873, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */ + { 6906, 0x00000B02 }, /* GL_CURRENT_NORMAL */ + { 6924, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + { 6954, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_OES */ + { 6984, 0x00008B8D }, /* GL_CURRENT_PROGRAM */ + { 7003, 0x00008865 }, /* GL_CURRENT_QUERY */ + { 7020, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */ + { 7041, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */ + { 7065, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */ + { 7092, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */ + { 7116, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */ + { 7143, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */ + { 7176, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ + { 7210, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + { 7243, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */ + { 7270, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */ + { 7296, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */ + { 7321, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */ + { 7350, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */ + { 7372, 0x00000900 }, /* GL_CW */ + { 7378, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */ + { 7399, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */ + { 7420, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */ + { 7440, 0x00002101 }, /* GL_DECAL */ + { 7449, 0x00001E03 }, /* GL_DECR */ + { 7457, 0x00008508 }, /* GL_DECR_WRAP */ + { 7470, 0x00008508 }, /* GL_DECR_WRAP_EXT */ + { 7487, 0x00008B80 }, /* GL_DELETE_STATUS */ + { 7504, 0x00001801 }, /* GL_DEPTH */ + { 7513, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */ + { 7533, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */ + { 7557, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_OES */ + { 7581, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ + { 7601, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ + { 7625, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_OES */ + { 7649, 0x00000D1F }, /* GL_DEPTH_BIAS */ + { 7663, 0x00000D56 }, /* GL_DEPTH_BITS */ + { 7677, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ + { 7697, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ + { 7722, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ + { 7742, 0x0000864F }, /* GL_DEPTH_CLAMP */ + { 7757, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ + { 7775, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ + { 7796, 0x00001902 }, /* GL_DEPTH_COMPONENT */ + { 7815, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ + { 7836, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ + { 7861, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_OES */ + { 7886, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ + { 7912, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ + { 7933, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ + { 7958, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_OES */ + { 7983, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ + { 8009, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ + { 8030, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ + { 8055, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_OES */ + { 8080, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ + { 8106, 0x00000B74 }, /* GL_DEPTH_FUNC */ + { 8120, 0x00000B70 }, /* GL_DEPTH_RANGE */ + { 8135, 0x00000D1E }, /* GL_DEPTH_SCALE */ + { 8150, 0x000084F9 }, /* GL_DEPTH_STENCIL */ + { 8167, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ + { 8195, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */ + { 8216, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ + { 8236, 0x000084F9 }, /* GL_DEPTH_STENCIL_OES */ + { 8257, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + { 8285, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + { 8313, 0x00000B71 }, /* GL_DEPTH_TEST */ + { 8327, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ + { 8349, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ + { 8375, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ + { 8394, 0x00001201 }, /* GL_DIFFUSE */ + { 8405, 0x00000BD0 }, /* GL_DITHER */ + { 8415, 0x00000A02 }, /* GL_DOMAIN */ + { 8425, 0x00001100 }, /* GL_DONT_CARE */ + { 8438, 0x000086AE }, /* GL_DOT3_RGB */ + { 8450, 0x000086AF }, /* GL_DOT3_RGBA */ + { 8463, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ + { 8480, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ + { 8497, 0x000086AE }, /* GL_DOT3_RGB_ARB */ + { 8513, 0x00008740 }, /* GL_DOT3_RGB_EXT */ + { 8529, 0x0000140A }, /* GL_DOUBLE */ + { 8539, 0x00000C32 }, /* GL_DOUBLEBUFFER */ + { 8555, 0x00000C01 }, /* GL_DRAW_BUFFER */ + { 8570, 0x00008825 }, /* GL_DRAW_BUFFER0 */ + { 8586, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ + { 8606, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ + { 8626, 0x00008826 }, /* GL_DRAW_BUFFER1 */ + { 8642, 0x0000882F }, /* GL_DRAW_BUFFER10 */ + { 8659, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ + { 8680, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ + { 8701, 0x00008830 }, /* GL_DRAW_BUFFER11 */ + { 8718, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ + { 8739, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ + { 8760, 0x00008831 }, /* GL_DRAW_BUFFER12 */ + { 8777, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ + { 8798, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ + { 8819, 0x00008832 }, /* GL_DRAW_BUFFER13 */ + { 8836, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ + { 8857, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ + { 8878, 0x00008833 }, /* GL_DRAW_BUFFER14 */ + { 8895, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ + { 8916, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ + { 8937, 0x00008834 }, /* GL_DRAW_BUFFER15 */ + { 8954, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ + { 8975, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ + { 8996, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ + { 9016, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ + { 9036, 0x00008827 }, /* GL_DRAW_BUFFER2 */ + { 9052, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ + { 9072, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ + { 9092, 0x00008828 }, /* GL_DRAW_BUFFER3 */ + { 9108, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ + { 9128, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ + { 9148, 0x00008829 }, /* GL_DRAW_BUFFER4 */ + { 9164, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ + { 9184, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ + { 9204, 0x0000882A }, /* GL_DRAW_BUFFER5 */ + { 9220, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ + { 9240, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ + { 9260, 0x0000882B }, /* GL_DRAW_BUFFER6 */ + { 9276, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ + { 9296, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ + { 9316, 0x0000882C }, /* GL_DRAW_BUFFER7 */ + { 9332, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ + { 9352, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ + { 9372, 0x0000882D }, /* GL_DRAW_BUFFER8 */ + { 9388, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ + { 9408, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ + { 9428, 0x0000882E }, /* GL_DRAW_BUFFER9 */ + { 9444, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ + { 9464, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ + { 9484, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ + { 9504, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */ + { 9532, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ + { 9564, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ + { 9588, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ + { 9608, 0x00000304 }, /* GL_DST_ALPHA */ + { 9621, 0x00000306 }, /* GL_DST_COLOR */ + { 9634, 0x0000877A }, /* GL_DU8DV8_ATI */ + { 9648, 0x00008779 }, /* GL_DUDV_ATI */ + { 9660, 0x000088EA }, /* GL_DYNAMIC_COPY */ + { 9676, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ + { 9696, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ + { 9712, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ + { 9732, 0x000088E9 }, /* GL_DYNAMIC_READ */ + { 9748, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ + { 9768, 0x00000B43 }, /* GL_EDGE_FLAG */ + { 9781, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ + { 9800, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + { 9834, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ + { 9872, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ + { 9899, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + { 9925, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ + { 9949, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + { 9981, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ + { 10017, 0x00001600 }, /* GL_EMISSION */ + { 10029, 0x00002000 }, /* GL_ENABLE_BIT */ + { 10043, 0x00000202 }, /* GL_EQUAL */ + { 10052, 0x00001509 }, /* GL_EQUIV */ + { 10061, 0x00010000 }, /* GL_EVAL_BIT */ + { 10073, 0x00000800 }, /* GL_EXP */ + { 10080, 0x00000801 }, /* GL_EXP2 */ + { 10088, 0x00001F03 }, /* GL_EXTENSIONS */ + { 10102, 0x00002400 }, /* GL_EYE_LINEAR */ + { 10116, 0x00002502 }, /* GL_EYE_PLANE */ + { 10129, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ + { 10154, 0x0000855B }, /* GL_EYE_RADIAL_NV */ + { 10171, 0x00000000 }, /* GL_FALSE */ + { 10180, 0x00001101 }, /* GL_FASTEST */ + { 10191, 0x00001C01 }, /* GL_FEEDBACK */ + { 10203, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ + { 10230, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ + { 10254, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ + { 10278, 0x00001B02 }, /* GL_FILL */ + { 10286, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */ + { 10313, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */ + { 10344, 0x0000140C }, /* GL_FIXED */ + { 10353, 0x0000140C }, /* GL_FIXED_OES */ + { 10366, 0x00001D00 }, /* GL_FLAT */ + { 10374, 0x00001406 }, /* GL_FLOAT */ + { 10383, 0x00008B5A }, /* GL_FLOAT_MAT2 */ + { 10397, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ + { 10415, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ + { 10431, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ + { 10447, 0x00008B5B }, /* GL_FLOAT_MAT3 */ + { 10461, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ + { 10479, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ + { 10495, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ + { 10511, 0x00008B5C }, /* GL_FLOAT_MAT4 */ + { 10525, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ + { 10543, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ + { 10559, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ + { 10575, 0x00008B50 }, /* GL_FLOAT_VEC2 */ + { 10589, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ + { 10607, 0x00008B51 }, /* GL_FLOAT_VEC3 */ + { 10621, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ + { 10639, 0x00008B52 }, /* GL_FLOAT_VEC4 */ + { 10653, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ + { 10671, 0x00000B60 }, /* GL_FOG */ + { 10678, 0x00000080 }, /* GL_FOG_BIT */ + { 10689, 0x00000B66 }, /* GL_FOG_COLOR */ + { 10702, 0x00008451 }, /* GL_FOG_COORD */ + { 10715, 0x00008451 }, /* GL_FOG_COORDINATE */ + { 10733, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ + { 10757, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + { 10796, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ + { 10839, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + { 10871, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + { 10902, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + { 10931, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ + { 10956, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ + { 10975, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ + { 11009, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ + { 11036, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ + { 11062, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ + { 11086, 0x00008450 }, /* GL_FOG_COORD_SRC */ + { 11103, 0x00000B62 }, /* GL_FOG_DENSITY */ + { 11118, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ + { 11142, 0x00000B64 }, /* GL_FOG_END */ + { 11153, 0x00000C54 }, /* GL_FOG_HINT */ + { 11165, 0x00000B61 }, /* GL_FOG_INDEX */ + { 11178, 0x00000B65 }, /* GL_FOG_MODE */ + { 11190, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ + { 11209, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ + { 11234, 0x00000B63 }, /* GL_FOG_START */ + { 11247, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ + { 11265, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ + { 11289, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ + { 11308, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ + { 11331, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + { 11366, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES */ + { 11405, 0x00008D40 }, /* GL_FRAMEBUFFER */ + { 11420, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + { 11457, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + { 11493, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + { 11534, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + { 11575, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + { 11612, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + { 11649, 0x00008DA7 }, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB */ + { 11687, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + { 11725, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ + { 11767, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES */ + { 11809, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + { 11847, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ + { 11889, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES */ + { 11931, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + { 11966, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + { 12005, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ + { 12054, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES */ + { 12103, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + { 12151, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ + { 12203, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES */ + { 12255, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + { 12295, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ + { 12339, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + { 12379, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ + { 12423, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES */ + { 12467, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */ + { 12490, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ + { 12517, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_OES */ + { 12544, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ + { 12568, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ + { 12596, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_OES */ + { 12624, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ + { 12647, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ + { 12666, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + { 12703, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ + { 12744, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES */ + { 12785, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS */ + { 12822, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + { 12863, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES */ + { 12904, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ + { 12942, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + { 12984, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES */ + { 13026, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + { 13077, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + { 13115, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES */ + { 13153, 0x00008DA9 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */ + { 13195, 0x00008DA8 }, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB */ + { 13239, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + { 13284, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ + { 13333, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES */ + { 13382, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + { 13420, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */ + { 13462, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ + { 13500, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + { 13542, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES */ + { 13584, 0x00008D40 }, /* GL_FRAMEBUFFER_OES */ + { 13603, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + { 13635, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ + { 13660, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ + { 13687, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ + { 13718, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_OES */ + { 13749, 0x00000404 }, /* GL_FRONT */ + { 13758, 0x00000408 }, /* GL_FRONT_AND_BACK */ + { 13776, 0x00000B46 }, /* GL_FRONT_FACE */ + { 13790, 0x00000400 }, /* GL_FRONT_LEFT */ + { 13804, 0x00000401 }, /* GL_FRONT_RIGHT */ + { 13819, 0x00008006 }, /* GL_FUNC_ADD */ + { 13831, 0x00008006 }, /* GL_FUNC_ADD_EXT */ + { 13847, 0x00008006 }, /* GL_FUNC_ADD_OES */ + { 13863, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ + { 13888, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ + { 13917, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_OES */ + { 13946, 0x0000800A }, /* GL_FUNC_SUBTRACT */ + { 13963, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ + { 13984, 0x0000800A }, /* GL_FUNC_SUBTRACT_OES */ + { 14005, 0x00008191 }, /* GL_GENERATE_MIPMAP */ + { 14024, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ + { 14048, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ + { 14077, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ + { 14101, 0x00008DDB }, /* GL_GEOMETRY_INPUT_TYPE_ARB */ + { 14128, 0x00008DDC }, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */ + { 14156, 0x00008DD9 }, /* GL_GEOMETRY_SHADER_ARB */ + { 14179, 0x00008DDA }, /* GL_GEOMETRY_VERTICES_OUT_ARB */ + { 14208, 0x00000206 }, /* GL_GEQUAL */ + { 14218, 0x00000204 }, /* GL_GREATER */ + { 14229, 0x00001904 }, /* GL_GREEN */ + { 14238, 0x00000D19 }, /* GL_GREEN_BIAS */ + { 14252, 0x00000D53 }, /* GL_GREEN_BITS */ + { 14266, 0x00000D18 }, /* GL_GREEN_SCALE */ + { 14281, 0x0000140B }, /* GL_HALF_FLOAT */ + { 14295, 0x00008D61 }, /* GL_HALF_FLOAT_OES */ + { 14313, 0x00008DF2 }, /* GL_HIGH_FLOAT */ + { 14327, 0x00008DF5 }, /* GL_HIGH_INT */ + { 14339, 0x00008000 }, /* GL_HINT_BIT */ + { 14351, 0x00008024 }, /* GL_HISTOGRAM */ + { 14364, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ + { 14388, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ + { 14416, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ + { 14439, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ + { 14466, 0x00008024 }, /* GL_HISTOGRAM_EXT */ + { 14483, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ + { 14503, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ + { 14527, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ + { 14551, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ + { 14579, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + { 14607, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ + { 14639, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ + { 14661, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ + { 14687, 0x0000802D }, /* GL_HISTOGRAM_SINK */ + { 14705, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ + { 14727, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ + { 14746, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ + { 14769, 0x0000862A }, /* GL_IDENTITY_NV */ + { 14784, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ + { 14804, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT */ + { 14840, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + { 14880, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE */ + { 14914, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + { 14952, 0x00001E02 }, /* GL_INCR */ + { 14960, 0x00008507 }, /* GL_INCR_WRAP */ + { 14973, 0x00008507 }, /* GL_INCR_WRAP_EXT */ + { 14990, 0x00008222 }, /* GL_INDEX */ + { 14999, 0x00008077 }, /* GL_INDEX_ARRAY */ + { 15014, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + { 15044, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ + { 15078, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ + { 15101, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ + { 15123, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ + { 15143, 0x00000D51 }, /* GL_INDEX_BITS */ + { 15157, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ + { 15178, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ + { 15196, 0x00000C30 }, /* GL_INDEX_MODE */ + { 15210, 0x00000D13 }, /* GL_INDEX_OFFSET */ + { 15226, 0x00000D12 }, /* GL_INDEX_SHIFT */ + { 15241, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ + { 15260, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ + { 15279, 0x00001404 }, /* GL_INT */ + { 15286, 0x00008049 }, /* GL_INTENSITY */ + { 15299, 0x0000804C }, /* GL_INTENSITY12 */ + { 15314, 0x0000804C }, /* GL_INTENSITY12_EXT */ + { 15333, 0x0000804D }, /* GL_INTENSITY16 */ + { 15348, 0x0000804D }, /* GL_INTENSITY16_EXT */ + { 15367, 0x0000804A }, /* GL_INTENSITY4 */ + { 15381, 0x0000804A }, /* GL_INTENSITY4_EXT */ + { 15399, 0x0000804B }, /* GL_INTENSITY8 */ + { 15413, 0x0000804B }, /* GL_INTENSITY8_EXT */ + { 15431, 0x00008049 }, /* GL_INTENSITY_EXT */ + { 15448, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS_EXT */ + { 15475, 0x00008575 }, /* GL_INTERPOLATE */ + { 15490, 0x00008575 }, /* GL_INTERPOLATE_ARB */ + { 15509, 0x00008575 }, /* GL_INTERPOLATE_EXT */ + { 15528, 0x00008DF7 }, /* GL_INT_10_10_10_2_OES */ + { 15550, 0x00008B53 }, /* GL_INT_VEC2 */ + { 15562, 0x00008B53 }, /* GL_INT_VEC2_ARB */ + { 15578, 0x00008B54 }, /* GL_INT_VEC3 */ + { 15590, 0x00008B54 }, /* GL_INT_VEC3_ARB */ + { 15606, 0x00008B55 }, /* GL_INT_VEC4 */ + { 15618, 0x00008B55 }, /* GL_INT_VEC4_ARB */ + { 15634, 0x00000500 }, /* GL_INVALID_ENUM */ + { 15650, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + { 15683, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ + { 15720, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_OES */ + { 15757, 0x00000502 }, /* GL_INVALID_OPERATION */ + { 15778, 0x00000501 }, /* GL_INVALID_VALUE */ + { 15795, 0x0000862B }, /* GL_INVERSE_NV */ + { 15809, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ + { 15833, 0x0000150A }, /* GL_INVERT */ + { 15843, 0x00001E00 }, /* GL_KEEP */ + { 15851, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */ + { 15877, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */ + { 15907, 0x00000406 }, /* GL_LEFT */ + { 15915, 0x00000203 }, /* GL_LEQUAL */ + { 15925, 0x00000201 }, /* GL_LESS */ + { 15933, 0x00004000 }, /* GL_LIGHT0 */ + { 15943, 0x00004001 }, /* GL_LIGHT1 */ + { 15953, 0x00004002 }, /* GL_LIGHT2 */ + { 15963, 0x00004003 }, /* GL_LIGHT3 */ + { 15973, 0x00004004 }, /* GL_LIGHT4 */ + { 15983, 0x00004005 }, /* GL_LIGHT5 */ + { 15993, 0x00004006 }, /* GL_LIGHT6 */ + { 16003, 0x00004007 }, /* GL_LIGHT7 */ + { 16013, 0x00000B50 }, /* GL_LIGHTING */ + { 16025, 0x00000040 }, /* GL_LIGHTING_BIT */ + { 16041, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ + { 16064, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + { 16093, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ + { 16126, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + { 16154, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ + { 16178, 0x00001B01 }, /* GL_LINE */ + { 16186, 0x00002601 }, /* GL_LINEAR */ + { 16196, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ + { 16218, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + { 16248, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + { 16279, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ + { 16303, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ + { 16328, 0x00000001 }, /* GL_LINES */ + { 16337, 0x0000000A }, /* GL_LINES_ADJACENCY_ARB */ + { 16360, 0x00000004 }, /* GL_LINE_BIT */ + { 16372, 0x00000002 }, /* GL_LINE_LOOP */ + { 16385, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ + { 16405, 0x00000B20 }, /* GL_LINE_SMOOTH */ + { 16420, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ + { 16440, 0x00000B24 }, /* GL_LINE_STIPPLE */ + { 16456, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ + { 16480, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ + { 16503, 0x00000003 }, /* GL_LINE_STRIP */ + { 16517, 0x0000000B }, /* GL_LINE_STRIP_ADJACENCY_ARB */ + { 16545, 0x00000702 }, /* GL_LINE_TOKEN */ + { 16559, 0x00000B21 }, /* GL_LINE_WIDTH */ + { 16573, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ + { 16599, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ + { 16619, 0x00008B82 }, /* GL_LINK_STATUS */ + { 16634, 0x00000B32 }, /* GL_LIST_BASE */ + { 16647, 0x00020000 }, /* GL_LIST_BIT */ + { 16659, 0x00000B33 }, /* GL_LIST_INDEX */ + { 16673, 0x00000B30 }, /* GL_LIST_MODE */ + { 16686, 0x00000101 }, /* GL_LOAD */ + { 16694, 0x00000BF1 }, /* GL_LOGIC_OP */ + { 16706, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ + { 16723, 0x00008CA1 }, /* GL_LOWER_LEFT */ + { 16737, 0x00008DF0 }, /* GL_LOW_FLOAT */ + { 16750, 0x00008DF3 }, /* GL_LOW_INT */ + { 16761, 0x00001909 }, /* GL_LUMINANCE */ + { 16774, 0x00008041 }, /* GL_LUMINANCE12 */ + { 16789, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ + { 16812, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ + { 16839, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ + { 16861, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ + { 16887, 0x00008041 }, /* GL_LUMINANCE12_EXT */ + { 16906, 0x00008042 }, /* GL_LUMINANCE16 */ + { 16921, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ + { 16944, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ + { 16971, 0x00008042 }, /* GL_LUMINANCE16_EXT */ + { 16990, 0x0000803F }, /* GL_LUMINANCE4 */ + { 17004, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ + { 17025, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ + { 17050, 0x0000803F }, /* GL_LUMINANCE4_EXT */ + { 17068, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ + { 17089, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ + { 17114, 0x00008040 }, /* GL_LUMINANCE8 */ + { 17128, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ + { 17149, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ + { 17174, 0x00008040 }, /* GL_LUMINANCE8_EXT */ + { 17192, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ + { 17211, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ + { 17227, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ + { 17247, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ + { 17269, 0x00000D91 }, /* GL_MAP1_INDEX */ + { 17283, 0x00000D92 }, /* GL_MAP1_NORMAL */ + { 17298, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ + { 17322, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ + { 17346, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ + { 17370, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ + { 17394, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ + { 17411, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ + { 17428, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + { 17456, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + { 17485, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + { 17514, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + { 17543, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + { 17572, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + { 17601, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + { 17630, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + { 17658, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + { 17686, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + { 17714, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + { 17742, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + { 17770, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + { 17798, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + { 17826, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + { 17854, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + { 17882, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ + { 17898, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ + { 17918, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ + { 17940, 0x00000DB1 }, /* GL_MAP2_INDEX */ + { 17954, 0x00000DB2 }, /* GL_MAP2_NORMAL */ + { 17969, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ + { 17993, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ + { 18017, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ + { 18041, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ + { 18065, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ + { 18082, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ + { 18099, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + { 18127, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + { 18156, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + { 18185, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + { 18214, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + { 18243, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + { 18272, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + { 18301, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + { 18329, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + { 18357, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + { 18385, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + { 18413, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + { 18441, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + { 18469, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ + { 18497, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + { 18525, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + { 18553, 0x00000D10 }, /* GL_MAP_COLOR */ + { 18566, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */ + { 18592, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */ + { 18621, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */ + { 18649, 0x00000001 }, /* GL_MAP_READ_BIT */ + { 18665, 0x00000D11 }, /* GL_MAP_STENCIL */ + { 18680, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */ + { 18706, 0x00000002 }, /* GL_MAP_WRITE_BIT */ + { 18723, 0x000088C0 }, /* GL_MATRIX0_ARB */ + { 18738, 0x00008630 }, /* GL_MATRIX0_NV */ + { 18752, 0x000088CA }, /* GL_MATRIX10_ARB */ + { 18768, 0x000088CB }, /* GL_MATRIX11_ARB */ + { 18784, 0x000088CC }, /* GL_MATRIX12_ARB */ + { 18800, 0x000088CD }, /* GL_MATRIX13_ARB */ + { 18816, 0x000088CE }, /* GL_MATRIX14_ARB */ + { 18832, 0x000088CF }, /* GL_MATRIX15_ARB */ + { 18848, 0x000088D0 }, /* GL_MATRIX16_ARB */ + { 18864, 0x000088D1 }, /* GL_MATRIX17_ARB */ + { 18880, 0x000088D2 }, /* GL_MATRIX18_ARB */ + { 18896, 0x000088D3 }, /* GL_MATRIX19_ARB */ + { 18912, 0x000088C1 }, /* GL_MATRIX1_ARB */ + { 18927, 0x00008631 }, /* GL_MATRIX1_NV */ + { 18941, 0x000088D4 }, /* GL_MATRIX20_ARB */ + { 18957, 0x000088D5 }, /* GL_MATRIX21_ARB */ + { 18973, 0x000088D6 }, /* GL_MATRIX22_ARB */ + { 18989, 0x000088D7 }, /* GL_MATRIX23_ARB */ + { 19005, 0x000088D8 }, /* GL_MATRIX24_ARB */ + { 19021, 0x000088D9 }, /* GL_MATRIX25_ARB */ + { 19037, 0x000088DA }, /* GL_MATRIX26_ARB */ + { 19053, 0x000088DB }, /* GL_MATRIX27_ARB */ + { 19069, 0x000088DC }, /* GL_MATRIX28_ARB */ + { 19085, 0x000088DD }, /* GL_MATRIX29_ARB */ + { 19101, 0x000088C2 }, /* GL_MATRIX2_ARB */ + { 19116, 0x00008632 }, /* GL_MATRIX2_NV */ + { 19130, 0x000088DE }, /* GL_MATRIX30_ARB */ + { 19146, 0x000088DF }, /* GL_MATRIX31_ARB */ + { 19162, 0x000088C3 }, /* GL_MATRIX3_ARB */ + { 19177, 0x00008633 }, /* GL_MATRIX3_NV */ + { 19191, 0x000088C4 }, /* GL_MATRIX4_ARB */ + { 19206, 0x00008634 }, /* GL_MATRIX4_NV */ + { 19220, 0x000088C5 }, /* GL_MATRIX5_ARB */ + { 19235, 0x00008635 }, /* GL_MATRIX5_NV */ + { 19249, 0x000088C6 }, /* GL_MATRIX6_ARB */ + { 19264, 0x00008636 }, /* GL_MATRIX6_NV */ + { 19278, 0x000088C7 }, /* GL_MATRIX7_ARB */ + { 19293, 0x00008637 }, /* GL_MATRIX7_NV */ + { 19307, 0x000088C8 }, /* GL_MATRIX8_ARB */ + { 19322, 0x000088C9 }, /* GL_MATRIX9_ARB */ + { 19337, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ + { 19363, 0x00008B9E }, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */ + { 19404, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_OES */ + { 19430, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + { 19464, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_OES */ + { 19498, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + { 19529, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_OES */ + { 19560, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + { 19593, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_OES */ + { 19626, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + { 19657, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_OES */ + { 19688, 0x00000BA0 }, /* GL_MATRIX_MODE */ + { 19703, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ + { 19725, 0x00008840 }, /* GL_MATRIX_PALETTE_OES */ + { 19747, 0x00008008 }, /* GL_MAX */ + { 19754, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ + { 19777, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE_OES */ + { 19804, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + { 19836, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ + { 19862, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + { 19895, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + { 19921, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 19955, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ + { 19974, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */ + { 19999, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + { 20028, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + { 20060, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 20096, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + { 20132, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ + { 20172, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ + { 20198, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ + { 20228, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ + { 20253, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ + { 20282, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + { 20311, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ + { 20344, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES */ + { 20377, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ + { 20397, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ + { 20421, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ + { 20445, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ + { 20469, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ + { 20494, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ + { 20512, 0x00008008 }, /* GL_MAX_EXT */ + { 20523, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + { 20558, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ + { 20597, 0x00008DFD }, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */ + { 20629, 0x00008DE0 }, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB */ + { 20665, 0x00008C29 }, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB */ + { 20705, 0x00008DE1 }, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB */ + { 20749, 0x00008DDF }, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB */ + { 20788, 0x00008DDD }, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */ + { 20827, 0x00000D31 }, /* GL_MAX_LIGHTS */ + { 20841, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ + { 20861, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + { 20899, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + { 20928, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ + { 20952, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ + { 20980, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_OES */ + { 21008, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ + { 21031, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 21068, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 21104, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + { 21131, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + { 21160, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + { 21194, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + { 21230, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + { 21257, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + { 21289, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + { 21325, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + { 21354, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + { 21383, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ + { 21411, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + { 21449, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 21493, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 21536, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 21570, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 21609, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 21646, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 21684, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 21727, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 21770, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + { 21800, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + { 21831, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 21867, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 21903, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ + { 21933, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + { 21967, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ + { 22000, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */ + { 22025, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + { 22054, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_OES */ + { 22083, 0x00008D57 }, /* GL_MAX_SAMPLES */ + { 22098, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */ + { 22117, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */ + { 22144, 0x00008504 }, /* GL_MAX_SHININESS_NV */ + { 22164, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ + { 22188, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ + { 22210, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ + { 22236, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + { 22263, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ + { 22294, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ + { 22318, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS_EXT */ + { 22346, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + { 22380, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ + { 22400, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ + { 22427, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ + { 22448, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ + { 22473, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ + { 22498, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + { 22533, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT */ + { 22586, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT */ + { 22633, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT */ + { 22683, 0x00008B4B }, /* GL_MAX_VARYING_COMPONENTS */ + { 22709, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ + { 22731, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ + { 22757, 0x00008DFC }, /* GL_MAX_VARYING_VECTORS */ + { 22780, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ + { 22802, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + { 22828, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + { 22862, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ + { 22900, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + { 22933, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ + { 22970, 0x00008DFB }, /* GL_MAX_VERTEX_UNIFORM_VECTORS */ + { 23000, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ + { 23024, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_OES */ + { 23048, 0x00008DDE }, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */ + { 23085, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ + { 23106, 0x00008DF1 }, /* GL_MEDIUM_FLOAT */ + { 23122, 0x00008DF4 }, /* GL_MEDIUM_INT */ + { 23136, 0x00008007 }, /* GL_MIN */ + { 23143, 0x0000802E }, /* GL_MINMAX */ + { 23153, 0x0000802E }, /* GL_MINMAX_EXT */ + { 23167, 0x0000802F }, /* GL_MINMAX_FORMAT */ + { 23184, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ + { 23205, 0x00008030 }, /* GL_MINMAX_SINK */ + { 23220, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ + { 23239, 0x00008007 }, /* GL_MIN_EXT */ + { 23250, 0x00008370 }, /* GL_MIRRORED_REPEAT */ + { 23269, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ + { 23292, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ + { 23315, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ + { 23335, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ + { 23355, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + { 23385, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ + { 23413, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + { 23441, 0x00001700 }, /* GL_MODELVIEW */ + { 23454, 0x00001700 }, /* GL_MODELVIEW0_ARB */ + { 23472, 0x0000872A }, /* GL_MODELVIEW10_ARB */ + { 23491, 0x0000872B }, /* GL_MODELVIEW11_ARB */ + { 23510, 0x0000872C }, /* GL_MODELVIEW12_ARB */ + { 23529, 0x0000872D }, /* GL_MODELVIEW13_ARB */ + { 23548, 0x0000872E }, /* GL_MODELVIEW14_ARB */ + { 23567, 0x0000872F }, /* GL_MODELVIEW15_ARB */ + { 23586, 0x00008730 }, /* GL_MODELVIEW16_ARB */ + { 23605, 0x00008731 }, /* GL_MODELVIEW17_ARB */ + { 23624, 0x00008732 }, /* GL_MODELVIEW18_ARB */ + { 23643, 0x00008733 }, /* GL_MODELVIEW19_ARB */ + { 23662, 0x0000850A }, /* GL_MODELVIEW1_ARB */ + { 23680, 0x00008734 }, /* GL_MODELVIEW20_ARB */ + { 23699, 0x00008735 }, /* GL_MODELVIEW21_ARB */ + { 23718, 0x00008736 }, /* GL_MODELVIEW22_ARB */ + { 23737, 0x00008737 }, /* GL_MODELVIEW23_ARB */ + { 23756, 0x00008738 }, /* GL_MODELVIEW24_ARB */ + { 23775, 0x00008739 }, /* GL_MODELVIEW25_ARB */ + { 23794, 0x0000873A }, /* GL_MODELVIEW26_ARB */ + { 23813, 0x0000873B }, /* GL_MODELVIEW27_ARB */ + { 23832, 0x0000873C }, /* GL_MODELVIEW28_ARB */ + { 23851, 0x0000873D }, /* GL_MODELVIEW29_ARB */ + { 23870, 0x00008722 }, /* GL_MODELVIEW2_ARB */ + { 23888, 0x0000873E }, /* GL_MODELVIEW30_ARB */ + { 23907, 0x0000873F }, /* GL_MODELVIEW31_ARB */ + { 23926, 0x00008723 }, /* GL_MODELVIEW3_ARB */ + { 23944, 0x00008724 }, /* GL_MODELVIEW4_ARB */ + { 23962, 0x00008725 }, /* GL_MODELVIEW5_ARB */ + { 23980, 0x00008726 }, /* GL_MODELVIEW6_ARB */ + { 23998, 0x00008727 }, /* GL_MODELVIEW7_ARB */ + { 24016, 0x00008728 }, /* GL_MODELVIEW8_ARB */ + { 24034, 0x00008729 }, /* GL_MODELVIEW9_ARB */ + { 24052, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ + { 24072, 0x0000898D }, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */ + { 24114, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ + { 24141, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ + { 24166, 0x00002100 }, /* GL_MODULATE */ + { 24178, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ + { 24198, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ + { 24225, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ + { 24250, 0x00000103 }, /* GL_MULT */ + { 24258, 0x0000809D }, /* GL_MULTISAMPLE */ + { 24273, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ + { 24293, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ + { 24312, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ + { 24331, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ + { 24355, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ + { 24378, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + { 24408, 0x00002A25 }, /* GL_N3F_V3F */ + { 24419, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ + { 24439, 0x0000150E }, /* GL_NAND */ + { 24447, 0x00002600 }, /* GL_NEAREST */ + { 24458, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + { 24489, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + { 24521, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ + { 24546, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ + { 24572, 0x00000200 }, /* GL_NEVER */ + { 24581, 0x00001102 }, /* GL_NICEST */ + { 24591, 0x00000000 }, /* GL_NONE */ + { 24599, 0x00000000 }, /* GL_NONE_OES */ + { 24611, 0x00001505 }, /* GL_NOOP */ + { 24619, 0x00001508 }, /* GL_NOR */ + { 24626, 0x00000BA1 }, /* GL_NORMALIZE */ + { 24639, 0x00008075 }, /* GL_NORMAL_ARRAY */ + { 24655, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + { 24686, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ + { 24721, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ + { 24745, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ + { 24768, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ + { 24789, 0x00008511 }, /* GL_NORMAL_MAP */ + { 24803, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ + { 24821, 0x00008511 }, /* GL_NORMAL_MAP_NV */ + { 24838, 0x00008511 }, /* GL_NORMAL_MAP_OES */ + { 24856, 0x00000205 }, /* GL_NOTEQUAL */ + { 24868, 0x00000000 }, /* GL_NO_ERROR */ + { 24880, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + { 24914, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ + { 24952, 0x000087FE }, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */ + { 24986, 0x00008DF9 }, /* GL_NUM_SHADER_BINARY_FORMATS */ + { 25015, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ + { 25047, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ + { 25089, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ + { 25119, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ + { 25159, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ + { 25190, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ + { 25219, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ + { 25247, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ + { 25277, 0x00002401 }, /* GL_OBJECT_LINEAR */ + { 25294, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ + { 25320, 0x00002501 }, /* GL_OBJECT_PLANE */ + { 25336, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ + { 25371, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ + { 25393, 0x00009112 }, /* GL_OBJECT_TYPE */ + { 25408, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ + { 25427, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ + { 25457, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ + { 25478, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ + { 25506, 0x00000001 }, /* GL_ONE */ + { 25513, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + { 25541, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ + { 25573, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ + { 25601, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ + { 25633, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ + { 25656, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ + { 25679, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ + { 25702, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ + { 25725, 0x00008598 }, /* GL_OPERAND0_ALPHA */ + { 25743, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ + { 25765, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ + { 25787, 0x00008590 }, /* GL_OPERAND0_RGB */ + { 25803, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ + { 25823, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ + { 25843, 0x00008599 }, /* GL_OPERAND1_ALPHA */ + { 25861, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ + { 25883, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ + { 25905, 0x00008591 }, /* GL_OPERAND1_RGB */ + { 25921, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ + { 25941, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ + { 25961, 0x0000859A }, /* GL_OPERAND2_ALPHA */ + { 25979, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ + { 26001, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ + { 26023, 0x00008592 }, /* GL_OPERAND2_RGB */ + { 26039, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ + { 26059, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ + { 26079, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ + { 26100, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ + { 26119, 0x00001507 }, /* GL_OR */ + { 26125, 0x00000A01 }, /* GL_ORDER */ + { 26134, 0x0000150D }, /* GL_OR_INVERTED */ + { 26149, 0x0000150B }, /* GL_OR_REVERSE */ + { 26163, 0x00000505 }, /* GL_OUT_OF_MEMORY */ + { 26180, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ + { 26198, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ + { 26219, 0x00008758 }, /* GL_PACK_INVERT_MESA */ + { 26239, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ + { 26257, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ + { 26276, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ + { 26296, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ + { 26316, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ + { 26334, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ + { 26353, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ + { 26378, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ + { 26402, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ + { 26423, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ + { 26445, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ + { 26467, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ + { 26492, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ + { 26516, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ + { 26537, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ + { 26559, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ + { 26581, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ + { 26603, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ + { 26634, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ + { 26654, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + { 26679, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ + { 26699, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + { 26724, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ + { 26744, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + { 26769, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ + { 26789, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + { 26814, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ + { 26834, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + { 26859, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ + { 26879, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + { 26904, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ + { 26924, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + { 26949, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ + { 26969, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + { 26994, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ + { 27014, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + { 27039, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ + { 27059, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + { 27084, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ + { 27102, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ + { 27123, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ + { 27152, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ + { 27185, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ + { 27210, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ + { 27233, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + { 27264, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ + { 27299, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ + { 27326, 0x00001B00 }, /* GL_POINT */ + { 27335, 0x00000000 }, /* GL_POINTS */ + { 27345, 0x00000002 }, /* GL_POINT_BIT */ + { 27358, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ + { 27388, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ + { 27422, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ + { 27456, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ + { 27491, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ + { 27520, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ + { 27553, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ + { 27586, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ + { 27620, 0x00000B11 }, /* GL_POINT_SIZE */ + { 27634, 0x00008B9F }, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */ + { 27673, 0x00008B9C }, /* GL_POINT_SIZE_ARRAY_OES */ + { 27697, 0x0000898C }, /* GL_POINT_SIZE_ARRAY_POINTER_OES */ + { 27729, 0x0000898B }, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */ + { 27760, 0x0000898A }, /* GL_POINT_SIZE_ARRAY_TYPE_OES */ + { 27789, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ + { 27815, 0x00008127 }, /* GL_POINT_SIZE_MAX */ + { 27833, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ + { 27855, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ + { 27877, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ + { 27900, 0x00008126 }, /* GL_POINT_SIZE_MIN */ + { 27918, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ + { 27940, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ + { 27962, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ + { 27985, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ + { 28005, 0x00000B10 }, /* GL_POINT_SMOOTH */ + { 28021, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ + { 28042, 0x00008861 }, /* GL_POINT_SPRITE */ + { 28058, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ + { 28078, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ + { 28107, 0x00008861 }, /* GL_POINT_SPRITE_NV */ + { 28126, 0x00008861 }, /* GL_POINT_SPRITE_OES */ + { 28146, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ + { 28172, 0x00000701 }, /* GL_POINT_TOKEN */ + { 28187, 0x00000009 }, /* GL_POLYGON */ + { 28198, 0x00000008 }, /* GL_POLYGON_BIT */ + { 28213, 0x00000B40 }, /* GL_POLYGON_MODE */ + { 28229, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ + { 28252, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ + { 28277, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ + { 28300, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ + { 28323, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ + { 28347, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ + { 28371, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ + { 28389, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ + { 28412, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ + { 28431, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ + { 28454, 0x00000703 }, /* GL_POLYGON_TOKEN */ + { 28471, 0x00001203 }, /* GL_POSITION */ + { 28483, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + { 28515, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ + { 28551, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + { 28584, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ + { 28621, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + { 28652, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ + { 28687, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + { 28719, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ + { 28755, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + { 28788, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + { 28820, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ + { 28856, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + { 28889, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ + { 28926, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + { 28956, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ + { 28990, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + { 29021, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ + { 29056, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + { 29087, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ + { 29122, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + { 29154, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ + { 29190, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + { 29220, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ + { 29254, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + { 29285, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ + { 29320, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + { 29352, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + { 29383, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ + { 29418, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + { 29450, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ + { 29486, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ + { 29515, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ + { 29548, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ + { 29578, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ + { 29612, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + { 29651, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + { 29684, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + { 29724, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + { 29758, 0x00008578 }, /* GL_PREVIOUS */ + { 29770, 0x00008578 }, /* GL_PREVIOUS_ARB */ + { 29786, 0x00008578 }, /* GL_PREVIOUS_EXT */ + { 29802, 0x00008577 }, /* GL_PRIMARY_COLOR */ + { 29819, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ + { 29840, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ + { 29861, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED_EXT */ + { 29889, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 29922, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 29954, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ + { 29977, 0x000087FF }, /* GL_PROGRAM_BINARY_FORMATS_OES */ + { 30007, 0x00008741 }, /* GL_PROGRAM_BINARY_LENGTH_OES */ + { 30036, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ + { 30059, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ + { 30089, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ + { 30118, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ + { 30146, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ + { 30168, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + { 30196, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + { 30224, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ + { 30246, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ + { 30267, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 30307, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 30346, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 30376, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 30411, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 30444, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 30478, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 30517, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 30556, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ + { 30578, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ + { 30604, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ + { 30628, 0x00008642 }, /* GL_PROGRAM_POINT_SIZE_ARB */ + { 30654, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ + { 30677, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ + { 30699, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ + { 30720, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ + { 30741, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ + { 30768, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 30800, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 30832, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + { 30867, 0x00001701 }, /* GL_PROJECTION */ + { 30881, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ + { 30902, 0x0000898E }, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */ + { 30945, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ + { 30971, 0x00008E4F }, /* GL_PROVOKING_VERTEX */ + { 30991, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */ + { 31015, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ + { 31036, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ + { 31055, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ + { 31078, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + { 31117, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + { 31155, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ + { 31175, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + { 31205, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ + { 31229, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ + { 31249, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + { 31279, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ + { 31303, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ + { 31323, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + { 31356, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ + { 31382, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ + { 31412, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + { 31443, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ + { 31473, 0x00008A1D }, /* GL_PURGEABLE_APPLE */ + { 31492, 0x00002003 }, /* GL_Q */ + { 31497, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ + { 31522, 0x00000007 }, /* GL_QUADS */ + { 31531, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ + { 31575, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ + { 31623, 0x00008614 }, /* GL_QUAD_MESH_SUN */ + { 31640, 0x00000008 }, /* GL_QUAD_STRIP */ + { 31654, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */ + { 31684, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */ + { 31711, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ + { 31733, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ + { 31759, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */ + { 31779, 0x00008866 }, /* GL_QUERY_RESULT */ + { 31795, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ + { 31815, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ + { 31841, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ + { 31871, 0x00008E13 }, /* GL_QUERY_WAIT_NV */ + { 31888, 0x00002002 }, /* GL_R */ + { 31893, 0x00002A10 }, /* GL_R3_G3_B2 */ + { 31905, 0x00008C89 }, /* GL_RASTERIZER_DISCARD_EXT */ + { 31931, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + { 31964, 0x00000C02 }, /* GL_READ_BUFFER */ + { 31979, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ + { 31999, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */ + { 32027, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + { 32059, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ + { 32083, 0x000088B8 }, /* GL_READ_ONLY */ + { 32096, 0x000088B8 }, /* GL_READ_ONLY_ARB */ + { 32113, 0x000088BA }, /* GL_READ_WRITE */ + { 32127, 0x000088BA }, /* GL_READ_WRITE_ARB */ + { 32145, 0x00001903 }, /* GL_RED */ + { 32152, 0x00008016 }, /* GL_REDUCE */ + { 32162, 0x00008016 }, /* GL_REDUCE_EXT */ + { 32176, 0x00000D15 }, /* GL_RED_BIAS */ + { 32188, 0x00000D52 }, /* GL_RED_BITS */ + { 32200, 0x00000D14 }, /* GL_RED_SCALE */ + { 32213, 0x00008512 }, /* GL_REFLECTION_MAP */ + { 32231, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ + { 32253, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ + { 32274, 0x00008512 }, /* GL_REFLECTION_MAP_OES */ + { 32296, 0x00008A19 }, /* GL_RELEASED_APPLE */ + { 32314, 0x00001C00 }, /* GL_RENDER */ + { 32324, 0x00008D41 }, /* GL_RENDERBUFFER */ + { 32340, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ + { 32367, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE_OES */ + { 32398, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */ + { 32422, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ + { 32450, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_OES */ + { 32478, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ + { 32504, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE_OES */ + { 32534, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ + { 32561, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE_OES */ + { 32592, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ + { 32612, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ + { 32639, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE_OES */ + { 32670, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ + { 32693, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ + { 32720, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_OES */ + { 32747, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + { 32779, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ + { 32815, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_OES */ + { 32851, 0x00008D41 }, /* GL_RENDERBUFFER_OES */ + { 32871, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ + { 32896, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE_OES */ + { 32925, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ + { 32949, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */ + { 32977, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ + { 33006, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE_OES */ + { 33039, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ + { 33061, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ + { 33087, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_OES */ + { 33113, 0x00001F01 }, /* GL_RENDERER */ + { 33125, 0x00000C40 }, /* GL_RENDER_MODE */ + { 33140, 0x00002901 }, /* GL_REPEAT */ + { 33150, 0x00001E01 }, /* GL_REPLACE */ + { 33161, 0x00008062 }, /* GL_REPLACE_EXT */ + { 33176, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ + { 33199, 0x0000803A }, /* GL_RESCALE_NORMAL */ + { 33217, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ + { 33239, 0x00008A1B }, /* GL_RETAINED_APPLE */ + { 33257, 0x00000102 }, /* GL_RETURN */ + { 33267, 0x00001907 }, /* GL_RGB */ + { 33274, 0x00008052 }, /* GL_RGB10 */ + { 33283, 0x00008059 }, /* GL_RGB10_A2 */ + { 33295, 0x00008059 }, /* GL_RGB10_A2_EXT */ + { 33311, 0x00008052 }, /* GL_RGB10_EXT */ + { 33324, 0x00008053 }, /* GL_RGB12 */ + { 33333, 0x00008053 }, /* GL_RGB12_EXT */ + { 33346, 0x00008054 }, /* GL_RGB16 */ + { 33355, 0x00008054 }, /* GL_RGB16_EXT */ + { 33368, 0x0000804E }, /* GL_RGB2_EXT */ + { 33380, 0x0000804F }, /* GL_RGB4 */ + { 33388, 0x0000804F }, /* GL_RGB4_EXT */ + { 33400, 0x000083A1 }, /* GL_RGB4_S3TC */ + { 33413, 0x00008050 }, /* GL_RGB5 */ + { 33421, 0x00008D62 }, /* GL_RGB565 */ + { 33431, 0x00008D62 }, /* GL_RGB565_OES */ + { 33445, 0x00008057 }, /* GL_RGB5_A1 */ + { 33456, 0x00008057 }, /* GL_RGB5_A1_EXT */ + { 33471, 0x00008057 }, /* GL_RGB5_A1_OES */ + { 33486, 0x00008050 }, /* GL_RGB5_EXT */ + { 33498, 0x00008051 }, /* GL_RGB8 */ + { 33506, 0x00008051 }, /* GL_RGB8_EXT */ + { 33518, 0x00008051 }, /* GL_RGB8_OES */ + { 33530, 0x00001908 }, /* GL_RGBA */ + { 33538, 0x0000805A }, /* GL_RGBA12 */ + { 33548, 0x0000805A }, /* GL_RGBA12_EXT */ + { 33562, 0x0000805B }, /* GL_RGBA16 */ + { 33572, 0x0000805B }, /* GL_RGBA16_EXT */ + { 33586, 0x00008055 }, /* GL_RGBA2 */ + { 33595, 0x00008055 }, /* GL_RGBA2_EXT */ + { 33608, 0x00008056 }, /* GL_RGBA4 */ + { 33617, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ + { 33636, 0x00008056 }, /* GL_RGBA4_EXT */ + { 33649, 0x00008056 }, /* GL_RGBA4_OES */ + { 33662, 0x000083A3 }, /* GL_RGBA4_S3TC */ + { 33676, 0x00008058 }, /* GL_RGBA8 */ + { 33685, 0x00008058 }, /* GL_RGBA8_EXT */ + { 33698, 0x00008058 }, /* GL_RGBA8_OES */ + { 33711, 0x00008F97 }, /* GL_RGBA8_SNORM */ + { 33726, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ + { 33744, 0x00000C31 }, /* GL_RGBA_MODE */ + { 33757, 0x000083A2 }, /* GL_RGBA_S3TC */ + { 33770, 0x00008F93 }, /* GL_RGBA_SNORM */ + { 33784, 0x000083A0 }, /* GL_RGB_S3TC */ + { 33796, 0x00008573 }, /* GL_RGB_SCALE */ + { 33809, 0x00008573 }, /* GL_RGB_SCALE_ARB */ + { 33826, 0x00008573 }, /* GL_RGB_SCALE_EXT */ + { 33843, 0x00000407 }, /* GL_RIGHT */ + { 33852, 0x00002000 }, /* GL_S */ + { 33857, 0x00008B5D }, /* GL_SAMPLER_1D */ + { 33871, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ + { 33892, 0x00008B5E }, /* GL_SAMPLER_2D */ + { 33906, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ + { 33927, 0x00008B5F }, /* GL_SAMPLER_3D */ + { 33941, 0x00008B5F }, /* GL_SAMPLER_3D_OES */ + { 33959, 0x00008B60 }, /* GL_SAMPLER_CUBE */ + { 33975, 0x000080A9 }, /* GL_SAMPLES */ + { 33986, 0x000086B4 }, /* GL_SAMPLES_3DFX */ + { 34002, 0x000080A9 }, /* GL_SAMPLES_ARB */ + { 34017, 0x00008914 }, /* GL_SAMPLES_PASSED */ + { 34035, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ + { 34057, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + { 34085, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ + { 34117, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ + { 34140, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ + { 34167, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ + { 34185, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ + { 34208, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ + { 34230, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ + { 34249, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ + { 34272, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ + { 34298, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ + { 34328, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ + { 34353, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ + { 34382, 0x00080000 }, /* GL_SCISSOR_BIT */ + { 34397, 0x00000C10 }, /* GL_SCISSOR_BOX */ + { 34412, 0x00000C11 }, /* GL_SCISSOR_TEST */ + { 34428, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ + { 34453, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + { 34493, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 34537, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + { 34570, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + { 34600, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + { 34632, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + { 34662, 0x00001C02 }, /* GL_SELECT */ + { 34672, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ + { 34700, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ + { 34725, 0x00008012 }, /* GL_SEPARABLE_2D */ + { 34741, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS_EXT */ + { 34765, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ + { 34792, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ + { 34823, 0x0000150F }, /* GL_SET */ + { 34830, 0x00008DF8 }, /* GL_SHADER_BINARY_FORMATS */ + { 34855, 0x00008DFA }, /* GL_SHADER_COMPILER */ + { 34874, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ + { 34895, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ + { 34919, 0x00008B4F }, /* GL_SHADER_TYPE */ + { 34934, 0x00000B54 }, /* GL_SHADE_MODEL */ + { 34949, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ + { 34977, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ + { 35000, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + { 35030, 0x00001601 }, /* GL_SHININESS */ + { 35043, 0x00001402 }, /* GL_SHORT */ + { 35052, 0x00009119 }, /* GL_SIGNALED */ + { 35064, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ + { 35085, 0x000081F9 }, /* GL_SINGLE_COLOR */ + { 35101, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ + { 35121, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ + { 35140, 0x00008C46 }, /* GL_SLUMINANCE */ + { 35154, 0x00008C47 }, /* GL_SLUMINANCE8 */ + { 35169, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ + { 35191, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ + { 35211, 0x00001D01 }, /* GL_SMOOTH */ + { 35221, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ + { 35254, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ + { 35281, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ + { 35314, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ + { 35341, 0x00008588 }, /* GL_SOURCE0_ALPHA */ + { 35358, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ + { 35379, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ + { 35400, 0x00008580 }, /* GL_SOURCE0_RGB */ + { 35415, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ + { 35434, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ + { 35453, 0x00008589 }, /* GL_SOURCE1_ALPHA */ + { 35470, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ + { 35491, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ + { 35512, 0x00008581 }, /* GL_SOURCE1_RGB */ + { 35527, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ + { 35546, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ + { 35565, 0x0000858A }, /* GL_SOURCE2_ALPHA */ + { 35582, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ + { 35603, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ + { 35624, 0x00008582 }, /* GL_SOURCE2_RGB */ + { 35639, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ + { 35658, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ + { 35677, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ + { 35697, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ + { 35715, 0x00001202 }, /* GL_SPECULAR */ + { 35727, 0x00002402 }, /* GL_SPHERE_MAP */ + { 35741, 0x00001206 }, /* GL_SPOT_CUTOFF */ + { 35756, 0x00001204 }, /* GL_SPOT_DIRECTION */ + { 35774, 0x00001205 }, /* GL_SPOT_EXPONENT */ + { 35791, 0x00008588 }, /* GL_SRC0_ALPHA */ + { 35805, 0x00008580 }, /* GL_SRC0_RGB */ + { 35817, 0x00008589 }, /* GL_SRC1_ALPHA */ + { 35831, 0x00008581 }, /* GL_SRC1_RGB */ + { 35843, 0x0000858A }, /* GL_SRC2_ALPHA */ + { 35857, 0x00008582 }, /* GL_SRC2_RGB */ + { 35869, 0x00000302 }, /* GL_SRC_ALPHA */ + { 35882, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ + { 35904, 0x00000300 }, /* GL_SRC_COLOR */ + { 35917, 0x00008C40 }, /* GL_SRGB */ + { 35925, 0x00008C41 }, /* GL_SRGB8 */ + { 35934, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ + { 35950, 0x00008C42 }, /* GL_SRGB_ALPHA */ + { 35964, 0x00000503 }, /* GL_STACK_OVERFLOW */ + { 35982, 0x00000504 }, /* GL_STACK_UNDERFLOW */ + { 36001, 0x000088E6 }, /* GL_STATIC_COPY */ + { 36016, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ + { 36035, 0x000088E4 }, /* GL_STATIC_DRAW */ + { 36050, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ + { 36069, 0x000088E5 }, /* GL_STATIC_READ */ + { 36084, 0x000088E5 }, /* GL_STATIC_READ_ARB */ + { 36103, 0x00001802 }, /* GL_STENCIL */ + { 36114, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ + { 36136, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ + { 36162, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_OES */ + { 36188, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ + { 36209, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ + { 36234, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ + { 36255, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ + { 36280, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + { 36312, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ + { 36348, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + { 36380, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ + { 36416, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ + { 36436, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ + { 36463, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ + { 36489, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 36505, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 36527, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 36550, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 36566, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 36582, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 36599, 0x00008D46 }, /* GL_STENCIL_INDEX1 */ + { 36617, 0x00008D49 }, /* GL_STENCIL_INDEX16 */ + { 36636, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 36659, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 36681, 0x00008D46 }, /* GL_STENCIL_INDEX1_OES */ + { 36703, 0x00008D47 }, /* GL_STENCIL_INDEX4 */ + { 36721, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 36743, 0x00008D47 }, /* GL_STENCIL_INDEX4_OES */ + { 36765, 0x00008D48 }, /* GL_STENCIL_INDEX8 */ + { 36783, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 36805, 0x00008D48 }, /* GL_STENCIL_INDEX8_OES */ + { 36827, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 36848, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 36875, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 36902, 0x00000B97 }, /* GL_STENCIL_REF */ + { 36917, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 36933, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 36962, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 36984, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 37005, 0x00000C33 }, /* GL_STEREO */ + { 37015, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */ + { 37039, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */ + { 37064, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */ + { 37088, 0x000088E2 }, /* GL_STREAM_COPY */ + { 37103, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 37122, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 37137, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 37156, 0x000088E1 }, /* GL_STREAM_READ */ + { 37171, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 37190, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 37207, 0x000084E7 }, /* GL_SUBTRACT */ + { 37219, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 37235, 0x00009113 }, /* GL_SYNC_CONDITION */ + { 37253, 0x00009116 }, /* GL_SYNC_FENCE */ + { 37267, 0x00009115 }, /* GL_SYNC_FLAGS */ + { 37281, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */ + { 37308, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ + { 37338, 0x00009114 }, /* GL_SYNC_STATUS */ + { 37353, 0x00002001 }, /* GL_T */ + { 37358, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 37373, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 37392, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 37408, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 37423, 0x00002A27 }, /* GL_T2F_V3F */ + { 37434, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 37453, 0x00002A28 }, /* GL_T4F_V4F */ + { 37464, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 37487, 0x00001702 }, /* GL_TEXTURE */ + { 37498, 0x000084C0 }, /* GL_TEXTURE0 */ + { 37510, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 37526, 0x000084C1 }, /* GL_TEXTURE1 */ + { 37538, 0x000084CA }, /* GL_TEXTURE10 */ + { 37551, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 37568, 0x000084CB }, /* GL_TEXTURE11 */ + { 37581, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 37598, 0x000084CC }, /* GL_TEXTURE12 */ + { 37611, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 37628, 0x000084CD }, /* GL_TEXTURE13 */ + { 37641, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 37658, 0x000084CE }, /* GL_TEXTURE14 */ + { 37671, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 37688, 0x000084CF }, /* GL_TEXTURE15 */ + { 37701, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 37718, 0x000084D0 }, /* GL_TEXTURE16 */ + { 37731, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 37748, 0x000084D1 }, /* GL_TEXTURE17 */ + { 37761, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 37778, 0x000084D2 }, /* GL_TEXTURE18 */ + { 37791, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 37808, 0x000084D3 }, /* GL_TEXTURE19 */ + { 37821, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 37838, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 37854, 0x000084C2 }, /* GL_TEXTURE2 */ + { 37866, 0x000084D4 }, /* GL_TEXTURE20 */ + { 37879, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 37896, 0x000084D5 }, /* GL_TEXTURE21 */ + { 37909, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 37926, 0x000084D6 }, /* GL_TEXTURE22 */ + { 37939, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 37956, 0x000084D7 }, /* GL_TEXTURE23 */ + { 37969, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 37986, 0x000084D8 }, /* GL_TEXTURE24 */ + { 37999, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 38016, 0x000084D9 }, /* GL_TEXTURE25 */ + { 38029, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 38046, 0x000084DA }, /* GL_TEXTURE26 */ + { 38059, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 38076, 0x000084DB }, /* GL_TEXTURE27 */ + { 38089, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 38106, 0x000084DC }, /* GL_TEXTURE28 */ + { 38119, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 38136, 0x000084DD }, /* GL_TEXTURE29 */ + { 38149, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 38166, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 38182, 0x000084C3 }, /* GL_TEXTURE3 */ + { 38194, 0x000084DE }, /* GL_TEXTURE30 */ + { 38207, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 38224, 0x000084DF }, /* GL_TEXTURE31 */ + { 38237, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 38254, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 38270, 0x000084C4 }, /* GL_TEXTURE4 */ + { 38282, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 38298, 0x000084C5 }, /* GL_TEXTURE5 */ + { 38310, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 38326, 0x000084C6 }, /* GL_TEXTURE6 */ + { 38338, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 38354, 0x000084C7 }, /* GL_TEXTURE7 */ + { 38366, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 38382, 0x000084C8 }, /* GL_TEXTURE8 */ + { 38394, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 38410, 0x000084C9 }, /* GL_TEXTURE9 */ + { 38422, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 38438, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 38452, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ + { 38476, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 38490, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ + { 38514, 0x0000806F }, /* GL_TEXTURE_3D */ + { 38528, 0x0000806F }, /* GL_TEXTURE_3D_OES */ + { 38546, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 38568, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 38594, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 38616, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 38638, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + { 38670, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 38692, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + { 38724, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 38746, 0x0000806A }, /* GL_TEXTURE_BINDING_3D_OES */ + { 38772, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 38800, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 38832, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_OES */ + { 38864, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 38897, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 38929, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 38944, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 38965, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 38990, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 39008, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 39032, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 39063, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 39093, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 39123, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 39158, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 39189, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 39227, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 39254, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 39286, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 39320, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 39344, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 39372, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 39396, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 39424, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 39457, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 39481, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 39503, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 39525, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 39551, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 39585, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 39618, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 39655, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 39683, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 39715, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 39738, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 39776, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 39818, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 39849, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 39877, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 39907, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 39935, 0x00008B9D }, /* GL_TEXTURE_CROP_RECT_OES */ + { 39960, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 39980, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 40004, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 40035, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 40070, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES */ + { 40105, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 40136, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 40171, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES */ + { 40206, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 40237, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 40272, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES */ + { 40307, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_OES */ + { 40331, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 40362, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 40397, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES */ + { 40432, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 40463, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 40498, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES */ + { 40533, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 40564, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 40599, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES */ + { 40634, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + { 40663, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 40680, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 40702, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 40728, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 40743, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 40764, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 40784, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 40810, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL_EXT */ + { 40840, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 40860, 0x00002500 }, /* GL_TEXTURE_GEN_MODE_OES */ + { 40884, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 40901, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 40918, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 40935, 0x00008D60 }, /* GL_TEXTURE_GEN_STR_OES */ + { 40958, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 40975, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 41000, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 41022, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 41048, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 41066, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 41092, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 41118, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 41148, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 41175, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 41200, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 41220, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 41244, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 41271, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 41298, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 41325, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 41351, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 41381, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 41403, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 41421, 0x0000898F }, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */ + { 41461, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 41491, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 41519, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 41547, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 41575, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 41596, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 41615, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 41637, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 41656, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 41676, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ + { 41706, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */ + { 41737, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 41762, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 41786, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 41806, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 41830, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 41850, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 41873, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ + { 41897, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */ + { 41925, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */ + { 41955, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 41980, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 42014, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 42031, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 42049, 0x00008072 }, /* GL_TEXTURE_WRAP_R_OES */ + { 42071, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 42089, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 42107, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */ + { 42126, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ + { 42146, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 42165, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 42194, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 42211, 0x00008E22 }, /* GL_TRANSFORM_FEEDBACK */ + { 42233, 0x00008E25 }, /* GL_TRANSFORM_FEEDBACK_BINDING */ + { 42263, 0x00008E24 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */ + { 42299, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT */ + { 42340, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER_EXT */ + { 42373, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT */ + { 42411, 0x00008E23 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ + { 42447, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT */ + { 42485, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT */ + { 42524, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT */ + { 42569, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS_EXT */ + { 42604, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT */ + { 42649, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 42675, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 42705, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 42737, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 42767, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 42801, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 42817, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 42848, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 42883, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 42911, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 42943, 0x00000004 }, /* GL_TRIANGLES */ + { 42956, 0x0000000C }, /* GL_TRIANGLES_ADJACENCY_ARB */ + { 42983, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 42999, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 43020, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 43038, 0x0000000D }, /* GL_TRIANGLE_STRIP_ADJACENCY_ARB */ + { 43070, 0x00000001 }, /* GL_TRUE */ + { 43078, 0x00008A1C }, /* GL_UNDEFINED_APPLE */ + { 43097, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 43117, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 43140, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 43160, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 43181, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 43203, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 43225, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 43245, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 43266, 0x00009118 }, /* GL_UNSIGNALED */ + { 43280, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 43297, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 43324, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 43347, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 43363, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 43390, 0x00008DF6 }, /* GL_UNSIGNED_INT_10_10_10_2_OES */ + { 43421, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ + { 43442, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */ + { 43467, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 43491, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_OES */ + { 43516, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 43547, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV_EXT */ + { 43582, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 43606, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 43634, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ + { 43657, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 43675, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 43705, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT */ + { 43739, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 43765, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 43795, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT */ + { 43829, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 43855, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 43879, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 43907, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 43935, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 43962, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 43994, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 44025, 0x00008CA2 }, /* GL_UPPER_LEFT */ + { 44039, 0x00002A20 }, /* GL_V2F */ + { 44046, 0x00002A21 }, /* GL_V3F */ + { 44053, 0x00008B83 }, /* GL_VALIDATE_STATUS */ + { 44072, 0x00001F00 }, /* GL_VENDOR */ + { 44082, 0x00001F02 }, /* GL_VERSION */ + { 44093, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 44109, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */ + { 44133, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + { 44163, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 44194, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 44229, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 44253, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 44274, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 44297, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 44318, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 44345, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 44373, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 44401, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 44429, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 44457, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 44485, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 44513, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 44540, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 44567, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 44594, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 44621, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 44648, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 44675, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 44702, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 44729, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 44756, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 44794, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 44836, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + { 44867, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 44902, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + { 44936, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 44974, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + { 45005, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 45040, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + { 45068, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 45100, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + { 45130, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 45164, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + { 45192, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 45224, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 45244, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 45266, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 45295, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 45316, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + { 45345, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 45378, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 45410, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + { 45437, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 45468, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 45498, 0x00008B31 }, /* GL_VERTEX_SHADER */ + { 45515, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 45536, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 45563, 0x00000BA2 }, /* GL_VIEWPORT */ + { 45575, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 45591, 0x00008A1A }, /* GL_VOLATILE_APPLE */ + { 45609, 0x0000911D }, /* GL_WAIT_FAILED */ + { 45624, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 45644, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 45675, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 45710, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_OES */ + { 45745, 0x000086AD }, /* GL_WEIGHT_ARRAY_OES */ + { 45765, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 45793, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_OES */ + { 45821, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 45846, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_OES */ + { 45871, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 45898, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_OES */ + { 45925, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 45950, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_OES */ + { 45975, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 45999, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 46018, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 46032, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 46050, 0x000088B9 }, /* GL_WRITE_ONLY_OES */ + { 46068, 0x00001506 }, /* GL_XOR */ + { 46075, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 46094, 0x00008757 }, /* GL_YCBCR_MESA */ + { 46108, 0x00000000 }, /* GL_ZERO */ + { 46116, 0x00000D16 }, /* GL_ZOOM_X */ + { 46126, 0x00000D17 }, /* GL_ZOOM_Y */ }; -static const unsigned reduced_enums[1357] = +static const unsigned reduced_enums[1423] = { - 480, /* GL_FALSE */ - 703, /* GL_LINES */ - 705, /* GL_LINE_LOOP */ - 712, /* GL_LINE_STRIP */ - 1774, /* GL_TRIANGLES */ - 1777, /* GL_TRIANGLE_STRIP */ - 1775, /* GL_TRIANGLE_FAN */ - 1288, /* GL_QUADS */ - 1292, /* GL_QUAD_STRIP */ - 1173, /* GL_POLYGON */ - 1185, /* GL_POLYGON_STIPPLE_BIT */ - 1134, /* GL_PIXEL_MODE_BIT */ - 690, /* GL_LIGHTING_BIT */ - 510, /* GL_FOG_BIT */ + 500, /* GL_FALSE */ + 760, /* GL_LINES */ + 763, /* GL_LINE_LOOP */ + 770, /* GL_LINE_STRIP */ + 1934, /* GL_TRIANGLES */ + 1938, /* GL_TRIANGLE_STRIP */ + 1936, /* GL_TRIANGLE_FAN */ + 1393, /* GL_QUADS */ + 1397, /* GL_QUAD_STRIP */ + 1273, /* GL_POLYGON */ + 761, /* GL_LINES_ADJACENCY_ARB */ + 771, /* GL_LINE_STRIP_ADJACENCY_ARB */ + 1935, /* GL_TRIANGLES_ADJACENCY_ARB */ + 1939, /* GL_TRIANGLE_STRIP_ADJACENCY_ARB */ + 1285, /* GL_POLYGON_STIPPLE_BIT */ + 1228, /* GL_PIXEL_MODE_BIT */ + 747, /* GL_LIGHTING_BIT */ + 532, /* GL_FOG_BIT */ 8, /* GL_ACCUM */ - 722, /* GL_LOAD */ - 1353, /* GL_RETURN */ - 1006, /* GL_MULT */ + 781, /* GL_LOAD */ + 1471, /* GL_RETURN */ + 1096, /* GL_MULT */ 23, /* GL_ADD */ - 1022, /* GL_NEVER */ - 680, /* GL_LESS */ - 470, /* GL_EQUAL */ - 679, /* GL_LEQUAL */ - 600, /* GL_GREATER */ - 1037, /* GL_NOTEQUAL */ - 599, /* GL_GEQUAL */ + 1112, /* GL_NEVER */ + 737, /* GL_LESS */ + 490, /* GL_EQUAL */ + 736, /* GL_LEQUAL */ + 649, /* GL_GREATER */ + 1129, /* GL_NOTEQUAL */ + 648, /* GL_GEQUAL */ 47, /* GL_ALWAYS */ - 1494, /* GL_SRC_COLOR */ - 1067, /* GL_ONE_MINUS_SRC_COLOR */ - 1492, /* GL_SRC_ALPHA */ - 1066, /* GL_ONE_MINUS_SRC_ALPHA */ - 449, /* GL_DST_ALPHA */ - 1064, /* GL_ONE_MINUS_DST_ALPHA */ - 450, /* GL_DST_COLOR */ - 1065, /* GL_ONE_MINUS_DST_COLOR */ - 1493, /* GL_SRC_ALPHA_SATURATE */ - 587, /* GL_FRONT_LEFT */ - 588, /* GL_FRONT_RIGHT */ + 1622, /* GL_SRC_COLOR */ + 1161, /* GL_ONE_MINUS_SRC_COLOR */ + 1620, /* GL_SRC_ALPHA */ + 1160, /* GL_ONE_MINUS_SRC_ALPHA */ + 469, /* GL_DST_ALPHA */ + 1158, /* GL_ONE_MINUS_DST_ALPHA */ + 470, /* GL_DST_COLOR */ + 1159, /* GL_ONE_MINUS_DST_COLOR */ + 1621, /* GL_SRC_ALPHA_SATURATE */ + 629, /* GL_FRONT_LEFT */ + 630, /* GL_FRONT_RIGHT */ 69, /* GL_BACK_LEFT */ 70, /* GL_BACK_RIGHT */ - 584, /* GL_FRONT */ + 626, /* GL_FRONT */ 68, /* GL_BACK */ - 678, /* GL_LEFT */ - 1395, /* GL_RIGHT */ - 585, /* GL_FRONT_AND_BACK */ + 735, /* GL_LEFT */ + 1519, /* GL_RIGHT */ + 627, /* GL_FRONT_AND_BACK */ 63, /* GL_AUX0 */ 64, /* GL_AUX1 */ 65, /* GL_AUX2 */ 66, /* GL_AUX3 */ - 667, /* GL_INVALID_ENUM */ - 671, /* GL_INVALID_VALUE */ - 670, /* GL_INVALID_OPERATION */ - 1499, /* GL_STACK_OVERFLOW */ - 1500, /* GL_STACK_UNDERFLOW */ - 1092, /* GL_OUT_OF_MEMORY */ - 668, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + 723, /* GL_INVALID_ENUM */ + 728, /* GL_INVALID_VALUE */ + 727, /* GL_INVALID_OPERATION */ + 1627, /* GL_STACK_OVERFLOW */ + 1628, /* GL_STACK_UNDERFLOW */ + 1186, /* GL_OUT_OF_MEMORY */ + 724, /* GL_INVALID_FRAMEBUFFER_OPERATION */ 0, /* GL_2D */ 2, /* GL_3D */ 3, /* GL_3D_COLOR */ 4, /* GL_3D_COLOR_TEXTURE */ 6, /* GL_4D_COLOR_TEXTURE */ - 1112, /* GL_PASS_THROUGH_TOKEN */ - 1172, /* GL_POINT_TOKEN */ - 713, /* GL_LINE_TOKEN */ - 1186, /* GL_POLYGON_TOKEN */ - 74, /* GL_BITMAP_TOKEN */ - 448, /* GL_DRAW_PIXEL_TOKEN */ - 302, /* GL_COPY_PIXEL_TOKEN */ - 706, /* GL_LINE_RESET_TOKEN */ - 473, /* GL_EXP */ - 474, /* GL_EXP2 */ - 338, /* GL_CW */ - 126, /* GL_CCW */ - 147, /* GL_COEFF */ - 1089, /* GL_ORDER */ - 385, /* GL_DOMAIN */ - 312, /* GL_CURRENT_COLOR */ - 315, /* GL_CURRENT_INDEX */ - 321, /* GL_CURRENT_NORMAL */ - 334, /* GL_CURRENT_TEXTURE_COORDS */ - 326, /* GL_CURRENT_RASTER_COLOR */ - 328, /* GL_CURRENT_RASTER_INDEX */ - 332, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ - 329, /* GL_CURRENT_RASTER_POSITION */ - 330, /* GL_CURRENT_RASTER_POSITION_VALID */ - 327, /* GL_CURRENT_RASTER_DISTANCE */ - 1165, /* GL_POINT_SMOOTH */ - 1154, /* GL_POINT_SIZE */ - 1164, /* GL_POINT_SIZE_RANGE */ - 1155, /* GL_POINT_SIZE_GRANULARITY */ - 707, /* GL_LINE_SMOOTH */ - 714, /* GL_LINE_WIDTH */ - 716, /* GL_LINE_WIDTH_RANGE */ - 715, /* GL_LINE_WIDTH_GRANULARITY */ - 709, /* GL_LINE_STIPPLE */ - 710, /* GL_LINE_STIPPLE_PATTERN */ - 711, /* GL_LINE_STIPPLE_REPEAT */ - 721, /* GL_LIST_MODE */ - 887, /* GL_MAX_LIST_NESTING */ - 718, /* GL_LIST_BASE */ - 720, /* GL_LIST_INDEX */ - 1175, /* GL_POLYGON_MODE */ - 1182, /* GL_POLYGON_SMOOTH */ - 1184, /* GL_POLYGON_STIPPLE */ - 459, /* GL_EDGE_FLAG */ - 305, /* GL_CULL_FACE */ - 306, /* GL_CULL_FACE_MODE */ - 586, /* GL_FRONT_FACE */ - 689, /* GL_LIGHTING */ - 694, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - 695, /* GL_LIGHT_MODEL_TWO_SIDE */ - 691, /* GL_LIGHT_MODEL_AMBIENT */ - 1441, /* GL_SHADE_MODEL */ - 194, /* GL_COLOR_MATERIAL_FACE */ - 195, /* GL_COLOR_MATERIAL_PARAMETER */ - 193, /* GL_COLOR_MATERIAL */ - 509, /* GL_FOG */ - 531, /* GL_FOG_INDEX */ - 527, /* GL_FOG_DENSITY */ - 535, /* GL_FOG_START */ - 529, /* GL_FOG_END */ - 532, /* GL_FOG_MODE */ - 511, /* GL_FOG_COLOR */ - 371, /* GL_DEPTH_RANGE */ - 379, /* GL_DEPTH_TEST */ - 382, /* GL_DEPTH_WRITEMASK */ - 359, /* GL_DEPTH_CLEAR_VALUE */ - 370, /* GL_DEPTH_FUNC */ + 1206, /* GL_PASS_THROUGH_TOKEN */ + 1272, /* GL_POINT_TOKEN */ + 772, /* GL_LINE_TOKEN */ + 1286, /* GL_POLYGON_TOKEN */ + 75, /* GL_BITMAP_TOKEN */ + 468, /* GL_DRAW_PIXEL_TOKEN */ + 315, /* GL_COPY_PIXEL_TOKEN */ + 764, /* GL_LINE_RESET_TOKEN */ + 493, /* GL_EXP */ + 494, /* GL_EXP2 */ + 352, /* GL_CW */ + 137, /* GL_CCW */ + 158, /* GL_COEFF */ + 1183, /* GL_ORDER */ + 405, /* GL_DOMAIN */ + 325, /* GL_CURRENT_COLOR */ + 328, /* GL_CURRENT_INDEX */ + 334, /* GL_CURRENT_NORMAL */ + 348, /* GL_CURRENT_TEXTURE_COORDS */ + 340, /* GL_CURRENT_RASTER_COLOR */ + 342, /* GL_CURRENT_RASTER_INDEX */ + 346, /* GL_CURRENT_RASTER_TEXTURE_COORDS */ + 343, /* GL_CURRENT_RASTER_POSITION */ + 344, /* GL_CURRENT_RASTER_POSITION_VALID */ + 341, /* GL_CURRENT_RASTER_DISTANCE */ + 1264, /* GL_POINT_SMOOTH */ + 1248, /* GL_POINT_SIZE */ + 1263, /* GL_POINT_SIZE_RANGE */ + 1254, /* GL_POINT_SIZE_GRANULARITY */ + 765, /* GL_LINE_SMOOTH */ + 773, /* GL_LINE_WIDTH */ + 775, /* GL_LINE_WIDTH_RANGE */ + 774, /* GL_LINE_WIDTH_GRANULARITY */ + 767, /* GL_LINE_STIPPLE */ + 768, /* GL_LINE_STIPPLE_PATTERN */ + 769, /* GL_LINE_STIPPLE_REPEAT */ + 780, /* GL_LIST_MODE */ + 963, /* GL_MAX_LIST_NESTING */ + 777, /* GL_LIST_BASE */ + 779, /* GL_LIST_INDEX */ + 1275, /* GL_POLYGON_MODE */ + 1282, /* GL_POLYGON_SMOOTH */ + 1284, /* GL_POLYGON_STIPPLE */ + 479, /* GL_EDGE_FLAG */ + 318, /* GL_CULL_FACE */ + 319, /* GL_CULL_FACE_MODE */ + 628, /* GL_FRONT_FACE */ + 746, /* GL_LIGHTING */ + 751, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + 752, /* GL_LIGHT_MODEL_TWO_SIDE */ + 748, /* GL_LIGHT_MODEL_AMBIENT */ + 1569, /* GL_SHADE_MODEL */ + 206, /* GL_COLOR_MATERIAL_FACE */ + 207, /* GL_COLOR_MATERIAL_PARAMETER */ + 205, /* GL_COLOR_MATERIAL */ + 531, /* GL_FOG */ + 553, /* GL_FOG_INDEX */ + 549, /* GL_FOG_DENSITY */ + 557, /* GL_FOG_START */ + 551, /* GL_FOG_END */ + 554, /* GL_FOG_MODE */ + 533, /* GL_FOG_COLOR */ + 390, /* GL_DEPTH_RANGE */ + 399, /* GL_DEPTH_TEST */ + 402, /* GL_DEPTH_WRITEMASK */ + 375, /* GL_DEPTH_CLEAR_VALUE */ + 389, /* GL_DEPTH_FUNC */ 12, /* GL_ACCUM_CLEAR_VALUE */ - 1539, /* GL_STENCIL_TEST */ - 1523, /* GL_STENCIL_CLEAR_VALUE */ - 1525, /* GL_STENCIL_FUNC */ - 1541, /* GL_STENCIL_VALUE_MASK */ - 1524, /* GL_STENCIL_FAIL */ - 1536, /* GL_STENCIL_PASS_DEPTH_FAIL */ - 1537, /* GL_STENCIL_PASS_DEPTH_PASS */ - 1538, /* GL_STENCIL_REF */ - 1542, /* GL_STENCIL_WRITEMASK */ - 855, /* GL_MATRIX_MODE */ - 1027, /* GL_NORMALIZE */ - 1870, /* GL_VIEWPORT */ - 1001, /* GL_MODELVIEW_STACK_DEPTH */ - 1265, /* GL_PROJECTION_STACK_DEPTH */ - 1749, /* GL_TEXTURE_STACK_DEPTH */ - 999, /* GL_MODELVIEW_MATRIX */ - 1264, /* GL_PROJECTION_MATRIX */ - 1732, /* GL_TEXTURE_MATRIX */ + 1671, /* GL_STENCIL_TEST */ + 1652, /* GL_STENCIL_CLEAR_VALUE */ + 1654, /* GL_STENCIL_FUNC */ + 1673, /* GL_STENCIL_VALUE_MASK */ + 1653, /* GL_STENCIL_FAIL */ + 1668, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1669, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1670, /* GL_STENCIL_REF */ + 1674, /* GL_STENCIL_WRITEMASK */ + 922, /* GL_MATRIX_MODE */ + 1118, /* GL_NORMALIZE */ + 2037, /* GL_VIEWPORT */ + 1091, /* GL_MODELVIEW_STACK_DEPTH */ + 1370, /* GL_PROJECTION_STACK_DEPTH */ + 1896, /* GL_TEXTURE_STACK_DEPTH */ + 1088, /* GL_MODELVIEW_MATRIX */ + 1368, /* GL_PROJECTION_MATRIX */ + 1878, /* GL_TEXTURE_MATRIX */ 61, /* GL_ATTRIB_STACK_DEPTH */ - 137, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ + 148, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ 43, /* GL_ALPHA_TEST */ 44, /* GL_ALPHA_TEST_FUNC */ 45, /* GL_ALPHA_TEST_REF */ - 384, /* GL_DITHER */ - 78, /* GL_BLEND_DST */ - 87, /* GL_BLEND_SRC */ - 75, /* GL_BLEND */ - 724, /* GL_LOGIC_OP_MODE */ - 641, /* GL_INDEX_LOGIC_OP */ - 192, /* GL_COLOR_LOGIC_OP */ + 404, /* GL_DITHER */ + 79, /* GL_BLEND_DST */ + 93, /* GL_BLEND_SRC */ + 76, /* GL_BLEND */ + 783, /* GL_LOGIC_OP_MODE */ + 695, /* GL_INDEX_LOGIC_OP */ + 204, /* GL_COLOR_LOGIC_OP */ 67, /* GL_AUX_BUFFERS */ - 395, /* GL_DRAW_BUFFER */ - 1306, /* GL_READ_BUFFER */ - 1422, /* GL_SCISSOR_BOX */ - 1423, /* GL_SCISSOR_TEST */ - 640, /* GL_INDEX_CLEAR_VALUE */ - 645, /* GL_INDEX_WRITEMASK */ - 189, /* GL_COLOR_CLEAR_VALUE */ - 231, /* GL_COLOR_WRITEMASK */ - 642, /* GL_INDEX_MODE */ - 1388, /* GL_RGBA_MODE */ - 394, /* GL_DOUBLEBUFFER */ - 1543, /* GL_STEREO */ - 1345, /* GL_RENDER_MODE */ - 1113, /* GL_PERSPECTIVE_CORRECTION_HINT */ - 1166, /* GL_POINT_SMOOTH_HINT */ - 708, /* GL_LINE_SMOOTH_HINT */ - 1183, /* GL_POLYGON_SMOOTH_HINT */ - 530, /* GL_FOG_HINT */ - 1713, /* GL_TEXTURE_GEN_S */ - 1714, /* GL_TEXTURE_GEN_T */ - 1712, /* GL_TEXTURE_GEN_R */ - 1711, /* GL_TEXTURE_GEN_Q */ - 1126, /* GL_PIXEL_MAP_I_TO_I */ - 1132, /* GL_PIXEL_MAP_S_TO_S */ - 1128, /* GL_PIXEL_MAP_I_TO_R */ - 1124, /* GL_PIXEL_MAP_I_TO_G */ - 1122, /* GL_PIXEL_MAP_I_TO_B */ - 1120, /* GL_PIXEL_MAP_I_TO_A */ - 1130, /* GL_PIXEL_MAP_R_TO_R */ - 1118, /* GL_PIXEL_MAP_G_TO_G */ - 1116, /* GL_PIXEL_MAP_B_TO_B */ - 1114, /* GL_PIXEL_MAP_A_TO_A */ - 1127, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - 1133, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - 1129, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - 1125, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - 1123, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - 1121, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - 1131, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - 1119, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - 1117, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - 1115, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - 1787, /* GL_UNPACK_SWAP_BYTES */ - 1782, /* GL_UNPACK_LSB_FIRST */ - 1783, /* GL_UNPACK_ROW_LENGTH */ - 1786, /* GL_UNPACK_SKIP_ROWS */ - 1785, /* GL_UNPACK_SKIP_PIXELS */ - 1780, /* GL_UNPACK_ALIGNMENT */ - 1101, /* GL_PACK_SWAP_BYTES */ - 1096, /* GL_PACK_LSB_FIRST */ - 1097, /* GL_PACK_ROW_LENGTH */ - 1100, /* GL_PACK_SKIP_ROWS */ - 1099, /* GL_PACK_SKIP_PIXELS */ - 1093, /* GL_PACK_ALIGNMENT */ - 802, /* GL_MAP_COLOR */ - 807, /* GL_MAP_STENCIL */ - 644, /* GL_INDEX_SHIFT */ - 643, /* GL_INDEX_OFFSET */ - 1320, /* GL_RED_SCALE */ - 1318, /* GL_RED_BIAS */ - 1889, /* GL_ZOOM_X */ - 1890, /* GL_ZOOM_Y */ - 604, /* GL_GREEN_SCALE */ - 602, /* GL_GREEN_BIAS */ - 93, /* GL_BLUE_SCALE */ - 91, /* GL_BLUE_BIAS */ + 415, /* GL_DRAW_BUFFER */ + 1412, /* GL_READ_BUFFER */ + 1547, /* GL_SCISSOR_BOX */ + 1548, /* GL_SCISSOR_TEST */ + 694, /* GL_INDEX_CLEAR_VALUE */ + 699, /* GL_INDEX_WRITEMASK */ + 201, /* GL_COLOR_CLEAR_VALUE */ + 243, /* GL_COLOR_WRITEMASK */ + 696, /* GL_INDEX_MODE */ + 1512, /* GL_RGBA_MODE */ + 414, /* GL_DOUBLEBUFFER */ + 1675, /* GL_STEREO */ + 1463, /* GL_RENDER_MODE */ + 1207, /* GL_PERSPECTIVE_CORRECTION_HINT */ + 1265, /* GL_POINT_SMOOTH_HINT */ + 766, /* GL_LINE_SMOOTH_HINT */ + 1283, /* GL_POLYGON_SMOOTH_HINT */ + 552, /* GL_FOG_HINT */ + 1858, /* GL_TEXTURE_GEN_S */ + 1860, /* GL_TEXTURE_GEN_T */ + 1857, /* GL_TEXTURE_GEN_R */ + 1856, /* GL_TEXTURE_GEN_Q */ + 1220, /* GL_PIXEL_MAP_I_TO_I */ + 1226, /* GL_PIXEL_MAP_S_TO_S */ + 1222, /* GL_PIXEL_MAP_I_TO_R */ + 1218, /* GL_PIXEL_MAP_I_TO_G */ + 1216, /* GL_PIXEL_MAP_I_TO_B */ + 1214, /* GL_PIXEL_MAP_I_TO_A */ + 1224, /* GL_PIXEL_MAP_R_TO_R */ + 1212, /* GL_PIXEL_MAP_G_TO_G */ + 1210, /* GL_PIXEL_MAP_B_TO_B */ + 1208, /* GL_PIXEL_MAP_A_TO_A */ + 1221, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + 1227, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + 1223, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + 1219, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + 1217, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + 1215, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + 1225, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + 1213, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + 1211, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + 1209, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + 1949, /* GL_UNPACK_SWAP_BYTES */ + 1944, /* GL_UNPACK_LSB_FIRST */ + 1945, /* GL_UNPACK_ROW_LENGTH */ + 1948, /* GL_UNPACK_SKIP_ROWS */ + 1947, /* GL_UNPACK_SKIP_PIXELS */ + 1942, /* GL_UNPACK_ALIGNMENT */ + 1195, /* GL_PACK_SWAP_BYTES */ + 1190, /* GL_PACK_LSB_FIRST */ + 1191, /* GL_PACK_ROW_LENGTH */ + 1194, /* GL_PACK_SKIP_ROWS */ + 1193, /* GL_PACK_SKIP_PIXELS */ + 1187, /* GL_PACK_ALIGNMENT */ + 863, /* GL_MAP_COLOR */ + 868, /* GL_MAP_STENCIL */ + 698, /* GL_INDEX_SHIFT */ + 697, /* GL_INDEX_OFFSET */ + 1426, /* GL_RED_SCALE */ + 1424, /* GL_RED_BIAS */ + 2063, /* GL_ZOOM_X */ + 2064, /* GL_ZOOM_Y */ + 653, /* GL_GREEN_SCALE */ + 651, /* GL_GREEN_BIAS */ + 101, /* GL_BLUE_SCALE */ + 99, /* GL_BLUE_BIAS */ 42, /* GL_ALPHA_SCALE */ 40, /* GL_ALPHA_BIAS */ - 372, /* GL_DEPTH_SCALE */ - 352, /* GL_DEPTH_BIAS */ - 882, /* GL_MAX_EVAL_ORDER */ - 886, /* GL_MAX_LIGHTS */ - 864, /* GL_MAX_CLIP_PLANES */ - 934, /* GL_MAX_TEXTURE_SIZE */ - 892, /* GL_MAX_PIXEL_MAP_TABLE */ - 860, /* GL_MAX_ATTRIB_STACK_DEPTH */ - 889, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - 890, /* GL_MAX_NAME_STACK_DEPTH */ - 918, /* GL_MAX_PROJECTION_STACK_DEPTH */ - 935, /* GL_MAX_TEXTURE_STACK_DEPTH */ - 949, /* GL_MAX_VIEWPORT_DIMS */ - 861, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - 1553, /* GL_SUBPIXEL_BITS */ - 639, /* GL_INDEX_BITS */ - 1319, /* GL_RED_BITS */ - 603, /* GL_GREEN_BITS */ - 92, /* GL_BLUE_BITS */ + 391, /* GL_DEPTH_SCALE */ + 368, /* GL_DEPTH_BIAS */ + 952, /* GL_MAX_EVAL_ORDER */ + 962, /* GL_MAX_LIGHTS */ + 933, /* GL_MAX_CLIP_PLANES */ + 1013, /* GL_MAX_TEXTURE_SIZE */ + 969, /* GL_MAX_PIXEL_MAP_TABLE */ + 929, /* GL_MAX_ATTRIB_STACK_DEPTH */ + 965, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + 966, /* GL_MAX_NAME_STACK_DEPTH */ + 995, /* GL_MAX_PROJECTION_STACK_DEPTH */ + 1014, /* GL_MAX_TEXTURE_STACK_DEPTH */ + 1036, /* GL_MAX_VIEWPORT_DIMS */ + 930, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + 1685, /* GL_SUBPIXEL_BITS */ + 693, /* GL_INDEX_BITS */ + 1425, /* GL_RED_BITS */ + 652, /* GL_GREEN_BITS */ + 100, /* GL_BLUE_BITS */ 41, /* GL_ALPHA_BITS */ - 353, /* GL_DEPTH_BITS */ - 1521, /* GL_STENCIL_BITS */ + 369, /* GL_DEPTH_BITS */ + 1650, /* GL_STENCIL_BITS */ 14, /* GL_ACCUM_RED_BITS */ 13, /* GL_ACCUM_GREEN_BITS */ 10, /* GL_ACCUM_BLUE_BITS */ 9, /* GL_ACCUM_ALPHA_BITS */ - 1015, /* GL_NAME_STACK_DEPTH */ + 1105, /* GL_NAME_STACK_DEPTH */ 62, /* GL_AUTO_NORMAL */ - 748, /* GL_MAP1_COLOR_4 */ - 751, /* GL_MAP1_INDEX */ - 752, /* GL_MAP1_NORMAL */ - 753, /* GL_MAP1_TEXTURE_COORD_1 */ - 754, /* GL_MAP1_TEXTURE_COORD_2 */ - 755, /* GL_MAP1_TEXTURE_COORD_3 */ - 756, /* GL_MAP1_TEXTURE_COORD_4 */ - 757, /* GL_MAP1_VERTEX_3 */ - 758, /* GL_MAP1_VERTEX_4 */ - 775, /* GL_MAP2_COLOR_4 */ - 778, /* GL_MAP2_INDEX */ - 779, /* GL_MAP2_NORMAL */ - 780, /* GL_MAP2_TEXTURE_COORD_1 */ - 781, /* GL_MAP2_TEXTURE_COORD_2 */ - 782, /* GL_MAP2_TEXTURE_COORD_3 */ - 783, /* GL_MAP2_TEXTURE_COORD_4 */ - 784, /* GL_MAP2_VERTEX_3 */ - 785, /* GL_MAP2_VERTEX_4 */ - 749, /* GL_MAP1_GRID_DOMAIN */ - 750, /* GL_MAP1_GRID_SEGMENTS */ - 776, /* GL_MAP2_GRID_DOMAIN */ - 777, /* GL_MAP2_GRID_SEGMENTS */ - 1636, /* GL_TEXTURE_1D */ - 1638, /* GL_TEXTURE_2D */ - 483, /* GL_FEEDBACK_BUFFER_POINTER */ - 484, /* GL_FEEDBACK_BUFFER_SIZE */ - 485, /* GL_FEEDBACK_BUFFER_TYPE */ - 1432, /* GL_SELECTION_BUFFER_POINTER */ - 1433, /* GL_SELECTION_BUFFER_SIZE */ - 1755, /* GL_TEXTURE_WIDTH */ - 1718, /* GL_TEXTURE_HEIGHT */ - 1673, /* GL_TEXTURE_COMPONENTS */ - 1657, /* GL_TEXTURE_BORDER_COLOR */ - 1656, /* GL_TEXTURE_BORDER */ - 386, /* GL_DONT_CARE */ - 481, /* GL_FASTEST */ - 1023, /* GL_NICEST */ + 809, /* GL_MAP1_COLOR_4 */ + 812, /* GL_MAP1_INDEX */ + 813, /* GL_MAP1_NORMAL */ + 814, /* GL_MAP1_TEXTURE_COORD_1 */ + 815, /* GL_MAP1_TEXTURE_COORD_2 */ + 816, /* GL_MAP1_TEXTURE_COORD_3 */ + 817, /* GL_MAP1_TEXTURE_COORD_4 */ + 818, /* GL_MAP1_VERTEX_3 */ + 819, /* GL_MAP1_VERTEX_4 */ + 836, /* GL_MAP2_COLOR_4 */ + 839, /* GL_MAP2_INDEX */ + 840, /* GL_MAP2_NORMAL */ + 841, /* GL_MAP2_TEXTURE_COORD_1 */ + 842, /* GL_MAP2_TEXTURE_COORD_2 */ + 843, /* GL_MAP2_TEXTURE_COORD_3 */ + 844, /* GL_MAP2_TEXTURE_COORD_4 */ + 845, /* GL_MAP2_VERTEX_3 */ + 846, /* GL_MAP2_VERTEX_4 */ + 810, /* GL_MAP1_GRID_DOMAIN */ + 811, /* GL_MAP1_GRID_SEGMENTS */ + 837, /* GL_MAP2_GRID_DOMAIN */ + 838, /* GL_MAP2_GRID_SEGMENTS */ + 1768, /* GL_TEXTURE_1D */ + 1770, /* GL_TEXTURE_2D */ + 503, /* GL_FEEDBACK_BUFFER_POINTER */ + 504, /* GL_FEEDBACK_BUFFER_SIZE */ + 505, /* GL_FEEDBACK_BUFFER_TYPE */ + 1557, /* GL_SELECTION_BUFFER_POINTER */ + 1558, /* GL_SELECTION_BUFFER_SIZE */ + 1902, /* GL_TEXTURE_WIDTH */ + 1864, /* GL_TEXTURE_HEIGHT */ + 1808, /* GL_TEXTURE_COMPONENTS */ + 1792, /* GL_TEXTURE_BORDER_COLOR */ + 1791, /* GL_TEXTURE_BORDER */ + 406, /* GL_DONT_CARE */ + 501, /* GL_FASTEST */ + 1113, /* GL_NICEST */ 48, /* GL_AMBIENT */ - 383, /* GL_DIFFUSE */ - 1481, /* GL_SPECULAR */ - 1187, /* GL_POSITION */ - 1484, /* GL_SPOT_DIRECTION */ - 1485, /* GL_SPOT_EXPONENT */ - 1483, /* GL_SPOT_CUTOFF */ - 276, /* GL_CONSTANT_ATTENUATION */ - 698, /* GL_LINEAR_ATTENUATION */ - 1287, /* GL_QUADRATIC_ATTENUATION */ - 245, /* GL_COMPILE */ - 246, /* GL_COMPILE_AND_EXECUTE */ - 121, /* GL_BYTE */ - 1789, /* GL_UNSIGNED_BYTE */ - 1446, /* GL_SHORT */ - 1801, /* GL_UNSIGNED_SHORT */ - 647, /* GL_INT */ - 1792, /* GL_UNSIGNED_INT */ - 490, /* GL_FLOAT */ + 403, /* GL_DIFFUSE */ + 1609, /* GL_SPECULAR */ + 1287, /* GL_POSITION */ + 1612, /* GL_SPOT_DIRECTION */ + 1613, /* GL_SPOT_EXPONENT */ + 1611, /* GL_SPOT_CUTOFF */ + 288, /* GL_CONSTANT_ATTENUATION */ + 755, /* GL_LINEAR_ATTENUATION */ + 1392, /* GL_QUADRATIC_ATTENUATION */ + 257, /* GL_COMPILE */ + 258, /* GL_COMPILE_AND_EXECUTE */ + 132, /* GL_BYTE */ + 1951, /* GL_UNSIGNED_BYTE */ + 1574, /* GL_SHORT */ + 1966, /* GL_UNSIGNED_SHORT */ + 701, /* GL_INT */ + 1954, /* GL_UNSIGNED_INT */ + 512, /* GL_FLOAT */ 1, /* GL_2_BYTES */ 5, /* GL_3_BYTES */ 7, /* GL_4_BYTES */ - 393, /* GL_DOUBLE */ - 605, /* GL_HALF_FLOAT */ - 133, /* GL_CLEAR */ + 413, /* GL_DOUBLE */ + 654, /* GL_HALF_FLOAT */ + 509, /* GL_FIXED */ + 144, /* GL_CLEAR */ 50, /* GL_AND */ 52, /* GL_AND_REVERSE */ - 300, /* GL_COPY */ + 313, /* GL_COPY */ 51, /* GL_AND_INVERTED */ - 1025, /* GL_NOOP */ - 1885, /* GL_XOR */ - 1088, /* GL_OR */ - 1026, /* GL_NOR */ - 471, /* GL_EQUIV */ - 674, /* GL_INVERT */ - 1091, /* GL_OR_REVERSE */ - 301, /* GL_COPY_INVERTED */ - 1090, /* GL_OR_INVERTED */ - 1016, /* GL_NAND */ - 1437, /* GL_SET */ - 468, /* GL_EMISSION */ - 1445, /* GL_SHININESS */ + 1116, /* GL_NOOP */ + 2059, /* GL_XOR */ + 1182, /* GL_OR */ + 1117, /* GL_NOR */ + 491, /* GL_EQUIV */ + 731, /* GL_INVERT */ + 1185, /* GL_OR_REVERSE */ + 314, /* GL_COPY_INVERTED */ + 1184, /* GL_OR_INVERTED */ + 1106, /* GL_NAND */ + 1563, /* GL_SET */ + 488, /* GL_EMISSION */ + 1573, /* GL_SHININESS */ 49, /* GL_AMBIENT_AND_DIFFUSE */ - 191, /* GL_COLOR_INDEXES */ - 966, /* GL_MODELVIEW */ - 1263, /* GL_PROJECTION */ - 1571, /* GL_TEXTURE */ - 148, /* GL_COLOR */ - 347, /* GL_DEPTH */ - 1507, /* GL_STENCIL */ - 190, /* GL_COLOR_INDEX */ - 1526, /* GL_STENCIL_INDEX */ - 360, /* GL_DEPTH_COMPONENT */ - 1315, /* GL_RED */ - 601, /* GL_GREEN */ - 90, /* GL_BLUE */ + 203, /* GL_COLOR_INDEXES */ + 1055, /* GL_MODELVIEW */ + 1367, /* GL_PROJECTION */ + 1703, /* GL_TEXTURE */ + 159, /* GL_COLOR */ + 361, /* GL_DEPTH */ + 1635, /* GL_STENCIL */ + 202, /* GL_COLOR_INDEX */ + 1655, /* GL_STENCIL_INDEX */ + 376, /* GL_DEPTH_COMPONENT */ + 1421, /* GL_RED */ + 650, /* GL_GREEN */ + 98, /* GL_BLUE */ 31, /* GL_ALPHA */ - 1354, /* GL_RGB */ - 1373, /* GL_RGBA */ - 726, /* GL_LUMINANCE */ - 747, /* GL_LUMINANCE_ALPHA */ - 73, /* GL_BITMAP */ - 1143, /* GL_POINT */ - 696, /* GL_LINE */ - 486, /* GL_FILL */ - 1325, /* GL_RENDER */ - 482, /* GL_FEEDBACK */ - 1431, /* GL_SELECT */ - 489, /* GL_FLAT */ - 1456, /* GL_SMOOTH */ - 675, /* GL_KEEP */ - 1347, /* GL_REPLACE */ - 629, /* GL_INCR */ - 343, /* GL_DECR */ - 1816, /* GL_VENDOR */ - 1344, /* GL_RENDERER */ - 1817, /* GL_VERSION */ - 475, /* GL_EXTENSIONS */ - 1396, /* GL_S */ - 1562, /* GL_T */ - 1303, /* GL_R */ - 1286, /* GL_Q */ - 1002, /* GL_MODULATE */ - 342, /* GL_DECAL */ - 1708, /* GL_TEXTURE_ENV_MODE */ - 1707, /* GL_TEXTURE_ENV_COLOR */ - 1706, /* GL_TEXTURE_ENV */ - 476, /* GL_EYE_LINEAR */ - 1049, /* GL_OBJECT_LINEAR */ - 1482, /* GL_SPHERE_MAP */ - 1710, /* GL_TEXTURE_GEN_MODE */ - 1051, /* GL_OBJECT_PLANE */ - 477, /* GL_EYE_PLANE */ - 1017, /* GL_NEAREST */ - 697, /* GL_LINEAR */ - 1021, /* GL_NEAREST_MIPMAP_NEAREST */ - 702, /* GL_LINEAR_MIPMAP_NEAREST */ - 1020, /* GL_NEAREST_MIPMAP_LINEAR */ - 701, /* GL_LINEAR_MIPMAP_LINEAR */ - 1731, /* GL_TEXTURE_MAG_FILTER */ - 1739, /* GL_TEXTURE_MIN_FILTER */ - 1757, /* GL_TEXTURE_WRAP_S */ - 1758, /* GL_TEXTURE_WRAP_T */ - 127, /* GL_CLAMP */ - 1346, /* GL_REPEAT */ - 1181, /* GL_POLYGON_OFFSET_UNITS */ - 1180, /* GL_POLYGON_OFFSET_POINT */ - 1179, /* GL_POLYGON_OFFSET_LINE */ - 1304, /* GL_R3_G3_B2 */ - 1813, /* GL_V2F */ - 1814, /* GL_V3F */ - 124, /* GL_C4UB_V2F */ - 125, /* GL_C4UB_V3F */ - 122, /* GL_C3F_V3F */ - 1014, /* GL_N3F_V3F */ - 123, /* GL_C4F_N3F_V3F */ - 1567, /* GL_T2F_V3F */ - 1569, /* GL_T4F_V4F */ - 1565, /* GL_T2F_C4UB_V3F */ - 1563, /* GL_T2F_C3F_V3F */ - 1566, /* GL_T2F_N3F_V3F */ - 1564, /* GL_T2F_C4F_N3F_V3F */ - 1568, /* GL_T4F_C4F_N3F_V4F */ - 140, /* GL_CLIP_PLANE0 */ - 141, /* GL_CLIP_PLANE1 */ - 142, /* GL_CLIP_PLANE2 */ - 143, /* GL_CLIP_PLANE3 */ - 144, /* GL_CLIP_PLANE4 */ - 145, /* GL_CLIP_PLANE5 */ - 681, /* GL_LIGHT0 */ - 682, /* GL_LIGHT1 */ - 683, /* GL_LIGHT2 */ - 684, /* GL_LIGHT3 */ - 685, /* GL_LIGHT4 */ - 686, /* GL_LIGHT5 */ - 687, /* GL_LIGHT6 */ - 688, /* GL_LIGHT7 */ - 606, /* GL_HINT_BIT */ - 278, /* GL_CONSTANT_COLOR */ - 1062, /* GL_ONE_MINUS_CONSTANT_COLOR */ - 273, /* GL_CONSTANT_ALPHA */ - 1060, /* GL_ONE_MINUS_CONSTANT_ALPHA */ - 76, /* GL_BLEND_COLOR */ - 589, /* GL_FUNC_ADD */ - 950, /* GL_MIN */ - 857, /* GL_MAX */ - 81, /* GL_BLEND_EQUATION */ - 593, /* GL_FUNC_SUBTRACT */ - 591, /* GL_FUNC_REVERSE_SUBTRACT */ - 281, /* GL_CONVOLUTION_1D */ - 282, /* GL_CONVOLUTION_2D */ - 1434, /* GL_SEPARABLE_2D */ - 285, /* GL_CONVOLUTION_BORDER_MODE */ - 289, /* GL_CONVOLUTION_FILTER_SCALE */ - 287, /* GL_CONVOLUTION_FILTER_BIAS */ - 1316, /* GL_REDUCE */ - 291, /* GL_CONVOLUTION_FORMAT */ - 295, /* GL_CONVOLUTION_WIDTH */ - 293, /* GL_CONVOLUTION_HEIGHT */ - 873, /* GL_MAX_CONVOLUTION_WIDTH */ - 871, /* GL_MAX_CONVOLUTION_HEIGHT */ - 1220, /* GL_POST_CONVOLUTION_RED_SCALE */ - 1216, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - 1211, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - 1207, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - 1218, /* GL_POST_CONVOLUTION_RED_BIAS */ - 1214, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - 1209, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - 1205, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - 607, /* GL_HISTOGRAM */ - 1269, /* GL_PROXY_HISTOGRAM */ - 623, /* GL_HISTOGRAM_WIDTH */ - 613, /* GL_HISTOGRAM_FORMAT */ - 619, /* GL_HISTOGRAM_RED_SIZE */ - 615, /* GL_HISTOGRAM_GREEN_SIZE */ - 610, /* GL_HISTOGRAM_BLUE_SIZE */ - 608, /* GL_HISTOGRAM_ALPHA_SIZE */ - 617, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - 621, /* GL_HISTOGRAM_SINK */ - 951, /* GL_MINMAX */ - 953, /* GL_MINMAX_FORMAT */ - 955, /* GL_MINMAX_SINK */ - 1570, /* GL_TABLE_TOO_LARGE_EXT */ - 1791, /* GL_UNSIGNED_BYTE_3_3_2 */ - 1803, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - 1805, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - 1798, /* GL_UNSIGNED_INT_8_8_8_8 */ - 1793, /* GL_UNSIGNED_INT_10_10_10_2 */ - 1178, /* GL_POLYGON_OFFSET_FILL */ - 1177, /* GL_POLYGON_OFFSET_FACTOR */ - 1176, /* GL_POLYGON_OFFSET_BIAS */ - 1350, /* GL_RESCALE_NORMAL */ + 1472, /* GL_RGB */ + 1495, /* GL_RGBA */ + 787, /* GL_LUMINANCE */ + 808, /* GL_LUMINANCE_ALPHA */ + 74, /* GL_BITMAP */ + 1237, /* GL_POINT */ + 753, /* GL_LINE */ + 506, /* GL_FILL */ + 1432, /* GL_RENDER */ + 502, /* GL_FEEDBACK */ + 1556, /* GL_SELECT */ + 511, /* GL_FLAT */ + 1584, /* GL_SMOOTH */ + 732, /* GL_KEEP */ + 1465, /* GL_REPLACE */ + 683, /* GL_INCR */ + 357, /* GL_DECR */ + 1983, /* GL_VENDOR */ + 1462, /* GL_RENDERER */ + 1984, /* GL_VERSION */ + 495, /* GL_EXTENSIONS */ + 1520, /* GL_S */ + 1694, /* GL_T */ + 1408, /* GL_R */ + 1391, /* GL_Q */ + 1092, /* GL_MODULATE */ + 356, /* GL_DECAL */ + 1851, /* GL_TEXTURE_ENV_MODE */ + 1850, /* GL_TEXTURE_ENV_COLOR */ + 1849, /* GL_TEXTURE_ENV */ + 496, /* GL_EYE_LINEAR */ + 1143, /* GL_OBJECT_LINEAR */ + 1610, /* GL_SPHERE_MAP */ + 1854, /* GL_TEXTURE_GEN_MODE */ + 1145, /* GL_OBJECT_PLANE */ + 497, /* GL_EYE_PLANE */ + 1107, /* GL_NEAREST */ + 754, /* GL_LINEAR */ + 1111, /* GL_NEAREST_MIPMAP_NEAREST */ + 759, /* GL_LINEAR_MIPMAP_NEAREST */ + 1110, /* GL_NEAREST_MIPMAP_LINEAR */ + 758, /* GL_LINEAR_MIPMAP_LINEAR */ + 1877, /* GL_TEXTURE_MAG_FILTER */ + 1886, /* GL_TEXTURE_MIN_FILTER */ + 1905, /* GL_TEXTURE_WRAP_S */ + 1906, /* GL_TEXTURE_WRAP_T */ + 138, /* GL_CLAMP */ + 1464, /* GL_REPEAT */ + 1281, /* GL_POLYGON_OFFSET_UNITS */ + 1280, /* GL_POLYGON_OFFSET_POINT */ + 1279, /* GL_POLYGON_OFFSET_LINE */ + 1409, /* GL_R3_G3_B2 */ + 1980, /* GL_V2F */ + 1981, /* GL_V3F */ + 135, /* GL_C4UB_V2F */ + 136, /* GL_C4UB_V3F */ + 133, /* GL_C3F_V3F */ + 1104, /* GL_N3F_V3F */ + 134, /* GL_C4F_N3F_V3F */ + 1699, /* GL_T2F_V3F */ + 1701, /* GL_T4F_V4F */ + 1697, /* GL_T2F_C4UB_V3F */ + 1695, /* GL_T2F_C3F_V3F */ + 1698, /* GL_T2F_N3F_V3F */ + 1696, /* GL_T2F_C4F_N3F_V3F */ + 1700, /* GL_T4F_C4F_N3F_V4F */ + 151, /* GL_CLIP_PLANE0 */ + 152, /* GL_CLIP_PLANE1 */ + 153, /* GL_CLIP_PLANE2 */ + 154, /* GL_CLIP_PLANE3 */ + 155, /* GL_CLIP_PLANE4 */ + 156, /* GL_CLIP_PLANE5 */ + 738, /* GL_LIGHT0 */ + 739, /* GL_LIGHT1 */ + 740, /* GL_LIGHT2 */ + 741, /* GL_LIGHT3 */ + 742, /* GL_LIGHT4 */ + 743, /* GL_LIGHT5 */ + 744, /* GL_LIGHT6 */ + 745, /* GL_LIGHT7 */ + 658, /* GL_HINT_BIT */ + 290, /* GL_CONSTANT_COLOR */ + 1156, /* GL_ONE_MINUS_CONSTANT_COLOR */ + 285, /* GL_CONSTANT_ALPHA */ + 1154, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + 77, /* GL_BLEND_COLOR */ + 631, /* GL_FUNC_ADD */ + 1039, /* GL_MIN */ + 925, /* GL_MAX */ + 84, /* GL_BLEND_EQUATION */ + 637, /* GL_FUNC_SUBTRACT */ + 634, /* GL_FUNC_REVERSE_SUBTRACT */ + 293, /* GL_CONVOLUTION_1D */ + 294, /* GL_CONVOLUTION_2D */ + 1559, /* GL_SEPARABLE_2D */ + 297, /* GL_CONVOLUTION_BORDER_MODE */ + 301, /* GL_CONVOLUTION_FILTER_SCALE */ + 299, /* GL_CONVOLUTION_FILTER_BIAS */ + 1422, /* GL_REDUCE */ + 303, /* GL_CONVOLUTION_FORMAT */ + 307, /* GL_CONVOLUTION_WIDTH */ + 305, /* GL_CONVOLUTION_HEIGHT */ + 942, /* GL_MAX_CONVOLUTION_WIDTH */ + 940, /* GL_MAX_CONVOLUTION_HEIGHT */ + 1320, /* GL_POST_CONVOLUTION_RED_SCALE */ + 1316, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + 1311, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + 1307, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + 1318, /* GL_POST_CONVOLUTION_RED_BIAS */ + 1314, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + 1309, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + 1305, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + 659, /* GL_HISTOGRAM */ + 1374, /* GL_PROXY_HISTOGRAM */ + 675, /* GL_HISTOGRAM_WIDTH */ + 665, /* GL_HISTOGRAM_FORMAT */ + 671, /* GL_HISTOGRAM_RED_SIZE */ + 667, /* GL_HISTOGRAM_GREEN_SIZE */ + 662, /* GL_HISTOGRAM_BLUE_SIZE */ + 660, /* GL_HISTOGRAM_ALPHA_SIZE */ + 669, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + 673, /* GL_HISTOGRAM_SINK */ + 1040, /* GL_MINMAX */ + 1042, /* GL_MINMAX_FORMAT */ + 1044, /* GL_MINMAX_SINK */ + 1702, /* GL_TABLE_TOO_LARGE_EXT */ + 1953, /* GL_UNSIGNED_BYTE_3_3_2 */ + 1969, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 1972, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 1963, /* GL_UNSIGNED_INT_8_8_8_8 */ + 1955, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1278, /* GL_POLYGON_OFFSET_FILL */ + 1277, /* GL_POLYGON_OFFSET_FACTOR */ + 1276, /* GL_POLYGON_OFFSET_BIAS */ + 1468, /* GL_RESCALE_NORMAL */ 36, /* GL_ALPHA4 */ 38, /* GL_ALPHA8 */ 32, /* GL_ALPHA12 */ 34, /* GL_ALPHA16 */ - 737, /* GL_LUMINANCE4 */ - 743, /* GL_LUMINANCE8 */ - 727, /* GL_LUMINANCE12 */ - 733, /* GL_LUMINANCE16 */ - 738, /* GL_LUMINANCE4_ALPHA4 */ - 741, /* GL_LUMINANCE6_ALPHA2 */ - 744, /* GL_LUMINANCE8_ALPHA8 */ - 730, /* GL_LUMINANCE12_ALPHA4 */ - 728, /* GL_LUMINANCE12_ALPHA12 */ - 734, /* GL_LUMINANCE16_ALPHA16 */ - 648, /* GL_INTENSITY */ - 653, /* GL_INTENSITY4 */ - 655, /* GL_INTENSITY8 */ - 649, /* GL_INTENSITY12 */ - 651, /* GL_INTENSITY16 */ - 1363, /* GL_RGB2_EXT */ - 1364, /* GL_RGB4 */ - 1367, /* GL_RGB5 */ - 1371, /* GL_RGB8 */ - 1355, /* GL_RGB10 */ - 1359, /* GL_RGB12 */ - 1361, /* GL_RGB16 */ - 1378, /* GL_RGBA2 */ - 1380, /* GL_RGBA4 */ - 1368, /* GL_RGB5_A1 */ - 1384, /* GL_RGBA8 */ - 1356, /* GL_RGB10_A2 */ - 1374, /* GL_RGBA12 */ - 1376, /* GL_RGBA16 */ - 1746, /* GL_TEXTURE_RED_SIZE */ - 1716, /* GL_TEXTURE_GREEN_SIZE */ - 1654, /* GL_TEXTURE_BLUE_SIZE */ - 1641, /* GL_TEXTURE_ALPHA_SIZE */ - 1729, /* GL_TEXTURE_LUMINANCE_SIZE */ - 1720, /* GL_TEXTURE_INTENSITY_SIZE */ - 1348, /* GL_REPLACE_EXT */ - 1273, /* GL_PROXY_TEXTURE_1D */ - 1276, /* GL_PROXY_TEXTURE_2D */ - 1753, /* GL_TEXTURE_TOO_LARGE_EXT */ - 1741, /* GL_TEXTURE_PRIORITY */ - 1748, /* GL_TEXTURE_RESIDENT */ - 1644, /* GL_TEXTURE_BINDING_1D */ - 1646, /* GL_TEXTURE_BINDING_2D */ - 1648, /* GL_TEXTURE_BINDING_3D */ - 1098, /* GL_PACK_SKIP_IMAGES */ - 1094, /* GL_PACK_IMAGE_HEIGHT */ - 1784, /* GL_UNPACK_SKIP_IMAGES */ - 1781, /* GL_UNPACK_IMAGE_HEIGHT */ - 1640, /* GL_TEXTURE_3D */ - 1279, /* GL_PROXY_TEXTURE_3D */ - 1703, /* GL_TEXTURE_DEPTH */ - 1756, /* GL_TEXTURE_WRAP_R */ - 858, /* GL_MAX_3D_TEXTURE_SIZE */ - 1818, /* GL_VERTEX_ARRAY */ - 1028, /* GL_NORMAL_ARRAY */ - 149, /* GL_COLOR_ARRAY */ - 633, /* GL_INDEX_ARRAY */ - 1681, /* GL_TEXTURE_COORD_ARRAY */ - 460, /* GL_EDGE_FLAG_ARRAY */ - 1824, /* GL_VERTEX_ARRAY_SIZE */ - 1826, /* GL_VERTEX_ARRAY_TYPE */ - 1825, /* GL_VERTEX_ARRAY_STRIDE */ - 1033, /* GL_NORMAL_ARRAY_TYPE */ - 1032, /* GL_NORMAL_ARRAY_STRIDE */ - 153, /* GL_COLOR_ARRAY_SIZE */ - 155, /* GL_COLOR_ARRAY_TYPE */ - 154, /* GL_COLOR_ARRAY_STRIDE */ - 638, /* GL_INDEX_ARRAY_TYPE */ - 637, /* GL_INDEX_ARRAY_STRIDE */ - 1685, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - 1687, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - 1686, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - 464, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - 1823, /* GL_VERTEX_ARRAY_POINTER */ - 1031, /* GL_NORMAL_ARRAY_POINTER */ - 152, /* GL_COLOR_ARRAY_POINTER */ - 636, /* GL_INDEX_ARRAY_POINTER */ - 1684, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - 463, /* GL_EDGE_FLAG_ARRAY_POINTER */ - 1007, /* GL_MULTISAMPLE */ - 1408, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - 1410, /* GL_SAMPLE_ALPHA_TO_ONE */ - 1415, /* GL_SAMPLE_COVERAGE */ - 1412, /* GL_SAMPLE_BUFFERS */ - 1403, /* GL_SAMPLES */ - 1419, /* GL_SAMPLE_COVERAGE_VALUE */ - 1417, /* GL_SAMPLE_COVERAGE_INVERT */ - 196, /* GL_COLOR_MATRIX */ - 198, /* GL_COLOR_MATRIX_STACK_DEPTH */ - 867, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - 1203, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - 1199, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - 1194, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - 1190, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - 1201, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - 1197, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - 1192, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - 1188, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - 1664, /* GL_TEXTURE_COLOR_TABLE_SGI */ - 1280, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - 1666, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - 80, /* GL_BLEND_DST_RGB */ - 89, /* GL_BLEND_SRC_RGB */ - 79, /* GL_BLEND_DST_ALPHA */ - 88, /* GL_BLEND_SRC_ALPHA */ - 202, /* GL_COLOR_TABLE */ - 1213, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - 1196, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - 1268, /* GL_PROXY_COLOR_TABLE */ - 1272, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - 1271, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - 226, /* GL_COLOR_TABLE_SCALE */ - 206, /* GL_COLOR_TABLE_BIAS */ - 211, /* GL_COLOR_TABLE_FORMAT */ - 228, /* GL_COLOR_TABLE_WIDTH */ - 223, /* GL_COLOR_TABLE_RED_SIZE */ - 214, /* GL_COLOR_TABLE_GREEN_SIZE */ - 208, /* GL_COLOR_TABLE_BLUE_SIZE */ - 203, /* GL_COLOR_TABLE_ALPHA_SIZE */ - 220, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ - 217, /* GL_COLOR_TABLE_INTENSITY_SIZE */ + 798, /* GL_LUMINANCE4 */ + 804, /* GL_LUMINANCE8 */ + 788, /* GL_LUMINANCE12 */ + 794, /* GL_LUMINANCE16 */ + 799, /* GL_LUMINANCE4_ALPHA4 */ + 802, /* GL_LUMINANCE6_ALPHA2 */ + 805, /* GL_LUMINANCE8_ALPHA8 */ + 791, /* GL_LUMINANCE12_ALPHA4 */ + 789, /* GL_LUMINANCE12_ALPHA12 */ + 795, /* GL_LUMINANCE16_ALPHA16 */ + 702, /* GL_INTENSITY */ + 707, /* GL_INTENSITY4 */ + 709, /* GL_INTENSITY8 */ + 703, /* GL_INTENSITY12 */ + 705, /* GL_INTENSITY16 */ + 1481, /* GL_RGB2_EXT */ + 1482, /* GL_RGB4 */ + 1485, /* GL_RGB5 */ + 1492, /* GL_RGB8 */ + 1473, /* GL_RGB10 */ + 1477, /* GL_RGB12 */ + 1479, /* GL_RGB16 */ + 1500, /* GL_RGBA2 */ + 1502, /* GL_RGBA4 */ + 1488, /* GL_RGB5_A1 */ + 1507, /* GL_RGBA8 */ + 1474, /* GL_RGB10_A2 */ + 1496, /* GL_RGBA12 */ + 1498, /* GL_RGBA16 */ + 1893, /* GL_TEXTURE_RED_SIZE */ + 1862, /* GL_TEXTURE_GREEN_SIZE */ + 1789, /* GL_TEXTURE_BLUE_SIZE */ + 1774, /* GL_TEXTURE_ALPHA_SIZE */ + 1875, /* GL_TEXTURE_LUMINANCE_SIZE */ + 1866, /* GL_TEXTURE_INTENSITY_SIZE */ + 1466, /* GL_REPLACE_EXT */ + 1378, /* GL_PROXY_TEXTURE_1D */ + 1381, /* GL_PROXY_TEXTURE_2D */ + 1900, /* GL_TEXTURE_TOO_LARGE_EXT */ + 1888, /* GL_TEXTURE_PRIORITY */ + 1895, /* GL_TEXTURE_RESIDENT */ + 1777, /* GL_TEXTURE_BINDING_1D */ + 1779, /* GL_TEXTURE_BINDING_2D */ + 1781, /* GL_TEXTURE_BINDING_3D */ + 1192, /* GL_PACK_SKIP_IMAGES */ + 1188, /* GL_PACK_IMAGE_HEIGHT */ + 1946, /* GL_UNPACK_SKIP_IMAGES */ + 1943, /* GL_UNPACK_IMAGE_HEIGHT */ + 1772, /* GL_TEXTURE_3D */ + 1384, /* GL_PROXY_TEXTURE_3D */ + 1846, /* GL_TEXTURE_DEPTH */ + 1903, /* GL_TEXTURE_WRAP_R */ + 926, /* GL_MAX_3D_TEXTURE_SIZE */ + 1985, /* GL_VERTEX_ARRAY */ + 1119, /* GL_NORMAL_ARRAY */ + 160, /* GL_COLOR_ARRAY */ + 687, /* GL_INDEX_ARRAY */ + 1816, /* GL_TEXTURE_COORD_ARRAY */ + 480, /* GL_EDGE_FLAG_ARRAY */ + 1991, /* GL_VERTEX_ARRAY_SIZE */ + 1993, /* GL_VERTEX_ARRAY_TYPE */ + 1992, /* GL_VERTEX_ARRAY_STRIDE */ + 1124, /* GL_NORMAL_ARRAY_TYPE */ + 1123, /* GL_NORMAL_ARRAY_STRIDE */ + 164, /* GL_COLOR_ARRAY_SIZE */ + 166, /* GL_COLOR_ARRAY_TYPE */ + 165, /* GL_COLOR_ARRAY_STRIDE */ + 692, /* GL_INDEX_ARRAY_TYPE */ + 691, /* GL_INDEX_ARRAY_STRIDE */ + 1820, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 1822, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 1821, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 484, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + 1990, /* GL_VERTEX_ARRAY_POINTER */ + 1122, /* GL_NORMAL_ARRAY_POINTER */ + 163, /* GL_COLOR_ARRAY_POINTER */ + 690, /* GL_INDEX_ARRAY_POINTER */ + 1819, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 483, /* GL_EDGE_FLAG_ARRAY_POINTER */ + 1097, /* GL_MULTISAMPLE */ + 1533, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + 1535, /* GL_SAMPLE_ALPHA_TO_ONE */ + 1540, /* GL_SAMPLE_COVERAGE */ + 1537, /* GL_SAMPLE_BUFFERS */ + 1528, /* GL_SAMPLES */ + 1544, /* GL_SAMPLE_COVERAGE_VALUE */ + 1542, /* GL_SAMPLE_COVERAGE_INVERT */ + 208, /* GL_COLOR_MATRIX */ + 210, /* GL_COLOR_MATRIX_STACK_DEPTH */ + 936, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + 1303, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + 1299, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + 1294, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + 1290, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + 1301, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + 1297, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + 1292, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + 1288, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + 1799, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1385, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + 1801, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 82, /* GL_BLEND_DST_RGB */ + 96, /* GL_BLEND_SRC_RGB */ + 80, /* GL_BLEND_DST_ALPHA */ + 94, /* GL_BLEND_SRC_ALPHA */ + 214, /* GL_COLOR_TABLE */ + 1313, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + 1296, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + 1373, /* GL_PROXY_COLOR_TABLE */ + 1377, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + 1376, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + 238, /* GL_COLOR_TABLE_SCALE */ + 218, /* GL_COLOR_TABLE_BIAS */ + 223, /* GL_COLOR_TABLE_FORMAT */ + 240, /* GL_COLOR_TABLE_WIDTH */ + 235, /* GL_COLOR_TABLE_RED_SIZE */ + 226, /* GL_COLOR_TABLE_GREEN_SIZE */ + 220, /* GL_COLOR_TABLE_BLUE_SIZE */ + 215, /* GL_COLOR_TABLE_ALPHA_SIZE */ + 232, /* GL_COLOR_TABLE_LUMINANCE_SIZE */ + 229, /* GL_COLOR_TABLE_INTENSITY_SIZE */ 71, /* GL_BGR */ 72, /* GL_BGRA */ - 881, /* GL_MAX_ELEMENTS_VERTICES */ - 880, /* GL_MAX_ELEMENTS_INDICES */ - 1719, /* GL_TEXTURE_INDEX_SIZE_EXT */ - 146, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - 1160, /* GL_POINT_SIZE_MIN */ - 1156, /* GL_POINT_SIZE_MAX */ - 1150, /* GL_POINT_FADE_THRESHOLD_SIZE */ - 1146, /* GL_POINT_DISTANCE_ATTENUATION */ - 128, /* GL_CLAMP_TO_BORDER */ - 131, /* GL_CLAMP_TO_EDGE */ - 1740, /* GL_TEXTURE_MIN_LOD */ - 1738, /* GL_TEXTURE_MAX_LOD */ - 1643, /* GL_TEXTURE_BASE_LEVEL */ - 1737, /* GL_TEXTURE_MAX_LEVEL */ - 626, /* GL_IGNORE_BORDER_HP */ - 277, /* GL_CONSTANT_BORDER_HP */ - 1349, /* GL_REPLICATE_BORDER_HP */ - 283, /* GL_CONVOLUTION_BORDER_COLOR */ - 1057, /* GL_OCCLUSION_TEST_HP */ - 1058, /* GL_OCCLUSION_TEST_RESULT_HP */ - 699, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - 1658, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - 1660, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - 1662, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - 1663, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1661, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - 1659, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - 862, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - 863, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1223, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - 1225, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - 1222, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - 1224, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - 1727, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - 1728, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - 1726, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - 595, /* GL_GENERATE_MIPMAP */ - 596, /* GL_GENERATE_MIPMAP_HINT */ - 533, /* GL_FOG_OFFSET_SGIX */ - 534, /* GL_FOG_OFFSET_VALUE_SGIX */ - 1672, /* GL_TEXTURE_COMPARE_SGIX */ - 1671, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - 1723, /* GL_TEXTURE_LEQUAL_R_SGIX */ - 1715, /* GL_TEXTURE_GEQUAL_R_SGIX */ - 361, /* GL_DEPTH_COMPONENT16 */ - 364, /* GL_DEPTH_COMPONENT24 */ - 367, /* GL_DEPTH_COMPONENT32 */ - 307, /* GL_CULL_VERTEX_EXT */ - 309, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ - 308, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - 1882, /* GL_WRAP_BORDER_SUN */ - 1665, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - 692, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - 1449, /* GL_SINGLE_COLOR */ - 1435, /* GL_SEPARATE_SPECULAR_COLOR */ - 1444, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - 544, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - 545, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - 552, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - 547, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - 543, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - 542, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - 546, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - 553, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - 565, /* GL_FRAMEBUFFER_DEFAULT */ - 581, /* GL_FRAMEBUFFER_UNDEFINED */ - 374, /* GL_DEPTH_STENCIL_ATTACHMENT */ - 632, /* GL_INDEX */ - 1790, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - 1806, /* GL_UNSIGNED_SHORT_5_6_5 */ - 1807, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - 1804, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - 1802, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - 1799, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - 1797, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - 1735, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - 1736, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - 1734, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - 958, /* GL_MIRRORED_REPEAT */ - 1391, /* GL_RGB_S3TC */ - 1366, /* GL_RGB4_S3TC */ - 1389, /* GL_RGBA_S3TC */ - 1383, /* GL_RGBA4_S3TC */ - 1387, /* GL_RGBA_DXT5_S3TC */ - 1381, /* GL_RGBA4_DXT5_S3TC */ - 265, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ - 260, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ - 261, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ - 262, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - 1019, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - 1018, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - 700, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - 520, /* GL_FOG_COORDINATE_SOURCE */ - 512, /* GL_FOG_COORD */ - 536, /* GL_FRAGMENT_DEPTH */ - 313, /* GL_CURRENT_FOG_COORD */ - 519, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - 518, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - 517, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - 514, /* GL_FOG_COORDINATE_ARRAY */ - 200, /* GL_COLOR_SUM */ - 333, /* GL_CURRENT_SECONDARY_COLOR */ - 1428, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - 1430, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - 1429, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - 1427, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - 1424, /* GL_SECONDARY_COLOR_ARRAY */ - 331, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ + 951, /* GL_MAX_ELEMENTS_VERTICES */ + 950, /* GL_MAX_ELEMENTS_INDICES */ + 1865, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 157, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ + 1259, /* GL_POINT_SIZE_MIN */ + 1255, /* GL_POINT_SIZE_MAX */ + 1244, /* GL_POINT_FADE_THRESHOLD_SIZE */ + 1240, /* GL_POINT_DISTANCE_ATTENUATION */ + 139, /* GL_CLAMP_TO_BORDER */ + 142, /* GL_CLAMP_TO_EDGE */ + 1887, /* GL_TEXTURE_MIN_LOD */ + 1885, /* GL_TEXTURE_MAX_LOD */ + 1776, /* GL_TEXTURE_BASE_LEVEL */ + 1884, /* GL_TEXTURE_MAX_LEVEL */ + 678, /* GL_IGNORE_BORDER_HP */ + 289, /* GL_CONSTANT_BORDER_HP */ + 1467, /* GL_REPLICATE_BORDER_HP */ + 295, /* GL_CONVOLUTION_BORDER_COLOR */ + 1151, /* GL_OCCLUSION_TEST_HP */ + 1152, /* GL_OCCLUSION_TEST_RESULT_HP */ + 756, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + 1793, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1795, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1797, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1798, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1796, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1794, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 931, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + 932, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1323, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + 1325, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + 1322, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + 1324, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + 1873, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 1874, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 1872, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 640, /* GL_GENERATE_MIPMAP */ + 641, /* GL_GENERATE_MIPMAP_HINT */ + 555, /* GL_FOG_OFFSET_SGIX */ + 556, /* GL_FOG_OFFSET_VALUE_SGIX */ + 1807, /* GL_TEXTURE_COMPARE_SGIX */ + 1806, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 1869, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 1861, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 377, /* GL_DEPTH_COMPONENT16 */ + 381, /* GL_DEPTH_COMPONENT24 */ + 385, /* GL_DEPTH_COMPONENT32 */ + 320, /* GL_CULL_VERTEX_EXT */ + 322, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ + 321, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ + 2055, /* GL_WRAP_BORDER_SUN */ + 1800, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 749, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + 1577, /* GL_SINGLE_COLOR */ + 1561, /* GL_SEPARATE_SPECULAR_COLOR */ + 1572, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + 567, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + 568, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + 578, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + 570, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + 566, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + 565, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + 569, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + 579, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + 596, /* GL_FRAMEBUFFER_DEFAULT */ + 622, /* GL_FRAMEBUFFER_UNDEFINED */ + 393, /* GL_DEPTH_STENCIL_ATTACHMENT */ + 686, /* GL_INDEX */ + 1952, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 1973, /* GL_UNSIGNED_SHORT_5_6_5 */ + 1974, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 1970, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 1967, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 1964, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 1961, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 1882, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 1883, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 1881, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 1047, /* GL_MIRRORED_REPEAT */ + 1515, /* GL_RGB_S3TC */ + 1484, /* GL_RGB4_S3TC */ + 1513, /* GL_RGBA_S3TC */ + 1506, /* GL_RGBA4_S3TC */ + 1511, /* GL_RGBA_DXT5_S3TC */ + 1503, /* GL_RGBA4_DXT5_S3TC */ + 277, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ + 272, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ + 273, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ + 274, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ + 1109, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + 1108, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + 757, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + 542, /* GL_FOG_COORDINATE_SOURCE */ + 534, /* GL_FOG_COORD */ + 558, /* GL_FRAGMENT_DEPTH */ + 326, /* GL_CURRENT_FOG_COORD */ + 541, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + 540, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + 539, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + 536, /* GL_FOG_COORDINATE_ARRAY */ + 212, /* GL_COLOR_SUM */ + 347, /* GL_CURRENT_SECONDARY_COLOR */ + 1553, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + 1555, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + 1554, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + 1552, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + 1549, /* GL_SECONDARY_COLOR_ARRAY */ + 345, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ 28, /* GL_ALIASED_POINT_SIZE_RANGE */ 27, /* GL_ALIASED_LINE_WIDTH_RANGE */ - 1572, /* GL_TEXTURE0 */ - 1574, /* GL_TEXTURE1 */ - 1596, /* GL_TEXTURE2 */ - 1618, /* GL_TEXTURE3 */ - 1624, /* GL_TEXTURE4 */ - 1626, /* GL_TEXTURE5 */ - 1628, /* GL_TEXTURE6 */ - 1630, /* GL_TEXTURE7 */ - 1632, /* GL_TEXTURE8 */ - 1634, /* GL_TEXTURE9 */ - 1575, /* GL_TEXTURE10 */ - 1577, /* GL_TEXTURE11 */ - 1579, /* GL_TEXTURE12 */ - 1581, /* GL_TEXTURE13 */ - 1583, /* GL_TEXTURE14 */ - 1585, /* GL_TEXTURE15 */ - 1587, /* GL_TEXTURE16 */ - 1589, /* GL_TEXTURE17 */ - 1591, /* GL_TEXTURE18 */ - 1593, /* GL_TEXTURE19 */ - 1597, /* GL_TEXTURE20 */ - 1599, /* GL_TEXTURE21 */ - 1601, /* GL_TEXTURE22 */ - 1603, /* GL_TEXTURE23 */ - 1605, /* GL_TEXTURE24 */ - 1607, /* GL_TEXTURE25 */ - 1609, /* GL_TEXTURE26 */ - 1611, /* GL_TEXTURE27 */ - 1613, /* GL_TEXTURE28 */ - 1615, /* GL_TEXTURE29 */ - 1619, /* GL_TEXTURE30 */ - 1621, /* GL_TEXTURE31 */ + 1704, /* GL_TEXTURE0 */ + 1706, /* GL_TEXTURE1 */ + 1728, /* GL_TEXTURE2 */ + 1750, /* GL_TEXTURE3 */ + 1756, /* GL_TEXTURE4 */ + 1758, /* GL_TEXTURE5 */ + 1760, /* GL_TEXTURE6 */ + 1762, /* GL_TEXTURE7 */ + 1764, /* GL_TEXTURE8 */ + 1766, /* GL_TEXTURE9 */ + 1707, /* GL_TEXTURE10 */ + 1709, /* GL_TEXTURE11 */ + 1711, /* GL_TEXTURE12 */ + 1713, /* GL_TEXTURE13 */ + 1715, /* GL_TEXTURE14 */ + 1717, /* GL_TEXTURE15 */ + 1719, /* GL_TEXTURE16 */ + 1721, /* GL_TEXTURE17 */ + 1723, /* GL_TEXTURE18 */ + 1725, /* GL_TEXTURE19 */ + 1729, /* GL_TEXTURE20 */ + 1731, /* GL_TEXTURE21 */ + 1733, /* GL_TEXTURE22 */ + 1735, /* GL_TEXTURE23 */ + 1737, /* GL_TEXTURE24 */ + 1739, /* GL_TEXTURE25 */ + 1741, /* GL_TEXTURE26 */ + 1743, /* GL_TEXTURE27 */ + 1745, /* GL_TEXTURE28 */ + 1747, /* GL_TEXTURE29 */ + 1751, /* GL_TEXTURE30 */ + 1753, /* GL_TEXTURE31 */ 18, /* GL_ACTIVE_TEXTURE */ - 134, /* GL_CLIENT_ACTIVE_TEXTURE */ - 936, /* GL_MAX_TEXTURE_UNITS */ - 1767, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - 1770, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - 1772, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - 1764, /* GL_TRANSPOSE_COLOR_MATRIX */ - 1554, /* GL_SUBTRACT */ - 921, /* GL_MAX_RENDERBUFFER_SIZE */ - 248, /* GL_COMPRESSED_ALPHA */ - 252, /* GL_COMPRESSED_LUMINANCE */ - 253, /* GL_COMPRESSED_LUMINANCE_ALPHA */ - 250, /* GL_COMPRESSED_INTENSITY */ - 256, /* GL_COMPRESSED_RGB */ - 257, /* GL_COMPRESSED_RGBA */ - 1679, /* GL_TEXTURE_COMPRESSION_HINT */ - 1744, /* GL_TEXTURE_RECTANGLE_ARB */ - 1651, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - 1283, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - 919, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - 373, /* GL_DEPTH_STENCIL */ - 1794, /* GL_UNSIGNED_INT_24_8 */ - 932, /* GL_MAX_TEXTURE_LOD_BIAS */ - 1733, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - 933, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - 1709, /* GL_TEXTURE_FILTER_CONTROL */ - 1724, /* GL_TEXTURE_LOD_BIAS */ - 233, /* GL_COMBINE4 */ - 926, /* GL_MAX_SHININESS_NV */ - 927, /* GL_MAX_SPOT_EXPONENT_NV */ - 630, /* GL_INCR_WRAP */ - 344, /* GL_DECR_WRAP */ - 978, /* GL_MODELVIEW1_ARB */ - 1034, /* GL_NORMAL_MAP */ - 1321, /* GL_REFLECTION_MAP */ - 1688, /* GL_TEXTURE_CUBE_MAP */ - 1649, /* GL_TEXTURE_BINDING_CUBE_MAP */ - 1696, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - 1690, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - 1698, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - 1692, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - 1700, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - 1694, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - 1281, /* GL_PROXY_TEXTURE_CUBE_MAP */ - 875, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - 1013, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - 528, /* GL_FOG_DISTANCE_MODE_NV */ - 479, /* GL_EYE_RADIAL_NV */ - 478, /* GL_EYE_PLANE_ABSOLUTE_NV */ - 232, /* GL_COMBINE */ - 239, /* GL_COMBINE_RGB */ - 234, /* GL_COMBINE_ALPHA */ - 1392, /* GL_RGB_SCALE */ + 145, /* GL_CLIENT_ACTIVE_TEXTURE */ + 1015, /* GL_MAX_TEXTURE_UNITS */ + 1927, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 1930, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 1932, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 1924, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1686, /* GL_SUBTRACT */ + 998, /* GL_MAX_RENDERBUFFER_SIZE */ + 260, /* GL_COMPRESSED_ALPHA */ + 264, /* GL_COMPRESSED_LUMINANCE */ + 265, /* GL_COMPRESSED_LUMINANCE_ALPHA */ + 262, /* GL_COMPRESSED_INTENSITY */ + 268, /* GL_COMPRESSED_RGB */ + 269, /* GL_COMPRESSED_RGBA */ + 1814, /* GL_TEXTURE_COMPRESSION_HINT */ + 1891, /* GL_TEXTURE_RECTANGLE_ARB */ + 1786, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + 1388, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + 996, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + 392, /* GL_DEPTH_STENCIL */ + 1957, /* GL_UNSIGNED_INT_24_8 */ + 1010, /* GL_MAX_TEXTURE_LOD_BIAS */ + 1880, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 1012, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + 1852, /* GL_TEXTURE_FILTER_CONTROL */ + 1870, /* GL_TEXTURE_LOD_BIAS */ + 245, /* GL_COMBINE4 */ + 1004, /* GL_MAX_SHININESS_NV */ + 1005, /* GL_MAX_SPOT_EXPONENT_NV */ + 684, /* GL_INCR_WRAP */ + 358, /* GL_DECR_WRAP */ + 1067, /* GL_MODELVIEW1_ARB */ + 1125, /* GL_NORMAL_MAP */ + 1427, /* GL_REFLECTION_MAP */ + 1824, /* GL_TEXTURE_CUBE_MAP */ + 1783, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 1836, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 1826, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 1839, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 1829, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 1842, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 1832, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1386, /* GL_PROXY_TEXTURE_CUBE_MAP */ + 944, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + 1103, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + 550, /* GL_FOG_DISTANCE_MODE_NV */ + 499, /* GL_EYE_RADIAL_NV */ + 498, /* GL_EYE_PLANE_ABSOLUTE_NV */ + 244, /* GL_COMBINE */ + 251, /* GL_COMBINE_RGB */ + 246, /* GL_COMBINE_ALPHA */ + 1516, /* GL_RGB_SCALE */ 24, /* GL_ADD_SIGNED */ - 658, /* GL_INTERPOLATE */ - 272, /* GL_CONSTANT */ - 1229, /* GL_PRIMARY_COLOR */ - 1226, /* GL_PREVIOUS */ - 1464, /* GL_SOURCE0_RGB */ - 1470, /* GL_SOURCE1_RGB */ - 1476, /* GL_SOURCE2_RGB */ - 1480, /* GL_SOURCE3_RGB_NV */ - 1461, /* GL_SOURCE0_ALPHA */ - 1467, /* GL_SOURCE1_ALPHA */ - 1473, /* GL_SOURCE2_ALPHA */ - 1479, /* GL_SOURCE3_ALPHA_NV */ - 1071, /* GL_OPERAND0_RGB */ - 1077, /* GL_OPERAND1_RGB */ - 1083, /* GL_OPERAND2_RGB */ - 1087, /* GL_OPERAND3_RGB_NV */ - 1068, /* GL_OPERAND0_ALPHA */ - 1074, /* GL_OPERAND1_ALPHA */ - 1080, /* GL_OPERAND2_ALPHA */ - 1086, /* GL_OPERAND3_ALPHA_NV */ - 109, /* GL_BUFFER_OBJECT_APPLE */ - 1819, /* GL_VERTEX_ARRAY_BINDING */ - 1742, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ - 1743, /* GL_TEXTURE_RANGE_POINTER_APPLE */ - 1886, /* GL_YCBCR_422_APPLE */ - 1808, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - 1810, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - 1752, /* GL_TEXTURE_STORAGE_HINT_APPLE */ - 1545, /* GL_STORAGE_PRIVATE_APPLE */ - 1544, /* GL_STORAGE_CACHED_APPLE */ - 1546, /* GL_STORAGE_SHARED_APPLE */ - 1451, /* GL_SLICE_ACCUM_SUN */ - 1291, /* GL_QUAD_MESH_SUN */ - 1776, /* GL_TRIANGLE_MESH_SUN */ - 1858, /* GL_VERTEX_PROGRAM_ARB */ - 1869, /* GL_VERTEX_STATE_PROGRAM_NV */ - 1845, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - 1851, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - 1853, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - 1855, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - 335, /* GL_CURRENT_VERTEX_ATTRIB */ - 1242, /* GL_PROGRAM_LENGTH_ARB */ - 1256, /* GL_PROGRAM_STRING_ARB */ - 1000, /* GL_MODELVIEW_PROJECTION_NV */ - 625, /* GL_IDENTITY_NV */ - 672, /* GL_INVERSE_NV */ - 1769, /* GL_TRANSPOSE_NV */ - 673, /* GL_INVERSE_TRANSPOSE_NV */ - 905, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - 904, /* GL_MAX_PROGRAM_MATRICES_ARB */ - 811, /* GL_MATRIX0_NV */ - 823, /* GL_MATRIX1_NV */ - 835, /* GL_MATRIX2_NV */ - 839, /* GL_MATRIX3_NV */ - 841, /* GL_MATRIX4_NV */ - 843, /* GL_MATRIX5_NV */ - 845, /* GL_MATRIX6_NV */ - 847, /* GL_MATRIX7_NV */ - 319, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ - 316, /* GL_CURRENT_MATRIX_ARB */ - 1861, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - 1864, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - 1254, /* GL_PROGRAM_PARAMETER_NV */ - 1849, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - 1258, /* GL_PROGRAM_TARGET_NV */ - 1255, /* GL_PROGRAM_RESIDENT_NV */ - 1761, /* GL_TRACK_MATRIX_NV */ - 1762, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - 1859, /* GL_VERTEX_PROGRAM_BINDING_NV */ - 1236, /* GL_PROGRAM_ERROR_POSITION_ARB */ - 357, /* GL_DEPTH_CLAMP */ - 1827, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - 1834, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - 1835, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - 1836, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - 1837, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - 1838, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - 1839, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - 1840, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - 1841, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - 1842, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - 1828, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - 1829, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - 1830, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - 1831, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - 1832, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - 1833, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - 759, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - 766, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - 767, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - 768, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - 769, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - 770, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - 771, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - 772, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - 773, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - 774, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - 760, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - 761, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - 762, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - 763, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - 764, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - 765, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - 786, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - 793, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - 794, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - 795, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - 796, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - 797, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - 798, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - 1235, /* GL_PROGRAM_BINDING_ARB */ - 800, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - 801, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - 787, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - 788, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - 789, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - 790, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - 791, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - 792, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - 1677, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - 1674, /* GL_TEXTURE_COMPRESSED */ - 1039, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - 270, /* GL_COMPRESSED_TEXTURE_FORMATS */ - 948, /* GL_MAX_VERTEX_UNITS_ARB */ + 713, /* GL_INTERPOLATE */ + 284, /* GL_CONSTANT */ + 1329, /* GL_PRIMARY_COLOR */ + 1326, /* GL_PREVIOUS */ + 1592, /* GL_SOURCE0_RGB */ + 1598, /* GL_SOURCE1_RGB */ + 1604, /* GL_SOURCE2_RGB */ + 1608, /* GL_SOURCE3_RGB_NV */ + 1589, /* GL_SOURCE0_ALPHA */ + 1595, /* GL_SOURCE1_ALPHA */ + 1601, /* GL_SOURCE2_ALPHA */ + 1607, /* GL_SOURCE3_ALPHA_NV */ + 1165, /* GL_OPERAND0_RGB */ + 1171, /* GL_OPERAND1_RGB */ + 1177, /* GL_OPERAND2_RGB */ + 1181, /* GL_OPERAND3_RGB_NV */ + 1162, /* GL_OPERAND0_ALPHA */ + 1168, /* GL_OPERAND1_ALPHA */ + 1174, /* GL_OPERAND2_ALPHA */ + 1180, /* GL_OPERAND3_ALPHA_NV */ + 120, /* GL_BUFFER_OBJECT_APPLE */ + 1986, /* GL_VERTEX_ARRAY_BINDING */ + 1889, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ + 1890, /* GL_TEXTURE_RANGE_POINTER_APPLE */ + 2060, /* GL_YCBCR_422_APPLE */ + 1975, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 1977, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 1899, /* GL_TEXTURE_STORAGE_HINT_APPLE */ + 1677, /* GL_STORAGE_PRIVATE_APPLE */ + 1676, /* GL_STORAGE_CACHED_APPLE */ + 1678, /* GL_STORAGE_SHARED_APPLE */ + 1579, /* GL_SLICE_ACCUM_SUN */ + 1396, /* GL_QUAD_MESH_SUN */ + 1937, /* GL_TRIANGLE_MESH_SUN */ + 2025, /* GL_VERTEX_PROGRAM_ARB */ + 2036, /* GL_VERTEX_STATE_PROGRAM_NV */ + 2012, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + 2018, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + 2020, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + 2022, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + 349, /* GL_CURRENT_VERTEX_ATTRIB */ + 1345, /* GL_PROGRAM_LENGTH_ARB */ + 1360, /* GL_PROGRAM_STRING_ARB */ + 1090, /* GL_MODELVIEW_PROJECTION_NV */ + 677, /* GL_IDENTITY_NV */ + 729, /* GL_INVERSE_NV */ + 1929, /* GL_TRANSPOSE_NV */ + 730, /* GL_INVERSE_TRANSPOSE_NV */ + 982, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + 981, /* GL_MAX_PROGRAM_MATRICES_ARB */ + 872, /* GL_MATRIX0_NV */ + 884, /* GL_MATRIX1_NV */ + 896, /* GL_MATRIX2_NV */ + 900, /* GL_MATRIX3_NV */ + 902, /* GL_MATRIX4_NV */ + 904, /* GL_MATRIX5_NV */ + 906, /* GL_MATRIX6_NV */ + 908, /* GL_MATRIX7_NV */ + 332, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ + 329, /* GL_CURRENT_MATRIX_ARB */ + 2028, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + 2031, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + 1357, /* GL_PROGRAM_PARAMETER_NV */ + 2016, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + 1362, /* GL_PROGRAM_TARGET_NV */ + 1359, /* GL_PROGRAM_RESIDENT_NV */ + 1909, /* GL_TRACK_MATRIX_NV */ + 1910, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 2026, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1339, /* GL_PROGRAM_ERROR_POSITION_ARB */ + 373, /* GL_DEPTH_CLAMP */ + 1994, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 2001, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 2002, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 2003, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 2004, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 2005, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 2006, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 2007, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 2008, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 2009, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 1995, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 1996, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 1997, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 1998, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 1999, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 2000, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 820, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + 827, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + 828, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + 829, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + 830, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + 831, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + 832, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + 833, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + 834, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + 835, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + 821, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + 822, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + 823, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + 824, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + 825, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + 826, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + 847, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + 854, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + 855, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + 856, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + 857, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + 858, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + 859, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + 1338, /* GL_PROGRAM_BINDING_ARB */ + 861, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + 862, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + 848, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + 849, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + 850, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + 851, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + 852, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + 853, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + 1812, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 1809, /* GL_TEXTURE_COMPRESSED */ + 1131, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + 282, /* GL_COMPRESSED_TEXTURE_FORMATS */ + 1033, /* GL_MAX_VERTEX_UNITS_ARB */ 22, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - 1881, /* GL_WEIGHT_SUM_UNITY_ARB */ - 1857, /* GL_VERTEX_BLEND_ARB */ - 337, /* GL_CURRENT_WEIGHT_ARB */ - 1880, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - 1879, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - 1878, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - 1877, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - 1874, /* GL_WEIGHT_ARRAY_ARB */ - 387, /* GL_DOT3_RGB */ - 388, /* GL_DOT3_RGBA */ - 264, /* GL_COMPRESSED_RGB_FXT1_3DFX */ - 259, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - 1008, /* GL_MULTISAMPLE_3DFX */ - 1413, /* GL_SAMPLE_BUFFERS_3DFX */ - 1404, /* GL_SAMPLES_3DFX */ - 989, /* GL_MODELVIEW2_ARB */ - 992, /* GL_MODELVIEW3_ARB */ - 993, /* GL_MODELVIEW4_ARB */ - 994, /* GL_MODELVIEW5_ARB */ - 995, /* GL_MODELVIEW6_ARB */ - 996, /* GL_MODELVIEW7_ARB */ - 997, /* GL_MODELVIEW8_ARB */ - 998, /* GL_MODELVIEW9_ARB */ - 968, /* GL_MODELVIEW10_ARB */ - 969, /* GL_MODELVIEW11_ARB */ - 970, /* GL_MODELVIEW12_ARB */ - 971, /* GL_MODELVIEW13_ARB */ - 972, /* GL_MODELVIEW14_ARB */ - 973, /* GL_MODELVIEW15_ARB */ - 974, /* GL_MODELVIEW16_ARB */ - 975, /* GL_MODELVIEW17_ARB */ - 976, /* GL_MODELVIEW18_ARB */ - 977, /* GL_MODELVIEW19_ARB */ - 979, /* GL_MODELVIEW20_ARB */ - 980, /* GL_MODELVIEW21_ARB */ - 981, /* GL_MODELVIEW22_ARB */ - 982, /* GL_MODELVIEW23_ARB */ - 983, /* GL_MODELVIEW24_ARB */ - 984, /* GL_MODELVIEW25_ARB */ - 985, /* GL_MODELVIEW26_ARB */ - 986, /* GL_MODELVIEW27_ARB */ - 987, /* GL_MODELVIEW28_ARB */ - 988, /* GL_MODELVIEW29_ARB */ - 990, /* GL_MODELVIEW30_ARB */ - 991, /* GL_MODELVIEW31_ARB */ - 392, /* GL_DOT3_RGB_EXT */ - 390, /* GL_DOT3_RGBA_EXT */ - 962, /* GL_MIRROR_CLAMP_EXT */ - 965, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - 1003, /* GL_MODULATE_ADD_ATI */ - 1004, /* GL_MODULATE_SIGNED_ADD_ATI */ - 1005, /* GL_MODULATE_SUBTRACT_ATI */ - 1887, /* GL_YCBCR_MESA */ - 1095, /* GL_PACK_INVERT_MESA */ - 340, /* GL_DEBUG_OBJECT_MESA */ - 341, /* GL_DEBUG_PRINT_MESA */ - 339, /* GL_DEBUG_ASSERT_MESA */ - 111, /* GL_BUFFER_SIZE */ - 113, /* GL_BUFFER_USAGE */ - 117, /* GL_BUMP_ROT_MATRIX_ATI */ - 118, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ - 116, /* GL_BUMP_NUM_TEX_UNITS_ATI */ - 120, /* GL_BUMP_TEX_UNITS_ATI */ - 452, /* GL_DUDV_ATI */ - 451, /* GL_DU8DV8_ATI */ - 115, /* GL_BUMP_ENVMAP_ATI */ - 119, /* GL_BUMP_TARGET_ATI */ - 1512, /* GL_STENCIL_BACK_FUNC */ - 1510, /* GL_STENCIL_BACK_FAIL */ - 1514, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - 1516, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - 537, /* GL_FRAGMENT_PROGRAM_ARB */ - 1233, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 1261, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 1260, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - 1245, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 1251, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 1250, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 894, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 917, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 916, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - 907, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 913, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 912, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 877, /* GL_MAX_DRAW_BUFFERS */ - 396, /* GL_DRAW_BUFFER0 */ - 399, /* GL_DRAW_BUFFER1 */ - 420, /* GL_DRAW_BUFFER2 */ - 423, /* GL_DRAW_BUFFER3 */ - 426, /* GL_DRAW_BUFFER4 */ - 429, /* GL_DRAW_BUFFER5 */ - 432, /* GL_DRAW_BUFFER6 */ - 435, /* GL_DRAW_BUFFER7 */ - 438, /* GL_DRAW_BUFFER8 */ - 441, /* GL_DRAW_BUFFER9 */ - 400, /* GL_DRAW_BUFFER10 */ - 403, /* GL_DRAW_BUFFER11 */ - 406, /* GL_DRAW_BUFFER12 */ - 409, /* GL_DRAW_BUFFER13 */ - 412, /* GL_DRAW_BUFFER14 */ - 415, /* GL_DRAW_BUFFER15 */ - 82, /* GL_BLEND_EQUATION_ALPHA */ - 856, /* GL_MATRIX_PALETTE_ARB */ - 888, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - 891, /* GL_MAX_PALETTE_MATRICES_ARB */ - 322, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - 850, /* GL_MATRIX_INDEX_ARRAY_ARB */ - 317, /* GL_CURRENT_MATRIX_INDEX_ARB */ - 852, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - 854, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - 853, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - 851, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - 1704, /* GL_TEXTURE_DEPTH_SIZE */ - 380, /* GL_DEPTH_TEXTURE_MODE */ - 1669, /* GL_TEXTURE_COMPARE_MODE */ - 1667, /* GL_TEXTURE_COMPARE_FUNC */ - 243, /* GL_COMPARE_R_TO_TEXTURE */ - 1167, /* GL_POINT_SPRITE */ - 297, /* GL_COORD_REPLACE */ - 1171, /* GL_POINT_SPRITE_R_MODE_NV */ - 1295, /* GL_QUERY_COUNTER_BITS */ - 324, /* GL_CURRENT_QUERY */ - 1298, /* GL_QUERY_RESULT */ - 1300, /* GL_QUERY_RESULT_AVAILABLE */ - 942, /* GL_MAX_VERTEX_ATTRIBS */ - 1847, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - 378, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - 377, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - 928, /* GL_MAX_TEXTURE_COORDS */ - 930, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - 1238, /* GL_PROGRAM_ERROR_STRING_ARB */ - 1240, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - 1239, /* GL_PROGRAM_FORMAT_ARB */ - 1754, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - 355, /* GL_DEPTH_BOUNDS_TEST_EXT */ - 354, /* GL_DEPTH_BOUNDS_EXT */ + 2054, /* GL_WEIGHT_SUM_UNITY_ARB */ + 2024, /* GL_VERTEX_BLEND_ARB */ + 351, /* GL_CURRENT_WEIGHT_ARB */ + 2052, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 2050, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 2048, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 2046, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 2041, /* GL_WEIGHT_ARRAY_ARB */ + 407, /* GL_DOT3_RGB */ + 408, /* GL_DOT3_RGBA */ + 276, /* GL_COMPRESSED_RGB_FXT1_3DFX */ + 271, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ + 1098, /* GL_MULTISAMPLE_3DFX */ + 1538, /* GL_SAMPLE_BUFFERS_3DFX */ + 1529, /* GL_SAMPLES_3DFX */ + 1078, /* GL_MODELVIEW2_ARB */ + 1081, /* GL_MODELVIEW3_ARB */ + 1082, /* GL_MODELVIEW4_ARB */ + 1083, /* GL_MODELVIEW5_ARB */ + 1084, /* GL_MODELVIEW6_ARB */ + 1085, /* GL_MODELVIEW7_ARB */ + 1086, /* GL_MODELVIEW8_ARB */ + 1087, /* GL_MODELVIEW9_ARB */ + 1057, /* GL_MODELVIEW10_ARB */ + 1058, /* GL_MODELVIEW11_ARB */ + 1059, /* GL_MODELVIEW12_ARB */ + 1060, /* GL_MODELVIEW13_ARB */ + 1061, /* GL_MODELVIEW14_ARB */ + 1062, /* GL_MODELVIEW15_ARB */ + 1063, /* GL_MODELVIEW16_ARB */ + 1064, /* GL_MODELVIEW17_ARB */ + 1065, /* GL_MODELVIEW18_ARB */ + 1066, /* GL_MODELVIEW19_ARB */ + 1068, /* GL_MODELVIEW20_ARB */ + 1069, /* GL_MODELVIEW21_ARB */ + 1070, /* GL_MODELVIEW22_ARB */ + 1071, /* GL_MODELVIEW23_ARB */ + 1072, /* GL_MODELVIEW24_ARB */ + 1073, /* GL_MODELVIEW25_ARB */ + 1074, /* GL_MODELVIEW26_ARB */ + 1075, /* GL_MODELVIEW27_ARB */ + 1076, /* GL_MODELVIEW28_ARB */ + 1077, /* GL_MODELVIEW29_ARB */ + 1079, /* GL_MODELVIEW30_ARB */ + 1080, /* GL_MODELVIEW31_ARB */ + 412, /* GL_DOT3_RGB_EXT */ + 410, /* GL_DOT3_RGBA_EXT */ + 1051, /* GL_MIRROR_CLAMP_EXT */ + 1054, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + 1093, /* GL_MODULATE_ADD_ATI */ + 1094, /* GL_MODULATE_SIGNED_ADD_ATI */ + 1095, /* GL_MODULATE_SUBTRACT_ATI */ + 2061, /* GL_YCBCR_MESA */ + 1189, /* GL_PACK_INVERT_MESA */ + 354, /* GL_DEBUG_OBJECT_MESA */ + 355, /* GL_DEBUG_PRINT_MESA */ + 353, /* GL_DEBUG_ASSERT_MESA */ + 122, /* GL_BUFFER_SIZE */ + 124, /* GL_BUFFER_USAGE */ + 128, /* GL_BUMP_ROT_MATRIX_ATI */ + 129, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ + 127, /* GL_BUMP_NUM_TEX_UNITS_ATI */ + 131, /* GL_BUMP_TEX_UNITS_ATI */ + 472, /* GL_DUDV_ATI */ + 471, /* GL_DU8DV8_ATI */ + 126, /* GL_BUMP_ENVMAP_ATI */ + 130, /* GL_BUMP_TARGET_ATI */ + 1133, /* GL_NUM_PROGRAM_BINARY_FORMATS_OES */ + 1336, /* GL_PROGRAM_BINARY_FORMATS_OES */ + 1641, /* GL_STENCIL_BACK_FUNC */ + 1639, /* GL_STENCIL_BACK_FAIL */ + 1643, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + 1645, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + 559, /* GL_FRAGMENT_PROGRAM_ARB */ + 1334, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 1365, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 1364, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + 1348, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 1354, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 1353, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 971, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 994, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 993, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + 984, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 990, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 989, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 947, /* GL_MAX_DRAW_BUFFERS */ + 416, /* GL_DRAW_BUFFER0 */ + 419, /* GL_DRAW_BUFFER1 */ + 440, /* GL_DRAW_BUFFER2 */ + 443, /* GL_DRAW_BUFFER3 */ + 446, /* GL_DRAW_BUFFER4 */ + 449, /* GL_DRAW_BUFFER5 */ + 452, /* GL_DRAW_BUFFER6 */ + 455, /* GL_DRAW_BUFFER7 */ + 458, /* GL_DRAW_BUFFER8 */ + 461, /* GL_DRAW_BUFFER9 */ + 420, /* GL_DRAW_BUFFER10 */ + 423, /* GL_DRAW_BUFFER11 */ + 426, /* GL_DRAW_BUFFER12 */ + 429, /* GL_DRAW_BUFFER13 */ + 432, /* GL_DRAW_BUFFER14 */ + 435, /* GL_DRAW_BUFFER15 */ + 85, /* GL_BLEND_EQUATION_ALPHA */ + 923, /* GL_MATRIX_PALETTE_ARB */ + 964, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + 967, /* GL_MAX_PALETTE_MATRICES_ARB */ + 335, /* GL_CURRENT_PALETTE_MATRIX_ARB */ + 911, /* GL_MATRIX_INDEX_ARRAY_ARB */ + 330, /* GL_CURRENT_MATRIX_INDEX_ARB */ + 916, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + 920, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + 918, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + 914, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + 1847, /* GL_TEXTURE_DEPTH_SIZE */ + 400, /* GL_DEPTH_TEXTURE_MODE */ + 1804, /* GL_TEXTURE_COMPARE_MODE */ + 1802, /* GL_TEXTURE_COMPARE_FUNC */ + 255, /* GL_COMPARE_R_TO_TEXTURE */ + 1266, /* GL_POINT_SPRITE */ + 309, /* GL_COORD_REPLACE */ + 1271, /* GL_POINT_SPRITE_R_MODE_NV */ + 1400, /* GL_QUERY_COUNTER_BITS */ + 338, /* GL_CURRENT_QUERY */ + 1403, /* GL_QUERY_RESULT */ + 1405, /* GL_QUERY_RESULT_AVAILABLE */ + 1026, /* GL_MAX_VERTEX_ATTRIBS */ + 2014, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + 398, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + 397, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + 1006, /* GL_MAX_TEXTURE_COORDS */ + 1008, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + 1341, /* GL_PROGRAM_ERROR_STRING_ARB */ + 1343, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + 1342, /* GL_PROGRAM_FORMAT_ARB */ + 1901, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 371, /* GL_DEPTH_BOUNDS_TEST_EXT */ + 370, /* GL_DEPTH_BOUNDS_EXT */ 53, /* GL_ARRAY_BUFFER */ - 465, /* GL_ELEMENT_ARRAY_BUFFER */ + 485, /* GL_ELEMENT_ARRAY_BUFFER */ 54, /* GL_ARRAY_BUFFER_BINDING */ - 466, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - 1821, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - 1029, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - 150, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - 634, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - 1682, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - 461, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - 1425, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - 515, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - 1875, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - 1843, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - 1241, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - 900, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - 1247, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 909, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 1259, /* GL_PROGRAM_TEMPORARIES_ARB */ - 915, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - 1249, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 911, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 1253, /* GL_PROGRAM_PARAMETERS_ARB */ - 914, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - 1248, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - 910, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - 1234, /* GL_PROGRAM_ATTRIBS_ARB */ - 895, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - 1246, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - 908, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - 1232, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - 893, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - 1244, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 906, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 901, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - 897, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - 1262, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - 1766, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - 1311, /* GL_READ_ONLY */ - 1883, /* GL_WRITE_ONLY */ - 1313, /* GL_READ_WRITE */ - 102, /* GL_BUFFER_ACCESS */ - 105, /* GL_BUFFER_MAPPED */ - 107, /* GL_BUFFER_MAP_POINTER */ - 1760, /* GL_TIME_ELAPSED_EXT */ - 810, /* GL_MATRIX0_ARB */ - 822, /* GL_MATRIX1_ARB */ - 834, /* GL_MATRIX2_ARB */ - 838, /* GL_MATRIX3_ARB */ - 840, /* GL_MATRIX4_ARB */ - 842, /* GL_MATRIX5_ARB */ - 844, /* GL_MATRIX6_ARB */ - 846, /* GL_MATRIX7_ARB */ - 848, /* GL_MATRIX8_ARB */ - 849, /* GL_MATRIX9_ARB */ - 812, /* GL_MATRIX10_ARB */ - 813, /* GL_MATRIX11_ARB */ - 814, /* GL_MATRIX12_ARB */ - 815, /* GL_MATRIX13_ARB */ - 816, /* GL_MATRIX14_ARB */ - 817, /* GL_MATRIX15_ARB */ - 818, /* GL_MATRIX16_ARB */ - 819, /* GL_MATRIX17_ARB */ - 820, /* GL_MATRIX18_ARB */ - 821, /* GL_MATRIX19_ARB */ - 824, /* GL_MATRIX20_ARB */ - 825, /* GL_MATRIX21_ARB */ - 826, /* GL_MATRIX22_ARB */ - 827, /* GL_MATRIX23_ARB */ - 828, /* GL_MATRIX24_ARB */ - 829, /* GL_MATRIX25_ARB */ - 830, /* GL_MATRIX26_ARB */ - 831, /* GL_MATRIX27_ARB */ - 832, /* GL_MATRIX28_ARB */ - 833, /* GL_MATRIX29_ARB */ - 836, /* GL_MATRIX30_ARB */ - 837, /* GL_MATRIX31_ARB */ - 1549, /* GL_STREAM_DRAW */ - 1551, /* GL_STREAM_READ */ - 1547, /* GL_STREAM_COPY */ - 1503, /* GL_STATIC_DRAW */ - 1505, /* GL_STATIC_READ */ - 1501, /* GL_STATIC_COPY */ - 455, /* GL_DYNAMIC_DRAW */ - 457, /* GL_DYNAMIC_READ */ - 453, /* GL_DYNAMIC_COPY */ - 1135, /* GL_PIXEL_PACK_BUFFER */ - 1139, /* GL_PIXEL_UNPACK_BUFFER */ - 1136, /* GL_PIXEL_PACK_BUFFER_BINDING */ - 1140, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ - 348, /* GL_DEPTH24_STENCIL8 */ - 1750, /* GL_TEXTURE_STENCIL_SIZE */ - 1702, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ - 896, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - 899, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - 903, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - 902, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - 859, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - 1540, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 486, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + 1988, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 1120, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + 161, /* GL_COLOR_ARRAY_BUFFER_BINDING */ + 688, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + 1817, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 481, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + 1550, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + 537, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + 2042, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 2010, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1344, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + 977, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + 1350, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 986, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 1363, /* GL_PROGRAM_TEMPORARIES_ARB */ + 992, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + 1352, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 988, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 1356, /* GL_PROGRAM_PARAMETERS_ARB */ + 991, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + 1351, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + 987, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + 1335, /* GL_PROGRAM_ATTRIBS_ARB */ + 972, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + 1349, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + 985, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + 1333, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + 970, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + 1347, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 983, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 978, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + 974, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + 1366, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + 1926, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1417, /* GL_READ_ONLY */ + 2056, /* GL_WRITE_ONLY */ + 1419, /* GL_READ_WRITE */ + 110, /* GL_BUFFER_ACCESS */ + 114, /* GL_BUFFER_MAPPED */ + 117, /* GL_BUFFER_MAP_POINTER */ + 1908, /* GL_TIME_ELAPSED_EXT */ + 871, /* GL_MATRIX0_ARB */ + 883, /* GL_MATRIX1_ARB */ + 895, /* GL_MATRIX2_ARB */ + 899, /* GL_MATRIX3_ARB */ + 901, /* GL_MATRIX4_ARB */ + 903, /* GL_MATRIX5_ARB */ + 905, /* GL_MATRIX6_ARB */ + 907, /* GL_MATRIX7_ARB */ + 909, /* GL_MATRIX8_ARB */ + 910, /* GL_MATRIX9_ARB */ + 873, /* GL_MATRIX10_ARB */ + 874, /* GL_MATRIX11_ARB */ + 875, /* GL_MATRIX12_ARB */ + 876, /* GL_MATRIX13_ARB */ + 877, /* GL_MATRIX14_ARB */ + 878, /* GL_MATRIX15_ARB */ + 879, /* GL_MATRIX16_ARB */ + 880, /* GL_MATRIX17_ARB */ + 881, /* GL_MATRIX18_ARB */ + 882, /* GL_MATRIX19_ARB */ + 885, /* GL_MATRIX20_ARB */ + 886, /* GL_MATRIX21_ARB */ + 887, /* GL_MATRIX22_ARB */ + 888, /* GL_MATRIX23_ARB */ + 889, /* GL_MATRIX24_ARB */ + 890, /* GL_MATRIX25_ARB */ + 891, /* GL_MATRIX26_ARB */ + 892, /* GL_MATRIX27_ARB */ + 893, /* GL_MATRIX28_ARB */ + 894, /* GL_MATRIX29_ARB */ + 897, /* GL_MATRIX30_ARB */ + 898, /* GL_MATRIX31_ARB */ + 1681, /* GL_STREAM_DRAW */ + 1683, /* GL_STREAM_READ */ + 1679, /* GL_STREAM_COPY */ + 1631, /* GL_STATIC_DRAW */ + 1633, /* GL_STATIC_READ */ + 1629, /* GL_STATIC_COPY */ + 475, /* GL_DYNAMIC_DRAW */ + 477, /* GL_DYNAMIC_READ */ + 473, /* GL_DYNAMIC_COPY */ + 1229, /* GL_PIXEL_PACK_BUFFER */ + 1233, /* GL_PIXEL_UNPACK_BUFFER */ + 1230, /* GL_PIXEL_PACK_BUFFER_BINDING */ + 1234, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + 362, /* GL_DEPTH24_STENCIL8 */ + 1897, /* GL_TEXTURE_STENCIL_SIZE */ + 1845, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + 973, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + 976, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + 980, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + 979, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + 928, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + 1672, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ 17, /* GL_ACTIVE_STENCIL_FACE_EXT */ - 963, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - 1406, /* GL_SAMPLES_PASSED */ - 110, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ - 104, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ - 1324, /* GL_RELEASED_APPLE */ - 1872, /* GL_VOLATILE_APPLE */ - 1352, /* GL_RETAINED_APPLE */ - 1779, /* GL_UNDEFINED_APPLE */ - 1285, /* GL_PURGEABLE_APPLE */ - 538, /* GL_FRAGMENT_SHADER */ - 1867, /* GL_VERTEX_SHADER */ - 1252, /* GL_PROGRAM_OBJECT_ARB */ - 1438, /* GL_SHADER_OBJECT_ARB */ - 884, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - 946, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - 940, /* GL_MAX_VARYING_FLOATS */ - 944, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - 869, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - 1055, /* GL_OBJECT_TYPE_ARB */ - 1440, /* GL_SHADER_TYPE */ - 503, /* GL_FLOAT_VEC2 */ - 505, /* GL_FLOAT_VEC3 */ - 507, /* GL_FLOAT_VEC4 */ - 661, /* GL_INT_VEC2 */ - 663, /* GL_INT_VEC3 */ - 665, /* GL_INT_VEC4 */ - 94, /* GL_BOOL */ - 96, /* GL_BOOL_VEC2 */ - 98, /* GL_BOOL_VEC3 */ - 100, /* GL_BOOL_VEC4 */ - 491, /* GL_FLOAT_MAT2 */ - 495, /* GL_FLOAT_MAT3 */ - 499, /* GL_FLOAT_MAT4 */ - 1397, /* GL_SAMPLER_1D */ - 1399, /* GL_SAMPLER_2D */ - 1401, /* GL_SAMPLER_3D */ - 1402, /* GL_SAMPLER_CUBE */ - 1398, /* GL_SAMPLER_1D_SHADOW */ - 1400, /* GL_SAMPLER_2D_SHADOW */ - 493, /* GL_FLOAT_MAT2x3 */ - 494, /* GL_FLOAT_MAT2x4 */ - 497, /* GL_FLOAT_MAT3x2 */ - 498, /* GL_FLOAT_MAT3x4 */ - 501, /* GL_FLOAT_MAT4x2 */ - 502, /* GL_FLOAT_MAT4x3 */ - 346, /* GL_DELETE_STATUS */ - 247, /* GL_COMPILE_STATUS */ - 717, /* GL_LINK_STATUS */ - 1815, /* GL_VALIDATE_STATUS */ - 646, /* GL_INFO_LOG_LENGTH */ + 1052, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + 1531, /* GL_SAMPLES_PASSED */ + 1253, /* GL_POINT_SIZE_ARRAY_TYPE_OES */ + 1252, /* GL_POINT_SIZE_ARRAY_STRIDE_OES */ + 1251, /* GL_POINT_SIZE_ARRAY_POINTER_OES */ + 1089, /* GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES */ + 1369, /* GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES */ + 1879, /* GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES */ + 121, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ + 113, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ + 1431, /* GL_RELEASED_APPLE */ + 2039, /* GL_VOLATILE_APPLE */ + 1470, /* GL_RETAINED_APPLE */ + 1941, /* GL_UNDEFINED_APPLE */ + 1390, /* GL_PURGEABLE_APPLE */ + 560, /* GL_FRAGMENT_SHADER */ + 2034, /* GL_VERTEX_SHADER */ + 1355, /* GL_PROGRAM_OBJECT_ARB */ + 1566, /* GL_SHADER_OBJECT_ARB */ + 954, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + 1030, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + 1023, /* GL_MAX_VARYING_FLOATS */ + 1028, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + 938, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + 1149, /* GL_OBJECT_TYPE_ARB */ + 1568, /* GL_SHADER_TYPE */ + 525, /* GL_FLOAT_VEC2 */ + 527, /* GL_FLOAT_VEC3 */ + 529, /* GL_FLOAT_VEC4 */ + 717, /* GL_INT_VEC2 */ + 719, /* GL_INT_VEC3 */ + 721, /* GL_INT_VEC4 */ + 102, /* GL_BOOL */ + 104, /* GL_BOOL_VEC2 */ + 106, /* GL_BOOL_VEC3 */ + 108, /* GL_BOOL_VEC4 */ + 513, /* GL_FLOAT_MAT2 */ + 517, /* GL_FLOAT_MAT3 */ + 521, /* GL_FLOAT_MAT4 */ + 1521, /* GL_SAMPLER_1D */ + 1523, /* GL_SAMPLER_2D */ + 1525, /* GL_SAMPLER_3D */ + 1527, /* GL_SAMPLER_CUBE */ + 1522, /* GL_SAMPLER_1D_SHADOW */ + 1524, /* GL_SAMPLER_2D_SHADOW */ + 515, /* GL_FLOAT_MAT2x3 */ + 516, /* GL_FLOAT_MAT2x4 */ + 519, /* GL_FLOAT_MAT3x2 */ + 520, /* GL_FLOAT_MAT3x4 */ + 523, /* GL_FLOAT_MAT4x2 */ + 524, /* GL_FLOAT_MAT4x3 */ + 360, /* GL_DELETE_STATUS */ + 259, /* GL_COMPILE_STATUS */ + 776, /* GL_LINK_STATUS */ + 1982, /* GL_VALIDATE_STATUS */ + 700, /* GL_INFO_LOG_LENGTH */ 56, /* GL_ATTACHED_SHADERS */ 20, /* GL_ACTIVE_UNIFORMS */ 21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ - 1439, /* GL_SHADER_SOURCE_LENGTH */ + 1567, /* GL_SHADER_SOURCE_LENGTH */ 15, /* GL_ACTIVE_ATTRIBUTES */ 16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ - 540, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - 1442, /* GL_SHADING_LANGUAGE_VERSION */ - 323, /* GL_CURRENT_PROGRAM */ - 1104, /* GL_PALETTE4_RGB8_OES */ - 1106, /* GL_PALETTE4_RGBA8_OES */ - 1102, /* GL_PALETTE4_R5_G6_B5_OES */ - 1105, /* GL_PALETTE4_RGBA4_OES */ - 1103, /* GL_PALETTE4_RGB5_A1_OES */ - 1109, /* GL_PALETTE8_RGB8_OES */ - 1111, /* GL_PALETTE8_RGBA8_OES */ - 1107, /* GL_PALETTE8_R5_G6_B5_OES */ - 1110, /* GL_PALETTE8_RGBA4_OES */ - 1108, /* GL_PALETTE8_RGB5_A1_OES */ - 628, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - 627, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - 1800, /* GL_UNSIGNED_NORMALIZED */ - 1637, /* GL_TEXTURE_1D_ARRAY_EXT */ - 1274, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - 1639, /* GL_TEXTURE_2D_ARRAY_EXT */ - 1277, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - 1645, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - 1647, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - 1495, /* GL_SRGB */ - 1496, /* GL_SRGB8 */ - 1498, /* GL_SRGB_ALPHA */ - 1497, /* GL_SRGB8_ALPHA8 */ - 1455, /* GL_SLUMINANCE_ALPHA */ - 1454, /* GL_SLUMINANCE8_ALPHA8 */ - 1452, /* GL_SLUMINANCE */ - 1453, /* GL_SLUMINANCE8 */ - 268, /* GL_COMPRESSED_SRGB */ - 269, /* GL_COMPRESSED_SRGB_ALPHA */ - 266, /* GL_COMPRESSED_SLUMINANCE */ - 267, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ - 1169, /* GL_POINT_SPRITE_COORD_ORIGIN */ - 725, /* GL_LOWER_LEFT */ - 1812, /* GL_UPPER_LEFT */ - 1518, /* GL_STENCIL_BACK_REF */ - 1519, /* GL_STENCIL_BACK_VALUE_MASK */ - 1520, /* GL_STENCIL_BACK_WRITEMASK */ - 445, /* GL_DRAW_FRAMEBUFFER_BINDING */ - 1328, /* GL_RENDERBUFFER_BINDING */ - 1307, /* GL_READ_FRAMEBUFFER */ - 444, /* GL_DRAW_FRAMEBUFFER */ - 1308, /* GL_READ_FRAMEBUFFER_BINDING */ - 1339, /* GL_RENDERBUFFER_SAMPLES */ - 550, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - 548, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - 559, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - 555, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - 557, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - 563, /* GL_FRAMEBUFFER_COMPLETE */ - 567, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - 574, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - 572, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - 569, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - 573, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - 570, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ - 578, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ - 582, /* GL_FRAMEBUFFER_UNSUPPORTED */ - 580, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - 865, /* GL_MAX_COLOR_ATTACHMENTS */ - 156, /* GL_COLOR_ATTACHMENT0 */ - 158, /* GL_COLOR_ATTACHMENT1 */ - 172, /* GL_COLOR_ATTACHMENT2 */ - 174, /* GL_COLOR_ATTACHMENT3 */ - 176, /* GL_COLOR_ATTACHMENT4 */ - 178, /* GL_COLOR_ATTACHMENT5 */ - 180, /* GL_COLOR_ATTACHMENT6 */ - 182, /* GL_COLOR_ATTACHMENT7 */ - 184, /* GL_COLOR_ATTACHMENT8 */ - 186, /* GL_COLOR_ATTACHMENT9 */ - 159, /* GL_COLOR_ATTACHMENT10 */ - 161, /* GL_COLOR_ATTACHMENT11 */ - 163, /* GL_COLOR_ATTACHMENT12 */ - 165, /* GL_COLOR_ATTACHMENT13 */ - 167, /* GL_COLOR_ATTACHMENT14 */ - 169, /* GL_COLOR_ATTACHMENT15 */ - 350, /* GL_DEPTH_ATTACHMENT */ - 1508, /* GL_STENCIL_ATTACHMENT */ - 541, /* GL_FRAMEBUFFER */ - 1326, /* GL_RENDERBUFFER */ - 1342, /* GL_RENDERBUFFER_WIDTH */ - 1334, /* GL_RENDERBUFFER_HEIGHT */ - 1336, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - 1535, /* GL_STENCIL_INDEX_EXT */ - 1527, /* GL_STENCIL_INDEX1 */ - 1531, /* GL_STENCIL_INDEX4 */ - 1533, /* GL_STENCIL_INDEX8 */ - 1528, /* GL_STENCIL_INDEX16 */ - 1338, /* GL_RENDERBUFFER_RED_SIZE */ - 1333, /* GL_RENDERBUFFER_GREEN_SIZE */ - 1330, /* GL_RENDERBUFFER_BLUE_SIZE */ - 1327, /* GL_RENDERBUFFER_ALPHA_SIZE */ - 1331, /* GL_RENDERBUFFER_DEPTH_SIZE */ - 1341, /* GL_RENDERBUFFER_STENCIL_SIZE */ - 576, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - 923, /* GL_MAX_SAMPLES */ - 1302, /* GL_QUERY_WAIT_NV */ - 1297, /* GL_QUERY_NO_WAIT_NV */ - 1294, /* GL_QUERY_BY_REGION_WAIT_NV */ - 1293, /* GL_QUERY_BY_REGION_NO_WAIT_NV */ - 1289, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ - 487, /* GL_FIRST_VERTEX_CONVENTION */ - 676, /* GL_LAST_VERTEX_CONVENTION */ - 1266, /* GL_PROVOKING_VERTEX */ - 303, /* GL_COPY_READ_BUFFER */ - 304, /* GL_COPY_WRITE_BUFFER */ - 1390, /* GL_RGBA_SNORM */ - 1386, /* GL_RGBA8_SNORM */ - 1448, /* GL_SIGNED_NORMALIZED */ - 925, /* GL_MAX_SERVER_WAIT_TIMEOUT */ - 1054, /* GL_OBJECT_TYPE */ - 1556, /* GL_SYNC_CONDITION */ - 1561, /* GL_SYNC_STATUS */ - 1558, /* GL_SYNC_FLAGS */ - 1557, /* GL_SYNC_FENCE */ - 1560, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ - 1788, /* GL_UNSIGNALED */ - 1447, /* GL_SIGNALED */ + 562, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + 1570, /* GL_SHADING_LANGUAGE_VERSION */ + 337, /* GL_CURRENT_PROGRAM */ + 1198, /* GL_PALETTE4_RGB8_OES */ + 1200, /* GL_PALETTE4_RGBA8_OES */ + 1196, /* GL_PALETTE4_R5_G6_B5_OES */ + 1199, /* GL_PALETTE4_RGBA4_OES */ + 1197, /* GL_PALETTE4_RGB5_A1_OES */ + 1203, /* GL_PALETTE8_RGB8_OES */ + 1205, /* GL_PALETTE8_RGBA8_OES */ + 1201, /* GL_PALETTE8_R5_G6_B5_OES */ + 1204, /* GL_PALETTE8_RGBA4_OES */ + 1202, /* GL_PALETTE8_RGB5_A1_OES */ + 682, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + 680, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + 1250, /* GL_POINT_SIZE_ARRAY_OES */ + 1823, /* GL_TEXTURE_CROP_RECT_OES */ + 912, /* GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES */ + 1249, /* GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES */ + 1965, /* GL_UNSIGNED_NORMALIZED */ + 1769, /* GL_TEXTURE_1D_ARRAY_EXT */ + 1379, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + 1771, /* GL_TEXTURE_2D_ARRAY_EXT */ + 1382, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + 1778, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + 1780, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + 958, /* GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB */ + 1623, /* GL_SRGB */ + 1624, /* GL_SRGB8 */ + 1626, /* GL_SRGB_ALPHA */ + 1625, /* GL_SRGB8_ALPHA8 */ + 1583, /* GL_SLUMINANCE_ALPHA */ + 1582, /* GL_SLUMINANCE8_ALPHA8 */ + 1580, /* GL_SLUMINANCE */ + 1581, /* GL_SLUMINANCE8 */ + 280, /* GL_COMPRESSED_SRGB */ + 281, /* GL_COMPRESSED_SRGB_ALPHA */ + 278, /* GL_COMPRESSED_SLUMINANCE */ + 279, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ + 1923, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT */ + 1917, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT */ + 1021, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT */ + 1922, /* GL_TRANSFORM_FEEDBACK_VARYINGS_EXT */ + 1920, /* GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT */ + 1919, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT */ + 1332, /* GL_PRIMITIVES_GENERATED_EXT */ + 1921, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT */ + 1410, /* GL_RASTERIZER_DISCARD_EXT */ + 1019, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT */ + 1020, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT */ + 712, /* GL_INTERLEAVED_ATTRIBS_EXT */ + 1560, /* GL_SEPARATE_ATTRIBS_EXT */ + 1916, /* GL_TRANSFORM_FEEDBACK_BUFFER_EXT */ + 1915, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT */ + 1268, /* GL_POINT_SPRITE_COORD_ORIGIN */ + 784, /* GL_LOWER_LEFT */ + 1979, /* GL_UPPER_LEFT */ + 1647, /* GL_STENCIL_BACK_REF */ + 1648, /* GL_STENCIL_BACK_VALUE_MASK */ + 1649, /* GL_STENCIL_BACK_WRITEMASK */ + 465, /* GL_DRAW_FRAMEBUFFER_BINDING */ + 1436, /* GL_RENDERBUFFER_BINDING */ + 1413, /* GL_READ_FRAMEBUFFER */ + 464, /* GL_DRAW_FRAMEBUFFER */ + 1414, /* GL_READ_FRAMEBUFFER_BINDING */ + 1455, /* GL_RENDERBUFFER_SAMPLES */ + 575, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + 572, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + 587, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + 582, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + 585, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + 593, /* GL_FRAMEBUFFER_COMPLETE */ + 598, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + 612, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + 607, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + 602, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + 608, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + 604, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ + 617, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ + 623, /* GL_FRAMEBUFFER_UNSUPPORTED */ + 621, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + 934, /* GL_MAX_COLOR_ATTACHMENTS */ + 167, /* GL_COLOR_ATTACHMENT0 */ + 170, /* GL_COLOR_ATTACHMENT1 */ + 184, /* GL_COLOR_ATTACHMENT2 */ + 186, /* GL_COLOR_ATTACHMENT3 */ + 188, /* GL_COLOR_ATTACHMENT4 */ + 190, /* GL_COLOR_ATTACHMENT5 */ + 192, /* GL_COLOR_ATTACHMENT6 */ + 194, /* GL_COLOR_ATTACHMENT7 */ + 196, /* GL_COLOR_ATTACHMENT8 */ + 198, /* GL_COLOR_ATTACHMENT9 */ + 171, /* GL_COLOR_ATTACHMENT10 */ + 173, /* GL_COLOR_ATTACHMENT11 */ + 175, /* GL_COLOR_ATTACHMENT12 */ + 177, /* GL_COLOR_ATTACHMENT13 */ + 179, /* GL_COLOR_ATTACHMENT14 */ + 181, /* GL_COLOR_ATTACHMENT15 */ + 365, /* GL_DEPTH_ATTACHMENT */ + 1636, /* GL_STENCIL_ATTACHMENT */ + 564, /* GL_FRAMEBUFFER */ + 1433, /* GL_RENDERBUFFER */ + 1459, /* GL_RENDERBUFFER_WIDTH */ + 1446, /* GL_RENDERBUFFER_HEIGHT */ + 1449, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + 1667, /* GL_STENCIL_INDEX_EXT */ + 1656, /* GL_STENCIL_INDEX1 */ + 1661, /* GL_STENCIL_INDEX4 */ + 1664, /* GL_STENCIL_INDEX8 */ + 1657, /* GL_STENCIL_INDEX16 */ + 1453, /* GL_RENDERBUFFER_RED_SIZE */ + 1444, /* GL_RENDERBUFFER_GREEN_SIZE */ + 1439, /* GL_RENDERBUFFER_BLUE_SIZE */ + 1434, /* GL_RENDERBUFFER_ALPHA_SIZE */ + 1441, /* GL_RENDERBUFFER_DEPTH_SIZE */ + 1457, /* GL_RENDERBUFFER_STENCIL_SIZE */ + 615, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + 1001, /* GL_MAX_SAMPLES */ + 1859, /* GL_TEXTURE_GEN_STR_OES */ + 655, /* GL_HALF_FLOAT_OES */ + 1487, /* GL_RGB565_OES */ + 571, /* GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB */ + 611, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB */ + 610, /* GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB */ + 646, /* GL_GEOMETRY_SHADER_ARB */ + 647, /* GL_GEOMETRY_VERTICES_OUT_ARB */ + 644, /* GL_GEOMETRY_INPUT_TYPE_ARB */ + 645, /* GL_GEOMETRY_OUTPUT_TYPE_ARB */ + 961, /* GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB */ + 1035, /* GL_MAX_VERTEX_VARYING_COMPONENTS_ARB */ + 960, /* GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB */ + 957, /* GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB */ + 959, /* GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB */ + 785, /* GL_LOW_FLOAT */ + 1037, /* GL_MEDIUM_FLOAT */ + 656, /* GL_HIGH_FLOAT */ + 786, /* GL_LOW_INT */ + 1038, /* GL_MEDIUM_INT */ + 657, /* GL_HIGH_INT */ + 1956, /* GL_UNSIGNED_INT_10_10_10_2_OES */ + 716, /* GL_INT_10_10_10_2_OES */ + 1564, /* GL_SHADER_BINARY_FORMATS */ + 1134, /* GL_NUM_SHADER_BINARY_FORMATS */ + 1565, /* GL_SHADER_COMPILER */ + 1032, /* GL_MAX_VERTEX_UNIFORM_VECTORS */ + 1025, /* GL_MAX_VARYING_VECTORS */ + 956, /* GL_MAX_FRAGMENT_UNIFORM_VECTORS */ + 1407, /* GL_QUERY_WAIT_NV */ + 1402, /* GL_QUERY_NO_WAIT_NV */ + 1399, /* GL_QUERY_BY_REGION_WAIT_NV */ + 1398, /* GL_QUERY_BY_REGION_NO_WAIT_NV */ + 1912, /* GL_TRANSFORM_FEEDBACK */ + 1918, /* GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ + 1914, /* GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */ + 1913, /* GL_TRANSFORM_FEEDBACK_BINDING */ + 1394, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ + 507, /* GL_FIRST_VERTEX_CONVENTION */ + 733, /* GL_LAST_VERTEX_CONVENTION */ + 1371, /* GL_PROVOKING_VERTEX */ + 316, /* GL_COPY_READ_BUFFER */ + 317, /* GL_COPY_WRITE_BUFFER */ + 1514, /* GL_RGBA_SNORM */ + 1510, /* GL_RGBA8_SNORM */ + 1576, /* GL_SIGNED_NORMALIZED */ + 1003, /* GL_MAX_SERVER_WAIT_TIMEOUT */ + 1148, /* GL_OBJECT_TYPE */ + 1688, /* GL_SYNC_CONDITION */ + 1693, /* GL_SYNC_STATUS */ + 1690, /* GL_SYNC_FLAGS */ + 1689, /* GL_SYNC_FENCE */ + 1692, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ + 1950, /* GL_UNSIGNALED */ + 1575, /* GL_SIGNALED */ 46, /* GL_ALREADY_SIGNALED */ - 1759, /* GL_TIMEOUT_EXPIRED */ - 271, /* GL_CONDITION_SATISFIED */ - 1873, /* GL_WAIT_FAILED */ - 472, /* GL_EVAL_BIT */ - 1305, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - 719, /* GL_LIST_BIT */ - 1653, /* GL_TEXTURE_BIT */ - 1421, /* GL_SCISSOR_BIT */ + 1907, /* GL_TIMEOUT_EXPIRED */ + 283, /* GL_CONDITION_SATISFIED */ + 2040, /* GL_WAIT_FAILED */ + 492, /* GL_EVAL_BIT */ + 1411, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + 778, /* GL_LIST_BIT */ + 1788, /* GL_TEXTURE_BIT */ + 1546, /* GL_SCISSOR_BIT */ 29, /* GL_ALL_ATTRIB_BITS */ - 1010, /* GL_MULTISAMPLE_BIT */ + 1100, /* GL_MULTISAMPLE_BIT */ 30, /* GL_ALL_CLIENT_ATTRIB_BITS */ }; @@ -5234,7 +5648,8 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } else { /* this is not re-entrant safe, no big deal here */ - sprintf(token_tmp, "0x%x", nr); + _mesa_snprintf(token_tmp, sizeof(token_tmp) - 1, "0x%x", nr); + token_tmp[sizeof(token_tmp) - 1] = '\0'; return token_tmp; } } diff --git a/mesalib/src/mesa/main/es_generator.py b/mesalib/src/mesa/main/es_generator.py new file mode 100644 index 000000000..ecb34bb5c --- /dev/null +++ b/mesalib/src/mesa/main/es_generator.py @@ -0,0 +1,743 @@ +#************************************************************************* +# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. +# All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +#************************************************************************* + + +import sys, os +import APIspecutil as apiutil + +# These dictionary entries are used for automatic conversion. +# The string will be used as a format string with the conversion +# variable. +Converters = { + 'GLfloat': { + 'GLdouble': "(GLdouble) (%s)", + 'GLfixed' : "(GLint) (%s * 65536)", + }, + 'GLfixed': { + 'GLfloat': "(GLfloat) (%s / 65536.0f)", + 'GLdouble': "(GLdouble) (%s / 65536.0)", + }, + 'GLdouble': { + 'GLfloat': "(GLfloat) (%s)", + 'GLfixed': "(GLfixed) (%s * 65536)", + }, + 'GLclampf': { + 'GLclampd': "(GLclampd) (%s)", + 'GLclampx': "(GLclampx) (%s * 65536)", + }, + 'GLclampx': { + 'GLclampf': "(GLclampf) (%s / 65536.0f)", + 'GLclampd': "(GLclampd) (%s / 65536.0)", + }, + 'GLubyte': { + 'GLfloat': "(GLfloat) (%s / 255.0f)", + }, +} + +def GetBaseType(type): + typeTokens = type.split(' ') + baseType = None + typeModifiers = [] + for t in typeTokens: + if t in ['const', '*']: + typeModifiers.append(t) + else: + baseType = t + return (baseType, typeModifiers) + +def ConvertValue(value, fromType, toType): + """Returns a string that represents the given parameter string, + type-converted if necessary.""" + + if not Converters.has_key(fromType): + print >> sys.stderr, "No base converter for type '%s' found. Ignoring." % fromType + return value + + if not Converters[fromType].has_key(toType): + print >> sys.stderr, "No converter found for type '%s' to type '%s'. Ignoring." % (fromType, toType) + return value + + # This part is simple. Return the proper conversion. + conversionString = Converters[fromType][toType] + return conversionString % value + +FormatStrings = { + 'GLenum' : '0x%x', + 'GLfloat' : '%f', + 'GLint' : '%d', + 'GLbitfield' : '0x%x', +} +def GetFormatString(type): + if FormatStrings.has_key(type): + return FormatStrings[type] + else: + return None + + +###################################################################### +# Version-specific values to be used in the main script +# header: which header file to include +# api: what text specifies an API-level function +VersionSpecificValues = { + 'GLES1.1' : { + 'description' : 'GLES1.1 functions', + 'header' : 'GLES/gl.h', + 'extheader' : 'GLES/glext.h', + 'shortname' : 'es1' + }, + 'GLES2.0': { + 'description' : 'GLES2.0 functions', + 'header' : 'GLES2/gl2.h', + 'extheader' : 'GLES2/gl2ext.h', + 'shortname' : 'es2' + } +} + + +###################################################################### +# Main code for the script begins here. + +# Get the name of the program (without the directory part) for use in +# error messages. +program = os.path.basename(sys.argv[0]) + +# Set default values +verbose = 0 +functionList = "APIspec.xml" +version = "GLES1.1" + +# Allow for command-line switches +import getopt, time +options = "hvV:S:" +try: + optlist, args = getopt.getopt(sys.argv[1:], options) +except getopt.GetoptError, message: + sys.stderr.write("%s: %s. Use -h for help.\n" % (program, message)) + sys.exit(1) + +for option, optarg in optlist: + if option == "-h": + sys.stderr.write("Usage: %s [-%s]\n" % (program, options)) + sys.stderr.write("Parse an API specification file and generate wrapper functions for a given GLES version\n") + sys.stderr.write("-h gives help\n") + sys.stderr.write("-v is verbose\n") + sys.stderr.write("-V specifies GLES version to generate [%s]:\n" % version) + for key in VersionSpecificValues.keys(): + sys.stderr.write(" %s - %s\n" % (key, VersionSpecificValues[key]['description'])) + sys.stderr.write("-S specifies API specification file to use [%s]\n" % functionList) + sys.exit(1) + elif option == "-v": + verbose += 1 + elif option == "-V": + version = optarg + elif option == "-S": + functionList = optarg + +# Beyond switches, we support no further command-line arguments +if len(args) > 0: + sys.stderr.write("%s: only switch arguments are supported - use -h for help\n" % program) + sys.exit(1) + +# If we don't have a valid version, abort. +if not VersionSpecificValues.has_key(version): + sys.stderr.write("%s: version '%s' is not valid - use -h for help\n" % (program, version)) + sys.exit(1) + +# Grab the version-specific items we need to use +versionHeader = VersionSpecificValues[version]['header'] +versionExtHeader = VersionSpecificValues[version]['extheader'] +shortname = VersionSpecificValues[version]['shortname'] + +# If we get to here, we're good to go. The "version" parameter +# directs GetDispatchedFunctions to only allow functions from +# that "category" (version in our parlance). This allows +# functions with different declarations in different categories +# to exist (glTexImage2D, for example, is different between +# GLES1 and GLES2). +keys = apiutil.GetAllFunctions(functionList, version) + +allSpecials = apiutil.AllSpecials() + +print """/* DO NOT EDIT ************************************************* + * THIS FILE AUTOMATICALLY GENERATED BY THE %s SCRIPT + * API specification file: %s + * GLES version: %s + * date: %s + */ +""" % (program, functionList, version, time.strftime("%Y-%m-%d %H:%M:%S")) + +# The headers we choose are version-specific. +print """ +#include "%s" +#include "%s" +#include "main/mfeatures.h" + +#if FEATURE_%s +""" % (versionHeader, versionExtHeader, shortname.upper()) + +# Everyone needs these types. +print """ +/* These types are needed for the Mesa veneer, but are not defined in + * the standard GLES headers. + */ +typedef double GLdouble; +typedef double GLclampd; + +/* Mesa error handling requires these */ +extern void *_mesa_get_current_context(void); +extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... ); + +#include "main/compiler.h" +#include "main/api_exec.h" +#include "main/remap.h" + +/* cannot include main/dispatch.h here */ +#ifdef IN_DRI_DRIVER +#define _GLAPI_USE_REMAP_TABLE +#endif +/* glapi uses GLAPIENTRY while GLES headers define GL_APIENTRY */ +#ifndef GLAPIENTRY +#define GLAPIENTRY GL_APIENTRY +#endif +#include "%sapi/glapi/glapitable.h" +#include "%sapi/glapi/glapioffsets.h" +#include "%sapi/glapi/glapidispatch.h" + +#if FEATURE_remap_table + +#if !FEATURE_GL +int driDispatchRemapTable[driDispatchRemapTable_size]; +#endif + +#define need_MESA_remap_table + +#include "%sapi/main/remap_helper.h" + +void +_mesa_init_remap_table_%s(void) +{ + _mesa_do_init_remap_table(_mesa_function_pool, + driDispatchRemapTable_size, + MESA_remap_table_functions); +} + +void +_mesa_map_static_functions_%s(void) +{ +} + +#endif + +typedef void (*_glapi_proc)(void); /* generic function pointer */ +""" % (shortname, shortname, shortname, shortname, shortname, shortname); + +# Finally we get to the all-important functions +print """/************************************************************* + * Generated functions begin here + */ +""" +for funcName in keys: + if verbose > 0: sys.stderr.write("%s: processing function %s\n" % (program, funcName)) + + # start figuring out what this function will look like. + returnType = apiutil.ReturnType(funcName) + props = apiutil.Properties(funcName) + params = apiutil.Parameters(funcName) + declarationString = apiutil.MakeDeclarationString(params) + + # In case of error, a function may have to return. Make + # sure we have valid return values in this case. + if returnType == "void": + errorReturn = "return" + elif returnType == "GLboolean": + errorReturn = "return GL_FALSE" + else: + errorReturn = "return (%s) 0" % returnType + + # These are the output of this large calculation block. + # passthroughDeclarationString: a typed set of parameters that + # will be used to create the "extern" reference for the + # underlying Mesa or support function. Note that as generated + # these have an extra ", " at the beginning, which will be + # removed before use. + # + # passthroughDeclarationString: an untyped list of parameters + # that will be used to call the underlying Mesa or support + # function (including references to converted parameters). + # This will also be generated with an extra ", " at the + # beginning, which will be removed before use. + # + # variables: C code to create any local variables determined to + # be necessary. + # conversionCodeOutgoing: C code to convert application parameters + # to a necessary type before calling the underlying support code. + # May be empty if no conversion is required. + # conversionCodeIncoming: C code to do the converse: convert + # values returned by underlying Mesa code to the types needed + # by the application. + # Note that *either* the conversionCodeIncoming will be used (for + # generated query functions), *or* the conversionCodeOutgoing will + # be used (for generated non-query functions), never both. + passthroughFuncName = "" + passthroughDeclarationString = "" + passthroughCallString = "" + prefixOverride = None + variables = [] + conversionCodeOutgoing = [] + conversionCodeIncoming = [] + switchCode = [] + + # Calculate the name of the underlying support function to call. + # By default, the passthrough function is named _mesa_<funcName>. + # We're allowed to override the prefix and/or the function name + # for each function record, though. The "ConversionFunction" + # utility is poorly named, BTW... + if funcName in allSpecials: + # perform checks and pass through + funcPrefix = "_check_" + aliasprefix = "_es_" + else: + funcPrefix = "_es_" + aliasprefix = apiutil.AliasPrefix(funcName) + alias = apiutil.ConversionFunction(funcName) + prefixOverride = apiutil.FunctionPrefix(funcName) + if prefixOverride != "_mesa_": + aliasprefix = apiutil.FunctionPrefix(funcName) + if not alias: + # There may still be a Mesa alias for the function + if apiutil.Alias(funcName): + passthroughFuncName = "%s%s" % (aliasprefix, apiutil.Alias(funcName)) + else: + passthroughFuncName = "%s%s" % (aliasprefix, funcName) + else: # a specific alias is provided + passthroughFuncName = "%s%s" % (aliasprefix, alias) + + # Look at every parameter: each one may have only specific + # allowed values, or dependent parameters to check, or + # variant-sized vector arrays to calculate + for (paramName, paramType, paramMaxVecSize, paramConvertToType, paramValidValues, paramValueConversion) in params: + # We'll need this below if we're doing conversions + (paramBaseType, paramTypeModifiers) = GetBaseType(paramType) + + # Conversion management. + # We'll handle three cases, easiest to hardest: a parameter + # that doesn't require conversion, a scalar parameter that + # requires conversion, and a vector parameter that requires + # conversion. + if paramConvertToType == None: + # Unconverted parameters are easy, whether they're vector + # or scalar - just add them to the call list. No conversions + # or anything to worry about. + passthroughDeclarationString += ", %s %s" % (paramType, paramName) + passthroughCallString += ", %s" % paramName + + elif paramMaxVecSize == 0: # a scalar parameter that needs conversion + # A scalar to hold a converted parameter + variables.append(" %s converted_%s;" % (paramConvertToType, paramName)) + + # Outgoing conversion depends on whether we have to conditionally + # perform value conversion. + if paramValueConversion == "none": + conversionCodeOutgoing.append(" converted_%s = (%s) %s;" % (paramName, paramConvertToType, paramName)) + elif paramValueConversion == "some": + # We'll need a conditional variable to keep track of + # whether we're converting values or not. + if (" int convert_%s_value = 1;" % paramName) not in variables: + variables.append(" int convert_%s_value = 1;" % paramName) + + # Write code based on that conditional. + conversionCodeOutgoing.append(" if (convert_%s_value) {" % paramName) + conversionCodeOutgoing.append(" converted_%s = %s;" % (paramName, ConvertValue(paramName, paramBaseType, paramConvertToType))) + conversionCodeOutgoing.append(" } else {") + conversionCodeOutgoing.append(" converted_%s = (%s) %s;" % (paramName, paramConvertToType, paramName)) + conversionCodeOutgoing.append(" }") + else: # paramValueConversion == "all" + conversionCodeOutgoing.append(" converted_%s = %s;" % (paramName, ConvertValue(paramName, paramBaseType, paramConvertToType))) + + # Note that there can be no incoming conversion for a + # scalar parameter; changing the scalar will only change + # the local value, and won't ultimately change anything + # that passes back to the application. + + # Call strings. The unusual " ".join() call will join the + # array of parameter modifiers with spaces as separators. + passthroughDeclarationString += ", %s %s %s" % (paramConvertToType, " ".join(paramTypeModifiers), paramName) + passthroughCallString += ", converted_%s" % paramName + + else: # a vector parameter that needs conversion + # We'll need an index variable for conversions + if " register unsigned int i;" not in variables: + variables.append(" register unsigned int i;") + + # This variable will hold the (possibly variant) size of + # this array needing conversion. By default, we'll set + # it to the maximal size (which is correct for functions + # with a constant-sized vector parameter); for true + # variant arrays, we'll modify it with other code. + variables.append(" unsigned int n_%s = %d;" % (paramName, paramMaxVecSize)) + + # This array will hold the actual converted values. + variables.append(" %s converted_%s[%d];" % (paramConvertToType, paramName, paramMaxVecSize)) + + # Again, we choose the conversion code based on whether we + # have to always convert values, never convert values, or + # conditionally convert values. + if paramValueConversion == "none": + conversionCodeOutgoing.append(" for (i = 0; i < n_%s; i++) {" % paramName) + conversionCodeOutgoing.append(" converted_%s[i] = (%s) %s[i];" % (paramName, paramConvertToType, paramName)) + conversionCodeOutgoing.append(" }") + elif paramValueConversion == "some": + # We'll need a conditional variable to keep track of + # whether we're converting values or not. + if (" int convert_%s_value = 1;" % paramName) not in variables: + variables.append(" int convert_%s_value = 1;" % paramName) + # Write code based on that conditional. + conversionCodeOutgoing.append(" if (convert_%s_value) {" % paramName) + conversionCodeOutgoing.append(" for (i = 0; i < n_%s; i++) {" % paramName) + conversionCodeOutgoing.append(" converted_%s[i] = %s;" % (paramName, ConvertValue("%s[i]" % paramName, paramBaseType, paramConvertToType))) + conversionCodeOutgoing.append(" }") + conversionCodeOutgoing.append(" } else {") + conversionCodeOutgoing.append(" for (i = 0; i < n_%s; i++) {" % paramName) + conversionCodeOutgoing.append(" converted_%s[i] = (%s) %s[i];" % (paramName, paramConvertToType, paramName)) + conversionCodeOutgoing.append(" }") + conversionCodeOutgoing.append(" }") + else: # paramValueConversion == "all" + conversionCodeOutgoing.append(" for (i = 0; i < n_%s; i++) {" % paramName) + conversionCodeOutgoing.append(" converted_%s[i] = %s;" % (paramName, ConvertValue("%s[i]" % paramName, paramBaseType, paramConvertToType))) + + conversionCodeOutgoing.append(" }") + + # If instead we need an incoming conversion (i.e. results + # from Mesa have to be converted before handing back + # to the application), this is it. Fortunately, we don't + # have to worry about conditional value conversion - the + # functions that do (e.g. glGetFixedv()) are handled + # specially, outside this code generation. + # + # Whether we use incoming conversion or outgoing conversion + # is determined later - we only ever use one or the other. + + if paramValueConversion == "none": + conversionCodeIncoming.append(" for (i = 0; i < n_%s; i++) {" % paramName) + conversionCodeIncoming.append(" %s[i] = (%s) converted_%s[i];" % (paramName, paramConvertToType, paramName)) + conversionCodeIncoming.append(" }") + elif paramValueConversion == "some": + # We'll need a conditional variable to keep track of + # whether we're converting values or not. + if (" int convert_%s_value = 1;" % paramName) not in variables: + variables.append(" int convert_%s_value = 1;" % paramName) + + # Write code based on that conditional. + conversionCodeIncoming.append(" if (convert_%s_value) {" % paramName) + conversionCodeIncoming.append(" for (i = 0; i < n_%s; i++) {" % paramName) + conversionCodeIncoming.append(" %s[i] = %s;" % (paramName, ConvertValue("converted_%s[i]" % paramName, paramConvertToType, paramBaseType))) + conversionCodeIncoming.append(" }") + conversionCodeIncoming.append(" } else {") + conversionCodeIncoming.append(" for (i = 0; i < n_%s; i++) {" % paramName) + conversionCodeIncoming.append(" %s[i] = (%s) converted_%s[i];" % (paramName, paramBaseType, paramName)) + conversionCodeIncoming.append(" }") + conversionCodeIncoming.append(" }") + else: # paramValueConversion == "all" + conversionCodeIncoming.append(" for (i = 0; i < n_%s; i++) {" % paramName) + conversionCodeIncoming.append(" %s[i] = %s;" % (paramName, ConvertValue("converted_%s[i]" % paramName, paramConvertToType, paramBaseType))) + conversionCodeIncoming.append(" }") + + # Call strings. The unusual " ".join() call will join the + # array of parameter modifiers with spaces as separators. + passthroughDeclarationString += ", %s %s %s" % (paramConvertToType, " ".join(paramTypeModifiers), paramName) + passthroughCallString += ", converted_%s" % paramName + + # endif conversion management + + # Parameter checking. If the parameter has a specific list of + # valid values, we have to make sure that the passed-in values + # match these, or we make an error. + if len(paramValidValues) > 0: + # We're about to make a big switch statement with an + # error at the end. By default, the error is GL_INVALID_ENUM, + # unless we find a "case" statement in the middle with a + # non-GLenum value. + errorDefaultCase = "GL_INVALID_ENUM" + + # This parameter has specific valid values. Make a big + # switch statement to handle it. Note that the original + # parameters are always what is checked, not the + # converted parameters. + switchCode.append(" switch(%s) {" % paramName) + + for valueIndex in range(len(paramValidValues)): + (paramValue, dependentVecSize, dependentParamName, dependentValidValues, errorCode, valueConvert) = paramValidValues[valueIndex] + + # We're going to need information on the dependent param + # as well. + if dependentParamName: + depParamIndex = apiutil.FindParamIndex(params, dependentParamName) + if depParamIndex == None: + sys.stderr.write("%s: can't find dependent param '%s' for function '%s'\n" % (program, dependentParamName, funcName)) + + (depParamName, depParamType, depParamMaxVecSize, depParamConvertToType, depParamValidValues, depParamValueConversion) = params[depParamIndex] + else: + (depParamName, depParamType, depParamMaxVecSize, depParamConvertToType, depParamValidValues, depParamValueConversion) = (None, None, None, None, [], None) + + # This is a sneaky trick. It's valid syntax for a parameter + # that is *not* going to be converted to be declared + # with a dependent vector size; but in this case, the + # dependent vector size is unused and unnecessary. + # So check for this and ignore the dependent vector size + # if the parameter is not going to be converted. + if depParamConvertToType: + usedDependentVecSize = dependentVecSize + else: + usedDependentVecSize = None + + # We'll peek ahead at the next parameter, to see whether + # we can combine cases + if valueIndex + 1 < len(paramValidValues) : + (nextParamValue, nextDependentVecSize, nextDependentParamName, nextDependentValidValues, nextErrorCode, nextValueConvert) = paramValidValues[valueIndex + 1] + if depParamConvertToType: + usedNextDependentVecSize = nextDependentVecSize + else: + usedNextDependentVecSize = None + + # Create a case for this value. As a mnemonic, + # if we have a dependent vector size that we're ignoring, + # add it as a comment. + if usedDependentVecSize == None and dependentVecSize != None: + switchCode.append(" case %s: /* size %s */" % (paramValue, dependentVecSize)) + else: + switchCode.append(" case %s:" % paramValue) + + # If this is not a GLenum case, then switch our error + # if no value is matched to be GL_INVALID_VALUE instead + # of GL_INVALID_ENUM. (Yes, this does get confused + # if there are both values and GLenums in the same + # switch statement, which shouldn't happen.) + if paramValue[0:3] != "GL_": + errorDefaultCase = "GL_INVALID_VALUE" + + # If all the remaining parameters are identical to the + # next set, then we're done - we'll just create the + # official code on the next pass through, and the two + # cases will share the code. + if valueIndex + 1 < len(paramValidValues) and usedDependentVecSize == usedNextDependentVecSize and dependentParamName == nextDependentParamName and dependentValidValues == nextDependentValidValues and errorCode == nextErrorCode and valueConvert == nextValueConvert: + continue + + # Otherwise, we'll have to generate code for this case. + # Start off with a check: if there is a dependent parameter, + # and a list of valid values for that parameter, we need + # to generate an error if something other than one + # of those values is passed. + if len(dependentValidValues) > 0: + conditional="" + + # If the parameter being checked is actually an array, + # check only its first element. + if depParamMaxVecSize == 0: + valueToCheck = dependentParamName + else: + valueToCheck = "%s[0]" % dependentParamName + + for v in dependentValidValues: + conditional += " && %s != %s" % (valueToCheck, v) + switchCode.append(" if (%s) {" % conditional[4:]) + if errorCode == None: + errorCode = "GL_INVALID_ENUM" + switchCode.append(' _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s=0x%s)", %s);' % (errorCode, funcName, paramName, "%x", paramName)) + switchCode.append(" %s;" % errorReturn) + switchCode.append(" }") + # endif there are dependent valid values + + # The dependent parameter may require conditional + # value conversion. If it does, and we don't want + # to convert values, we'll have to generate code for that + if depParamValueConversion == "some" and valueConvert == "noconvert": + switchCode.append(" convert_%s_value = 0;" % dependentParamName) + + # If there's a dependent vector size for this parameter + # that we're actually going to use (i.e. we need conversion), + # mark it. + if usedDependentVecSize: + switchCode.append(" n_%s = %s;" % (dependentParamName, dependentVecSize)) + + # In all cases, break out of the switch if any valid + # value is found. + switchCode.append(" break;") + + + # Need a default case to catch all the other, invalid + # parameter values. These will all generate errors. + switchCode.append(" default:") + if errorCode == None: + errorCode = "GL_INVALID_ENUM" + formatString = GetFormatString(paramType) + if formatString == None: + switchCode.append(' _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s)");' % (errorCode, funcName, paramName)) + else: + switchCode.append(' _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s=%s)", %s);' % (errorCode, funcName, paramName, formatString, paramName)) + switchCode.append(" %s;" % errorReturn) + + # End of our switch code. + switchCode.append(" }") + + # endfor every recognized parameter value + + # endfor every param + + # Here, the passthroughDeclarationString and passthroughCallString + # are complete; remove the extra ", " at the front of each. + passthroughDeclarationString = passthroughDeclarationString[2:] + passthroughCallString = passthroughCallString[2:] + if not passthroughDeclarationString: + passthroughDeclarationString = "void" + + # The Mesa functions are scattered across all the Mesa + # header files. The easiest way to manage declarations + # is to create them ourselves. + if funcName in allSpecials: + print "/* this function is special and is defined elsewhere */" + print "extern %s GL_APIENTRY %s(%s);" % (returnType, passthroughFuncName, passthroughDeclarationString) + + # A function may be a core function (i.e. it exists in + # the core specification), a core addition (extension + # functions added officially to the core), a required + # extension (usually an extension for an earlier version + # that has been officially adopted), or an optional extension. + # + # Core functions have a simple category (e.g. "GLES1.1"); + # we generate only a simple callback for them. + # + # Core additions have two category listings, one simple + # and one compound (e.g. ["GLES1.1", "GLES1.1:OES_fixed_point"]). + # We generate the core function, and also an extension function. + # + # Required extensions and implemented optional extensions + # have a single compound category "GLES1.1:OES_point_size_array". + # For these we generate just the extension function. + for categorySpec in apiutil.Categories(funcName): + compoundCategory = categorySpec.split(":") + + # This category isn't for us, if the base category doesn't match + # our version + if compoundCategory[0] != version: + continue + + # Otherwise, determine if we're writing code for a core + # function (no suffix) or an extension function. + if len(compoundCategory) == 1: + # This is a core function + extensionName = None + extensionSuffix = "" + else: + # This is an extension function. We'll need to append + # the extension suffix. + extensionName = compoundCategory[1] + extensionSuffix = extensionName.split("_")[0] + fullFuncName = funcPrefix + funcName + extensionSuffix + + # Now the generated function. The text used to mark an API-level + # function, oddly, is version-specific. + if extensionName: + print "/* Extension %s */" % extensionName + + if (not variables and + not switchCode and + not conversionCodeOutgoing and + not conversionCodeIncoming): + # pass through directly + print "#define %s %s" % (fullFuncName, passthroughFuncName) + print + continue + + print "static %s GL_APIENTRY %s(%s)" % (returnType, fullFuncName, declarationString) + print "{" + + # Start printing our code pieces. Start with any local + # variables we need. This unusual syntax joins the + # lines in the variables[] array with the "\n" separator. + if len(variables) > 0: + print "\n".join(variables) + "\n" + + # If there's any sort of parameter checking or variable + # array sizing, the switch code will contain it. + if len(switchCode) > 0: + print "\n".join(switchCode) + "\n" + + # In the case of an outgoing conversion (i.e. parameters must + # be converted before calling the underlying Mesa function), + # use the appropriate code. + if "get" not in props and len(conversionCodeOutgoing) > 0: + print "\n".join(conversionCodeOutgoing) + "\n" + + # Call the Mesa function. Note that there are very few functions + # that return a value (i.e. returnType is not "void"), and that + # none of them require incoming translation; so we're safe + # to generate code that directly returns in those cases, + # even though it's not completely independent. + + if returnType == "void": + print " %s(%s);" % (passthroughFuncName, passthroughCallString) + else: + print " return %s(%s);" % (passthroughFuncName, passthroughCallString) + + # If the function is one that returns values (i.e. "get" in props), + # it might return values of a different type than we need, that + # require conversion before passing back to the application. + if "get" in props and len(conversionCodeIncoming) > 0: + print "\n".join(conversionCodeIncoming) + + # All done. + print "}" + print + # end for each category provided for a function + +# end for each function + +print """ +struct _glapi_table * +_mesa_create_exec_table_%s(void) +{ + struct _glapi_table *exec; + exec = _mesa_alloc_dispatch_table(sizeof *exec); + if (exec == NULL) + return NULL; + +""" % shortname + +for func in keys: + prefix = "_es_" if func not in allSpecials else "_check_" + for spec in apiutil.Categories(func): + ext = spec.split(":") + # version does not match + if ext.pop(0) != version: + continue + entry = func + if ext: + suffix = ext[0].split("_")[0] + entry += suffix + print " SET_%s(exec, %s%s);" % (entry, prefix, entry) +print "" +print " return exec;" +print "}" + +print """ +#endif /* FEATURE_%s */""" % (shortname.upper()) diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 30245d6aa..080fa98df 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -28,7 +28,6 @@ #include "imports.h" #include "context.h" #include "extensions.h" -#include "simple_list.h" #include "mtypes.h" @@ -45,35 +44,44 @@ static const struct { const char *name; int flag_offset; } default_extensions[] = { + { OFF, "GL_ARB_blend_func_extended", F(ARB_blend_func_extended) }, { OFF, "GL_ARB_copy_buffer", F(ARB_copy_buffer) }, - { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, + { OFF, "GL_ARB_depth_buffer_float", F(ARB_depth_buffer_float) }, { OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) }, + { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, { ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) }, { OFF, "GL_ARB_draw_elements_base_vertex", F(ARB_draw_elements_base_vertex) }, + { OFF, "GL_ARB_draw_instanced", F(ARB_draw_instanced) }, { OFF, "GL_ARB_fragment_coord_conventions", F(ARB_fragment_coord_conventions) }, { OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) }, { OFF, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow) }, { OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) }, { OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) }, + { OFF, "GL_ARB_explicit_attrib_location", F(ARB_explicit_attrib_location) }, + /* TODO: reenable this when the new GLSL compiler actually supports them */ + /* { OFF, "GL_ARB_geometry_shader4", F(ARB_geometry_shader4) }, */ { OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) }, { OFF, "GL_ARB_half_float_vertex", F(ARB_half_float_vertex) }, { OFF, "GL_ARB_imaging", F(ARB_imaging) }, + { OFF, "GL_ARB_instanced_arrays", F(ARB_instanced_arrays) }, { OFF, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range) }, { ON, "GL_ARB_multisample", F(ARB_multisample) }, { OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, { OFF, "GL_ARB_occlusion_query", F(ARB_occlusion_query) }, + { OFF, "GL_ARB_occlusion_query2", F(ARB_occlusion_query2) }, { OFF, "GL_ARB_pixel_buffer_object", F(EXT_pixel_buffer_object) }, { OFF, "GL_ARB_point_parameters", F(EXT_point_parameters) }, { OFF, "GL_ARB_point_sprite", F(ARB_point_sprite) }, { OFF, "GL_ARB_provoking_vertex", F(EXT_provoking_vertex) }, + { OFF, "GL_ARB_sampler_objects", F(ARB_sampler_objects) }, { OFF, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map) }, { OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) }, { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) }, - { OFF, "GL_ARB_shading_language_120", F(ARB_shading_language_120) }, { OFF, "GL_ARB_shadow", F(ARB_shadow) }, { OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) }, { OFF, "GL_ARB_sync", F(ARB_sync) }, { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, + { OFF, "GL_ARB_texture_buffer_object", F(ARB_texture_buffer_object) }, { ON, "GL_ARB_texture_compression", F(ARB_texture_compression) }, { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, { OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) }, @@ -82,14 +90,21 @@ static const struct { { OFF, "GL_ARB_texture_env_dot3", F(ARB_texture_env_dot3) }, { OFF, "GL_MESAX_texture_float", F(ARB_texture_float) }, { OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)}, + { OFF, "GL_ARB_texture_multisample", F(ARB_texture_multisample) }, { OFF, "GL_ARB_texture_non_power_of_two", F(ARB_texture_non_power_of_two)}, { OFF, "GL_ARB_texture_rectangle", F(NV_texture_rectangle) }, + { OFF, "GL_ARB_texture_rg", F(ARB_texture_rg) }, + { OFF, "GL_ARB_texture_rgb10_a2ui", F(ARB_texture_rgb10_a2ui) }, + { OFF, "GL_ARB_texture_swizzle", F(EXT_texture_swizzle) }, { ON, "GL_ARB_transpose_matrix", F(ARB_transpose_matrix) }, + { OFF, "GL_ARB_transform_feedback2", F(ARB_transform_feedback2) }, + { OFF, "GL_ARB_uniform_buffer_object", F(ARB_uniform_buffer_object) }, { OFF, "GL_ARB_vertex_array_bgra", F(EXT_vertex_array_bgra) }, { OFF, "GL_ARB_vertex_array_object", F(ARB_vertex_array_object) }, { ON, "GL_ARB_vertex_buffer_object", F(ARB_vertex_buffer_object) }, { OFF, "GL_ARB_vertex_program", F(ARB_vertex_program) }, { OFF, "GL_ARB_vertex_shader", F(ARB_vertex_shader) }, + { OFF, "GL_ARB_vertex_type_2_10_10_10_rev", F(ARB_vertex_type_2_10_10_10_rev) }, { ON, "GL_ARB_window_pos", F(ARB_window_pos) }, { ON, "GL_EXT_abgr", F(EXT_abgr) }, { ON, "GL_EXT_bgra", F(EXT_bgra) }, @@ -106,15 +121,18 @@ static const struct { { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) }, { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) }, { OFF, "GL_EXT_draw_buffers2", F(EXT_draw_buffers2) }, + { OFF, "GL_EXT_draw_instanced", F(ARB_draw_instanced) }, { ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) }, { OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) }, { OFF, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample) }, { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) }, + { OFF, "GL_EXT_framebuffer_sRGB", F(EXT_framebuffer_sRGB) }, { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, { OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) }, { OFF, "GL_EXT_histogram", F(EXT_histogram) }, { ON, "GL_EXT_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_EXT_packed_depth_stencil", F(EXT_packed_depth_stencil) }, + { OFF, "GL_EXT_packed_float", F(EXT_packed_float) }, { ON, "GL_EXT_packed_pixels", F(EXT_packed_pixels) }, { OFF, "GL_EXT_paletted_texture", F(EXT_paletted_texture) }, { OFF, "GL_EXT_pixel_buffer_object", F(EXT_pixel_buffer_object) }, @@ -133,19 +151,23 @@ static const struct { { ON, "GL_EXT_texture3D", F(EXT_texture3D) }, { OFF, "GL_EXT_texture_array", F(EXT_texture_array) }, { OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) }, + { OFF, "GL_EXT_texture_compression_rgtc", F(EXT_texture_compression_rgtc) }, { OFF, "GL_EXT_texture_cube_map", F(ARB_texture_cube_map) }, { ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) }, { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) }, { OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) }, { OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) }, + { OFF, "GL_EXT_texture_integer", F(EXT_texture_integer) }, { OFF, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) }, { OFF, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp) }, { ON, "GL_EXT_texture_object", F(EXT_texture_object) }, { OFF, "GL_EXT_texture_rectangle", F(NV_texture_rectangle) }, + { OFF, "GL_EXT_texture_shared_exponent", F(EXT_texture_shared_exponent) }, { OFF, "GL_EXT_texture_sRGB", F(EXT_texture_sRGB) }, { OFF, "GL_EXT_texture_swizzle", F(EXT_texture_swizzle) }, { OFF, "GL_EXT_timer_query", F(EXT_timer_query) }, + { OFF, "GL_EXT_transform_feedback", F(EXT_transform_feedback) }, { ON, "GL_EXT_vertex_array", F(EXT_vertex_array) }, { OFF, "GL_EXT_vertex_array_bgra", F(EXT_vertex_array_bgra) }, { OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) }, @@ -179,9 +201,10 @@ static const struct { { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) }, { OFF, "GL_NV_packed_depth_stencil", F(EXT_packed_depth_stencil) }, { OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, + { OFF, "GL_NV_primitive_restart", F(NV_primitive_restart) }, + { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, { OFF, "GL_NV_texture_env_combine4", F(NV_texture_env_combine4) }, { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, - { ON, "GL_NV_texgen_reflection", F(NV_texgen_reflection) }, { OFF, "GL_NV_vertex_program", F(NV_vertex_program) }, { OFF, "GL_NV_vertex_program1_1", F(NV_vertex_program1_1) }, { ON, "GL_OES_read_format", F(OES_read_format) }, @@ -194,6 +217,9 @@ static const struct { { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, { ON, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_S3_s3tc", F(S3_s3tc) }, +#if FEATURE_OES_EGL_image + { OFF, "GL_OES_EGL_image", F(OES_EGL_image) }, +#endif #if FEATURE_OES_draw_texture { OFF, "GL_OES_draw_texture", F(OES_draw_texture) }, #endif /* FEATURE_OES_draw_texture */ @@ -224,6 +250,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #if FEATURE_ARB_framebuffer_object ctx->Extensions.ARB_framebuffer_object = GL_TRUE; #endif +#if FEATURE_ARB_geometry_shader4 + ctx->Extensions.ARB_geometry_shader4 = GL_TRUE; +#endif ctx->Extensions.ARB_half_float_pixel = GL_TRUE; ctx->Extensions.ARB_half_float_vertex = GL_TRUE; ctx->Extensions.ARB_imaging = GL_TRUE; @@ -239,9 +268,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #if FEATURE_ARB_shading_language_100 ctx->Extensions.ARB_shading_language_100 = GL_TRUE; #endif -#if FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_TRUE; -#endif ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_shadow_ambient = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; @@ -319,6 +345,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.EXT_texture_sRGB = GL_TRUE; #endif ctx->Extensions.EXT_texture_swizzle = GL_TRUE; +#if FEATURE_EXT_transform_feedback + /*ctx->Extensions.EXT_transform_feedback = GL_TRUE;*/ +#endif ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE; /*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/ ctx->Extensions.MESA_pack_invert = GL_TRUE; @@ -480,13 +509,9 @@ _mesa_enable_2_1_extensions(GLcontext *ctx) #if FEATURE_EXT_texture_sRGB ctx->Extensions.EXT_texture_sRGB = GL_TRUE; #endif -#ifdef FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_TRUE; -#endif } - /** * Either enable or disable the named extension. * \return GL_TRUE for success, GL_FALSE if invalid extension name @@ -672,8 +697,8 @@ _mesa_init_extensions( GLcontext *ctx ) * Construct the GL_EXTENSIONS string. Called the first time that * glGetString(GL_EXTENSIONS) is called. */ -GLubyte * -_mesa_make_extension_string( GLcontext *ctx ) +static GLubyte * +compute_extensions( GLcontext *ctx ) { const char *extraExt = get_extension_override(ctx); GLuint extStrLen = 0; @@ -718,6 +743,206 @@ _mesa_make_extension_string( GLcontext *ctx ) return (GLubyte *) s; } +static size_t +append_extension(GLubyte **str, const char *ext) +{ + GLubyte *s = *str; + size_t len = strlen(ext); + + if (s) { + memcpy(s, ext, len); + s[len++] = ' '; + s[len] = '\0'; + + *str += len; + } + else { + len++; + } + + return len; +} + + +static size_t +make_extension_string_es1(const GLcontext *ctx, GLubyte *str) +{ + size_t len = 0; + + /* Core additions */ + len += append_extension(&str, "GL_OES_byte_coordinates"); + len += append_extension(&str, "GL_OES_fixed_point"); + len += append_extension(&str, "GL_OES_single_precision"); + len += append_extension(&str, "GL_OES_matrix_get"); + + /* 1.1 required extensions */ + len += append_extension(&str, "GL_OES_read_format"); + len += append_extension(&str, "GL_OES_compressed_paletted_texture"); + len += append_extension(&str, "GL_OES_point_size_array"); + len += append_extension(&str, "GL_OES_point_sprite"); + + /* 1.1 deprecated extensions */ + len += append_extension(&str, "GL_OES_query_matrix"); + +#if FEATURE_OES_draw_texture + if (ctx->Extensions.OES_draw_texture) + len += append_extension(&str, "GL_OES_draw_texture"); +#endif + + if (ctx->Extensions.EXT_blend_equation_separate) + len += append_extension(&str, "GL_OES_blend_equation_separate"); + if (ctx->Extensions.EXT_blend_func_separate) + len += append_extension(&str, "GL_OES_blend_func_separate"); + if (ctx->Extensions.EXT_blend_subtract) + len += append_extension(&str, "GL_OES_blend_subtract"); + + if (ctx->Extensions.EXT_stencil_wrap) + len += append_extension(&str, "GL_OES_stencil_wrap"); + + if (ctx->Extensions.ARB_texture_cube_map) + len += append_extension(&str, "GL_OES_texture_cube_map"); + if (ctx->Extensions.ARB_texture_env_crossbar) + len += append_extension(&str, "GL_OES_texture_env_crossbar"); + if (ctx->Extensions.ARB_texture_mirrored_repeat) + len += append_extension(&str, "GL_OES_texture_mirrored_repeat"); + + if (ctx->Extensions.ARB_framebuffer_object) { + len += append_extension(&str, "GL_OES_framebuffer_object"); + len += append_extension(&str, "GL_OES_depth24"); + len += append_extension(&str, "GL_OES_depth32"); + len += append_extension(&str, "GL_OES_fbo_render_mipmap"); + len += append_extension(&str, "GL_OES_rgb8_rgba8"); + len += append_extension(&str, "GL_OES_stencil1"); + len += append_extension(&str, "GL_OES_stencil4"); + len += append_extension(&str, "GL_OES_stencil8"); + } + + if (ctx->Extensions.EXT_vertex_array) + len += append_extension(&str, "GL_OES_element_index_uint"); + if (ctx->Extensions.ARB_vertex_buffer_object) + len += append_extension(&str, "GL_OES_mapbuffer"); + if (ctx->Extensions.EXT_texture_filter_anisotropic) + len += append_extension(&str, "GL_EXT_texture_filter_anisotropic"); + + /* some applications check this for NPOT support */ + if (ctx->Extensions.ARB_texture_non_power_of_two) + len += append_extension(&str, "GL_ARB_texture_non_power_of_two"); + + if (ctx->Extensions.EXT_texture_compression_s3tc) + len += append_extension(&str, "GL_EXT_texture_compression_dxt1"); + if (ctx->Extensions.EXT_texture_lod_bias) + len += append_extension(&str, "GL_EXT_texture_lod_bias"); + if (ctx->Extensions.EXT_blend_minmax) + len += append_extension(&str, "GL_EXT_blend_minmax"); + if (ctx->Extensions.EXT_multi_draw_arrays) + len += append_extension(&str, "GL_EXT_multi_draw_arrays"); + +#if FEATURE_OES_EGL_image + if (ctx->Extensions.OES_EGL_image) + len += append_extension(&str, "GL_OES_EGL_image"); +#endif + + return len; +} + + +static GLubyte * +compute_extensions_es1(const GLcontext *ctx) +{ + GLubyte *s; + unsigned int len; + + len = make_extension_string_es1(ctx, NULL); + s = malloc(len + 1); + if (!s) + return NULL; + make_extension_string_es1(ctx, s); + + return s; +} + +static size_t +make_extension_string_es2(const GLcontext *ctx, GLubyte *str) +{ + size_t len = 0; + + len += append_extension(&str, "GL_OES_compressed_paletted_texture"); + + if (ctx->Extensions.ARB_framebuffer_object) { + len += append_extension(&str, "GL_OES_depth24"); + len += append_extension(&str, "GL_OES_depth32"); + len += append_extension(&str, "GL_OES_fbo_render_mipmap"); + len += append_extension(&str, "GL_OES_rgb8_rgba8"); + len += append_extension(&str, "GL_OES_stencil1"); + len += append_extension(&str, "GL_OES_stencil4"); + } + + if (ctx->Extensions.EXT_vertex_array) + len += append_extension(&str, "GL_OES_element_index_uint"); + if (ctx->Extensions.ARB_vertex_buffer_object) + len += append_extension(&str, "GL_OES_mapbuffer"); + + if (ctx->Extensions.EXT_texture3D) + len += append_extension(&str, "GL_OES_texture_3D"); + if (ctx->Extensions.ARB_texture_non_power_of_two) + len += append_extension(&str, "GL_OES_texture_npot"); + if (ctx->Extensions.EXT_texture_filter_anisotropic) + len += append_extension(&str, "GL_EXT_texture_filter_anisotropic"); + + len += append_extension(&str, "GL_EXT_texture_type_2_10_10_10_REV"); + if (ctx->Extensions.ARB_depth_texture) + len += append_extension(&str, "GL_OES_depth_texture"); + if (ctx->Extensions.EXT_packed_depth_stencil) + len += append_extension(&str, "GL_OES_packed_depth_stencil"); + if (ctx->Extensions.ARB_fragment_shader) + len += append_extension(&str, "GL_OES_standard_derivatives"); + + if (ctx->Extensions.EXT_texture_compression_s3tc) + len += append_extension(&str, "GL_EXT_texture_compression_dxt1"); + if (ctx->Extensions.EXT_blend_minmax) + len += append_extension(&str, "GL_EXT_blend_minmax"); + if (ctx->Extensions.EXT_multi_draw_arrays) + len += append_extension(&str, "GL_EXT_multi_draw_arrays"); + +#if FEATURE_OES_EGL_image + if (ctx->Extensions.OES_EGL_image) + len += append_extension(&str, "GL_OES_EGL_image"); +#endif + + return len; +} + +static GLubyte * +compute_extensions_es2(GLcontext *ctx) +{ + GLubyte *s; + unsigned int len; + + len = make_extension_string_es2(ctx, NULL); + s = malloc(len + 1); + if (!s) + return NULL; + make_extension_string_es2(ctx, s); + + return s; +} + + +GLubyte * +_mesa_make_extension_string(GLcontext *ctx) +{ + switch (ctx->API) { + case API_OPENGL: + return compute_extensions(ctx); + case API_OPENGLES2: + return compute_extensions_es2(ctx); + case API_OPENGLES: + return compute_extensions_es1(ctx); + default: + assert(0); + return NULL; + } +} /** * Return number of enabled extensions. @@ -738,7 +963,7 @@ _mesa_get_extension_count(GLcontext *ctx) if (0) _mesa_debug(ctx, "%u of %d extensions enabled\n", ctx->Extensions.Count, - Elements(default_extensions)); + (int) Elements(default_extensions)); return ctx->Extensions.Count; } diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index cc20f7479..5201f5025 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -71,6 +71,10 @@ static struct gl_framebuffer DummyFramebuffer; static struct gl_renderbuffer DummyRenderbuffer; +/* We bind this framebuffer when applications pass a NULL + * drawable/surface in make current. */ +static struct gl_framebuffer IncompleteFramebuffer; + #define IS_CUBE_FACE(TARGET) \ ((TARGET) >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && \ @@ -93,10 +97,19 @@ delete_dummy_framebuffer(struct gl_framebuffer *fb) void _mesa_init_fbobjects(GLcontext *ctx) { + _glthread_INIT_MUTEX(DummyFramebuffer.Mutex); + _glthread_INIT_MUTEX(DummyRenderbuffer.Mutex); + _glthread_INIT_MUTEX(IncompleteFramebuffer.Mutex); DummyFramebuffer.Delete = delete_dummy_framebuffer; DummyRenderbuffer.Delete = delete_dummy_renderbuffer; + IncompleteFramebuffer.Delete = delete_dummy_framebuffer; } +struct gl_framebuffer * +_mesa_get_incomplete_framebuffer(void) +{ + return &IncompleteFramebuffer; +} /** * Helper routine for getting a gl_renderbuffer. @@ -147,6 +160,8 @@ invalidate_framebuffer(struct gl_framebuffer *fb) /** * Given a GL_*_ATTACHMENTn token, return a pointer to the corresponding * gl_renderbuffer_attachment object. + * This function is only used for user-created FB objects, not the + * default / window-system FB object. * If \p attachment is GL_DEPTH_STENCIL_ATTACHMENT, return a pointer to * the depth buffer attachment point. */ @@ -156,6 +171,8 @@ _mesa_get_attachment(GLcontext *ctx, struct gl_framebuffer *fb, { GLuint i; + assert(fb->Name > 0); + switch (attachment) { case GL_COLOR_ATTACHMENT0_EXT: case GL_COLOR_ATTACHMENT1_EXT: @@ -180,8 +197,50 @@ _mesa_get_attachment(GLcontext *ctx, struct gl_framebuffer *fb, return &fb->Attachment[BUFFER_COLOR0 + i]; case GL_DEPTH_STENCIL_ATTACHMENT: /* fall-through */ + case GL_DEPTH_BUFFER: + /* fall-through / new in GL 3.0 */ + case GL_DEPTH_ATTACHMENT_EXT: + return &fb->Attachment[BUFFER_DEPTH]; + case GL_STENCIL_BUFFER: + /* fall-through / new in GL 3.0 */ + case GL_STENCIL_ATTACHMENT_EXT: + return &fb->Attachment[BUFFER_STENCIL]; + default: + return NULL; + } +} + + +/** + * As above, but only used for getting attachments of the default / + * window-system framebuffer (not user-created framebuffer objects). + */ +static struct gl_renderbuffer_attachment * +_mesa_get_fb0_attachment(GLcontext *ctx, struct gl_framebuffer *fb, + GLenum attachment) +{ + assert(fb->Name == 0); + + switch (attachment) { + case GL_FRONT_LEFT: + return &fb->Attachment[BUFFER_FRONT_LEFT]; + case GL_FRONT_RIGHT: + return &fb->Attachment[BUFFER_FRONT_RIGHT]; + case GL_BACK_LEFT: + return &fb->Attachment[BUFFER_BACK_LEFT]; + case GL_BACK_RIGHT: + return &fb->Attachment[BUFFER_BACK_RIGHT]; + case GL_AUX0: + if (fb->Visual.numAuxBuffers == 1) { + return &fb->Attachment[BUFFER_AUX0]; + } + return NULL; + case GL_DEPTH_BUFFER: + /* fall-through / new in GL 3.0 */ case GL_DEPTH_ATTACHMENT_EXT: return &fb->Attachment[BUFFER_DEPTH]; + case GL_STENCIL_BUFFER: + /* fall-through / new in GL 3.0 */ case GL_STENCIL_ATTACHMENT_EXT: return &fb->Attachment[BUFFER_STENCIL]; default: @@ -190,6 +249,7 @@ _mesa_get_attachment(GLcontext *ctx, struct gl_framebuffer *fb, } + /** * Remove any texture or renderbuffer attached to the given attachment * point. Update reference counts, etc. @@ -389,7 +449,9 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, if (format == GL_COLOR) { if (baseFormat != GL_RGB && - baseFormat != GL_RGBA) { + baseFormat != GL_RGBA && + (!ctx->Extensions.ARB_framebuffer_object || + baseFormat != GL_ALPHA)) { att_incomplete("bad format"); att->Complete = GL_FALSE; return; @@ -568,7 +630,8 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) f = texImg->_BaseFormat; numImages++; if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT - && f != GL_DEPTH_STENCIL_EXT) { + && f != GL_DEPTH_STENCIL_EXT + && (!ctx->Extensions.ARB_framebuffer_object || f != GL_ALPHA)) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT; fbo_incomplete("texture attachment incomplete", -1); return; @@ -625,30 +688,32 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) } } -#ifndef FEATURE_OES_framebuffer_object - /* Check that all DrawBuffers are present */ - for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) { - if (fb->ColorDrawBuffer[j] != GL_NONE) { - const struct gl_renderbuffer_attachment *att - = _mesa_get_attachment(ctx, fb, fb->ColorDrawBuffer[j]); - assert(att); - if (att->Type == GL_NONE) { - fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT; - fbo_incomplete("missing drawbuffer", j); - return; - } +#if FEATURE_GL + if (ctx->API == API_OPENGL) { + /* Check that all DrawBuffers are present */ + for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) { + if (fb->ColorDrawBuffer[j] != GL_NONE) { + const struct gl_renderbuffer_attachment *att + = _mesa_get_attachment(ctx, fb, fb->ColorDrawBuffer[j]); + assert(att); + if (att->Type == GL_NONE) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT; + fbo_incomplete("missing drawbuffer", j); + return; + } + } } - } - /* Check that the ReadBuffer is present */ - if (fb->ColorReadBuffer != GL_NONE) { - const struct gl_renderbuffer_attachment *att - = _mesa_get_attachment(ctx, fb, fb->ColorReadBuffer); - assert(att); - if (att->Type == GL_NONE) { - fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT; + /* Check that the ReadBuffer is present */ + if (fb->ColorReadBuffer != GL_NONE) { + const struct gl_renderbuffer_attachment *att + = _mesa_get_attachment(ctx, fb, fb->ColorReadBuffer); + assert(att); + if (att->Type == GL_NONE) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT; fbo_incomplete("missing readbuffer", -1); - return; + return; + } } } #else @@ -866,6 +931,12 @@ GLenum _mesa_base_fbo_format(GLcontext *ctx, GLenum internalFormat) { switch (internalFormat) { + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return GL_ALPHA; case GL_RGB: case GL_R3_G3_B2: case GL_RGB4: @@ -883,6 +954,7 @@ _mesa_base_fbo_format(GLcontext *ctx, GLenum internalFormat) case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: + case GL_RGBA16_SNORM: return GL_RGBA; case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: @@ -962,7 +1034,7 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, rb = ctx->CurrentRenderbuffer; if (!rb) { - _mesa_error(ctx, GL_INVALID_OPERATION, func); + _mesa_error(ctx, GL_INVALID_OPERATION, "%s", func); return; } @@ -1008,22 +1080,31 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, */ } + #if FEATURE_OES_EGL_image void GLAPIENTRY -_mesa_EGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image) +_mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { struct gl_renderbuffer *rb; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); + if (!ctx->Extensions.OES_EGL_image) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glEGLImageTargetRenderbufferStorageOES(unsupported)"); + return; + } + if (target != GL_RENDERBUFFER) { - _mesa_error(ctx, GL_INVALID_ENUM, "EGLImageTargetRenderbufferStorageOES"); + _mesa_error(ctx, GL_INVALID_ENUM, + "EGLImageTargetRenderbufferStorageOES"); return; } rb = ctx->CurrentRenderbuffer; if (!rb) { - _mesa_error(ctx, GL_INVALID_OPERATION, "EGLImageTargetRenderbufferStorageOES"); + _mesa_error(ctx, GL_INVALID_OPERATION, + "EGLImageTargetRenderbufferStorageOES"); return; } @@ -1033,6 +1114,7 @@ _mesa_EGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image) } #endif + /** * Helper function for _mesa_GetRenderbufferParameterivEXT() and * _mesa_GetFramebufferAttachmentParameterivEXT() @@ -1101,6 +1183,26 @@ _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples, } +/** + * OpenGL ES version of glRenderBufferStorage. + */ +void GLAPIENTRY +_es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat, + GLsizei width, GLsizei height) +{ + switch (internalFormat) { + case GL_RGB565: + /* XXX this confuses GL_RENDERBUFFER_INTERNAL_FORMAT_OES */ + /* choose a closest format */ + internalFormat = GL_RGB5; + break; + default: + break; + } + + renderbuffer_storage(target, internalFormat, width, height, 0); +} + void GLAPIENTRY _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) @@ -1549,6 +1651,7 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target, texObj = _mesa_lookup_texture(ctx, texture); if (texObj != NULL) { if (textarget == 0) { + /* XXX what's the purpose of this? */ err = (texObj->Target != GL_TEXTURE_3D) && (texObj->Target != GL_TEXTURE_1D_ARRAY_EXT) && (texObj->Target != GL_TEXTURE_2D_ARRAY_EXT); @@ -1559,6 +1662,13 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target, : (texObj->Target != textarget); } } + else { + /* can't render to a non-existant texture */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glFramebufferTexture%sEXT(non existant texture)", + caller); + return; + } if (err) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -1830,12 +1940,14 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, } if (buffer->Name == 0) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetFramebufferAttachmentParameterivEXT"); - return; + /* the default / window-system FBO */ + att = _mesa_get_fb0_attachment(ctx, buffer, attachment); + } + else { + /* user-created framebuffer FBO */ + att = _mesa_get_attachment(ctx, buffer, attachment); } - att = _mesa_get_attachment(ctx, buffer, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetFramebufferAttachmentParameterivEXT(attachment)"); @@ -2206,3 +2318,25 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, mask, filter); } #endif /* FEATURE_EXT_framebuffer_blit */ + +#if FEATURE_ARB_geometry_shader4 +void GLAPIENTRY +_mesa_FramebufferTextureARB(GLenum target, GLenum attachment, + GLuint texture, GLint level) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glFramebufferTextureARB " + "not implemented!"); +} + +void GLAPIENTRY +_mesa_FramebufferTextureFaceARB(GLenum target, GLenum attachment, + GLuint texture, GLint level, GLenum face) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glFramebufferTextureFaceARB " + "not implemented!"); +} +#endif /* FEATURE_ARB_geometry_shader4 */ diff --git a/mesalib/src/mesa/main/fbobject.h b/mesalib/src/mesa/main/fbobject.h index 28f75dfca..9850ee9aa 100644 --- a/mesalib/src/mesa/main/fbobject.h +++ b/mesalib/src/mesa/main/fbobject.h @@ -26,10 +26,14 @@ #ifndef FBOBJECT_H #define FBOBJECT_H +#include "mtypes.h" extern void _mesa_init_fbobjects(GLcontext *ctx); +extern struct gl_framebuffer * +_mesa_get_incomplete_framebuffer(void); + extern struct gl_renderbuffer * _mesa_lookup_renderbuffer(GLcontext *ctx, GLuint id); @@ -89,6 +93,10 @@ _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLsizei width, GLsizei height); extern void GLAPIENTRY +_es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat, + GLsizei width, GLsizei height); + +extern void GLAPIENTRY _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image); extern void GLAPIENTRY @@ -145,5 +153,13 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +extern void GLAPIENTRY +_mesa_FramebufferTextureARB(GLenum target, GLenum attachment, + GLuint texture, GLint level); + +extern void GLAPIENTRY +_mesa_FramebufferTextureFaceARB(GLenum target, GLenum attachment, + GLuint texture, GLint level, GLenum face); + #endif /* FBOBJECT_H */ diff --git a/mesalib/src/mesa/main/feedback.h b/mesalib/src/mesa/main/feedback.h index 3e8283ed2..c6354b97b 100644 --- a/mesalib/src/mesa/main/feedback.h +++ b/mesalib/src/mesa/main/feedback.h @@ -32,11 +32,6 @@ #if FEATURE_feedback -#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) \ - do { \ - (driver)->RenderMode = impl ## RenderMode; \ - } while (0) - extern void _mesa_feedback_vertex( GLcontext *ctx, const GLfloat win[4], @@ -63,7 +58,7 @@ _mesa_init_feedback_dispatch(struct _glapi_table *disp); #else /* FEATURE_feedback */ -#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) do { } while (0) +#include "main/compiler.h" static INLINE void _mesa_feedback_vertex( GLcontext *ctx, diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c index ba94a3877..92fec09ba 100644 --- a/mesalib/src/mesa/main/ffvertex_prog.c +++ b/mesalib/src/mesa/main/ffvertex_prog.c @@ -38,12 +38,12 @@ #include "main/macros.h" #include "main/enums.h" #include "main/ffvertex_prog.h" -#include "shader/program.h" -#include "shader/prog_cache.h" -#include "shader/prog_instruction.h" -#include "shader/prog_parameter.h" -#include "shader/prog_print.h" -#include "shader/prog_statevars.h" +#include "program/program.h" +#include "program/prog_cache.h" +#include "program/prog_instruction.h" +#include "program/prog_parameter.h" +#include "program/prog_print.h" +#include "program/prog_statevars.h" /** Max of number of lights and texture coord units */ @@ -75,6 +75,7 @@ struct state_key { unsigned light_attenuated:1; unsigned texunit_really_enabled:1; unsigned texmat_enabled:1; + unsigned coord_replace:1; unsigned texgen_enabled:4; unsigned texgen_mode0:4; unsigned texgen_mode1:4; @@ -225,6 +226,10 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) if (texUnit->_ReallyEnabled) key->unit[i].texunit_really_enabled = 1; + if (ctx->Point.PointSprite) + if (ctx->Point.CoordReplace[i]) + key->unit[i].coord_replace = 1; + if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i)) key->unit[i].texmat_enabled = 1; @@ -1385,6 +1390,9 @@ static void build_texture_transform( struct tnl_program *p ) if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i))) continue; + if (p->state->unit[i].coord_replace) + continue; + if (p->state->unit[i].texgen_enabled || p->state->unit[i].texmat_enabled) { diff --git a/mesalib/src/mesa/main/fog.c b/mesalib/src/mesa/main/fog.c index 269ff3f8b..9f26c012d 100644 --- a/mesalib/src/mesa/main/fog.c +++ b/mesalib/src/mesa/main/fog.c @@ -27,6 +27,7 @@ #include "colormac.h" #include "context.h" #include "fog.h" +#include "macros.h" #include "mtypes.h" diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index d0c9c0028..9db9f1c56 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -26,7 +26,7 @@ #include "imports.h" #include "formats.h" -#include "config.h" +#include "mfeatures.h" /** @@ -48,7 +48,7 @@ struct gl_format_info /** * Logical data type: one of GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALED, - * GL_UNSIGNED_INT, GL_SIGNED_INT, GL_FLOAT. + * GL_UNSIGNED_INT, GL_INT, GL_FLOAT. */ GLenum DataType; @@ -628,6 +628,66 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 16, 0, 0, 0, 1, 1, 2 }, + + /* unnormalized signed int formats */ + { + MESA_FORMAT_RGBA_INT8, + "MESA_FORMAT_RGBA_INT8", + GL_RGBA, + GL_INT, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGBA_INT16, + "MESA_FORMAT_RGBA_INT16", + GL_RGBA, + GL_INT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_INT32, + "MESA_FORMAT_RGBA_INT32", + GL_RGBA, + GL_INT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + + /* unnormalized unsigned int formats */ + { + MESA_FORMAT_RGBA_UINT8, + "MESA_FORMAT_RGBA_UINT8", + GL_RGBA, + GL_UNSIGNED_INT, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGBA_UINT16, + "MESA_FORMAT_RGBA_UINT16", + GL_RGBA, + GL_UNSIGNED_INT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_UINT32, + "MESA_FORMAT_RGBA_UINT32", + GL_RGBA, + GL_UNSIGNED_INT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + + { MESA_FORMAT_DUDV8, "MESA_FORMAT_DUDV8", @@ -637,6 +697,35 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 1, 1, 2 }, + + /* Signed 8 bits / channel */ + { + MESA_FORMAT_SIGNED_R8, /* Name */ + "MESA_FORMAT_SIGNED_R8", /* StrName */ + GL_RGBA, /* BaseFormat */ + GL_SIGNED_NORMALIZED, /* DataType */ + 8, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_SIGNED_RG88, + "MESA_FORMAT_SIGNED_RG88", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_SIGNED_RGBX8888, + "MESA_FORMAT_SIGNED_RGBX8888", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 /* 4 bpp, but no alpha */ + }, { MESA_FORMAT_SIGNED_RGBA8888, "MESA_FORMAT_SIGNED_RGBA8888", @@ -655,6 +744,35 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 1, 1, 4 }, + + /* Signed 16 bits / channel */ + { + MESA_FORMAT_SIGNED_R_16, + "MESA_FORMAT_SIGNED_R_16", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 16, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_SIGNED_RG_16, + "MESA_FORMAT_SIGNED_RG_16", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_SIGNED_RGB_16, + "MESA_FORMAT_SIGNED_RGB_16", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, { MESA_FORMAT_SIGNED_RGBA_16, "MESA_FORMAT_SIGNED_RGBA_16", @@ -663,6 +781,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 16, 16, 16, 16, 0, 0, 0, 0, 0, 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_16, + "MESA_FORMAT_RGBA_16", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 } }; @@ -814,6 +941,18 @@ _mesa_is_format_compressed(gl_format format) /** + * Determine if the given format represents a packed depth/stencil buffer. + */ +GLboolean +_mesa_is_format_packed_depth_stencil(gl_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + + return info->BaseFormat == GL_DEPTH_STENCIL; +} + + +/** * Return color encoding for given format. * \return GL_LINEAR or GL_SRGB */ @@ -1067,6 +1206,19 @@ _mesa_format_to_type_and_comps(gl_format format, *datatype = GL_BYTE; *comps = 4; return; + + case MESA_FORMAT_SIGNED_R_16: + *datatype = GL_SHORT; + *comps = 1; + return; + case MESA_FORMAT_SIGNED_RG_16: + *datatype = GL_SHORT; + *comps = 2; + return; + case MESA_FORMAT_SIGNED_RGB_16: + *datatype = GL_SHORT; + *comps = 3; + return; case MESA_FORMAT_SIGNED_RGBA_16: *datatype = GL_SHORT; *comps = 4; @@ -1150,6 +1302,36 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 1; return; + case MESA_FORMAT_RGBA_INT8: + *datatype = GL_BYTE; + *comps = 4; + return; + case MESA_FORMAT_RGBA_INT16: + *datatype = GL_SHORT; + *comps = 4; + return; + case MESA_FORMAT_RGBA_INT32: + *datatype = GL_INT; + *comps = 4; + return; + + /** + * \name Non-normalized unsigned integer formats. + */ + case MESA_FORMAT_RGBA_UINT8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 4; + return; + case MESA_FORMAT_RGBA_UINT16: + *datatype = GL_UNSIGNED_SHORT; + *comps = 4; + return; + case MESA_FORMAT_RGBA_UINT32: + *datatype = GL_UNSIGNED_INT; + *comps = 4; + return; + + default: _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); *datatype = 0; diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h index 0eeeb8b2b..e9467f486 100644 --- a/mesalib/src/mesa/main/formats.h +++ b/mesalib/src/mesa/main/formats.h @@ -33,7 +33,7 @@ #define FORMATS_H -#include "main/mtypes.h" +#include <GL/gl.h> @@ -131,13 +131,38 @@ typedef enum /*@}*/ /** + * \name Non-normalized signed integer formats. + * XXX Note: these are just stand-ins for some better hardware + * formats TBD such as BGRA or ARGB. + */ + MESA_FORMAT_RGBA_INT8, + MESA_FORMAT_RGBA_INT16, + MESA_FORMAT_RGBA_INT32, + + /** + * \name Non-normalized unsigned integer formats. + */ + MESA_FORMAT_RGBA_UINT8, + MESA_FORMAT_RGBA_UINT16, + MESA_FORMAT_RGBA_UINT32, + + /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ + /** * \name Signed fixed point texture formats. */ /*@{*/ - MESA_FORMAT_DUDV8, - MESA_FORMAT_SIGNED_RGBA8888, - MESA_FORMAT_SIGNED_RGBA8888_REV, - MESA_FORMAT_SIGNED_RGBA_16, + MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */ + MESA_FORMAT_SIGNED_R8, /* RRRR RRRR */ + MESA_FORMAT_SIGNED_RG88, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_SIGNED_RGBX8888, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + MESA_FORMAT_SIGNED_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + MESA_FORMAT_SIGNED_RGBA8888_REV,/*AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_SIGNED_R_16, /* ushort[0]=R */ + MESA_FORMAT_SIGNED_RG_16, /* ushort[0]=R, ushort[1]=G */ + MESA_FORMAT_SIGNED_RGB_16, /* ushort[0]=R, ushort[1]=G, ushort[2]=B */ + MESA_FORMAT_SIGNED_RGBA_16, /* ... */ + MESA_FORMAT_RGBA_16, /* ... */ /*@}*/ MESA_FORMAT_COUNT @@ -165,6 +190,9 @@ _mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh); extern GLboolean _mesa_is_format_compressed(gl_format format); +extern GLboolean +_mesa_is_format_packed_depth_stencil(gl_format format); + extern GLenum _mesa_get_format_color_encoding(gl_format format); diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c index 6a85162d5..a98c09cfb 100644 --- a/mesalib/src/mesa/main/framebuffer.c +++ b/mesalib/src/mesa/main/framebuffer.c @@ -35,6 +35,7 @@ #include "buffers.h" #include "context.h" #include "depthstencil.h" +#include "enums.h" #include "formats.h" #include "macros.h" #include "mtypes.h" @@ -74,7 +75,6 @@ compute_depth_max(struct gl_framebuffer *fb) fb->_MRD = (GLfloat)1.0 / fb->_DepthMaxF; } - /** * Create and initialize a gl_framebuffer object. * This is intended for creating _window_system_ framebuffers, not generic @@ -543,7 +543,8 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) const GLenum baseFormat = _mesa_get_format_base_format(rb->Format); const gl_format fmt = rb->Format; - if (baseFormat == GL_RGBA || baseFormat == GL_RGB) { + if (baseFormat == GL_RGBA || baseFormat == GL_RGB || + baseFormat == GL_ALPHA) { fb->Visual.redBits = _mesa_get_format_bits(fmt, GL_RED_BITS); fb->Visual.greenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS); fb->Visual.blueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS); @@ -610,7 +611,7 @@ _mesa_update_depth_buffer(GLcontext *ctx, depthRb = fb->Attachment[attIndex].Renderbuffer; - if (depthRb && depthRb->_BaseFormat == GL_DEPTH_STENCIL) { + if (depthRb && _mesa_is_format_packed_depth_stencil(depthRb->Format)) { /* The attached depth buffer is a GL_DEPTH_STENCIL renderbuffer */ if (!fb->_DepthBuffer || fb->_DepthBuffer->Wrapped != depthRb @@ -651,7 +652,7 @@ _mesa_update_stencil_buffer(GLcontext *ctx, stencilRb = fb->Attachment[attIndex].Renderbuffer; - if (stencilRb && stencilRb->_BaseFormat == GL_DEPTH_STENCIL) { + if (stencilRb && _mesa_is_format_packed_depth_stencil(stencilRb->Format)) { /* The attached stencil buffer is a GL_DEPTH_STENCIL renderbuffer */ if (!fb->_StencilBuffer || fb->_StencilBuffer->Wrapped != stencilRb @@ -877,6 +878,7 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format) return GL_FALSE; } ASSERT(_mesa_get_format_bits(ctx->ReadBuffer->_ColorReadBuffer->Format, GL_RED_BITS) > 0 || + _mesa_get_format_bits(ctx->ReadBuffer->_ColorReadBuffer->Format, GL_ALPHA_BITS) > 0 || _mesa_get_format_bits(ctx->ReadBuffer->_ColorReadBuffer->Format, GL_INDEX_BITS) > 0); break; case GL_DEPTH: @@ -986,6 +988,10 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format) return GL_TRUE; } + +/** + * Used to answer the GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES query. + */ GLenum _mesa_get_color_read_format(GLcontext *ctx) { @@ -999,6 +1005,10 @@ _mesa_get_color_read_format(GLcontext *ctx) } } + +/** + * Used to answer the GL_IMPLEMENTATION_COLOR_READ_TYPE_OES query. + */ GLenum _mesa_get_color_read_type(GLcontext *ctx) { @@ -1011,3 +1021,43 @@ _mesa_get_color_read_type(GLcontext *ctx) return GL_UNSIGNED_BYTE; } } + + +/** + * Print framebuffer info to stderr, for debugging. + */ +void +_mesa_print_framebuffer(const struct gl_framebuffer *fb) +{ + GLuint i; + + fprintf(stderr, "Mesa Framebuffer %u at %p\n", fb->Name, (void *) fb); + fprintf(stderr, " Size: %u x %u Status: %s\n", fb->Width, fb->Height, + _mesa_lookup_enum_by_nr(fb->_Status)); + fprintf(stderr, " Attachments:\n"); + + for (i = 0; i < BUFFER_COUNT; i++) { + const struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; + if (att->Type == GL_TEXTURE) { + const struct gl_texture_image *texImage; + fprintf(stderr, + " %2d: Texture %u, level %u, face %u, slice %u, complete %d\n", + i, att->Texture->Name, att->TextureLevel, att->CubeMapFace, + att->Zoffset, att->Complete); + texImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; + fprintf(stderr, " Size: %u x %u x %u Format %s\n", + texImage->Width, texImage->Height, texImage->Depth, + _mesa_get_format_name(texImage->TexFormat)); + } + else if (att->Type == GL_RENDERBUFFER) { + fprintf(stderr, " %2d: Renderbuffer %u, complete %d\n", + i, att->Renderbuffer->Name, att->Complete); + fprintf(stderr, " Size: %u x %u Format %s\n", + att->Renderbuffer->Width, att->Renderbuffer->Height, + _mesa_get_format_name(att->Renderbuffer->Format)); + } + else { + fprintf(stderr, " %2d: none\n", i); + } + } +} diff --git a/mesalib/src/mesa/main/framebuffer.h b/mesalib/src/mesa/main/framebuffer.h index 960513812..2e9844282 100644 --- a/mesalib/src/mesa/main/framebuffer.h +++ b/mesalib/src/mesa/main/framebuffer.h @@ -26,6 +26,7 @@ #ifndef FRAMEBUFFER_H #define FRAMEBUFFER_H +#include "mtypes.h" extern struct gl_framebuffer * _mesa_create_framebuffer(const GLvisual *visual); @@ -91,4 +92,7 @@ _mesa_get_color_read_type(GLcontext *ctx); extern GLenum _mesa_get_color_read_format(GLcontext *ctx); +extern void +_mesa_print_framebuffer(const struct gl_framebuffer *fb); + #endif /* FRAMEBUFFER_H */ diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index edc440091..2062134a3 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -1,11 +1,31 @@ - -/*** - *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen.py - ***/ +/* + * Copyright (C) 2010 Brian Paul All Rights Reserved. + * Copyright (C) 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Author: Kristian Høgsberg <krh@bitplanet.net> + */ #include "glheader.h" #include "context.h" #include "enable.h" +#include "enums.h" #include "extensions.h" #include "get.h" #include "macros.h" @@ -14,10 +34,43 @@ #include "texcompress.h" #include "framebuffer.h" +/* This is a table driven implemetation of the glGet*v() functions. + * The basic idea is that most getters just look up an int somewhere + * in GLcontext and then convert it to a bool or float according to + * which of glGetIntegerv() glGetBooleanv() etc is being called. + * Instead of generating code to do this, we can just record the enum + * value and the offset into GLcontext in an array of structs. Then + * in glGet*(), we lookup the struct for the enum in question, and use + * the offset to get the int we need. + * + * Sometimes we need to look up a float, a boolean, a bit in a + * bitfield, a matrix or other types instead, so we need to track the + * type of the value in GLcontext. And sometimes the value isn't in + * GLcontext but in the drawbuffer, the array object, current texture + * unit, or maybe it's a computed value. So we need to also track + * where or how to find the value. Finally, we sometimes need to + * check that one of a number of extensions are enabled, the GL + * version or flush or call _mesa_update_state(). This is done by + * attaching optional extra information to the value description + * struct, it's sort of like an array of opcodes that describe extra + * checks or actions. + * + * Putting all this together we end up with struct value_desc below, + * and with a couple of macros to help, the table of struct value_desc + * is about as concise as the specification in the old python script. + */ + +#undef CONST #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) +#define FLOAT_TO_FIXED(F) ( ((F) * 65536.0f > INT_MAX) ? INT_MAX : \ + ((F) * 65536.0f < INT_MIN) ? INT_MIN : \ + (GLint) ((F) * 65536.0f) ) #define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) +#define INT_TO_FIXED(I) ( ((I) > SHRT_MAX) ? INT_MAX : \ + ((I) < SHRT_MIN) ? INT_MIN : \ + (GLint) ((I) * 65536) ) #define INT64_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) #define INT64_TO_INT(I) ( (GLint)((I > INT_MAX) ? INT_MAX : ((I < INT_MIN) ? INT_MIN : (I))) ) @@ -25,7617 +78,2285 @@ #define BOOLEAN_TO_INT(B) ( (GLint) (B) ) #define BOOLEAN_TO_INT64(B) ( (GLint64) (B) ) #define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F ) +#define BOOLEAN_TO_FIXED(B) ( (GLint) ((B) ? 1 : 0) << 16 ) #define ENUM_TO_INT64(E) ( (GLint64) (E) ) +#define ENUM_TO_FIXED(E) (E) +enum value_type { + TYPE_INVALID, + TYPE_API_MASK, + TYPE_INT, + TYPE_INT_2, + TYPE_INT_3, + TYPE_INT_4, + TYPE_INT_N, + TYPE_INT64, + TYPE_ENUM, + TYPE_ENUM_2, + TYPE_BOOLEAN, + TYPE_BIT_0, + TYPE_BIT_1, + TYPE_BIT_2, + TYPE_BIT_3, + TYPE_BIT_4, + TYPE_BIT_5, + TYPE_FLOAT, + TYPE_FLOAT_2, + TYPE_FLOAT_3, + TYPE_FLOAT_4, + TYPE_FLOATN, + TYPE_FLOATN_2, + TYPE_FLOATN_3, + TYPE_FLOATN_4, + TYPE_DOUBLEN, + TYPE_MATRIX, + TYPE_MATRIX_T, + TYPE_CONST +}; -/* - * Check if named extension is enabled, if not generate error and return. - */ -#define CHECK_EXT1(EXT1, FUNC) \ - if (!ctx->Extensions.EXT1) { \ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \ - return; \ +enum value_location { + LOC_BUFFER, + LOC_CONTEXT, + LOC_ARRAY, + LOC_TEXUNIT, + LOC_CUSTOM +}; + +enum value_extra { + EXTRA_END = 0x8000, + EXTRA_VERSION_30, + EXTRA_VERSION_31, + EXTRA_VERSION_32, + EXTRA_VERSION_ES2, + EXTRA_NEW_BUFFERS, + EXTRA_VALID_DRAW_BUFFER, + EXTRA_VALID_TEXTURE_UNIT, + EXTRA_FLUSH_CURRENT, +}; + +#define NO_EXTRA NULL +#define NO_OFFSET 0 + +struct value_desc { + GLenum pname; + GLubyte location; /**< enum value_location */ + GLubyte type; /**< enum value_type */ + int offset; + const int *extra; +}; + +union value { + GLfloat value_float; + GLfloat value_float_4[4]; + GLmatrix *value_matrix; + GLint value_int; + GLint value_int_4[4]; + GLint64 value_int64; + GLenum value_enum; + + /* Sigh, see GL_COMPRESSED_TEXTURE_FORMATS_ARB handling */ + struct { + GLint n, ints[100]; + } value_int_n; + GLboolean value_bool; +}; + +#define BUFFER_FIELD(field, type) \ + LOC_BUFFER, type, offsetof(struct gl_framebuffer, field) +#define CONTEXT_FIELD(field, type) \ + LOC_CONTEXT, type, offsetof(GLcontext, field) +#define ARRAY_FIELD(field, type) \ + LOC_ARRAY, type, offsetof(struct gl_array_object, field) +#define CONST(value) \ + LOC_CONTEXT, TYPE_CONST, value + +#define BUFFER_INT(field) BUFFER_FIELD(field, TYPE_INT) +#define BUFFER_ENUM(field) BUFFER_FIELD(field, TYPE_ENUM) + +#define CONTEXT_INT(field) CONTEXT_FIELD(field, TYPE_INT) +#define CONTEXT_INT2(field) CONTEXT_FIELD(field, TYPE_INT_2) +#define CONTEXT_INT64(field) CONTEXT_FIELD(field, TYPE_INT64) +#define CONTEXT_ENUM(field) CONTEXT_FIELD(field, TYPE_ENUM) +#define CONTEXT_ENUM2(field) CONTEXT_FIELD(field, TYPE_ENUM_2) +#define CONTEXT_BOOL(field) CONTEXT_FIELD(field, TYPE_BOOLEAN) +#define CONTEXT_BIT0(field) CONTEXT_FIELD(field, TYPE_BIT_0) +#define CONTEXT_BIT1(field) CONTEXT_FIELD(field, TYPE_BIT_1) +#define CONTEXT_BIT2(field) CONTEXT_FIELD(field, TYPE_BIT_2) +#define CONTEXT_BIT3(field) CONTEXT_FIELD(field, TYPE_BIT_3) +#define CONTEXT_BIT4(field) CONTEXT_FIELD(field, TYPE_BIT_4) +#define CONTEXT_BIT5(field) CONTEXT_FIELD(field, TYPE_BIT_5) +#define CONTEXT_FLOAT(field) CONTEXT_FIELD(field, TYPE_FLOAT) +#define CONTEXT_FLOAT2(field) CONTEXT_FIELD(field, TYPE_FLOAT_2) +#define CONTEXT_FLOAT3(field) CONTEXT_FIELD(field, TYPE_FLOAT_3) +#define CONTEXT_FLOAT4(field) CONTEXT_FIELD(field, TYPE_FLOAT_4) +#define CONTEXT_MATRIX(field) CONTEXT_FIELD(field, TYPE_MATRIX) +#define CONTEXT_MATRIX_T(field) CONTEXT_FIELD(field, TYPE_MATRIX_T) + +#define ARRAY_INT(field) ARRAY_FIELD(field, TYPE_INT) +#define ARRAY_ENUM(field) ARRAY_FIELD(field, TYPE_ENUM) +#define ARRAY_BOOL(field) ARRAY_FIELD(field, TYPE_BOOLEAN) + +#define EXT(f) \ + offsetof(struct gl_extensions, f) + +#define EXTRA_EXT(e) \ + static const int extra_##e[] = { \ + EXT(e), EXTRA_END \ } -/* - * Check if either of two extensions is enabled. +#define EXTRA_EXT2(e1, e2) \ + static const int extra_##e1##_##e2[] = { \ + EXT(e1), EXT(e2), EXTRA_END \ + } + +/* The 'extra' mechanism is a way to specify extra checks (such as + * extensions or specific gl versions) or actions (flush current, new + * buffers) that we need to do before looking up an enum. We need to + * declare them all up front so we can refer to them in the value_desc + * structs below. */ + +static const int extra_new_buffers[] = { + EXTRA_NEW_BUFFERS, + EXTRA_END +}; + +static const int extra_valid_draw_buffer[] = { + EXTRA_VALID_DRAW_BUFFER, + EXTRA_END +}; + +static const int extra_valid_texture_unit[] = { + EXTRA_VALID_TEXTURE_UNIT, + EXTRA_END +}; + +static const int extra_flush_current_valid_texture_unit[] = { + EXTRA_FLUSH_CURRENT, + EXTRA_VALID_TEXTURE_UNIT, + EXTRA_END +}; + +static const int extra_flush_current[] = { + EXTRA_FLUSH_CURRENT, + EXTRA_END +}; + +static const int extra_new_buffers_OES_read_format[] = { + EXTRA_NEW_BUFFERS, + EXT(OES_read_format), + EXTRA_END +}; + +static const int extra_EXT_secondary_color_flush_current[] = { + EXT(EXT_secondary_color), + EXTRA_FLUSH_CURRENT, + EXTRA_END +}; + +static const int extra_EXT_fog_coord_flush_current[] = { + EXT(EXT_fog_coord), + EXTRA_FLUSH_CURRENT, + EXTRA_END +}; + +EXTRA_EXT(ARB_multitexture); +EXTRA_EXT(ARB_texture_cube_map); +EXTRA_EXT(MESA_texture_array); +EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program); +EXTRA_EXT(EXT_secondary_color); +EXTRA_EXT(EXT_fog_coord); +EXTRA_EXT(EXT_texture_lod_bias); +EXTRA_EXT(EXT_texture_filter_anisotropic); +EXTRA_EXT(IBM_rasterpos_clip); +EXTRA_EXT(NV_point_sprite); +EXTRA_EXT(SGIS_generate_mipmap); +EXTRA_EXT(NV_vertex_program); +EXTRA_EXT(NV_fragment_program); +EXTRA_EXT(NV_texture_rectangle); +EXTRA_EXT(EXT_stencil_two_side); +EXTRA_EXT(NV_light_max_exponent); +EXTRA_EXT(EXT_convolution); +EXTRA_EXT(EXT_histogram); +EXTRA_EXT(SGI_color_table); +EXTRA_EXT(SGI_texture_color_table); +EXTRA_EXT(EXT_depth_bounds_test); +EXTRA_EXT(ARB_depth_clamp); +EXTRA_EXT(ATI_fragment_shader); +EXTRA_EXT(EXT_framebuffer_blit); +EXTRA_EXT(ARB_shader_objects); +EXTRA_EXT(EXT_provoking_vertex); +EXTRA_EXT(ARB_fragment_shader); +EXTRA_EXT(ARB_fragment_program); +EXTRA_EXT(ARB_framebuffer_object); +EXTRA_EXT(EXT_framebuffer_object); +EXTRA_EXT(APPLE_vertex_array_object); +EXTRA_EXT(ARB_seamless_cube_map); +EXTRA_EXT(EXT_compiled_vertex_array); +EXTRA_EXT(ARB_sync); +EXTRA_EXT(ARB_vertex_shader); +EXTRA_EXT(EXT_transform_feedback); +EXTRA_EXT(ARB_transform_feedback2); +EXTRA_EXT(EXT_pixel_buffer_object); +EXTRA_EXT(ARB_vertex_program); +EXTRA_EXT2(NV_point_sprite, ARB_point_sprite); +EXTRA_EXT2(ARB_fragment_program, NV_fragment_program); +EXTRA_EXT2(ARB_vertex_program, NV_vertex_program); +EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program); +EXTRA_EXT(ARB_vertex_buffer_object); +EXTRA_EXT(ARB_geometry_shader4); + +static const int +extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = { + EXT(ARB_vertex_program), + EXT(ARB_fragment_program), + EXT(NV_vertex_program), + EXTRA_END +}; + +static const int +extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = { + EXT(NV_vertex_program), + EXT(ARB_vertex_program), + EXT(ARB_fragment_program), + EXT(NV_vertex_program), + EXTRA_END +}; + +static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END }; +static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END }; +static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END }; + +static const int +extra_ARB_vertex_program_version_es2[] = { + EXT(ARB_vertex_program), + EXTRA_VERSION_ES2, + EXTRA_END +}; + +#define API_OPENGL_BIT (1 << API_OPENGL) +#define API_OPENGLES_BIT (1 << API_OPENGLES) +#define API_OPENGLES2_BIT (1 << API_OPENGLES2) + +/* This is the big table describing all the enums we accept in + * glGet*v(). The table is partitioned into six parts: enums + * understood by all GL APIs (OpenGL, GLES and GLES2), enums shared + * between OpenGL and GLES, enums exclusive to GLES, etc for the + * remaining combinations. When we add the enums to the hash table in + * _mesa_init_get_hash(), we only add the enums for the API we're + * instantiating and the different sections are guarded by #if + * FEATURE_GL etc to make sure we only compile in the enums we may + * need. */ + +static const struct value_desc values[] = { + /* Enums shared between OpenGL, GLES1 and GLES2 */ + { 0, 0, TYPE_API_MASK, + API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGLES2_BIT, NO_EXTRA}, + { GL_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers }, + { GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA }, + { GL_BLEND_SRC, CONTEXT_ENUM(Color.BlendSrcRGB), NO_EXTRA }, + { GL_BLUE_BITS, BUFFER_INT(Visual.blueBits), extra_new_buffers }, + { GL_COLOR_CLEAR_VALUE, CONTEXT_FIELD(Color.ClearColor[0], TYPE_FLOATN_4), NO_EXTRA }, + { GL_COLOR_WRITEMASK, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA }, + { GL_CULL_FACE, CONTEXT_BOOL(Polygon.CullFlag), NO_EXTRA }, + { GL_CULL_FACE_MODE, CONTEXT_ENUM(Polygon.CullFaceMode), NO_EXTRA }, + { GL_DEPTH_BITS, BUFFER_INT(Visual.depthBits), NO_EXTRA }, + { GL_DEPTH_CLEAR_VALUE, CONTEXT_FIELD(Depth.Clear, TYPE_DOUBLEN), NO_EXTRA }, + { GL_DEPTH_FUNC, CONTEXT_ENUM(Depth.Func), NO_EXTRA }, + { GL_DEPTH_RANGE, CONTEXT_FIELD(Viewport.Near, TYPE_FLOATN_2), NO_EXTRA }, + { GL_DEPTH_TEST, CONTEXT_BOOL(Depth.Test), NO_EXTRA }, + { GL_DEPTH_WRITEMASK, CONTEXT_BOOL(Depth.Mask), NO_EXTRA }, + { GL_DITHER, CONTEXT_BOOL(Color.DitherFlag), NO_EXTRA }, + { GL_FRONT_FACE, CONTEXT_ENUM(Polygon.FrontFace), NO_EXTRA }, + { GL_GREEN_BITS, BUFFER_INT(Visual.greenBits), extra_new_buffers }, + { GL_LINE_WIDTH, CONTEXT_FLOAT(Line.Width), NO_EXTRA }, + { GL_ALIASED_LINE_WIDTH_RANGE, CONTEXT_FLOAT2(Const.MinLineWidth), NO_EXTRA }, + { GL_MAX_ELEMENTS_VERTICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA }, + { GL_MAX_ELEMENTS_INDICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA }, + { GL_MAX_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.MaxTextureLevels), NO_EXTRA }, + { GL_MAX_VIEWPORT_DIMS, CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA }, + { GL_PACK_ALIGNMENT, CONTEXT_INT(Pack.Alignment), NO_EXTRA }, + { GL_ALIASED_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSize), NO_EXTRA }, + { GL_POLYGON_OFFSET_FACTOR, CONTEXT_FLOAT(Polygon.OffsetFactor ), NO_EXTRA }, + { GL_POLYGON_OFFSET_UNITS, CONTEXT_FLOAT(Polygon.OffsetUnits ), NO_EXTRA }, + { GL_POLYGON_OFFSET_FILL, CONTEXT_BOOL(Polygon.OffsetFill), NO_EXTRA }, + { GL_RED_BITS, BUFFER_INT(Visual.redBits), extra_new_buffers }, + { GL_SCISSOR_BOX, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA }, + { GL_SCISSOR_TEST, CONTEXT_BOOL(Scissor.Enabled), NO_EXTRA }, + { GL_STENCIL_BITS, BUFFER_INT(Visual.stencilBits), NO_EXTRA }, + { GL_STENCIL_CLEAR_VALUE, CONTEXT_INT(Stencil.Clear), NO_EXTRA }, + { GL_STENCIL_FAIL, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, + { GL_STENCIL_FUNC, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, + { GL_STENCIL_PASS_DEPTH_FAIL, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, + { GL_STENCIL_PASS_DEPTH_PASS, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, + { GL_STENCIL_REF, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA }, + { GL_STENCIL_TEST, CONTEXT_BOOL(Stencil.Enabled), NO_EXTRA }, + { GL_STENCIL_VALUE_MASK, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA }, + { GL_STENCIL_WRITEMASK, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA }, + { GL_SUBPIXEL_BITS, CONTEXT_INT(Const.SubPixelBits), NO_EXTRA }, + { GL_TEXTURE_BINDING_2D, LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX, NO_EXTRA }, + { GL_UNPACK_ALIGNMENT, CONTEXT_INT(Unpack.Alignment), NO_EXTRA }, + { GL_VIEWPORT, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA }, + + /* GL_ARB_multitexture */ + { GL_ACTIVE_TEXTURE_ARB, + LOC_CUSTOM, TYPE_INT, 0, extra_ARB_multitexture }, + + /* Note that all the OES_* extensions require that the Mesa "struct + * gl_extensions" include a member with the name of the extension. + * That structure does not yet include OES extensions (and we're + * not sure whether it will). If it does, all the OES_* + * extensions below should mark the dependency. */ + + /* GL_ARB_texture_cube_map */ + { GL_TEXTURE_BINDING_CUBE_MAP_ARB, LOC_CUSTOM, TYPE_INT, + TEXTURE_CUBE_INDEX, extra_ARB_texture_cube_map }, + { GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.MaxCubeTextureLevels), + extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */ + + /* XXX: OES_blend_subtract */ + { GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.BlendSrcRGB), NO_EXTRA }, + { GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.BlendDstRGB), NO_EXTRA }, + { GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.BlendSrcA), NO_EXTRA }, + { GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.BlendDstA), NO_EXTRA }, + + /* GL_BLEND_EQUATION_RGB, which is what we're really after, is + * defined identically to GL_BLEND_EQUATION. */ + { GL_BLEND_EQUATION, CONTEXT_ENUM(Color.BlendEquationRGB), NO_EXTRA }, + { GL_BLEND_EQUATION_ALPHA_EXT, CONTEXT_ENUM(Color.BlendEquationA), NO_EXTRA }, + + /* GL_ARB_texture_compression */ + { GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, + { GL_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT_N, 0, NO_EXTRA }, + + /* GL_ARB_multisample */ + { GL_SAMPLE_ALPHA_TO_COVERAGE_ARB, + CONTEXT_BOOL(Multisample.SampleAlphaToCoverage), NO_EXTRA }, + { GL_SAMPLE_COVERAGE_ARB, CONTEXT_BOOL(Multisample.SampleCoverage), NO_EXTRA }, + { GL_SAMPLE_COVERAGE_VALUE_ARB, + CONTEXT_FLOAT(Multisample.SampleCoverageValue), NO_EXTRA }, + { GL_SAMPLE_COVERAGE_INVERT_ARB, + CONTEXT_BOOL(Multisample.SampleCoverageInvert), NO_EXTRA }, + { GL_SAMPLE_BUFFERS_ARB, BUFFER_INT(Visual.sampleBuffers), NO_EXTRA }, + { GL_SAMPLES_ARB, BUFFER_INT(Visual.samples), NO_EXTRA }, + + /* GL_SGIS_generate_mipmap */ + { GL_GENERATE_MIPMAP_HINT_SGIS, CONTEXT_ENUM(Hint.GenerateMipmap), + extra_SGIS_generate_mipmap }, + + /* GL_ARB_vertex_buffer_object */ + { GL_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, + + /* GL_ARB_vertex_buffer_object */ + /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported */ + { GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, 0, + extra_ARB_vertex_buffer_object }, + + /* GL_OES_read_format */ + { GL_IMPLEMENTATION_COLOR_READ_TYPE_OES, LOC_CUSTOM, TYPE_INT, 0, + extra_new_buffers_OES_read_format }, + { GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES, LOC_CUSTOM, TYPE_INT, 0, + extra_new_buffers_OES_read_format }, + + /* GL_EXT_framebuffer_object */ + { GL_FRAMEBUFFER_BINDING_EXT, BUFFER_INT(Name), + extra_EXT_framebuffer_object }, + { GL_RENDERBUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_framebuffer_object }, + { GL_MAX_RENDERBUFFER_SIZE_EXT, CONTEXT_INT(Const.MaxRenderbufferSize), + extra_EXT_framebuffer_object }, + + /* This entry isn't spec'ed for GLES 2, but is needed for Mesa's + * GLSL: */ + { GL_MAX_CLIP_PLANES, CONTEXT_INT(Const.MaxClipPlanes), NO_EXTRA }, + +#if FEATURE_GL || FEATURE_ES1 + /* Enums in OpenGL and GLES1 */ + { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES_BIT, NO_EXTRA }, + { GL_LIGHT0, CONTEXT_BOOL(Light.Light[0].Enabled), NO_EXTRA }, + { GL_LIGHT1, CONTEXT_BOOL(Light.Light[1].Enabled), NO_EXTRA }, + { GL_LIGHT2, CONTEXT_BOOL(Light.Light[2].Enabled), NO_EXTRA }, + { GL_LIGHT3, CONTEXT_BOOL(Light.Light[3].Enabled), NO_EXTRA }, + { GL_LIGHT4, CONTEXT_BOOL(Light.Light[4].Enabled), NO_EXTRA }, + { GL_LIGHT5, CONTEXT_BOOL(Light.Light[5].Enabled), NO_EXTRA }, + { GL_LIGHT6, CONTEXT_BOOL(Light.Light[6].Enabled), NO_EXTRA }, + { GL_LIGHT7, CONTEXT_BOOL(Light.Light[7].Enabled), NO_EXTRA }, + { GL_LIGHTING, CONTEXT_BOOL(Light.Enabled), NO_EXTRA }, + { GL_LIGHT_MODEL_AMBIENT, + CONTEXT_FIELD(Light.Model.Ambient[0], TYPE_FLOATN_4), NO_EXTRA }, + { GL_LIGHT_MODEL_TWO_SIDE, CONTEXT_BOOL(Light.Model.TwoSide), NO_EXTRA }, + { GL_ALPHA_TEST, CONTEXT_BOOL(Color.AlphaEnabled), NO_EXTRA }, + { GL_ALPHA_TEST_FUNC, CONTEXT_ENUM(Color.AlphaFunc), NO_EXTRA }, + { GL_ALPHA_TEST_REF, CONTEXT_FIELD(Color.AlphaRef, TYPE_FLOATN), NO_EXTRA }, + { GL_BLEND_DST, CONTEXT_ENUM(Color.BlendDstRGB), NO_EXTRA }, + { GL_CLIP_PLANE0, CONTEXT_BIT0(Transform.ClipPlanesEnabled), NO_EXTRA }, + { GL_CLIP_PLANE1, CONTEXT_BIT1(Transform.ClipPlanesEnabled), NO_EXTRA }, + { GL_CLIP_PLANE2, CONTEXT_BIT2(Transform.ClipPlanesEnabled), NO_EXTRA }, + { GL_CLIP_PLANE3, CONTEXT_BIT3(Transform.ClipPlanesEnabled), NO_EXTRA }, + { GL_CLIP_PLANE4, CONTEXT_BIT4(Transform.ClipPlanesEnabled), NO_EXTRA }, + { GL_CLIP_PLANE5, CONTEXT_BIT5(Transform.ClipPlanesEnabled), NO_EXTRA }, + { GL_COLOR_MATERIAL, CONTEXT_BOOL(Light.ColorMaterialEnabled), NO_EXTRA }, + { GL_CURRENT_COLOR, + CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR0][0], TYPE_FLOATN_4), + extra_flush_current }, + { GL_CURRENT_NORMAL, + CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_NORMAL][0], TYPE_FLOATN_3), + extra_flush_current }, + { GL_CURRENT_TEXTURE_COORDS, LOC_CUSTOM, TYPE_FLOAT_4, 0, + extra_flush_current_valid_texture_unit }, + { GL_DISTANCE_ATTENUATION_EXT, CONTEXT_FLOAT3(Point.Params[0]), NO_EXTRA }, + { GL_FOG, CONTEXT_BOOL(Fog.Enabled), NO_EXTRA }, + { GL_FOG_COLOR, CONTEXT_FIELD(Fog.Color[0], TYPE_FLOATN_4), NO_EXTRA }, + { GL_FOG_DENSITY, CONTEXT_FLOAT(Fog.Density), NO_EXTRA }, + { GL_FOG_END, CONTEXT_FLOAT(Fog.End), NO_EXTRA }, + { GL_FOG_HINT, CONTEXT_ENUM(Hint.Fog), NO_EXTRA }, + { GL_FOG_MODE, CONTEXT_ENUM(Fog.Mode), NO_EXTRA }, + { GL_FOG_START, CONTEXT_FLOAT(Fog.Start), NO_EXTRA }, + { GL_LINE_SMOOTH, CONTEXT_BOOL(Line.SmoothFlag), NO_EXTRA }, + { GL_LINE_SMOOTH_HINT, CONTEXT_ENUM(Hint.LineSmooth), NO_EXTRA }, + { GL_LINE_WIDTH_RANGE, CONTEXT_FLOAT2(Const.MinLineWidthAA), NO_EXTRA }, + { GL_COLOR_LOGIC_OP, CONTEXT_BOOL(Color.ColorLogicOpEnabled), NO_EXTRA }, + { GL_LOGIC_OP_MODE, CONTEXT_ENUM(Color.LogicOp), NO_EXTRA }, + { GL_MATRIX_MODE, CONTEXT_ENUM(Transform.MatrixMode), NO_EXTRA }, + { GL_MAX_MODELVIEW_STACK_DEPTH, CONST(MAX_MODELVIEW_STACK_DEPTH), NO_EXTRA }, + { GL_MAX_PROJECTION_STACK_DEPTH, CONST(MAX_PROJECTION_STACK_DEPTH), NO_EXTRA }, + { GL_MAX_TEXTURE_STACK_DEPTH, CONST(MAX_TEXTURE_STACK_DEPTH), NO_EXTRA }, + { GL_MODELVIEW_MATRIX, CONTEXT_MATRIX(ModelviewMatrixStack.Top), NO_EXTRA }, + { GL_MODELVIEW_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, ModelviewMatrixStack.Depth), NO_EXTRA }, + { GL_NORMALIZE, CONTEXT_BOOL(Transform.Normalize), NO_EXTRA }, + { GL_PACK_SKIP_IMAGES_EXT, CONTEXT_INT(Pack.SkipImages), NO_EXTRA }, + { GL_PERSPECTIVE_CORRECTION_HINT, CONTEXT_ENUM(Hint.PerspectiveCorrection), NO_EXTRA }, + { GL_POINT_SIZE, CONTEXT_FLOAT(Point.Size), NO_EXTRA }, + { GL_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSizeAA), NO_EXTRA }, + { GL_POINT_SMOOTH, CONTEXT_BOOL(Point.SmoothFlag), NO_EXTRA }, + { GL_POINT_SMOOTH_HINT, CONTEXT_ENUM(Hint.PointSmooth), NO_EXTRA }, + { GL_POINT_SIZE_MIN_EXT, CONTEXT_FLOAT(Point.MinSize), NO_EXTRA }, + { GL_POINT_SIZE_MAX_EXT, CONTEXT_FLOAT(Point.MaxSize), NO_EXTRA }, + { GL_POINT_FADE_THRESHOLD_SIZE_EXT, CONTEXT_FLOAT(Point.Threshold), NO_EXTRA }, + { GL_PROJECTION_MATRIX, CONTEXT_MATRIX(ProjectionMatrixStack.Top), NO_EXTRA }, + { GL_PROJECTION_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, ProjectionMatrixStack.Depth), NO_EXTRA }, + { GL_RESCALE_NORMAL, CONTEXT_BOOL(Transform.RescaleNormals), NO_EXTRA }, + { GL_SHADE_MODEL, CONTEXT_ENUM(Light.ShadeModel), NO_EXTRA }, + { GL_TEXTURE_2D, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA }, + { GL_TEXTURE_MATRIX, LOC_CUSTOM, TYPE_MATRIX, 0, extra_valid_texture_unit }, + { GL_TEXTURE_STACK_DEPTH, LOC_CUSTOM, TYPE_INT, 0, + extra_valid_texture_unit }, + + { GL_VERTEX_ARRAY, ARRAY_BOOL(Vertex.Enabled), NO_EXTRA }, + { GL_VERTEX_ARRAY_SIZE, ARRAY_INT(Vertex.Size), NO_EXTRA }, + { GL_VERTEX_ARRAY_TYPE, ARRAY_ENUM(Vertex.Type), NO_EXTRA }, + { GL_VERTEX_ARRAY_STRIDE, ARRAY_INT(Vertex.Stride), NO_EXTRA }, + { GL_NORMAL_ARRAY, ARRAY_ENUM(Normal.Enabled), NO_EXTRA }, + { GL_NORMAL_ARRAY_TYPE, ARRAY_ENUM(Normal.Type), NO_EXTRA }, + { GL_NORMAL_ARRAY_STRIDE, ARRAY_INT(Normal.Stride), NO_EXTRA }, + { GL_COLOR_ARRAY, ARRAY_BOOL(Color.Enabled), NO_EXTRA }, + { GL_COLOR_ARRAY_SIZE, ARRAY_INT(Color.Size), NO_EXTRA }, + { GL_COLOR_ARRAY_TYPE, ARRAY_ENUM(Color.Type), NO_EXTRA }, + { GL_COLOR_ARRAY_STRIDE, ARRAY_INT(Color.Stride), NO_EXTRA }, + { GL_TEXTURE_COORD_ARRAY, + LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Enabled), NO_EXTRA }, + { GL_TEXTURE_COORD_ARRAY_SIZE, + LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Size), NO_EXTRA }, + { GL_TEXTURE_COORD_ARRAY_TYPE, + LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Type), NO_EXTRA }, + { GL_TEXTURE_COORD_ARRAY_STRIDE, + LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Stride), NO_EXTRA }, + + /* GL_ARB_multitexture */ + { GL_MAX_TEXTURE_UNITS_ARB, + CONTEXT_INT(Const.MaxTextureUnits), extra_ARB_multitexture }, + { GL_CLIENT_ACTIVE_TEXTURE_ARB, + LOC_CUSTOM, TYPE_INT, 0, extra_ARB_multitexture }, + + /* GL_ARB_texture_cube_map */ + { GL_TEXTURE_CUBE_MAP_ARB, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA }, + /* S, T, and R are always set at the same time */ + { GL_TEXTURE_GEN_STR_OES, LOC_TEXUNIT, TYPE_BIT_0, + offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA }, + + /* GL_ARB_multisample */ + { GL_MULTISAMPLE_ARB, CONTEXT_BOOL(Multisample.Enabled), NO_EXTRA }, + { GL_SAMPLE_ALPHA_TO_ONE_ARB, CONTEXT_BOOL(Multisample.SampleAlphaToOne), NO_EXTRA }, + + /* GL_ARB_vertex_buffer_object */ + { GL_VERTEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, Vertex.BufferObj), NO_EXTRA }, + { GL_NORMAL_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, Normal.BufferObj), NO_EXTRA }, + { GL_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, Color.BufferObj), NO_EXTRA }, + { GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA }, + + /* GL_OES_point_sprite */ + { GL_POINT_SPRITE_NV, + CONTEXT_BOOL(Point.PointSprite), + extra_NV_point_sprite_ARB_point_sprite }, + + /* GL_ARB_fragment_shader */ + { GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, + CONTEXT_INT(Const.FragmentProgram.MaxUniformComponents), + extra_ARB_fragment_shader }, + + /* GL_ARB_vertex_shader */ + { GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, + CONTEXT_INT(Const.VertexProgram.MaxUniformComponents), + extra_ARB_vertex_shader }, + { GL_MAX_VARYING_FLOATS_ARB, LOC_CUSTOM, TYPE_INT, 0, + extra_ARB_vertex_shader }, + + /* GL_EXT_texture_lod_bias */ + { GL_MAX_TEXTURE_LOD_BIAS_EXT, CONTEXT_FLOAT(Const.MaxTextureLodBias), + extra_EXT_texture_lod_bias }, + + /* GL_EXT_texture_filter_anisotropic */ + { GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, + CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy), + extra_EXT_texture_filter_anisotropic }, +#endif /* FEATURE_GL || FEATURE_ES1 */ + +#if FEATURE_ES1 + { 0, 0, TYPE_API_MASK, API_OPENGLES_BIT }, + /* XXX: OES_matrix_get */ + { GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES }, + { GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES }, + { GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES }, + + /* OES_point_size_array */ + { GL_POINT_SIZE_ARRAY_OES, ARRAY_FIELD(PointSize.Enabled, TYPE_BOOLEAN) }, + { GL_POINT_SIZE_ARRAY_TYPE_OES, ARRAY_FIELD(PointSize.Type, TYPE_ENUM) }, + { GL_POINT_SIZE_ARRAY_STRIDE_OES, ARRAY_FIELD(PointSize.Stride, TYPE_INT) }, + { GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES, LOC_CUSTOM, TYPE_INT, 0 }, +#endif /* FEATURE_ES1 */ + +#if FEATURE_GL || FEATURE_ES2 + { 0, 0, TYPE_API_MASK, API_OPENGL_BIT | API_OPENGLES2_BIT, NO_EXTRA }, + /* This entry isn't spec'ed for GLES 2, but is needed for Mesa's GLSL: */ + { GL_MAX_LIGHTS, CONTEXT_INT(Const.MaxLights), NO_EXTRA }, + { GL_MAX_TEXTURE_COORDS_ARB, /* == GL_MAX_TEXTURE_COORDS_NV */ + CONTEXT_INT(Const.MaxTextureCoordUnits), + extra_ARB_fragment_program_NV_fragment_program }, + + /* GL_ARB_draw_buffers */ + { GL_MAX_DRAW_BUFFERS_ARB, CONTEXT_INT(Const.MaxDrawBuffers), NO_EXTRA }, + + { GL_BLEND_COLOR_EXT, CONTEXT_FIELD(Color.BlendColor[0], TYPE_FLOATN_4), NO_EXTRA }, + /* GL_ARB_fragment_program */ + { GL_MAX_TEXTURE_IMAGE_UNITS_ARB, /* == GL_MAX_TEXTURE_IMAGE_UNITS_NV */ + CONTEXT_INT(Const.MaxTextureImageUnits), + extra_ARB_fragment_program_NV_fragment_program }, + { GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, + CONTEXT_INT(Const.MaxVertexTextureImageUnits), extra_ARB_vertex_shader }, + { GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, + CONTEXT_INT(Const.MaxCombinedTextureImageUnits), + extra_ARB_vertex_shader }, + + /* GL_ARB_shader_objects + * Actually, this token isn't part of GL_ARB_shader_objects, but is + * close enough for now. */ + { GL_CURRENT_PROGRAM, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_shader_objects }, + + /* OpenGL 2.0 */ + { GL_STENCIL_BACK_FUNC, CONTEXT_ENUM(Stencil.Function[1]), NO_EXTRA }, + { GL_STENCIL_BACK_VALUE_MASK, CONTEXT_INT(Stencil.ValueMask[1]), NO_EXTRA }, + { GL_STENCIL_BACK_WRITEMASK, CONTEXT_INT(Stencil.WriteMask[1]), NO_EXTRA }, + { GL_STENCIL_BACK_REF, CONTEXT_INT(Stencil.Ref[1]), NO_EXTRA }, + { GL_STENCIL_BACK_FAIL, CONTEXT_ENUM(Stencil.FailFunc[1]), NO_EXTRA }, + { GL_STENCIL_BACK_PASS_DEPTH_FAIL, CONTEXT_ENUM(Stencil.ZFailFunc[1]), NO_EXTRA }, + { GL_STENCIL_BACK_PASS_DEPTH_PASS, CONTEXT_ENUM(Stencil.ZPassFunc[1]), NO_EXTRA }, + + { GL_MAX_VERTEX_ATTRIBS_ARB, + CONTEXT_INT(Const.VertexProgram.MaxAttribs), + extra_ARB_vertex_program_version_es2 }, + + /* OES_texture_3D */ + { GL_TEXTURE_BINDING_3D, LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA }, + { GL_MAX_3D_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.Max3DTextureLevels), NO_EXTRA }, + + /* GL_ARB_fragment_program/OES_standard_derivatives */ + { GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB, + CONTEXT_ENUM(Hint.FragmentShaderDerivative), extra_ARB_fragment_shader }, +#endif /* FEATURE_GL || FEATURE_ES2 */ + +#if FEATURE_ES2 + /* Enums unique to OpenGL ES 2.0 */ + { 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA }, + { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA }, + { GL_MAX_VARYING_VECTORS, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.MaxVarying), NO_EXTRA }, + { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, Const.VertexProgram.MaxUniformComponents), NO_EXTRA }, + { GL_SHADER_COMPILER, CONST(1), NO_EXTRA }, + /* OES_get_program_binary */ + { GL_NUM_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA }, + { GL_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA }, +#endif /* FEATURE_ES2 */ + +#if FEATURE_GL + /* Remaining enums are only in OpenGL */ + { 0, 0, TYPE_API_MASK, API_OPENGL_BIT, NO_EXTRA }, + { GL_ACCUM_RED_BITS, BUFFER_INT(Visual.accumRedBits), NO_EXTRA }, + { GL_ACCUM_GREEN_BITS, BUFFER_INT(Visual.accumGreenBits), NO_EXTRA }, + { GL_ACCUM_BLUE_BITS, BUFFER_INT(Visual.accumBlueBits), NO_EXTRA }, + { GL_ACCUM_ALPHA_BITS, BUFFER_INT(Visual.accumAlphaBits), NO_EXTRA }, + { GL_ACCUM_CLEAR_VALUE, CONTEXT_FIELD(Accum.ClearColor[0], TYPE_FLOATN_4), NO_EXTRA }, + { GL_ALPHA_BIAS, CONTEXT_FLOAT(Pixel.AlphaBias), NO_EXTRA }, + { GL_ALPHA_SCALE, CONTEXT_FLOAT(Pixel.AlphaScale), NO_EXTRA }, + { GL_ATTRIB_STACK_DEPTH, CONTEXT_INT(AttribStackDepth), NO_EXTRA }, + { GL_AUTO_NORMAL, CONTEXT_BOOL(Eval.AutoNormal), NO_EXTRA }, + { GL_AUX_BUFFERS, BUFFER_INT(Visual.numAuxBuffers), NO_EXTRA }, + { GL_BLUE_BIAS, CONTEXT_FLOAT(Pixel.BlueBias), NO_EXTRA }, + { GL_BLUE_SCALE, CONTEXT_FLOAT(Pixel.BlueScale), NO_EXTRA }, + { GL_CLIENT_ATTRIB_STACK_DEPTH, CONTEXT_INT(ClientAttribStackDepth), NO_EXTRA }, + { GL_COLOR_MATERIAL_FACE, CONTEXT_ENUM(Light.ColorMaterialFace), NO_EXTRA }, + { GL_COLOR_MATERIAL_PARAMETER, CONTEXT_ENUM(Light.ColorMaterialMode), NO_EXTRA }, + { GL_CURRENT_INDEX, + CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]), + extra_flush_current }, + { GL_CURRENT_RASTER_COLOR, + CONTEXT_FIELD(Current.RasterColor[0], TYPE_FLOATN_4), NO_EXTRA }, + { GL_CURRENT_RASTER_DISTANCE, CONTEXT_FLOAT(Current.RasterDistance), NO_EXTRA }, + { GL_CURRENT_RASTER_INDEX, CONST(1), NO_EXTRA }, + { GL_CURRENT_RASTER_POSITION, CONTEXT_FLOAT4(Current.RasterPos[0]), NO_EXTRA }, + { GL_CURRENT_RASTER_SECONDARY_COLOR, + CONTEXT_FIELD(Current.RasterSecondaryColor[0], TYPE_FLOATN_4), NO_EXTRA }, + { GL_CURRENT_RASTER_TEXTURE_COORDS, LOC_CUSTOM, TYPE_FLOAT_4, 0, + extra_valid_texture_unit }, + { GL_CURRENT_RASTER_POSITION_VALID, CONTEXT_BOOL(Current.RasterPosValid), NO_EXTRA }, + { GL_DEPTH_BIAS, CONTEXT_FLOAT(Pixel.DepthBias), NO_EXTRA }, + { GL_DEPTH_SCALE, CONTEXT_FLOAT(Pixel.DepthScale), NO_EXTRA }, + { GL_DOUBLEBUFFER, BUFFER_INT(Visual.doubleBufferMode), NO_EXTRA }, + { GL_DRAW_BUFFER, BUFFER_ENUM(ColorDrawBuffer[0]), NO_EXTRA }, + { GL_EDGE_FLAG, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA }, + { GL_FEEDBACK_BUFFER_SIZE, CONTEXT_INT(Feedback.BufferSize), NO_EXTRA }, + { GL_FEEDBACK_BUFFER_TYPE, CONTEXT_ENUM(Feedback.Type), NO_EXTRA }, + { GL_FOG_INDEX, CONTEXT_FLOAT(Fog.Index), NO_EXTRA }, + { GL_GREEN_BIAS, CONTEXT_FLOAT(Pixel.GreenBias), NO_EXTRA }, + { GL_GREEN_SCALE, CONTEXT_FLOAT(Pixel.GreenScale), NO_EXTRA }, + { GL_INDEX_BITS, BUFFER_INT(Visual.indexBits), extra_new_buffers }, + { GL_INDEX_CLEAR_VALUE, CONTEXT_INT(Color.ClearIndex), NO_EXTRA }, + { GL_INDEX_MODE, CONST(0) , NO_EXTRA}, + { GL_INDEX_OFFSET, CONTEXT_INT(Pixel.IndexOffset), NO_EXTRA }, + { GL_INDEX_SHIFT, CONTEXT_INT(Pixel.IndexShift), NO_EXTRA }, + { GL_INDEX_WRITEMASK, CONTEXT_INT(Color.IndexMask), NO_EXTRA }, + { GL_LIGHT_MODEL_COLOR_CONTROL, CONTEXT_ENUM(Light.Model.ColorControl), NO_EXTRA }, + { GL_LIGHT_MODEL_LOCAL_VIEWER, CONTEXT_BOOL(Light.Model.LocalViewer), NO_EXTRA }, + { GL_LINE_STIPPLE, CONTEXT_BOOL(Line.StippleFlag), NO_EXTRA }, + { GL_LINE_STIPPLE_PATTERN, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, + { GL_LINE_STIPPLE_REPEAT, CONTEXT_INT(Line.StippleFactor), NO_EXTRA }, + { GL_LINE_WIDTH_GRANULARITY, CONTEXT_FLOAT(Const.LineWidthGranularity), NO_EXTRA }, + { GL_LIST_BASE, CONTEXT_INT(List.ListBase), NO_EXTRA }, + { GL_LIST_INDEX, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA }, + { GL_LIST_MODE, LOC_CUSTOM, TYPE_ENUM, 0, NO_EXTRA }, + { GL_INDEX_LOGIC_OP, CONTEXT_BOOL(Color.IndexLogicOpEnabled), NO_EXTRA }, + { GL_MAP1_COLOR_4, CONTEXT_BOOL(Eval.Map1Color4), NO_EXTRA }, + { GL_MAP1_GRID_DOMAIN, CONTEXT_FLOAT2(Eval.MapGrid1u1), NO_EXTRA }, + { GL_MAP1_GRID_SEGMENTS, CONTEXT_INT(Eval.MapGrid1un), NO_EXTRA }, + { GL_MAP1_INDEX, CONTEXT_BOOL(Eval.Map1Index), NO_EXTRA }, + { GL_MAP1_NORMAL, CONTEXT_BOOL(Eval.Map1Normal), NO_EXTRA }, + { GL_MAP1_TEXTURE_COORD_1, CONTEXT_BOOL(Eval.Map1TextureCoord1), NO_EXTRA }, + { GL_MAP1_TEXTURE_COORD_2, CONTEXT_BOOL(Eval.Map1TextureCoord2), NO_EXTRA }, + { GL_MAP1_TEXTURE_COORD_3, CONTEXT_BOOL(Eval.Map1TextureCoord3), NO_EXTRA }, + { GL_MAP1_TEXTURE_COORD_4, CONTEXT_BOOL(Eval.Map1TextureCoord4), NO_EXTRA }, + { GL_MAP1_VERTEX_3, CONTEXT_BOOL(Eval.Map1Vertex3), NO_EXTRA }, + { GL_MAP1_VERTEX_4, CONTEXT_BOOL(Eval.Map1Vertex4), NO_EXTRA }, + { GL_MAP2_COLOR_4, CONTEXT_BOOL(Eval.Map2Color4), NO_EXTRA }, + { GL_MAP2_GRID_DOMAIN, LOC_CUSTOM, TYPE_FLOAT_4, 0, NO_EXTRA }, + { GL_MAP2_GRID_SEGMENTS, CONTEXT_INT2(Eval.MapGrid2un), NO_EXTRA }, + { GL_MAP2_INDEX, CONTEXT_BOOL(Eval.Map2Index), NO_EXTRA }, + { GL_MAP2_NORMAL, CONTEXT_BOOL(Eval.Map2Normal), NO_EXTRA }, + { GL_MAP2_TEXTURE_COORD_1, CONTEXT_BOOL(Eval.Map2TextureCoord1), NO_EXTRA }, + { GL_MAP2_TEXTURE_COORD_2, CONTEXT_BOOL(Eval.Map2TextureCoord2), NO_EXTRA }, + { GL_MAP2_TEXTURE_COORD_3, CONTEXT_BOOL(Eval.Map2TextureCoord3), NO_EXTRA }, + { GL_MAP2_TEXTURE_COORD_4, CONTEXT_BOOL(Eval.Map2TextureCoord4), NO_EXTRA }, + { GL_MAP2_VERTEX_3, CONTEXT_BOOL(Eval.Map2Vertex3), NO_EXTRA }, + { GL_MAP2_VERTEX_4, CONTEXT_BOOL(Eval.Map2Vertex4), NO_EXTRA }, + { GL_MAP_COLOR, CONTEXT_BOOL(Pixel.MapColorFlag), NO_EXTRA }, + { GL_MAP_STENCIL, CONTEXT_BOOL(Pixel.MapStencilFlag), NO_EXTRA }, + { GL_MAX_ATTRIB_STACK_DEPTH, CONST(MAX_ATTRIB_STACK_DEPTH), NO_EXTRA }, + { GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, CONST(MAX_CLIENT_ATTRIB_STACK_DEPTH), NO_EXTRA }, + + { GL_MAX_EVAL_ORDER, CONST(MAX_EVAL_ORDER), NO_EXTRA }, + { GL_MAX_LIST_NESTING, CONST(MAX_LIST_NESTING), NO_EXTRA }, + { GL_MAX_NAME_STACK_DEPTH, CONST(MAX_NAME_STACK_DEPTH), NO_EXTRA }, + { GL_MAX_PIXEL_MAP_TABLE, CONST(MAX_PIXEL_MAP_TABLE), NO_EXTRA }, + { GL_NAME_STACK_DEPTH, CONTEXT_INT(Select.NameStackDepth), NO_EXTRA }, + { GL_PACK_LSB_FIRST, CONTEXT_BOOL(Pack.LsbFirst), NO_EXTRA }, + { GL_PACK_ROW_LENGTH, CONTEXT_INT(Pack.RowLength), NO_EXTRA }, + { GL_PACK_SKIP_PIXELS, CONTEXT_INT(Pack.SkipPixels), NO_EXTRA }, + { GL_PACK_SKIP_ROWS, CONTEXT_INT(Pack.SkipRows), NO_EXTRA }, + { GL_PACK_SWAP_BYTES, CONTEXT_BOOL(Pack.SwapBytes), NO_EXTRA }, + { GL_PACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Pack.ImageHeight), NO_EXTRA }, + { GL_PACK_INVERT_MESA, CONTEXT_BOOL(Pack.Invert), NO_EXTRA }, + { GL_PIXEL_MAP_A_TO_A_SIZE, CONTEXT_INT(PixelMaps.AtoA.Size), NO_EXTRA }, + { GL_PIXEL_MAP_B_TO_B_SIZE, CONTEXT_INT(PixelMaps.BtoB.Size), NO_EXTRA }, + { GL_PIXEL_MAP_G_TO_G_SIZE, CONTEXT_INT(PixelMaps.GtoG.Size), NO_EXTRA }, + { GL_PIXEL_MAP_I_TO_A_SIZE, CONTEXT_INT(PixelMaps.ItoA.Size), NO_EXTRA }, + { GL_PIXEL_MAP_I_TO_B_SIZE, CONTEXT_INT(PixelMaps.ItoB.Size), NO_EXTRA }, + { GL_PIXEL_MAP_I_TO_G_SIZE, CONTEXT_INT(PixelMaps.ItoG.Size), NO_EXTRA }, + { GL_PIXEL_MAP_I_TO_I_SIZE, CONTEXT_INT(PixelMaps.ItoI.Size), NO_EXTRA }, + { GL_PIXEL_MAP_I_TO_R_SIZE, CONTEXT_INT(PixelMaps.ItoR.Size), NO_EXTRA }, + { GL_PIXEL_MAP_R_TO_R_SIZE, CONTEXT_INT(PixelMaps.RtoR.Size), NO_EXTRA }, + { GL_PIXEL_MAP_S_TO_S_SIZE, CONTEXT_INT(PixelMaps.StoS.Size), NO_EXTRA }, + { GL_POINT_SIZE_GRANULARITY, CONTEXT_FLOAT(Const.PointSizeGranularity), NO_EXTRA }, + { GL_POLYGON_MODE, CONTEXT_ENUM2(Polygon.FrontMode), NO_EXTRA }, + { GL_POLYGON_OFFSET_BIAS_EXT, CONTEXT_FLOAT(Polygon.OffsetUnits), NO_EXTRA }, + { GL_POLYGON_OFFSET_POINT, CONTEXT_BOOL(Polygon.OffsetPoint), NO_EXTRA }, + { GL_POLYGON_OFFSET_LINE, CONTEXT_BOOL(Polygon.OffsetLine), NO_EXTRA }, + { GL_POLYGON_SMOOTH, CONTEXT_BOOL(Polygon.SmoothFlag), NO_EXTRA }, + { GL_POLYGON_SMOOTH_HINT, CONTEXT_ENUM(Hint.PolygonSmooth), NO_EXTRA }, + { GL_POLYGON_STIPPLE, CONTEXT_BOOL(Polygon.StippleFlag), NO_EXTRA }, + { GL_READ_BUFFER, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, + { GL_RED_BIAS, CONTEXT_FLOAT(Pixel.RedBias), NO_EXTRA }, + { GL_RED_SCALE, CONTEXT_FLOAT(Pixel.RedScale), NO_EXTRA }, + { GL_RENDER_MODE, CONTEXT_ENUM(RenderMode), NO_EXTRA }, + { GL_RGBA_MODE, CONST(1), NO_EXTRA }, + { GL_SELECTION_BUFFER_SIZE, CONTEXT_INT(Select.BufferSize), NO_EXTRA }, + { GL_SHARED_TEXTURE_PALETTE_EXT, CONTEXT_BOOL(Texture.SharedPalette), NO_EXTRA }, + + { GL_STEREO, BUFFER_INT(Visual.stereoMode), NO_EXTRA }, + + { GL_TEXTURE_1D, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA }, + { GL_TEXTURE_3D, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA }, + { GL_TEXTURE_1D_ARRAY_EXT, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA }, + { GL_TEXTURE_2D_ARRAY_EXT, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA }, + + { GL_TEXTURE_BINDING_1D, LOC_CUSTOM, TYPE_INT, TEXTURE_1D_INDEX, NO_EXTRA }, + { GL_TEXTURE_BINDING_1D_ARRAY, LOC_CUSTOM, TYPE_INT, + TEXTURE_1D_ARRAY_INDEX, extra_MESA_texture_array }, + { GL_TEXTURE_BINDING_2D_ARRAY, LOC_CUSTOM, TYPE_INT, + TEXTURE_1D_ARRAY_INDEX, extra_MESA_texture_array }, + { GL_MAX_ARRAY_TEXTURE_LAYERS_EXT, + CONTEXT_INT(Const.MaxArrayTextureLayers), extra_MESA_texture_array }, + + { GL_TEXTURE_GEN_S, LOC_TEXUNIT, TYPE_BIT_0, + offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA }, + { GL_TEXTURE_GEN_T, LOC_TEXUNIT, TYPE_BIT_1, + offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA }, + { GL_TEXTURE_GEN_R, LOC_TEXUNIT, TYPE_BIT_2, + offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA }, + { GL_TEXTURE_GEN_Q, LOC_TEXUNIT, TYPE_BIT_3, + offsetof(struct gl_texture_unit, TexGenEnabled), NO_EXTRA }, + { GL_UNPACK_LSB_FIRST, CONTEXT_BOOL(Unpack.LsbFirst), NO_EXTRA }, + { GL_UNPACK_ROW_LENGTH, CONTEXT_INT(Unpack.RowLength), NO_EXTRA }, + { GL_UNPACK_SKIP_PIXELS, CONTEXT_INT(Unpack.SkipPixels), NO_EXTRA }, + { GL_UNPACK_SKIP_ROWS, CONTEXT_INT(Unpack.SkipRows), NO_EXTRA }, + { GL_UNPACK_SWAP_BYTES, CONTEXT_BOOL(Unpack.SwapBytes), NO_EXTRA }, + { GL_UNPACK_SKIP_IMAGES_EXT, CONTEXT_INT(Unpack.SkipImages), NO_EXTRA }, + { GL_UNPACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Unpack.ImageHeight), NO_EXTRA }, + { GL_UNPACK_CLIENT_STORAGE_APPLE, CONTEXT_BOOL(Unpack.ClientStorage), NO_EXTRA }, + { GL_ZOOM_X, CONTEXT_FLOAT(Pixel.ZoomX), NO_EXTRA }, + { GL_ZOOM_Y, CONTEXT_FLOAT(Pixel.ZoomY), NO_EXTRA }, + + /* Vertex arrays */ + { GL_VERTEX_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, + { GL_NORMAL_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, + { GL_COLOR_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, + { GL_INDEX_ARRAY, ARRAY_BOOL(Index.Enabled), NO_EXTRA }, + { GL_INDEX_ARRAY_TYPE, ARRAY_ENUM(Index.Type), NO_EXTRA }, + { GL_INDEX_ARRAY_STRIDE, ARRAY_INT(Index.Stride), NO_EXTRA }, + { GL_INDEX_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, + { GL_TEXTURE_COORD_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, + { GL_EDGE_FLAG_ARRAY, ARRAY_BOOL(EdgeFlag.Enabled), NO_EXTRA }, + { GL_EDGE_FLAG_ARRAY_STRIDE, ARRAY_INT(EdgeFlag.Stride), NO_EXTRA }, + { GL_EDGE_FLAG_ARRAY_COUNT_EXT, CONST(0), NO_EXTRA }, + + /* GL_ARB_texture_compression */ + { GL_TEXTURE_COMPRESSION_HINT_ARB, CONTEXT_INT(Hint.TextureCompression), NO_EXTRA }, + + /* GL_EXT_compiled_vertex_array */ + { GL_ARRAY_ELEMENT_LOCK_FIRST_EXT, CONTEXT_INT(Array.LockFirst), + extra_EXT_compiled_vertex_array }, + { GL_ARRAY_ELEMENT_LOCK_COUNT_EXT, CONTEXT_INT(Array.LockCount), + extra_EXT_compiled_vertex_array }, + + /* GL_ARB_transpose_matrix */ + { GL_TRANSPOSE_COLOR_MATRIX_ARB, CONTEXT_MATRIX_T(ColorMatrixStack.Top), NO_EXTRA }, + { GL_TRANSPOSE_MODELVIEW_MATRIX_ARB, + CONTEXT_MATRIX_T(ModelviewMatrixStack), NO_EXTRA }, + { GL_TRANSPOSE_PROJECTION_MATRIX_ARB, + CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA }, + { GL_TRANSPOSE_TEXTURE_MATRIX_ARB, CONTEXT_MATRIX_T(TextureMatrixStack), NO_EXTRA }, + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + { GL_COLOR_MATRIX_SGI, CONTEXT_MATRIX(ColorMatrixStack.Top), NO_EXTRA }, + { GL_COLOR_MATRIX_STACK_DEPTH_SGI, LOC_CUSTOM, TYPE_INT, + offsetof(GLcontext, ColorMatrixStack.Depth), NO_EXTRA }, + { GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI, + CONST(MAX_COLOR_STACK_DEPTH), NO_EXTRA }, + { GL_POST_COLOR_MATRIX_RED_SCALE_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixScale[0]), NO_EXTRA }, + { GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixScale[1]), NO_EXTRA }, + { GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixScale[2]), NO_EXTRA }, + { GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixScale[3]), NO_EXTRA }, + { GL_POST_COLOR_MATRIX_RED_BIAS_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixBias[0]), NO_EXTRA }, + { GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixBias[1]), NO_EXTRA }, + { GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixBias[2]), NO_EXTRA }, + { GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI, + CONTEXT_FLOAT(Pixel.PostColorMatrixBias[3]), NO_EXTRA }, + + /* GL_EXT_convolution (also in 1.2 imaging) */ + { GL_CONVOLUTION_1D_EXT, CONTEXT_BOOL(Pixel.Convolution1DEnabled), + extra_EXT_convolution }, + { GL_CONVOLUTION_2D_EXT, CONTEXT_BOOL(Pixel.Convolution2DEnabled), + extra_EXT_convolution }, + { GL_SEPARABLE_2D_EXT, CONTEXT_BOOL(Pixel.Separable2DEnabled), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_RED_SCALE_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionScale[0]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_GREEN_SCALE_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionScale[1]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_BLUE_SCALE_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionScale[2]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_ALPHA_SCALE_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionScale[3]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_RED_BIAS_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionBias[0]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_GREEN_BIAS_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionBias[1]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_BLUE_BIAS_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionBias[2]), + extra_EXT_convolution }, + { GL_POST_CONVOLUTION_ALPHA_BIAS_EXT, + CONTEXT_FLOAT(Pixel.PostConvolutionBias[3]), + extra_EXT_convolution }, + + /* GL_EXT_histogram / GL_ARB_imaging */ + { GL_HISTOGRAM, CONTEXT_BOOL(Pixel.HistogramEnabled), + extra_EXT_histogram }, + { GL_MINMAX, CONTEXT_BOOL(Pixel.MinMaxEnabled), extra_EXT_histogram }, + + /* GL_SGI_color_table / GL_ARB_imaging */ + { GL_COLOR_TABLE_SGI, + CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]), + extra_SGI_color_table }, + { GL_POST_CONVOLUTION_COLOR_TABLE_SGI, + CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]), + extra_SGI_color_table }, + { GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI, + CONTEXT_BOOL(Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]), + extra_SGI_color_table }, + + /* GL_SGI_texture_color_table */ + { GL_TEXTURE_COLOR_TABLE_SGI, LOC_TEXUNIT, TYPE_BOOLEAN, + offsetof(struct gl_texture_unit, ColorTableEnabled), + extra_SGI_texture_color_table }, + + /* GL_EXT_secondary_color */ + { GL_COLOR_SUM_EXT, CONTEXT_BOOL(Fog.ColorSumEnabled), + extra_EXT_secondary_color_ARB_vertex_program }, + { GL_CURRENT_SECONDARY_COLOR_EXT, + CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR1][0], TYPE_FLOATN_4), + extra_EXT_secondary_color_flush_current }, + { GL_SECONDARY_COLOR_ARRAY_EXT, ARRAY_BOOL(SecondaryColor.Enabled), + extra_EXT_secondary_color }, + { GL_SECONDARY_COLOR_ARRAY_TYPE_EXT, ARRAY_ENUM(SecondaryColor.Type), + extra_EXT_secondary_color }, + { GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT, ARRAY_INT(SecondaryColor.Stride), + extra_EXT_secondary_color }, + { GL_SECONDARY_COLOR_ARRAY_SIZE_EXT, ARRAY_INT(SecondaryColor.Size), + extra_EXT_secondary_color }, + + /* GL_EXT_fog_coord */ + { GL_CURRENT_FOG_COORDINATE_EXT, + CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]), + extra_EXT_fog_coord_flush_current }, + { GL_FOG_COORDINATE_ARRAY_EXT, ARRAY_BOOL(FogCoord.Enabled), + extra_EXT_fog_coord }, + { GL_FOG_COORDINATE_ARRAY_TYPE_EXT, ARRAY_ENUM(FogCoord.Type), + extra_EXT_fog_coord }, + { GL_FOG_COORDINATE_ARRAY_STRIDE_EXT, ARRAY_INT(FogCoord.Stride), + extra_EXT_fog_coord }, + { GL_FOG_COORDINATE_SOURCE_EXT, CONTEXT_ENUM(Fog.FogCoordinateSource), + extra_EXT_fog_coord }, + + /* GL_IBM_rasterpos_clip */ + { GL_RASTER_POSITION_UNCLIPPED_IBM, + CONTEXT_BOOL(Transform.RasterPositionUnclipped), + extra_IBM_rasterpos_clip }, + + /* GL_NV_point_sprite */ + { GL_POINT_SPRITE_R_MODE_NV, + CONTEXT_ENUM(Point.SpriteRMode), extra_NV_point_sprite }, + { GL_POINT_SPRITE_COORD_ORIGIN, CONTEXT_ENUM(Point.SpriteOrigin), + extra_NV_point_sprite_ARB_point_sprite }, + + /* GL_NV_vertex_program */ + { GL_VERTEX_PROGRAM_BINDING_NV, LOC_CUSTOM, TYPE_INT, 0, + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY0_NV, ARRAY_BOOL(VertexAttrib[0].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY1_NV, ARRAY_BOOL(VertexAttrib[1].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY2_NV, ARRAY_BOOL(VertexAttrib[2].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY3_NV, ARRAY_BOOL(VertexAttrib[3].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY4_NV, ARRAY_BOOL(VertexAttrib[4].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY5_NV, ARRAY_BOOL(VertexAttrib[5].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY6_NV, ARRAY_BOOL(VertexAttrib[6].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY7_NV, ARRAY_BOOL(VertexAttrib[7].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY8_NV, ARRAY_BOOL(VertexAttrib[8].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY9_NV, ARRAY_BOOL(VertexAttrib[9].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY10_NV, ARRAY_BOOL(VertexAttrib[10].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY11_NV, ARRAY_BOOL(VertexAttrib[11].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY12_NV, ARRAY_BOOL(VertexAttrib[12].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY13_NV, ARRAY_BOOL(VertexAttrib[13].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY14_NV, ARRAY_BOOL(VertexAttrib[14].Enabled), + extra_NV_vertex_program }, + { GL_VERTEX_ATTRIB_ARRAY15_NV, ARRAY_BOOL(VertexAttrib[15].Enabled), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB0_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[0]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB1_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[1]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB2_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[2]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB3_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[3]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB4_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[4]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB5_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[5]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB6_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[6]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB7_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[7]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB8_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[8]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB9_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[9]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB10_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[10]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB11_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[11]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB12_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[12]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB13_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[13]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB14_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[14]), + extra_NV_vertex_program }, + { GL_MAP1_VERTEX_ATTRIB15_4_NV, CONTEXT_BOOL(Eval.Map1Attrib[15]), + extra_NV_vertex_program }, + + /* GL_NV_fragment_program */ + { GL_FRAGMENT_PROGRAM_NV, CONTEXT_BOOL(FragmentProgram.Enabled), + extra_NV_fragment_program }, + { GL_FRAGMENT_PROGRAM_BINDING_NV, LOC_CUSTOM, TYPE_INT, 0, + extra_NV_fragment_program }, + { GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV, + CONST(MAX_NV_FRAGMENT_PROGRAM_PARAMS), + extra_NV_fragment_program }, + + /* GL_NV_texture_rectangle */ + { GL_TEXTURE_RECTANGLE_NV, + LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_NV_texture_rectangle }, + { GL_TEXTURE_BINDING_RECTANGLE_NV, + LOC_CUSTOM, TYPE_INT, TEXTURE_RECT_INDEX, extra_NV_texture_rectangle }, + { GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, + CONTEXT_INT(Const.MaxTextureRectSize), extra_NV_texture_rectangle }, + + /* GL_EXT_stencil_two_side */ + { GL_STENCIL_TEST_TWO_SIDE_EXT, CONTEXT_BOOL(Stencil.TestTwoSide), + extra_EXT_stencil_two_side }, + { GL_ACTIVE_STENCIL_FACE_EXT, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA }, + + /* GL_NV_light_max_exponent */ + { GL_MAX_SHININESS_NV, CONTEXT_FLOAT(Const.MaxShininess), + extra_NV_light_max_exponent }, + { GL_MAX_SPOT_EXPONENT_NV, CONTEXT_FLOAT(Const.MaxSpotExponent), + extra_NV_light_max_exponent }, + + /* GL_ARB_vertex_buffer_object */ + { GL_INDEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, Index.BufferObj), NO_EXTRA }, + { GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, EdgeFlag.BufferObj), NO_EXTRA }, + { GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, SecondaryColor.BufferObj), NO_EXTRA }, + { GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, + offsetof(struct gl_array_object, FogCoord.BufferObj), NO_EXTRA }, + + /* GL_EXT_pixel_buffer_object */ + { GL_PIXEL_PACK_BUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_pixel_buffer_object }, + { GL_PIXEL_UNPACK_BUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_pixel_buffer_object }, + + /* GL_ARB_vertex_program */ + { GL_VERTEX_PROGRAM_ARB, /* == GL_VERTEX_PROGRAM_NV */ + CONTEXT_BOOL(VertexProgram.Enabled), + extra_ARB_vertex_program_NV_vertex_program }, + { GL_VERTEX_PROGRAM_POINT_SIZE_ARB, /* == GL_VERTEX_PROGRAM_POINT_SIZE_NV*/ + CONTEXT_BOOL(VertexProgram.PointSizeEnabled), + extra_ARB_vertex_program_NV_vertex_program }, + { GL_VERTEX_PROGRAM_TWO_SIDE_ARB, /* == GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + CONTEXT_BOOL(VertexProgram.TwoSideEnabled), + extra_ARB_vertex_program_NV_vertex_program }, + { GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, /* == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + CONTEXT_INT(Const.MaxProgramMatrixStackDepth), + extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + { GL_MAX_PROGRAM_MATRICES_ARB, /* == GL_MAX_TRACK_MATRICES_NV */ + CONTEXT_INT(Const.MaxProgramMatrices), + extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + { GL_CURRENT_MATRIX_STACK_DEPTH_ARB, /* == GL_CURRENT_MATRIX_STACK_DEPTH_NV */ + LOC_CUSTOM, TYPE_INT, 0, + extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + + { GL_CURRENT_MATRIX_ARB, /* == GL_CURRENT_MATRIX_NV */ + LOC_CUSTOM, TYPE_MATRIX, 0, + extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + { GL_TRANSPOSE_CURRENT_MATRIX_ARB, /* == GL_CURRENT_MATRIX_NV */ + LOC_CUSTOM, TYPE_MATRIX, 0, + extra_ARB_vertex_program_ARB_fragment_program }, + + { GL_PROGRAM_ERROR_POSITION_ARB, /* == GL_PROGRAM_ERROR_POSITION_NV */ + CONTEXT_INT(Program.ErrorPos), + extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_program }, + + /* GL_ARB_fragment_program */ + { GL_FRAGMENT_PROGRAM_ARB, CONTEXT_BOOL(FragmentProgram.Enabled), + extra_ARB_fragment_program }, + + /* GL_EXT_depth_bounds_test */ + { GL_DEPTH_BOUNDS_TEST_EXT, CONTEXT_BOOL(Depth.BoundsTest), + extra_EXT_depth_bounds_test }, + { GL_DEPTH_BOUNDS_EXT, CONTEXT_FLOAT2(Depth.BoundsMin), + extra_EXT_depth_bounds_test }, + + /* GL_ARB_depth_clamp*/ + { GL_DEPTH_CLAMP, CONTEXT_BOOL(Transform.DepthClamp), + extra_ARB_depth_clamp }, + + /* GL_ARB_draw_buffers */ + { GL_DRAW_BUFFER0_ARB, BUFFER_ENUM(ColorDrawBuffer[0]), NO_EXTRA }, + { GL_DRAW_BUFFER1_ARB, BUFFER_ENUM(ColorDrawBuffer[1]), + extra_valid_draw_buffer }, + { GL_DRAW_BUFFER2_ARB, BUFFER_ENUM(ColorDrawBuffer[2]), + extra_valid_draw_buffer }, + { GL_DRAW_BUFFER3_ARB, BUFFER_ENUM(ColorDrawBuffer[3]), + extra_valid_draw_buffer }, + + /* GL_ATI_fragment_shader */ + { GL_NUM_FRAGMENT_REGISTERS_ATI, CONST(6), extra_ATI_fragment_shader }, + { GL_NUM_FRAGMENT_CONSTANTS_ATI, CONST(8), extra_ATI_fragment_shader }, + { GL_NUM_PASSES_ATI, CONST(2), extra_ATI_fragment_shader }, + { GL_NUM_INSTRUCTIONS_PER_PASS_ATI, CONST(8), extra_ATI_fragment_shader }, + { GL_NUM_INSTRUCTIONS_TOTAL_ATI, CONST(16), extra_ATI_fragment_shader }, + { GL_COLOR_ALPHA_PAIRING_ATI, CONST(GL_TRUE), extra_ATI_fragment_shader }, + { GL_NUM_LOOPBACK_COMPONENTS_ATI, CONST(3), extra_ATI_fragment_shader }, + { GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI, + CONST(3), extra_ATI_fragment_shader }, + + /* GL_EXT_framebuffer_object */ + { GL_MAX_COLOR_ATTACHMENTS_EXT, CONTEXT_INT(Const.MaxColorAttachments), + extra_EXT_framebuffer_object }, + + /* GL_EXT_framebuffer_blit + * NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT */ + { GL_READ_FRAMEBUFFER_BINDING_EXT, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_framebuffer_blit }, + + /* GL_EXT_provoking_vertex */ + { GL_PROVOKING_VERTEX_EXT, + CONTEXT_BOOL(Light.ProvokingVertex), extra_EXT_provoking_vertex }, + { GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT, + CONTEXT_BOOL(Const.QuadsFollowProvokingVertexConvention), + extra_EXT_provoking_vertex }, + + /* GL_ARB_framebuffer_object */ + { GL_MAX_SAMPLES, CONTEXT_INT(Const.MaxSamples), + extra_ARB_framebuffer_object }, + + /* GL_APPLE_vertex_array_object */ + { GL_VERTEX_ARRAY_BINDING_APPLE, ARRAY_INT(Name), + extra_APPLE_vertex_array_object }, + + /* GL_ARB_seamless_cube_map */ + { GL_TEXTURE_CUBE_MAP_SEAMLESS, + CONTEXT_BOOL(Texture.CubeMapSeamless), extra_ARB_seamless_cube_map }, + + /* GL_ARB_sync */ + { GL_MAX_SERVER_WAIT_TIMEOUT, + CONTEXT_INT64(Const.MaxServerWaitTimeout), extra_ARB_sync }, + + /* GL_EXT_transform_feedback */ + { GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0, + extra_EXT_transform_feedback }, + { GL_RASTERIZER_DISCARD, CONTEXT_BOOL(TransformFeedback.RasterDiscard), + extra_EXT_transform_feedback }, + { GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, + CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents), + extra_EXT_transform_feedback }, + { GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, + CONTEXT_INT(Const.MaxTransformFeedbackSeparateAttribs), + extra_EXT_transform_feedback }, + { GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, + CONTEXT_INT(Const.MaxTransformFeedbackSeparateComponents), + extra_EXT_transform_feedback }, + + /* GL_ARB_transform_feedback2 */ + { GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED, LOC_CUSTOM, TYPE_BOOLEAN, 0, + extra_ARB_transform_feedback2 }, + { GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE, LOC_CUSTOM, TYPE_BOOLEAN, 0, + extra_ARB_transform_feedback2 }, + { GL_TRANSFORM_FEEDBACK_BINDING, LOC_CUSTOM, TYPE_INT, 0, + extra_ARB_transform_feedback2 }, + + /* GL_ARB_geometry_shader4 */ + { GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB, + CONTEXT_INT(Const.GeometryProgram.MaxGeometryTextureImageUnits), + extra_ARB_geometry_shader4 }, + { GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB, + CONTEXT_INT(Const.GeometryProgram.MaxGeometryOutputVertices), + extra_ARB_geometry_shader4 }, + { GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB, + CONTEXT_INT(Const.GeometryProgram.MaxGeometryTotalOutputComponents), + extra_ARB_geometry_shader4 }, + { GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB, + CONTEXT_INT(Const.GeometryProgram.MaxGeometryUniformComponents), + extra_ARB_geometry_shader4 }, + { GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB, + CONTEXT_INT(Const.GeometryProgram.MaxGeometryVaryingComponents), + extra_ARB_geometry_shader4 }, + { GL_MAX_VERTEX_VARYING_COMPONENTS_ARB, + CONTEXT_INT(Const.GeometryProgram.MaxVertexVaryingComponents), + extra_ARB_geometry_shader4 }, + + /* GL 3.0 */ + { GL_NUM_EXTENSIONS, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 }, + { GL_MAJOR_VERSION, CONTEXT_INT(VersionMajor), extra_version_30 }, + { GL_MINOR_VERSION, CONTEXT_INT(VersionMinor), extra_version_30 }, + { GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 }, + + /* GL 3.1 */ + { GL_PRIMITIVE_RESTART, CONTEXT_BOOL(Array.PrimitiveRestart), + extra_version_31 }, + { GL_PRIMITIVE_RESTART_INDEX, CONTEXT_INT(Array.RestartIndex), + extra_version_31 }, + + /* GL 3.2 */ + { GL_CONTEXT_PROFILE_MASK, CONTEXT_INT(Const.ProfileMask), + extra_version_32 }, +#endif /* FEATURE_GL */ +}; + +/* All we need now is a way to look up the value struct from the enum. + * The code generated by gcc for the old generated big switch + * statement is a big, balanced, open coded if/else tree, essentially + * an unrolled binary search. It would be natural to sort the new + * enum table and use bsearch(), but we will use a read-only hash + * table instead. bsearch() has a nice guaranteed worst case + * performance, but we're also guaranteed to hit that worst case + * (log2(n) iterations) for about half the enums. Instead, using an + * open addressing hash table, we can find the enum on the first try + * for 80% of the enums, 1 collision for 10% and never more than 5 + * collisions for any enum (typical numbers). And the code is very + * simple, even though it feels a little magic. */ + +static unsigned short table[1024]; +static const int prime_factor = 89, prime_step = 281; + +#ifdef GET_DEBUG +static void +print_table_stats(void) +{ + int i, j, collisions[11], count, hash, mask; + const struct value_desc *d; + + count = 0; + mask = Elements(table) - 1; + memset(collisions, 0, sizeof collisions); + + for (i = 0; i < Elements(table); i++) { + if (!table[i]) + continue; + count++; + d = &values[table[i]]; + hash = (d->pname * prime_factor); + j = 0; + while (1) { + if (values[table[hash & mask]].pname == d->pname) + break; + hash += prime_step; + j++; + } + + if (j < 10) + collisions[j]++; + else + collisions[10]++; + } + + printf("number of enums: %d (total %d)\n", count, Elements(values)); + for (i = 0; i < Elements(collisions) - 1; i++) + if (collisions[i] > 0) + printf(" %d enums with %d %scollisions\n", + collisions[i], i, i == 10 ? "or more " : ""); +} +#endif + +/** + * Initialize the enum hash for a given API + * + * This is called from one_time_init() to insert the enum values that + * are valid for the API in question into the enum hash table. + * + * \param the current context, for determining the API in question */ -#define CHECK_EXT2(EXT1, EXT2, FUNC) \ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \ - return; \ +void _mesa_init_get_hash(GLcontext *ctx) +{ + int i, hash, index, mask; + int api_mask = 0, api_bit; + + mask = Elements(table) - 1; + api_bit = 1 << ctx->API; + + for (i = 0; i < Elements(values); i++) { + if (values[i].type == TYPE_API_MASK) { + api_mask = values[i].offset; + continue; + } + if (!(api_mask & api_bit)) + continue; + + hash = (values[i].pname * prime_factor) & mask; + while (1) { + index = hash & mask; + if (!table[index]) { + table[index] = i; + break; + } + hash += prime_step; + } } -/* - * Check if either of three extensions is enabled. +#ifdef GET_DEBUG + print_table_stats(); +#endif +} + +/** + * Handle irregular enums + * + * Some values don't conform to the "well-known type at context + * pointer + offset" pattern, so we have this function to catch all + * the corner cases. Typically, it's a computed value or a one-off + * pointer to a custom struct or something. + * + * In this case we can't return a pointer to the value, so we'll have + * to use the temporary variable 'v' declared back in the calling + * glGet*v() function to store the result. + * + * \param ctx the current context + * \param d the struct value_desc that describes the enum + * \param v pointer to the tmp declared in the calling glGet*v() function */ -#define CHECK_EXT3(EXT1, EXT2, EXT3, FUNC) \ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \ - !ctx->Extensions.EXT3) { \ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \ - return; \ +static void +find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v) +{ + struct gl_buffer_object *buffer_obj; + struct gl_client_array *array; + GLuint unit, *p; + + switch (d->pname) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + case GL_TEXTURE_1D_ARRAY_EXT: + case GL_TEXTURE_2D_ARRAY_EXT: + case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_RECTANGLE_NV: + v->value_bool = _mesa_IsEnabled(d->pname); + break; + + case GL_LINE_STIPPLE_PATTERN: + /* This is the only GLushort, special case it here by promoting + * to an int rather than introducing a new type. */ + v->value_int = ctx->Line.StipplePattern; + break; + + case GL_CURRENT_RASTER_TEXTURE_COORDS: + unit = ctx->Texture.CurrentUnit; + v->value_float_4[0] = ctx->Current.RasterTexCoords[unit][0]; + v->value_float_4[1] = ctx->Current.RasterTexCoords[unit][1]; + v->value_float_4[2] = ctx->Current.RasterTexCoords[unit][2]; + v->value_float_4[3] = ctx->Current.RasterTexCoords[unit][3]; + break; + + case GL_CURRENT_TEXTURE_COORDS: + unit = ctx->Texture.CurrentUnit; + v->value_float_4[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]; + v->value_float_4[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]; + v->value_float_4[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]; + v->value_float_4[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]; + break; + + case GL_COLOR_WRITEMASK: + v->value_int_4[0] = ctx->Color.ColorMask[0][RCOMP] ? 1 : 0; + v->value_int_4[1] = ctx->Color.ColorMask[0][GCOMP] ? 1 : 0; + v->value_int_4[2] = ctx->Color.ColorMask[0][BCOMP] ? 1 : 0; + v->value_int_4[3] = ctx->Color.ColorMask[0][ACOMP] ? 1 : 0; + break; + + case GL_EDGE_FLAG: + v->value_bool = ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0; + break; + + case GL_READ_BUFFER: + v->value_enum = ctx->ReadBuffer->ColorReadBuffer; + break; + + case GL_MAP2_GRID_DOMAIN: + v->value_float_4[0] = ctx->Eval.MapGrid2u1; + v->value_float_4[1] = ctx->Eval.MapGrid2u2; + v->value_float_4[2] = ctx->Eval.MapGrid2v1; + v->value_float_4[3] = ctx->Eval.MapGrid2v2; + break; + + case GL_TEXTURE_STACK_DEPTH: + unit = ctx->Texture.CurrentUnit; + v->value_int = ctx->TextureMatrixStack[unit].Depth + 1; + break; + case GL_TEXTURE_MATRIX: + unit = ctx->Texture.CurrentUnit; + v->value_matrix = ctx->TextureMatrixStack[unit].Top; + break; + + case GL_TEXTURE_COORD_ARRAY: + case GL_TEXTURE_COORD_ARRAY_SIZE: + case GL_TEXTURE_COORD_ARRAY_TYPE: + case GL_TEXTURE_COORD_ARRAY_STRIDE: + array = &ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture]; + v->value_int = *(GLuint *) ((char *) array + d->offset); + break; + + case GL_ACTIVE_TEXTURE_ARB: + v->value_int = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; + break; + case GL_CLIENT_ACTIVE_TEXTURE_ARB: + v->value_int = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; + break; + + case GL_MODELVIEW_STACK_DEPTH: + case GL_PROJECTION_STACK_DEPTH: + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + v->value_int = *(GLint *) ((char *) ctx + d->offset) + 1; + break; + + case GL_MAX_TEXTURE_SIZE: + case GL_MAX_3D_TEXTURE_SIZE: + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + p = (GLuint *) ((char *) ctx + d->offset); + v->value_int = 1 << (*p - 1); + break; + + case GL_SCISSOR_BOX: + v->value_int_4[0] = ctx->Scissor.X; + v->value_int_4[1] = ctx->Scissor.Y; + v->value_int_4[2] = ctx->Scissor.Width; + v->value_int_4[3] = ctx->Scissor.Height; + break; + + case GL_LIST_INDEX: + v->value_int = + ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0; + break; + case GL_LIST_MODE: + if (!ctx->CompileFlag) + v->value_enum = 0; + else if (ctx->ExecuteFlag) + v->value_enum = GL_COMPILE_AND_EXECUTE; + else + v->value_enum = GL_COMPILE; + break; + + case GL_VIEWPORT: + v->value_int_4[0] = ctx->Viewport.X; + v->value_int_4[1] = ctx->Viewport.Y; + v->value_int_4[2] = ctx->Viewport.Width; + v->value_int_4[3] = ctx->Viewport.Height; + break; + + case GL_ACTIVE_STENCIL_FACE_EXT: + v->value_enum = ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT; + break; + + case GL_STENCIL_FAIL: + v->value_enum = ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_FUNC: + v->value_enum = ctx->Stencil.Function[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_PASS_DEPTH_FAIL: + v->value_enum = ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_PASS_DEPTH_PASS: + v->value_enum = ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_REF: + v->value_int = ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_VALUE_MASK: + v->value_int = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; + break; + case GL_STENCIL_WRITEMASK: + v->value_int = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; + break; + + case GL_NUM_EXTENSIONS: + v->value_int = _mesa_get_extension_count(ctx); + break; + + case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: + v->value_int = _mesa_get_color_read_type(ctx); + break; + case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: + v->value_int = _mesa_get_color_read_format(ctx); + break; + + case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: + v->value_int = ctx->CurrentStack->Depth + 1; + break; + case GL_CURRENT_MATRIX_ARB: + case GL_TRANSPOSE_CURRENT_MATRIX_ARB: + v->value_matrix = ctx->CurrentStack->Top; + break; + + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + v->value_int = _mesa_get_compressed_formats(ctx, NULL, GL_FALSE); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + v->value_int_n.n = + _mesa_get_compressed_formats(ctx, v->value_int_n.ints, GL_FALSE); + ASSERT(v->value_int_n.n <= 100); + break; + + case GL_MAX_VARYING_FLOATS_ARB: + v->value_int = ctx->Const.MaxVarying * 4; + break; + + /* Various object names */ + + case GL_TEXTURE_BINDING_1D: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_1D_ARRAY_EXT: + case GL_TEXTURE_BINDING_2D_ARRAY_EXT: + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + case GL_TEXTURE_BINDING_RECTANGLE_NV: + unit = ctx->Texture.CurrentUnit; + v->value_int = + ctx->Texture.Unit[unit].CurrentTex[d->offset]->Name; + break; + + /* GL_ARB_vertex_buffer_object */ + case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: + case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: + case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: + case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: + case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: + case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: + case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: + buffer_obj = (struct gl_buffer_object *) + ((char *) ctx->Array.ArrayObj + d->offset); + v->value_int = buffer_obj->Name; + break; + case GL_ARRAY_BUFFER_BINDING_ARB: + v->value_int = ctx->Array.ArrayBufferObj->Name; + break; + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: + v->value_int = + ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name; + break; + case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: + v->value_int = ctx->Array.ElementArrayBufferObj->Name; + break; + + case GL_FRAGMENT_PROGRAM_BINDING_NV: + v->value_int = + ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0; + break; + case GL_VERTEX_PROGRAM_BINDING_NV: + v->value_int = + ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0; + break; + case GL_PIXEL_PACK_BUFFER_BINDING_EXT: + v->value_int = ctx->Pack.BufferObj->Name; + break; + case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: + v->value_int = ctx->Unpack.BufferObj->Name; + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + v->value_int = ctx->TransformFeedback.CurrentBuffer->Name; + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED: + v->value_int = ctx->TransformFeedback.CurrentObject->Paused; + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE: + v->value_int = ctx->TransformFeedback.CurrentObject->Active; + break; + case GL_TRANSFORM_FEEDBACK_BINDING: + v->value_int = ctx->TransformFeedback.CurrentObject->Name; + break; + case GL_CURRENT_PROGRAM: + v->value_int = + ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0; + break; + case GL_READ_FRAMEBUFFER_BINDING_EXT: + v->value_int = ctx->ReadBuffer->Name; + break; + case GL_RENDERBUFFER_BINDING_EXT: + v->value_int = + ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; + break; + case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: + v->value_int = ctx->Array.ArrayObj->PointSize.BufferObj->Name; + break; + } +} + +/** + * Check extra constraints on a struct value_desc descriptor + * + * If a struct value_desc has a non-NULL extra pointer, it means that + * there are a number of extra constraints to check or actions to + * perform. The extras is just an integer array where each integer + * encode different constraints or actions. + * + * \param ctx current context + * \param func name of calling glGet*v() function for error reporting + * \param d the struct value_desc that has the extra constraints + * + * \return GL_FALSE if one of the constraints was not satisfied, + * otherwise GL_TRUE. + */ +static GLboolean +check_extra(GLcontext *ctx, const char *func, const struct value_desc *d) +{ + const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor; + int total, enabled; + const int *e; + + total = 0; + enabled = 0; + for (e = d->extra; *e != EXTRA_END; e++) + switch (*e) { + case EXTRA_VERSION_30: + if (version >= 30) { + total++; + enabled++; + } + break; + case EXTRA_VERSION_31: + if (version >= 31) { + total++; + enabled++; + } + break; + case EXTRA_VERSION_32: + if (version >= 32) { + total++; + enabled++; + } + break; + case EXTRA_VERSION_ES2: + if (ctx->API == API_OPENGLES2) { + total++; + enabled++; + } + break; + case EXTRA_NEW_BUFFERS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); + break; + case EXTRA_FLUSH_CURRENT: + FLUSH_CURRENT(ctx, 0); + break; + case EXTRA_VALID_DRAW_BUFFER: + if (d->pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(draw buffer %u)", + func, d->pname - GL_DRAW_BUFFER0_ARB); + return GL_FALSE; + } + break; + case EXTRA_VALID_TEXTURE_UNIT: + if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(texture %u)", + func, ctx->Texture.CurrentUnit); + return GL_FALSE; + } + break; + case EXTRA_END: + break; + default: /* *e is a offset into the extension struct */ + total++; + if (*(GLboolean *) ((char *) &ctx->Extensions + *e)) + enabled++; + break; + } + + if (total > 0 && enabled == 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, + _mesa_lookup_enum_by_nr(d->pname)); + return GL_FALSE; } -/* - * Check if either of four extensions is enabled. + return GL_TRUE; +} + +static const struct value_desc error_value = + { 0, 0, TYPE_INVALID, NO_OFFSET, NO_EXTRA }; + +/** + * Find the struct value_desc corresponding to the enum 'pname'. + * + * We hash the enum value to get an index into the 'table' array, + * which holds the index in the 'values' array of struct value_desc. + * Once we've found the entry, we do the extra checks, if any, then + * look up the value and return a pointer to it. + * + * If the value has to be computed (for example, it's the result of a + * function call or we need to add 1 to it), we use the tmp 'v' to + * store the result. + * + * \param func name of glGet*v() func for error reporting + * \param pname the enum value we're looking up + * \param p is were we return the pointer to the value + * \param v a tmp union value variable in the calling glGet*v() function + * + * \return the struct value_desc corresponding to the enum or a struct + * value_desc of TYPE_INVALID if not found. This lets the calling + * glGet*v() function jump right into a switch statement and + * handle errors there instead of having to check for NULL. */ -#define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4, FUNC) \ - if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \ - !ctx->Extensions.EXT3 && !ctx->Extensions.EXT4) { \ - _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \ - return; \ +static const struct value_desc * +find_value(const char *func, GLenum pname, void **p, union value *v) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *unit; + int mask, hash; + const struct value_desc *d; + + mask = Elements(table) - 1; + hash = (pname * prime_factor); + while (1) { + d = &values[table[hash & mask]]; + if (likely(d->pname == pname)) + break; + + /* If the enum isn't valid, the hash walk ends with index 0, + * which is the API mask entry at the beginning of values[]. */ + if (d->type == TYPE_API_MASK) { + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, + _mesa_lookup_enum_by_nr(pname)); + return &error_value; + } + hash += prime_step; + } + + if (unlikely(d->extra && !check_extra(ctx, func, d))) + return &error_value; + + switch (d->location) { + case LOC_BUFFER: + *p = ((char *) ctx->DrawBuffer + d->offset); + return d; + case LOC_CONTEXT: + *p = ((char *) ctx + d->offset); + return d; + case LOC_ARRAY: + *p = ((char *) ctx->Array.ArrayObj + d->offset); + return d; + case LOC_TEXUNIT: + unit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + *p = ((char *) unit + d->offset); + return d; + case LOC_CUSTOM: + find_custom_value(ctx, d, v); + *p = v; + return d; + default: + assert(0); + break; } + /* silence warning */ + return &error_value; +} + +static const int transpose[] = { + 0, 4, 8, 12, + 1, 5, 9, 13, + 2, 6, 10, 14, + 3, 7, 11, 15 +}; void GLAPIENTRY -_mesa_GetBooleanv( GLenum pname, GLboolean *params ) +_mesa_GetBooleanv(GLenum pname, GLboolean *params) { - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; - if (!params) - return; + d = find_value("glGetBooleanv", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = INT_TO_BOOLEAN(d->offset); + break; - if (ctx->NewState) - _mesa_update_state(ctx); + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[3]); + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[2]); + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[1]); + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = FLOAT_TO_BOOLEAN(((GLfloat *) p)[0]); + break; - if (ctx->Driver.GetBooleanv && - ctx->Driver.GetBooleanv(ctx, pname, params)) - return; + case TYPE_DOUBLEN: + params[0] = FLOAT_TO_BOOLEAN(((GLdouble *) p)[0]); + break; - switch (pname) { - case GL_ACCUM_RED_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumRedBits); - break; - case GL_ACCUM_GREEN_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumGreenBits); - break; - case GL_ACCUM_BLUE_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumBlueBits); - break; - case GL_ACCUM_ALPHA_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.accumAlphaBits); - break; - case GL_ACCUM_CLEAR_VALUE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Accum.ClearColor[3]); - break; - case GL_ALPHA_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaBias); - break; - case GL_ALPHA_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.alphaBits); - break; - case GL_ALPHA_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaScale); - break; - case GL_ALPHA_TEST: - params[0] = ctx->Color.AlphaEnabled; - break; - case GL_ALPHA_TEST_FUNC: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.AlphaFunc); - break; - case GL_ALPHA_TEST_REF: - params[0] = FLOAT_TO_BOOLEAN(ctx->Color.AlphaRef); - break; - case GL_ATTRIB_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->AttribStackDepth); - break; - case GL_AUTO_NORMAL: - params[0] = ctx->Eval.AutoNormal; - break; - case GL_AUX_BUFFERS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.numAuxBuffers); - break; - case GL_BLEND: - params[0] = (ctx->Color.BlendEnabled & 1); - break; - case GL_BLEND_DST: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_SRC_RGB_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_DST_RGB_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC_ALPHA_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendSrcA); - break; - case GL_BLEND_DST_ALPHA_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendDstA); - break; - case GL_BLEND_EQUATION: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationRGB ); - break; - case GL_BLEND_EQUATION_ALPHA_EXT: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.BlendEquationA ); - break; - case GL_BLEND_COLOR_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Color.BlendColor[3]); - break; - case GL_BLUE_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueBias); - break; - case GL_BLUE_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.blueBits); - break; - case GL_BLUE_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueScale); - break; - case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->ClientAttribStackDepth); - break; - case GL_CLIP_PLANE0: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 0) & 1; - break; - case GL_CLIP_PLANE1: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 1) & 1; - break; - case GL_CLIP_PLANE2: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 2) & 1; - break; - case GL_CLIP_PLANE3: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 3) & 1; - break; - case GL_CLIP_PLANE4: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 4) & 1; - break; - case GL_CLIP_PLANE5: - params[0] = (ctx->Transform.ClipPlanesEnabled >> 5) & 1; - break; - case GL_COLOR_CLEAR_VALUE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Color.ClearColor[3]); - break; - case GL_COLOR_MATERIAL: - params[0] = ctx->Light.ColorMaterialEnabled; - break; - case GL_COLOR_MATERIAL_FACE: - params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialFace); - break; - case GL_COLOR_MATERIAL_PARAMETER: - params[0] = ENUM_TO_BOOLEAN(ctx->Light.ColorMaterialMode); - break; - case GL_COLOR_WRITEMASK: - params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[0][RCOMP] ? 1 : 0); - params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[0][GCOMP] ? 1 : 0); - params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[0][BCOMP] ? 1 : 0); - params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[0][ACOMP] ? 1 : 0); - break; - case GL_CULL_FACE: - params[0] = ctx->Polygon.CullFlag; - break; - case GL_CULL_FACE_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.CullFaceMode); - break; - case GL_CURRENT_COLOR: - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); - } - break; - case GL_CURRENT_INDEX: - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); - } - break; - case GL_CURRENT_NORMAL: - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); - } - break; - case GL_CURRENT_RASTER_COLOR: - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[3]); - break; - case GL_CURRENT_RASTER_DISTANCE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterDistance); - break; - case GL_CURRENT_RASTER_INDEX: - params[0] = FLOAT_TO_BOOLEAN(1.0); - break; - case GL_CURRENT_RASTER_POSITION: - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterPos[3]); - break; - case GL_CURRENT_RASTER_SECONDARY_COLOR: - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterSecondaryColor[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterSecondaryColor[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterSecondaryColor[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterSecondaryColor[3]); - break; - case GL_CURRENT_RASTER_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(raster tex coords, unit %u)", unit); - return; - } - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[unit][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[unit][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[unit][2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.RasterTexCoords[unit][3]); - } - break; - case GL_CURRENT_RASTER_POSITION_VALID: - params[0] = ctx->Current.RasterPosValid; - break; - case GL_CURRENT_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(current tex coords, unit %u)", unit); - return; - } - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]); - } - break; - case GL_DEPTH_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthBias); - break; - case GL_DEPTH_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.depthBits); - break; - case GL_DEPTH_CLEAR_VALUE: - params[0] = FLOAT_TO_BOOLEAN(((GLfloat) ctx->Depth.Clear)); - break; - case GL_DEPTH_FUNC: - params[0] = ENUM_TO_BOOLEAN(ctx->Depth.Func); - break; - case GL_DEPTH_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Viewport.Near); - params[1] = FLOAT_TO_BOOLEAN(ctx->Viewport.Far); - break; - case GL_DEPTH_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.DepthScale); - break; - case GL_DEPTH_TEST: - params[0] = ctx->Depth.Test; - break; - case GL_DEPTH_WRITEMASK: - params[0] = ctx->Depth.Mask; - break; - case GL_DITHER: - params[0] = ctx->Color.DitherFlag; - break; - case GL_DOUBLEBUFFER: - params[0] = ctx->DrawBuffer->Visual.doubleBufferMode; - break; - case GL_DRAW_BUFFER: - params[0] = ENUM_TO_BOOLEAN(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_EDGE_FLAG: - { - FLUSH_CURRENT(ctx, 0); - params[0] = (ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0); - } - break; - case GL_FEEDBACK_BUFFER_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Feedback.BufferSize); - break; - case GL_FEEDBACK_BUFFER_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Feedback.Type); - break; - case GL_FOG: - params[0] = ctx->Fog.Enabled; - break; - case GL_FOG_COLOR: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Fog.Color[3]); - break; - case GL_FOG_DENSITY: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Density); - break; - case GL_FOG_END: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.End); - break; - case GL_FOG_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.Fog); - break; - case GL_FOG_INDEX: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Index); - break; - case GL_FOG_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Fog.Mode); - break; - case GL_FOG_START: - params[0] = FLOAT_TO_BOOLEAN(ctx->Fog.Start); - break; - case GL_FRONT_FACE: - params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontFace); - break; - case GL_GREEN_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenBias); - break; - case GL_GREEN_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.greenBits); - break; - case GL_GREEN_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenScale); - break; - case GL_INDEX_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.indexBits); - break; - case GL_INDEX_CLEAR_VALUE: - params[0] = INT_TO_BOOLEAN(ctx->Color.ClearIndex); - break; - case GL_INDEX_MODE: - params[0] = GL_FALSE; - break; - case GL_INDEX_OFFSET: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexOffset); - break; - case GL_INDEX_SHIFT: - params[0] = INT_TO_BOOLEAN(ctx->Pixel.IndexShift); - break; - case GL_INDEX_WRITEMASK: - params[0] = INT_TO_BOOLEAN(ctx->Color.IndexMask); - break; - case GL_LIGHT0: - params[0] = ctx->Light.Light[0].Enabled; - break; - case GL_LIGHT1: - params[0] = ctx->Light.Light[1].Enabled; - break; - case GL_LIGHT2: - params[0] = ctx->Light.Light[2].Enabled; - break; - case GL_LIGHT3: - params[0] = ctx->Light.Light[3].Enabled; - break; - case GL_LIGHT4: - params[0] = ctx->Light.Light[4].Enabled; - break; - case GL_LIGHT5: - params[0] = ctx->Light.Light[5].Enabled; - break; - case GL_LIGHT6: - params[0] = ctx->Light.Light[6].Enabled; - break; - case GL_LIGHT7: - params[0] = ctx->Light.Light[7].Enabled; - break; - case GL_LIGHTING: - params[0] = ctx->Light.Enabled; - break; - case GL_LIGHT_MODEL_AMBIENT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Light.Model.Ambient[3]); - break; - case GL_LIGHT_MODEL_COLOR_CONTROL: - params[0] = ENUM_TO_BOOLEAN(ctx->Light.Model.ColorControl); - break; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - params[0] = ctx->Light.Model.LocalViewer; - break; - case GL_LIGHT_MODEL_TWO_SIDE: - params[0] = ctx->Light.Model.TwoSide; - break; - case GL_LINE_SMOOTH: - params[0] = ctx->Line.SmoothFlag; - break; - case GL_LINE_SMOOTH_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.LineSmooth); - break; - case GL_LINE_STIPPLE: - params[0] = ctx->Line.StippleFlag; - break; - case GL_LINE_STIPPLE_PATTERN: - params[0] = INT_TO_BOOLEAN(ctx->Line.StipplePattern); - break; - case GL_LINE_STIPPLE_REPEAT: - params[0] = INT_TO_BOOLEAN(ctx->Line.StippleFactor); - break; - case GL_LINE_WIDTH: - params[0] = FLOAT_TO_BOOLEAN(ctx->Line.Width); - break; - case GL_LINE_WIDTH_GRANULARITY: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.LineWidthGranularity); - break; - case GL_LINE_WIDTH_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidthAA); - params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidthAA); - break; - case GL_ALIASED_LINE_WIDTH_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinLineWidth); - params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxLineWidth); - break; - case GL_LIST_BASE: - params[0] = INT_TO_BOOLEAN(ctx->List.ListBase); - break; - case GL_LIST_INDEX: - params[0] = INT_TO_BOOLEAN((ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)); - break; - case GL_LIST_MODE: - { - GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE; - params[0] = ENUM_TO_BOOLEAN(mode); - } - break; - case GL_INDEX_LOGIC_OP: - params[0] = ctx->Color.IndexLogicOpEnabled; - break; - case GL_COLOR_LOGIC_OP: - params[0] = ctx->Color.ColorLogicOpEnabled; - break; - case GL_LOGIC_OP_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Color.LogicOp); - break; - case GL_MAP1_COLOR_4: - params[0] = ctx->Eval.Map1Color4; - break; - case GL_MAP1_GRID_DOMAIN: - params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u1); - params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid1u2); - break; - case GL_MAP1_GRID_SEGMENTS: - params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid1un); - break; - case GL_MAP1_INDEX: - params[0] = ctx->Eval.Map1Index; - break; - case GL_MAP1_NORMAL: - params[0] = ctx->Eval.Map1Normal; - break; - case GL_MAP1_TEXTURE_COORD_1: - params[0] = ctx->Eval.Map1TextureCoord1; - break; - case GL_MAP1_TEXTURE_COORD_2: - params[0] = ctx->Eval.Map1TextureCoord2; - break; - case GL_MAP1_TEXTURE_COORD_3: - params[0] = ctx->Eval.Map1TextureCoord3; - break; - case GL_MAP1_TEXTURE_COORD_4: - params[0] = ctx->Eval.Map1TextureCoord4; - break; - case GL_MAP1_VERTEX_3: - params[0] = ctx->Eval.Map1Vertex3; - break; - case GL_MAP1_VERTEX_4: - params[0] = ctx->Eval.Map1Vertex4; - break; - case GL_MAP2_COLOR_4: - params[0] = ctx->Eval.Map2Color4; - break; - case GL_MAP2_GRID_DOMAIN: - params[0] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u1); - params[1] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2u2); - params[2] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v1); - params[3] = FLOAT_TO_BOOLEAN(ctx->Eval.MapGrid2v2); - break; - case GL_MAP2_GRID_SEGMENTS: - params[0] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2un); - params[1] = INT_TO_BOOLEAN(ctx->Eval.MapGrid2vn); - break; - case GL_MAP2_INDEX: - params[0] = ctx->Eval.Map2Index; - break; - case GL_MAP2_NORMAL: - params[0] = ctx->Eval.Map2Normal; - break; - case GL_MAP2_TEXTURE_COORD_1: - params[0] = ctx->Eval.Map2TextureCoord1; - break; - case GL_MAP2_TEXTURE_COORD_2: - params[0] = ctx->Eval.Map2TextureCoord2; - break; - case GL_MAP2_TEXTURE_COORD_3: - params[0] = ctx->Eval.Map2TextureCoord3; - break; - case GL_MAP2_TEXTURE_COORD_4: - params[0] = ctx->Eval.Map2TextureCoord4; - break; - case GL_MAP2_VERTEX_3: - params[0] = ctx->Eval.Map2Vertex3; - break; - case GL_MAP2_VERTEX_4: - params[0] = ctx->Eval.Map2Vertex4; - break; - case GL_MAP_COLOR: - params[0] = ctx->Pixel.MapColorFlag; - break; - case GL_MAP_STENCIL: - params[0] = ctx->Pixel.MapStencilFlag; - break; - case GL_MATRIX_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Transform.MatrixMode); - break; - case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_CLIENT_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIP_PLANES: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxClipPlanes); - break; - case GL_MAX_ELEMENTS_VERTICES: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_ELEMENTS_INDICES: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_EVAL_ORDER: - params[0] = INT_TO_BOOLEAN(MAX_EVAL_ORDER); - break; - case GL_MAX_LIGHTS: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxLights); - break; - case GL_MAX_LIST_NESTING: - params[0] = INT_TO_BOOLEAN(MAX_LIST_NESTING); - break; - case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_MODELVIEW_STACK_DEPTH); - break; - case GL_MAX_NAME_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_NAME_STACK_DEPTH); - break; - case GL_MAX_PIXEL_MAP_TABLE: - params[0] = INT_TO_BOOLEAN(MAX_PIXEL_MAP_TABLE); - break; - case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_PROJECTION_STACK_DEPTH); - break; - case GL_MAX_TEXTURE_SIZE: - params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.MaxTextureLevels - 1)); - break; - case GL_MAX_3D_TEXTURE_SIZE: - params[0] = INT_TO_BOOLEAN(1 << (ctx->Const.Max3DTextureLevels - 1)); - break; - case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(MAX_TEXTURE_STACK_DEPTH); - break; - case GL_MAX_VIEWPORT_DIMS: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxViewportWidth); - params[1] = INT_TO_BOOLEAN(ctx->Const.MaxViewportHeight); - break; - case GL_MODELVIEW_MATRIX: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_MODELVIEW_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->ModelviewMatrixStack.Depth + 1); - break; - case GL_NAME_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->Select.NameStackDepth); - break; - case GL_NORMALIZE: - params[0] = ctx->Transform.Normalize; - break; - case GL_PACK_ALIGNMENT: - params[0] = INT_TO_BOOLEAN(ctx->Pack.Alignment); - break; - case GL_PACK_LSB_FIRST: - params[0] = ctx->Pack.LsbFirst; - break; - case GL_PACK_ROW_LENGTH: - params[0] = INT_TO_BOOLEAN(ctx->Pack.RowLength); - break; - case GL_PACK_SKIP_PIXELS: - params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipPixels); - break; - case GL_PACK_SKIP_ROWS: - params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipRows); - break; - case GL_PACK_SWAP_BYTES: - params[0] = ctx->Pack.SwapBytes; - break; - case GL_PACK_SKIP_IMAGES_EXT: - params[0] = INT_TO_BOOLEAN(ctx->Pack.SkipImages); - break; - case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = INT_TO_BOOLEAN(ctx->Pack.ImageHeight); - break; - case GL_PACK_INVERT_MESA: - params[0] = ctx->Pack.Invert; - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PerspectiveCorrection); - break; - case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.AtoA.Size); - break; - case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.BtoB.Size); - break; - case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.GtoG.Size); - break; - case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoA.Size); - break; - case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoB.Size); - break; - case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoG.Size); - break; - case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoI.Size); - break; - case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoR.Size); - break; - case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.RtoR.Size); - break; - case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.StoS.Size); - break; - case GL_POINT_SIZE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Size); - break; - case GL_POINT_SIZE_GRANULARITY: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.PointSizeGranularity); - break; - case GL_POINT_SIZE_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSizeAA); - params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSizeAA); - break; - case GL_ALIASED_POINT_SIZE_RANGE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MinPointSize); - params[1] = FLOAT_TO_BOOLEAN(ctx->Const.MaxPointSize); - break; - case GL_POINT_SMOOTH: - params[0] = ctx->Point.SmoothFlag; - break; - case GL_POINT_SMOOTH_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PointSmooth); - break; - case GL_POINT_SIZE_MIN_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MinSize); - break; - case GL_POINT_SIZE_MAX_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.MaxSize); - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Threshold); - break; - case GL_DISTANCE_ATTENUATION_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Params[0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Point.Params[1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Point.Params[2]); - break; - case GL_POLYGON_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.FrontMode); - params[1] = ENUM_TO_BOOLEAN(ctx->Polygon.BackMode); - break; - case GL_POLYGON_OFFSET_BIAS_EXT: - params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits); - break; - case GL_POLYGON_OFFSET_FACTOR: - params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetFactor ); - break; - case GL_POLYGON_OFFSET_UNITS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Polygon.OffsetUnits ); - break; - case GL_POLYGON_OFFSET_POINT: - params[0] = ctx->Polygon.OffsetPoint; - break; - case GL_POLYGON_OFFSET_LINE: - params[0] = ctx->Polygon.OffsetLine; - break; - case GL_POLYGON_OFFSET_FILL: - params[0] = ctx->Polygon.OffsetFill; - break; - case GL_POLYGON_SMOOTH: - params[0] = ctx->Polygon.SmoothFlag; - break; - case GL_POLYGON_SMOOTH_HINT: - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PolygonSmooth); - break; - case GL_POLYGON_STIPPLE: - params[0] = ctx->Polygon.StippleFlag; - break; - case GL_PROJECTION_MATRIX: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_PROJECTION_STACK_DEPTH: - params[0] = INT_TO_BOOLEAN(ctx->ProjectionMatrixStack.Depth + 1); - break; - case GL_READ_BUFFER: - params[0] = ENUM_TO_BOOLEAN(ctx->ReadBuffer->ColorReadBuffer); - break; - case GL_RED_BIAS: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias); - break; - case GL_RED_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.redBits); - break; - case GL_RED_SCALE: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedScale); - break; - case GL_RENDER_MODE: - params[0] = ENUM_TO_BOOLEAN(ctx->RenderMode); - break; - case GL_RESCALE_NORMAL: - params[0] = ctx->Transform.RescaleNormals; - break; - case GL_RGBA_MODE: - params[0] = GL_TRUE; - break; - case GL_SCISSOR_BOX: - params[0] = INT_TO_BOOLEAN(ctx->Scissor.X); - params[1] = INT_TO_BOOLEAN(ctx->Scissor.Y); - params[2] = INT_TO_BOOLEAN(ctx->Scissor.Width); - params[3] = INT_TO_BOOLEAN(ctx->Scissor.Height); - break; - case GL_SCISSOR_TEST: - params[0] = ctx->Scissor.Enabled; - break; - case GL_SELECTION_BUFFER_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Select.BufferSize); - break; - case GL_SHADE_MODEL: - params[0] = ENUM_TO_BOOLEAN(ctx->Light.ShadeModel); - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - params[0] = ctx->Texture.SharedPalette; - break; - case GL_STENCIL_BITS: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.stencilBits); - break; - case GL_STENCIL_CLEAR_VALUE: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.Clear); - break; - case GL_STENCIL_FAIL: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_FUNC: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_PASS: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_REF: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_TEST: - params[0] = ctx->Stencil.Enabled; - break; - case GL_STENCIL_VALUE_MASK: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_WRITEMASK: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); - break; - case GL_STEREO: - params[0] = ctx->DrawBuffer->Visual.stereoMode; - break; - case GL_SUBPIXEL_BITS: - params[0] = INT_TO_BOOLEAN(ctx->Const.SubPixelBits); - break; - case GL_TEXTURE_1D: - params[0] = _mesa_IsEnabled(GL_TEXTURE_1D); - break; - case GL_TEXTURE_2D: - params[0] = _mesa_IsEnabled(GL_TEXTURE_2D); - break; - case GL_TEXTURE_3D: - params[0] = _mesa_IsEnabled(GL_TEXTURE_3D); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetBooleanv"); - params[0] = _mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetBooleanv"); - params[0] = _mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT); - break; - case GL_TEXTURE_BINDING_1D: - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D: - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_3D: - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); - break; - case GL_TEXTURE_GEN_S: - params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0); - break; - case GL_TEXTURE_GEN_T: - params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0); - break; - case GL_TEXTURE_GEN_R: - params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0); - break; - case GL_TEXTURE_GEN_Q: - params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0); - break; - case GL_TEXTURE_MATRIX: - { - const GLfloat *matrix; - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)", - unit); - return; - } - matrix = ctx->TextureMatrixStack[unit].Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TEXTURE_STACK_DEPTH: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(texture stack depth, unit %u)", unit); - return; - } - params[0] = INT_TO_BOOLEAN(ctx->TextureMatrixStack[unit].Depth + 1); - } - break; - case GL_UNPACK_ALIGNMENT: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.Alignment); - break; - case GL_UNPACK_LSB_FIRST: - params[0] = ctx->Unpack.LsbFirst; - break; - case GL_UNPACK_ROW_LENGTH: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.RowLength); - break; - case GL_UNPACK_SKIP_PIXELS: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipPixels); - break; - case GL_UNPACK_SKIP_ROWS: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipRows); - break; - case GL_UNPACK_SWAP_BYTES: - params[0] = ctx->Unpack.SwapBytes; - break; - case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.SkipImages); - break; - case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = INT_TO_BOOLEAN(ctx->Unpack.ImageHeight); - break; - case GL_UNPACK_CLIENT_STORAGE_APPLE: - params[0] = ctx->Unpack.ClientStorage; - break; - case GL_VIEWPORT: - params[0] = INT_TO_BOOLEAN(ctx->Viewport.X); - params[1] = INT_TO_BOOLEAN(ctx->Viewport.Y); - params[2] = INT_TO_BOOLEAN(ctx->Viewport.Width); - params[3] = INT_TO_BOOLEAN(ctx->Viewport.Height); - break; - case GL_ZOOM_X: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomX); - break; - case GL_ZOOM_Y: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.ZoomY); - break; - case GL_VERTEX_ARRAY: - params[0] = ctx->Array.ArrayObj->Vertex.Enabled; - break; - case GL_VERTEX_ARRAY_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Vertex.Size); - break; - case GL_VERTEX_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Vertex.Type); - break; - case GL_VERTEX_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Vertex.Stride); - break; - case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_NORMAL_ARRAY: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Normal.Enabled); - break; - case GL_NORMAL_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Normal.Type); - break; - case GL_NORMAL_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Normal.Stride); - break; - case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_COLOR_ARRAY: - params[0] = ctx->Array.ArrayObj->Color.Enabled; - break; - case GL_COLOR_ARRAY_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Color.Size); - break; - case GL_COLOR_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Color.Type); - break; - case GL_COLOR_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Color.Stride); - break; - case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_INDEX_ARRAY: - params[0] = ctx->Array.ArrayObj->Index.Enabled; - break; - case GL_INDEX_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->Index.Type); - break; - case GL_INDEX_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Index.Stride); - break; - case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_TEXTURE_COORD_ARRAY: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled; - break; - case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size); - break; - case GL_TEXTURE_COORD_ARRAY_TYPE: - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); - break; - case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride); - break; - case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_EDGE_FLAG_ARRAY: - params[0] = ctx->Array.ArrayObj->EdgeFlag.Enabled; - break; - case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->EdgeFlag.Stride); - break; - case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = INT_TO_BOOLEAN(0); - break; - case GL_MAX_TEXTURE_UNITS_ARB: - CHECK_EXT1(ARB_multitexture, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureUnits); - break; - case GL_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); - break; - case GL_CLIENT_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); - break; - case GL_TEXTURE_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetBooleanv"); - params[0] = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); - break; - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); - break; - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN((1 << (ctx->Const.MaxCubeTextureLevels - 1))); - break; - case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Hint.TextureCompression); - break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = INT_TO_BOOLEAN(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)); - break; - case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - { - GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = ENUM_TO_BOOLEAN(formats[i]); - } - break; - case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: - CHECK_EXT1(EXT_compiled_vertex_array, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Array.LockFirst); - break; - case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: - CHECK_EXT1(EXT_compiled_vertex_array, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Array.LockCount); - break; - case GL_TRANSPOSE_COLOR_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - { - const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_COLOR_MATRIX_SGI: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = INT_TO_BOOLEAN(ctx->ColorMatrixStack.Depth + 1); - break; - case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = INT_TO_BOOLEAN(MAX_COLOR_STACK_DEPTH); - break; - case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixScale[3]); - break; - case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostColorMatrixBias[3]); - break; - case GL_CONVOLUTION_1D_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = ctx->Pixel.Convolution1DEnabled; - break; - case GL_CONVOLUTION_2D_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = ctx->Pixel.Convolution2DEnabled; - break; - case GL_SEPARABLE_2D_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = ctx->Pixel.Separable2DEnabled; - break; - case GL_POST_CONVOLUTION_RED_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[0]); - break; - case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[1]); - break; - case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionScale[3]); - break; - case GL_POST_CONVOLUTION_RED_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[0]); - break; - case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[1]); - break; - case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.PostConvolutionBias[3]); - break; - case GL_HISTOGRAM: - CHECK_EXT1(EXT_histogram, "GetBooleanv"); - params[0] = ctx->Pixel.HistogramEnabled; - break; - case GL_MINMAX: - CHECK_EXT1(EXT_histogram, "GetBooleanv"); - params[0] = ctx->Pixel.MinMaxEnabled; - break; - case GL_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetBooleanv"); - params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]; - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetBooleanv"); - params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]; - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetBooleanv"); - params[0] = ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]; - break; - case GL_TEXTURE_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_texture_color_table, "GetBooleanv"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled; - break; - case GL_COLOR_SUM_EXT: - CHECK_EXT2(EXT_secondary_color, ARB_vertex_program, "GetBooleanv"); - params[0] = ctx->Fog.ColorSumEnabled; - break; - case GL_CURRENT_SECONDARY_COLOR_EXT: - CHECK_EXT1(EXT_secondary_color, "GetBooleanv"); - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); - params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); - params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); - params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); - } - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - CHECK_EXT1(EXT_secondary_color, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Enabled; - break; - case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetBooleanv"); - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->SecondaryColor.Type); - break; - case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->SecondaryColor.Stride); - break; - case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->SecondaryColor.Size); - break; - case GL_CURRENT_FOG_COORDINATE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetBooleanv"); - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); - } - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - CHECK_EXT1(EXT_fog_coord, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->FogCoord.Enabled; - break; - case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetBooleanv"); - params[0] = ENUM_TO_BOOLEAN(ctx->Array.ArrayObj->FogCoord.Type); - break; - case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->FogCoord.Stride); - break; - case GL_FOG_COORDINATE_SOURCE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetBooleanv"); - params[0] = ENUM_TO_BOOLEAN(ctx->Fog.FogCoordinateSource); - break; - case GL_MAX_TEXTURE_LOD_BIAS_EXT: - CHECK_EXT1(EXT_texture_lod_bias, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureLodBias); - break; - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - CHECK_EXT1(EXT_texture_filter_anisotropic, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxTextureMaxAnisotropy); - break; - case GL_MULTISAMPLE_ARB: - params[0] = ctx->Multisample.Enabled; - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - params[0] = ctx->Multisample.SampleAlphaToCoverage; - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - params[0] = ctx->Multisample.SampleAlphaToOne; - break; - case GL_SAMPLE_COVERAGE_ARB: - params[0] = ctx->Multisample.SampleCoverage; - break; - case GL_SAMPLE_COVERAGE_VALUE_ARB: - params[0] = FLOAT_TO_BOOLEAN(ctx->Multisample.SampleCoverageValue); - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - params[0] = ctx->Multisample.SampleCoverageInvert; - break; - case GL_SAMPLE_BUFFERS_ARB: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.sampleBuffers); - break; - case GL_SAMPLES_ARB: - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.samples); - break; - case GL_RASTER_POSITION_UNCLIPPED_IBM: - CHECK_EXT1(IBM_rasterpos_clip, "GetBooleanv"); - params[0] = ctx->Transform.RasterPositionUnclipped; - break; - case GL_POINT_SPRITE_NV: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetBooleanv"); - params[0] = ctx->Point.PointSprite; - break; - case GL_POINT_SPRITE_R_MODE_NV: - CHECK_EXT1(NV_point_sprite, "GetBooleanv"); - params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteRMode); - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetBooleanv"); - params[0] = ENUM_TO_BOOLEAN(ctx->Point.SpriteOrigin); - break; - case GL_GENERATE_MIPMAP_HINT_SGIS: - CHECK_EXT1(SGIS_generate_mipmap, "GetBooleanv"); - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.GenerateMipmap); - break; - case GL_VERTEX_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); - break; - case GL_VERTEX_ATTRIB_ARRAY0_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[0].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY1_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[1].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY2_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[2].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY3_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[3].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[4].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY5_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[5].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY6_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[6].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY7_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[7].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY8_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[8].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY9_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[9].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY10_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[10].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY11_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[11].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY12_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[12].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY13_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[13].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY14_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[14].Enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Array.ArrayObj->VertexAttrib[15].Enabled; - break; - case GL_MAP1_VERTEX_ATTRIB0_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[0]; - break; - case GL_MAP1_VERTEX_ATTRIB1_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[1]; - break; - case GL_MAP1_VERTEX_ATTRIB2_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[2]; - break; - case GL_MAP1_VERTEX_ATTRIB3_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[3]; - break; - case GL_MAP1_VERTEX_ATTRIB4_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[4]; - break; - case GL_MAP1_VERTEX_ATTRIB5_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[5]; - break; - case GL_MAP1_VERTEX_ATTRIB6_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[6]; - break; - case GL_MAP1_VERTEX_ATTRIB7_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[7]; - break; - case GL_MAP1_VERTEX_ATTRIB8_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[8]; - break; - case GL_MAP1_VERTEX_ATTRIB9_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[9]; - break; - case GL_MAP1_VERTEX_ATTRIB10_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[10]; - break; - case GL_MAP1_VERTEX_ATTRIB11_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[11]; - break; - case GL_MAP1_VERTEX_ATTRIB12_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[12]; - break; - case GL_MAP1_VERTEX_ATTRIB13_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[13]; - break; - case GL_MAP1_VERTEX_ATTRIB14_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[14]; - break; - case GL_MAP1_VERTEX_ATTRIB15_4_NV: - CHECK_EXT1(NV_vertex_program, "GetBooleanv"); - params[0] = ctx->Eval.Map1Attrib[15]; - break; - case GL_FRAGMENT_PROGRAM_NV: - CHECK_EXT1(NV_fragment_program, "GetBooleanv"); - params[0] = ctx->FragmentProgram.Enabled; - break; - case GL_FRAGMENT_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_fragment_program, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); - break; - case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: - CHECK_EXT1(NV_fragment_program, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(MAX_NV_FRAGMENT_PROGRAM_PARAMS); - break; - case GL_TEXTURE_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetBooleanv"); - params[0] = _mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV); - break; - case GL_TEXTURE_BINDING_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); - break; - case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureRectSize); - break; - case GL_STENCIL_TEST_TWO_SIDE_EXT: - CHECK_EXT1(EXT_stencil_two_side, "GetBooleanv"); - params[0] = ctx->Stencil.TestTwoSide; - break; - case GL_ACTIVE_STENCIL_FACE_EXT: - CHECK_EXT1(EXT_stencil_two_side, "GetBooleanv"); - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); - break; - case GL_MAX_SHININESS_NV: - CHECK_EXT1(NV_light_max_exponent, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxShininess); - break; - case GL_MAX_SPOT_EXPONENT_NV: - CHECK_EXT1(NV_light_max_exponent, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Const.MaxSpotExponent); - break; - case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayBufferObj->Name); - break; - case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Vertex.BufferObj->Name); - break; - case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Normal.BufferObj->Name); - break; - case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Color.BufferObj->Name); - break; - case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Index.BufferObj->Name); - break; - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); - break; - case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name); - break; - case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name); - break; - case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->FogCoord.BufferObj->Name); - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Array.ElementArrayBufferObj->Name); - break; - case GL_PIXEL_PACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Pack.BufferObj->Name); - break; - case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Unpack.BufferObj->Name); - break; - case GL_VERTEX_PROGRAM_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetBooleanv"); - params[0] = ctx->VertexProgram.Enabled; - break; - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetBooleanv"); - params[0] = ctx->VertexProgram.PointSizeEnabled; - break; - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetBooleanv"); - params[0] = ctx->VertexProgram.TwoSideEnabled; - break; - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrixStackDepth); - break; - case GL_MAX_PROGRAM_MATRICES_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxProgramMatrices); - break; - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetBooleanv"); - params[0] = ctx->CurrentStack->Depth + 1; - break; - case GL_CURRENT_MATRIX_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_fragment_program, "GetBooleanv"); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[1]); - params[2] = FLOAT_TO_BOOLEAN(matrix[2]); - params[3] = FLOAT_TO_BOOLEAN(matrix[3]); - params[4] = FLOAT_TO_BOOLEAN(matrix[4]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[6]); - params[7] = FLOAT_TO_BOOLEAN(matrix[7]); - params[8] = FLOAT_TO_BOOLEAN(matrix[8]); - params[9] = FLOAT_TO_BOOLEAN(matrix[9]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[11]); - params[12] = FLOAT_TO_BOOLEAN(matrix[12]); - params[13] = FLOAT_TO_BOOLEAN(matrix[13]); - params[14] = FLOAT_TO_BOOLEAN(matrix[14]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - CHECK_EXT2(ARB_vertex_program, ARB_fragment_program, "GetBooleanv"); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = FLOAT_TO_BOOLEAN(matrix[0]); - params[1] = FLOAT_TO_BOOLEAN(matrix[4]); - params[2] = FLOAT_TO_BOOLEAN(matrix[8]); - params[3] = FLOAT_TO_BOOLEAN(matrix[12]); - params[4] = FLOAT_TO_BOOLEAN(matrix[1]); - params[5] = FLOAT_TO_BOOLEAN(matrix[5]); - params[6] = FLOAT_TO_BOOLEAN(matrix[9]); - params[7] = FLOAT_TO_BOOLEAN(matrix[13]); - params[8] = FLOAT_TO_BOOLEAN(matrix[2]); - params[9] = FLOAT_TO_BOOLEAN(matrix[6]); - params[10] = FLOAT_TO_BOOLEAN(matrix[10]); - params[11] = FLOAT_TO_BOOLEAN(matrix[14]); - params[12] = FLOAT_TO_BOOLEAN(matrix[3]); - params[13] = FLOAT_TO_BOOLEAN(matrix[7]); - params[14] = FLOAT_TO_BOOLEAN(matrix[11]); - params[15] = FLOAT_TO_BOOLEAN(matrix[15]); - } - break; - case GL_MAX_VERTEX_ATTRIBS_ARB: - CHECK_EXT1(ARB_vertex_program, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.VertexProgram.MaxAttribs); - break; - case GL_PROGRAM_ERROR_POSITION_ARB: - CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Program.ErrorPos); - break; - case GL_FRAGMENT_PROGRAM_ARB: - CHECK_EXT1(ARB_fragment_program, "GetBooleanv"); - params[0] = ctx->FragmentProgram.Enabled; - break; - case GL_MAX_TEXTURE_COORDS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureCoordUnits); - break; - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTextureImageUnits); - break; - case GL_DEPTH_BOUNDS_TEST_EXT: - CHECK_EXT1(EXT_depth_bounds_test, "GetBooleanv"); - params[0] = ctx->Depth.BoundsTest; - break; - case GL_DEPTH_BOUNDS_EXT: - CHECK_EXT1(EXT_depth_bounds_test, "GetBooleanv"); - params[0] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMin); - params[1] = FLOAT_TO_BOOLEAN(ctx->Depth.BoundsMax); - break; - case GL_DEPTH_CLAMP: - CHECK_EXT1(ARB_depth_clamp, "GetBooleanv"); - params[0] = ctx->Transform.DepthClamp; - break; - case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxDrawBuffers); - break; - case GL_DRAW_BUFFER0_ARB: - params[0] = ENUM_TO_BOOLEAN(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_DRAW_BUFFER1_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[1]; - params[0] = ENUM_TO_BOOLEAN(buffer); - } - break; - case GL_DRAW_BUFFER2_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[2]; - params[0] = ENUM_TO_BOOLEAN(buffer); - } - break; - case GL_DRAW_BUFFER3_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[3]; - params[0] = ENUM_TO_BOOLEAN(buffer); - } - break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - CHECK_EXT1(OES_read_format, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_type(ctx)); - break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - CHECK_EXT1(OES_read_format, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_format(ctx)); - break; - case GL_NUM_FRAGMENT_REGISTERS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(6); - break; - case GL_NUM_FRAGMENT_CONSTANTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(8); - break; - case GL_NUM_PASSES_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(2); - break; - case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(8); - break; - case GL_NUM_INSTRUCTIONS_TOTAL_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(16); - break; - case GL_COLOR_ALPHA_PAIRING_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); - params[0] = GL_TRUE; - break; - case GL_NUM_LOOPBACK_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(3); - break; - case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(3); - break; - case GL_STENCIL_BACK_FUNC: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.Function[1]); - break; - case GL_STENCIL_BACK_VALUE_MASK: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.ValueMask[1]); - break; - case GL_STENCIL_BACK_WRITEMASK: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.WriteMask[1]); - break; - case GL_STENCIL_BACK_REF: - params[0] = INT_TO_BOOLEAN(ctx->Stencil.Ref[1]); - break; - case GL_STENCIL_BACK_FAIL: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.FailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZFailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: - params[0] = ENUM_TO_BOOLEAN(ctx->Stencil.ZPassFunc[1]); - break; - case GL_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Name); - break; - case GL_RENDERBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); - break; - case GL_MAX_COLOR_ATTACHMENTS_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxColorAttachments); - break; - case GL_MAX_RENDERBUFFER_SIZE_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxRenderbufferSize); - break; - case GL_READ_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_blit, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->ReadBuffer->Name); - break; - case GL_PROVOKING_VERTEX_EXT: - CHECK_EXT1(EXT_provoking_vertex, "GetBooleanv"); - params[0] = ctx->Light.ProvokingVertex; - break; - case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: - CHECK_EXT1(EXT_provoking_vertex, "GetBooleanv"); - params[0] = ctx->Const.QuadsFollowProvokingVertexConvention; - break; - case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_fragment_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.FragmentProgram.MaxUniformComponents); - break; - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: - CHECK_EXT1(ARB_fragment_shader, "GetBooleanv"); - params[0] = ENUM_TO_BOOLEAN(ctx->Hint.FragmentShaderDerivative); - break; - case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.VertexProgram.MaxUniformComponents); - break; - case GL_MAX_VARYING_FLOATS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVarying * 4); - break; - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxVertexTextureImageUnits); - break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxCombinedTextureImageUnits); - break; - case GL_CURRENT_PROGRAM: - CHECK_EXT1(ARB_shader_objects, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); - break; - case GL_MAX_SAMPLES: - CHECK_EXT1(ARB_framebuffer_object, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.MaxSamples); - break; - case GL_VERTEX_ARRAY_BINDING_APPLE: - CHECK_EXT1(APPLE_vertex_array_object, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Name); - break; - case GL_TEXTURE_CUBE_MAP_SEAMLESS: - CHECK_EXT1(ARB_seamless_cube_map, "GetBooleanv"); - params[0] = ctx->Texture.CubeMapSeamless; - break; - case GL_MAX_SERVER_WAIT_TIMEOUT: - CHECK_EXT1(ARB_sync, "GetBooleanv"); - params[0] = INT64_TO_BOOLEAN(ctx->Const.MaxServerWaitTimeout); - break; - case GL_NUM_EXTENSIONS: - params[0] = INT_TO_BOOLEAN(_mesa_get_extension_count(ctx)); - break; - case GL_MAJOR_VERSION: - params[0] = INT_TO_BOOLEAN(ctx->VersionMajor); - break; - case GL_MINOR_VERSION: - params[0] = INT_TO_BOOLEAN(ctx->VersionMinor); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); + case TYPE_INT_4: + params[3] = INT_TO_BOOLEAN(((GLint *) p)[3]); + case TYPE_INT_3: + params[2] = INT_TO_BOOLEAN(((GLint *) p)[2]); + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = INT_TO_BOOLEAN(((GLint *) p)[1]); + case TYPE_INT: + case TYPE_ENUM: + params[0] = INT_TO_BOOLEAN(((GLint *) p)[0]); + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_BOOLEAN(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = INT64_TO_BOOLEAN(((GLint64 *) p)[0]); + break; + + case TYPE_BOOLEAN: + params[0] = ((GLboolean*) p)[0]; + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_BOOLEAN(m->m[i]); + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_BOOLEAN(m->m[transpose[i]]); + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = (*(GLbitfield *) p >> shift) & 1; + break; } } void GLAPIENTRY -_mesa_GetFloatv( GLenum pname, GLfloat *params ) +_mesa_GetFloatv(GLenum pname, GLfloat *params) { - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; - if (!params) - return; + d = find_value("glGetFloatv", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = (GLfloat) d->offset; + break; - if (ctx->NewState) - _mesa_update_state(ctx); + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = ((GLfloat *) p)[3]; + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = ((GLfloat *) p)[2]; + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = ((GLfloat *) p)[1]; + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = ((GLfloat *) p)[0]; + break; - if (ctx->Driver.GetFloatv && - ctx->Driver.GetFloatv(ctx, pname, params)) - return; + case TYPE_DOUBLEN: + params[0] = ((GLdouble *) p)[0]; + break; - switch (pname) { - case GL_ACCUM_RED_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumRedBits); - break; - case GL_ACCUM_GREEN_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumGreenBits); - break; - case GL_ACCUM_BLUE_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumBlueBits); - break; - case GL_ACCUM_ALPHA_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.accumAlphaBits); - break; - case GL_ACCUM_CLEAR_VALUE: - params[0] = ctx->Accum.ClearColor[0]; - params[1] = ctx->Accum.ClearColor[1]; - params[2] = ctx->Accum.ClearColor[2]; - params[3] = ctx->Accum.ClearColor[3]; - break; - case GL_ALPHA_BIAS: - params[0] = ctx->Pixel.AlphaBias; - break; - case GL_ALPHA_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.alphaBits); - break; - case GL_ALPHA_SCALE: - params[0] = ctx->Pixel.AlphaScale; - break; - case GL_ALPHA_TEST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Color.AlphaEnabled); - break; - case GL_ALPHA_TEST_FUNC: - params[0] = ENUM_TO_FLOAT(ctx->Color.AlphaFunc); - break; - case GL_ALPHA_TEST_REF: - params[0] = ctx->Color.AlphaRef; - break; - case GL_ATTRIB_STACK_DEPTH: - params[0] = (GLfloat)(ctx->AttribStackDepth); - break; - case GL_AUTO_NORMAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.AutoNormal); - break; - case GL_AUX_BUFFERS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.numAuxBuffers); - break; - case GL_BLEND: - params[0] = BOOLEAN_TO_FLOAT((ctx->Color.BlendEnabled & 1)); - break; - case GL_BLEND_DST: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_SRC_RGB_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_DST_RGB_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC_ALPHA_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendSrcA); - break; - case GL_BLEND_DST_ALPHA_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendDstA); - break; - case GL_BLEND_EQUATION: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationRGB ); - break; - case GL_BLEND_EQUATION_ALPHA_EXT: - params[0] = ENUM_TO_FLOAT(ctx->Color.BlendEquationA ); - break; - case GL_BLEND_COLOR_EXT: - params[0] = ctx->Color.BlendColor[0]; - params[1] = ctx->Color.BlendColor[1]; - params[2] = ctx->Color.BlendColor[2]; - params[3] = ctx->Color.BlendColor[3]; - break; - case GL_BLUE_BIAS: - params[0] = ctx->Pixel.BlueBias; - break; - case GL_BLUE_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.blueBits); - break; - case GL_BLUE_SCALE: - params[0] = ctx->Pixel.BlueScale; - break; - case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = (GLfloat)(ctx->ClientAttribStackDepth); - break; - case GL_CLIP_PLANE0: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 0) & 1); - break; - case GL_CLIP_PLANE1: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 1) & 1); - break; - case GL_CLIP_PLANE2: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 2) & 1); - break; - case GL_CLIP_PLANE3: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 3) & 1); - break; - case GL_CLIP_PLANE4: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 4) & 1); - break; - case GL_CLIP_PLANE5: - params[0] = BOOLEAN_TO_FLOAT((ctx->Transform.ClipPlanesEnabled >> 5) & 1); - break; - case GL_COLOR_CLEAR_VALUE: - params[0] = ctx->Color.ClearColor[0]; - params[1] = ctx->Color.ClearColor[1]; - params[2] = ctx->Color.ClearColor[2]; - params[3] = ctx->Color.ClearColor[3]; - break; - case GL_COLOR_MATERIAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.ColorMaterialEnabled); - break; - case GL_COLOR_MATERIAL_FACE: - params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialFace); - break; - case GL_COLOR_MATERIAL_PARAMETER: - params[0] = ENUM_TO_FLOAT(ctx->Light.ColorMaterialMode); - break; - case GL_COLOR_WRITEMASK: - params[0] = (GLfloat)(ctx->Color.ColorMask[0][RCOMP] ? 1 : 0); - params[1] = (GLfloat)(ctx->Color.ColorMask[0][GCOMP] ? 1 : 0); - params[2] = (GLfloat)(ctx->Color.ColorMask[0][BCOMP] ? 1 : 0); - params[3] = (GLfloat)(ctx->Color.ColorMask[0][ACOMP] ? 1 : 0); - break; - case GL_CULL_FACE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.CullFlag); - break; - case GL_CULL_FACE_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode); - break; - case GL_CURRENT_COLOR: - { - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; - params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; - params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; - params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; - } - break; - case GL_CURRENT_INDEX: - { - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]; - } - break; - case GL_CURRENT_NORMAL: - { - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; - params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; - params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; - } - break; - case GL_CURRENT_RASTER_COLOR: - params[0] = ctx->Current.RasterColor[0]; - params[1] = ctx->Current.RasterColor[1]; - params[2] = ctx->Current.RasterColor[2]; - params[3] = ctx->Current.RasterColor[3]; - break; - case GL_CURRENT_RASTER_DISTANCE: - params[0] = ctx->Current.RasterDistance; - break; - case GL_CURRENT_RASTER_INDEX: - params[0] = 1.0; - break; - case GL_CURRENT_RASTER_POSITION: - params[0] = ctx->Current.RasterPos[0]; - params[1] = ctx->Current.RasterPos[1]; - params[2] = ctx->Current.RasterPos[2]; - params[3] = ctx->Current.RasterPos[3]; - break; - case GL_CURRENT_RASTER_SECONDARY_COLOR: - params[0] = ctx->Current.RasterSecondaryColor[0]; - params[1] = ctx->Current.RasterSecondaryColor[1]; - params[2] = ctx->Current.RasterSecondaryColor[2]; - params[3] = ctx->Current.RasterSecondaryColor[3]; - break; - case GL_CURRENT_RASTER_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(raster tex coords, unit %u)", unit); - return; - } - params[0] = ctx->Current.RasterTexCoords[unit][0]; - params[1] = ctx->Current.RasterTexCoords[unit][1]; - params[2] = ctx->Current.RasterTexCoords[unit][2]; - params[3] = ctx->Current.RasterTexCoords[unit][3]; - } - break; - case GL_CURRENT_RASTER_POSITION_VALID: - params[0] = BOOLEAN_TO_FLOAT(ctx->Current.RasterPosValid); - break; - case GL_CURRENT_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(current tex coords, unit %u)", unit); - return; - } - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]; - params[1] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]; - params[2] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]; - params[3] = ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]; - } - break; - case GL_DEPTH_BIAS: - params[0] = ctx->Pixel.DepthBias; - break; - case GL_DEPTH_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.depthBits); - break; - case GL_DEPTH_CLEAR_VALUE: - params[0] = ((GLfloat) ctx->Depth.Clear); - break; - case GL_DEPTH_FUNC: - params[0] = ENUM_TO_FLOAT(ctx->Depth.Func); - break; - case GL_DEPTH_RANGE: - params[0] = ctx->Viewport.Near; - params[1] = ctx->Viewport.Far; - break; - case GL_DEPTH_SCALE: - params[0] = ctx->Pixel.DepthScale; - break; - case GL_DEPTH_TEST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Test); - break; - case GL_DEPTH_WRITEMASK: - params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.Mask); - break; - case GL_DITHER: - params[0] = BOOLEAN_TO_FLOAT(ctx->Color.DitherFlag); - break; - case GL_DOUBLEBUFFER: - params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.doubleBufferMode); - break; - case GL_DRAW_BUFFER: - params[0] = ENUM_TO_FLOAT(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_EDGE_FLAG: - { - FLUSH_CURRENT(ctx, 0); - params[0] = BOOLEAN_TO_FLOAT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); - } - break; - case GL_FEEDBACK_BUFFER_SIZE: - params[0] = (GLfloat)(ctx->Feedback.BufferSize); - break; - case GL_FEEDBACK_BUFFER_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Feedback.Type); - break; - case GL_FOG: - params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.Enabled); - break; - case GL_FOG_COLOR: - params[0] = ctx->Fog.Color[0]; - params[1] = ctx->Fog.Color[1]; - params[2] = ctx->Fog.Color[2]; - params[3] = ctx->Fog.Color[3]; - break; - case GL_FOG_DENSITY: - params[0] = ctx->Fog.Density; - break; - case GL_FOG_END: - params[0] = ctx->Fog.End; - break; - case GL_FOG_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.Fog); - break; - case GL_FOG_INDEX: - params[0] = ctx->Fog.Index; - break; - case GL_FOG_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Fog.Mode); - break; - case GL_FOG_START: - params[0] = ctx->Fog.Start; - break; - case GL_FRONT_FACE: - params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontFace); - break; - case GL_GREEN_BIAS: - params[0] = ctx->Pixel.GreenBias; - break; - case GL_GREEN_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.greenBits); - break; - case GL_GREEN_SCALE: - params[0] = ctx->Pixel.GreenScale; - break; - case GL_INDEX_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.indexBits); - break; - case GL_INDEX_CLEAR_VALUE: - params[0] = (GLfloat)(ctx->Color.ClearIndex); - break; - case GL_INDEX_MODE: - params[0] = BOOLEAN_TO_FLOAT(GL_FALSE); - break; - case GL_INDEX_OFFSET: - params[0] = (GLfloat)(ctx->Pixel.IndexOffset); - break; - case GL_INDEX_SHIFT: - params[0] = (GLfloat)(ctx->Pixel.IndexShift); - break; - case GL_INDEX_WRITEMASK: - params[0] = (GLfloat)(ctx->Color.IndexMask); - break; - case GL_LIGHT0: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[0].Enabled); - break; - case GL_LIGHT1: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[1].Enabled); - break; - case GL_LIGHT2: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[2].Enabled); - break; - case GL_LIGHT3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[3].Enabled); - break; - case GL_LIGHT4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[4].Enabled); - break; - case GL_LIGHT5: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[5].Enabled); - break; - case GL_LIGHT6: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[6].Enabled); - break; - case GL_LIGHT7: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Light[7].Enabled); - break; - case GL_LIGHTING: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Enabled); - break; - case GL_LIGHT_MODEL_AMBIENT: - params[0] = ctx->Light.Model.Ambient[0]; - params[1] = ctx->Light.Model.Ambient[1]; - params[2] = ctx->Light.Model.Ambient[2]; - params[3] = ctx->Light.Model.Ambient[3]; - break; - case GL_LIGHT_MODEL_COLOR_CONTROL: - params[0] = ENUM_TO_FLOAT(ctx->Light.Model.ColorControl); - break; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.LocalViewer); - break; - case GL_LIGHT_MODEL_TWO_SIDE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.Model.TwoSide); - break; - case GL_LINE_SMOOTH: - params[0] = BOOLEAN_TO_FLOAT(ctx->Line.SmoothFlag); - break; - case GL_LINE_SMOOTH_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.LineSmooth); - break; - case GL_LINE_STIPPLE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Line.StippleFlag); - break; - case GL_LINE_STIPPLE_PATTERN: - params[0] = (GLfloat)(ctx->Line.StipplePattern); - break; - case GL_LINE_STIPPLE_REPEAT: - params[0] = (GLfloat)(ctx->Line.StippleFactor); - break; - case GL_LINE_WIDTH: - params[0] = ctx->Line.Width; - break; - case GL_LINE_WIDTH_GRANULARITY: - params[0] = ctx->Const.LineWidthGranularity; - break; - case GL_LINE_WIDTH_RANGE: - params[0] = ctx->Const.MinLineWidthAA; - params[1] = ctx->Const.MaxLineWidthAA; - break; - case GL_ALIASED_LINE_WIDTH_RANGE: - params[0] = ctx->Const.MinLineWidth; - params[1] = ctx->Const.MaxLineWidth; - break; - case GL_LIST_BASE: - params[0] = (GLfloat)(ctx->List.ListBase); - break; - case GL_LIST_INDEX: - params[0] = (GLfloat)((ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)); - break; - case GL_LIST_MODE: - { - GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE; - params[0] = ENUM_TO_FLOAT(mode); - } - break; - case GL_INDEX_LOGIC_OP: - params[0] = BOOLEAN_TO_FLOAT(ctx->Color.IndexLogicOpEnabled); - break; - case GL_COLOR_LOGIC_OP: - params[0] = BOOLEAN_TO_FLOAT(ctx->Color.ColorLogicOpEnabled); - break; - case GL_LOGIC_OP_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Color.LogicOp); - break; - case GL_MAP1_COLOR_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Color4); - break; - case GL_MAP1_GRID_DOMAIN: - params[0] = ctx->Eval.MapGrid1u1; - params[1] = ctx->Eval.MapGrid1u2; - break; - case GL_MAP1_GRID_SEGMENTS: - params[0] = (GLfloat)(ctx->Eval.MapGrid1un); - break; - case GL_MAP1_INDEX: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Index); - break; - case GL_MAP1_NORMAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Normal); - break; - case GL_MAP1_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord1); - break; - case GL_MAP1_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord2); - break; - case GL_MAP1_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord3); - break; - case GL_MAP1_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1TextureCoord4); - break; - case GL_MAP1_VERTEX_3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex3); - break; - case GL_MAP1_VERTEX_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Vertex4); - break; - case GL_MAP2_COLOR_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Color4); - break; - case GL_MAP2_GRID_DOMAIN: - params[0] = ctx->Eval.MapGrid2u1; - params[1] = ctx->Eval.MapGrid2u2; - params[2] = ctx->Eval.MapGrid2v1; - params[3] = ctx->Eval.MapGrid2v2; - break; - case GL_MAP2_GRID_SEGMENTS: - params[0] = (GLfloat)(ctx->Eval.MapGrid2un); - params[1] = (GLfloat)(ctx->Eval.MapGrid2vn); - break; - case GL_MAP2_INDEX: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Index); - break; - case GL_MAP2_NORMAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Normal); - break; - case GL_MAP2_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord1); - break; - case GL_MAP2_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord2); - break; - case GL_MAP2_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord3); - break; - case GL_MAP2_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2TextureCoord4); - break; - case GL_MAP2_VERTEX_3: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex3); - break; - case GL_MAP2_VERTEX_4: - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map2Vertex4); - break; - case GL_MAP_COLOR: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapColorFlag); - break; - case GL_MAP_STENCIL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MapStencilFlag); - break; - case GL_MATRIX_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Transform.MatrixMode); - break; - case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = (GLfloat)(MAX_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = (GLfloat)(MAX_CLIENT_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIP_PLANES: - params[0] = (GLfloat)(ctx->Const.MaxClipPlanes); - break; - case GL_MAX_ELEMENTS_VERTICES: - params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_ELEMENTS_INDICES: - params[0] = (GLfloat)(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_EVAL_ORDER: - params[0] = (GLfloat)(MAX_EVAL_ORDER); - break; - case GL_MAX_LIGHTS: - params[0] = (GLfloat)(ctx->Const.MaxLights); - break; - case GL_MAX_LIST_NESTING: - params[0] = (GLfloat)(MAX_LIST_NESTING); - break; - case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = (GLfloat)(MAX_MODELVIEW_STACK_DEPTH); - break; - case GL_MAX_NAME_STACK_DEPTH: - params[0] = (GLfloat)(MAX_NAME_STACK_DEPTH); - break; - case GL_MAX_PIXEL_MAP_TABLE: - params[0] = (GLfloat)(MAX_PIXEL_MAP_TABLE); - break; - case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = (GLfloat)(MAX_PROJECTION_STACK_DEPTH); - break; - case GL_MAX_TEXTURE_SIZE: - params[0] = (GLfloat)(1 << (ctx->Const.MaxTextureLevels - 1)); - break; - case GL_MAX_3D_TEXTURE_SIZE: - params[0] = (GLfloat)(1 << (ctx->Const.Max3DTextureLevels - 1)); - break; - case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = (GLfloat)(MAX_TEXTURE_STACK_DEPTH); - break; - case GL_MAX_VIEWPORT_DIMS: - params[0] = (GLfloat)(ctx->Const.MaxViewportWidth); - params[1] = (GLfloat)(ctx->Const.MaxViewportHeight); - break; - case GL_MODELVIEW_MATRIX: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_MODELVIEW_STACK_DEPTH: - params[0] = (GLfloat)(ctx->ModelviewMatrixStack.Depth + 1); - break; - case GL_NAME_STACK_DEPTH: - params[0] = (GLfloat)(ctx->Select.NameStackDepth); - break; - case GL_NORMALIZE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.Normalize); - break; - case GL_PACK_ALIGNMENT: - params[0] = (GLfloat)(ctx->Pack.Alignment); - break; - case GL_PACK_LSB_FIRST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.LsbFirst); - break; - case GL_PACK_ROW_LENGTH: - params[0] = (GLfloat)(ctx->Pack.RowLength); - break; - case GL_PACK_SKIP_PIXELS: - params[0] = (GLfloat)(ctx->Pack.SkipPixels); - break; - case GL_PACK_SKIP_ROWS: - params[0] = (GLfloat)(ctx->Pack.SkipRows); - break; - case GL_PACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.SwapBytes); - break; - case GL_PACK_SKIP_IMAGES_EXT: - params[0] = (GLfloat)(ctx->Pack.SkipImages); - break; - case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = (GLfloat)(ctx->Pack.ImageHeight); - break; - case GL_PACK_INVERT_MESA: - params[0] = BOOLEAN_TO_FLOAT(ctx->Pack.Invert); - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection); - break; - case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.AtoA.Size); - break; - case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.BtoB.Size); - break; - case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.GtoG.Size); - break; - case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoA.Size); - break; - case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoB.Size); - break; - case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoG.Size); - break; - case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoI.Size); - break; - case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.ItoR.Size); - break; - case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.RtoR.Size); - break; - case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = (GLfloat)(ctx->PixelMaps.StoS.Size); - break; - case GL_POINT_SIZE: - params[0] = ctx->Point.Size; - break; - case GL_POINT_SIZE_GRANULARITY: - params[0] = ctx->Const.PointSizeGranularity; - break; - case GL_POINT_SIZE_RANGE: - params[0] = ctx->Const.MinPointSizeAA; - params[1] = ctx->Const.MaxPointSizeAA; - break; - case GL_ALIASED_POINT_SIZE_RANGE: - params[0] = ctx->Const.MinPointSize; - params[1] = ctx->Const.MaxPointSize; - break; - case GL_POINT_SMOOTH: - params[0] = BOOLEAN_TO_FLOAT(ctx->Point.SmoothFlag); - break; - case GL_POINT_SMOOTH_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.PointSmooth); - break; - case GL_POINT_SIZE_MIN_EXT: - params[0] = ctx->Point.MinSize; - break; - case GL_POINT_SIZE_MAX_EXT: - params[0] = ctx->Point.MaxSize; - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - params[0] = ctx->Point.Threshold; - break; - case GL_DISTANCE_ATTENUATION_EXT: - params[0] = ctx->Point.Params[0]; - params[1] = ctx->Point.Params[1]; - params[2] = ctx->Point.Params[2]; - break; - case GL_POLYGON_MODE: - params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontMode); - params[1] = ENUM_TO_FLOAT(ctx->Polygon.BackMode); - break; - case GL_POLYGON_OFFSET_BIAS_EXT: - params[0] = ctx->Polygon.OffsetUnits; - break; - case GL_POLYGON_OFFSET_FACTOR: - params[0] = ctx->Polygon.OffsetFactor ; - break; - case GL_POLYGON_OFFSET_UNITS: - params[0] = ctx->Polygon.OffsetUnits ; - break; - case GL_POLYGON_OFFSET_POINT: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetPoint); - break; - case GL_POLYGON_OFFSET_LINE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetLine); - break; - case GL_POLYGON_OFFSET_FILL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.OffsetFill); - break; - case GL_POLYGON_SMOOTH: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.SmoothFlag); - break; - case GL_POLYGON_SMOOTH_HINT: - params[0] = ENUM_TO_FLOAT(ctx->Hint.PolygonSmooth); - break; - case GL_POLYGON_STIPPLE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Polygon.StippleFlag); - break; - case GL_PROJECTION_MATRIX: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_PROJECTION_STACK_DEPTH: - params[0] = (GLfloat)(ctx->ProjectionMatrixStack.Depth + 1); - break; - case GL_READ_BUFFER: - params[0] = ENUM_TO_FLOAT(ctx->ReadBuffer->ColorReadBuffer); - break; - case GL_RED_BIAS: - params[0] = ctx->Pixel.RedBias; - break; - case GL_RED_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.redBits); - break; - case GL_RED_SCALE: - params[0] = ctx->Pixel.RedScale; - break; - case GL_RENDER_MODE: - params[0] = ENUM_TO_FLOAT(ctx->RenderMode); - break; - case GL_RESCALE_NORMAL: - params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RescaleNormals); - break; - case GL_RGBA_MODE: - params[0] = BOOLEAN_TO_FLOAT(GL_TRUE); - break; - case GL_SCISSOR_BOX: - params[0] = (GLfloat)(ctx->Scissor.X); - params[1] = (GLfloat)(ctx->Scissor.Y); - params[2] = (GLfloat)(ctx->Scissor.Width); - params[3] = (GLfloat)(ctx->Scissor.Height); - break; - case GL_SCISSOR_TEST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Scissor.Enabled); - break; - case GL_SELECTION_BUFFER_SIZE: - params[0] = (GLfloat)(ctx->Select.BufferSize); - break; - case GL_SHADE_MODEL: - params[0] = ENUM_TO_FLOAT(ctx->Light.ShadeModel); - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.SharedPalette); - break; - case GL_STENCIL_BITS: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.stencilBits); - break; - case GL_STENCIL_CLEAR_VALUE: - params[0] = (GLfloat)(ctx->Stencil.Clear); - break; - case GL_STENCIL_FAIL: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_FUNC: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_PASS: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_REF: - params[0] = (GLfloat)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_TEST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.Enabled); - break; - case GL_STENCIL_VALUE_MASK: - params[0] = (GLfloat)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_WRITEMASK: - params[0] = (GLfloat)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); - break; - case GL_STEREO: - params[0] = BOOLEAN_TO_FLOAT(ctx->DrawBuffer->Visual.stereoMode); - break; - case GL_SUBPIXEL_BITS: - params[0] = (GLfloat)(ctx->Const.SubPixelBits); - break; - case GL_TEXTURE_1D: - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D)); - break; - case GL_TEXTURE_2D: - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D)); - break; - case GL_TEXTURE_3D: - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_3D)); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); - break; - case GL_TEXTURE_BINDING_1D: - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D: - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_3D: - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetFloatv"); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetFloatv"); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); - break; - case GL_TEXTURE_GEN_S: - params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_T: - params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_R: - params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_Q: - params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_MATRIX: - { - const GLfloat *matrix; - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)", - unit); - return; - } - matrix = ctx->TextureMatrixStack[unit].Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_TEXTURE_STACK_DEPTH: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(texture stack depth, unit %u)", unit); - return; - } - params[0] = (GLfloat)(ctx->TextureMatrixStack[unit].Depth + 1); - } - break; - case GL_UNPACK_ALIGNMENT: - params[0] = (GLfloat)(ctx->Unpack.Alignment); - break; - case GL_UNPACK_LSB_FIRST: - params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.LsbFirst); - break; - case GL_UNPACK_ROW_LENGTH: - params[0] = (GLfloat)(ctx->Unpack.RowLength); - break; - case GL_UNPACK_SKIP_PIXELS: - params[0] = (GLfloat)(ctx->Unpack.SkipPixels); - break; - case GL_UNPACK_SKIP_ROWS: - params[0] = (GLfloat)(ctx->Unpack.SkipRows); - break; - case GL_UNPACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.SwapBytes); - break; - case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = (GLfloat)(ctx->Unpack.SkipImages); - break; - case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = (GLfloat)(ctx->Unpack.ImageHeight); - break; - case GL_UNPACK_CLIENT_STORAGE_APPLE: - params[0] = BOOLEAN_TO_FLOAT(ctx->Unpack.ClientStorage); - break; - case GL_VIEWPORT: - params[0] = (GLfloat)(ctx->Viewport.X); - params[1] = (GLfloat)(ctx->Viewport.Y); - params[2] = (GLfloat)(ctx->Viewport.Width); - params[3] = (GLfloat)(ctx->Viewport.Height); - break; - case GL_ZOOM_X: - params[0] = ctx->Pixel.ZoomX; - break; - case GL_ZOOM_Y: - params[0] = ctx->Pixel.ZoomY; - break; - case GL_VERTEX_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->Vertex.Enabled); - break; - case GL_VERTEX_ARRAY_SIZE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Vertex.Size); - break; - case GL_VERTEX_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Vertex.Type); - break; - case GL_VERTEX_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Vertex.Stride); - break; - case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_NORMAL_ARRAY: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Normal.Enabled); - break; - case GL_NORMAL_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Normal.Type); - break; - case GL_NORMAL_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Normal.Stride); - break; - case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_COLOR_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->Color.Enabled); - break; - case GL_COLOR_ARRAY_SIZE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Color.Size); - break; - case GL_COLOR_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Color.Type); - break; - case GL_COLOR_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Color.Stride); - break; - case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_INDEX_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->Index.Enabled); - break; - case GL_INDEX_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->Index.Type); - break; - case GL_INDEX_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Index.Stride); - break; - case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_TEXTURE_COORD_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled); - break; - case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size); - break; - case GL_TEXTURE_COORD_ARRAY_TYPE: - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); - break; - case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride); - break; - case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_EDGE_FLAG_ARRAY: - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->EdgeFlag.Enabled); - break; - case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = (GLfloat)(ctx->Array.ArrayObj->EdgeFlag.Stride); - break; - case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = (GLfloat)(0); - break; - case GL_MAX_TEXTURE_UNITS_ARB: - CHECK_EXT1(ARB_multitexture, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxTextureUnits); - break; - case GL_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture, "GetFloatv"); - params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); - break; - case GL_CLIENT_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture, "GetFloatv"); - params[0] = (GLfloat)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); - break; - case GL_TEXTURE_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); - break; - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetFloatv"); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); - break; - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetFloatv"); - params[0] = (GLfloat)((1 << (ctx->Const.MaxCubeTextureLevels - 1))); - break; - case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = (GLfloat)(ctx->Hint.TextureCompression); - break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = (GLfloat)(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)); - break; - case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - { - GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = ENUM_TO_FLOAT(formats[i]); - } - break; - case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: - CHECK_EXT1(EXT_compiled_vertex_array, "GetFloatv"); - params[0] = (GLfloat)(ctx->Array.LockFirst); - break; - case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: - CHECK_EXT1(EXT_compiled_vertex_array, "GetFloatv"); - params[0] = (GLfloat)(ctx->Array.LockCount); - break; - case GL_TRANSPOSE_COLOR_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - { - const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_COLOR_MATRIX_SGI: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = (GLfloat)(ctx->ColorMatrixStack.Depth + 1); - break; - case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = (GLfloat)(MAX_COLOR_STACK_DEPTH); - break; - case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: - params[0] = ctx->Pixel.PostColorMatrixScale[0]; - break; - case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: - params[0] = ctx->Pixel.PostColorMatrixScale[1]; - break; - case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: - params[0] = ctx->Pixel.PostColorMatrixScale[2]; - break; - case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: - params[0] = ctx->Pixel.PostColorMatrixScale[3]; - break; - case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: - params[0] = ctx->Pixel.PostColorMatrixBias[0]; - break; - case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: - params[0] = ctx->Pixel.PostColorMatrixBias[1]; - break; - case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: - params[0] = ctx->Pixel.PostColorMatrixBias[2]; - break; - case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: - params[0] = ctx->Pixel.PostColorMatrixBias[3]; - break; - case GL_CONVOLUTION_1D_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution1DEnabled); - break; - case GL_CONVOLUTION_2D_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Convolution2DEnabled); - break; - case GL_SEPARABLE_2D_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.Separable2DEnabled); - break; - case GL_POST_CONVOLUTION_RED_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = ctx->Pixel.PostConvolutionScale[0]; - break; - case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = ctx->Pixel.PostConvolutionScale[1]; - break; - case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = ctx->Pixel.PostConvolutionScale[2]; - break; - case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = ctx->Pixel.PostConvolutionScale[3]; - break; - case GL_POST_CONVOLUTION_RED_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = ctx->Pixel.PostConvolutionBias[0]; - break; - case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = ctx->Pixel.PostConvolutionBias[1]; - break; - case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = ctx->Pixel.PostConvolutionBias[2]; - break; - case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetFloatv"); - params[0] = ctx->Pixel.PostConvolutionBias[3]; - break; - case GL_HISTOGRAM: - CHECK_EXT1(EXT_histogram, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.HistogramEnabled); - break; - case GL_MINMAX: - CHECK_EXT1(EXT_histogram, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.MinMaxEnabled); - break; - case GL_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]); - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]); - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]); - break; - case GL_TEXTURE_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_texture_color_table, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); - break; - case GL_COLOR_SUM_EXT: - CHECK_EXT2(EXT_secondary_color, ARB_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Fog.ColorSumEnabled); - break; - case GL_CURRENT_SECONDARY_COLOR_EXT: - CHECK_EXT1(EXT_secondary_color, "GetFloatv"); - { - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; - params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; - params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; - params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]; - } - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - CHECK_EXT1(EXT_secondary_color, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->SecondaryColor.Enabled); - break; - case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetFloatv"); - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->SecondaryColor.Type); - break; - case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetFloatv"); - params[0] = (GLfloat)(ctx->Array.ArrayObj->SecondaryColor.Stride); - break; - case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetFloatv"); - params[0] = (GLfloat)(ctx->Array.ArrayObj->SecondaryColor.Size); - break; - case GL_CURRENT_FOG_COORDINATE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetFloatv"); - { - FLUSH_CURRENT(ctx, 0); - params[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; - } - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - CHECK_EXT1(EXT_fog_coord, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->FogCoord.Enabled); - break; - case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetFloatv"); - params[0] = ENUM_TO_FLOAT(ctx->Array.ArrayObj->FogCoord.Type); - break; - case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetFloatv"); - params[0] = (GLfloat)(ctx->Array.ArrayObj->FogCoord.Stride); - break; - case GL_FOG_COORDINATE_SOURCE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetFloatv"); - params[0] = ENUM_TO_FLOAT(ctx->Fog.FogCoordinateSource); - break; - case GL_MAX_TEXTURE_LOD_BIAS_EXT: - CHECK_EXT1(EXT_texture_lod_bias, "GetFloatv"); - params[0] = ctx->Const.MaxTextureLodBias; - break; - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - CHECK_EXT1(EXT_texture_filter_anisotropic, "GetFloatv"); - params[0] = ctx->Const.MaxTextureMaxAnisotropy; - break; - case GL_MULTISAMPLE_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.Enabled); - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToCoverage); - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleAlphaToOne); - break; - case GL_SAMPLE_COVERAGE_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverage); - break; - case GL_SAMPLE_COVERAGE_VALUE_ARB: - params[0] = ctx->Multisample.SampleCoverageValue; - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - params[0] = BOOLEAN_TO_FLOAT(ctx->Multisample.SampleCoverageInvert); - break; - case GL_SAMPLE_BUFFERS_ARB: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.sampleBuffers); - break; - case GL_SAMPLES_ARB: - params[0] = (GLfloat)(ctx->DrawBuffer->Visual.samples); - break; - case GL_RASTER_POSITION_UNCLIPPED_IBM: - CHECK_EXT1(IBM_rasterpos_clip, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.RasterPositionUnclipped); - break; - case GL_POINT_SPRITE_NV: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Point.PointSprite); - break; - case GL_POINT_SPRITE_R_MODE_NV: - CHECK_EXT1(NV_point_sprite, "GetFloatv"); - params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteRMode); - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetFloatv"); - params[0] = ENUM_TO_FLOAT(ctx->Point.SpriteOrigin); - break; - case GL_GENERATE_MIPMAP_HINT_SGIS: - CHECK_EXT1(SGIS_generate_mipmap, "GetFloatv"); - params[0] = ENUM_TO_FLOAT(ctx->Hint.GenerateMipmap); - break; - case GL_VERTEX_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = (GLfloat)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); - break; - case GL_VERTEX_ATTRIB_ARRAY0_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[0].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY1_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[1].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY2_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[2].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY3_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[3].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[4].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY5_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[5].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY6_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[6].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY7_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[7].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY8_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[8].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY9_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[9].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY10_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[10].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY11_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[11].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY12_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[12].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY13_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[13].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY14_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[14].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Array.ArrayObj->VertexAttrib[15].Enabled); - break; - case GL_MAP1_VERTEX_ATTRIB0_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[0]); - break; - case GL_MAP1_VERTEX_ATTRIB1_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[1]); - break; - case GL_MAP1_VERTEX_ATTRIB2_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[2]); - break; - case GL_MAP1_VERTEX_ATTRIB3_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[3]); - break; - case GL_MAP1_VERTEX_ATTRIB4_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[4]); - break; - case GL_MAP1_VERTEX_ATTRIB5_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[5]); - break; - case GL_MAP1_VERTEX_ATTRIB6_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[6]); - break; - case GL_MAP1_VERTEX_ATTRIB7_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[7]); - break; - case GL_MAP1_VERTEX_ATTRIB8_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[8]); - break; - case GL_MAP1_VERTEX_ATTRIB9_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[9]); - break; - case GL_MAP1_VERTEX_ATTRIB10_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[10]); - break; - case GL_MAP1_VERTEX_ATTRIB11_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[11]); - break; - case GL_MAP1_VERTEX_ATTRIB12_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[12]); - break; - case GL_MAP1_VERTEX_ATTRIB13_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[13]); - break; - case GL_MAP1_VERTEX_ATTRIB14_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[14]); - break; - case GL_MAP1_VERTEX_ATTRIB15_4_NV: - CHECK_EXT1(NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Eval.Map1Attrib[15]); - break; - case GL_FRAGMENT_PROGRAM_NV: - CHECK_EXT1(NV_fragment_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled); - break; - case GL_FRAGMENT_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_fragment_program, "GetFloatv"); - params[0] = (GLfloat)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); - break; - case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: - CHECK_EXT1(NV_fragment_program, "GetFloatv"); - params[0] = (GLfloat)(MAX_NV_FRAGMENT_PROGRAM_PARAMS); - break; - case GL_TEXTURE_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); - break; - case GL_TEXTURE_BINDING_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetFloatv"); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); - break; - case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxTextureRectSize); - break; - case GL_STENCIL_TEST_TWO_SIDE_EXT: - CHECK_EXT1(EXT_stencil_two_side, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Stencil.TestTwoSide); - break; - case GL_ACTIVE_STENCIL_FACE_EXT: - CHECK_EXT1(EXT_stencil_two_side, "GetFloatv"); - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); - break; - case GL_MAX_SHININESS_NV: - CHECK_EXT1(NV_light_max_exponent, "GetFloatv"); - params[0] = ctx->Const.MaxShininess; - break; - case GL_MAX_SPOT_EXPONENT_NV: - CHECK_EXT1(NV_light_max_exponent, "GetFloatv"); - params[0] = ctx->Const.MaxSpotExponent; - break; - case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayBufferObj->Name); - break; - case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Vertex.BufferObj->Name); - break; - case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Normal.BufferObj->Name); - break; - case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Color.BufferObj->Name); - break; - case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->Index.BufferObj->Name); - break; - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); - break; - case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name); - break; - case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name); - break; - case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ArrayObj->FogCoord.BufferObj->Name); - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLfloat)(ctx->Array.ElementArrayBufferObj->Name); - break; - case GL_PIXEL_PACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object, "GetFloatv"); - params[0] = (GLfloat)(ctx->Pack.BufferObj->Name); - break; - case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object, "GetFloatv"); - params[0] = (GLfloat)(ctx->Unpack.BufferObj->Name); - break; - case GL_VERTEX_PROGRAM_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.Enabled); - break; - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.PointSizeEnabled); - break; - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->VertexProgram.TwoSideEnabled); - break; - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxProgramMatrixStackDepth); - break; - case GL_MAX_PROGRAM_MATRICES_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxProgramMatrices); - break; - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->CurrentStack->Depth + 1); - break; - case GL_CURRENT_MATRIX_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_fragment_program, "GetFloatv"); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = matrix[0]; - params[1] = matrix[1]; - params[2] = matrix[2]; - params[3] = matrix[3]; - params[4] = matrix[4]; - params[5] = matrix[5]; - params[6] = matrix[6]; - params[7] = matrix[7]; - params[8] = matrix[8]; - params[9] = matrix[9]; - params[10] = matrix[10]; - params[11] = matrix[11]; - params[12] = matrix[12]; - params[13] = matrix[13]; - params[14] = matrix[14]; - params[15] = matrix[15]; - } - break; - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - CHECK_EXT2(ARB_vertex_program, ARB_fragment_program, "GetFloatv"); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = matrix[0]; - params[1] = matrix[4]; - params[2] = matrix[8]; - params[3] = matrix[12]; - params[4] = matrix[1]; - params[5] = matrix[5]; - params[6] = matrix[9]; - params[7] = matrix[13]; - params[8] = matrix[2]; - params[9] = matrix[6]; - params[10] = matrix[10]; - params[11] = matrix[14]; - params[12] = matrix[3]; - params[13] = matrix[7]; - params[14] = matrix[11]; - params[15] = matrix[15]; - } - break; - case GL_MAX_VERTEX_ATTRIBS_ARB: - CHECK_EXT1(ARB_vertex_program, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.VertexProgram.MaxAttribs); - break; - case GL_PROGRAM_ERROR_POSITION_ARB: - CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program, "GetFloatv"); - params[0] = (GLfloat)(ctx->Program.ErrorPos); - break; - case GL_FRAGMENT_PROGRAM_ARB: - CHECK_EXT1(ARB_fragment_program, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->FragmentProgram.Enabled); - break; - case GL_MAX_TEXTURE_COORDS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxTextureCoordUnits); - break; - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxTextureImageUnits); - break; - case GL_DEPTH_BOUNDS_TEST_EXT: - CHECK_EXT1(EXT_depth_bounds_test, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Depth.BoundsTest); - break; - case GL_DEPTH_BOUNDS_EXT: - CHECK_EXT1(EXT_depth_bounds_test, "GetFloatv"); - params[0] = ctx->Depth.BoundsMin; - params[1] = ctx->Depth.BoundsMax; - break; - case GL_DEPTH_CLAMP: - CHECK_EXT1(ARB_depth_clamp, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Transform.DepthClamp); - break; - case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = (GLfloat)(ctx->Const.MaxDrawBuffers); - break; - case GL_DRAW_BUFFER0_ARB: - params[0] = ENUM_TO_FLOAT(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_DRAW_BUFFER1_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[1]; - params[0] = ENUM_TO_FLOAT(buffer); - } - break; - case GL_DRAW_BUFFER2_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[2]; - params[0] = ENUM_TO_FLOAT(buffer); - } - break; - case GL_DRAW_BUFFER3_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[3]; - params[0] = ENUM_TO_FLOAT(buffer); - } - break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - CHECK_EXT1(OES_read_format, "GetFloatv"); - params[0] = (GLfloat)(_mesa_get_color_read_type(ctx)); - break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - CHECK_EXT1(OES_read_format, "GetFloatv"); - params[0] = (GLfloat)(_mesa_get_color_read_format(ctx)); - break; - case GL_NUM_FRAGMENT_REGISTERS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); - params[0] = (GLfloat)(6); - break; - case GL_NUM_FRAGMENT_CONSTANTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); - params[0] = (GLfloat)(8); - break; - case GL_NUM_PASSES_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); - params[0] = (GLfloat)(2); - break; - case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); - params[0] = (GLfloat)(8); - break; - case GL_NUM_INSTRUCTIONS_TOTAL_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); - params[0] = (GLfloat)(16); - break; - case GL_COLOR_ALPHA_PAIRING_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(GL_TRUE); - break; - case GL_NUM_LOOPBACK_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); - params[0] = (GLfloat)(3); - break; - case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); - params[0] = (GLfloat)(3); - break; - case GL_STENCIL_BACK_FUNC: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.Function[1]); - break; - case GL_STENCIL_BACK_VALUE_MASK: - params[0] = (GLfloat)(ctx->Stencil.ValueMask[1]); - break; - case GL_STENCIL_BACK_WRITEMASK: - params[0] = (GLfloat)(ctx->Stencil.WriteMask[1]); - break; - case GL_STENCIL_BACK_REF: - params[0] = (GLfloat)(ctx->Stencil.Ref[1]); - break; - case GL_STENCIL_BACK_FAIL: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.FailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: - params[0] = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc[1]); - break; - case GL_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetFloatv"); - params[0] = (GLfloat)(ctx->DrawBuffer->Name); - break; - case GL_RENDERBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetFloatv"); - params[0] = (GLfloat)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); - break; - case GL_MAX_COLOR_ATTACHMENTS_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxColorAttachments); - break; - case GL_MAX_RENDERBUFFER_SIZE_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxRenderbufferSize); - break; - case GL_READ_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_blit, "GetFloatv"); - params[0] = (GLfloat)(ctx->ReadBuffer->Name); - break; - case GL_PROVOKING_VERTEX_EXT: - CHECK_EXT1(EXT_provoking_vertex, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Light.ProvokingVertex); - break; - case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: - CHECK_EXT1(EXT_provoking_vertex, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Const.QuadsFollowProvokingVertexConvention); - break; - case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_fragment_shader, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.FragmentProgram.MaxUniformComponents); - break; - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: - CHECK_EXT1(ARB_fragment_shader, "GetFloatv"); - params[0] = ENUM_TO_FLOAT(ctx->Hint.FragmentShaderDerivative); - break; - case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.VertexProgram.MaxUniformComponents); - break; - case GL_MAX_VARYING_FLOATS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxVarying * 4); - break; - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxVertexTextureImageUnits); - break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxCombinedTextureImageUnits); - break; - case GL_CURRENT_PROGRAM: - CHECK_EXT1(ARB_shader_objects, "GetFloatv"); - params[0] = (GLfloat)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); - break; - case GL_MAX_SAMPLES: - CHECK_EXT1(ARB_framebuffer_object, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxSamples); - break; - case GL_VERTEX_ARRAY_BINDING_APPLE: - CHECK_EXT1(APPLE_vertex_array_object, "GetFloatv"); - params[0] = (GLfloat)(ctx->Array.ArrayObj->Name); - break; - case GL_TEXTURE_CUBE_MAP_SEAMLESS: - CHECK_EXT1(ARB_seamless_cube_map, "GetFloatv"); - params[0] = BOOLEAN_TO_FLOAT(ctx->Texture.CubeMapSeamless); - break; - case GL_MAX_SERVER_WAIT_TIMEOUT: - CHECK_EXT1(ARB_sync, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.MaxServerWaitTimeout); - break; - case GL_NUM_EXTENSIONS: - params[0] = (GLfloat)(_mesa_get_extension_count(ctx)); - break; - case GL_MAJOR_VERSION: - params[0] = (GLfloat)(ctx->VersionMajor); - break; - case GL_MINOR_VERSION: - params[0] = (GLfloat)(ctx->VersionMinor); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname); + case TYPE_INT_4: + params[3] = (GLfloat) (((GLint *) p)[3]); + case TYPE_INT_3: + params[2] = (GLfloat) (((GLint *) p)[2]); + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = (GLfloat) (((GLint *) p)[1]); + case TYPE_INT: + case TYPE_ENUM: + params[0] = (GLfloat) (((GLint *) p)[0]); + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_FLOAT(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = ((GLint64 *) p)[0]; + break; + + case TYPE_BOOLEAN: + params[0] = BOOLEAN_TO_FLOAT(*(GLboolean*) p); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = m->m[i]; + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = m->m[transpose[i]]; + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = BOOLEAN_TO_FLOAT((*(GLbitfield *) p >> shift) & 1); + break; } } void GLAPIENTRY -_mesa_GetIntegerv( GLenum pname, GLint *params ) +_mesa_GetIntegerv(GLenum pname, GLint *params) { - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; - if (!params) - return; + d = find_value("glGetIntegerv", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = d->offset; + break; - if (ctx->NewState) - _mesa_update_state(ctx); + case TYPE_FLOAT_4: + params[3] = IROUND(((GLfloat *) p)[3]); + case TYPE_FLOAT_3: + params[2] = IROUND(((GLfloat *) p)[2]); + case TYPE_FLOAT_2: + params[1] = IROUND(((GLfloat *) p)[1]); + case TYPE_FLOAT: + params[0] = IROUND(((GLfloat *) p)[0]); + break; - if (ctx->Driver.GetIntegerv && - ctx->Driver.GetIntegerv(ctx, pname, params)) - return; + case TYPE_FLOATN_4: + params[3] = FLOAT_TO_INT(((GLfloat *) p)[3]); + case TYPE_FLOATN_3: + params[2] = FLOAT_TO_INT(((GLfloat *) p)[2]); + case TYPE_FLOATN_2: + params[1] = FLOAT_TO_INT(((GLfloat *) p)[1]); + case TYPE_FLOATN: + params[0] = FLOAT_TO_INT(((GLfloat *) p)[0]); + break; - switch (pname) { - case GL_ACCUM_RED_BITS: - params[0] = ctx->DrawBuffer->Visual.accumRedBits; - break; - case GL_ACCUM_GREEN_BITS: - params[0] = ctx->DrawBuffer->Visual.accumGreenBits; - break; - case GL_ACCUM_BLUE_BITS: - params[0] = ctx->DrawBuffer->Visual.accumBlueBits; - break; - case GL_ACCUM_ALPHA_BITS: - params[0] = ctx->DrawBuffer->Visual.accumAlphaBits; - break; - case GL_ACCUM_CLEAR_VALUE: - params[0] = FLOAT_TO_INT(ctx->Accum.ClearColor[0]); - params[1] = FLOAT_TO_INT(ctx->Accum.ClearColor[1]); - params[2] = FLOAT_TO_INT(ctx->Accum.ClearColor[2]); - params[3] = FLOAT_TO_INT(ctx->Accum.ClearColor[3]); - break; - case GL_ALPHA_BIAS: - params[0] = IROUND(ctx->Pixel.AlphaBias); - break; - case GL_ALPHA_BITS: - params[0] = ctx->DrawBuffer->Visual.alphaBits; - break; - case GL_ALPHA_SCALE: - params[0] = IROUND(ctx->Pixel.AlphaScale); - break; - case GL_ALPHA_TEST: - params[0] = BOOLEAN_TO_INT(ctx->Color.AlphaEnabled); - break; - case GL_ALPHA_TEST_FUNC: - params[0] = ENUM_TO_INT(ctx->Color.AlphaFunc); - break; - case GL_ALPHA_TEST_REF: - params[0] = FLOAT_TO_INT(ctx->Color.AlphaRef); - break; - case GL_ATTRIB_STACK_DEPTH: - params[0] = ctx->AttribStackDepth; - break; - case GL_AUTO_NORMAL: - params[0] = BOOLEAN_TO_INT(ctx->Eval.AutoNormal); - break; - case GL_AUX_BUFFERS: - params[0] = ctx->DrawBuffer->Visual.numAuxBuffers; - break; - case GL_BLEND: - params[0] = BOOLEAN_TO_INT((ctx->Color.BlendEnabled & 1)); - break; - case GL_BLEND_DST: - params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC: - params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_SRC_RGB_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_DST_RGB_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC_ALPHA_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendSrcA); - break; - case GL_BLEND_DST_ALPHA_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendDstA); - break; - case GL_BLEND_EQUATION: - params[0] = ENUM_TO_INT(ctx->Color.BlendEquationRGB ); - break; - case GL_BLEND_EQUATION_ALPHA_EXT: - params[0] = ENUM_TO_INT(ctx->Color.BlendEquationA ); - break; - case GL_BLEND_COLOR_EXT: - params[0] = FLOAT_TO_INT(ctx->Color.BlendColor[0]); - params[1] = FLOAT_TO_INT(ctx->Color.BlendColor[1]); - params[2] = FLOAT_TO_INT(ctx->Color.BlendColor[2]); - params[3] = FLOAT_TO_INT(ctx->Color.BlendColor[3]); - break; - case GL_BLUE_BIAS: - params[0] = IROUND(ctx->Pixel.BlueBias); - break; - case GL_BLUE_BITS: - params[0] = ctx->DrawBuffer->Visual.blueBits; - break; - case GL_BLUE_SCALE: - params[0] = IROUND(ctx->Pixel.BlueScale); - break; - case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = ctx->ClientAttribStackDepth; - break; - case GL_CLIP_PLANE0: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 0) & 1); - break; - case GL_CLIP_PLANE1: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 1) & 1); - break; - case GL_CLIP_PLANE2: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 2) & 1); - break; - case GL_CLIP_PLANE3: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 3) & 1); - break; - case GL_CLIP_PLANE4: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 4) & 1); - break; - case GL_CLIP_PLANE5: - params[0] = BOOLEAN_TO_INT((ctx->Transform.ClipPlanesEnabled >> 5) & 1); - break; - case GL_COLOR_CLEAR_VALUE: - params[0] = FLOAT_TO_INT(ctx->Color.ClearColor[0]); - params[1] = FLOAT_TO_INT(ctx->Color.ClearColor[1]); - params[2] = FLOAT_TO_INT(ctx->Color.ClearColor[2]); - params[3] = FLOAT_TO_INT(ctx->Color.ClearColor[3]); - break; - case GL_COLOR_MATERIAL: - params[0] = BOOLEAN_TO_INT(ctx->Light.ColorMaterialEnabled); - break; - case GL_COLOR_MATERIAL_FACE: - params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialFace); - break; - case GL_COLOR_MATERIAL_PARAMETER: - params[0] = ENUM_TO_INT(ctx->Light.ColorMaterialMode); - break; - case GL_COLOR_WRITEMASK: - params[0] = ctx->Color.ColorMask[0][RCOMP] ? 1 : 0; - params[1] = ctx->Color.ColorMask[0][GCOMP] ? 1 : 0; - params[2] = ctx->Color.ColorMask[0][BCOMP] ? 1 : 0; - params[3] = ctx->Color.ColorMask[0][ACOMP] ? 1 : 0; - break; - case GL_CULL_FACE: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.CullFlag); - break; - case GL_CULL_FACE_MODE: - params[0] = ENUM_TO_INT(ctx->Polygon.CullFaceMode); - break; - case GL_CURRENT_COLOR: - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); - params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); - params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); - params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); - } - break; - case GL_CURRENT_INDEX: - { - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); - } - break; - case GL_CURRENT_NORMAL: - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); - params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); - params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); - } - break; - case GL_CURRENT_RASTER_COLOR: - params[0] = FLOAT_TO_INT(ctx->Current.RasterColor[0]); - params[1] = FLOAT_TO_INT(ctx->Current.RasterColor[1]); - params[2] = FLOAT_TO_INT(ctx->Current.RasterColor[2]); - params[3] = FLOAT_TO_INT(ctx->Current.RasterColor[3]); - break; - case GL_CURRENT_RASTER_DISTANCE: - params[0] = IROUND(ctx->Current.RasterDistance); - break; - case GL_CURRENT_RASTER_INDEX: - params[0] = IROUND(1.0); - break; - case GL_CURRENT_RASTER_POSITION: - params[0] = IROUND(ctx->Current.RasterPos[0]); - params[1] = IROUND(ctx->Current.RasterPos[1]); - params[2] = IROUND(ctx->Current.RasterPos[2]); - params[3] = IROUND(ctx->Current.RasterPos[3]); - break; - case GL_CURRENT_RASTER_SECONDARY_COLOR: - params[0] = FLOAT_TO_INT(ctx->Current.RasterSecondaryColor[0]); - params[1] = FLOAT_TO_INT(ctx->Current.RasterSecondaryColor[1]); - params[2] = FLOAT_TO_INT(ctx->Current.RasterSecondaryColor[2]); - params[3] = FLOAT_TO_INT(ctx->Current.RasterSecondaryColor[3]); - break; - case GL_CURRENT_RASTER_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(raster tex coords, unit %u)", unit); - return; - } - params[0] = IROUND(ctx->Current.RasterTexCoords[unit][0]); - params[1] = IROUND(ctx->Current.RasterTexCoords[unit][1]); - params[2] = IROUND(ctx->Current.RasterTexCoords[unit][2]); - params[3] = IROUND(ctx->Current.RasterTexCoords[unit][3]); - } - break; - case GL_CURRENT_RASTER_POSITION_VALID: - params[0] = BOOLEAN_TO_INT(ctx->Current.RasterPosValid); - break; - case GL_CURRENT_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(current tex coords, unit %u)", unit); - return; - } - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]); - params[1] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]); - params[2] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]); - params[3] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]); - } - break; - case GL_DEPTH_BIAS: - params[0] = IROUND(ctx->Pixel.DepthBias); - break; - case GL_DEPTH_BITS: - params[0] = ctx->DrawBuffer->Visual.depthBits; - break; - case GL_DEPTH_CLEAR_VALUE: - params[0] = FLOAT_TO_INT(((GLfloat) ctx->Depth.Clear)); - break; - case GL_DEPTH_FUNC: - params[0] = ENUM_TO_INT(ctx->Depth.Func); - break; - case GL_DEPTH_RANGE: - params[0] = FLOAT_TO_INT(ctx->Viewport.Near); - params[1] = FLOAT_TO_INT(ctx->Viewport.Far); - break; - case GL_DEPTH_SCALE: - params[0] = IROUND(ctx->Pixel.DepthScale); - break; - case GL_DEPTH_TEST: - params[0] = BOOLEAN_TO_INT(ctx->Depth.Test); - break; - case GL_DEPTH_WRITEMASK: - params[0] = BOOLEAN_TO_INT(ctx->Depth.Mask); - break; - case GL_DITHER: - params[0] = BOOLEAN_TO_INT(ctx->Color.DitherFlag); - break; - case GL_DOUBLEBUFFER: - params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.doubleBufferMode); - break; - case GL_DRAW_BUFFER: - params[0] = ENUM_TO_INT(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_EDGE_FLAG: - { - FLUSH_CURRENT(ctx, 0); - params[0] = BOOLEAN_TO_INT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); - } - break; - case GL_FEEDBACK_BUFFER_SIZE: - params[0] = ctx->Feedback.BufferSize; - break; - case GL_FEEDBACK_BUFFER_TYPE: - params[0] = ENUM_TO_INT(ctx->Feedback.Type); - break; - case GL_FOG: - params[0] = BOOLEAN_TO_INT(ctx->Fog.Enabled); - break; - case GL_FOG_COLOR: - params[0] = FLOAT_TO_INT(ctx->Fog.Color[0]); - params[1] = FLOAT_TO_INT(ctx->Fog.Color[1]); - params[2] = FLOAT_TO_INT(ctx->Fog.Color[2]); - params[3] = FLOAT_TO_INT(ctx->Fog.Color[3]); - break; - case GL_FOG_DENSITY: - params[0] = IROUND(ctx->Fog.Density); - break; - case GL_FOG_END: - params[0] = IROUND(ctx->Fog.End); - break; - case GL_FOG_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.Fog); - break; - case GL_FOG_INDEX: - params[0] = IROUND(ctx->Fog.Index); - break; - case GL_FOG_MODE: - params[0] = ENUM_TO_INT(ctx->Fog.Mode); - break; - case GL_FOG_START: - params[0] = IROUND(ctx->Fog.Start); - break; - case GL_FRONT_FACE: - params[0] = ENUM_TO_INT(ctx->Polygon.FrontFace); - break; - case GL_GREEN_BIAS: - params[0] = IROUND(ctx->Pixel.GreenBias); - break; - case GL_GREEN_BITS: - params[0] = ctx->DrawBuffer->Visual.greenBits; - break; - case GL_GREEN_SCALE: - params[0] = IROUND(ctx->Pixel.GreenScale); - break; - case GL_INDEX_BITS: - params[0] = ctx->DrawBuffer->Visual.indexBits; - break; - case GL_INDEX_CLEAR_VALUE: - params[0] = ctx->Color.ClearIndex; - break; - case GL_INDEX_MODE: - params[0] = BOOLEAN_TO_INT(GL_FALSE); - break; - case GL_INDEX_OFFSET: - params[0] = ctx->Pixel.IndexOffset; - break; - case GL_INDEX_SHIFT: - params[0] = ctx->Pixel.IndexShift; - break; - case GL_INDEX_WRITEMASK: - params[0] = ctx->Color.IndexMask; - break; - case GL_LIGHT0: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[0].Enabled); - break; - case GL_LIGHT1: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[1].Enabled); - break; - case GL_LIGHT2: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[2].Enabled); - break; - case GL_LIGHT3: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[3].Enabled); - break; - case GL_LIGHT4: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[4].Enabled); - break; - case GL_LIGHT5: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[5].Enabled); - break; - case GL_LIGHT6: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[6].Enabled); - break; - case GL_LIGHT7: - params[0] = BOOLEAN_TO_INT(ctx->Light.Light[7].Enabled); - break; - case GL_LIGHTING: - params[0] = BOOLEAN_TO_INT(ctx->Light.Enabled); - break; - case GL_LIGHT_MODEL_AMBIENT: - params[0] = FLOAT_TO_INT(ctx->Light.Model.Ambient[0]); - params[1] = FLOAT_TO_INT(ctx->Light.Model.Ambient[1]); - params[2] = FLOAT_TO_INT(ctx->Light.Model.Ambient[2]); - params[3] = FLOAT_TO_INT(ctx->Light.Model.Ambient[3]); - break; - case GL_LIGHT_MODEL_COLOR_CONTROL: - params[0] = ENUM_TO_INT(ctx->Light.Model.ColorControl); - break; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - params[0] = BOOLEAN_TO_INT(ctx->Light.Model.LocalViewer); - break; - case GL_LIGHT_MODEL_TWO_SIDE: - params[0] = BOOLEAN_TO_INT(ctx->Light.Model.TwoSide); - break; - case GL_LINE_SMOOTH: - params[0] = BOOLEAN_TO_INT(ctx->Line.SmoothFlag); - break; - case GL_LINE_SMOOTH_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.LineSmooth); - break; - case GL_LINE_STIPPLE: - params[0] = BOOLEAN_TO_INT(ctx->Line.StippleFlag); - break; - case GL_LINE_STIPPLE_PATTERN: - params[0] = ctx->Line.StipplePattern; - break; - case GL_LINE_STIPPLE_REPEAT: - params[0] = ctx->Line.StippleFactor; - break; - case GL_LINE_WIDTH: - params[0] = IROUND(ctx->Line.Width); - break; - case GL_LINE_WIDTH_GRANULARITY: - params[0] = IROUND(ctx->Const.LineWidthGranularity); - break; - case GL_LINE_WIDTH_RANGE: - params[0] = IROUND(ctx->Const.MinLineWidthAA); - params[1] = IROUND(ctx->Const.MaxLineWidthAA); - break; - case GL_ALIASED_LINE_WIDTH_RANGE: - params[0] = IROUND(ctx->Const.MinLineWidth); - params[1] = IROUND(ctx->Const.MaxLineWidth); - break; - case GL_LIST_BASE: - params[0] = ctx->List.ListBase; - break; - case GL_LIST_INDEX: - params[0] = (ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0); - break; - case GL_LIST_MODE: - { - GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE; - params[0] = ENUM_TO_INT(mode); - } - break; - case GL_INDEX_LOGIC_OP: - params[0] = BOOLEAN_TO_INT(ctx->Color.IndexLogicOpEnabled); - break; - case GL_COLOR_LOGIC_OP: - params[0] = BOOLEAN_TO_INT(ctx->Color.ColorLogicOpEnabled); - break; - case GL_LOGIC_OP_MODE: - params[0] = ENUM_TO_INT(ctx->Color.LogicOp); - break; - case GL_MAP1_COLOR_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Color4); - break; - case GL_MAP1_GRID_DOMAIN: - params[0] = IROUND(ctx->Eval.MapGrid1u1); - params[1] = IROUND(ctx->Eval.MapGrid1u2); - break; - case GL_MAP1_GRID_SEGMENTS: - params[0] = ctx->Eval.MapGrid1un; - break; - case GL_MAP1_INDEX: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Index); - break; - case GL_MAP1_NORMAL: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Normal); - break; - case GL_MAP1_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord1); - break; - case GL_MAP1_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord2); - break; - case GL_MAP1_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord3); - break; - case GL_MAP1_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1TextureCoord4); - break; - case GL_MAP1_VERTEX_3: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex3); - break; - case GL_MAP1_VERTEX_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Vertex4); - break; - case GL_MAP2_COLOR_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Color4); - break; - case GL_MAP2_GRID_DOMAIN: - params[0] = IROUND(ctx->Eval.MapGrid2u1); - params[1] = IROUND(ctx->Eval.MapGrid2u2); - params[2] = IROUND(ctx->Eval.MapGrid2v1); - params[3] = IROUND(ctx->Eval.MapGrid2v2); - break; - case GL_MAP2_GRID_SEGMENTS: - params[0] = ctx->Eval.MapGrid2un; - params[1] = ctx->Eval.MapGrid2vn; - break; - case GL_MAP2_INDEX: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Index); - break; - case GL_MAP2_NORMAL: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Normal); - break; - case GL_MAP2_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord1); - break; - case GL_MAP2_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord2); - break; - case GL_MAP2_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord3); - break; - case GL_MAP2_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2TextureCoord4); - break; - case GL_MAP2_VERTEX_3: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex3); - break; - case GL_MAP2_VERTEX_4: - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map2Vertex4); - break; - case GL_MAP_COLOR: - params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapColorFlag); - break; - case GL_MAP_STENCIL: - params[0] = BOOLEAN_TO_INT(ctx->Pixel.MapStencilFlag); - break; - case GL_MATRIX_MODE: - params[0] = ENUM_TO_INT(ctx->Transform.MatrixMode); - break; - case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = MAX_ATTRIB_STACK_DEPTH; - break; - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = MAX_CLIENT_ATTRIB_STACK_DEPTH; - break; - case GL_MAX_CLIP_PLANES: - params[0] = ctx->Const.MaxClipPlanes; - break; - case GL_MAX_ELEMENTS_VERTICES: - params[0] = ctx->Const.MaxArrayLockSize; - break; - case GL_MAX_ELEMENTS_INDICES: - params[0] = ctx->Const.MaxArrayLockSize; - break; - case GL_MAX_EVAL_ORDER: - params[0] = MAX_EVAL_ORDER; - break; - case GL_MAX_LIGHTS: - params[0] = ctx->Const.MaxLights; - break; - case GL_MAX_LIST_NESTING: - params[0] = MAX_LIST_NESTING; - break; - case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = MAX_MODELVIEW_STACK_DEPTH; - break; - case GL_MAX_NAME_STACK_DEPTH: - params[0] = MAX_NAME_STACK_DEPTH; - break; - case GL_MAX_PIXEL_MAP_TABLE: - params[0] = MAX_PIXEL_MAP_TABLE; - break; - case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = MAX_PROJECTION_STACK_DEPTH; - break; - case GL_MAX_TEXTURE_SIZE: - params[0] = 1 << (ctx->Const.MaxTextureLevels - 1); - break; - case GL_MAX_3D_TEXTURE_SIZE: - params[0] = 1 << (ctx->Const.Max3DTextureLevels - 1); - break; - case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = MAX_TEXTURE_STACK_DEPTH; - break; - case GL_MAX_VIEWPORT_DIMS: - params[0] = ctx->Const.MaxViewportWidth; - params[1] = ctx->Const.MaxViewportHeight; - break; - case GL_MODELVIEW_MATRIX: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_MODELVIEW_STACK_DEPTH: - params[0] = ctx->ModelviewMatrixStack.Depth + 1; - break; - case GL_NAME_STACK_DEPTH: - params[0] = ctx->Select.NameStackDepth; - break; - case GL_NORMALIZE: - params[0] = BOOLEAN_TO_INT(ctx->Transform.Normalize); - break; - case GL_PACK_ALIGNMENT: - params[0] = ctx->Pack.Alignment; - break; - case GL_PACK_LSB_FIRST: - params[0] = BOOLEAN_TO_INT(ctx->Pack.LsbFirst); - break; - case GL_PACK_ROW_LENGTH: - params[0] = ctx->Pack.RowLength; - break; - case GL_PACK_SKIP_PIXELS: - params[0] = ctx->Pack.SkipPixels; - break; - case GL_PACK_SKIP_ROWS: - params[0] = ctx->Pack.SkipRows; - break; - case GL_PACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_INT(ctx->Pack.SwapBytes); - break; - case GL_PACK_SKIP_IMAGES_EXT: - params[0] = ctx->Pack.SkipImages; - break; - case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = ctx->Pack.ImageHeight; - break; - case GL_PACK_INVERT_MESA: - params[0] = BOOLEAN_TO_INT(ctx->Pack.Invert); - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.PerspectiveCorrection); - break; - case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = ctx->PixelMaps.AtoA.Size; - break; - case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = ctx->PixelMaps.BtoB.Size; - break; - case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = ctx->PixelMaps.GtoG.Size; - break; - case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = ctx->PixelMaps.ItoA.Size; - break; - case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = ctx->PixelMaps.ItoB.Size; - break; - case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = ctx->PixelMaps.ItoG.Size; - break; - case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = ctx->PixelMaps.ItoI.Size; - break; - case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = ctx->PixelMaps.ItoR.Size; - break; - case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = ctx->PixelMaps.RtoR.Size; - break; - case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = ctx->PixelMaps.StoS.Size; - break; - case GL_POINT_SIZE: - params[0] = IROUND(ctx->Point.Size); - break; - case GL_POINT_SIZE_GRANULARITY: - params[0] = IROUND(ctx->Const.PointSizeGranularity); - break; - case GL_POINT_SIZE_RANGE: - params[0] = IROUND(ctx->Const.MinPointSizeAA); - params[1] = IROUND(ctx->Const.MaxPointSizeAA); - break; - case GL_ALIASED_POINT_SIZE_RANGE: - params[0] = IROUND(ctx->Const.MinPointSize); - params[1] = IROUND(ctx->Const.MaxPointSize); - break; - case GL_POINT_SMOOTH: - params[0] = BOOLEAN_TO_INT(ctx->Point.SmoothFlag); - break; - case GL_POINT_SMOOTH_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.PointSmooth); - break; - case GL_POINT_SIZE_MIN_EXT: - params[0] = IROUND(ctx->Point.MinSize); - break; - case GL_POINT_SIZE_MAX_EXT: - params[0] = IROUND(ctx->Point.MaxSize); - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - params[0] = IROUND(ctx->Point.Threshold); - break; - case GL_DISTANCE_ATTENUATION_EXT: - params[0] = IROUND(ctx->Point.Params[0]); - params[1] = IROUND(ctx->Point.Params[1]); - params[2] = IROUND(ctx->Point.Params[2]); - break; - case GL_POLYGON_MODE: - params[0] = ENUM_TO_INT(ctx->Polygon.FrontMode); - params[1] = ENUM_TO_INT(ctx->Polygon.BackMode); - break; - case GL_POLYGON_OFFSET_BIAS_EXT: - params[0] = IROUND(ctx->Polygon.OffsetUnits); - break; - case GL_POLYGON_OFFSET_FACTOR: - params[0] = IROUND(ctx->Polygon.OffsetFactor ); - break; - case GL_POLYGON_OFFSET_UNITS: - params[0] = IROUND(ctx->Polygon.OffsetUnits ); - break; - case GL_POLYGON_OFFSET_POINT: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetPoint); - break; - case GL_POLYGON_OFFSET_LINE: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetLine); - break; - case GL_POLYGON_OFFSET_FILL: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.OffsetFill); - break; - case GL_POLYGON_SMOOTH: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.SmoothFlag); - break; - case GL_POLYGON_SMOOTH_HINT: - params[0] = ENUM_TO_INT(ctx->Hint.PolygonSmooth); - break; - case GL_POLYGON_STIPPLE: - params[0] = BOOLEAN_TO_INT(ctx->Polygon.StippleFlag); - break; - case GL_PROJECTION_MATRIX: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_PROJECTION_STACK_DEPTH: - params[0] = ctx->ProjectionMatrixStack.Depth + 1; - break; - case GL_READ_BUFFER: - params[0] = ENUM_TO_INT(ctx->ReadBuffer->ColorReadBuffer); - break; - case GL_RED_BIAS: - params[0] = IROUND(ctx->Pixel.RedBias); - break; - case GL_RED_BITS: - params[0] = ctx->DrawBuffer->Visual.redBits; - break; - case GL_RED_SCALE: - params[0] = IROUND(ctx->Pixel.RedScale); - break; - case GL_RENDER_MODE: - params[0] = ENUM_TO_INT(ctx->RenderMode); - break; - case GL_RESCALE_NORMAL: - params[0] = BOOLEAN_TO_INT(ctx->Transform.RescaleNormals); - break; - case GL_RGBA_MODE: - params[0] = BOOLEAN_TO_INT(GL_TRUE); - break; - case GL_SCISSOR_BOX: - params[0] = ctx->Scissor.X; - params[1] = ctx->Scissor.Y; - params[2] = ctx->Scissor.Width; - params[3] = ctx->Scissor.Height; - break; - case GL_SCISSOR_TEST: - params[0] = BOOLEAN_TO_INT(ctx->Scissor.Enabled); - break; - case GL_SELECTION_BUFFER_SIZE: - params[0] = ctx->Select.BufferSize; - break; - case GL_SHADE_MODEL: - params[0] = ENUM_TO_INT(ctx->Light.ShadeModel); - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - params[0] = BOOLEAN_TO_INT(ctx->Texture.SharedPalette); - break; - case GL_STENCIL_BITS: - params[0] = ctx->DrawBuffer->Visual.stencilBits; - break; - case GL_STENCIL_CLEAR_VALUE: - params[0] = ctx->Stencil.Clear; - break; - case GL_STENCIL_FAIL: - params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_FUNC: - params[0] = ENUM_TO_INT(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_PASS: - params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_REF: - params[0] = ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; - break; - case GL_STENCIL_TEST: - params[0] = BOOLEAN_TO_INT(ctx->Stencil.Enabled); - break; - case GL_STENCIL_VALUE_MASK: - params[0] = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; - break; - case GL_STENCIL_WRITEMASK: - params[0] = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; - break; - case GL_STEREO: - params[0] = BOOLEAN_TO_INT(ctx->DrawBuffer->Visual.stereoMode); - break; - case GL_SUBPIXEL_BITS: - params[0] = ctx->Const.SubPixelBits; - break; - case GL_TEXTURE_1D: - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D)); - break; - case GL_TEXTURE_2D: - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D)); - break; - case GL_TEXTURE_3D: - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_3D)); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); - break; - case GL_TEXTURE_BINDING_1D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name; - break; - case GL_TEXTURE_BINDING_2D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name; - break; - case GL_TEXTURE_BINDING_3D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name; - break; - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetIntegerv"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name; - break; - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetIntegerv"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name; - break; - case GL_TEXTURE_GEN_S: - params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_T: - params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_R: - params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_Q: - params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_MATRIX: - { - const GLfloat *matrix; - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)", - unit); - return; - } - matrix = ctx->TextureMatrixStack[unit].Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TEXTURE_STACK_DEPTH: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(texture stack depth, unit %u)", unit); - return; - } - params[0] = ctx->TextureMatrixStack[unit].Depth + 1; - } - break; - case GL_UNPACK_ALIGNMENT: - params[0] = ctx->Unpack.Alignment; - break; - case GL_UNPACK_LSB_FIRST: - params[0] = BOOLEAN_TO_INT(ctx->Unpack.LsbFirst); - break; - case GL_UNPACK_ROW_LENGTH: - params[0] = ctx->Unpack.RowLength; - break; - case GL_UNPACK_SKIP_PIXELS: - params[0] = ctx->Unpack.SkipPixels; - break; - case GL_UNPACK_SKIP_ROWS: - params[0] = ctx->Unpack.SkipRows; - break; - case GL_UNPACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_INT(ctx->Unpack.SwapBytes); - break; - case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = ctx->Unpack.SkipImages; - break; - case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = ctx->Unpack.ImageHeight; - break; - case GL_UNPACK_CLIENT_STORAGE_APPLE: - params[0] = BOOLEAN_TO_INT(ctx->Unpack.ClientStorage); - break; - case GL_VIEWPORT: - params[0] = ctx->Viewport.X; - params[1] = ctx->Viewport.Y; - params[2] = ctx->Viewport.Width; - params[3] = ctx->Viewport.Height; - break; - case GL_ZOOM_X: - params[0] = IROUND(ctx->Pixel.ZoomX); - break; - case GL_ZOOM_Y: - params[0] = IROUND(ctx->Pixel.ZoomY); - break; - case GL_VERTEX_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->Vertex.Enabled); - break; - case GL_VERTEX_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->Vertex.Size; - break; - case GL_VERTEX_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Vertex.Type); - break; - case GL_VERTEX_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Vertex.Stride; - break; - case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_NORMAL_ARRAY: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Normal.Enabled); - break; - case GL_NORMAL_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Normal.Type); - break; - case GL_NORMAL_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Normal.Stride; - break; - case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_COLOR_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->Color.Enabled); - break; - case GL_COLOR_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->Color.Size; - break; - case GL_COLOR_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Color.Type); - break; - case GL_COLOR_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Color.Stride; - break; - case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_INDEX_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->Index.Enabled); - break; - case GL_INDEX_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->Index.Type); - break; - case GL_INDEX_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Index.Stride; - break; - case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_TEXTURE_COORD_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled); - break; - case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size; - break; - case GL_TEXTURE_COORD_ARRAY_TYPE: - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); - break; - case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride; - break; - case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_EDGE_FLAG_ARRAY: - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->EdgeFlag.Enabled); - break; - case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->EdgeFlag.Stride; - break; - case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = 0; - break; - case GL_MAX_TEXTURE_UNITS_ARB: - CHECK_EXT1(ARB_multitexture, "GetIntegerv"); - params[0] = ctx->Const.MaxTextureUnits; - break; - case GL_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture, "GetIntegerv"); - params[0] = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; - break; - case GL_CLIENT_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture, "GetIntegerv"); - params[0] = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); - break; - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetIntegerv"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name; - break; - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetIntegerv"); - params[0] = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); - break; - case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = ctx->Hint.TextureCompression; - break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = _mesa_get_compressed_formats(ctx, NULL, GL_FALSE); - break; - case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - { - GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT(formats[i]); - } - break; - case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: - CHECK_EXT1(EXT_compiled_vertex_array, "GetIntegerv"); - params[0] = ctx->Array.LockFirst; - break; - case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: - CHECK_EXT1(EXT_compiled_vertex_array, "GetIntegerv"); - params[0] = ctx->Array.LockCount; - break; - case GL_TRANSPOSE_COLOR_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - { - const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_COLOR_MATRIX_SGI: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = ctx->ColorMatrixStack.Depth + 1; - break; - case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = MAX_COLOR_STACK_DEPTH; - break; - case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixScale[3]); - break; - case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: - params[0] = IROUND(ctx->Pixel.PostColorMatrixBias[3]); - break; - case GL_CONVOLUTION_1D_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution1DEnabled); - break; - case GL_CONVOLUTION_2D_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.Convolution2DEnabled); - break; - case GL_SEPARABLE_2D_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.Separable2DEnabled); - break; - case GL_POST_CONVOLUTION_RED_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = IROUND(ctx->Pixel.PostConvolutionScale[0]); - break; - case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = IROUND(ctx->Pixel.PostConvolutionScale[1]); - break; - case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = IROUND(ctx->Pixel.PostConvolutionScale[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = IROUND(ctx->Pixel.PostConvolutionScale[3]); - break; - case GL_POST_CONVOLUTION_RED_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = IROUND(ctx->Pixel.PostConvolutionBias[0]); - break; - case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = IROUND(ctx->Pixel.PostConvolutionBias[1]); - break; - case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = IROUND(ctx->Pixel.PostConvolutionBias[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetIntegerv"); - params[0] = IROUND(ctx->Pixel.PostConvolutionBias[3]); - break; - case GL_HISTOGRAM: - CHECK_EXT1(EXT_histogram, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.HistogramEnabled); - break; - case GL_MINMAX: - CHECK_EXT1(EXT_histogram, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.MinMaxEnabled); - break; - case GL_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]); - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]); - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]); - break; - case GL_TEXTURE_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_texture_color_table, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); - break; - case GL_COLOR_SUM_EXT: - CHECK_EXT2(EXT_secondary_color, ARB_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Fog.ColorSumEnabled); - break; - case GL_CURRENT_SECONDARY_COLOR_EXT: - CHECK_EXT1(EXT_secondary_color, "GetIntegerv"); - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); - params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); - params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); - params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); - } - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - CHECK_EXT1(EXT_secondary_color, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->SecondaryColor.Enabled); - break; - case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetIntegerv"); - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->SecondaryColor.Type); - break; - case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetIntegerv"); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Stride; - break; - case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetIntegerv"); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Size; - break; - case GL_CURRENT_FOG_COORDINATE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetIntegerv"); - { - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); - } - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - CHECK_EXT1(EXT_fog_coord, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->FogCoord.Enabled); - break; - case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetIntegerv"); - params[0] = ENUM_TO_INT(ctx->Array.ArrayObj->FogCoord.Type); - break; - case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetIntegerv"); - params[0] = ctx->Array.ArrayObj->FogCoord.Stride; - break; - case GL_FOG_COORDINATE_SOURCE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetIntegerv"); - params[0] = ENUM_TO_INT(ctx->Fog.FogCoordinateSource); - break; - case GL_MAX_TEXTURE_LOD_BIAS_EXT: - CHECK_EXT1(EXT_texture_lod_bias, "GetIntegerv"); - params[0] = IROUND(ctx->Const.MaxTextureLodBias); - break; - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - CHECK_EXT1(EXT_texture_filter_anisotropic, "GetIntegerv"); - params[0] = IROUND(ctx->Const.MaxTextureMaxAnisotropy); - break; - case GL_MULTISAMPLE_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.Enabled); - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToCoverage); - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleAlphaToOne); - break; - case GL_SAMPLE_COVERAGE_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverage); - break; - case GL_SAMPLE_COVERAGE_VALUE_ARB: - params[0] = IROUND(ctx->Multisample.SampleCoverageValue); - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - params[0] = BOOLEAN_TO_INT(ctx->Multisample.SampleCoverageInvert); - break; - case GL_SAMPLE_BUFFERS_ARB: - params[0] = ctx->DrawBuffer->Visual.sampleBuffers; - break; - case GL_SAMPLES_ARB: - params[0] = ctx->DrawBuffer->Visual.samples; - break; - case GL_RASTER_POSITION_UNCLIPPED_IBM: - CHECK_EXT1(IBM_rasterpos_clip, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Transform.RasterPositionUnclipped); - break; - case GL_POINT_SPRITE_NV: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Point.PointSprite); - break; - case GL_POINT_SPRITE_R_MODE_NV: - CHECK_EXT1(NV_point_sprite, "GetIntegerv"); - params[0] = ENUM_TO_INT(ctx->Point.SpriteRMode); - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetIntegerv"); - params[0] = ENUM_TO_INT(ctx->Point.SpriteOrigin); - break; - case GL_GENERATE_MIPMAP_HINT_SGIS: - CHECK_EXT1(SGIS_generate_mipmap, "GetIntegerv"); - params[0] = ENUM_TO_INT(ctx->Hint.GenerateMipmap); - break; - case GL_VERTEX_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = (ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0); - break; - case GL_VERTEX_ATTRIB_ARRAY0_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[0].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY1_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[1].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY2_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[2].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY3_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[3].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[4].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY5_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[5].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY6_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[6].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY7_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[7].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY8_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[8].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY9_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[9].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY10_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[10].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY11_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[11].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY12_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[12].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY13_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[13].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY14_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[14].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Array.ArrayObj->VertexAttrib[15].Enabled); - break; - case GL_MAP1_VERTEX_ATTRIB0_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[0]); - break; - case GL_MAP1_VERTEX_ATTRIB1_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[1]); - break; - case GL_MAP1_VERTEX_ATTRIB2_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[2]); - break; - case GL_MAP1_VERTEX_ATTRIB3_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[3]); - break; - case GL_MAP1_VERTEX_ATTRIB4_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[4]); - break; - case GL_MAP1_VERTEX_ATTRIB5_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[5]); - break; - case GL_MAP1_VERTEX_ATTRIB6_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[6]); - break; - case GL_MAP1_VERTEX_ATTRIB7_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[7]); - break; - case GL_MAP1_VERTEX_ATTRIB8_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[8]); - break; - case GL_MAP1_VERTEX_ATTRIB9_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[9]); - break; - case GL_MAP1_VERTEX_ATTRIB10_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[10]); - break; - case GL_MAP1_VERTEX_ATTRIB11_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[11]); - break; - case GL_MAP1_VERTEX_ATTRIB12_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[12]); - break; - case GL_MAP1_VERTEX_ATTRIB13_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[13]); - break; - case GL_MAP1_VERTEX_ATTRIB14_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[14]); - break; - case GL_MAP1_VERTEX_ATTRIB15_4_NV: - CHECK_EXT1(NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Eval.Map1Attrib[15]); - break; - case GL_FRAGMENT_PROGRAM_NV: - CHECK_EXT1(NV_fragment_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled); - break; - case GL_FRAGMENT_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_fragment_program, "GetIntegerv"); - params[0] = ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0; - break; - case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: - CHECK_EXT1(NV_fragment_program, "GetIntegerv"); - params[0] = MAX_NV_FRAGMENT_PROGRAM_PARAMS; - break; - case GL_TEXTURE_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); - break; - case GL_TEXTURE_BINDING_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetIntegerv"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name; - break; - case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetIntegerv"); - params[0] = ctx->Const.MaxTextureRectSize; - break; - case GL_STENCIL_TEST_TWO_SIDE_EXT: - CHECK_EXT1(EXT_stencil_two_side, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Stencil.TestTwoSide); - break; - case GL_ACTIVE_STENCIL_FACE_EXT: - CHECK_EXT1(EXT_stencil_two_side, "GetIntegerv"); - params[0] = ENUM_TO_INT(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); - break; - case GL_MAX_SHININESS_NV: - CHECK_EXT1(NV_light_max_exponent, "GetIntegerv"); - params[0] = IROUND(ctx->Const.MaxShininess); - break; - case GL_MAX_SPOT_EXPONENT_NV: - CHECK_EXT1(NV_light_max_exponent, "GetIntegerv"); - params[0] = IROUND(ctx->Const.MaxSpotExponent); - break; - case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayBufferObj->Name; - break; - case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Vertex.BufferObj->Name; - break; - case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Normal.BufferObj->Name; - break; - case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Color.BufferObj->Name; - break; - case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Index.BufferObj->Name; - break; - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name; - break; - case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name; - break; - case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name; - break; - case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->FogCoord.BufferObj->Name; - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ElementArrayBufferObj->Name; - break; - case GL_PIXEL_PACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object, "GetIntegerv"); - params[0] = ctx->Pack.BufferObj->Name; - break; - case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object, "GetIntegerv"); - params[0] = ctx->Unpack.BufferObj->Name; - break; - case GL_VERTEX_PROGRAM_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.Enabled); - break; - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.PointSizeEnabled); - break; - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->VertexProgram.TwoSideEnabled); - break; - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetIntegerv"); - params[0] = ctx->Const.MaxProgramMatrixStackDepth; - break; - case GL_MAX_PROGRAM_MATRICES_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetIntegerv"); - params[0] = ctx->Const.MaxProgramMatrices; - break; - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->CurrentStack->Depth + 1); - break; - case GL_CURRENT_MATRIX_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_fragment_program, "GetIntegerv"); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[1]); - params[2] = IROUND(matrix[2]); - params[3] = IROUND(matrix[3]); - params[4] = IROUND(matrix[4]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[6]); - params[7] = IROUND(matrix[7]); - params[8] = IROUND(matrix[8]); - params[9] = IROUND(matrix[9]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[11]); - params[12] = IROUND(matrix[12]); - params[13] = IROUND(matrix[13]); - params[14] = IROUND(matrix[14]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - CHECK_EXT2(ARB_vertex_program, ARB_fragment_program, "GetIntegerv"); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = IROUND(matrix[0]); - params[1] = IROUND(matrix[4]); - params[2] = IROUND(matrix[8]); - params[3] = IROUND(matrix[12]); - params[4] = IROUND(matrix[1]); - params[5] = IROUND(matrix[5]); - params[6] = IROUND(matrix[9]); - params[7] = IROUND(matrix[13]); - params[8] = IROUND(matrix[2]); - params[9] = IROUND(matrix[6]); - params[10] = IROUND(matrix[10]); - params[11] = IROUND(matrix[14]); - params[12] = IROUND(matrix[3]); - params[13] = IROUND(matrix[7]); - params[14] = IROUND(matrix[11]); - params[15] = IROUND(matrix[15]); - } - break; - case GL_MAX_VERTEX_ATTRIBS_ARB: - CHECK_EXT1(ARB_vertex_program, "GetIntegerv"); - params[0] = ctx->Const.VertexProgram.MaxAttribs; - break; - case GL_PROGRAM_ERROR_POSITION_ARB: - CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program, "GetIntegerv"); - params[0] = ctx->Program.ErrorPos; - break; - case GL_FRAGMENT_PROGRAM_ARB: - CHECK_EXT1(ARB_fragment_program, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->FragmentProgram.Enabled); - break; - case GL_MAX_TEXTURE_COORDS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetIntegerv"); - params[0] = ctx->Const.MaxTextureCoordUnits; - break; - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetIntegerv"); - params[0] = ctx->Const.MaxTextureImageUnits; - break; - case GL_DEPTH_BOUNDS_TEST_EXT: - CHECK_EXT1(EXT_depth_bounds_test, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Depth.BoundsTest); - break; - case GL_DEPTH_BOUNDS_EXT: - CHECK_EXT1(EXT_depth_bounds_test, "GetIntegerv"); - params[0] = IROUND(ctx->Depth.BoundsMin); - params[1] = IROUND(ctx->Depth.BoundsMax); - break; - case GL_DEPTH_CLAMP: - CHECK_EXT1(ARB_depth_clamp, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Transform.DepthClamp); - break; - case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = ctx->Const.MaxDrawBuffers; - break; - case GL_DRAW_BUFFER0_ARB: - params[0] = ENUM_TO_INT(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_DRAW_BUFFER1_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[1]; - params[0] = ENUM_TO_INT(buffer); - } - break; - case GL_DRAW_BUFFER2_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[2]; - params[0] = ENUM_TO_INT(buffer); - } - break; - case GL_DRAW_BUFFER3_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[3]; - params[0] = ENUM_TO_INT(buffer); - } - break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - CHECK_EXT1(OES_read_format, "GetIntegerv"); - params[0] = _mesa_get_color_read_type(ctx); - break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - CHECK_EXT1(OES_read_format, "GetIntegerv"); - params[0] = _mesa_get_color_read_format(ctx); - break; - case GL_NUM_FRAGMENT_REGISTERS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); - params[0] = 6; - break; - case GL_NUM_FRAGMENT_CONSTANTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); - params[0] = 8; - break; - case GL_NUM_PASSES_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); - params[0] = 2; - break; - case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); - params[0] = 8; - break; - case GL_NUM_INSTRUCTIONS_TOTAL_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); - params[0] = 16; - break; - case GL_COLOR_ALPHA_PAIRING_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(GL_TRUE); - break; - case GL_NUM_LOOPBACK_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); - params[0] = 3; - break; - case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); - params[0] = 3; - break; - case GL_STENCIL_BACK_FUNC: - params[0] = ENUM_TO_INT(ctx->Stencil.Function[1]); - break; - case GL_STENCIL_BACK_VALUE_MASK: - params[0] = ctx->Stencil.ValueMask[1]; - break; - case GL_STENCIL_BACK_WRITEMASK: - params[0] = ctx->Stencil.WriteMask[1]; - break; - case GL_STENCIL_BACK_REF: - params[0] = ctx->Stencil.Ref[1]; - break; - case GL_STENCIL_BACK_FAIL: - params[0] = ENUM_TO_INT(ctx->Stencil.FailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_INT(ctx->Stencil.ZFailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: - params[0] = ENUM_TO_INT(ctx->Stencil.ZPassFunc[1]); - break; - case GL_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetIntegerv"); - params[0] = ctx->DrawBuffer->Name; - break; - case GL_RENDERBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetIntegerv"); - params[0] = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; - break; - case GL_MAX_COLOR_ATTACHMENTS_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetIntegerv"); - params[0] = ctx->Const.MaxColorAttachments; - break; - case GL_MAX_RENDERBUFFER_SIZE_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetIntegerv"); - params[0] = ctx->Const.MaxRenderbufferSize; - break; - case GL_READ_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_blit, "GetIntegerv"); - params[0] = ctx->ReadBuffer->Name; - break; - case GL_PROVOKING_VERTEX_EXT: - CHECK_EXT1(EXT_provoking_vertex, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Light.ProvokingVertex); - break; - case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: - CHECK_EXT1(EXT_provoking_vertex, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Const.QuadsFollowProvokingVertexConvention); - break; - case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_fragment_shader, "GetIntegerv"); - params[0] = ctx->Const.FragmentProgram.MaxUniformComponents; - break; - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: - CHECK_EXT1(ARB_fragment_shader, "GetIntegerv"); - params[0] = ENUM_TO_INT(ctx->Hint.FragmentShaderDerivative); - break; - case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); - params[0] = ctx->Const.VertexProgram.MaxUniformComponents; - break; - case GL_MAX_VARYING_FLOATS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); - params[0] = ctx->Const.MaxVarying * 4; - break; - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); - params[0] = ctx->Const.MaxVertexTextureImageUnits; - break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); - params[0] = ctx->Const.MaxCombinedTextureImageUnits; - break; - case GL_CURRENT_PROGRAM: - CHECK_EXT1(ARB_shader_objects, "GetIntegerv"); - params[0] = ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0; - break; - case GL_MAX_SAMPLES: - CHECK_EXT1(ARB_framebuffer_object, "GetIntegerv"); - params[0] = ctx->Const.MaxSamples; - break; - case GL_VERTEX_ARRAY_BINDING_APPLE: - CHECK_EXT1(APPLE_vertex_array_object, "GetIntegerv"); - params[0] = ctx->Array.ArrayObj->Name; - break; - case GL_TEXTURE_CUBE_MAP_SEAMLESS: - CHECK_EXT1(ARB_seamless_cube_map, "GetIntegerv"); - params[0] = BOOLEAN_TO_INT(ctx->Texture.CubeMapSeamless); - break; - case GL_MAX_SERVER_WAIT_TIMEOUT: - CHECK_EXT1(ARB_sync, "GetIntegerv"); - params[0] = INT64_TO_INT(ctx->Const.MaxServerWaitTimeout); - break; - case GL_NUM_EXTENSIONS: - params[0] = _mesa_get_extension_count(ctx); - break; - case GL_MAJOR_VERSION: - params[0] = ctx->VersionMajor; - break; - case GL_MINOR_VERSION: - params[0] = ctx->VersionMinor; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); + case TYPE_DOUBLEN: + params[0] = FLOAT_TO_INT(((GLdouble *) p)[0]); + break; + + case TYPE_INT_4: + params[3] = ((GLint *) p)[3]; + case TYPE_INT_3: + params[2] = ((GLint *) p)[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = ((GLint *) p)[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = ((GLint *) p)[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = v.value_int_n.ints[i]; + break; + + case TYPE_INT64: + params[0] = INT64_TO_INT(((GLint64 *) p)[0]); + break; + + case TYPE_BOOLEAN: + params[0] = BOOLEAN_TO_INT(*(GLboolean*) p); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_INT(m->m[i]); + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_INT(m->m[transpose[i]]); + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = (*(GLbitfield *) p >> shift) & 1; + break; } } #if FEATURE_ARB_sync void GLAPIENTRY -_mesa_GetInteger64v( GLenum pname, GLint64 *params ) +_mesa_GetInteger64v(GLenum pname, GLint64 *params) { - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; - if (!params) - return; + d = find_value("glGetInteger64v", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = d->offset; + break; - if (ctx->NewState) - _mesa_update_state(ctx); + case TYPE_FLOAT_4: + params[3] = IROUND64(((GLfloat *) p)[3]); + case TYPE_FLOAT_3: + params[2] = IROUND64(((GLfloat *) p)[2]); + case TYPE_FLOAT_2: + params[1] = IROUND64(((GLfloat *) p)[1]); + case TYPE_FLOAT: + params[0] = IROUND64(((GLfloat *) p)[0]); + break; - if (ctx->Driver.GetInteger64v && - ctx->Driver.GetInteger64v(ctx, pname, params)) - return; + case TYPE_FLOATN_4: + params[3] = FLOAT_TO_INT64(((GLfloat *) p)[3]); + case TYPE_FLOATN_3: + params[2] = FLOAT_TO_INT64(((GLfloat *) p)[2]); + case TYPE_FLOATN_2: + params[1] = FLOAT_TO_INT64(((GLfloat *) p)[1]); + case TYPE_FLOATN: + params[0] = FLOAT_TO_INT64(((GLfloat *) p)[0]); + break; - switch (pname) { - case GL_ACCUM_RED_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumRedBits); - break; - case GL_ACCUM_GREEN_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumGreenBits); - break; - case GL_ACCUM_BLUE_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumBlueBits); - break; - case GL_ACCUM_ALPHA_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumAlphaBits); - break; - case GL_ACCUM_CLEAR_VALUE: - params[0] = FLOAT_TO_INT64(ctx->Accum.ClearColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Accum.ClearColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Accum.ClearColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Accum.ClearColor[3]); - break; - case GL_ALPHA_BIAS: - params[0] = IROUND64(ctx->Pixel.AlphaBias); - break; - case GL_ALPHA_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.alphaBits); - break; - case GL_ALPHA_SCALE: - params[0] = IROUND64(ctx->Pixel.AlphaScale); - break; - case GL_ALPHA_TEST: - params[0] = BOOLEAN_TO_INT64(ctx->Color.AlphaEnabled); - break; - case GL_ALPHA_TEST_FUNC: - params[0] = ENUM_TO_INT64(ctx->Color.AlphaFunc); - break; - case GL_ALPHA_TEST_REF: - params[0] = FLOAT_TO_INT64(ctx->Color.AlphaRef); - break; - case GL_ATTRIB_STACK_DEPTH: - params[0] = (GLint64)(ctx->AttribStackDepth); - break; - case GL_AUTO_NORMAL: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.AutoNormal); - break; - case GL_AUX_BUFFERS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.numAuxBuffers); - break; - case GL_BLEND: - params[0] = BOOLEAN_TO_INT64((ctx->Color.BlendEnabled & 1)); - break; - case GL_BLEND_DST: - params[0] = ENUM_TO_INT64(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC: - params[0] = ENUM_TO_INT64(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_SRC_RGB_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendSrcRGB); - break; - case GL_BLEND_DST_RGB_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendDstRGB); - break; - case GL_BLEND_SRC_ALPHA_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendSrcA); - break; - case GL_BLEND_DST_ALPHA_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendDstA); - break; - case GL_BLEND_EQUATION: - params[0] = ENUM_TO_INT64(ctx->Color.BlendEquationRGB ); - break; - case GL_BLEND_EQUATION_ALPHA_EXT: - params[0] = ENUM_TO_INT64(ctx->Color.BlendEquationA ); - break; - case GL_BLEND_COLOR_EXT: - params[0] = FLOAT_TO_INT64(ctx->Color.BlendColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Color.BlendColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Color.BlendColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Color.BlendColor[3]); - break; - case GL_BLUE_BIAS: - params[0] = IROUND64(ctx->Pixel.BlueBias); - break; - case GL_BLUE_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.blueBits); - break; - case GL_BLUE_SCALE: - params[0] = IROUND64(ctx->Pixel.BlueScale); - break; - case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = (GLint64)(ctx->ClientAttribStackDepth); - break; - case GL_CLIP_PLANE0: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 0) & 1); - break; - case GL_CLIP_PLANE1: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 1) & 1); - break; - case GL_CLIP_PLANE2: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 2) & 1); - break; - case GL_CLIP_PLANE3: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 3) & 1); - break; - case GL_CLIP_PLANE4: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 4) & 1); - break; - case GL_CLIP_PLANE5: - params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 5) & 1); - break; - case GL_COLOR_CLEAR_VALUE: - params[0] = FLOAT_TO_INT64(ctx->Color.ClearColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Color.ClearColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Color.ClearColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Color.ClearColor[3]); - break; - case GL_COLOR_MATERIAL: - params[0] = BOOLEAN_TO_INT64(ctx->Light.ColorMaterialEnabled); - break; - case GL_COLOR_MATERIAL_FACE: - params[0] = ENUM_TO_INT64(ctx->Light.ColorMaterialFace); - break; - case GL_COLOR_MATERIAL_PARAMETER: - params[0] = ENUM_TO_INT64(ctx->Light.ColorMaterialMode); - break; - case GL_COLOR_WRITEMASK: - params[0] = (GLint64)(ctx->Color.ColorMask[0][RCOMP] ? 1 : 0); - params[1] = (GLint64)(ctx->Color.ColorMask[0][GCOMP] ? 1 : 0); - params[2] = (GLint64)(ctx->Color.ColorMask[0][BCOMP] ? 1 : 0); - params[3] = (GLint64)(ctx->Color.ColorMask[0][ACOMP] ? 1 : 0); - break; - case GL_CULL_FACE: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.CullFlag); - break; - case GL_CULL_FACE_MODE: - params[0] = ENUM_TO_INT64(ctx->Polygon.CullFaceMode); - break; - case GL_CURRENT_COLOR: - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); - params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); - params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); - params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); - } - break; - case GL_CURRENT_INDEX: - { - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); - } - break; - case GL_CURRENT_NORMAL: - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); - params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); - params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); - } - break; - case GL_CURRENT_RASTER_COLOR: - params[0] = FLOAT_TO_INT64(ctx->Current.RasterColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Current.RasterColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Current.RasterColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Current.RasterColor[3]); - break; - case GL_CURRENT_RASTER_DISTANCE: - params[0] = IROUND64(ctx->Current.RasterDistance); - break; - case GL_CURRENT_RASTER_INDEX: - params[0] = IROUND64(1.0); - break; - case GL_CURRENT_RASTER_POSITION: - params[0] = IROUND64(ctx->Current.RasterPos[0]); - params[1] = IROUND64(ctx->Current.RasterPos[1]); - params[2] = IROUND64(ctx->Current.RasterPos[2]); - params[3] = IROUND64(ctx->Current.RasterPos[3]); - break; - case GL_CURRENT_RASTER_SECONDARY_COLOR: - params[0] = FLOAT_TO_INT64(ctx->Current.RasterSecondaryColor[0]); - params[1] = FLOAT_TO_INT64(ctx->Current.RasterSecondaryColor[1]); - params[2] = FLOAT_TO_INT64(ctx->Current.RasterSecondaryColor[2]); - params[3] = FLOAT_TO_INT64(ctx->Current.RasterSecondaryColor[3]); - break; - case GL_CURRENT_RASTER_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(raster tex coords, unit %u)", unit); - return; - } - params[0] = IROUND64(ctx->Current.RasterTexCoords[unit][0]); - params[1] = IROUND64(ctx->Current.RasterTexCoords[unit][1]); - params[2] = IROUND64(ctx->Current.RasterTexCoords[unit][2]); - params[3] = IROUND64(ctx->Current.RasterTexCoords[unit][3]); - } - break; - case GL_CURRENT_RASTER_POSITION_VALID: - params[0] = BOOLEAN_TO_INT64(ctx->Current.RasterPosValid); - break; - case GL_CURRENT_TEXTURE_COORDS: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(current tex coords, unit %u)", unit); - return; - } - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]); - params[1] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]); - params[2] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][2]); - params[3] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][3]); - } - break; - case GL_DEPTH_BIAS: - params[0] = IROUND64(ctx->Pixel.DepthBias); - break; - case GL_DEPTH_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.depthBits); - break; - case GL_DEPTH_CLEAR_VALUE: - params[0] = FLOAT_TO_INT64(((GLfloat) ctx->Depth.Clear)); - break; - case GL_DEPTH_FUNC: - params[0] = ENUM_TO_INT64(ctx->Depth.Func); - break; - case GL_DEPTH_RANGE: - params[0] = FLOAT_TO_INT64(ctx->Viewport.Near); - params[1] = FLOAT_TO_INT64(ctx->Viewport.Far); - break; - case GL_DEPTH_SCALE: - params[0] = IROUND64(ctx->Pixel.DepthScale); - break; - case GL_DEPTH_TEST: - params[0] = BOOLEAN_TO_INT64(ctx->Depth.Test); - break; - case GL_DEPTH_WRITEMASK: - params[0] = BOOLEAN_TO_INT64(ctx->Depth.Mask); - break; - case GL_DITHER: - params[0] = BOOLEAN_TO_INT64(ctx->Color.DitherFlag); - break; - case GL_DOUBLEBUFFER: - params[0] = BOOLEAN_TO_INT64(ctx->DrawBuffer->Visual.doubleBufferMode); - break; - case GL_DRAW_BUFFER: - params[0] = ENUM_TO_INT64(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_EDGE_FLAG: - { - FLUSH_CURRENT(ctx, 0); - params[0] = BOOLEAN_TO_INT64((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); - } - break; - case GL_FEEDBACK_BUFFER_SIZE: - params[0] = (GLint64)(ctx->Feedback.BufferSize); - break; - case GL_FEEDBACK_BUFFER_TYPE: - params[0] = ENUM_TO_INT64(ctx->Feedback.Type); - break; - case GL_FOG: - params[0] = BOOLEAN_TO_INT64(ctx->Fog.Enabled); - break; - case GL_FOG_COLOR: - params[0] = FLOAT_TO_INT64(ctx->Fog.Color[0]); - params[1] = FLOAT_TO_INT64(ctx->Fog.Color[1]); - params[2] = FLOAT_TO_INT64(ctx->Fog.Color[2]); - params[3] = FLOAT_TO_INT64(ctx->Fog.Color[3]); - break; - case GL_FOG_DENSITY: - params[0] = IROUND64(ctx->Fog.Density); - break; - case GL_FOG_END: - params[0] = IROUND64(ctx->Fog.End); - break; - case GL_FOG_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.Fog); - break; - case GL_FOG_INDEX: - params[0] = IROUND64(ctx->Fog.Index); - break; - case GL_FOG_MODE: - params[0] = ENUM_TO_INT64(ctx->Fog.Mode); - break; - case GL_FOG_START: - params[0] = IROUND64(ctx->Fog.Start); - break; - case GL_FRONT_FACE: - params[0] = ENUM_TO_INT64(ctx->Polygon.FrontFace); - break; - case GL_GREEN_BIAS: - params[0] = IROUND64(ctx->Pixel.GreenBias); - break; - case GL_GREEN_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.greenBits); - break; - case GL_GREEN_SCALE: - params[0] = IROUND64(ctx->Pixel.GreenScale); - break; - case GL_INDEX_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.indexBits); - break; - case GL_INDEX_CLEAR_VALUE: - params[0] = (GLint64)(ctx->Color.ClearIndex); - break; - case GL_INDEX_MODE: - params[0] = BOOLEAN_TO_INT64(GL_FALSE); - break; - case GL_INDEX_OFFSET: - params[0] = (GLint64)(ctx->Pixel.IndexOffset); - break; - case GL_INDEX_SHIFT: - params[0] = (GLint64)(ctx->Pixel.IndexShift); - break; - case GL_INDEX_WRITEMASK: - params[0] = (GLint64)(ctx->Color.IndexMask); - break; - case GL_LIGHT0: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[0].Enabled); - break; - case GL_LIGHT1: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[1].Enabled); - break; - case GL_LIGHT2: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[2].Enabled); - break; - case GL_LIGHT3: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[3].Enabled); - break; - case GL_LIGHT4: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[4].Enabled); - break; - case GL_LIGHT5: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[5].Enabled); - break; - case GL_LIGHT6: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[6].Enabled); - break; - case GL_LIGHT7: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[7].Enabled); - break; - case GL_LIGHTING: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Enabled); - break; - case GL_LIGHT_MODEL_AMBIENT: - params[0] = FLOAT_TO_INT64(ctx->Light.Model.Ambient[0]); - params[1] = FLOAT_TO_INT64(ctx->Light.Model.Ambient[1]); - params[2] = FLOAT_TO_INT64(ctx->Light.Model.Ambient[2]); - params[3] = FLOAT_TO_INT64(ctx->Light.Model.Ambient[3]); - break; - case GL_LIGHT_MODEL_COLOR_CONTROL: - params[0] = ENUM_TO_INT64(ctx->Light.Model.ColorControl); - break; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Model.LocalViewer); - break; - case GL_LIGHT_MODEL_TWO_SIDE: - params[0] = BOOLEAN_TO_INT64(ctx->Light.Model.TwoSide); - break; - case GL_LINE_SMOOTH: - params[0] = BOOLEAN_TO_INT64(ctx->Line.SmoothFlag); - break; - case GL_LINE_SMOOTH_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.LineSmooth); - break; - case GL_LINE_STIPPLE: - params[0] = BOOLEAN_TO_INT64(ctx->Line.StippleFlag); - break; - case GL_LINE_STIPPLE_PATTERN: - params[0] = (GLint64)(ctx->Line.StipplePattern); - break; - case GL_LINE_STIPPLE_REPEAT: - params[0] = (GLint64)(ctx->Line.StippleFactor); - break; - case GL_LINE_WIDTH: - params[0] = IROUND64(ctx->Line.Width); - break; - case GL_LINE_WIDTH_GRANULARITY: - params[0] = IROUND64(ctx->Const.LineWidthGranularity); - break; - case GL_LINE_WIDTH_RANGE: - params[0] = IROUND64(ctx->Const.MinLineWidthAA); - params[1] = IROUND64(ctx->Const.MaxLineWidthAA); - break; - case GL_ALIASED_LINE_WIDTH_RANGE: - params[0] = IROUND64(ctx->Const.MinLineWidth); - params[1] = IROUND64(ctx->Const.MaxLineWidth); - break; - case GL_LIST_BASE: - params[0] = (GLint64)(ctx->List.ListBase); - break; - case GL_LIST_INDEX: - params[0] = (GLint64)((ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)); - break; - case GL_LIST_MODE: - { - GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE; - params[0] = ENUM_TO_INT64(mode); - } - break; - case GL_INDEX_LOGIC_OP: - params[0] = BOOLEAN_TO_INT64(ctx->Color.IndexLogicOpEnabled); - break; - case GL_COLOR_LOGIC_OP: - params[0] = BOOLEAN_TO_INT64(ctx->Color.ColorLogicOpEnabled); - break; - case GL_LOGIC_OP_MODE: - params[0] = ENUM_TO_INT64(ctx->Color.LogicOp); - break; - case GL_MAP1_COLOR_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Color4); - break; - case GL_MAP1_GRID_DOMAIN: - params[0] = IROUND64(ctx->Eval.MapGrid1u1); - params[1] = IROUND64(ctx->Eval.MapGrid1u2); - break; - case GL_MAP1_GRID_SEGMENTS: - params[0] = (GLint64)(ctx->Eval.MapGrid1un); - break; - case GL_MAP1_INDEX: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Index); - break; - case GL_MAP1_NORMAL: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Normal); - break; - case GL_MAP1_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1TextureCoord1); - break; - case GL_MAP1_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1TextureCoord2); - break; - case GL_MAP1_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1TextureCoord3); - break; - case GL_MAP1_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1TextureCoord4); - break; - case GL_MAP1_VERTEX_3: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Vertex3); - break; - case GL_MAP1_VERTEX_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Vertex4); - break; - case GL_MAP2_COLOR_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Color4); - break; - case GL_MAP2_GRID_DOMAIN: - params[0] = IROUND64(ctx->Eval.MapGrid2u1); - params[1] = IROUND64(ctx->Eval.MapGrid2u2); - params[2] = IROUND64(ctx->Eval.MapGrid2v1); - params[3] = IROUND64(ctx->Eval.MapGrid2v2); - break; - case GL_MAP2_GRID_SEGMENTS: - params[0] = (GLint64)(ctx->Eval.MapGrid2un); - params[1] = (GLint64)(ctx->Eval.MapGrid2vn); - break; - case GL_MAP2_INDEX: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Index); - break; - case GL_MAP2_NORMAL: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Normal); - break; - case GL_MAP2_TEXTURE_COORD_1: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2TextureCoord1); - break; - case GL_MAP2_TEXTURE_COORD_2: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2TextureCoord2); - break; - case GL_MAP2_TEXTURE_COORD_3: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2TextureCoord3); - break; - case GL_MAP2_TEXTURE_COORD_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2TextureCoord4); - break; - case GL_MAP2_VERTEX_3: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Vertex3); - break; - case GL_MAP2_VERTEX_4: - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Vertex4); - break; - case GL_MAP_COLOR: - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.MapColorFlag); - break; - case GL_MAP_STENCIL: - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.MapStencilFlag); - break; - case GL_MATRIX_MODE: - params[0] = ENUM_TO_INT64(ctx->Transform.MatrixMode); - break; - case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = (GLint64)(MAX_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = (GLint64)(MAX_CLIENT_ATTRIB_STACK_DEPTH); - break; - case GL_MAX_CLIP_PLANES: - params[0] = (GLint64)(ctx->Const.MaxClipPlanes); - break; - case GL_MAX_ELEMENTS_VERTICES: - params[0] = (GLint64)(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_ELEMENTS_INDICES: - params[0] = (GLint64)(ctx->Const.MaxArrayLockSize); - break; - case GL_MAX_EVAL_ORDER: - params[0] = (GLint64)(MAX_EVAL_ORDER); - break; - case GL_MAX_LIGHTS: - params[0] = (GLint64)(ctx->Const.MaxLights); - break; - case GL_MAX_LIST_NESTING: - params[0] = (GLint64)(MAX_LIST_NESTING); - break; - case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = (GLint64)(MAX_MODELVIEW_STACK_DEPTH); - break; - case GL_MAX_NAME_STACK_DEPTH: - params[0] = (GLint64)(MAX_NAME_STACK_DEPTH); - break; - case GL_MAX_PIXEL_MAP_TABLE: - params[0] = (GLint64)(MAX_PIXEL_MAP_TABLE); - break; - case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = (GLint64)(MAX_PROJECTION_STACK_DEPTH); - break; - case GL_MAX_TEXTURE_SIZE: - params[0] = (GLint64)(1 << (ctx->Const.MaxTextureLevels - 1)); - break; - case GL_MAX_3D_TEXTURE_SIZE: - params[0] = (GLint64)(1 << (ctx->Const.Max3DTextureLevels - 1)); - break; - case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = (GLint64)(MAX_TEXTURE_STACK_DEPTH); - break; - case GL_MAX_VIEWPORT_DIMS: - params[0] = (GLint64)(ctx->Const.MaxViewportWidth); - params[1] = (GLint64)(ctx->Const.MaxViewportHeight); - break; - case GL_MODELVIEW_MATRIX: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_MODELVIEW_STACK_DEPTH: - params[0] = (GLint64)(ctx->ModelviewMatrixStack.Depth + 1); - break; - case GL_NAME_STACK_DEPTH: - params[0] = (GLint64)(ctx->Select.NameStackDepth); - break; - case GL_NORMALIZE: - params[0] = BOOLEAN_TO_INT64(ctx->Transform.Normalize); - break; - case GL_PACK_ALIGNMENT: - params[0] = (GLint64)(ctx->Pack.Alignment); - break; - case GL_PACK_LSB_FIRST: - params[0] = BOOLEAN_TO_INT64(ctx->Pack.LsbFirst); - break; - case GL_PACK_ROW_LENGTH: - params[0] = (GLint64)(ctx->Pack.RowLength); - break; - case GL_PACK_SKIP_PIXELS: - params[0] = (GLint64)(ctx->Pack.SkipPixels); - break; - case GL_PACK_SKIP_ROWS: - params[0] = (GLint64)(ctx->Pack.SkipRows); - break; - case GL_PACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_INT64(ctx->Pack.SwapBytes); - break; - case GL_PACK_SKIP_IMAGES_EXT: - params[0] = (GLint64)(ctx->Pack.SkipImages); - break; - case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = (GLint64)(ctx->Pack.ImageHeight); - break; - case GL_PACK_INVERT_MESA: - params[0] = BOOLEAN_TO_INT64(ctx->Pack.Invert); - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.PerspectiveCorrection); - break; - case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.AtoA.Size); - break; - case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.BtoB.Size); - break; - case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.GtoG.Size); - break; - case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoA.Size); - break; - case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoB.Size); - break; - case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoG.Size); - break; - case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoI.Size); - break; - case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.ItoR.Size); - break; - case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.RtoR.Size); - break; - case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = (GLint64)(ctx->PixelMaps.StoS.Size); - break; - case GL_POINT_SIZE: - params[0] = IROUND64(ctx->Point.Size); - break; - case GL_POINT_SIZE_GRANULARITY: - params[0] = IROUND64(ctx->Const.PointSizeGranularity); - break; - case GL_POINT_SIZE_RANGE: - params[0] = IROUND64(ctx->Const.MinPointSizeAA); - params[1] = IROUND64(ctx->Const.MaxPointSizeAA); - break; - case GL_ALIASED_POINT_SIZE_RANGE: - params[0] = IROUND64(ctx->Const.MinPointSize); - params[1] = IROUND64(ctx->Const.MaxPointSize); - break; - case GL_POINT_SMOOTH: - params[0] = BOOLEAN_TO_INT64(ctx->Point.SmoothFlag); - break; - case GL_POINT_SMOOTH_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.PointSmooth); - break; - case GL_POINT_SIZE_MIN_EXT: - params[0] = IROUND64(ctx->Point.MinSize); - break; - case GL_POINT_SIZE_MAX_EXT: - params[0] = IROUND64(ctx->Point.MaxSize); - break; - case GL_POINT_FADE_THRESHOLD_SIZE_EXT: - params[0] = IROUND64(ctx->Point.Threshold); - break; - case GL_DISTANCE_ATTENUATION_EXT: - params[0] = IROUND64(ctx->Point.Params[0]); - params[1] = IROUND64(ctx->Point.Params[1]); - params[2] = IROUND64(ctx->Point.Params[2]); - break; - case GL_POLYGON_MODE: - params[0] = ENUM_TO_INT64(ctx->Polygon.FrontMode); - params[1] = ENUM_TO_INT64(ctx->Polygon.BackMode); - break; - case GL_POLYGON_OFFSET_BIAS_EXT: - params[0] = IROUND64(ctx->Polygon.OffsetUnits); - break; - case GL_POLYGON_OFFSET_FACTOR: - params[0] = IROUND64(ctx->Polygon.OffsetFactor ); - break; - case GL_POLYGON_OFFSET_UNITS: - params[0] = IROUND64(ctx->Polygon.OffsetUnits ); - break; - case GL_POLYGON_OFFSET_POINT: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.OffsetPoint); - break; - case GL_POLYGON_OFFSET_LINE: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.OffsetLine); - break; - case GL_POLYGON_OFFSET_FILL: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.OffsetFill); - break; - case GL_POLYGON_SMOOTH: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.SmoothFlag); - break; - case GL_POLYGON_SMOOTH_HINT: - params[0] = ENUM_TO_INT64(ctx->Hint.PolygonSmooth); - break; - case GL_POLYGON_STIPPLE: - params[0] = BOOLEAN_TO_INT64(ctx->Polygon.StippleFlag); - break; - case GL_PROJECTION_MATRIX: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_PROJECTION_STACK_DEPTH: - params[0] = (GLint64)(ctx->ProjectionMatrixStack.Depth + 1); - break; - case GL_READ_BUFFER: - params[0] = ENUM_TO_INT64(ctx->ReadBuffer->ColorReadBuffer); - break; - case GL_RED_BIAS: - params[0] = IROUND64(ctx->Pixel.RedBias); - break; - case GL_RED_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.redBits); - break; - case GL_RED_SCALE: - params[0] = IROUND64(ctx->Pixel.RedScale); - break; - case GL_RENDER_MODE: - params[0] = ENUM_TO_INT64(ctx->RenderMode); - break; - case GL_RESCALE_NORMAL: - params[0] = BOOLEAN_TO_INT64(ctx->Transform.RescaleNormals); - break; - case GL_RGBA_MODE: - params[0] = BOOLEAN_TO_INT64(GL_TRUE); - break; - case GL_SCISSOR_BOX: - params[0] = (GLint64)(ctx->Scissor.X); - params[1] = (GLint64)(ctx->Scissor.Y); - params[2] = (GLint64)(ctx->Scissor.Width); - params[3] = (GLint64)(ctx->Scissor.Height); - break; - case GL_SCISSOR_TEST: - params[0] = BOOLEAN_TO_INT64(ctx->Scissor.Enabled); - break; - case GL_SELECTION_BUFFER_SIZE: - params[0] = (GLint64)(ctx->Select.BufferSize); - break; - case GL_SHADE_MODEL: - params[0] = ENUM_TO_INT64(ctx->Light.ShadeModel); - break; - case GL_SHARED_TEXTURE_PALETTE_EXT: - params[0] = BOOLEAN_TO_INT64(ctx->Texture.SharedPalette); - break; - case GL_STENCIL_BITS: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.stencilBits); - break; - case GL_STENCIL_CLEAR_VALUE: - params[0] = (GLint64)(ctx->Stencil.Clear); - break; - case GL_STENCIL_FAIL: - params[0] = ENUM_TO_INT64(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_FUNC: - params[0] = ENUM_TO_INT64(ctx->Stencil.Function[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_INT64(ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_PASS_DEPTH_PASS: - params[0] = ENUM_TO_INT64(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_REF: - params[0] = (GLint64)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_TEST: - params[0] = BOOLEAN_TO_INT64(ctx->Stencil.Enabled); - break; - case GL_STENCIL_VALUE_MASK: - params[0] = (GLint64)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); - break; - case GL_STENCIL_WRITEMASK: - params[0] = (GLint64)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); - break; - case GL_STEREO: - params[0] = BOOLEAN_TO_INT64(ctx->DrawBuffer->Visual.stereoMode); - break; - case GL_SUBPIXEL_BITS: - params[0] = (GLint64)(ctx->Const.SubPixelBits); - break; - case GL_TEXTURE_1D: - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_1D)); - break; - case GL_TEXTURE_2D: - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_2D)); - break; - case GL_TEXTURE_3D: - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_3D)); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); - break; - case GL_TEXTURE_BINDING_1D: - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D: - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_3D: - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetInteger64v"); - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); - break; - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - CHECK_EXT1(MESA_texture_array, "GetInteger64v"); - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); - break; - case GL_TEXTURE_GEN_S: - params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_T: - params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_R: - params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_GEN_Q: - params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)); - break; - case GL_TEXTURE_MATRIX: - { - const GLfloat *matrix; - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGet(texture matrix %u)", - unit); - return; - } - matrix = ctx->TextureMatrixStack[unit].Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TEXTURE_STACK_DEPTH: - { - const GLuint unit = ctx->Texture.CurrentUnit; - if (unit >= ctx->Const.MaxTextureCoordUnits) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGet(texture stack depth, unit %u)", unit); - return; - } - params[0] = (GLint64)(ctx->TextureMatrixStack[unit].Depth + 1); - } - break; - case GL_UNPACK_ALIGNMENT: - params[0] = (GLint64)(ctx->Unpack.Alignment); - break; - case GL_UNPACK_LSB_FIRST: - params[0] = BOOLEAN_TO_INT64(ctx->Unpack.LsbFirst); - break; - case GL_UNPACK_ROW_LENGTH: - params[0] = (GLint64)(ctx->Unpack.RowLength); - break; - case GL_UNPACK_SKIP_PIXELS: - params[0] = (GLint64)(ctx->Unpack.SkipPixels); - break; - case GL_UNPACK_SKIP_ROWS: - params[0] = (GLint64)(ctx->Unpack.SkipRows); - break; - case GL_UNPACK_SWAP_BYTES: - params[0] = BOOLEAN_TO_INT64(ctx->Unpack.SwapBytes); - break; - case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = (GLint64)(ctx->Unpack.SkipImages); - break; - case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = (GLint64)(ctx->Unpack.ImageHeight); - break; - case GL_UNPACK_CLIENT_STORAGE_APPLE: - params[0] = BOOLEAN_TO_INT64(ctx->Unpack.ClientStorage); - break; - case GL_VIEWPORT: - params[0] = (GLint64)(ctx->Viewport.X); - params[1] = (GLint64)(ctx->Viewport.Y); - params[2] = (GLint64)(ctx->Viewport.Width); - params[3] = (GLint64)(ctx->Viewport.Height); - break; - case GL_ZOOM_X: - params[0] = IROUND64(ctx->Pixel.ZoomX); - break; - case GL_ZOOM_Y: - params[0] = IROUND64(ctx->Pixel.ZoomY); - break; - case GL_VERTEX_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Vertex.Enabled); - break; - case GL_VERTEX_ARRAY_SIZE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.Size); - break; - case GL_VERTEX_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Vertex.Type); - break; - case GL_VERTEX_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.Stride); - break; - case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_NORMAL_ARRAY: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Normal.Enabled); - break; - case GL_NORMAL_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Normal.Type); - break; - case GL_NORMAL_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Normal.Stride); - break; - case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_COLOR_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Color.Enabled); - break; - case GL_COLOR_ARRAY_SIZE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Color.Size); - break; - case GL_COLOR_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Color.Type); - break; - case GL_COLOR_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Color.Stride); - break; - case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_INDEX_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Index.Enabled); - break; - case GL_INDEX_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Index.Type); - break; - case GL_INDEX_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->Index.Stride); - break; - case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_TEXTURE_COORD_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled); - break; - case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size); - break; - case GL_TEXTURE_COORD_ARRAY_TYPE: - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); - break; - case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride); - break; - case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_EDGE_FLAG_ARRAY: - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->EdgeFlag.Enabled); - break; - case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = (GLint64)(ctx->Array.ArrayObj->EdgeFlag.Stride); - break; - case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = (GLint64)(0); - break; - case GL_MAX_TEXTURE_UNITS_ARB: - CHECK_EXT1(ARB_multitexture, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxTextureUnits); - break; - case GL_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture, "GetInteger64v"); - params[0] = (GLint64)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); - break; - case GL_CLIENT_ACTIVE_TEXTURE_ARB: - CHECK_EXT1(ARB_multitexture, "GetInteger64v"); - params[0] = (GLint64)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); - break; - case GL_TEXTURE_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)); - break; - case GL_TEXTURE_BINDING_CUBE_MAP_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetInteger64v"); - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); - break; - case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: - CHECK_EXT1(ARB_texture_cube_map, "GetInteger64v"); - params[0] = (GLint64)((1 << (ctx->Const.MaxCubeTextureLevels - 1))); - break; - case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = (GLint64)(ctx->Hint.TextureCompression); - break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = (GLint64)(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)); - break; - case GL_COMPRESSED_TEXTURE_FORMATS_ARB: - { - GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT64(formats[i]); - } - break; - case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: - CHECK_EXT1(EXT_compiled_vertex_array, "GetInteger64v"); - params[0] = (GLint64)(ctx->Array.LockFirst); - break; - case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: - CHECK_EXT1(EXT_compiled_vertex_array, "GetInteger64v"); - params[0] = (GLint64)(ctx->Array.LockCount); - break; - case GL_TRANSPOSE_COLOR_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TRANSPOSE_PROJECTION_MATRIX_ARB: - { - const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TRANSPOSE_TEXTURE_MATRIX_ARB: - { - const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_COLOR_MATRIX_SGI: - { - const GLfloat *matrix = ctx->ColorMatrixStack.Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = (GLint64)(ctx->ColorMatrixStack.Depth + 1); - break; - case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = (GLint64)(MAX_COLOR_STACK_DEPTH); - break; - case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[3]); - break; - case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixBias[0]); - break; - case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixBias[1]); - break; - case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixBias[2]); - break; - case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: - params[0] = IROUND64(ctx->Pixel.PostColorMatrixBias[3]); - break; - case GL_CONVOLUTION_1D_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.Convolution1DEnabled); - break; - case GL_CONVOLUTION_2D_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.Convolution2DEnabled); - break; - case GL_SEPARABLE_2D_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.Separable2DEnabled); - break; - case GL_POST_CONVOLUTION_RED_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = IROUND64(ctx->Pixel.PostConvolutionScale[0]); - break; - case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = IROUND64(ctx->Pixel.PostConvolutionScale[1]); - break; - case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = IROUND64(ctx->Pixel.PostConvolutionScale[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = IROUND64(ctx->Pixel.PostConvolutionScale[3]); - break; - case GL_POST_CONVOLUTION_RED_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = IROUND64(ctx->Pixel.PostConvolutionBias[0]); - break; - case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = IROUND64(ctx->Pixel.PostConvolutionBias[1]); - break; - case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = IROUND64(ctx->Pixel.PostConvolutionBias[2]); - break; - case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: - CHECK_EXT1(EXT_convolution, "GetInteger64v"); - params[0] = IROUND64(ctx->Pixel.PostConvolutionBias[3]); - break; - case GL_HISTOGRAM: - CHECK_EXT1(EXT_histogram, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.HistogramEnabled); - break; - case GL_MINMAX: - CHECK_EXT1(EXT_histogram, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.MinMaxEnabled); - break; - case GL_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]); - break; - case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]); - break; - case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_color_table, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]); - break; - case GL_TEXTURE_COLOR_TABLE_SGI: - CHECK_EXT1(SGI_texture_color_table, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled); - break; - case GL_COLOR_SUM_EXT: - CHECK_EXT2(EXT_secondary_color, ARB_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Fog.ColorSumEnabled); - break; - case GL_CURRENT_SECONDARY_COLOR_EXT: - CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - { - FLUSH_CURRENT(ctx, 0); - params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); - params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); - params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); - params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); - } - break; - case GL_SECONDARY_COLOR_ARRAY_EXT: - CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->SecondaryColor.Enabled); - break; - case GL_SECONDARY_COLOR_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->SecondaryColor.Type); - break; - case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.Stride); - break; - case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: - CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.Size); - break; - case GL_CURRENT_FOG_COORDINATE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); - { - FLUSH_CURRENT(ctx, 0); - params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); - } - break; - case GL_FOG_COORDINATE_ARRAY_EXT: - CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->FogCoord.Enabled); - break; - case GL_FOG_COORDINATE_ARRAY_TYPE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); - params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->FogCoord.Type); - break; - case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); - params[0] = (GLint64)(ctx->Array.ArrayObj->FogCoord.Stride); - break; - case GL_FOG_COORDINATE_SOURCE_EXT: - CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); - params[0] = ENUM_TO_INT64(ctx->Fog.FogCoordinateSource); - break; - case GL_MAX_TEXTURE_LOD_BIAS_EXT: - CHECK_EXT1(EXT_texture_lod_bias, "GetInteger64v"); - params[0] = IROUND64(ctx->Const.MaxTextureLodBias); - break; - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - CHECK_EXT1(EXT_texture_filter_anisotropic, "GetInteger64v"); - params[0] = IROUND64(ctx->Const.MaxTextureMaxAnisotropy); - break; - case GL_MULTISAMPLE_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.Enabled); - break; - case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleAlphaToCoverage); - break; - case GL_SAMPLE_ALPHA_TO_ONE_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleAlphaToOne); - break; - case GL_SAMPLE_COVERAGE_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleCoverage); - break; - case GL_SAMPLE_COVERAGE_VALUE_ARB: - params[0] = IROUND64(ctx->Multisample.SampleCoverageValue); - break; - case GL_SAMPLE_COVERAGE_INVERT_ARB: - params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleCoverageInvert); - break; - case GL_SAMPLE_BUFFERS_ARB: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.sampleBuffers); - break; - case GL_SAMPLES_ARB: - params[0] = (GLint64)(ctx->DrawBuffer->Visual.samples); - break; - case GL_RASTER_POSITION_UNCLIPPED_IBM: - CHECK_EXT1(IBM_rasterpos_clip, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Transform.RasterPositionUnclipped); - break; - case GL_POINT_SPRITE_NV: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Point.PointSprite); - break; - case GL_POINT_SPRITE_R_MODE_NV: - CHECK_EXT1(NV_point_sprite, "GetInteger64v"); - params[0] = ENUM_TO_INT64(ctx->Point.SpriteRMode); - break; - case GL_POINT_SPRITE_COORD_ORIGIN: - CHECK_EXT2(NV_point_sprite, ARB_point_sprite, "GetInteger64v"); - params[0] = ENUM_TO_INT64(ctx->Point.SpriteOrigin); - break; - case GL_GENERATE_MIPMAP_HINT_SGIS: - CHECK_EXT1(SGIS_generate_mipmap, "GetInteger64v"); - params[0] = ENUM_TO_INT64(ctx->Hint.GenerateMipmap); - break; - case GL_VERTEX_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = (GLint64)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); - break; - case GL_VERTEX_ATTRIB_ARRAY0_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[0].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY1_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[1].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY2_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[2].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY3_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[3].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[4].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY5_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[5].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY6_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[6].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY7_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[7].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY8_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[8].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY9_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[9].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY10_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[10].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY11_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[11].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY12_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[12].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY13_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[13].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY14_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[14].Enabled); - break; - case GL_VERTEX_ATTRIB_ARRAY15_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->VertexAttrib[15].Enabled); - break; - case GL_MAP1_VERTEX_ATTRIB0_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[0]); - break; - case GL_MAP1_VERTEX_ATTRIB1_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[1]); - break; - case GL_MAP1_VERTEX_ATTRIB2_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[2]); - break; - case GL_MAP1_VERTEX_ATTRIB3_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[3]); - break; - case GL_MAP1_VERTEX_ATTRIB4_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[4]); - break; - case GL_MAP1_VERTEX_ATTRIB5_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[5]); - break; - case GL_MAP1_VERTEX_ATTRIB6_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[6]); - break; - case GL_MAP1_VERTEX_ATTRIB7_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[7]); - break; - case GL_MAP1_VERTEX_ATTRIB8_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[8]); - break; - case GL_MAP1_VERTEX_ATTRIB9_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[9]); - break; - case GL_MAP1_VERTEX_ATTRIB10_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[10]); - break; - case GL_MAP1_VERTEX_ATTRIB11_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[11]); - break; - case GL_MAP1_VERTEX_ATTRIB12_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[12]); - break; - case GL_MAP1_VERTEX_ATTRIB13_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[13]); - break; - case GL_MAP1_VERTEX_ATTRIB14_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[14]); - break; - case GL_MAP1_VERTEX_ATTRIB15_4_NV: - CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Attrib[15]); - break; - case GL_FRAGMENT_PROGRAM_NV: - CHECK_EXT1(NV_fragment_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->FragmentProgram.Enabled); - break; - case GL_FRAGMENT_PROGRAM_BINDING_NV: - CHECK_EXT1(NV_fragment_program, "GetInteger64v"); - params[0] = (GLint64)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); - break; - case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: - CHECK_EXT1(NV_fragment_program, "GetInteger64v"); - params[0] = (GLint64)(MAX_NV_FRAGMENT_PROGRAM_PARAMS); - break; - case GL_TEXTURE_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)); - break; - case GL_TEXTURE_BINDING_RECTANGLE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetInteger64v"); - params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); - break; - case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: - CHECK_EXT1(NV_texture_rectangle, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxTextureRectSize); - break; - case GL_STENCIL_TEST_TWO_SIDE_EXT: - CHECK_EXT1(EXT_stencil_two_side, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Stencil.TestTwoSide); - break; - case GL_ACTIVE_STENCIL_FACE_EXT: - CHECK_EXT1(EXT_stencil_two_side, "GetInteger64v"); - params[0] = ENUM_TO_INT64(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT); - break; - case GL_MAX_SHININESS_NV: - CHECK_EXT1(NV_light_max_exponent, "GetInteger64v"); - params[0] = IROUND64(ctx->Const.MaxShininess); - break; - case GL_MAX_SPOT_EXPONENT_NV: - CHECK_EXT1(NV_light_max_exponent, "GetInteger64v"); - params[0] = IROUND64(ctx->Const.MaxSpotExponent); - break; - case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayBufferObj->Name); - break; - case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.BufferObj->Name); - break; - case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->Normal.BufferObj->Name); - break; - case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->Color.BufferObj->Name); - break; - case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->Index.BufferObj->Name); - break; - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); - break; - case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name); - break; - case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name); - break; - case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ArrayObj->FogCoord.BufferObj->Name); - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = (GLint64)(ctx->Array.ElementArrayBufferObj->Name); - break; - case GL_PIXEL_PACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object, "GetInteger64v"); - params[0] = (GLint64)(ctx->Pack.BufferObj->Name); - break; - case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: - CHECK_EXT1(EXT_pixel_buffer_object, "GetInteger64v"); - params[0] = (GLint64)(ctx->Unpack.BufferObj->Name); - break; - case GL_VERTEX_PROGRAM_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->VertexProgram.Enabled); - break; - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->VertexProgram.PointSizeEnabled); - break; - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->VertexProgram.TwoSideEnabled); - break; - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxProgramMatrixStackDepth); - break; - case GL_MAX_PROGRAM_MATRICES_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxProgramMatrices); - break; - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->CurrentStack->Depth + 1); - break; - case GL_CURRENT_MATRIX_ARB: - CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_fragment_program, "GetInteger64v"); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[1]); - params[2] = IROUND64(matrix[2]); - params[3] = IROUND64(matrix[3]); - params[4] = IROUND64(matrix[4]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[6]); - params[7] = IROUND64(matrix[7]); - params[8] = IROUND64(matrix[8]); - params[9] = IROUND64(matrix[9]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[11]); - params[12] = IROUND64(matrix[12]); - params[13] = IROUND64(matrix[13]); - params[14] = IROUND64(matrix[14]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - CHECK_EXT2(ARB_vertex_program, ARB_fragment_program, "GetInteger64v"); - { - const GLfloat *matrix = ctx->CurrentStack->Top->m; - params[0] = IROUND64(matrix[0]); - params[1] = IROUND64(matrix[4]); - params[2] = IROUND64(matrix[8]); - params[3] = IROUND64(matrix[12]); - params[4] = IROUND64(matrix[1]); - params[5] = IROUND64(matrix[5]); - params[6] = IROUND64(matrix[9]); - params[7] = IROUND64(matrix[13]); - params[8] = IROUND64(matrix[2]); - params[9] = IROUND64(matrix[6]); - params[10] = IROUND64(matrix[10]); - params[11] = IROUND64(matrix[14]); - params[12] = IROUND64(matrix[3]); - params[13] = IROUND64(matrix[7]); - params[14] = IROUND64(matrix[11]); - params[15] = IROUND64(matrix[15]); - } - break; - case GL_MAX_VERTEX_ATTRIBS_ARB: - CHECK_EXT1(ARB_vertex_program, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.VertexProgram.MaxAttribs); - break; - case GL_PROGRAM_ERROR_POSITION_ARB: - CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program, "GetInteger64v"); - params[0] = (GLint64)(ctx->Program.ErrorPos); - break; - case GL_FRAGMENT_PROGRAM_ARB: - CHECK_EXT1(ARB_fragment_program, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->FragmentProgram.Enabled); - break; - case GL_MAX_TEXTURE_COORDS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxTextureCoordUnits); - break; - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxTextureImageUnits); - break; - case GL_DEPTH_BOUNDS_TEST_EXT: - CHECK_EXT1(EXT_depth_bounds_test, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Depth.BoundsTest); - break; - case GL_DEPTH_BOUNDS_EXT: - CHECK_EXT1(EXT_depth_bounds_test, "GetInteger64v"); - params[0] = IROUND64(ctx->Depth.BoundsMin); - params[1] = IROUND64(ctx->Depth.BoundsMax); - break; - case GL_DEPTH_CLAMP: - CHECK_EXT1(ARB_depth_clamp, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Transform.DepthClamp); - break; - case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = (GLint64)(ctx->Const.MaxDrawBuffers); - break; - case GL_DRAW_BUFFER0_ARB: - params[0] = ENUM_TO_INT64(ctx->DrawBuffer->ColorDrawBuffer[0]); - break; - case GL_DRAW_BUFFER1_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[1]; - params[0] = ENUM_TO_INT64(buffer); - } - break; - case GL_DRAW_BUFFER2_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[2]; - params[0] = ENUM_TO_INT64(buffer); - } - break; - case GL_DRAW_BUFFER3_ARB: - { - GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->DrawBuffer->ColorDrawBuffer[3]; - params[0] = ENUM_TO_INT64(buffer); - } - break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = (GLint64)(_mesa_get_color_read_type(ctx)); - break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = (GLint64)(_mesa_get_color_read_format(ctx)); - break; - case GL_NUM_FRAGMENT_REGISTERS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = (GLint64)(6); - break; - case GL_NUM_FRAGMENT_CONSTANTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = (GLint64)(8); - break; - case GL_NUM_PASSES_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = (GLint64)(2); - break; - case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = (GLint64)(8); - break; - case GL_NUM_INSTRUCTIONS_TOTAL_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = (GLint64)(16); - break; - case GL_COLOR_ALPHA_PAIRING_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(GL_TRUE); - break; - case GL_NUM_LOOPBACK_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = (GLint64)(3); - break; - case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: - CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = (GLint64)(3); - break; - case GL_STENCIL_BACK_FUNC: - params[0] = ENUM_TO_INT64(ctx->Stencil.Function[1]); - break; - case GL_STENCIL_BACK_VALUE_MASK: - params[0] = (GLint64)(ctx->Stencil.ValueMask[1]); - break; - case GL_STENCIL_BACK_WRITEMASK: - params[0] = (GLint64)(ctx->Stencil.WriteMask[1]); - break; - case GL_STENCIL_BACK_REF: - params[0] = (GLint64)(ctx->Stencil.Ref[1]); - break; - case GL_STENCIL_BACK_FAIL: - params[0] = ENUM_TO_INT64(ctx->Stencil.FailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: - params[0] = ENUM_TO_INT64(ctx->Stencil.ZFailFunc[1]); - break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: - params[0] = ENUM_TO_INT64(ctx->Stencil.ZPassFunc[1]); - break; - case GL_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = (GLint64)(ctx->DrawBuffer->Name); - break; - case GL_RENDERBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = (GLint64)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); - break; - case GL_MAX_COLOR_ATTACHMENTS_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxColorAttachments); - break; - case GL_MAX_RENDERBUFFER_SIZE_EXT: - CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxRenderbufferSize); - break; - case GL_READ_FRAMEBUFFER_BINDING_EXT: - CHECK_EXT1(EXT_framebuffer_blit, "GetInteger64v"); - params[0] = (GLint64)(ctx->ReadBuffer->Name); - break; - case GL_PROVOKING_VERTEX_EXT: - CHECK_EXT1(EXT_provoking_vertex, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Light.ProvokingVertex); - break; - case GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT: - CHECK_EXT1(EXT_provoking_vertex, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Const.QuadsFollowProvokingVertexConvention); - break; - case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_fragment_shader, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.FragmentProgram.MaxUniformComponents); - break; - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: - CHECK_EXT1(ARB_fragment_shader, "GetInteger64v"); - params[0] = ENUM_TO_INT64(ctx->Hint.FragmentShaderDerivative); - break; - case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.VertexProgram.MaxUniformComponents); - break; - case GL_MAX_VARYING_FLOATS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxVarying * 4); - break; - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxVertexTextureImageUnits); - break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: - CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxCombinedTextureImageUnits); - break; - case GL_CURRENT_PROGRAM: - CHECK_EXT1(ARB_shader_objects, "GetInteger64v"); - params[0] = (GLint64)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); - break; - case GL_MAX_SAMPLES: - CHECK_EXT1(ARB_framebuffer_object, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.MaxSamples); - break; - case GL_VERTEX_ARRAY_BINDING_APPLE: - CHECK_EXT1(APPLE_vertex_array_object, "GetInteger64v"); - params[0] = (GLint64)(ctx->Array.ArrayObj->Name); - break; - case GL_TEXTURE_CUBE_MAP_SEAMLESS: - CHECK_EXT1(ARB_seamless_cube_map, "GetInteger64v"); - params[0] = BOOLEAN_TO_INT64(ctx->Texture.CubeMapSeamless); - break; - case GL_MAX_SERVER_WAIT_TIMEOUT: - CHECK_EXT1(ARB_sync, "GetInteger64v"); - params[0] = ctx->Const.MaxServerWaitTimeout; - break; - case GL_NUM_EXTENSIONS: - params[0] = (GLint64)(_mesa_get_extension_count(ctx)); - break; - case GL_MAJOR_VERSION: - params[0] = (GLint64)(ctx->VersionMajor); - break; - case GL_MINOR_VERSION: - params[0] = (GLint64)(ctx->VersionMinor); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetInteger64v(pname=0x%x)", pname); + case TYPE_DOUBLEN: + params[0] = FLOAT_TO_INT64(((GLdouble *) p)[0]); + break; + + case TYPE_INT_4: + params[3] = ((GLint *) p)[3]; + case TYPE_INT_3: + params[2] = ((GLint *) p)[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = ((GLint *) p)[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = ((GLint *) p)[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_BOOLEAN(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = ((GLint64 *) p)[0]; + break; + + case TYPE_BOOLEAN: + params[0] = ((GLboolean*) p)[0]; + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_INT64(m->m[i]); + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_INT64(m->m[transpose[i]]); + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = (*(GLbitfield *) p >> shift) & 1; + break; } } #endif /* FEATURE_ARB_sync */ - void GLAPIENTRY -_mesa_GetDoublev( GLenum pname, GLdouble *params ) +_mesa_GetDoublev(GLenum pname, GLdouble *params) { - const GLfloat magic = -1234.5F; - GLfloat values[16]; - GLuint i; + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; - if (!params) - return; + d = find_value("glGetDoublev", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = d->offset; + break; - /* Init temp array to magic numbers so we can figure out how many values - * are returned by the GetFloatv() call. - */ - for (i = 0; i < 16; i++) - values[i] = magic; + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = ((GLfloat *) p)[3]; + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = ((GLfloat *) p)[2]; + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = ((GLfloat *) p)[1]; + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = ((GLfloat *) p)[0]; + break; - _mesa_GetFloatv(pname, values); - - for (i = 0; i < 16 && values[i] != magic; i++) - params[i] = (GLdouble) values[i]; + case TYPE_DOUBLEN: + params[0] = ((GLdouble *) p)[0]; + break; + + case TYPE_INT_4: + params[3] = ((GLint *) p)[3]; + case TYPE_INT_3: + params[2] = ((GLint *) p)[2]; + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = ((GLint *) p)[1]; + case TYPE_INT: + case TYPE_ENUM: + params[0] = ((GLint *) p)[0]; + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = v.value_int_n.ints[i]; + break; + + case TYPE_INT64: + params[0] = ((GLint64 *) p)[0]; + break; + + case TYPE_BOOLEAN: + params[0] = *(GLboolean*) p; + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = m->m[i]; + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = m->m[transpose[i]]; + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = (*(GLbitfield *) p >> shift) & 1; + break; + } } -void GLAPIENTRY -_mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params ) +static enum value_type +find_value_indexed(const char *func, GLenum pname, int index, union value *v) { GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - if (!params) - return; + switch (pname) { - if (ctx->NewState) - _mesa_update_state(ctx); + case GL_BLEND: + if (index >= ctx->Const.MaxDrawBuffers) + goto invalid_value; + if (!ctx->Extensions.EXT_draw_buffers2) + goto invalid_enum; + v->value_int = (ctx->Color.BlendEnabled >> index) & 1; + return TYPE_INT; - switch (pname) { - case GL_BLEND: - CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv"); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); - } - params[0] = INT_TO_BOOLEAN(((ctx->Color.BlendEnabled >> index) & 1)); - break; - case GL_COLOR_WRITEMASK: - CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv"); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); - } - params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0); - params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0); - params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][BCOMP] ? 1 : 0); - params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][ACOMP] ? 1 : 0); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanIndexedv(pname=0x%x)", pname); + case GL_COLOR_WRITEMASK: + if (index >= ctx->Const.MaxDrawBuffers) + goto invalid_value; + if (!ctx->Extensions.EXT_draw_buffers2) + goto invalid_enum; + v->value_int_4[0] = ctx->Color.ColorMask[index][RCOMP] ? 1 : 0; + v->value_int_4[1] = ctx->Color.ColorMask[index][GCOMP] ? 1 : 0; + v->value_int_4[2] = ctx->Color.ColorMask[index][BCOMP] ? 1 : 0; + v->value_int_4[3] = ctx->Color.ColorMask[index][ACOMP] ? 1 : 0; + return TYPE_INT_4; + + case GL_TRANSFORM_FEEDBACK_BUFFER_START: + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) + goto invalid_value; + if (!ctx->Extensions.EXT_transform_feedback) + goto invalid_enum; + v->value_int64 = ctx->TransformFeedback.CurrentObject->Offset[index]; + return TYPE_INT64; + + case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) + goto invalid_value; + if (!ctx->Extensions.EXT_transform_feedback) + goto invalid_enum; + v->value_int64 = ctx->TransformFeedback.CurrentObject->Size[index]; + return TYPE_INT64; + + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) + goto invalid_value; + if (!ctx->Extensions.EXT_transform_feedback) + goto invalid_enum; + v->value_int = ctx->TransformFeedback.CurrentObject->Buffers[index]->Name; + return TYPE_INT; } + + invalid_enum: + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, + _mesa_lookup_enum_by_nr(pname)); + return TYPE_INVALID; + invalid_value: + _mesa_error(ctx, GL_INVALID_VALUE, "%s(pname=%s)", func, + _mesa_lookup_enum_by_nr(pname)); + return TYPE_INVALID; } void GLAPIENTRY -_mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params ) +_mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params ) { - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); + union value v; - if (!params) - return; + switch (find_value_indexed("glGetBooleanIndexedv", pname, index, &v)) { + case TYPE_INT: + params[0] = INT_TO_BOOLEAN(v.value_int); + break; + case TYPE_INT_4: + params[0] = INT_TO_BOOLEAN(v.value_int_4[0]); + params[1] = INT_TO_BOOLEAN(v.value_int_4[1]); + params[2] = INT_TO_BOOLEAN(v.value_int_4[2]); + params[3] = INT_TO_BOOLEAN(v.value_int_4[3]); + break; + case TYPE_INT64: + params[0] = INT64_TO_BOOLEAN(v.value_int); + break; + default: + assert(0); + } +} - if (ctx->NewState) - _mesa_update_state(ctx); +void GLAPIENTRY +_mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params ) +{ + union value v; - switch (pname) { - case GL_BLEND: - CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv"); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); - } - params[0] = ((ctx->Color.BlendEnabled >> index) & 1); - break; - case GL_COLOR_WRITEMASK: - CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv"); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); - } - params[0] = ctx->Color.ColorMask[index][RCOMP] ? 1 : 0; - params[1] = ctx->Color.ColorMask[index][GCOMP] ? 1 : 0; - params[2] = ctx->Color.ColorMask[index][BCOMP] ? 1 : 0; - params[3] = ctx->Color.ColorMask[index][ACOMP] ? 1 : 0; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerIndexedv(pname=0x%x)", pname); + switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) { + case TYPE_INT: + params[0] = v.value_int; + break; + case TYPE_INT_4: + params[0] = v.value_int_4[0]; + params[1] = v.value_int_4[1]; + params[2] = v.value_int_4[2]; + params[3] = v.value_int_4[3]; + break; + case TYPE_INT64: + params[0] = INT64_TO_INT(v.value_int); + break; + default: + assert(0); } } @@ -7643,36 +2364,109 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params ) void GLAPIENTRY _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params ) { - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!params) - return; + union value v; - if (ctx->NewState) - _mesa_update_state(ctx); - - switch (pname) { - case GL_BLEND: - CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv"); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); - } - params[0] = (GLint64)(((ctx->Color.BlendEnabled >> index) & 1)); - break; - case GL_COLOR_WRITEMASK: - CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv"); - if (index >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); - } - params[0] = (GLint64)(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0); - params[1] = (GLint64)(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0); - params[2] = (GLint64)(ctx->Color.ColorMask[index][BCOMP] ? 1 : 0); - params[3] = (GLint64)(ctx->Color.ColorMask[index][ACOMP] ? 1 : 0); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetInteger64Indexedv(pname=0x%x)", pname); + switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) { + case TYPE_INT: + params[0] = v.value_int; + break; + case TYPE_INT_4: + params[0] = v.value_int_4[0]; + params[1] = v.value_int_4[1]; + params[2] = v.value_int_4[2]; + params[3] = v.value_int_4[3]; + break; + case TYPE_INT64: + params[0] = v.value_int; + break; + default: + assert(0); } } #endif /* FEATURE_ARB_sync */ +#if FEATURE_ES1 +void GLAPIENTRY +_mesa_GetFixedv(GLenum pname, GLfixed *params) +{ + const struct value_desc *d; + union value v; + GLmatrix *m; + int shift, i; + void *p; + + d = find_value("glGetDoublev", pname, &p, &v); + switch (d->type) { + case TYPE_INVALID: + break; + case TYPE_CONST: + params[0] = INT_TO_FIXED(d->offset); + break; + + case TYPE_FLOAT_4: + case TYPE_FLOATN_4: + params[3] = FLOAT_TO_FIXED(((GLfloat *) p)[3]); + case TYPE_FLOAT_3: + case TYPE_FLOATN_3: + params[2] = FLOAT_TO_FIXED(((GLfloat *) p)[2]); + case TYPE_FLOAT_2: + case TYPE_FLOATN_2: + params[1] = FLOAT_TO_FIXED(((GLfloat *) p)[1]); + case TYPE_FLOAT: + case TYPE_FLOATN: + params[0] = FLOAT_TO_FIXED(((GLfloat *) p)[0]); + break; + + case TYPE_DOUBLEN: + params[0] = FLOAT_TO_FIXED(((GLdouble *) p)[0]); + break; + + case TYPE_INT_4: + params[3] = INT_TO_FIXED(((GLint *) p)[3]); + case TYPE_INT_3: + params[2] = INT_TO_FIXED(((GLint *) p)[2]); + case TYPE_INT_2: + case TYPE_ENUM_2: + params[1] = INT_TO_FIXED(((GLint *) p)[1]); + case TYPE_INT: + case TYPE_ENUM: + params[0] = INT_TO_FIXED(((GLint *) p)[0]); + break; + + case TYPE_INT_N: + for (i = 0; i < v.value_int_n.n; i++) + params[i] = INT_TO_FIXED(v.value_int_n.ints[i]); + break; + + case TYPE_INT64: + params[0] = ((GLint64 *) p)[0]; + break; + + case TYPE_BOOLEAN: + params[0] = BOOLEAN_TO_FIXED(((GLboolean*) p)[0]); + break; + + case TYPE_MATRIX: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_FIXED(m->m[i]); + break; + + case TYPE_MATRIX_T: + m = *(GLmatrix **) p; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_FIXED(m->m[transpose[i]]); + break; + + case TYPE_BIT_0: + case TYPE_BIT_1: + case TYPE_BIT_2: + case TYPE_BIT_3: + case TYPE_BIT_4: + case TYPE_BIT_5: + shift = d->type - TYPE_BIT_0; + params[0] = BOOLEAN_TO_FIXED((*(GLbitfield *) p >> shift) & 1); + break; + } +} +#endif diff --git a/mesalib/src/mesa/main/get.h b/mesalib/src/mesa/main/get.h index cc426fc0f..99a004b71 100644 --- a/mesalib/src/mesa/main/get.h +++ b/mesalib/src/mesa/main/get.h @@ -32,7 +32,7 @@ #define GET_H -#include "mtypes.h" +#include "glheader.h" extern void GLAPIENTRY @@ -51,6 +51,9 @@ extern void GLAPIENTRY _mesa_GetInteger64v( GLenum pname, GLint64 *params ); extern void GLAPIENTRY +_mesa_GetFixedv(GLenum pname, GLfixed *params); + +extern void GLAPIENTRY _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params ); extern void GLAPIENTRY diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c index 51dd5f779..3910047fb 100644 --- a/mesalib/src/mesa/main/getstring.c +++ b/mesalib/src/mesa/main/getstring.c @@ -32,6 +32,46 @@ /** + * Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query. + */ +static const GLubyte * +shading_language_version(GLcontext *ctx) +{ + switch (ctx->API) { + case API_OPENGL: + if (!ctx->Extensions.ARB_shader_objects) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetString"); + return (const GLubyte *) 0; + } + + switch (ctx->Const.GLSLVersion) { + case 110: + return (const GLubyte *) "1.10"; + case 120: + return (const GLubyte *) "1.20"; + case 130: + return (const GLubyte *) "1.30"; + default: + _mesa_problem(ctx, + "Invalid GLSL version in shading_language_version()"); + return (const GLubyte *) 0; + } + break; + + case API_OPENGLES2: + return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16"; + + case API_OPENGLES: + /* fall-through */ + + default: + _mesa_problem(ctx, "Unexpected API value in shading_language_version()"); + return (const GLubyte *) 0; + } +} + + +/** * Query string-valued state. The return value should _not_ be freed by * the caller. * @@ -71,16 +111,10 @@ _mesa_GetString( GLenum name ) case GL_VERSION: return (const GLubyte *) ctx->VersionString; case GL_EXTENSIONS: - if (!ctx->Extensions.String) - ctx->Extensions.String = _mesa_make_extension_string(ctx); return (const GLubyte *) ctx->Extensions.String; -#if FEATURE_ARB_shading_language_100 - case GL_SHADING_LANGUAGE_VERSION_ARB: - if (ctx->Extensions.ARB_shading_language_120) - return (const GLubyte *) "1.20"; - else if (ctx->Extensions.ARB_shading_language_100) - return (const GLubyte *) "1.10"; - goto error; +#if FEATURE_ARB_shading_language_100 || FEATURE_ES2 + case GL_SHADING_LANGUAGE_VERSION: + return shading_language_version(ctx); #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \ FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program @@ -93,9 +127,6 @@ _mesa_GetString( GLenum name ) } /* FALL-THROUGH */ #endif -#if FEATURE_ARB_shading_language_100 - error: -#endif default: _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" ); return (const GLubyte *) 0; @@ -155,10 +186,6 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname)); - if (ctx->Driver.GetPointerv - && (*ctx->Driver.GetPointerv)(ctx, pname, params)) - return; - switch (pname) { case GL_VERTEX_ARRAY_POINTER: *params = (GLvoid *) ctx->Array.ArrayObj->Vertex.Ptr; diff --git a/mesalib/src/mesa/main/glheader.h b/mesalib/src/mesa/main/glheader.h index 77544c88c..45f7b55ad 100644 --- a/mesalib/src/mesa/main/glheader.h +++ b/mesalib/src/mesa/main/glheader.h @@ -55,11 +55,11 @@ #include "GL/internal/glcore.h" -#ifndef GL_FIXED -#define GL_FIXED 0x140C +/** + * GL_FIXED is defined in glext.h version 64 but these typedefs aren't (yet). + */ typedef int GLfixed; typedef int GLclampx; -#endif #ifndef GL_OES_EGL_image @@ -85,11 +85,61 @@ typedef void *GLeglImageOES; #define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 #endif +/* GLES 2.0 tokens */ +#ifndef GL_RGB565 +#define GL_RGB565 0x8D62 +#endif + +#ifndef GL_TEXTURE_GEN_STR_OES +#define GL_TEXTURE_GEN_STR_OES 0x8D60 +#endif + +#ifndef GL_OES_compressed_paletted_texture +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif + +#ifndef GL_OES_matrix_get +#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D +#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E +#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F +#endif + +#ifndef GL_ES_VERSION_2_0 +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#endif + + /** - * Special, internal token + * Internal token to represent a GLSL shader program (a collection of + * one or more shaders that get linked together). Note that GLSL + * shaders and shader programs share one name space (one hash table) + * so we need a value that's different from any of the + * GL_VERTEX/FRAGMENT/GEOMETRY_PROGRAM tokens. */ #define GL_SHADER_PROGRAM_MESA 0x9999 +/** + * Internal token for geometry programs. + * Use the value for GL_GEOMETRY_PROGRAM_NV for now. + */ +#define MESA_GEOMETRY_PROGRAM 0x8c26 + + + #endif /* GLHEADER_H */ diff --git a/mesalib/src/mesa/main/histogram.c b/mesalib/src/mesa/main/histogram.c index 3a65bb192..4e482bcd5 100644 --- a/mesalib/src/mesa/main/histogram.c +++ b/mesalib/src/mesa/main/histogram.c @@ -29,6 +29,7 @@ #include "context.h" #include "image.h" #include "histogram.h" +#include "macros.h" #include "main/dispatch.h" diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c index dc8d97728..86aa6d0d7 100644 --- a/mesalib/src/mesa/main/image.c +++ b/mesalib/src/mesa/main/image.c @@ -32,7 +32,6 @@ #include "glheader.h" #include "colormac.h" -#include "context.h" #include "enums.h" #include "image.h" #include "imports.h" @@ -274,17 +273,25 @@ _mesa_components_in_format( GLenum format ) case GL_STENCIL_INDEX: case GL_DEPTH_COMPONENT: case GL_RED: + case GL_RED_INTEGER_EXT: case GL_GREEN: + case GL_GREEN_INTEGER_EXT: case GL_BLUE: + case GL_BLUE_INTEGER_EXT: case GL_ALPHA: + case GL_ALPHA_INTEGER_EXT: case GL_LUMINANCE: + case GL_LUMINANCE_INTEGER_EXT: case GL_INTENSITY: return 1; case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE_ALPHA_INTEGER_EXT: return 2; case GL_RGB: + case GL_RGB_INTEGER_EXT: return 3; case GL_RGBA: + case GL_RGBA_INTEGER_EXT: return 4; case GL_BGR: return 3; @@ -523,6 +530,28 @@ _mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type ) default: return GL_FALSE; } + case GL_RED_INTEGER_EXT: + case GL_GREEN_INTEGER_EXT: + case GL_BLUE_INTEGER_EXT: + case GL_ALPHA_INTEGER_EXT: + case GL_RGB_INTEGER_EXT: + case GL_RGBA_INTEGER_EXT: + case GL_BGR_INTEGER_EXT: + case GL_BGRA_INTEGER_EXT: + case GL_LUMINANCE_INTEGER_EXT: + case GL_LUMINANCE_ALPHA_INTEGER_EXT: + switch (type) { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + return ctx->Extensions.EXT_texture_integer; + default: + return GL_FALSE; + } + default: ; /* fall-through */ } @@ -734,6 +763,32 @@ _mesa_is_depthstencil_format(GLenum format) } } + +/** + * Test if the given image format is a depth or stencil format. + */ +GLboolean +_mesa_is_depth_or_stencil_format(GLenum format) +{ + switch (format) { + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT16: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: + case GL_STENCIL_INDEX: + case GL_STENCIL_INDEX1_EXT: + case GL_STENCIL_INDEX4_EXT: + case GL_STENCIL_INDEX8_EXT: + case GL_STENCIL_INDEX16_EXT: + case GL_DEPTH_STENCIL_EXT: + case GL_DEPTH24_STENCIL8_EXT: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + /** * Test if the given image format is a dudv format. */ @@ -751,6 +806,64 @@ _mesa_is_dudv_format(GLenum format) /** + * Test if the given format is an integer (non-normalized) format. + */ +GLboolean +_mesa_is_integer_format(GLenum format) +{ + switch (format) { + case GL_RED_INTEGER_EXT: + case GL_GREEN_INTEGER_EXT: + case GL_BLUE_INTEGER_EXT: + case GL_ALPHA_INTEGER_EXT: + case GL_RGB_INTEGER_EXT: + case GL_RGBA_INTEGER_EXT: + case GL_BGR_INTEGER_EXT: + case GL_BGRA_INTEGER_EXT: + case GL_LUMINANCE_INTEGER_EXT: + case GL_LUMINANCE_ALPHA_INTEGER_EXT: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/** + * Test if an image format is a supported compressed format. + * \param format the internal format token provided by the user. + * \return GL_TRUE if compressed, GL_FALSE if uncompressed + */ +GLboolean +_mesa_is_compressed_format(GLcontext *ctx, GLenum format) +{ + switch (format) { + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + return ctx->Extensions.EXT_texture_compression_s3tc; + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + return ctx->Extensions.S3_s3tc; + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: + return ctx->Extensions.EXT_texture_sRGB + && ctx->Extensions.EXT_texture_compression_s3tc; + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + return ctx->Extensions.TDFX_texture_compression_FXT1; + default: + return GL_FALSE; + } +} + + +/** * Return the address of a specific pixel in an image (1D, 2D or 3D). * * Pixel unpacking/packing parameters are observed according to \p packing. @@ -3215,6 +3328,8 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLint redIndex, greenIndex, blueIndex, alphaIndex; GLint stride; GLint rComp, bComp, gComp, aComp; + GLboolean intFormat; + GLfloat rs = 1.0f, gs = 1.0f, bs = 1.0f, as = 1.0f; /* scale factors */ ASSERT(srcFormat == GL_RED || srcFormat == GL_GREEN || @@ -3229,7 +3344,17 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], srcFormat == GL_BGRA || srcFormat == GL_ABGR_EXT || srcFormat == GL_DU8DV8_ATI || - srcFormat == GL_DUDV_ATI); + srcFormat == GL_DUDV_ATI || + srcFormat == GL_RED_INTEGER_EXT || + srcFormat == GL_GREEN_INTEGER_EXT || + srcFormat == GL_BLUE_INTEGER_EXT || + srcFormat == GL_ALPHA_INTEGER_EXT || + srcFormat == GL_RGB_INTEGER_EXT || + srcFormat == GL_RGBA_INTEGER_EXT || + srcFormat == GL_BGR_INTEGER_EXT || + srcFormat == GL_BGRA_INTEGER_EXT || + srcFormat == GL_LUMINANCE_INTEGER_EXT || + srcFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT); ASSERT(srcType == GL_UNSIGNED_BYTE || srcType == GL_BYTE || @@ -3256,31 +3381,37 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], switch (srcFormat) { case GL_RED: + case GL_RED_INTEGER_EXT: redIndex = 0; greenIndex = blueIndex = alphaIndex = -1; stride = 1; break; case GL_GREEN: + case GL_GREEN_INTEGER_EXT: greenIndex = 0; redIndex = blueIndex = alphaIndex = -1; stride = 1; break; case GL_BLUE: + case GL_BLUE_INTEGER_EXT: blueIndex = 0; redIndex = greenIndex = alphaIndex = -1; stride = 1; break; case GL_ALPHA: + case GL_ALPHA_INTEGER_EXT: redIndex = greenIndex = blueIndex = -1; alphaIndex = 0; stride = 1; break; case GL_LUMINANCE: + case GL_LUMINANCE_INTEGER_EXT: redIndex = greenIndex = blueIndex = 0; alphaIndex = -1; stride = 1; break; case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE_ALPHA_INTEGER_EXT: redIndex = greenIndex = blueIndex = 0; alphaIndex = 1; stride = 2; @@ -3290,6 +3421,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], stride = 1; break; case GL_RGB: + case GL_RGB_INTEGER: redIndex = 0; greenIndex = 1; blueIndex = 2; @@ -3312,6 +3444,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], stride = 3; break; case GL_RGBA: + case GL_RGBA_INTEGER: redIndex = 0; greenIndex = 1; blueIndex = 2; @@ -3358,12 +3491,20 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], return; } + intFormat = _mesa_is_integer_format(srcFormat); -#define PROCESS(INDEX, CHANNEL, DEFAULT, TYPE, CONVERSION) \ +#define PROCESS(INDEX, CHANNEL, DEFAULT, DEFAULT_INT, TYPE, CONVERSION) \ if ((INDEX) < 0) { \ GLuint i; \ - for (i = 0; i < n; i++) { \ - rgba[i][CHANNEL] = DEFAULT; \ + if (intFormat) { \ + for (i = 0; i < n; i++) { \ + rgba[i][CHANNEL] = DEFAULT_INT; \ + } \ + } \ + else { \ + for (i = 0; i < n; i++) { \ + rgba[i][CHANNEL] = DEFAULT; \ + } \ } \ } \ else if (swapBytes) { \ @@ -3377,77 +3518,93 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], else if (sizeof(TYPE) == 4) { \ SWAP4BYTE(value); \ } \ - rgba[i][CHANNEL] = (GLfloat) CONVERSION(value); \ + if (intFormat) \ + rgba[i][CHANNEL] = (GLfloat) value; \ + else \ + rgba[i][CHANNEL] = (GLfloat) CONVERSION(value); \ s += stride; \ } \ } \ else { \ const TYPE *s = (const TYPE *) src; \ GLuint i; \ - for (i = 0; i < n; i++) { \ - rgba[i][CHANNEL] = (GLfloat) CONVERSION(s[INDEX]); \ - s += stride; \ + if (intFormat) { \ + for (i = 0; i < n; i++) { \ + rgba[i][CHANNEL] = (GLfloat) s[INDEX]; \ + s += stride; \ + } \ + } \ + else { \ + for (i = 0; i < n; i++) { \ + rgba[i][CHANNEL] = (GLfloat) CONVERSION(s[INDEX]); \ + s += stride; \ + } \ } \ } switch (srcType) { case GL_UNSIGNED_BYTE: - PROCESS(redIndex, RCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); - PROCESS(greenIndex, GCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); - PROCESS(blueIndex, BCOMP, 0.0F, GLubyte, UBYTE_TO_FLOAT); - PROCESS(alphaIndex, ACOMP, 1.0F, GLubyte, UBYTE_TO_FLOAT); + PROCESS(redIndex, RCOMP, 0.0F, 0, GLubyte, UBYTE_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, 0, GLubyte, UBYTE_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, 0, GLubyte, UBYTE_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, 255, GLubyte, UBYTE_TO_FLOAT); break; case GL_BYTE: - PROCESS(redIndex, RCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); - PROCESS(greenIndex, GCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); - PROCESS(blueIndex, BCOMP, 0.0F, GLbyte, BYTE_TO_FLOAT); - PROCESS(alphaIndex, ACOMP, 1.0F, GLbyte, BYTE_TO_FLOAT); + PROCESS(redIndex, RCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, 0, GLbyte, BYTE_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, 127, GLbyte, BYTE_TO_FLOAT); break; case GL_UNSIGNED_SHORT: - PROCESS(redIndex, RCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); - PROCESS(greenIndex, GCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); - PROCESS(blueIndex, BCOMP, 0.0F, GLushort, USHORT_TO_FLOAT); - PROCESS(alphaIndex, ACOMP, 1.0F, GLushort, USHORT_TO_FLOAT); + PROCESS(redIndex, RCOMP, 0.0F, 0, GLushort, USHORT_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, 0, GLushort, USHORT_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, 0, GLushort, USHORT_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, 0xffff, GLushort, USHORT_TO_FLOAT); break; case GL_SHORT: - PROCESS(redIndex, RCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); - PROCESS(greenIndex, GCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); - PROCESS(blueIndex, BCOMP, 0.0F, GLshort, SHORT_TO_FLOAT); - PROCESS(alphaIndex, ACOMP, 1.0F, GLshort, SHORT_TO_FLOAT); + PROCESS(redIndex, RCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, 0, GLshort, SHORT_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, 32767, GLshort, SHORT_TO_FLOAT); break; case GL_UNSIGNED_INT: - PROCESS(redIndex, RCOMP, 0.0F, GLuint, UINT_TO_FLOAT); - PROCESS(greenIndex, GCOMP, 0.0F, GLuint, UINT_TO_FLOAT); - PROCESS(blueIndex, BCOMP, 0.0F, GLuint, UINT_TO_FLOAT); - PROCESS(alphaIndex, ACOMP, 1.0F, GLuint, UINT_TO_FLOAT); + PROCESS(redIndex, RCOMP, 0.0F, 0, GLuint, UINT_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, 0, GLuint, UINT_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, 0, GLuint, UINT_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, 0xffffffff, GLuint, UINT_TO_FLOAT); break; case GL_INT: - PROCESS(redIndex, RCOMP, 0.0F, GLint, INT_TO_FLOAT); - PROCESS(greenIndex, GCOMP, 0.0F, GLint, INT_TO_FLOAT); - PROCESS(blueIndex, BCOMP, 0.0F, GLint, INT_TO_FLOAT); - PROCESS(alphaIndex, ACOMP, 1.0F, GLint, INT_TO_FLOAT); + PROCESS(redIndex, RCOMP, 0.0F, 0, GLint, INT_TO_FLOAT); + PROCESS(greenIndex, GCOMP, 0.0F, 0, GLint, INT_TO_FLOAT); + PROCESS(blueIndex, BCOMP, 0.0F, 0, GLint, INT_TO_FLOAT); + PROCESS(alphaIndex, ACOMP, 1.0F, 2147483647, GLint, INT_TO_FLOAT); break; case GL_FLOAT: - PROCESS(redIndex, RCOMP, 0.0F, GLfloat, (GLfloat)); - PROCESS(greenIndex, GCOMP, 0.0F, GLfloat, (GLfloat)); - PROCESS(blueIndex, BCOMP, 0.0F, GLfloat, (GLfloat)); - PROCESS(alphaIndex, ACOMP, 1.0F, GLfloat, (GLfloat)); + PROCESS(redIndex, RCOMP, 0.0F, 0.0F, GLfloat, (GLfloat)); + PROCESS(greenIndex, GCOMP, 0.0F, 0.0F, GLfloat, (GLfloat)); + PROCESS(blueIndex, BCOMP, 0.0F, 0.0F, GLfloat, (GLfloat)); + PROCESS(alphaIndex, ACOMP, 1.0F, 1.0F, GLfloat, (GLfloat)); break; case GL_HALF_FLOAT_ARB: - PROCESS(redIndex, RCOMP, 0.0F, GLhalfARB, _mesa_half_to_float); - PROCESS(greenIndex, GCOMP, 0.0F, GLhalfARB, _mesa_half_to_float); - PROCESS(blueIndex, BCOMP, 0.0F, GLhalfARB, _mesa_half_to_float); - PROCESS(alphaIndex, ACOMP, 1.0F, GLhalfARB, _mesa_half_to_float); + PROCESS(redIndex, RCOMP, 0.0F, 0.0F, GLhalfARB, _mesa_half_to_float); + PROCESS(greenIndex, GCOMP, 0.0F, 0.0F, GLhalfARB, _mesa_half_to_float); + PROCESS(blueIndex, BCOMP, 0.0F, 0.0F, GLhalfARB, _mesa_half_to_float); + PROCESS(alphaIndex, ACOMP, 1.0F, 1.0F, GLhalfARB, _mesa_half_to_float); break; case GL_UNSIGNED_BYTE_3_3_2: { const GLubyte *ubsrc = (const GLubyte *) src; GLuint i; + if (!intFormat) { + rs = 1.0F / 7.0F; + gs = 1.0F / 7.0F; + bs = 1.0F / 3.0F; + } for (i = 0; i < n; i ++) { GLubyte p = ubsrc[i]; - rgba[i][rComp] = ((p >> 5) ) * (1.0F / 7.0F); - rgba[i][gComp] = ((p >> 2) & 0x7) * (1.0F / 7.0F); - rgba[i][bComp] = ((p ) & 0x3) * (1.0F / 3.0F); + rgba[i][rComp] = ((p >> 5) ) * rs; + rgba[i][gComp] = ((p >> 2) & 0x7) * gs; + rgba[i][bComp] = ((p ) & 0x3) * bs; rgba[i][aComp] = 1.0F; } } @@ -3456,25 +3613,35 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], { const GLubyte *ubsrc = (const GLubyte *) src; GLuint i; + if (!intFormat) { + rs = 1.0F / 7.0F; + gs = 1.0F / 7.0F; + bs = 1.0F / 3.0F; + } for (i = 0; i < n; i ++) { GLubyte p = ubsrc[i]; - rgba[i][rComp] = ((p ) & 0x7) * (1.0F / 7.0F); - rgba[i][gComp] = ((p >> 3) & 0x7) * (1.0F / 7.0F); - rgba[i][bComp] = ((p >> 6) ) * (1.0F / 3.0F); + rgba[i][rComp] = ((p ) & 0x7) * rs; + rgba[i][gComp] = ((p >> 3) & 0x7) * gs; + rgba[i][bComp] = ((p >> 6) ) * bs; rgba[i][aComp] = 1.0F; } } break; case GL_UNSIGNED_SHORT_5_6_5: + if (!intFormat) { + rs = 1.0F / 31.0F; + gs = 1.0F / 63.0F; + bs = 1.0F / 31.0F; + } if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); - rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); - rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); - rgba[i][bComp] = ((p ) & 0x1f) * (1.0F / 31.0F); + rgba[i][rComp] = ((p >> 11) ) * rs; + rgba[i][gComp] = ((p >> 5) & 0x3f) * gs; + rgba[i][bComp] = ((p ) & 0x1f) * bs; rgba[i][aComp] = 1.0F; } } @@ -3483,23 +3650,28 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; - rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); - rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); - rgba[i][bComp] = ((p ) & 0x1f) * (1.0F / 31.0F); + rgba[i][rComp] = ((p >> 11) ) * rs; + rgba[i][gComp] = ((p >> 5) & 0x3f) * gs; + rgba[i][bComp] = ((p ) & 0x1f) * bs; rgba[i][aComp] = 1.0F; } } break; case GL_UNSIGNED_SHORT_5_6_5_REV: + if (!intFormat) { + rs = 1.0F / 31.0F; + gs = 1.0F / 63.0F; + bs = 1.0F / 31.0F; + } if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); - rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); - rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); - rgba[i][bComp] = ((p >> 11) ) * (1.0F / 31.0F); + rgba[i][rComp] = ((p ) & 0x1f) * rs; + rgba[i][gComp] = ((p >> 5) & 0x3f) * gs; + rgba[i][bComp] = ((p >> 11) ) * bs; rgba[i][aComp] = 1.0F; } } @@ -3508,24 +3680,27 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; - rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); - rgba[i][gComp] = ((p >> 5) & 0x3f) * (1.0F / 63.0F); - rgba[i][bComp] = ((p >> 11) ) * (1.0F / 31.0F); + rgba[i][rComp] = ((p ) & 0x1f) * rs; + rgba[i][gComp] = ((p >> 5) & 0x3f) * gs; + rgba[i][bComp] = ((p >> 11) ) * bs; rgba[i][aComp] = 1.0F; } } break; case GL_UNSIGNED_SHORT_4_4_4_4: + if (!intFormat) { + rs = gs = bs = as = 1.0F / 15.0F; + } if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); - rgba[i][rComp] = ((p >> 12) ) * (1.0F / 15.0F); - rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); - rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); - rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F); + rgba[i][rComp] = ((p >> 12) ) * rs; + rgba[i][gComp] = ((p >> 8) & 0xf) * gs; + rgba[i][bComp] = ((p >> 4) & 0xf) * bs; + rgba[i][aComp] = ((p ) & 0xf) * as; } } else { @@ -3533,24 +3708,27 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; - rgba[i][rComp] = ((p >> 12) ) * (1.0F / 15.0F); - rgba[i][gComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); - rgba[i][bComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); - rgba[i][aComp] = ((p ) & 0xf) * (1.0F / 15.0F); + rgba[i][rComp] = ((p >> 12) ) * rs; + rgba[i][gComp] = ((p >> 8) & 0xf) * gs; + rgba[i][bComp] = ((p >> 4) & 0xf) * bs; + rgba[i][aComp] = ((p ) & 0xf) * as; } } break; case GL_UNSIGNED_SHORT_4_4_4_4_REV: + if (!intFormat) { + rs = gs = bs = as = 1.0F / 15.0F; + } if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); - rgba[i][rComp] = ((p ) & 0xf) * (1.0F / 15.0F); - rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); - rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); - rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F); + rgba[i][rComp] = ((p ) & 0xf) * rs; + rgba[i][gComp] = ((p >> 4) & 0xf) * gs; + rgba[i][bComp] = ((p >> 8) & 0xf) * bs; + rgba[i][aComp] = ((p >> 12) ) * as; } } else { @@ -3558,24 +3736,27 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; - rgba[i][rComp] = ((p ) & 0xf) * (1.0F / 15.0F); - rgba[i][gComp] = ((p >> 4) & 0xf) * (1.0F / 15.0F); - rgba[i][bComp] = ((p >> 8) & 0xf) * (1.0F / 15.0F); - rgba[i][aComp] = ((p >> 12) ) * (1.0F / 15.0F); + rgba[i][rComp] = ((p ) & 0xf) * rs; + rgba[i][gComp] = ((p >> 4) & 0xf) * gs; + rgba[i][bComp] = ((p >> 8) & 0xf) * bs; + rgba[i][aComp] = ((p >> 12) ) * as; } } break; case GL_UNSIGNED_SHORT_5_5_5_1: + if (!intFormat) { + rs = gs = bs = 1.0F / 31.0F; + } if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); - rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); - rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F); - rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F); - rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F); + rgba[i][rComp] = ((p >> 11) ) * rs; + rgba[i][gComp] = ((p >> 6) & 0x1f) * gs; + rgba[i][bComp] = ((p >> 1) & 0x1f) * bs; + rgba[i][aComp] = ((p ) & 0x1) * as; } } else { @@ -3583,24 +3764,27 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; - rgba[i][rComp] = ((p >> 11) ) * (1.0F / 31.0F); - rgba[i][gComp] = ((p >> 6) & 0x1f) * (1.0F / 31.0F); - rgba[i][bComp] = ((p >> 1) & 0x1f) * (1.0F / 31.0F); - rgba[i][aComp] = ((p ) & 0x1) * (1.0F / 1.0F); + rgba[i][rComp] = ((p >> 11) ) * rs; + rgba[i][gComp] = ((p >> 6) & 0x1f) * gs; + rgba[i][bComp] = ((p >> 1) & 0x1f) * bs; + rgba[i][aComp] = ((p ) & 0x1) * as; } } break; case GL_UNSIGNED_SHORT_1_5_5_5_REV: + if (!intFormat) { + rs = gs = bs = 1.0F / 31.0F; + } if (swapBytes) { const GLushort *ussrc = (const GLushort *) src; GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; SWAP2BYTE(p); - rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); - rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F); - rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F); - rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F); + rgba[i][rComp] = ((p ) & 0x1f) * rs; + rgba[i][gComp] = ((p >> 5) & 0x1f) * gs; + rgba[i][bComp] = ((p >> 10) & 0x1f) * bs; + rgba[i][aComp] = ((p >> 15) ) * as; } } else { @@ -3608,10 +3792,10 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLushort p = ussrc[i]; - rgba[i][rComp] = ((p ) & 0x1f) * (1.0F / 31.0F); - rgba[i][gComp] = ((p >> 5) & 0x1f) * (1.0F / 31.0F); - rgba[i][bComp] = ((p >> 10) & 0x1f) * (1.0F / 31.0F); - rgba[i][aComp] = ((p >> 15) ) * (1.0F / 1.0F); + rgba[i][rComp] = ((p ) & 0x1f) * rs; + rgba[i][gComp] = ((p >> 5) & 0x1f) * gs; + rgba[i][bComp] = ((p >> 10) & 0x1f) * bs; + rgba[i][aComp] = ((p >> 15) ) * as; } } break; @@ -3619,23 +3803,45 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], if (swapBytes) { const GLuint *uisrc = (const GLuint *) src; GLuint i; - for (i = 0; i < n; i ++) { - GLuint p = uisrc[i]; - rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); - rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); - rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); - rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); + if (intFormat) { + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = (GLfloat) ((p ) & 0xff); + rgba[i][gComp] = (GLfloat) ((p >> 8) & 0xff); + rgba[i][bComp] = (GLfloat) ((p >> 16) & 0xff); + rgba[i][aComp] = (GLfloat) ((p >> 24) ); + } + } + else { + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); + rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); + rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); + rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); + } } } else { const GLuint *uisrc = (const GLuint *) src; GLuint i; - for (i = 0; i < n; i ++) { - GLuint p = uisrc[i]; - rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) ); - rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); - rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); - rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); + if (intFormat) { + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = (GLfloat) ((p >> 24) ); + rgba[i][gComp] = (GLfloat) ((p >> 16) & 0xff); + rgba[i][bComp] = (GLfloat) ((p >> 8) & 0xff); + rgba[i][aComp] = (GLfloat) ((p ) & 0xff); + } + } + else { + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) ); + rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); + rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); + rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); + } } } break; @@ -3643,37 +3849,65 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], if (swapBytes) { const GLuint *uisrc = (const GLuint *) src; GLuint i; - for (i = 0; i < n; i ++) { - GLuint p = uisrc[i]; - rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) ); - rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); - rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); - rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); + if (intFormat) { + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = (GLfloat) ((p >> 24) ); + rgba[i][gComp] = (GLfloat) ((p >> 16) & 0xff); + rgba[i][bComp] = (GLfloat) ((p >> 8) & 0xff); + rgba[i][aComp] = (GLfloat) ((p ) & 0xff); + } + } + else { + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = UBYTE_TO_FLOAT((p >> 24) ); + rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); + rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); + rgba[i][aComp] = UBYTE_TO_FLOAT((p ) & 0xff); + } } } else { const GLuint *uisrc = (const GLuint *) src; GLuint i; - for (i = 0; i < n; i ++) { - GLuint p = uisrc[i]; - rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); - rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); - rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); - rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); + if (intFormat) { + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = (GLfloat) ((p ) & 0xff); + rgba[i][gComp] = (GLfloat) ((p >> 8) & 0xff); + rgba[i][bComp] = (GLfloat) ((p >> 16) & 0xff); + rgba[i][aComp] = (GLfloat) ((p >> 24) ); + } + } + else { + for (i = 0; i < n; i ++) { + GLuint p = uisrc[i]; + rgba[i][rComp] = UBYTE_TO_FLOAT((p ) & 0xff); + rgba[i][gComp] = UBYTE_TO_FLOAT((p >> 8) & 0xff); + rgba[i][bComp] = UBYTE_TO_FLOAT((p >> 16) & 0xff); + rgba[i][aComp] = UBYTE_TO_FLOAT((p >> 24) ); + } } } break; case GL_UNSIGNED_INT_10_10_10_2: + if (!intFormat) { + rs = 1.0F / 1023.0F; + gs = 1.0F / 1023.0F; + bs = 1.0F / 1023.0F; + as = 1.0F / 3.0F; + } if (swapBytes) { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; SWAP4BYTE(p); - rgba[i][rComp] = ((p >> 22) ) * (1.0F / 1023.0F); - rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F); + rgba[i][rComp] = ((p >> 22) ) * rs; + rgba[i][gComp] = ((p >> 12) & 0x3ff) * gs; + rgba[i][bComp] = ((p >> 2) & 0x3ff) * bs; + rgba[i][aComp] = ((p ) & 0x3 ) * as; } } else { @@ -3681,24 +3915,30 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; - rgba[i][rComp] = ((p >> 22) ) * (1.0F / 1023.0F); - rgba[i][gComp] = ((p >> 12) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][bComp] = ((p >> 2) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][aComp] = ((p ) & 0x3 ) * (1.0F / 3.0F); + rgba[i][rComp] = ((p >> 22) ) * rs; + rgba[i][gComp] = ((p >> 12) & 0x3ff) * gs; + rgba[i][bComp] = ((p >> 2) & 0x3ff) * bs; + rgba[i][aComp] = ((p ) & 0x3 ) * as; } } break; case GL_UNSIGNED_INT_2_10_10_10_REV: + if (!intFormat) { + rs = 1.0F / 1023.0F; + gs = 1.0F / 1023.0F; + bs = 1.0F / 1023.0F; + as = 1.0F / 3.0F; + } if (swapBytes) { const GLuint *uisrc = (const GLuint *) src; GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; SWAP4BYTE(p); - rgba[i][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F); + rgba[i][rComp] = ((p ) & 0x3ff) * rs; + rgba[i][gComp] = ((p >> 10) & 0x3ff) * gs; + rgba[i][bComp] = ((p >> 20) & 0x3ff) * bs; + rgba[i][aComp] = ((p >> 30) ) * as; } } else { @@ -3706,10 +3946,10 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], GLuint i; for (i = 0; i < n; i ++) { GLuint p = uisrc[i]; - rgba[i][rComp] = ((p ) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][gComp] = ((p >> 10) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][bComp] = ((p >> 20) & 0x3ff) * (1.0F / 1023.0F); - rgba[i][aComp] = ((p >> 30) ) * (1.0F / 3.0F); + rgba[i][rComp] = ((p ) & 0x3ff) * rs; + rgba[i][gComp] = ((p >> 10) & 0x3ff) * gs; + rgba[i][bComp] = ((p >> 20) & 0x3ff) * bs; + rgba[i][aComp] = ((p >> 30) ) * as; } } break; @@ -4101,6 +4341,16 @@ _mesa_unpack_color_span_float( GLcontext *ctx, srcFormat == GL_RGBA || srcFormat == GL_BGRA || srcFormat == GL_ABGR_EXT || + srcFormat == GL_RED_INTEGER_EXT || + srcFormat == GL_GREEN_INTEGER_EXT || + srcFormat == GL_BLUE_INTEGER_EXT || + srcFormat == GL_ALPHA_INTEGER_EXT || + srcFormat == GL_RGB_INTEGER_EXT || + srcFormat == GL_RGBA_INTEGER_EXT || + srcFormat == GL_BGR_INTEGER_EXT || + srcFormat == GL_BGRA_INTEGER_EXT || + srcFormat == GL_LUMINANCE_INTEGER_EXT || + srcFormat == GL_LUMINANCE_ALPHA_INTEGER_EXT || srcFormat == GL_COLOR_INDEX); ASSERT(srcType == GL_BITMAP || diff --git a/mesalib/src/mesa/main/image.h b/mesalib/src/mesa/main/image.h index 9b34be0df..8b180d6bf 100644 --- a/mesalib/src/mesa/main/image.h +++ b/mesalib/src/mesa/main/image.h @@ -73,8 +73,16 @@ extern GLboolean _mesa_is_depthstencil_format(GLenum format); extern GLboolean +_mesa_is_depth_or_stencil_format(GLenum format); + +extern GLboolean _mesa_is_dudv_format(GLenum format); +extern GLboolean +_mesa_is_integer_format(GLenum format); + +extern GLboolean +_mesa_is_compressed_format(GLcontext *ctx, GLenum format); extern GLvoid * _mesa_image_address( GLuint dimensions, diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index b1389b25f..46e5c932d 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -243,41 +243,6 @@ _mesa_memset16( unsigned short *dst, unsigned short val, size_t n ) /** \name Math */ /*@{*/ -/** Wrapper around sin() */ -double -_mesa_sin(double a) -{ - return sin(a); -} - -/** Single precision wrapper around sin() */ -float -_mesa_sinf(float a) -{ - return (float) sin((double) a); -} - -/** Wrapper around cos() */ -double -_mesa_cos(double a) -{ - return cos(a); -} - -/** Single precision wrapper around asin() */ -float -_mesa_asinf(float x) -{ - return (float) asin((double) x); -} - -/** Single precision wrapper around atan() */ -float -_mesa_atanf(float x) -{ - return (float) atan((double) x); -} - /** Wrapper around sqrt() */ double _mesa_sqrtd(double x) @@ -486,15 +451,6 @@ _mesa_inv_sqrtf(float n) #endif } - -/** Wrapper around pow() */ -double -_mesa_pow(double x, double y) -{ - return pow(x, y); -} - - /** * Find the first bit set in a word. */ @@ -800,7 +756,7 @@ _mesa_strdup( const char *s ) float _mesa_strtof( const char *s, char **end ) { -#ifdef _GNU_SOURCE +#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) static locale_t loc = NULL; if (!loc) { loc = newlocale(LC_CTYPE_MASK, "C", NULL); diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index 1c263aabc..751f20650 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -116,6 +116,42 @@ typedef union { GLfloat f; GLint i; } fi_type; #endif +/** + * \name Work-arounds for platforms that lack C99 math functions + */ +/*@{*/ +#if (!defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE < 600)) && !defined(_ISOC99_SOURCE) \ + && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) \ + && (!defined(_MSC_VER) || (_MSC_VER < 1400)) +#define acosf(f) ((float) acos(f)) +#define asinf(f) ((float) asin(f)) +#define atan2f(x,y) ((float) atan2(x,y)) +#define atanf(f) ((float) atan(f)) +#define cielf(f) ((float) ciel(f)) +#define cosf(f) ((float) cos(f)) +#define coshf(f) ((float) cosh(f)) +#define expf(f) ((float) exp(f)) +#define exp2f(f) ((float) exp2(f)) +#define floorf(f) ((float) floor(f)) +#define logf(f) ((float) log(f)) +#define log2f(f) ((float) log2(f)) +#define powf(x,y) ((float) pow(x,y)) +#define sinf(f) ((float) sin(f)) +#define sinhf(f) ((float) sinh(f)) +#define sqrtf(f) ((float) sqrt(f)) +#define tanf(f) ((float) tan(f)) +#define tanhf(f) ((float) tanh(f)) +#endif + +#if defined(_MSC_VER) +static INLINE float truncf(float x) { return x < 0.0f ? ceilf(x) : floorf(x); } +static INLINE float exp2f(float x) { return powf(2.0f, x); } +static INLINE float log2f(float x) { return logf(x) * 1.442695041f; } +static INLINE int isblank(int ch) { return ch == ' ' || ch == '\t'; } +#define strtoll(p, e, b) _strtoi64(p, e, b) +#endif +/*@}*/ + /*** *** LOG2: Log base 2 of float ***/ @@ -444,42 +480,6 @@ _mesa_next_pow_two_64(uint64_t x) } -/*** - *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255] - *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255] - ***/ -#if defined(USE_IEEE) && !defined(DEBUG) -#define IEEE_0996 0x3f7f0000 /* 0.996 or so */ -/* This function/macro is sensitive to precision. Test very carefully - * if you change it! - */ -#define UNCLAMPED_FLOAT_TO_UBYTE(UB, F) \ - do { \ - fi_type __tmp; \ - __tmp.f = (F); \ - if (__tmp.i < 0) \ - UB = (GLubyte) 0; \ - else if (__tmp.i >= IEEE_0996) \ - UB = (GLubyte) 255; \ - else { \ - __tmp.f = __tmp.f * (255.0F/256.0F) + 32768.0F; \ - UB = (GLubyte) __tmp.i; \ - } \ - } while (0) -#define CLAMPED_FLOAT_TO_UBYTE(UB, F) \ - do { \ - fi_type __tmp; \ - __tmp.f = (F) * (255.0F/256.0F) + 32768.0F; \ - UB = (GLubyte) __tmp.i; \ - } while (0) -#else -#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \ - ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F)) -#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \ - ub = ((GLubyte) IROUND((f) * 255.0F)) -#endif - - /** * Return 1 if this is a little endian machine, 0 if big endian. */ @@ -522,21 +522,6 @@ extern void _mesa_memset16( unsigned short *dst, unsigned short val, size_t n ); extern double -_mesa_sin(double a); - -extern float -_mesa_sinf(float a); - -extern double -_mesa_cos(double a); - -extern float -_mesa_asinf(float x); - -extern float -_mesa_atanf(float x); - -extern double _mesa_sqrtd(double x); extern float @@ -548,9 +533,6 @@ _mesa_inv_sqrtf(float x); extern void _mesa_init_sqrt_table(void); -extern double -_mesa_pow(double x, double y); - extern int _mesa_ffs(int32_t i); @@ -584,19 +566,25 @@ extern unsigned int _mesa_str_checksum(const char *str); extern int -_mesa_snprintf( char *str, size_t size, const char *fmt, ... ); +_mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4); extern void -_mesa_warning( __GLcontext *gc, const char *fmtString, ... ); +_mesa_warning( __GLcontext *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void -_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ); +_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); extern void -_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); +_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4); extern void -_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); +_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); + + +#if defined(_MSC_VER) && !defined(snprintf) +#define snprintf _snprintf +#endif + #ifdef __cplusplus } diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c index 19dc96892..43ae28c25 100644 --- a/mesalib/src/mesa/main/light.c +++ b/mesalib/src/mesa/main/light.c @@ -162,7 +162,7 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); light->SpotCutoff = params[0]; - light->_CosCutoffNeg = (GLfloat) (_mesa_cos(light->SpotCutoff * DEG2RAD)); + light->_CosCutoffNeg = (GLfloat) (cos(light->SpotCutoff * DEG2RAD)); if (light->_CosCutoffNeg < 0) light->_CosCutoff = 0; else @@ -599,7 +599,7 @@ _mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname, bitmask |= MAT_BIT_FRONT_INDEXES | MAT_BIT_BACK_INDEXES; break; default: - _mesa_error( ctx, GL_INVALID_ENUM, where ); + _mesa_error( ctx, GL_INVALID_ENUM, "%s", where ); return 0; } @@ -610,12 +610,12 @@ _mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname, bitmask &= BACK_MATERIAL_BITS; } else if (face != GL_FRONT_AND_BACK) { - _mesa_error( ctx, GL_INVALID_ENUM, where ); + _mesa_error( ctx, GL_INVALID_ENUM, "%s", where ); return 0; } if (bitmask & ~legal) { - _mesa_error( ctx, GL_INVALID_ENUM, where ); + _mesa_error( ctx, GL_INVALID_ENUM, "%s", where ); return 0; } @@ -950,7 +950,7 @@ validate_spot_exp_table( struct gl_light *l ) for (i = EXP_TABLE_SIZE - 1; i > 0 ;i--) { if (clamp == 0) { - tmp = _mesa_pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); + tmp = pow(i / (GLdouble) (EXP_TABLE_SIZE - 1), exponent); if (tmp < FLT_MIN * 100.0) { tmp = 0.0; clamp = 1; @@ -1012,7 +1012,7 @@ validate_shine_table( GLcontext *ctx, GLuint side, GLfloat shininess ) GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1); if (x < 0.005) /* underflow check */ x = 0.005; - t = _mesa_pow(x, shininess); + t = pow(x, shininess); if (t > 1e-20) m[j] = (GLfloat) t; else diff --git a/mesalib/src/mesa/main/light.h b/mesalib/src/mesa/main/light.h index 9c1a5eefa..b3436114d 100644 --- a/mesalib/src/mesa/main/light.h +++ b/mesalib/src/mesa/main/light.h @@ -94,7 +94,7 @@ do { \ int k = (int) f; \ if (k < 0 /* gcc may cast an overflow float value to negative int value*/ \ || k > SHINE_TABLE_SIZE-2) \ - result = (GLfloat) _mesa_pow( dp, _tab->shininess ); \ + result = (GLfloat) pow( dp, _tab->shininess ); \ else \ result = _tab->tab[k] + (f-k)*(_tab->tab[k+1]-_tab->tab[k]); \ } while (0) diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h index a8624574d..b2ec0ba9b 100644 --- a/mesalib/src/mesa/main/macros.h +++ b/mesalib/src/mesa/main/macros.h @@ -127,6 +127,44 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; #define CLAMPED_FLOAT_TO_USHORT(us, f) \ us = ( (GLushort) IROUND( (f) * 65535.0F) ) +#define UNCLAMPED_FLOAT_TO_SHORT(s, f) \ + s = ( (GLshort) IROUND( CLAMP((f), -1.0F, 1.0F) * 32767.0F) ) + +/*** + *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255] + *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255] + ***/ +#if defined(USE_IEEE) && !defined(DEBUG) +#define IEEE_0996 0x3f7f0000 /* 0.996 or so */ +/* This function/macro is sensitive to precision. Test very carefully + * if you change it! + */ +#define UNCLAMPED_FLOAT_TO_UBYTE(UB, F) \ + do { \ + fi_type __tmp; \ + __tmp.f = (F); \ + if (__tmp.i < 0) \ + UB = (GLubyte) 0; \ + else if (__tmp.i >= IEEE_0996) \ + UB = (GLubyte) 255; \ + else { \ + __tmp.f = __tmp.f * (255.0F/256.0F) + 32768.0F; \ + UB = (GLubyte) __tmp.i; \ + } \ + } while (0) +#define CLAMPED_FLOAT_TO_UBYTE(UB, F) \ + do { \ + fi_type __tmp; \ + __tmp.f = (F) * (255.0F/256.0F) + 32768.0F; \ + UB = (GLubyte) __tmp.i; \ + } while (0) +#else +#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \ + ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F)) +#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \ + ub = ((GLubyte) IROUND((f) * 255.0F)) +#endif + /*@}*/ diff --git a/mesalib/src/mesa/main/mfeatures.h b/mesalib/src/mesa/main/mfeatures.h index cb96c4d1d..92311ef7f 100644 --- a/mesalib/src/mesa/main/mfeatures.h +++ b/mesalib/src/mesa/main/mfeatures.h @@ -42,9 +42,6 @@ /** * A feature can be anything. But most of them share certain characteristics. * - * When a feature defines driver entries, they can be initialized by - * _MESA_INIT_<FEATURE>_FUNCTIONS - * * When a feature defines vtxfmt entries, they can be initialized and * installed by * _MESA_INIT_<FEATURE>_VTXFMT @@ -68,62 +65,85 @@ * enabled or not. */ +#ifndef FEATURE_ES1 +#define FEATURE_ES1 0 +#endif +#ifndef FEATURE_ES2 +#define FEATURE_ES2 0 +#endif + +#define FEATURE_ES (FEATURE_ES1 || FEATURE_ES2) + +#ifndef FEATURE_GL +#define FEATURE_GL !FEATURE_ES +#endif + #ifdef IN_DRI_DRIVER -#define FEATURE_remap_table 1 +#define FEATURE_remap_table 1 #else -#define FEATURE_remap_table 0 +#define FEATURE_remap_table 0 #endif -#define FEATURE_accum _HAVE_FULL_GL -#define FEATURE_arrayelt _HAVE_FULL_GL -#define FEATURE_attrib_stack _HAVE_FULL_GL +#define FEATURE_dispatch 1 +#define FEATURE_texgen 1 +#define FEATURE_userclip 1 + +#define FEATURE_accum FEATURE_GL +#define FEATURE_arrayelt FEATURE_GL +#define FEATURE_attrib_stack FEATURE_GL /* this disables vtxfmt, api_loopback, and api_noop completely */ -#define FEATURE_beginend _HAVE_FULL_GL -#define FEATURE_colortable _HAVE_FULL_GL -#define FEATURE_convolve _HAVE_FULL_GL -#define FEATURE_dispatch _HAVE_FULL_GL -#define FEATURE_dlist (_HAVE_FULL_GL && FEATURE_arrayelt && FEATURE_beginend) -#define FEATURE_draw_read_buffer _HAVE_FULL_GL -#define FEATURE_drawpix _HAVE_FULL_GL -#define FEATURE_evaluators _HAVE_FULL_GL -#define FEATURE_feedback _HAVE_FULL_GL -#define FEATURE_fixedpt 0 -#define FEATURE_histogram _HAVE_FULL_GL -#define FEATURE_pixel_transfer _HAVE_FULL_GL -#define FEATURE_point_size_array 0 -#define FEATURE_queryobj _HAVE_FULL_GL -#define FEATURE_rastpos _HAVE_FULL_GL -#define FEATURE_texgen _HAVE_FULL_GL -#define FEATURE_texture_fxt1 _HAVE_FULL_GL -#define FEATURE_texture_s3tc _HAVE_FULL_GL -#define FEATURE_userclip _HAVE_FULL_GL -#define FEATURE_vertex_array_byte 0 -#define FEATURE_es2_glsl 0 - -#define FEATURE_ARB_fragment_program _HAVE_FULL_GL -#define FEATURE_ARB_framebuffer_object _HAVE_FULL_GL -#define FEATURE_ARB_map_buffer_range _HAVE_FULL_GL -#define FEATURE_ARB_pixel_buffer_object _HAVE_FULL_GL -#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL -#define FEATURE_ARB_vertex_program _HAVE_FULL_GL -#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL -#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL -#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader) -#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects -#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects -#define FEATURE_ARB_sync _HAVE_FULL_GL - -#define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL -#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL -#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL -#define FEATURE_APPLE_object_purgeable _HAVE_FULL_GL -#define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL -#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL -#define FEATURE_NV_fence _HAVE_FULL_GL -#define FEATURE_NV_fragment_program _HAVE_FULL_GL -#define FEATURE_NV_vertex_program _HAVE_FULL_GL - -#define FEATURE_OES_EGL_image _HAVE_FULL_GL +#define FEATURE_beginend FEATURE_GL +#define FEATURE_colortable FEATURE_GL +#define FEATURE_convolve FEATURE_GL +#define FEATURE_dlist (FEATURE_GL && FEATURE_arrayelt && FEATURE_beginend) +#define FEATURE_draw_read_buffer FEATURE_GL +#define FEATURE_drawpix FEATURE_GL +#define FEATURE_evaluators FEATURE_GL +#define FEATURE_feedback FEATURE_GL +#define FEATURE_histogram FEATURE_GL +#define FEATURE_pixel_transfer FEATURE_GL +#define FEATURE_queryobj FEATURE_GL +#define FEATURE_rastpos FEATURE_GL +#define FEATURE_texture_fxt1 FEATURE_GL +#define FEATURE_texture_s3tc FEATURE_GL + +#define FEATURE_extra_context_init FEATURE_ES +#define FEATURE_fixedpt FEATURE_ES +#define FEATURE_point_size_array FEATURE_ES +#define FEATURE_vertex_array_byte FEATURE_ES + +#define FEATURE_es2_glsl FEATURE_ES2 + +#define FEATURE_ARB_fragment_program 1 +#define FEATURE_ARB_vertex_program 1 +#define FEATURE_ARB_vertex_shader 1 +#define FEATURE_ARB_fragment_shader 1 +#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader) +#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects +#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects +#define FEATURE_ARB_geometry_shader4 FEATURE_ARB_shader_objects + +#define FEATURE_ARB_framebuffer_object (FEATURE_GL && FEATURE_EXT_framebuffer_object) +#define FEATURE_ARB_map_buffer_range FEATURE_GL +#define FEATURE_ARB_pixel_buffer_object (FEATURE_GL && FEATURE_EXT_pixel_buffer_object) +#define FEATURE_ARB_sync FEATURE_GL +#define FEATURE_ARB_vertex_buffer_object 1 + +#define FEATURE_EXT_framebuffer_blit FEATURE_GL +#define FEATURE_EXT_framebuffer_object 1 +#define FEATURE_EXT_pixel_buffer_object 1 +#define FEATURE_EXT_texture_sRGB FEATURE_GL +#define FEATURE_EXT_transform_feedback FEATURE_GL + +#define FEATURE_APPLE_object_purgeable FEATURE_GL +#define FEATURE_ATI_fragment_shader FEATURE_GL +#define FEATURE_NV_fence FEATURE_GL +#define FEATURE_NV_fragment_program FEATURE_GL +#define FEATURE_NV_vertex_program FEATURE_GL +#define FEATURE_OES_EGL_image 1 +#define FEATURE_OES_draw_texture FEATURE_ES1 +#define FEATURE_OES_framebuffer_object FEATURE_ES +#define FEATURE_OES_mapbuffer FEATURE_ES #endif /* FEATURES_H */ diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index 51f7edfab..3d1a4c49c 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -415,7 +415,7 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth, GLuint i, j, k; const GLuint *rowA = (const GLuint *) srcRowA; const GLuint *rowB = (const GLuint *) srcRowB; - GLfloat *dst = (GLfloat *) dstRow; + GLuint *dst = (GLuint *) dstRow; for (i = j = 0, k = k0; i < (GLuint) dstWidth; i++, j += colStride, k += colStride) { dst[i] = (GLfloat)(rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4); @@ -1005,21 +1005,28 @@ make_2d_mipmap(GLenum datatype, GLuint comps, GLint border, const GLint dstRowBytes = bpt * dstRowStride; const GLubyte *srcA, *srcB; GLubyte *dst; - GLint row; + GLint row, srcRowStep; /* Compute src and dst pointers, skipping any border */ srcA = srcPtr + border * ((srcWidth + 1) * bpt); - if (srcHeight > 1) + if (srcHeight > 1 && srcHeight > dstHeight) { + /* sample from two source rows */ srcB = srcA + srcRowBytes; - else + srcRowStep = 2; + } + else { + /* sample from one source row */ srcB = srcA; + srcRowStep = 1; + } + dst = dstPtr + border * ((dstWidth + 1) * bpt); for (row = 0; row < dstHeightNB; row++) { do_row(datatype, comps, srcWidthNB, srcA, srcB, dstWidthNB, dst); - srcA += 2 * srcRowBytes; - srcB += 2 * srcRowBytes; + srcA += srcRowStep * srcRowBytes; + srcB += srcRowStep * srcRowBytes; dst += dstRowBytes; } @@ -1581,7 +1588,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, struct gl_texture_image *dstImage; GLint srcWidth, srcHeight, srcDepth; GLint dstWidth, dstHeight, dstDepth; - GLint border, bytesPerTexel; + GLint border; GLboolean nextLevel; /* get src image parameters */ @@ -1623,33 +1630,24 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstImage->FetchTexelc = srcImage->FetchTexelc; dstImage->FetchTexelf = srcImage->FetchTexelf; - /* Alloc new teximage data buffer. - * Setup src and dest data pointers. - */ - if (_mesa_is_format_compressed(dstImage->TexFormat)) { - GLuint dstCompressedSize = - _mesa_format_image_size(dstImage->TexFormat, dstImage->Width, - dstImage->Height, dstImage->Depth); - ASSERT(dstCompressedSize > 0); - - dstImage->Data = _mesa_alloc_texmemory(dstCompressedSize); + /* Alloc new teximage data buffer */ + { + GLuint size = _mesa_format_image_size(dstImage->TexFormat, + dstWidth, dstHeight, dstDepth); + dstImage->Data = _mesa_alloc_texmemory(size); if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; } + } + + /* Setup src and dest data pointers */ + if (_mesa_is_format_compressed(dstImage->TexFormat)) { /* srcData and dstData are already set */ ASSERT(srcData); ASSERT(dstData); } else { - bytesPerTexel = _mesa_get_format_bytes(dstImage->TexFormat); - ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); - dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight - * dstDepth * bytesPerTexel); - if (!dstImage->Data) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); - return; - } srcData = (const GLubyte *) srcImage->Data; dstData = (GLubyte *) dstImage->Data; } diff --git a/mesalib/src/mesa/main/mm.c b/mesalib/src/mesa/main/mm.c index 3ef38e94b..25a029370 100644 --- a/mesalib/src/mesa/main/mm.c +++ b/mesalib/src/mesa/main/mm.c @@ -22,6 +22,11 @@ * */ +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> + +#include "compiler.h" #include "mm.h" diff --git a/mesalib/src/mesa/main/mm.h b/mesalib/src/mesa/main/mm.h index df340808a..228721ca2 100644 --- a/mesalib/src/mesa/main/mm.h +++ b/mesalib/src/mesa/main/mm.h @@ -32,9 +32,6 @@ #define MM_H -#include "imports.h" - - struct mem_block { struct mem_block *next, *prev; struct mem_block *next_free, *prev_free; diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 9d9b475dd..5494be8f4 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -36,12 +36,19 @@ #include "main/glheader.h" #include "main/config.h" -#include "main/compiler.h" #include "main/mfeatures.h" #include "glapi/glapi.h" #include "math/m_matrix.h" /* GLmatrix */ #include "main/simple_list.h" /* struct simple_node */ +/* Shader stages. Note that these will become 5 with tessellation. + * These MUST have the same values as PIPE_SHADER_* + */ +#define MESA_SHADER_VERTEX 0 +#define MESA_SHADER_FRAGMENT 1 +#define MESA_SHADER_GEOMETRY 2 +#define MESA_SHADER_TYPES 3 + /** * Color channel data type. @@ -238,6 +245,78 @@ typedef enum } gl_vert_result; +/*********************************************/ + +/** + * Indexes for geometry program attributes. + */ +typedef enum +{ + GEOM_ATTRIB_POSITION = 0, + GEOM_ATTRIB_COLOR0 = 1, + GEOM_ATTRIB_COLOR1 = 2, + GEOM_ATTRIB_SECONDARY_COLOR0 = 3, + GEOM_ATTRIB_SECONDARY_COLOR1 = 4, + GEOM_ATTRIB_FOG_FRAG_COORD = 5, + GEOM_ATTRIB_POINT_SIZE = 6, + GEOM_ATTRIB_CLIP_VERTEX = 7, + GEOM_ATTRIB_PRIMITIVE_ID = 8, + GEOM_ATTRIB_TEX_COORD = 9, + + GEOM_ATTRIB_VAR0 = 16, + GEOM_ATTRIB_MAX = (GEOM_ATTRIB_VAR0 + MAX_VARYING) +} gl_geom_attrib; + +/** + * Bitflags for geometry attributes. + * These are used in bitfields in many places. + */ +/*@{*/ +#define GEOM_BIT_COLOR0 (1 << GEOM_ATTRIB_COLOR0) +#define GEOM_BIT_COLOR1 (1 << GEOM_ATTRIB_COLOR1) +#define GEOM_BIT_SCOLOR0 (1 << GEOM_ATTRIB_SECONDARY_COLOR0) +#define GEOM_BIT_SCOLOR1 (1 << GEOM_ATTRIB_SECONDARY_COLOR1) +#define GEOM_BIT_TEX_COORD (1 << GEOM_ATTRIB_TEX_COORD) +#define GEOM_BIT_FOG_COORD (1 << GEOM_ATTRIB_FOG_FRAG_COORD) +#define GEOM_BIT_POSITION (1 << GEOM_ATTRIB_POSITION) +#define GEOM_BIT_POINT_SIDE (1 << GEOM_ATTRIB_POINT_SIZE) +#define GEOM_BIT_CLIP_VERTEX (1 << GEOM_ATTRIB_CLIP_VERTEX) +#define GEOM_BIT_PRIM_ID (1 << GEOM_ATTRIB_PRIMITIVE_ID) +#define GEOM_BIT_VAR0 (1 << GEOM_ATTRIB_VAR0) + +#define GEOM_BIT_VAR(g) (1 << (GEOM_BIT_VAR0 + (g))) +/*@}*/ + + +/** + * Indexes for geometry program result attributes + */ +/*@{*/ +typedef enum { + GEOM_RESULT_POS = 0, + GEOM_RESULT_COL0 = 1, + GEOM_RESULT_COL1 = 2, + GEOM_RESULT_SCOL0 = 3, + GEOM_RESULT_SCOL1 = 4, + GEOM_RESULT_FOGC = 5, + GEOM_RESULT_TEX0 = 6, + GEOM_RESULT_TEX1 = 7, + GEOM_RESULT_TEX2 = 8, + GEOM_RESULT_TEX3 = 9, + GEOM_RESULT_TEX4 = 10, + GEOM_RESULT_TEX5 = 11, + GEOM_RESULT_TEX6 = 12, + GEOM_RESULT_TEX7 = 13, + GEOM_RESULT_PSIZ = 14, + GEOM_RESULT_CLPV = 15, + GEOM_RESULT_PRID = 16, + GEOM_RESULT_LAYR = 17, + GEOM_RESULT_VAR0 = 18, /**< shader varying, should really be 16 */ + /* ### we need to -2 because var0 is 18 instead 16 like in the others */ + GEOM_RESULT_MAX = (GEOM_RESULT_VAR0 + MAX_VARYING - 2) +} gl_geom_result; +/*@}*/ + /** * Indexes for fragment program input attributes. */ @@ -1076,6 +1155,7 @@ typedef enum #define T_BIT 2 #define R_BIT 4 #define Q_BIT 8 +#define STR_BITS (S_BIT | T_BIT | R_BIT) /*@}*/ @@ -1547,12 +1627,15 @@ struct gl_array_attrib GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */ GLuint LockCount; /**< GL_EXT_compiled_vertex_array */ + /** GL 3.1 (slightly different from GL_NV_primitive_restart) */ + GLboolean PrimitiveRestart; + GLuint RestartIndex; + GLbitfield NewState; /**< mask of _NEW_ARRAY_* values */ -#if FEATURE_ARB_vertex_buffer_object + /* GL_ARB_vertex_buffer_object */ struct gl_buffer_object *ArrayBufferObj; struct gl_buffer_object *ElementArrayBufferObj; -#endif }; @@ -1724,6 +1807,11 @@ struct gl_program /** Which texture target is being sampled (TEXTURE_1D/2D/3D/etc_INDEX) */ gl_texture_index SamplerTargets[MAX_SAMPLERS]; + /** Bitmask of which register files are read/written with indirect + * addressing. Mask of (1 << PROGRAM_x) bits. + */ + GLbitfield IndirectRegisterFiles; + /** Logical counts */ /*@{*/ GLuint NumInstructions; @@ -1758,6 +1846,18 @@ struct gl_vertex_program }; +/** Geometry program object */ +struct gl_geometry_program +{ + struct gl_program Base; /**< base class */ + + GLint VerticesOut; + GLenum InputType; /**< GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_ARB, + GL_TRIANGLES, or GL_TRIANGLES_ADJACENCY_ARB */ + GLenum OutputType; /**< GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP */ +}; + + /** Fragment program object */ struct gl_fragment_program { @@ -1816,6 +1916,26 @@ struct gl_vertex_program_state /** + * Context state for geometry programs. + */ +struct gl_geometry_program_state +{ + GLboolean Enabled; /**< GL_ARB_GEOMETRY_SHADER4 */ + GLboolean _Enabled; /**< Enabled and valid program? */ + struct gl_geometry_program *Current; /**< user-bound geometry program */ + + /** Currently enabled and valid program (including internal programs + * and compiled shader programs). + */ + struct gl_geometry_program *_Current; + + GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */ + + /** Cache of fixed-function programs */ + struct gl_program_cache *Cache; +}; + +/** * Context state for fragment programs. */ struct gl_fragment_program_state @@ -1910,6 +2030,14 @@ struct gl_query_state /** GL_NV_conditional_render */ struct gl_query_object *CondRenderQuery; + + /** GL_EXT_transform_feedback */ + struct gl_query_object *PrimitivesGenerated; + struct gl_query_object *PrimitivesWritten; + + /** GL_ARB_timer_query */ + struct gl_query_object *TimeElapsed; + GLenum CondRenderMode; }; @@ -1944,7 +2072,7 @@ struct gl_sl_pragmas */ struct gl_shader { - GLenum Type; /**< GL_FRAGMENT_SHADER || GL_VERTEX_SHADER (first field!) */ + GLenum Type; /**< GL_FRAGMENT_SHADER || GL_VERTEX_SHADER || GL_GEOMETRY_SHADER_ARB (first field!) */ GLuint Name; /**< AKA the handle */ GLint RefCount; /**< Reference count */ GLboolean DeletePending; @@ -1956,6 +2084,15 @@ struct gl_shader struct gl_program *Program; /**< Post-compile assembly code */ GLchar *InfoLog; struct gl_sl_pragmas Pragmas; + + unsigned Version; /**< GLSL version used for linking */ + + struct exec_list *ir; + struct glsl_symbol_table *symbols; + + /** Shaders containing built-in functions that are used for linking. */ + struct gl_shader *builtins_to_link[16]; + unsigned num_builtins_to_link; }; @@ -1976,15 +2113,41 @@ struct gl_shader_program /** User-defined attribute bindings (glBindAttribLocation) */ struct gl_program_parameter_list *Attributes; + /** Transform feedback varyings */ + struct { + GLenum BufferMode; + GLuint NumVarying; + GLchar **VaryingNames; /**< Array [NumVarying] of char * */ + } TransformFeedback; + + /** Geometry shader state - copied into gl_geometry_program at link time */ + struct { + GLint VerticesOut; + GLenum InputType; /**< GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_ARB, + GL_TRIANGLES, or GL_TRIANGLES_ADJACENCY_ARB */ + GLenum OutputType; /**< GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP */ + } Geom; + /* post-link info: */ struct gl_vertex_program *VertexProgram; /**< Linked vertex program */ struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */ + struct gl_geometry_program *GeometryProgram; /**< Linked geometry prog */ struct gl_uniform_list *Uniforms; struct gl_program_parameter_list *Varying; GLboolean LinkStatus; /**< GL_LINK_STATUS */ GLboolean Validated; GLboolean _Used; /**< Ever used for drawing? */ GLchar *InfoLog; + + unsigned Version; /**< GLSL version used for linking */ + + /** + * Per-stage shaders resulting from the first stage of linking. + */ + /*@{*/ + GLuint _NumLinkedShaders; + struct gl_shader *_LinkedShaders[2]; + /*@}*/ }; @@ -2004,17 +2167,89 @@ struct gl_shader_program struct gl_shader_state { struct gl_shader_program *CurrentProgram; /**< The user-bound program */ + void *MemPool; + + GLbitfield Flags; /**< Mask of GLSL_x flags */ +}; + +/** + * Compiler options for a single GLSL shaders type + */ +struct gl_shader_compiler_options +{ /** Driver-selectable options: */ - GLboolean EmitHighLevelInstructions; /**< IF/ELSE/ENDIF vs. BRA, etc. */ - GLboolean EmitContReturn; /**< Emit CONT/RET opcodes? */ GLboolean EmitCondCodes; /**< Use condition codes? */ - GLboolean EmitComments; /**< Annotated instructions */ GLboolean EmitNVTempInitialization; /**< 0-fill NV temp registers */ - void *MemPool; - GLbitfield Flags; /**< Mask of GLSL_x flags */ + /** + * Attempts to flatten all ir_if (OPCODE_IF) for GPUs that can't + * support control flow. + */ + GLboolean EmitNoIfs; + GLboolean EmitNoLoops; + GLboolean EmitNoFunctions; + GLboolean EmitNoCont; /**< Emit CONT opcode? */ + GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */ + GLboolean EmitNoNoise; /**< Emit NOISE opcodes? */ + + /** + * \name Forms of indirect addressing the driver cannot do. + */ + /*@{*/ + GLboolean EmitNoIndirectInput; /**< No indirect addressing of inputs */ + GLboolean EmitNoIndirectOutput; /**< No indirect addressing of outputs */ + GLboolean EmitNoIndirectTemp; /**< No indirect addressing of temps */ + GLboolean EmitNoIndirectUniform; /**< No indirect addressing of constants */ + /*@}*/ + + GLuint MaxUnrollIterations; + struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */ }; +/** + * Transform feedback object state + */ +struct gl_transform_feedback_object +{ + GLuint Name; /**< AKA the object ID */ + GLint RefCount; + GLboolean Active; /**< Is transform feedback enabled? */ + GLboolean Paused; /**< Is transform feedback paused? */ + + /** The feedback buffers */ + GLuint BufferNames[MAX_FEEDBACK_ATTRIBS]; + struct gl_buffer_object *Buffers[MAX_FEEDBACK_ATTRIBS]; + + /** Start of feedback data in dest buffer */ + GLintptr Offset[MAX_FEEDBACK_ATTRIBS]; + /** Max data to put into dest buffer (in bytes) */ + GLsizeiptr Size[MAX_FEEDBACK_ATTRIBS]; +}; + + +/** + * Context state for transform feedback. + */ +struct gl_transform_feedback +{ + GLenum Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */ + + GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */ + + /** The general binding point (GL_TRANSFORM_FEEDBACK_BUFFER) */ + struct gl_buffer_object *CurrentBuffer; + + /** The table of all transform feedback objects */ + struct _mesa_HashTable *Objects; + + /** The current xform-fb object (GL_TRANSFORM_FEEDBACK_BINDING) */ + struct gl_transform_feedback_object *CurrentObject; + + /** The default xform-fb object (Name==0) */ + struct gl_transform_feedback_object *DefaultObject; +}; + + /** * State which can be shared by multiple contexts: @@ -2047,40 +2282,30 @@ struct gl_shared_state struct gl_buffer_object *NullBufferObj; /** - * \name Vertex/fragment programs + * \name Vertex/geometry/fragment programs */ /*@{*/ struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */ -#if FEATURE_ARB_vertex_program struct gl_vertex_program *DefaultVertexProgram; -#endif -#if FEATURE_ARB_fragment_program struct gl_fragment_program *DefaultFragmentProgram; -#endif + struct gl_geometry_program *DefaultGeometryProgram; /*@}*/ -#if FEATURE_ATI_fragment_shader + /* GL_ATI_fragment_shader */ struct _mesa_HashTable *ATIShaders; struct ati_fragment_shader *DefaultFragmentShader; -#endif -#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object struct _mesa_HashTable *BufferObjects; -#endif -#if FEATURE_ARB_shader_objects /** Table of both gl_shader and gl_shader_program objects */ struct _mesa_HashTable *ShaderObjects; -#endif -#if FEATURE_EXT_framebuffer_object + /* GL_EXT_framebuffer_object */ struct _mesa_HashTable *RenderBuffers; struct _mesa_HashTable *FrameBuffers; -#endif -#if FEATURE_ARB_sync + /* GL_ARB_sync */ struct simple_node SyncObjects; -#endif void *DriverData; /**< Device driver shared state */ }; @@ -2289,32 +2514,39 @@ struct gl_framebuffer /** - * Limits for vertex and fragment programs. + * Limits for vertex and fragment programs/shaders. */ struct gl_program_constants { /* logical limits */ GLuint MaxInstructions; - GLuint MaxAluInstructions; /* fragment programs only, for now */ - GLuint MaxTexInstructions; /* fragment programs only, for now */ - GLuint MaxTexIndirections; /* fragment programs only, for now */ + GLuint MaxAluInstructions; + GLuint MaxTexInstructions; + GLuint MaxTexIndirections; GLuint MaxAttribs; GLuint MaxTemps; - GLuint MaxAddressRegs; /* vertex program only, for now */ + GLuint MaxAddressRegs; GLuint MaxParameters; GLuint MaxLocalParams; GLuint MaxEnvParams; /* native/hardware limits */ GLuint MaxNativeInstructions; - GLuint MaxNativeAluInstructions; /* fragment programs only, for now */ - GLuint MaxNativeTexInstructions; /* fragment programs only, for now */ - GLuint MaxNativeTexIndirections; /* fragment programs only, for now */ + GLuint MaxNativeAluInstructions; + GLuint MaxNativeTexInstructions; + GLuint MaxNativeTexIndirections; GLuint MaxNativeAttribs; GLuint MaxNativeTemps; - GLuint MaxNativeAddressRegs; /* vertex program only, for now */ + GLuint MaxNativeAddressRegs; GLuint MaxNativeParameters; /* For shaders */ GLuint MaxUniformComponents; + /* GL_ARB_geometry_shader4 */ + GLuint MaxGeometryTextureImageUnits; + GLuint MaxGeometryVaryingComponents; + GLuint MaxVertexVaryingComponents; + GLuint MaxGeometryUniformComponents; + GLuint MaxGeometryOutputVertices; + GLuint MaxGeometryTotalOutputComponents; }; @@ -2361,6 +2593,7 @@ struct gl_constants struct gl_program_constants VertexProgram; /**< GL_ARB_vertex_program */ struct gl_program_constants FragmentProgram; /**< GL_ARB_fragment_program */ + struct gl_program_constants GeometryProgram; /**< GL_ARB_geometry_shader4 */ GLuint MaxProgramMatrices; GLuint MaxProgramMatrixStackDepth; @@ -2375,16 +2608,29 @@ struct gl_constants GLuint MaxVarying; /**< Number of float[4] varying parameters */ - GLbitfield SupportedBumpUnits; /**> units supporting GL_ATI_envmap_bumpmap as targets */ + GLuint GLSLVersion; /**< GLSL version supported (ex: 120 = 1.20) */ + + /** Which texture units support GL_ATI_envmap_bumpmap as targets */ + GLbitfield SupportedBumpUnits; /** * Maximum amount of time, measured in nanseconds, that the server can wait. */ GLuint64 MaxServerWaitTimeout; - - /**< GL_EXT_provoking_vertex */ + /** GL_EXT_provoking_vertex */ GLboolean QuadsFollowProvokingVertexConvention; + + /** OpenGL version 3.0 */ + GLbitfield ContextFlags; /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */ + + /** OpenGL version 3.2 */ + GLbitfield ProfileMask; /**< Mask of CONTEXT_x_PROFILE_BIT */ + + /** GL_EXT_transform_feedback */ + GLuint MaxTransformFeedbackSeparateAttribs; + GLuint MaxTransformFeedbackSeparateComponents; + GLuint MaxTransformFeedbackInterleavedComponents; }; @@ -2395,32 +2641,40 @@ struct gl_constants struct gl_extensions { GLboolean dummy; /* don't remove this! */ + GLboolean ARB_blend_func_extended; GLboolean ARB_copy_buffer; - GLboolean ARB_depth_texture; + GLboolean ARB_depth_buffer_float; GLboolean ARB_depth_clamp; + GLboolean ARB_depth_texture; GLboolean ARB_draw_buffers; GLboolean ARB_draw_elements_base_vertex; + GLboolean ARB_draw_instanced; GLboolean ARB_fragment_coord_conventions; GLboolean ARB_fragment_program; GLboolean ARB_fragment_program_shadow; GLboolean ARB_fragment_shader; GLboolean ARB_framebuffer_object; + GLboolean ARB_explicit_attrib_location; + GLboolean ARB_geometry_shader4; GLboolean ARB_half_float_pixel; GLboolean ARB_half_float_vertex; GLboolean ARB_imaging; + GLboolean ARB_instanced_arrays; GLboolean ARB_map_buffer_range; GLboolean ARB_multisample; GLboolean ARB_multitexture; GLboolean ARB_occlusion_query; + GLboolean ARB_occlusion_query2; GLboolean ARB_point_sprite; + GLboolean ARB_sampler_objects; GLboolean ARB_seamless_cube_map; GLboolean ARB_shader_objects; GLboolean ARB_shading_language_100; - GLboolean ARB_shading_language_120; GLboolean ARB_shadow; - GLboolean ARB_shadow_ambient; /* or GL_ARB_shadow_ambient */ + GLboolean ARB_shadow_ambient; GLboolean ARB_sync; GLboolean ARB_texture_border_clamp; + GLboolean ARB_texture_buffer_object; GLboolean ARB_texture_compression; GLboolean ARB_texture_cube_map; GLboolean ARB_texture_env_combine; @@ -2428,12 +2682,19 @@ struct gl_extensions GLboolean ARB_texture_env_dot3; GLboolean ARB_texture_float; GLboolean ARB_texture_mirrored_repeat; + GLboolean ARB_texture_multisample; GLboolean ARB_texture_non_power_of_two; + GLboolean ARB_texture_rg; + GLboolean ARB_texture_rgb10_a2ui; + GLboolean ARB_timer_query; + GLboolean ARB_transform_feedback2; GLboolean ARB_transpose_matrix; + GLboolean ARB_uniform_buffer_object; GLboolean ARB_vertex_array_object; GLboolean ARB_vertex_buffer_object; GLboolean ARB_vertex_program; GLboolean ARB_vertex_shader; + GLboolean ARB_vertex_type_2_10_10_10_rev; GLboolean ARB_window_pos; GLboolean EXT_abgr; GLboolean EXT_bgra; @@ -2455,11 +2716,13 @@ struct gl_extensions GLboolean EXT_framebuffer_blit; GLboolean EXT_framebuffer_multisample; GLboolean EXT_framebuffer_object; + GLboolean EXT_framebuffer_sRGB; GLboolean EXT_gpu_program_parameters; GLboolean EXT_histogram; GLboolean EXT_multi_draw_arrays; GLboolean EXT_paletted_texture; GLboolean EXT_packed_depth_stencil; + GLboolean EXT_packed_float; GLboolean EXT_packed_pixels; GLboolean EXT_pixel_buffer_object; GLboolean EXT_point_parameters; @@ -2478,14 +2741,18 @@ struct gl_extensions GLboolean EXT_texture3D; GLboolean EXT_texture_array; GLboolean EXT_texture_compression_s3tc; + GLboolean EXT_texture_compression_rgtc; GLboolean EXT_texture_env_add; GLboolean EXT_texture_env_combine; GLboolean EXT_texture_env_dot3; GLboolean EXT_texture_filter_anisotropic; + GLboolean EXT_texture_integer; GLboolean EXT_texture_lod_bias; GLboolean EXT_texture_mirror_clamp; + GLboolean EXT_texture_shared_exponent; GLboolean EXT_texture_sRGB; GLboolean EXT_texture_swizzle; + GLboolean EXT_transform_feedback; GLboolean EXT_timer_query; GLboolean EXT_vertex_array; GLboolean EXT_vertex_array_bgra; @@ -2514,6 +2781,7 @@ struct gl_extensions GLboolean NV_fragment_program_option; GLboolean NV_light_max_exponent; GLboolean NV_point_sprite; + GLboolean NV_primitive_restart; GLboolean NV_texgen_reflection; GLboolean NV_texture_env_combine4; GLboolean NV_texture_rectangle; @@ -2528,9 +2796,8 @@ struct gl_extensions GLboolean SGIS_texture_lod; GLboolean TDFX_texture_compression_FXT1; GLboolean S3_s3tc; -#if FEATURE_OES_draw_texture + GLboolean OES_EGL_image; GLboolean OES_draw_texture; -#endif /* FEATURE_OES_draw_texture */ /** The extension string */ const GLubyte *String; /** Number of supported extensions */ @@ -2815,6 +3082,14 @@ struct gl_dlist_state } Current; }; +/** + * Enum for the OpenGL APIs we know about and may support. + */ +typedef enum { + API_OPENGL, + API_OPENGLES, + API_OPENGLES2 +} gl_api; /** * Mesa rendering context. @@ -2833,6 +3108,7 @@ struct __GLcontextRec /** \name API function pointer tables */ /*@{*/ + gl_api API; struct _glapi_table *Save; /**< Display list save functions */ struct _glapi_table *Exec; /**< Execute functions */ struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */ @@ -2947,21 +3223,24 @@ struct __GLcontextRec struct gl_program_state Program; /**< general program state */ struct gl_vertex_program_state VertexProgram; struct gl_fragment_program_state FragmentProgram; + struct gl_geometry_program_state GeometryProgram; struct gl_ati_fragment_shader_state ATIFragmentShader; struct gl_shader_state Shader; /**< GLSL shader object state */ + struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_TYPES]; struct gl_query_state Query; /**< occlusion, timer queries */ + struct gl_transform_feedback TransformFeedback; + struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */ struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */ /*@}*/ struct gl_meta_state *Meta; /**< for "meta" operations */ -#if FEATURE_EXT_framebuffer_object + /* GL_EXT_framebuffer_object */ struct gl_renderbuffer *CurrentRenderbuffer; -#endif GLenum ErrorValue; /**< Last error code */ diff --git a/mesalib/src/mesa/main/multisample.h b/mesalib/src/mesa/main/multisample.h index 4305900cc..998488ef4 100644 --- a/mesalib/src/mesa/main/multisample.h +++ b/mesalib/src/mesa/main/multisample.h @@ -26,6 +26,7 @@ #ifndef MULTISAMPLE_H #define MULTISAMPLE_H +#include "mtypes.h" extern void GLAPIENTRY _mesa_SampleCoverageARB(GLclampf value, GLboolean invert); diff --git a/mesalib/src/mesa/shader/nvprogram.c b/mesalib/src/mesa/main/nvprogram.c index 19020be42..3a570b7dd 100644 --- a/mesalib/src/mesa/shader/nvprogram.c +++ b/mesalib/src/mesa/main/nvprogram.c @@ -42,13 +42,13 @@ #include "main/hash.h" #include "main/imports.h" #include "main/macros.h" -#include "program.h" -#include "prog_parameter.h" -#include "prog_instruction.h" -#include "nvfragparse.h" -#include "nvvertparse.h" -#include "arbprogparse.h" -#include "nvprogram.h" +#include "main/nvprogram.h" +#include "program/arbprogparse.h" +#include "program/nvfragparse.h" +#include "program/nvvertparse.h" +#include "program/program.h" +#include "program/prog_instruction.h" +#include "program/prog_parameter.h" @@ -516,8 +516,10 @@ _mesa_emit_nv_temp_initialization(GLcontext *ctx, { struct prog_instruction *inst; GLuint i; + struct gl_shader_compiler_options* options = + &ctx->ShaderCompilerOptions[_mesa_program_target_to_index(program->Target)]; - if (!ctx->Shader.EmitNVTempInitialization) + if (!options->EmitNVTempInitialization) return; /* We'll swizzle up a zero temporary so we can use it for the diff --git a/mesalib/src/mesa/shader/nvprogram.h b/mesalib/src/mesa/main/nvprogram.h index 8ee59661b..260a25ba9 100644 --- a/mesalib/src/mesa/shader/nvprogram.h +++ b/mesalib/src/mesa/main/nvprogram.h @@ -29,6 +29,8 @@ #ifndef NVPROGRAM_H #define NVPROGRAM_H +#include "glheader.h" +#include "mtypes.h" extern void GLAPIENTRY _mesa_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params); diff --git a/mesalib/src/mesa/main/pixelstore.h b/mesalib/src/mesa/main/pixelstore.h index ee963f9ba..47bff4276 100644 --- a/mesalib/src/mesa/main/pixelstore.h +++ b/mesalib/src/mesa/main/pixelstore.h @@ -33,6 +33,7 @@ #include "glheader.h" +#include "mtypes.h" extern void GLAPIENTRY diff --git a/mesalib/src/mesa/main/querymatrix.c b/mesalib/src/mesa/main/querymatrix.c new file mode 100644 index 000000000..36236eb9a --- /dev/null +++ b/mesalib/src/mesa/main/querymatrix.c @@ -0,0 +1,216 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + **************************************************************************/ + + +/** + * Code to implement GL_OES_query_matrix. See the spec at: + * http://www.khronos.org/registry/gles/extensions/OES/OES_query_matrix.txt + */ + + +#include <stdlib.h> +#include <math.h> +#include "GLES/gl.h" +#include "GLES/glext.h" + + +/** + * This is from the GL_OES_query_matrix extension specification: + * + * GLbitfield glQueryMatrixxOES( GLfixed mantissa[16], + * GLint exponent[16] ) + * mantissa[16] contains the contents of the current matrix in GLfixed + * format. exponent[16] contains the unbiased exponents applied to the + * matrix components, so that the internal representation of component i + * is close to mantissa[i] * 2^exponent[i]. The function returns a status + * word which is zero if all the components are valid. If + * status & (1<<i) != 0, the component i is invalid (e.g., NaN, Inf). + * The implementations are not required to keep track of overflows. In + * that case, the invalid bits are never set. + */ + +#define INT_TO_FIXED(x) ((GLfixed) ((x) << 16)) +#define FLOAT_TO_FIXED(x) ((GLfixed) ((x) * 65536.0)) + +#if defined(_MSC_VER) +/* Oddly, the fpclassify() function doesn't exist in such a form + * on MSVC. This is an implementation using slightly different + * lower-level Windows functions. + */ +#include <float.h> + +enum {FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, FP_NORMAL} +fpclassify(double x) +{ + switch(_fpclass(x)) { + case _FPCLASS_SNAN: /* signaling NaN */ + case _FPCLASS_QNAN: /* quiet NaN */ + return FP_NAN; + case _FPCLASS_NINF: /* negative infinity */ + case _FPCLASS_PINF: /* positive infinity */ + return FP_INFINITE; + case _FPCLASS_NN: /* negative normal */ + case _FPCLASS_PN: /* positive normal */ + return FP_NORMAL; + case _FPCLASS_ND: /* negative denormalized */ + case _FPCLASS_PD: /* positive denormalized */ + return FP_SUBNORMAL; + case _FPCLASS_NZ: /* negative zero */ + case _FPCLASS_PZ: /* positive zero */ + return FP_ZERO; + default: + /* Should never get here; but if we do, this will guarantee + * that the pattern is not treated like a number. + */ + return FP_NAN; + } +} + +#elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \ + defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \ + (defined(__sun) && defined(__C99FEATURES__)) || defined(__MINGW32__) || \ + (defined(__sun) && defined(__GNUC__)) + +/* fpclassify is available. */ + +#elif !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 600 + +enum {FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, FP_NORMAL} +fpclassify(double x) +{ + /* XXX do something better someday */ + return FP_NORMAL; +} + +#endif + +extern GLbitfield GL_APIENTRY _es_QueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]); + +/* The Mesa functions we'll need */ +extern void GL_APIENTRY _mesa_GetIntegerv(GLenum pname, GLint *params); +extern void GL_APIENTRY _mesa_GetFloatv(GLenum pname, GLfloat *params); + +GLbitfield GL_APIENTRY _es_QueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]) +{ + GLfloat matrix[16]; + GLint tmp; + GLenum currentMode = GL_FALSE; + GLenum desiredMatrix = GL_FALSE; + /* The bitfield returns 1 for each component that is invalid (i.e. + * NaN or Inf). In case of error, everything is invalid. + */ + GLbitfield rv; + register unsigned int i; + unsigned int bit; + + /* This data structure defines the mapping between the current matrix + * mode and the desired matrix identifier. + */ + static struct { + GLenum currentMode; + GLenum desiredMatrix; + } modes[] = { + {GL_MODELVIEW, GL_MODELVIEW_MATRIX}, + {GL_PROJECTION, GL_PROJECTION_MATRIX}, + {GL_TEXTURE, GL_TEXTURE_MATRIX}, +#if 0 + /* this doesn't exist in GLES */ + {GL_COLOR, GL_COLOR_MATRIX}, +#endif + }; + + /* Call Mesa to get the current matrix in floating-point form. First, + * we have to figure out what the current matrix mode is. + */ + _mesa_GetIntegerv(GL_MATRIX_MODE, &tmp); + currentMode = (GLenum) tmp; + + /* The mode is either GL_FALSE, if for some reason we failed to query + * the mode, or a given mode from the above table. Search for the + * returned mode to get the desired matrix; if we don't find it, + * we can return immediately, as _mesa_GetInteger() will have + * logged the necessary error already. + */ + for (i = 0; i < sizeof(modes)/sizeof(modes[0]); i++) { + if (modes[i].currentMode == currentMode) { + desiredMatrix = modes[i].desiredMatrix; + break; + } + } + if (desiredMatrix == GL_FALSE) { + /* Early error means all values are invalid. */ + return 0xffff; + } + + /* Now pull the matrix itself. */ + _mesa_GetFloatv(desiredMatrix, matrix); + + rv = 0; + for (i = 0, bit = 1; i < 16; i++, bit<<=1) { + float normalizedFraction; + int exp; + + switch (fpclassify(matrix[i])) { + /* A "subnormal" or denormalized number is too small to be + * represented in normal format; but despite that it's a + * valid floating point number. FP_ZERO and FP_NORMAL + * are both valid as well. We should be fine treating + * these three cases as legitimate floating-point numbers. + */ + case FP_SUBNORMAL: + case FP_NORMAL: + case FP_ZERO: + normalizedFraction = (GLfloat)frexp(matrix[i], &exp); + mantissa[i] = FLOAT_TO_FIXED(normalizedFraction); + exponent[i] = (GLint) exp; + break; + + /* If the entry is not-a-number or an infinity, then the + * matrix component is invalid. The invalid flag for + * the component is already set; might as well set the + * other return values to known values. We'll set + * distinct values so that a savvy end user could determine + * whether the matrix component was a NaN or an infinity, + * but this is more useful for debugging than anything else + * since the standard doesn't specify any such magic + * values to return. + */ + case FP_NAN: + mantissa[i] = INT_TO_FIXED(0); + exponent[i] = (GLint) 0; + rv |= bit; + break; + + case FP_INFINITE: + /* Return +/- 1 based on whether it's a positive or + * negative infinity. + */ + if (matrix[i] > 0) { + mantissa[i] = INT_TO_FIXED(1); + } + else { + mantissa[i] = -INT_TO_FIXED(1); + } + exponent[i] = (GLint) 0; + rv |= bit; + break; + + /* We should never get here; but here's a catching case + * in case fpclassify() is returnings something unexpected. + */ + default: + mantissa[i] = INT_TO_FIXED(2); + exponent[i] = (GLint) 0; + rv |= bit; + break; + } + + } /* for each component */ + + /* All done */ + return rv; +} diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c index ba7cfc30f..fd4ee3335 100644 --- a/mesalib/src/mesa/main/queryobj.c +++ b/mesalib/src/mesa/main/queryobj.c @@ -130,6 +130,42 @@ _mesa_init_query_object_functions(struct dd_function_table *driver) } +/** + * Return pointer to the query object binding point for the given target. + * \return NULL if invalid target, else the address of binding point + */ +static struct gl_query_object ** +get_query_binding_point(GLcontext *ctx, GLenum target) +{ + switch (target) { + case GL_SAMPLES_PASSED_ARB: + if (ctx->Extensions.ARB_occlusion_query) + return &ctx->Query.CurrentOcclusionObject; + else + return NULL; + case GL_TIME_ELAPSED_EXT: + if (ctx->Extensions.EXT_timer_query) + return &ctx->Query.CurrentTimerObject; + else + return NULL; +#if FEATURE_EXT_transform_feedback + case GL_PRIMITIVES_GENERATED: + if (ctx->Extensions.EXT_transform_feedback) + return &ctx->Query.PrimitivesGenerated; + else + return NULL; + case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: + if (ctx->Extensions.EXT_transform_feedback) + return &ctx->Query.PrimitivesWritten; + else + return NULL; +#endif + default: + return NULL; + } +} + + void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids) { @@ -214,36 +250,16 @@ _mesa_IsQueryARB(GLuint id) static void GLAPIENTRY _mesa_BeginQueryARB(GLenum target, GLuint id) { - struct gl_query_object *q; + struct gl_query_object *q, **bindpt; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_DEPTH); - switch (target) { - case GL_SAMPLES_PASSED_ARB: - if (!ctx->Extensions.ARB_occlusion_query) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)"); - return; - } - if (ctx->Query.CurrentOcclusionObject) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB"); - return; - } - break; - case GL_TIME_ELAPSED_EXT: - if (!ctx->Extensions.EXT_timer_query) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)"); - return; - } - if (ctx->Query.CurrentTimerObject) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB"); - return; - } - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)"); - return; + bindpt = get_query_binding_point(ctx, target); + if (!bindpt) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)"); + return; } if (id == 0) { @@ -275,12 +291,8 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) q->Result = 0; q->Ready = GL_FALSE; - if (target == GL_SAMPLES_PASSED_ARB) { - ctx->Query.CurrentOcclusionObject = q; - } - else if (target == GL_TIME_ELAPSED_EXT) { - ctx->Query.CurrentTimerObject = q; - } + /* XXX should probably refcount query objects */ + *bindpt = q; ctx->Driver.BeginQuery(ctx, q); } @@ -289,34 +301,22 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) static void GLAPIENTRY _mesa_EndQueryARB(GLenum target) { - struct gl_query_object *q; + struct gl_query_object *q, **bindpt; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_DEPTH); - switch (target) { - case GL_SAMPLES_PASSED_ARB: - if (!ctx->Extensions.ARB_occlusion_query) { - _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); - return; - } - q = ctx->Query.CurrentOcclusionObject; - ctx->Query.CurrentOcclusionObject = NULL; - break; - case GL_TIME_ELAPSED_EXT: - if (!ctx->Extensions.EXT_timer_query) { - _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); - return; - } - q = ctx->Query.CurrentTimerObject; - ctx->Query.CurrentTimerObject = NULL; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); - return; + bindpt = get_query_binding_point(ctx, target); + if (!bindpt) { + _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); + return; } + /* XXX should probably refcount query objects */ + q = *bindpt; + *bindpt = NULL; + if (!q || !q->Active) { _mesa_error(ctx, GL_INVALID_OPERATION, "glEndQueryARB(no matching glBeginQueryARB)"); @@ -331,30 +331,18 @@ _mesa_EndQueryARB(GLenum target) void GLAPIENTRY _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) { - struct gl_query_object *q; + struct gl_query_object *q, **bindpt; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (target) { - case GL_SAMPLES_PASSED_ARB: - if (!ctx->Extensions.ARB_occlusion_query) { - _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); - return; - } - q = ctx->Query.CurrentOcclusionObject; - break; - case GL_TIME_ELAPSED_EXT: - if (!ctx->Extensions.EXT_timer_query) { - _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); - return; - } - q = ctx->Query.CurrentTimerObject; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(target)"); - return; + bindpt = get_query_binding_point(ctx, target); + if (!bindpt) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryARB(target)"); + return; } + q = *bindpt; + switch (pname) { case GL_QUERY_COUNTER_BITS_ARB: *params = 8 * sizeof(q->Result); diff --git a/mesalib/src/mesa/main/queryobj.h b/mesalib/src/mesa/main/queryobj.h index ba8b5dd00..8746ed15e 100644 --- a/mesalib/src/mesa/main/queryobj.h +++ b/mesalib/src/mesa/main/queryobj.h @@ -33,17 +33,6 @@ #if FEATURE_queryobj -#define _MESA_INIT_QUERYOBJ_FUNCTIONS(driver, impl) \ - do { \ - (driver)->NewQueryObject = impl ## NewQueryObject; \ - (driver)->DeleteQuery = impl ## DeleteQuery; \ - (driver)->BeginQuery = impl ## BeginQuery; \ - (driver)->EndQuery = impl ## EndQuery; \ - (driver)->WaitQuery = impl ## WaitQuery; \ - (driver)->CheckQuery = impl ## CheckQuery; \ - } while (0) - - static INLINE struct gl_query_object * _mesa_lookup_query_object(GLcontext *ctx, GLuint id) { @@ -78,7 +67,11 @@ _mesa_init_queryobj_dispatch(struct _glapi_table *disp); #else /* FEATURE_queryobj */ -#define _MESA_INIT_QUERYOBJ_FUNCTIONS(driver, impl) do { } while (0) +static INLINE struct gl_query_object * +_mesa_lookup_query_object(GLcontext *ctx, GLuint id) +{ + return NULL; +} static INLINE void _mesa_init_query_object_functions(struct dd_function_table *driver) diff --git a/mesalib/src/mesa/main/rastpos.h b/mesalib/src/mesa/main/rastpos.h index b2127225b..4994616d4 100644 --- a/mesalib/src/mesa/main/rastpos.h +++ b/mesalib/src/mesa/main/rastpos.h @@ -37,18 +37,11 @@ #if FEATURE_rastpos -#define _MESA_INIT_RASTPOS_FUNCTIONS(driver, impl) \ - do { \ - (driver)->RasterPos = impl ## RasterPos; \ - } while (0) - extern void _mesa_init_rastpos_dispatch(struct _glapi_table *disp); #else /* FEATURE_rastpos */ -#define _MESA_INIT_RASTPOS_FUNCTIONS(driver, impl) do { } while (0) - static INLINE void _mesa_init_rastpos_dispatch(struct _glapi_table *disp) { diff --git a/mesalib/src/mesa/main/rbadaptors.c b/mesalib/src/mesa/main/rbadaptors.c deleted file mode 100644 index 1060c5796..000000000 --- a/mesalib/src/mesa/main/rbadaptors.c +++ /dev/null @@ -1,565 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * Renderbuffer adaptors. - * These fuctions are used to convert rendering from core Mesa's GLchan - * colors to 8 or 16-bit color channels in RGBA renderbuffers. - * This means Mesa can be compiled for 16 or 32-bit color processing - * and still render into 8 and 16-bit/channel renderbuffers. - */ - - -#include "glheader.h" -#include "mtypes.h" -#include "colormac.h" -#include "renderbuffer.h" -#include "rbadaptors.h" - - -static void -Delete_wrapper(struct gl_renderbuffer *rb) -{ - /* Decrement reference count on the buffer we're wrapping and delete - * it if refcount hits zero. - */ - _mesa_reference_renderbuffer(&rb->Wrapped, NULL); - - /* delete myself */ - _mesa_delete_renderbuffer(rb); -} - - -static GLboolean -AllocStorage_wrapper(GLcontext *ctx, struct gl_renderbuffer *rb, - GLenum internalFormat, GLuint width, GLuint height) -{ - GLboolean b = rb->Wrapped->AllocStorage(ctx, rb->Wrapped, internalFormat, - width, height); - if (b) { - rb->Width = width; - rb->Height = height; - } - return b; -} - - -static void * -GetPointer_wrapper(GLcontext *ctx, struct gl_renderbuffer *rb, - GLint x, GLint y) -{ - (void) ctx; - (void) rb; - (void) x; - (void) y; - return NULL; -} - - -static void -GetRow_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, void *values) -{ - GLubyte values8[MAX_WIDTH * 4]; - GLushort *values16 = (GLushort *) values; - GLuint i; - ASSERT(rb->DataType == GL_UNSIGNED_SHORT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - ASSERT(count <= MAX_WIDTH); - - /* get 8bpp values */ - rb->Wrapped->GetRow(ctx, rb->Wrapped, count, x, y, values8); - - /* convert 8bpp to 16bpp */ - for (i = 0; i < 4 * count; i++) { - values16[i] = (values8[i] << 8) | values8[i]; - } -} - - -static void -GetValues_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - const GLint x[], const GLint y[], void *values) -{ - GLubyte values8[MAX_WIDTH * 4]; - GLushort *values16 = (GLushort *) values; - GLuint i; - ASSERT(rb->DataType == GL_UNSIGNED_SHORT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - - rb->Wrapped->GetValues(ctx, rb->Wrapped, count, x, y, values8); - - for (i = 0; i < 4 * count; i++) { - values16[i] = (values8[i] << 8) | values8[i]; - } -} - - -static void -PutRow_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, const void *values, const GLubyte *mask) -{ - GLubyte values8[MAX_WIDTH * 4]; - GLushort *values16 = (GLushort *) values; - GLuint i; - ASSERT(rb->DataType == GL_UNSIGNED_SHORT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - for (i = 0; i < 4 * count; i++) { - values8[i] = values16[i] >> 8; - } - rb->Wrapped->PutRow(ctx, rb->Wrapped, count, x, y, values8, mask); -} - - -static void -PutRowRGB_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, const void *values, const GLubyte *mask) -{ - GLubyte values8[MAX_WIDTH * 3]; - GLushort *values16 = (GLushort *) values; - GLuint i; - ASSERT(rb->DataType == GL_UNSIGNED_SHORT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - for (i = 0; i < 3 * count; i++) { - values8[i] = values16[i] >> 8; - } - rb->Wrapped->PutRowRGB(ctx, rb->Wrapped, count, x, y, values8, mask); -} - - -static void -PutMonoRow_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, const void *value, const GLubyte *mask) -{ - GLubyte value8[4]; - GLushort *value16 = (GLushort *) value; - ASSERT(rb->DataType == GL_UNSIGNED_SHORT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - value8[0] = value16[0] >> 8; - value8[1] = value16[1] >> 8; - value8[2] = value16[2] >> 8; - value8[3] = value16[3] >> 8; - rb->Wrapped->PutMonoRow(ctx, rb->Wrapped, count, x, y, value8, mask); -} - - -static void -PutValues_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - const GLint x[], const GLint y[], const void *values, - const GLubyte *mask) -{ - GLubyte values8[MAX_WIDTH * 4]; - GLushort *values16 = (GLushort *) values; - GLuint i; - ASSERT(rb->DataType == GL_UNSIGNED_SHORT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - for (i = 0; i < 4 * count; i++) { - values8[i] = values16[i] >> 8; - } - rb->Wrapped->PutValues(ctx, rb->Wrapped, count, x, y, values8, mask); -} - - -static void -PutMonoValues_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint count, const GLint x[], const GLint y[], - const void *value, const GLubyte *mask) -{ - GLubyte value8[4]; - GLushort *value16 = (GLushort *) value; - ASSERT(rb->DataType == GL_UNSIGNED_SHORT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - value8[0] = value16[0] >> 8; - value8[1] = value16[1] >> 8; - value8[2] = value16[2] >> 8; - value8[3] = value16[3] >> 8; - rb->Wrapped->PutMonoValues(ctx, rb->Wrapped, count, x, y, value8, mask); -} - - -/** - * Wrap an 8-bit/channel renderbuffer with a 16-bit/channel - * renderbuffer adaptor. - */ -struct gl_renderbuffer * -_mesa_new_renderbuffer_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8) -{ - struct gl_renderbuffer *rb16; - - rb16 = _mesa_new_renderbuffer(ctx, rb8->Name); - if (rb16) { - ASSERT(rb8->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb8->_BaseFormat == GL_RGBA); - - _glthread_LOCK_MUTEX(rb8->Mutex); - rb8->RefCount++; - _glthread_UNLOCK_MUTEX(rb8->Mutex); - - rb16->InternalFormat = rb8->InternalFormat; - rb16->Format = rb8->Format; /* XXX is this right? */ - rb16->_BaseFormat = rb8->_BaseFormat; - rb16->DataType = GL_UNSIGNED_SHORT; - /* Note: passing through underlying bits/channel */ - rb16->Wrapped = rb8; - - rb16->AllocStorage = AllocStorage_wrapper; - rb16->Delete = Delete_wrapper; - rb16->GetPointer = GetPointer_wrapper; - rb16->GetRow = GetRow_16wrap8; - rb16->GetValues = GetValues_16wrap8; - rb16->PutRow = PutRow_16wrap8; - rb16->PutRowRGB = PutRowRGB_16wrap8; - rb16->PutMonoRow = PutMonoRow_16wrap8; - rb16->PutValues = PutValues_16wrap8; - rb16->PutMonoValues = PutMonoValues_16wrap8; - } - return rb16; -} - - - - -static void -GetRow_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, void *values) -{ - GLubyte values8[MAX_WIDTH * 4]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - ASSERT(count <= MAX_WIDTH); - - /* get 8bpp values */ - rb->Wrapped->GetRow(ctx, rb->Wrapped, count, x, y, values8); - - /* convert 8bpp to 32bpp */ - for (i = 0; i < 4 * count; i++) { - values32[i] = UBYTE_TO_FLOAT(values8[i]); - } -} - - -static void -GetValues_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - const GLint x[], const GLint y[], void *values) -{ - GLubyte values8[MAX_WIDTH * 4]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - - rb->Wrapped->GetValues(ctx, rb->Wrapped, count, x, y, values8); - - for (i = 0; i < 4 * count; i++) { - values32[i] = UBYTE_TO_FLOAT(values8[i]); - } -} - - -static void -PutRow_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, const void *values, const GLubyte *mask) -{ - GLubyte values8[MAX_WIDTH * 4]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - for (i = 0; i < 4 * count; i++) { - UNCLAMPED_FLOAT_TO_UBYTE(values8[i], values32[i]); - } - rb->Wrapped->PutRow(ctx, rb->Wrapped, count, x, y, values8, mask); -} - - -static void -PutRowRGB_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, const void *values, const GLubyte *mask) -{ - GLubyte values8[MAX_WIDTH * 3]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - for (i = 0; i < 3 * count; i++) { - UNCLAMPED_FLOAT_TO_UBYTE(values8[i], values32[i]); - } - rb->Wrapped->PutRowRGB(ctx, rb->Wrapped, count, x, y, values8, mask); -} - - -static void -PutMonoRow_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, const void *value, const GLubyte *mask) -{ - GLubyte value8[4]; - GLfloat *value32 = (GLfloat *) value; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - UNCLAMPED_FLOAT_TO_UBYTE(value8[0], value32[0]); - UNCLAMPED_FLOAT_TO_UBYTE(value8[1], value32[1]); - UNCLAMPED_FLOAT_TO_UBYTE(value8[2], value32[2]); - UNCLAMPED_FLOAT_TO_UBYTE(value8[3], value32[3]); - rb->Wrapped->PutMonoRow(ctx, rb->Wrapped, count, x, y, value8, mask); -} - - -static void -PutValues_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - const GLint x[], const GLint y[], const void *values, - const GLubyte *mask) -{ - GLubyte values8[MAX_WIDTH * 4]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - for (i = 0; i < 4 * count; i++) { - UNCLAMPED_FLOAT_TO_UBYTE(values8[i], values32[i]); - } - rb->Wrapped->PutValues(ctx, rb->Wrapped, count, x, y, values8, mask); -} - - -static void -PutMonoValues_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint count, const GLint x[], const GLint y[], - const void *value, const GLubyte *mask) -{ - GLubyte value8[4]; - GLfloat *value32 = (GLfloat *) value; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_BYTE); - UNCLAMPED_FLOAT_TO_UBYTE(value8[0], value32[0]); - UNCLAMPED_FLOAT_TO_UBYTE(value8[1], value32[1]); - UNCLAMPED_FLOAT_TO_UBYTE(value8[2], value32[2]); - UNCLAMPED_FLOAT_TO_UBYTE(value8[3], value32[3]); - rb->Wrapped->PutMonoValues(ctx, rb->Wrapped, count, x, y, value8, mask); -} - - -/** - * Wrap an 8-bit/channel renderbuffer with a 32-bit/channel - * renderbuffer adaptor. - */ -struct gl_renderbuffer * -_mesa_new_renderbuffer_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8) -{ - struct gl_renderbuffer *rb32; - - rb32 = _mesa_new_renderbuffer(ctx, rb8->Name); - if (rb32) { - ASSERT(rb8->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb8->_BaseFormat == GL_RGBA); - - _glthread_LOCK_MUTEX(rb8->Mutex); - rb8->RefCount++; - _glthread_UNLOCK_MUTEX(rb8->Mutex); - - rb32->InternalFormat = rb8->InternalFormat; - rb32->Format = rb8->Format; /* XXX is this right? */ - rb32->_BaseFormat = rb8->_BaseFormat; - rb32->DataType = GL_FLOAT; - /* Note: passing through underlying bits/channel */ - rb32->Wrapped = rb8; - - rb32->AllocStorage = AllocStorage_wrapper; - rb32->Delete = Delete_wrapper; - rb32->GetPointer = GetPointer_wrapper; - rb32->GetRow = GetRow_32wrap8; - rb32->GetValues = GetValues_32wrap8; - rb32->PutRow = PutRow_32wrap8; - rb32->PutRowRGB = PutRowRGB_32wrap8; - rb32->PutMonoRow = PutMonoRow_32wrap8; - rb32->PutValues = PutValues_32wrap8; - rb32->PutMonoValues = PutMonoValues_32wrap8; - } - return rb32; -} - - - - -static void -GetRow_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, void *values) -{ - GLushort values16[MAX_WIDTH * 4]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT); - ASSERT(count <= MAX_WIDTH); - - /* get 16bpp values */ - rb->Wrapped->GetRow(ctx, rb->Wrapped, count, x, y, values16); - - /* convert 16bpp to 32bpp */ - for (i = 0; i < 4 * count; i++) { - values32[i] = USHORT_TO_FLOAT(values16[i]); - } -} - - -static void -GetValues_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - const GLint x[], const GLint y[], void *values) -{ - GLushort values16[MAX_WIDTH * 4]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT); - - rb->Wrapped->GetValues(ctx, rb->Wrapped, count, x, y, values16); - - for (i = 0; i < 4 * count; i++) { - values32[i] = USHORT_TO_FLOAT(values16[i]); - } -} - - -static void -PutRow_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, const void *values, const GLubyte *mask) -{ - GLushort values16[MAX_WIDTH * 4]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT); - for (i = 0; i < 4 * count; i++) { - UNCLAMPED_FLOAT_TO_USHORT(values16[i], values32[i]); - } - rb->Wrapped->PutRow(ctx, rb->Wrapped, count, x, y, values16, mask); -} - - -static void -PutRowRGB_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, const void *values, const GLubyte *mask) -{ - GLushort values16[MAX_WIDTH * 3]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT); - for (i = 0; i < 3 * count; i++) { - UNCLAMPED_FLOAT_TO_USHORT(values16[i], values32[i]); - } - rb->Wrapped->PutRowRGB(ctx, rb->Wrapped, count, x, y, values16, mask); -} - - -static void -PutMonoRow_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - GLint x, GLint y, const void *value, const GLubyte *mask) -{ - GLushort value16[4]; - GLfloat *value32 = (GLfloat *) value; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT); - UNCLAMPED_FLOAT_TO_USHORT(value16[0], value32[0]); - UNCLAMPED_FLOAT_TO_USHORT(value16[1], value32[1]); - UNCLAMPED_FLOAT_TO_USHORT(value16[2], value32[2]); - UNCLAMPED_FLOAT_TO_USHORT(value16[3], value32[3]); - rb->Wrapped->PutMonoRow(ctx, rb->Wrapped, count, x, y, value16, mask); -} - - -static void -PutValues_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, - const GLint x[], const GLint y[], const void *values, - const GLubyte *mask) -{ - GLushort values16[MAX_WIDTH * 4]; - GLfloat *values32 = (GLfloat *) values; - GLuint i; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT); - for (i = 0; i < 4 * count; i++) { - UNCLAMPED_FLOAT_TO_USHORT(values16[i], values32[i]); - } - rb->Wrapped->PutValues(ctx, rb->Wrapped, count, x, y, values16, mask); -} - - -static void -PutMonoValues_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint count, const GLint x[], const GLint y[], - const void *value, const GLubyte *mask) -{ - GLushort value16[4]; - GLfloat *value32 = (GLfloat *) value; - ASSERT(rb->DataType == GL_FLOAT); - ASSERT(rb->Wrapped->DataType == GL_UNSIGNED_SHORT); - UNCLAMPED_FLOAT_TO_USHORT(value16[0], value32[0]); - UNCLAMPED_FLOAT_TO_USHORT(value16[1], value32[1]); - UNCLAMPED_FLOAT_TO_USHORT(value16[2], value32[2]); - UNCLAMPED_FLOAT_TO_USHORT(value16[3], value32[3]); - rb->Wrapped->PutMonoValues(ctx, rb->Wrapped, count, x, y, value16, mask); -} - - -/** - * Wrap an 16-bit/channel renderbuffer with a 32-bit/channel - * renderbuffer adaptor. - */ -struct gl_renderbuffer * -_mesa_new_renderbuffer_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb16) -{ - struct gl_renderbuffer *rb32; - - rb32 = _mesa_new_renderbuffer(ctx, rb16->Name); - if (rb32) { - ASSERT(rb16->DataType == GL_UNSIGNED_SHORT); - ASSERT(rb16->_BaseFormat == GL_RGBA); - - _glthread_LOCK_MUTEX(rb16->Mutex); - rb16->RefCount++; - _glthread_UNLOCK_MUTEX(rb16->Mutex); - - rb32->InternalFormat = rb16->InternalFormat; - rb32->Format = rb16->Format; /* XXX is this right? */ - rb32->_BaseFormat = rb16->_BaseFormat; - rb32->DataType = GL_FLOAT; - /* Note: passing through underlying bits/channel */ - rb32->Wrapped = rb16; - - rb32->AllocStorage = AllocStorage_wrapper; - rb32->Delete = Delete_wrapper; - rb32->GetPointer = GetPointer_wrapper; - rb32->GetRow = GetRow_32wrap16; - rb32->GetValues = GetValues_32wrap16; - rb32->PutRow = PutRow_32wrap16; - rb32->PutRowRGB = PutRowRGB_32wrap16; - rb32->PutMonoRow = PutMonoRow_32wrap16; - rb32->PutValues = PutValues_32wrap16; - rb32->PutMonoValues = PutMonoValues_32wrap16; - } - return rb32; -} diff --git a/mesalib/src/mesa/main/rbadaptors.h b/mesalib/src/mesa/main/rbadaptors.h deleted file mode 100644 index 1d45b287d..000000000 --- a/mesalib/src/mesa/main/rbadaptors.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.1 - * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef RBADAPTORS_H -#define RBADAPTORS_H - - -extern struct gl_renderbuffer * -_mesa_new_renderbuffer_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8); - -extern struct gl_renderbuffer * -_mesa_new_renderbuffer_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8); - -extern struct gl_renderbuffer * -_mesa_new_renderbuffer_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb16); - - -#endif /* RBADAPTORS_H */ diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index f4d74e8be..93f2bd31c 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -103,6 +103,12 @@ _mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type, "glReadPixels(no color buffer)"); return GL_TRUE; } + /* We no longer support CI-mode color buffers so trying to read + * GL_COLOR_INDEX pixels is always an error. + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadPixels(color buffer is RGB)"); + return GL_TRUE; } break; case GL_STENCIL_INDEX: diff --git a/mesalib/src/mesa/main/remap.c b/mesalib/src/mesa/main/remap.c index 8d9df6b83..2341f8488 100644 --- a/mesalib/src/mesa/main/remap.c +++ b/mesalib/src/mesa/main/remap.c @@ -14,12 +14,13 @@ * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ @@ -35,25 +36,18 @@ * a dynamic entry, or the corresponding static entry, in glapi. */ -#include "remap.h" -#include "imports.h" - -#include "main/dispatch.h" - +#include "mfeatures.h" #if FEATURE_remap_table - -#define need_MESA_remap_table -#include "main/remap_helper.h" +#include "remap.h" +#include "imports.h" +#include "glapi/glapi.h" #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) #define MAX_ENTRY_POINTS 16 - -/* this is global for quick access */ -int driDispatchRemapTable[driDispatchRemapTable_size]; - +static const char *_mesa_function_pool; /** * Return the spec string associated with the given function index. @@ -66,10 +60,7 @@ int driDispatchRemapTable[driDispatchRemapTable_size]; const char * _mesa_get_function_spec(GLint func_index) { - if (func_index < ARRAY_SIZE(_mesa_function_pool)) - return _mesa_function_pool + func_index; - else - return NULL; + return _mesa_function_pool + func_index; } @@ -161,32 +152,14 @@ _mesa_map_function_array(const struct gl_function_remap *func_array) /** - * Map the functions which are already static. - * - * When a extension function are incorporated into the ABI, the - * extension suffix is usually stripped. Mapping such functions - * makes sure the alternative names are available. - * - * Note that functions mapped by _mesa_init_remap_table() are - * excluded. - */ -void -_mesa_map_static_functions(void) -{ - /* Remap static functions which have alternative names and are in the ABI. - * This is to be on the safe side. glapi should have defined those names. - */ - _mesa_map_function_array(MESA_alt_functions); -} - - -/** * Initialize the remap table. This is called in one_time_init(). * The remap table needs to be initialized before calling the * CALL/GET/SET macros defined in main/dispatch.h. */ void -_mesa_init_remap_table(void) +_mesa_do_init_remap_table(const char *pool, + int size, + const struct gl_function_pool_remap *remap) { static GLboolean initialized = GL_FALSE; GLint i; @@ -194,15 +167,16 @@ _mesa_init_remap_table(void) if (initialized) return; initialized = GL_TRUE; + _mesa_function_pool = pool; /* initialize the remap table */ - for (i = 0; i < ARRAY_SIZE(driDispatchRemapTable); i++) { + for (i = 0; i < size; i++) { GLint offset; const char *spec; /* sanity check */ - ASSERT(i == MESA_remap_table_functions[i].remap_index); - spec = _mesa_function_pool + MESA_remap_table_functions[i].pool_index; + ASSERT(i == remap[i].remap_index); + spec = _mesa_function_pool + remap[i].pool_index; offset = _mesa_map_function_spec(spec); /* store the dispatch offset in the remap table */ diff --git a/mesalib/src/mesa/main/remap.h b/mesalib/src/mesa/main/remap.h index 7fb56e360..a2a55f615 100644 --- a/mesalib/src/mesa/main/remap.h +++ b/mesalib/src/mesa/main/remap.h @@ -14,12 +14,13 @@ * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ @@ -27,9 +28,18 @@ #define REMAP_H -#include "main/mtypes.h" +#include "main/compiler.h" +#include "main/mfeatures.h" -struct gl_function_remap; +struct gl_function_pool_remap { + int pool_index; + int remap_index; +}; + +struct gl_function_remap { + int func_index; + int dispatch_offset; /* for sanity check */ +}; #if FEATURE_remap_table @@ -38,9 +48,9 @@ extern int driDispatchRemapTable[]; extern const char * -_mesa_get_function_spec(GLint func_index); +_mesa_get_function_spec(int func_index); -extern GLint +extern int _mesa_map_function_spec(const char *spec); extern void @@ -50,17 +60,34 @@ extern void _mesa_map_static_functions(void); extern void +_mesa_map_static_functions_es1(void); + +extern void +_mesa_map_static_functions_es2(void); + +extern void +_mesa_do_init_remap_table(const char *pool, + int size, + const struct gl_function_pool_remap *remap); + +extern void _mesa_init_remap_table(void); +extern void +_mesa_init_remap_table_es1(void); + +extern void +_mesa_init_remap_table_es2(void); + #else /* FEATURE_remap_table */ static INLINE const char * -_mesa_get_function_spec(GLint func_index) +_mesa_get_function_spec(int func_index) { return NULL; } -static INLINE GLint +static INLINE int _mesa_map_function_spec(const char *spec) { return -1; @@ -76,11 +103,39 @@ _mesa_map_static_functions(void) { } + +static INLINE void +_mesa_map_static_functions_es1(void) +{ +} + +static INLINE void +_mesa_map_static_functions_es2(void) +{ +} + +static INLINE void +_mesa_do_init_remap_table(const char *pool, + int size, + const struct gl_function_pool_remap *remap) +{ +} + static INLINE void _mesa_init_remap_table(void) { } +static INLINE void +_mesa_init_remap_table_es1(void) +{ +} + +static INLINE void +_mesa_init_remap_table_es2(void) +{ +} + #endif /* FEATURE_remap_table */ diff --git a/mesalib/src/mesa/main/remap_helper.h b/mesalib/src/mesa/main/remap_helper.h index ee898efa5..631cc9015 100644 --- a/mesalib/src/mesa/main/remap_helper.h +++ b/mesalib/src/mesa/main/remap_helper.h @@ -26,11 +26,7 @@ */ #include "main/dispatch.h" - -struct gl_function_remap { - GLint func_index; - GLint dispatch_offset; /* for sanity check */ -}; +#include "main/remap.h" /* this is internal to remap.c */ #ifdef need_MESA_remap_table @@ -450,9 +446,9 @@ static const char _mesa_function_pool[] = "\0" "glCreateProgramObjectARB\0" "\0" - /* _mesa_function_pool[2906]: FragmentLightModelivSGIX (dynamic) */ + /* _mesa_function_pool[2906]: DeleteTransformFeedbacks (will be remapped) */ "ip\0" - "glFragmentLightModelivSGIX\0" + "glDeleteTransformFeedbacks\0" "\0" /* _mesa_function_pool[2937]: UniformMatrix4x3fv (will be remapped) */ "iiip\0" @@ -668,3711 +664,3801 @@ static const char _mesa_function_pool[] = "iip\0" "glGetTexEnvfv\0" "\0" - /* _mesa_function_pool[4480]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[4480]: BindTransformFeedback (will be remapped) */ + "ii\0" + "glBindTransformFeedback\0" + "\0" + /* _mesa_function_pool[4508]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ "ffffffffffff\0" "glTexCoord2fColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[4533]: Indexub (offset 315) */ + /* _mesa_function_pool[4561]: Indexub (offset 315) */ "i\0" "glIndexub\0" "\0" - /* _mesa_function_pool[4546]: TexEnvi (offset 186) */ + /* _mesa_function_pool[4574]: TexEnvi (offset 186) */ "iii\0" "glTexEnvi\0" "\0" - /* _mesa_function_pool[4561]: GetClipPlane (offset 259) */ + /* _mesa_function_pool[4589]: GetClipPlane (offset 259) */ "ip\0" "glGetClipPlane\0" "\0" - /* _mesa_function_pool[4580]: CombinerParameterfvNV (will be remapped) */ + /* _mesa_function_pool[4608]: CombinerParameterfvNV (will be remapped) */ "ip\0" "glCombinerParameterfvNV\0" "\0" - /* _mesa_function_pool[4608]: VertexAttribs3dvNV (will be remapped) */ + /* _mesa_function_pool[4636]: VertexAttribs3dvNV (will be remapped) */ "iip\0" "glVertexAttribs3dvNV\0" "\0" - /* _mesa_function_pool[4634]: VertexAttribs4fvNV (will be remapped) */ + /* _mesa_function_pool[4662]: VertexAttribs4fvNV (will be remapped) */ "iip\0" "glVertexAttribs4fvNV\0" "\0" - /* _mesa_function_pool[4660]: VertexArrayRangeNV (will be remapped) */ + /* _mesa_function_pool[4688]: VertexArrayRangeNV (will be remapped) */ "ip\0" "glVertexArrayRangeNV\0" "\0" - /* _mesa_function_pool[4685]: FragmentLightiSGIX (dynamic) */ + /* _mesa_function_pool[4713]: FragmentLightiSGIX (dynamic) */ "iii\0" "glFragmentLightiSGIX\0" "\0" - /* _mesa_function_pool[4711]: PolygonOffsetEXT (will be remapped) */ + /* _mesa_function_pool[4739]: PolygonOffsetEXT (will be remapped) */ "ff\0" "glPolygonOffsetEXT\0" "\0" - /* _mesa_function_pool[4734]: PollAsyncSGIX (dynamic) */ + /* _mesa_function_pool[4762]: PollAsyncSGIX (dynamic) */ "p\0" "glPollAsyncSGIX\0" "\0" - /* _mesa_function_pool[4753]: DeleteFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[4781]: DeleteFragmentShaderATI (will be remapped) */ "i\0" "glDeleteFragmentShaderATI\0" "\0" - /* _mesa_function_pool[4782]: Scaled (offset 301) */ + /* _mesa_function_pool[4810]: Scaled (offset 301) */ "ddd\0" "glScaled\0" "\0" - /* _mesa_function_pool[4796]: Scalef (offset 302) */ + /* _mesa_function_pool[4824]: ResumeTransformFeedback (will be remapped) */ + "\0" + "glResumeTransformFeedback\0" + "\0" + /* _mesa_function_pool[4852]: Scalef (offset 302) */ "fff\0" "glScalef\0" "\0" - /* _mesa_function_pool[4810]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[4866]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */ "ppp\0" "glTexCoord2fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[4848]: MultTransposeMatrixdARB (will be remapped) */ + /* _mesa_function_pool[4904]: MultTransposeMatrixdARB (will be remapped) */ "p\0" "glMultTransposeMatrixd\0" "glMultTransposeMatrixdARB\0" "\0" - /* _mesa_function_pool[4900]: ObjectUnpurgeableAPPLE (will be remapped) */ + /* _mesa_function_pool[4956]: ColorMaskIndexedEXT (will be remapped) */ + "iiiii\0" + "glColorMaskIndexedEXT\0" + "\0" + /* _mesa_function_pool[4985]: ObjectUnpurgeableAPPLE (will be remapped) */ "iii\0" "glObjectUnpurgeableAPPLE\0" "\0" - /* _mesa_function_pool[4930]: AlphaFunc (offset 240) */ + /* _mesa_function_pool[5015]: AlphaFunc (offset 240) */ "if\0" "glAlphaFunc\0" "\0" - /* _mesa_function_pool[4946]: WindowPos2svMESA (will be remapped) */ + /* _mesa_function_pool[5031]: WindowPos2svMESA (will be remapped) */ "p\0" "glWindowPos2sv\0" "glWindowPos2svARB\0" "glWindowPos2svMESA\0" "\0" - /* _mesa_function_pool[5001]: EdgeFlag (offset 41) */ + /* _mesa_function_pool[5086]: EdgeFlag (offset 41) */ "i\0" "glEdgeFlag\0" "\0" - /* _mesa_function_pool[5015]: TexCoord2iv (offset 107) */ + /* _mesa_function_pool[5100]: TexCoord2iv (offset 107) */ "p\0" "glTexCoord2iv\0" "\0" - /* _mesa_function_pool[5032]: CompressedTexImage1DARB (will be remapped) */ + /* _mesa_function_pool[5117]: CompressedTexImage1DARB (will be remapped) */ "iiiiiip\0" "glCompressedTexImage1D\0" "glCompressedTexImage1DARB\0" "\0" - /* _mesa_function_pool[5090]: Rotated (offset 299) */ + /* _mesa_function_pool[5175]: Rotated (offset 299) */ "dddd\0" "glRotated\0" "\0" - /* _mesa_function_pool[5106]: VertexAttrib2sNV (will be remapped) */ + /* _mesa_function_pool[5191]: VertexAttrib2sNV (will be remapped) */ "iii\0" "glVertexAttrib2sNV\0" "\0" - /* _mesa_function_pool[5130]: ReadPixels (offset 256) */ + /* _mesa_function_pool[5215]: ReadPixels (offset 256) */ "iiiiiip\0" "glReadPixels\0" "\0" - /* _mesa_function_pool[5152]: EdgeFlagv (offset 42) */ + /* _mesa_function_pool[5237]: EdgeFlagv (offset 42) */ "p\0" "glEdgeFlagv\0" "\0" - /* _mesa_function_pool[5167]: NormalPointerListIBM (dynamic) */ + /* _mesa_function_pool[5252]: NormalPointerListIBM (dynamic) */ "iipi\0" "glNormalPointerListIBM\0" "\0" - /* _mesa_function_pool[5196]: IndexPointerEXT (will be remapped) */ + /* _mesa_function_pool[5281]: IndexPointerEXT (will be remapped) */ "iiip\0" "glIndexPointerEXT\0" "\0" - /* _mesa_function_pool[5220]: Color4iv (offset 32) */ + /* _mesa_function_pool[5305]: Color4iv (offset 32) */ "p\0" "glColor4iv\0" "\0" - /* _mesa_function_pool[5234]: TexParameterf (offset 178) */ + /* _mesa_function_pool[5319]: TexParameterf (offset 178) */ "iif\0" "glTexParameterf\0" "\0" - /* _mesa_function_pool[5255]: TexParameteri (offset 180) */ + /* _mesa_function_pool[5340]: TexParameteri (offset 180) */ "iii\0" "glTexParameteri\0" "\0" - /* _mesa_function_pool[5276]: NormalPointerEXT (will be remapped) */ + /* _mesa_function_pool[5361]: NormalPointerEXT (will be remapped) */ "iiip\0" "glNormalPointerEXT\0" "\0" - /* _mesa_function_pool[5301]: MultiTexCoord3dARB (offset 392) */ + /* _mesa_function_pool[5386]: MultiTexCoord3dARB (offset 392) */ "iddd\0" "glMultiTexCoord3d\0" "glMultiTexCoord3dARB\0" "\0" - /* _mesa_function_pool[5346]: MultiTexCoord2iARB (offset 388) */ + /* _mesa_function_pool[5431]: MultiTexCoord2iARB (offset 388) */ "iii\0" "glMultiTexCoord2i\0" "glMultiTexCoord2iARB\0" "\0" - /* _mesa_function_pool[5390]: DrawPixels (offset 257) */ + /* _mesa_function_pool[5475]: DrawPixels (offset 257) */ "iiiip\0" "glDrawPixels\0" "\0" - /* _mesa_function_pool[5410]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[5495]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */ "iffffffff\0" "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[5470]: MultiTexCoord2svARB (offset 391) */ + /* _mesa_function_pool[5555]: MultiTexCoord2svARB (offset 391) */ "ip\0" "glMultiTexCoord2sv\0" "glMultiTexCoord2svARB\0" "\0" - /* _mesa_function_pool[5515]: ReplacementCodeubvSUN (dynamic) */ + /* _mesa_function_pool[5600]: ReplacementCodeubvSUN (dynamic) */ "p\0" "glReplacementCodeubvSUN\0" "\0" - /* _mesa_function_pool[5542]: Uniform3iARB (will be remapped) */ + /* _mesa_function_pool[5627]: Uniform3iARB (will be remapped) */ "iiii\0" "glUniform3i\0" "glUniform3iARB\0" "\0" - /* _mesa_function_pool[5575]: GetFragmentMaterialfvSGIX (dynamic) */ + /* _mesa_function_pool[5660]: DrawTransformFeedback (will be remapped) */ + "ii\0" + "glDrawTransformFeedback\0" + "\0" + /* _mesa_function_pool[5688]: GetFragmentMaterialfvSGIX (dynamic) */ "iip\0" "glGetFragmentMaterialfvSGIX\0" "\0" - /* _mesa_function_pool[5608]: GetShaderInfoLog (will be remapped) */ + /* _mesa_function_pool[5721]: GetShaderInfoLog (will be remapped) */ "iipp\0" "glGetShaderInfoLog\0" "\0" - /* _mesa_function_pool[5633]: WeightivARB (dynamic) */ + /* _mesa_function_pool[5746]: WeightivARB (dynamic) */ "ip\0" "glWeightivARB\0" "\0" - /* _mesa_function_pool[5651]: PollInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[5764]: PollInstrumentsSGIX (dynamic) */ "p\0" "glPollInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[5676]: GlobalAlphaFactordSUN (dynamic) */ + /* _mesa_function_pool[5789]: GlobalAlphaFactordSUN (dynamic) */ "d\0" "glGlobalAlphaFactordSUN\0" "\0" - /* _mesa_function_pool[5703]: GetFinalCombinerInputParameterfvNV (will be remapped) */ + /* _mesa_function_pool[5816]: GetFinalCombinerInputParameterfvNV (will be remapped) */ "iip\0" "glGetFinalCombinerInputParameterfvNV\0" "\0" - /* _mesa_function_pool[5745]: GenerateMipmapEXT (will be remapped) */ + /* _mesa_function_pool[5858]: GenerateMipmapEXT (will be remapped) */ "i\0" "glGenerateMipmap\0" "glGenerateMipmapEXT\0" "\0" - /* _mesa_function_pool[5785]: GenLists (offset 5) */ + /* _mesa_function_pool[5898]: GenLists (offset 5) */ "i\0" "glGenLists\0" "\0" - /* _mesa_function_pool[5799]: SetFragmentShaderConstantATI (will be remapped) */ + /* _mesa_function_pool[5912]: SetFragmentShaderConstantATI (will be remapped) */ "ip\0" "glSetFragmentShaderConstantATI\0" "\0" - /* _mesa_function_pool[5834]: GetMapAttribParameterivNV (dynamic) */ + /* _mesa_function_pool[5947]: GetMapAttribParameterivNV (dynamic) */ "iiip\0" "glGetMapAttribParameterivNV\0" "\0" - /* _mesa_function_pool[5868]: CreateShaderObjectARB (will be remapped) */ + /* _mesa_function_pool[5981]: CreateShaderObjectARB (will be remapped) */ "i\0" "glCreateShaderObjectARB\0" "\0" - /* _mesa_function_pool[5895]: GetSharpenTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[6008]: GetSharpenTexFuncSGIS (dynamic) */ "ip\0" "glGetSharpenTexFuncSGIS\0" "\0" - /* _mesa_function_pool[5923]: BufferDataARB (will be remapped) */ + /* _mesa_function_pool[6036]: BufferDataARB (will be remapped) */ "iipi\0" "glBufferData\0" "glBufferDataARB\0" "\0" - /* _mesa_function_pool[5958]: FlushVertexArrayRangeNV (will be remapped) */ + /* _mesa_function_pool[6071]: FlushVertexArrayRangeNV (will be remapped) */ "\0" "glFlushVertexArrayRangeNV\0" "\0" - /* _mesa_function_pool[5986]: MapGrid2d (offset 226) */ + /* _mesa_function_pool[6099]: MapGrid2d (offset 226) */ "iddidd\0" "glMapGrid2d\0" "\0" - /* _mesa_function_pool[6006]: MapGrid2f (offset 227) */ + /* _mesa_function_pool[6119]: MapGrid2f (offset 227) */ "iffiff\0" "glMapGrid2f\0" "\0" - /* _mesa_function_pool[6026]: SampleMapATI (will be remapped) */ + /* _mesa_function_pool[6139]: SampleMapATI (will be remapped) */ "iii\0" "glSampleMapATI\0" "\0" - /* _mesa_function_pool[6046]: VertexPointerEXT (will be remapped) */ + /* _mesa_function_pool[6159]: VertexPointerEXT (will be remapped) */ "iiiip\0" "glVertexPointerEXT\0" "\0" - /* _mesa_function_pool[6072]: GetTexFilterFuncSGIS (dynamic) */ + /* _mesa_function_pool[6185]: GetTexFilterFuncSGIS (dynamic) */ "iip\0" "glGetTexFilterFuncSGIS\0" "\0" - /* _mesa_function_pool[6100]: Scissor (offset 176) */ + /* _mesa_function_pool[6213]: Scissor (offset 176) */ "iiii\0" "glScissor\0" "\0" - /* _mesa_function_pool[6116]: Fogf (offset 153) */ + /* _mesa_function_pool[6229]: Fogf (offset 153) */ "if\0" "glFogf\0" "\0" - /* _mesa_function_pool[6127]: GetCombinerOutputParameterfvNV (will be remapped) */ - "iiip\0" - "glGetCombinerOutputParameterfvNV\0" + /* _mesa_function_pool[6240]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */ + "ppp\0" + "glReplacementCodeuiColor4ubVertex3fvSUN\0" "\0" - /* _mesa_function_pool[6166]: TexSubImage1D (offset 332) */ + /* _mesa_function_pool[6285]: TexSubImage1D (offset 332) */ "iiiiiip\0" "glTexSubImage1D\0" "glTexSubImage1DEXT\0" "\0" - /* _mesa_function_pool[6210]: VertexAttrib1sARB (will be remapped) */ + /* _mesa_function_pool[6329]: VertexAttrib1sARB (will be remapped) */ "ii\0" "glVertexAttrib1s\0" "glVertexAttrib1sARB\0" "\0" - /* _mesa_function_pool[6251]: FenceSync (will be remapped) */ + /* _mesa_function_pool[6370]: FenceSync (will be remapped) */ "ii\0" "glFenceSync\0" "\0" - /* _mesa_function_pool[6267]: Color4usv (offset 40) */ + /* _mesa_function_pool[6386]: Color4usv (offset 40) */ "p\0" "glColor4usv\0" "\0" - /* _mesa_function_pool[6282]: Fogi (offset 155) */ + /* _mesa_function_pool[6401]: Fogi (offset 155) */ "ii\0" "glFogi\0" "\0" - /* _mesa_function_pool[6293]: DepthRange (offset 288) */ + /* _mesa_function_pool[6412]: DepthRange (offset 288) */ "dd\0" "glDepthRange\0" "\0" - /* _mesa_function_pool[6310]: RasterPos3iv (offset 75) */ + /* _mesa_function_pool[6429]: RasterPos3iv (offset 75) */ "p\0" "glRasterPos3iv\0" "\0" - /* _mesa_function_pool[6328]: FinalCombinerInputNV (will be remapped) */ + /* _mesa_function_pool[6447]: FinalCombinerInputNV (will be remapped) */ "iiii\0" "glFinalCombinerInputNV\0" "\0" - /* _mesa_function_pool[6357]: TexCoord2i (offset 106) */ + /* _mesa_function_pool[6476]: TexCoord2i (offset 106) */ "ii\0" "glTexCoord2i\0" "\0" - /* _mesa_function_pool[6374]: PixelMapfv (offset 251) */ + /* _mesa_function_pool[6493]: PixelMapfv (offset 251) */ "iip\0" "glPixelMapfv\0" "\0" - /* _mesa_function_pool[6392]: Color4ui (offset 37) */ + /* _mesa_function_pool[6511]: Color4ui (offset 37) */ "iiii\0" "glColor4ui\0" "\0" - /* _mesa_function_pool[6409]: RasterPos3s (offset 76) */ + /* _mesa_function_pool[6528]: RasterPos3s (offset 76) */ "iii\0" "glRasterPos3s\0" "\0" - /* _mesa_function_pool[6428]: Color3usv (offset 24) */ + /* _mesa_function_pool[6547]: Color3usv (offset 24) */ "p\0" "glColor3usv\0" "\0" - /* _mesa_function_pool[6443]: FlushRasterSGIX (dynamic) */ + /* _mesa_function_pool[6562]: FlushRasterSGIX (dynamic) */ "\0" "glFlushRasterSGIX\0" "\0" - /* _mesa_function_pool[6463]: TexCoord2f (offset 104) */ + /* _mesa_function_pool[6582]: TexCoord2f (offset 104) */ "ff\0" "glTexCoord2f\0" "\0" - /* _mesa_function_pool[6480]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[6599]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */ "ifffff\0" "glReplacementCodeuiTexCoord2fVertex3fSUN\0" "\0" - /* _mesa_function_pool[6529]: TexCoord2d (offset 102) */ + /* _mesa_function_pool[6648]: TexCoord2d (offset 102) */ "dd\0" "glTexCoord2d\0" "\0" - /* _mesa_function_pool[6546]: RasterPos3d (offset 70) */ + /* _mesa_function_pool[6665]: RasterPos3d (offset 70) */ "ddd\0" "glRasterPos3d\0" "\0" - /* _mesa_function_pool[6565]: RasterPos3f (offset 72) */ + /* _mesa_function_pool[6684]: RasterPos3f (offset 72) */ "fff\0" "glRasterPos3f\0" "\0" - /* _mesa_function_pool[6584]: Uniform1fARB (will be remapped) */ + /* _mesa_function_pool[6703]: Uniform1fARB (will be remapped) */ "if\0" "glUniform1f\0" "glUniform1fARB\0" "\0" - /* _mesa_function_pool[6615]: AreTexturesResident (offset 322) */ + /* _mesa_function_pool[6734]: AreTexturesResident (offset 322) */ "ipp\0" "glAreTexturesResident\0" "glAreTexturesResidentEXT\0" "\0" - /* _mesa_function_pool[6667]: TexCoord2s (offset 108) */ + /* _mesa_function_pool[6786]: TexCoord2s (offset 108) */ "ii\0" "glTexCoord2s\0" "\0" - /* _mesa_function_pool[6684]: StencilOpSeparate (will be remapped) */ + /* _mesa_function_pool[6803]: StencilOpSeparate (will be remapped) */ "iiii\0" "glStencilOpSeparate\0" "glStencilOpSeparateATI\0" "\0" - /* _mesa_function_pool[6733]: ColorTableParameteriv (offset 341) */ + /* _mesa_function_pool[6852]: ColorTableParameteriv (offset 341) */ "iip\0" "glColorTableParameteriv\0" "glColorTableParameterivSGI\0" "\0" - /* _mesa_function_pool[6789]: FogCoordPointerListIBM (dynamic) */ + /* _mesa_function_pool[6908]: FogCoordPointerListIBM (dynamic) */ "iipi\0" "glFogCoordPointerListIBM\0" "\0" - /* _mesa_function_pool[6820]: WindowPos3dMESA (will be remapped) */ + /* _mesa_function_pool[6939]: WindowPos3dMESA (will be remapped) */ "ddd\0" "glWindowPos3d\0" "glWindowPos3dARB\0" "glWindowPos3dMESA\0" "\0" - /* _mesa_function_pool[6874]: Color4us (offset 39) */ + /* _mesa_function_pool[6993]: Color4us (offset 39) */ "iiii\0" "glColor4us\0" "\0" - /* _mesa_function_pool[6891]: PointParameterfvEXT (will be remapped) */ + /* _mesa_function_pool[7010]: PointParameterfvEXT (will be remapped) */ "ip\0" "glPointParameterfv\0" "glPointParameterfvARB\0" "glPointParameterfvEXT\0" "glPointParameterfvSGIS\0" "\0" - /* _mesa_function_pool[6981]: Color3bv (offset 10) */ + /* _mesa_function_pool[7100]: Color3bv (offset 10) */ "p\0" "glColor3bv\0" "\0" - /* _mesa_function_pool[6995]: WindowPos2fvMESA (will be remapped) */ + /* _mesa_function_pool[7114]: WindowPos2fvMESA (will be remapped) */ "p\0" "glWindowPos2fv\0" "glWindowPos2fvARB\0" "glWindowPos2fvMESA\0" "\0" - /* _mesa_function_pool[7050]: SecondaryColor3bvEXT (will be remapped) */ + /* _mesa_function_pool[7169]: SecondaryColor3bvEXT (will be remapped) */ "p\0" "glSecondaryColor3bv\0" "glSecondaryColor3bvEXT\0" "\0" - /* _mesa_function_pool[7096]: VertexPointerListIBM (dynamic) */ + /* _mesa_function_pool[7215]: VertexPointerListIBM (dynamic) */ "iiipi\0" "glVertexPointerListIBM\0" "\0" - /* _mesa_function_pool[7126]: GetProgramLocalParameterfvARB (will be remapped) */ + /* _mesa_function_pool[7245]: GetProgramLocalParameterfvARB (will be remapped) */ "iip\0" "glGetProgramLocalParameterfvARB\0" "\0" - /* _mesa_function_pool[7163]: FragmentMaterialfSGIX (dynamic) */ + /* _mesa_function_pool[7282]: FragmentMaterialfSGIX (dynamic) */ "iif\0" "glFragmentMaterialfSGIX\0" "\0" - /* _mesa_function_pool[7192]: TexCoord2fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[7311]: TexCoord2fNormal3fVertex3fSUN (dynamic) */ "ffffffff\0" "glTexCoord2fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[7234]: RenderbufferStorageEXT (will be remapped) */ + /* _mesa_function_pool[7353]: RenderbufferStorageEXT (will be remapped) */ "iiii\0" "glRenderbufferStorage\0" "glRenderbufferStorageEXT\0" "\0" - /* _mesa_function_pool[7287]: IsFenceNV (will be remapped) */ + /* _mesa_function_pool[7406]: IsFenceNV (will be remapped) */ "i\0" "glIsFenceNV\0" "\0" - /* _mesa_function_pool[7302]: AttachObjectARB (will be remapped) */ + /* _mesa_function_pool[7421]: AttachObjectARB (will be remapped) */ "ii\0" "glAttachObjectARB\0" "\0" - /* _mesa_function_pool[7324]: GetFragmentLightivSGIX (dynamic) */ + /* _mesa_function_pool[7443]: GetFragmentLightivSGIX (dynamic) */ "iip\0" "glGetFragmentLightivSGIX\0" "\0" - /* _mesa_function_pool[7354]: UniformMatrix2fvARB (will be remapped) */ + /* _mesa_function_pool[7473]: UniformMatrix2fvARB (will be remapped) */ "iiip\0" "glUniformMatrix2fv\0" "glUniformMatrix2fvARB\0" "\0" - /* _mesa_function_pool[7401]: MultiTexCoord2fARB (offset 386) */ + /* _mesa_function_pool[7520]: MultiTexCoord2fARB (offset 386) */ "iff\0" "glMultiTexCoord2f\0" "glMultiTexCoord2fARB\0" "\0" - /* _mesa_function_pool[7445]: ColorTable (offset 339) */ + /* _mesa_function_pool[7564]: ColorTable (offset 339) */ "iiiiip\0" "glColorTable\0" "glColorTableSGI\0" "glColorTableEXT\0" "\0" - /* _mesa_function_pool[7498]: IndexPointer (offset 314) */ + /* _mesa_function_pool[7617]: IndexPointer (offset 314) */ "iip\0" "glIndexPointer\0" "\0" - /* _mesa_function_pool[7518]: Accum (offset 213) */ + /* _mesa_function_pool[7637]: Accum (offset 213) */ "if\0" "glAccum\0" "\0" - /* _mesa_function_pool[7530]: GetTexImage (offset 281) */ + /* _mesa_function_pool[7649]: GetTexImage (offset 281) */ "iiiip\0" "glGetTexImage\0" "\0" - /* _mesa_function_pool[7551]: MapControlPointsNV (dynamic) */ + /* _mesa_function_pool[7670]: MapControlPointsNV (dynamic) */ "iiiiiiiip\0" "glMapControlPointsNV\0" "\0" - /* _mesa_function_pool[7583]: ConvolutionFilter2D (offset 349) */ + /* _mesa_function_pool[7702]: ConvolutionFilter2D (offset 349) */ "iiiiiip\0" "glConvolutionFilter2D\0" "glConvolutionFilter2DEXT\0" "\0" - /* _mesa_function_pool[7639]: Finish (offset 216) */ + /* _mesa_function_pool[7758]: Finish (offset 216) */ "\0" "glFinish\0" "\0" - /* _mesa_function_pool[7650]: MapParameterfvNV (dynamic) */ + /* _mesa_function_pool[7769]: MapParameterfvNV (dynamic) */ "iip\0" "glMapParameterfvNV\0" "\0" - /* _mesa_function_pool[7674]: ClearStencil (offset 207) */ + /* _mesa_function_pool[7793]: ClearStencil (offset 207) */ "i\0" "glClearStencil\0" "\0" - /* _mesa_function_pool[7692]: VertexAttrib3dvARB (will be remapped) */ + /* _mesa_function_pool[7811]: VertexAttrib3dvARB (will be remapped) */ "ip\0" "glVertexAttrib3dv\0" "glVertexAttrib3dvARB\0" "\0" - /* _mesa_function_pool[7735]: HintPGI (dynamic) */ + /* _mesa_function_pool[7854]: HintPGI (dynamic) */ "ii\0" "glHintPGI\0" "\0" - /* _mesa_function_pool[7749]: ConvolutionParameteriv (offset 353) */ + /* _mesa_function_pool[7868]: ConvolutionParameteriv (offset 353) */ "iip\0" "glConvolutionParameteriv\0" "glConvolutionParameterivEXT\0" "\0" - /* _mesa_function_pool[7807]: Color4s (offset 33) */ + /* _mesa_function_pool[7926]: Color4s (offset 33) */ "iiii\0" "glColor4s\0" "\0" - /* _mesa_function_pool[7823]: InterleavedArrays (offset 317) */ + /* _mesa_function_pool[7942]: InterleavedArrays (offset 317) */ "iip\0" "glInterleavedArrays\0" "\0" - /* _mesa_function_pool[7848]: RasterPos2fv (offset 65) */ + /* _mesa_function_pool[7967]: RasterPos2fv (offset 65) */ "p\0" "glRasterPos2fv\0" "\0" - /* _mesa_function_pool[7866]: TexCoord1fv (offset 97) */ + /* _mesa_function_pool[7985]: TexCoord1fv (offset 97) */ "p\0" "glTexCoord1fv\0" "\0" - /* _mesa_function_pool[7883]: Vertex2d (offset 126) */ + /* _mesa_function_pool[8002]: Vertex2d (offset 126) */ "dd\0" "glVertex2d\0" "\0" - /* _mesa_function_pool[7898]: CullParameterdvEXT (will be remapped) */ + /* _mesa_function_pool[8017]: CullParameterdvEXT (will be remapped) */ "ip\0" "glCullParameterdvEXT\0" "\0" - /* _mesa_function_pool[7923]: ProgramNamedParameter4fNV (will be remapped) */ + /* _mesa_function_pool[8042]: ProgramNamedParameter4fNV (will be remapped) */ "iipffff\0" "glProgramNamedParameter4fNV\0" "\0" - /* _mesa_function_pool[7960]: Color3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[8079]: Color3fVertex3fSUN (dynamic) */ "ffffff\0" "glColor3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[7989]: ProgramEnvParameter4fvARB (will be remapped) */ + /* _mesa_function_pool[8108]: ProgramEnvParameter4fvARB (will be remapped) */ "iip\0" "glProgramEnvParameter4fvARB\0" "glProgramParameter4fvNV\0" "\0" - /* _mesa_function_pool[8046]: Color4i (offset 31) */ + /* _mesa_function_pool[8165]: Color4i (offset 31) */ "iiii\0" "glColor4i\0" "\0" - /* _mesa_function_pool[8062]: Color4f (offset 29) */ + /* _mesa_function_pool[8181]: Color4f (offset 29) */ "ffff\0" "glColor4f\0" "\0" - /* _mesa_function_pool[8078]: RasterPos4fv (offset 81) */ + /* _mesa_function_pool[8197]: RasterPos4fv (offset 81) */ "p\0" "glRasterPos4fv\0" "\0" - /* _mesa_function_pool[8096]: Color4d (offset 27) */ + /* _mesa_function_pool[8215]: Color4d (offset 27) */ "dddd\0" "glColor4d\0" "\0" - /* _mesa_function_pool[8112]: ClearIndex (offset 205) */ + /* _mesa_function_pool[8231]: ClearIndex (offset 205) */ "f\0" "glClearIndex\0" "\0" - /* _mesa_function_pool[8128]: Color4b (offset 25) */ + /* _mesa_function_pool[8247]: Color4b (offset 25) */ "iiii\0" "glColor4b\0" "\0" - /* _mesa_function_pool[8144]: LoadMatrixd (offset 292) */ + /* _mesa_function_pool[8263]: LoadMatrixd (offset 292) */ "p\0" "glLoadMatrixd\0" "\0" - /* _mesa_function_pool[8161]: FragmentLightModeliSGIX (dynamic) */ + /* _mesa_function_pool[8280]: FragmentLightModeliSGIX (dynamic) */ "ii\0" "glFragmentLightModeliSGIX\0" "\0" - /* _mesa_function_pool[8191]: RasterPos2dv (offset 63) */ + /* _mesa_function_pool[8310]: RasterPos2dv (offset 63) */ "p\0" "glRasterPos2dv\0" "\0" - /* _mesa_function_pool[8209]: ConvolutionParameterfv (offset 351) */ + /* _mesa_function_pool[8328]: ConvolutionParameterfv (offset 351) */ "iip\0" "glConvolutionParameterfv\0" "glConvolutionParameterfvEXT\0" "\0" - /* _mesa_function_pool[8267]: TbufferMask3DFX (dynamic) */ + /* _mesa_function_pool[8386]: TbufferMask3DFX (dynamic) */ "i\0" "glTbufferMask3DFX\0" "\0" - /* _mesa_function_pool[8288]: GetTexGendv (offset 278) */ + /* _mesa_function_pool[8407]: GetTexGendv (offset 278) */ "iip\0" "glGetTexGendv\0" "\0" - /* _mesa_function_pool[8307]: ColorMaskIndexedEXT (will be remapped) */ - "iiiii\0" - "glColorMaskIndexedEXT\0" + /* _mesa_function_pool[8426]: GetVertexAttribfvNV (will be remapped) */ + "iip\0" + "glGetVertexAttribfvNV\0" + "\0" + /* _mesa_function_pool[8453]: BeginTransformFeedbackEXT (will be remapped) */ + "i\0" + "glBeginTransformFeedbackEXT\0" + "glBeginTransformFeedback\0" "\0" - /* _mesa_function_pool[8336]: LoadProgramNV (will be remapped) */ + /* _mesa_function_pool[8509]: LoadProgramNV (will be remapped) */ "iiip\0" "glLoadProgramNV\0" "\0" - /* _mesa_function_pool[8358]: WaitSync (will be remapped) */ + /* _mesa_function_pool[8531]: WaitSync (will be remapped) */ "iii\0" "glWaitSync\0" "\0" - /* _mesa_function_pool[8374]: EndList (offset 1) */ + /* _mesa_function_pool[8547]: EndList (offset 1) */ "\0" "glEndList\0" "\0" - /* _mesa_function_pool[8386]: VertexAttrib4fvNV (will be remapped) */ + /* _mesa_function_pool[8559]: VertexAttrib4fvNV (will be remapped) */ "ip\0" "glVertexAttrib4fvNV\0" "\0" - /* _mesa_function_pool[8410]: GetAttachedObjectsARB (will be remapped) */ + /* _mesa_function_pool[8583]: GetAttachedObjectsARB (will be remapped) */ "iipp\0" "glGetAttachedObjectsARB\0" "\0" - /* _mesa_function_pool[8440]: Uniform3fvARB (will be remapped) */ + /* _mesa_function_pool[8613]: Uniform3fvARB (will be remapped) */ "iip\0" "glUniform3fv\0" "glUniform3fvARB\0" "\0" - /* _mesa_function_pool[8474]: EvalCoord1fv (offset 231) */ + /* _mesa_function_pool[8647]: EvalCoord1fv (offset 231) */ "p\0" "glEvalCoord1fv\0" "\0" - /* _mesa_function_pool[8492]: DrawRangeElements (offset 338) */ + /* _mesa_function_pool[8665]: DrawRangeElements (offset 338) */ "iiiiip\0" "glDrawRangeElements\0" "glDrawRangeElementsEXT\0" "\0" - /* _mesa_function_pool[8543]: EvalMesh2 (offset 238) */ + /* _mesa_function_pool[8716]: EvalMesh2 (offset 238) */ "iiiii\0" "glEvalMesh2\0" "\0" - /* _mesa_function_pool[8562]: Vertex4fv (offset 145) */ + /* _mesa_function_pool[8735]: Vertex4fv (offset 145) */ "p\0" "glVertex4fv\0" "\0" - /* _mesa_function_pool[8577]: SpriteParameterfvSGIX (dynamic) */ + /* _mesa_function_pool[8750]: GenTransformFeedbacks (will be remapped) */ + "ip\0" + "glGenTransformFeedbacks\0" + "\0" + /* _mesa_function_pool[8778]: SpriteParameterfvSGIX (dynamic) */ "ip\0" "glSpriteParameterfvSGIX\0" "\0" - /* _mesa_function_pool[8605]: CheckFramebufferStatusEXT (will be remapped) */ + /* _mesa_function_pool[8806]: CheckFramebufferStatusEXT (will be remapped) */ "i\0" "glCheckFramebufferStatus\0" "glCheckFramebufferStatusEXT\0" "\0" - /* _mesa_function_pool[8661]: GlobalAlphaFactoruiSUN (dynamic) */ + /* _mesa_function_pool[8862]: GlobalAlphaFactoruiSUN (dynamic) */ "i\0" "glGlobalAlphaFactoruiSUN\0" "\0" - /* _mesa_function_pool[8689]: GetHandleARB (will be remapped) */ + /* _mesa_function_pool[8890]: GetHandleARB (will be remapped) */ "i\0" "glGetHandleARB\0" "\0" - /* _mesa_function_pool[8707]: GetVertexAttribivARB (will be remapped) */ + /* _mesa_function_pool[8908]: GetVertexAttribivARB (will be remapped) */ "iip\0" "glGetVertexAttribiv\0" "glGetVertexAttribivARB\0" "\0" - /* _mesa_function_pool[8755]: GetCombinerInputParameterfvNV (will be remapped) */ + /* _mesa_function_pool[8956]: GetCombinerInputParameterfvNV (will be remapped) */ "iiiip\0" "glGetCombinerInputParameterfvNV\0" "\0" - /* _mesa_function_pool[8794]: CreateProgram (will be remapped) */ + /* _mesa_function_pool[8995]: CreateProgram (will be remapped) */ "\0" "glCreateProgram\0" "\0" - /* _mesa_function_pool[8812]: LoadTransposeMatrixdARB (will be remapped) */ + /* _mesa_function_pool[9013]: LoadTransposeMatrixdARB (will be remapped) */ "p\0" "glLoadTransposeMatrixd\0" "glLoadTransposeMatrixdARB\0" "\0" - /* _mesa_function_pool[8864]: GetMinmax (offset 364) */ + /* _mesa_function_pool[9065]: GetMinmax (offset 364) */ "iiiip\0" "glGetMinmax\0" "glGetMinmaxEXT\0" "\0" - /* _mesa_function_pool[8898]: StencilFuncSeparate (will be remapped) */ + /* _mesa_function_pool[9099]: StencilFuncSeparate (will be remapped) */ "iiii\0" "glStencilFuncSeparate\0" "\0" - /* _mesa_function_pool[8926]: SecondaryColor3sEXT (will be remapped) */ + /* _mesa_function_pool[9127]: SecondaryColor3sEXT (will be remapped) */ "iii\0" "glSecondaryColor3s\0" "glSecondaryColor3sEXT\0" "\0" - /* _mesa_function_pool[8972]: Color3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[9173]: Color3fVertex3fvSUN (dynamic) */ "pp\0" "glColor3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[8998]: Normal3fv (offset 57) */ + /* _mesa_function_pool[9199]: Normal3fv (offset 57) */ "p\0" "glNormal3fv\0" "\0" - /* _mesa_function_pool[9013]: GlobalAlphaFactorbSUN (dynamic) */ + /* _mesa_function_pool[9214]: GlobalAlphaFactorbSUN (dynamic) */ "i\0" "glGlobalAlphaFactorbSUN\0" "\0" - /* _mesa_function_pool[9040]: Color3us (offset 23) */ + /* _mesa_function_pool[9241]: Color3us (offset 23) */ "iii\0" "glColor3us\0" "\0" - /* _mesa_function_pool[9056]: ImageTransformParameterfvHP (dynamic) */ + /* _mesa_function_pool[9257]: ImageTransformParameterfvHP (dynamic) */ "iip\0" "glImageTransformParameterfvHP\0" "\0" - /* _mesa_function_pool[9091]: VertexAttrib4ivARB (will be remapped) */ + /* _mesa_function_pool[9292]: VertexAttrib4ivARB (will be remapped) */ "ip\0" "glVertexAttrib4iv\0" "glVertexAttrib4ivARB\0" "\0" - /* _mesa_function_pool[9134]: End (offset 43) */ + /* _mesa_function_pool[9335]: End (offset 43) */ "\0" "glEnd\0" "\0" - /* _mesa_function_pool[9142]: VertexAttrib3fNV (will be remapped) */ + /* _mesa_function_pool[9343]: VertexAttrib3fNV (will be remapped) */ "ifff\0" "glVertexAttrib3fNV\0" "\0" - /* _mesa_function_pool[9167]: VertexAttribs2dvNV (will be remapped) */ + /* _mesa_function_pool[9368]: VertexAttribs2dvNV (will be remapped) */ "iip\0" "glVertexAttribs2dvNV\0" "\0" - /* _mesa_function_pool[9193]: GetQueryObjectui64vEXT (will be remapped) */ + /* _mesa_function_pool[9394]: GetQueryObjectui64vEXT (will be remapped) */ "iip\0" "glGetQueryObjectui64vEXT\0" "\0" - /* _mesa_function_pool[9223]: MultiTexCoord3fvARB (offset 395) */ + /* _mesa_function_pool[9424]: MultiTexCoord3fvARB (offset 395) */ "ip\0" "glMultiTexCoord3fv\0" "glMultiTexCoord3fvARB\0" "\0" - /* _mesa_function_pool[9268]: SecondaryColor3dEXT (will be remapped) */ + /* _mesa_function_pool[9469]: SecondaryColor3dEXT (will be remapped) */ "ddd\0" "glSecondaryColor3d\0" "glSecondaryColor3dEXT\0" "\0" - /* _mesa_function_pool[9314]: Color3ub (offset 19) */ + /* _mesa_function_pool[9515]: Color3ub (offset 19) */ "iii\0" "glColor3ub\0" "\0" - /* _mesa_function_pool[9330]: GetProgramParameterfvNV (will be remapped) */ + /* _mesa_function_pool[9531]: GetProgramParameterfvNV (will be remapped) */ "iiip\0" "glGetProgramParameterfvNV\0" "\0" - /* _mesa_function_pool[9362]: TangentPointerEXT (dynamic) */ + /* _mesa_function_pool[9563]: TangentPointerEXT (dynamic) */ "iip\0" "glTangentPointerEXT\0" "\0" - /* _mesa_function_pool[9387]: Color4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[9588]: Color4fNormal3fVertex3fvSUN (dynamic) */ "ppp\0" "glColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[9422]: GetInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[9623]: GetInstrumentsSGIX (dynamic) */ "\0" "glGetInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[9445]: Color3ui (offset 21) */ + /* _mesa_function_pool[9646]: Color3ui (offset 21) */ "iii\0" "glColor3ui\0" "\0" - /* _mesa_function_pool[9461]: EvalMapsNV (dynamic) */ + /* _mesa_function_pool[9662]: EvalMapsNV (dynamic) */ "ii\0" "glEvalMapsNV\0" "\0" - /* _mesa_function_pool[9478]: TexSubImage2D (offset 333) */ + /* _mesa_function_pool[9679]: TexSubImage2D (offset 333) */ "iiiiiiiip\0" "glTexSubImage2D\0" "glTexSubImage2DEXT\0" "\0" - /* _mesa_function_pool[9524]: FragmentLightivSGIX (dynamic) */ + /* _mesa_function_pool[9725]: FragmentLightivSGIX (dynamic) */ "iip\0" "glFragmentLightivSGIX\0" "\0" - /* _mesa_function_pool[9551]: GetTexParameterPointervAPPLE (will be remapped) */ + /* _mesa_function_pool[9752]: GetTexParameterPointervAPPLE (will be remapped) */ "iip\0" "glGetTexParameterPointervAPPLE\0" "\0" - /* _mesa_function_pool[9587]: TexGenfv (offset 191) */ + /* _mesa_function_pool[9788]: TexGenfv (offset 191) */ "iip\0" "glTexGenfv\0" "\0" - /* _mesa_function_pool[9603]: PixelTransformParameterfvEXT (dynamic) */ - "iip\0" - "glPixelTransformParameterfvEXT\0" + /* _mesa_function_pool[9804]: GetTransformFeedbackVaryingEXT (will be remapped) */ + "iiipppp\0" + "glGetTransformFeedbackVaryingEXT\0" + "glGetTransformFeedbackVarying\0" "\0" - /* _mesa_function_pool[9639]: VertexAttrib4bvARB (will be remapped) */ + /* _mesa_function_pool[9876]: VertexAttrib4bvARB (will be remapped) */ "ip\0" "glVertexAttrib4bv\0" "glVertexAttrib4bvARB\0" "\0" - /* _mesa_function_pool[9682]: AlphaFragmentOp2ATI (will be remapped) */ + /* _mesa_function_pool[9919]: AlphaFragmentOp2ATI (will be remapped) */ "iiiiiiiii\0" "glAlphaFragmentOp2ATI\0" "\0" - /* _mesa_function_pool[9715]: GetIntegerIndexedvEXT (will be remapped) */ + /* _mesa_function_pool[9952]: GetIntegerIndexedvEXT (will be remapped) */ "iip\0" "glGetIntegerIndexedvEXT\0" "\0" - /* _mesa_function_pool[9744]: MultiTexCoord4sARB (offset 406) */ + /* _mesa_function_pool[9981]: MultiTexCoord4sARB (offset 406) */ "iiiii\0" "glMultiTexCoord4s\0" "glMultiTexCoord4sARB\0" "\0" - /* _mesa_function_pool[9790]: GetFragmentMaterialivSGIX (dynamic) */ + /* _mesa_function_pool[10027]: GetFragmentMaterialivSGIX (dynamic) */ "iip\0" "glGetFragmentMaterialivSGIX\0" "\0" - /* _mesa_function_pool[9823]: WindowPos4dMESA (will be remapped) */ + /* _mesa_function_pool[10060]: WindowPos4dMESA (will be remapped) */ "dddd\0" "glWindowPos4dMESA\0" "\0" - /* _mesa_function_pool[9847]: WeightPointerARB (dynamic) */ + /* _mesa_function_pool[10084]: WeightPointerARB (dynamic) */ "iiip\0" "glWeightPointerARB\0" "\0" - /* _mesa_function_pool[9872]: WindowPos2dMESA (will be remapped) */ + /* _mesa_function_pool[10109]: WindowPos2dMESA (will be remapped) */ "dd\0" "glWindowPos2d\0" "glWindowPos2dARB\0" "glWindowPos2dMESA\0" "\0" - /* _mesa_function_pool[9925]: FramebufferTexture3DEXT (will be remapped) */ + /* _mesa_function_pool[10162]: FramebufferTexture3DEXT (will be remapped) */ "iiiiii\0" "glFramebufferTexture3D\0" "glFramebufferTexture3DEXT\0" "\0" - /* _mesa_function_pool[9982]: BlendEquation (offset 337) */ + /* _mesa_function_pool[10219]: BlendEquation (offset 337) */ "i\0" "glBlendEquation\0" "glBlendEquationEXT\0" "\0" - /* _mesa_function_pool[10020]: VertexAttrib3dNV (will be remapped) */ + /* _mesa_function_pool[10257]: VertexAttrib3dNV (will be remapped) */ "iddd\0" "glVertexAttrib3dNV\0" "\0" - /* _mesa_function_pool[10045]: VertexAttrib3dARB (will be remapped) */ + /* _mesa_function_pool[10282]: VertexAttrib3dARB (will be remapped) */ "iddd\0" "glVertexAttrib3d\0" "glVertexAttrib3dARB\0" "\0" - /* _mesa_function_pool[10088]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[10325]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ "ppppp\0" "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[10152]: VertexAttrib4fARB (will be remapped) */ + /* _mesa_function_pool[10389]: VertexAttrib4fARB (will be remapped) */ "iffff\0" "glVertexAttrib4f\0" "glVertexAttrib4fARB\0" "\0" - /* _mesa_function_pool[10196]: GetError (offset 261) */ + /* _mesa_function_pool[10433]: GetError (offset 261) */ "\0" "glGetError\0" "\0" - /* _mesa_function_pool[10209]: IndexFuncEXT (dynamic) */ + /* _mesa_function_pool[10446]: IndexFuncEXT (dynamic) */ "if\0" "glIndexFuncEXT\0" "\0" - /* _mesa_function_pool[10228]: TexCoord3dv (offset 111) */ + /* _mesa_function_pool[10465]: TexCoord3dv (offset 111) */ "p\0" "glTexCoord3dv\0" "\0" - /* _mesa_function_pool[10245]: Indexdv (offset 45) */ + /* _mesa_function_pool[10482]: Indexdv (offset 45) */ "p\0" "glIndexdv\0" "\0" - /* _mesa_function_pool[10258]: FramebufferTexture2DEXT (will be remapped) */ + /* _mesa_function_pool[10495]: FramebufferTexture2DEXT (will be remapped) */ "iiiii\0" "glFramebufferTexture2D\0" "glFramebufferTexture2DEXT\0" "\0" - /* _mesa_function_pool[10314]: Normal3s (offset 60) */ + /* _mesa_function_pool[10551]: Normal3s (offset 60) */ "iii\0" "glNormal3s\0" "\0" - /* _mesa_function_pool[10330]: GetObjectParameterivAPPLE (will be remapped) */ + /* _mesa_function_pool[10567]: GetObjectParameterivAPPLE (will be remapped) */ "iiip\0" "glGetObjectParameterivAPPLE\0" "\0" - /* _mesa_function_pool[10364]: PushName (offset 201) */ + /* _mesa_function_pool[10601]: PushName (offset 201) */ "i\0" "glPushName\0" "\0" - /* _mesa_function_pool[10378]: MultiTexCoord2dvARB (offset 385) */ + /* _mesa_function_pool[10615]: MultiTexCoord2dvARB (offset 385) */ "ip\0" "glMultiTexCoord2dv\0" "glMultiTexCoord2dvARB\0" "\0" - /* _mesa_function_pool[10423]: CullParameterfvEXT (will be remapped) */ + /* _mesa_function_pool[10660]: CullParameterfvEXT (will be remapped) */ "ip\0" "glCullParameterfvEXT\0" "\0" - /* _mesa_function_pool[10448]: Normal3i (offset 58) */ + /* _mesa_function_pool[10685]: Normal3i (offset 58) */ "iii\0" "glNormal3i\0" "\0" - /* _mesa_function_pool[10464]: ProgramNamedParameter4fvNV (will be remapped) */ + /* _mesa_function_pool[10701]: ProgramNamedParameter4fvNV (will be remapped) */ "iipp\0" "glProgramNamedParameter4fvNV\0" "\0" - /* _mesa_function_pool[10499]: SecondaryColorPointerEXT (will be remapped) */ + /* _mesa_function_pool[10736]: SecondaryColorPointerEXT (will be remapped) */ "iiip\0" "glSecondaryColorPointer\0" "glSecondaryColorPointerEXT\0" "\0" - /* _mesa_function_pool[10556]: VertexAttrib4fvARB (will be remapped) */ + /* _mesa_function_pool[10793]: VertexAttrib4fvARB (will be remapped) */ "ip\0" "glVertexAttrib4fv\0" "glVertexAttrib4fvARB\0" "\0" - /* _mesa_function_pool[10599]: ColorPointerListIBM (dynamic) */ + /* _mesa_function_pool[10836]: ColorPointerListIBM (dynamic) */ "iiipi\0" "glColorPointerListIBM\0" "\0" - /* _mesa_function_pool[10628]: GetActiveUniformARB (will be remapped) */ + /* _mesa_function_pool[10865]: GetActiveUniformARB (will be remapped) */ "iiipppp\0" "glGetActiveUniform\0" "glGetActiveUniformARB\0" "\0" - /* _mesa_function_pool[10678]: ImageTransformParameteriHP (dynamic) */ + /* _mesa_function_pool[10915]: ImageTransformParameteriHP (dynamic) */ "iii\0" "glImageTransformParameteriHP\0" "\0" - /* _mesa_function_pool[10712]: Normal3b (offset 52) */ + /* _mesa_function_pool[10949]: Normal3b (offset 52) */ "iii\0" "glNormal3b\0" "\0" - /* _mesa_function_pool[10728]: Normal3d (offset 54) */ + /* _mesa_function_pool[10965]: Normal3d (offset 54) */ "ddd\0" "glNormal3d\0" "\0" - /* _mesa_function_pool[10744]: Normal3f (offset 56) */ + /* _mesa_function_pool[10981]: Normal3f (offset 56) */ "fff\0" "glNormal3f\0" "\0" - /* _mesa_function_pool[10760]: MultiTexCoord1svARB (offset 383) */ + /* _mesa_function_pool[10997]: MultiTexCoord1svARB (offset 383) */ "ip\0" "glMultiTexCoord1sv\0" "glMultiTexCoord1svARB\0" "\0" - /* _mesa_function_pool[10805]: Indexi (offset 48) */ + /* _mesa_function_pool[11042]: Indexi (offset 48) */ "i\0" "glIndexi\0" "\0" - /* _mesa_function_pool[10817]: EGLImageTargetTexture2DOES (will be remapped) */ + /* _mesa_function_pool[11054]: EGLImageTargetTexture2DOES (will be remapped) */ "ip\0" "glEGLImageTargetTexture2DOES\0" "\0" - /* _mesa_function_pool[10850]: EndQueryARB (will be remapped) */ + /* _mesa_function_pool[11087]: EndQueryARB (will be remapped) */ "i\0" "glEndQuery\0" "glEndQueryARB\0" "\0" - /* _mesa_function_pool[10878]: DeleteFencesNV (will be remapped) */ + /* _mesa_function_pool[11115]: DeleteFencesNV (will be remapped) */ "ip\0" "glDeleteFencesNV\0" "\0" - /* _mesa_function_pool[10899]: DepthMask (offset 211) */ + /* _mesa_function_pool[11136]: BindBufferRangeEXT (will be remapped) */ + "iiiii\0" + "glBindBufferRangeEXT\0" + "glBindBufferRange\0" + "\0" + /* _mesa_function_pool[11182]: DepthMask (offset 211) */ "i\0" "glDepthMask\0" "\0" - /* _mesa_function_pool[10914]: IsShader (will be remapped) */ + /* _mesa_function_pool[11197]: IsShader (will be remapped) */ "i\0" "glIsShader\0" "\0" - /* _mesa_function_pool[10928]: Indexf (offset 46) */ + /* _mesa_function_pool[11211]: Indexf (offset 46) */ "f\0" "glIndexf\0" "\0" - /* _mesa_function_pool[10940]: GetImageTransformParameterivHP (dynamic) */ + /* _mesa_function_pool[11223]: GetImageTransformParameterivHP (dynamic) */ "iip\0" "glGetImageTransformParameterivHP\0" "\0" - /* _mesa_function_pool[10978]: Indexd (offset 44) */ + /* _mesa_function_pool[11261]: Indexd (offset 44) */ "d\0" "glIndexd\0" "\0" - /* _mesa_function_pool[10990]: GetMaterialiv (offset 270) */ + /* _mesa_function_pool[11273]: GetMaterialiv (offset 270) */ "iip\0" "glGetMaterialiv\0" "\0" - /* _mesa_function_pool[11011]: StencilOp (offset 244) */ + /* _mesa_function_pool[11294]: StencilOp (offset 244) */ "iii\0" "glStencilOp\0" "\0" - /* _mesa_function_pool[11028]: WindowPos4ivMESA (will be remapped) */ + /* _mesa_function_pool[11311]: WindowPos4ivMESA (will be remapped) */ "p\0" "glWindowPos4ivMESA\0" "\0" - /* _mesa_function_pool[11050]: MultiTexCoord3svARB (offset 399) */ + /* _mesa_function_pool[11333]: FramebufferTextureLayer (dynamic) */ + "iiiii\0" + "glFramebufferTextureLayerARB\0" + "\0" + /* _mesa_function_pool[11369]: MultiTexCoord3svARB (offset 399) */ "ip\0" "glMultiTexCoord3sv\0" "glMultiTexCoord3svARB\0" "\0" - /* _mesa_function_pool[11095]: TexEnvfv (offset 185) */ + /* _mesa_function_pool[11414]: TexEnvfv (offset 185) */ "iip\0" "glTexEnvfv\0" "\0" - /* _mesa_function_pool[11111]: MultiTexCoord4iARB (offset 404) */ + /* _mesa_function_pool[11430]: MultiTexCoord4iARB (offset 404) */ "iiiii\0" "glMultiTexCoord4i\0" "glMultiTexCoord4iARB\0" "\0" - /* _mesa_function_pool[11157]: Indexs (offset 50) */ + /* _mesa_function_pool[11476]: Indexs (offset 50) */ "i\0" "glIndexs\0" "\0" - /* _mesa_function_pool[11169]: Binormal3ivEXT (dynamic) */ + /* _mesa_function_pool[11488]: Binormal3ivEXT (dynamic) */ "p\0" "glBinormal3ivEXT\0" "\0" - /* _mesa_function_pool[11189]: ResizeBuffersMESA (will be remapped) */ + /* _mesa_function_pool[11508]: ResizeBuffersMESA (will be remapped) */ "\0" "glResizeBuffersMESA\0" "\0" - /* _mesa_function_pool[11211]: GetUniformivARB (will be remapped) */ + /* _mesa_function_pool[11530]: GetUniformivARB (will be remapped) */ "iip\0" "glGetUniformiv\0" "glGetUniformivARB\0" "\0" - /* _mesa_function_pool[11249]: PixelTexGenParameteriSGIS (will be remapped) */ + /* _mesa_function_pool[11568]: PixelTexGenParameteriSGIS (will be remapped) */ "ii\0" "glPixelTexGenParameteriSGIS\0" "\0" - /* _mesa_function_pool[11281]: VertexPointervINTEL (dynamic) */ + /* _mesa_function_pool[11600]: VertexPointervINTEL (dynamic) */ "iip\0" "glVertexPointervINTEL\0" "\0" - /* _mesa_function_pool[11308]: Vertex2i (offset 130) */ + /* _mesa_function_pool[11627]: Vertex2i (offset 130) */ "ii\0" "glVertex2i\0" "\0" - /* _mesa_function_pool[11323]: LoadMatrixf (offset 291) */ + /* _mesa_function_pool[11642]: LoadMatrixf (offset 291) */ "p\0" "glLoadMatrixf\0" "\0" - /* _mesa_function_pool[11340]: Vertex2f (offset 128) */ + /* _mesa_function_pool[11659]: Vertex2f (offset 128) */ "ff\0" "glVertex2f\0" "\0" - /* _mesa_function_pool[11355]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[11674]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */ "pppp\0" "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[11408]: Color4bv (offset 26) */ + /* _mesa_function_pool[11727]: Color4bv (offset 26) */ "p\0" "glColor4bv\0" "\0" - /* _mesa_function_pool[11422]: VertexPointer (offset 321) */ + /* _mesa_function_pool[11741]: VertexPointer (offset 321) */ "iiip\0" "glVertexPointer\0" "\0" - /* _mesa_function_pool[11444]: SecondaryColor3uiEXT (will be remapped) */ + /* _mesa_function_pool[11763]: SecondaryColor3uiEXT (will be remapped) */ "iii\0" "glSecondaryColor3ui\0" "glSecondaryColor3uiEXT\0" "\0" - /* _mesa_function_pool[11492]: StartInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[11811]: StartInstrumentsSGIX (dynamic) */ "\0" "glStartInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[11517]: SecondaryColor3usvEXT (will be remapped) */ + /* _mesa_function_pool[11836]: SecondaryColor3usvEXT (will be remapped) */ "p\0" "glSecondaryColor3usv\0" "glSecondaryColor3usvEXT\0" "\0" - /* _mesa_function_pool[11565]: VertexAttrib2fvNV (will be remapped) */ + /* _mesa_function_pool[11884]: VertexAttrib2fvNV (will be remapped) */ "ip\0" "glVertexAttrib2fvNV\0" "\0" - /* _mesa_function_pool[11589]: ProgramLocalParameter4dvARB (will be remapped) */ + /* _mesa_function_pool[11908]: ProgramLocalParameter4dvARB (will be remapped) */ "iip\0" "glProgramLocalParameter4dvARB\0" "\0" - /* _mesa_function_pool[11624]: DeleteLists (offset 4) */ + /* _mesa_function_pool[11943]: DeleteLists (offset 4) */ "ii\0" "glDeleteLists\0" "\0" - /* _mesa_function_pool[11642]: LogicOp (offset 242) */ + /* _mesa_function_pool[11961]: LogicOp (offset 242) */ "i\0" "glLogicOp\0" "\0" - /* _mesa_function_pool[11655]: MatrixIndexuivARB (dynamic) */ + /* _mesa_function_pool[11974]: MatrixIndexuivARB (dynamic) */ "ip\0" "glMatrixIndexuivARB\0" "\0" - /* _mesa_function_pool[11679]: Vertex2s (offset 132) */ + /* _mesa_function_pool[11998]: Vertex2s (offset 132) */ "ii\0" "glVertex2s\0" "\0" - /* _mesa_function_pool[11694]: RenderbufferStorageMultisample (will be remapped) */ + /* _mesa_function_pool[12013]: RenderbufferStorageMultisample (will be remapped) */ "iiiii\0" "glRenderbufferStorageMultisample\0" "glRenderbufferStorageMultisampleEXT\0" "\0" - /* _mesa_function_pool[11770]: TexCoord4fv (offset 121) */ + /* _mesa_function_pool[12089]: TexCoord4fv (offset 121) */ "p\0" "glTexCoord4fv\0" "\0" - /* _mesa_function_pool[11787]: Tangent3sEXT (dynamic) */ + /* _mesa_function_pool[12106]: Tangent3sEXT (dynamic) */ "iii\0" "glTangent3sEXT\0" "\0" - /* _mesa_function_pool[11807]: GlobalAlphaFactorfSUN (dynamic) */ + /* _mesa_function_pool[12126]: GlobalAlphaFactorfSUN (dynamic) */ "f\0" "glGlobalAlphaFactorfSUN\0" "\0" - /* _mesa_function_pool[11834]: MultiTexCoord3iARB (offset 396) */ + /* _mesa_function_pool[12153]: MultiTexCoord3iARB (offset 396) */ "iiii\0" "glMultiTexCoord3i\0" "glMultiTexCoord3iARB\0" "\0" - /* _mesa_function_pool[11879]: IsProgram (will be remapped) */ + /* _mesa_function_pool[12198]: IsProgram (will be remapped) */ "i\0" "glIsProgram\0" "\0" - /* _mesa_function_pool[11894]: TexCoordPointerListIBM (dynamic) */ + /* _mesa_function_pool[12213]: TexCoordPointerListIBM (dynamic) */ "iiipi\0" "glTexCoordPointerListIBM\0" "\0" - /* _mesa_function_pool[11926]: GlobalAlphaFactorusSUN (dynamic) */ + /* _mesa_function_pool[12245]: GlobalAlphaFactorusSUN (dynamic) */ "i\0" "glGlobalAlphaFactorusSUN\0" "\0" - /* _mesa_function_pool[11954]: VertexAttrib2dvNV (will be remapped) */ + /* _mesa_function_pool[12273]: VertexAttrib2dvNV (will be remapped) */ "ip\0" "glVertexAttrib2dvNV\0" "\0" - /* _mesa_function_pool[11978]: FramebufferRenderbufferEXT (will be remapped) */ + /* _mesa_function_pool[12297]: FramebufferRenderbufferEXT (will be remapped) */ "iiii\0" "glFramebufferRenderbuffer\0" "glFramebufferRenderbufferEXT\0" "\0" - /* _mesa_function_pool[12039]: VertexAttrib1dvNV (will be remapped) */ + /* _mesa_function_pool[12358]: VertexAttrib1dvNV (will be remapped) */ "ip\0" "glVertexAttrib1dvNV\0" "\0" - /* _mesa_function_pool[12063]: GenTextures (offset 328) */ + /* _mesa_function_pool[12382]: GenTextures (offset 328) */ "ip\0" "glGenTextures\0" "glGenTexturesEXT\0" "\0" - /* _mesa_function_pool[12098]: SetFenceNV (will be remapped) */ + /* _mesa_function_pool[12417]: FramebufferTextureARB (will be remapped) */ + "iiii\0" + "glFramebufferTextureARB\0" + "\0" + /* _mesa_function_pool[12447]: SetFenceNV (will be remapped) */ "ii\0" "glSetFenceNV\0" "\0" - /* _mesa_function_pool[12115]: FramebufferTexture1DEXT (will be remapped) */ + /* _mesa_function_pool[12464]: FramebufferTexture1DEXT (will be remapped) */ "iiiii\0" "glFramebufferTexture1D\0" "glFramebufferTexture1DEXT\0" "\0" - /* _mesa_function_pool[12171]: GetCombinerOutputParameterivNV (will be remapped) */ + /* _mesa_function_pool[12520]: GetCombinerOutputParameterivNV (will be remapped) */ "iiip\0" "glGetCombinerOutputParameterivNV\0" "\0" - /* _mesa_function_pool[12210]: MultiModeDrawArraysIBM (will be remapped) */ + /* _mesa_function_pool[12559]: MultiModeDrawArraysIBM (will be remapped) */ "pppii\0" "glMultiModeDrawArraysIBM\0" "\0" - /* _mesa_function_pool[12242]: PixelTexGenParameterivSGIS (will be remapped) */ + /* _mesa_function_pool[12591]: PixelTexGenParameterivSGIS (will be remapped) */ "ip\0" "glPixelTexGenParameterivSGIS\0" "\0" - /* _mesa_function_pool[12275]: TextureNormalEXT (dynamic) */ + /* _mesa_function_pool[12624]: TextureNormalEXT (dynamic) */ "i\0" "glTextureNormalEXT\0" "\0" - /* _mesa_function_pool[12297]: IndexPointerListIBM (dynamic) */ + /* _mesa_function_pool[12646]: IndexPointerListIBM (dynamic) */ "iipi\0" "glIndexPointerListIBM\0" "\0" - /* _mesa_function_pool[12325]: WeightfvARB (dynamic) */ + /* _mesa_function_pool[12674]: WeightfvARB (dynamic) */ "ip\0" "glWeightfvARB\0" "\0" - /* _mesa_function_pool[12343]: RasterPos2sv (offset 69) */ + /* _mesa_function_pool[12692]: GetCombinerOutputParameterfvNV (will be remapped) */ + "iiip\0" + "glGetCombinerOutputParameterfvNV\0" + "\0" + /* _mesa_function_pool[12731]: RasterPos2sv (offset 69) */ "p\0" "glRasterPos2sv\0" "\0" - /* _mesa_function_pool[12361]: Color4ubv (offset 36) */ + /* _mesa_function_pool[12749]: Color4ubv (offset 36) */ "p\0" "glColor4ubv\0" "\0" - /* _mesa_function_pool[12376]: DrawBuffer (offset 202) */ + /* _mesa_function_pool[12764]: DrawBuffer (offset 202) */ "i\0" "glDrawBuffer\0" "\0" - /* _mesa_function_pool[12392]: TexCoord2fv (offset 105) */ + /* _mesa_function_pool[12780]: TexCoord2fv (offset 105) */ "p\0" "glTexCoord2fv\0" "\0" - /* _mesa_function_pool[12409]: WindowPos4fMESA (will be remapped) */ + /* _mesa_function_pool[12797]: WindowPos4fMESA (will be remapped) */ "ffff\0" "glWindowPos4fMESA\0" "\0" - /* _mesa_function_pool[12433]: TexCoord1sv (offset 101) */ + /* _mesa_function_pool[12821]: TexCoord1sv (offset 101) */ "p\0" "glTexCoord1sv\0" "\0" - /* _mesa_function_pool[12450]: WindowPos3dvMESA (will be remapped) */ + /* _mesa_function_pool[12838]: WindowPos3dvMESA (will be remapped) */ "p\0" "glWindowPos3dv\0" "glWindowPos3dvARB\0" "glWindowPos3dvMESA\0" "\0" - /* _mesa_function_pool[12505]: DepthFunc (offset 245) */ + /* _mesa_function_pool[12893]: DepthFunc (offset 245) */ "i\0" "glDepthFunc\0" "\0" - /* _mesa_function_pool[12520]: PixelMapusv (offset 253) */ + /* _mesa_function_pool[12908]: PixelMapusv (offset 253) */ "iip\0" "glPixelMapusv\0" "\0" - /* _mesa_function_pool[12539]: GetQueryObjecti64vEXT (will be remapped) */ + /* _mesa_function_pool[12927]: GetQueryObjecti64vEXT (will be remapped) */ "iip\0" "glGetQueryObjecti64vEXT\0" "\0" - /* _mesa_function_pool[12568]: MultiTexCoord1dARB (offset 376) */ + /* _mesa_function_pool[12956]: MultiTexCoord1dARB (offset 376) */ "id\0" "glMultiTexCoord1d\0" "glMultiTexCoord1dARB\0" "\0" - /* _mesa_function_pool[12611]: PointParameterivNV (will be remapped) */ + /* _mesa_function_pool[12999]: PointParameterivNV (will be remapped) */ "ip\0" "glPointParameteriv\0" "glPointParameterivNV\0" "\0" - /* _mesa_function_pool[12655]: BlendFunc (offset 241) */ + /* _mesa_function_pool[13043]: BlendFunc (offset 241) */ "ii\0" "glBlendFunc\0" "\0" - /* _mesa_function_pool[12671]: Uniform2fvARB (will be remapped) */ + /* _mesa_function_pool[13059]: EndTransformFeedbackEXT (will be remapped) */ + "\0" + "glEndTransformFeedbackEXT\0" + "glEndTransformFeedback\0" + "\0" + /* _mesa_function_pool[13110]: Uniform2fvARB (will be remapped) */ "iip\0" "glUniform2fv\0" "glUniform2fvARB\0" "\0" - /* _mesa_function_pool[12705]: BufferParameteriAPPLE (will be remapped) */ + /* _mesa_function_pool[13144]: BufferParameteriAPPLE (will be remapped) */ "iii\0" "glBufferParameteriAPPLE\0" "\0" - /* _mesa_function_pool[12734]: MultiTexCoord3dvARB (offset 393) */ + /* _mesa_function_pool[13173]: MultiTexCoord3dvARB (offset 393) */ "ip\0" "glMultiTexCoord3dv\0" "glMultiTexCoord3dvARB\0" "\0" - /* _mesa_function_pool[12779]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[13218]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */ "pppp\0" "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[12835]: DeleteObjectARB (will be remapped) */ + /* _mesa_function_pool[13274]: DeleteObjectARB (will be remapped) */ "i\0" "glDeleteObjectARB\0" "\0" - /* _mesa_function_pool[12856]: MatrixIndexPointerARB (dynamic) */ + /* _mesa_function_pool[13295]: MatrixIndexPointerARB (dynamic) */ "iiip\0" "glMatrixIndexPointerARB\0" "\0" - /* _mesa_function_pool[12886]: ProgramNamedParameter4dvNV (will be remapped) */ + /* _mesa_function_pool[13325]: ProgramNamedParameter4dvNV (will be remapped) */ "iipp\0" "glProgramNamedParameter4dvNV\0" "\0" - /* _mesa_function_pool[12921]: Tangent3fvEXT (dynamic) */ + /* _mesa_function_pool[13360]: Tangent3fvEXT (dynamic) */ "p\0" "glTangent3fvEXT\0" "\0" - /* _mesa_function_pool[12940]: Flush (offset 217) */ + /* _mesa_function_pool[13379]: Flush (offset 217) */ "\0" "glFlush\0" "\0" - /* _mesa_function_pool[12950]: Color4uiv (offset 38) */ + /* _mesa_function_pool[13389]: Color4uiv (offset 38) */ "p\0" "glColor4uiv\0" "\0" - /* _mesa_function_pool[12965]: GenVertexArrays (will be remapped) */ + /* _mesa_function_pool[13404]: GenVertexArrays (will be remapped) */ "ip\0" "glGenVertexArrays\0" "\0" - /* _mesa_function_pool[12987]: RasterPos3sv (offset 77) */ + /* _mesa_function_pool[13426]: RasterPos3sv (offset 77) */ "p\0" "glRasterPos3sv\0" "\0" - /* _mesa_function_pool[13005]: BindFramebufferEXT (will be remapped) */ + /* _mesa_function_pool[13444]: BindFramebufferEXT (will be remapped) */ "ii\0" "glBindFramebuffer\0" "glBindFramebufferEXT\0" "\0" - /* _mesa_function_pool[13048]: ReferencePlaneSGIX (dynamic) */ + /* _mesa_function_pool[13487]: ReferencePlaneSGIX (dynamic) */ "p\0" "glReferencePlaneSGIX\0" "\0" - /* _mesa_function_pool[13072]: PushAttrib (offset 219) */ + /* _mesa_function_pool[13511]: PushAttrib (offset 219) */ "i\0" "glPushAttrib\0" "\0" - /* _mesa_function_pool[13088]: RasterPos2i (offset 66) */ + /* _mesa_function_pool[13527]: RasterPos2i (offset 66) */ "ii\0" "glRasterPos2i\0" "\0" - /* _mesa_function_pool[13106]: ValidateProgramARB (will be remapped) */ + /* _mesa_function_pool[13545]: ValidateProgramARB (will be remapped) */ "i\0" "glValidateProgram\0" "glValidateProgramARB\0" "\0" - /* _mesa_function_pool[13148]: TexParameteriv (offset 181) */ + /* _mesa_function_pool[13587]: TexParameteriv (offset 181) */ "iip\0" "glTexParameteriv\0" "\0" - /* _mesa_function_pool[13170]: UnlockArraysEXT (will be remapped) */ + /* _mesa_function_pool[13609]: UnlockArraysEXT (will be remapped) */ "\0" "glUnlockArraysEXT\0" "\0" - /* _mesa_function_pool[13190]: TexCoord2fColor3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[13629]: TexCoord2fColor3fVertex3fSUN (dynamic) */ "ffffffff\0" "glTexCoord2fColor3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[13231]: WindowPos3fvMESA (will be remapped) */ + /* _mesa_function_pool[13670]: WindowPos3fvMESA (will be remapped) */ "p\0" "glWindowPos3fv\0" "glWindowPos3fvARB\0" "glWindowPos3fvMESA\0" "\0" - /* _mesa_function_pool[13286]: RasterPos2f (offset 64) */ + /* _mesa_function_pool[13725]: RasterPos2f (offset 64) */ "ff\0" "glRasterPos2f\0" "\0" - /* _mesa_function_pool[13304]: VertexAttrib1svNV (will be remapped) */ + /* _mesa_function_pool[13743]: VertexAttrib1svNV (will be remapped) */ "ip\0" "glVertexAttrib1svNV\0" "\0" - /* _mesa_function_pool[13328]: RasterPos2d (offset 62) */ + /* _mesa_function_pool[13767]: RasterPos2d (offset 62) */ "dd\0" "glRasterPos2d\0" "\0" - /* _mesa_function_pool[13346]: RasterPos3fv (offset 73) */ + /* _mesa_function_pool[13785]: RasterPos3fv (offset 73) */ "p\0" "glRasterPos3fv\0" "\0" - /* _mesa_function_pool[13364]: CopyTexSubImage3D (offset 373) */ + /* _mesa_function_pool[13803]: CopyTexSubImage3D (offset 373) */ "iiiiiiiii\0" "glCopyTexSubImage3D\0" "glCopyTexSubImage3DEXT\0" "\0" - /* _mesa_function_pool[13418]: VertexAttrib2dARB (will be remapped) */ + /* _mesa_function_pool[13857]: VertexAttrib2dARB (will be remapped) */ "idd\0" "glVertexAttrib2d\0" "glVertexAttrib2dARB\0" "\0" - /* _mesa_function_pool[13460]: Color4ub (offset 35) */ + /* _mesa_function_pool[13899]: Color4ub (offset 35) */ "iiii\0" "glColor4ub\0" "\0" - /* _mesa_function_pool[13477]: GetInteger64v (will be remapped) */ + /* _mesa_function_pool[13916]: GetInteger64v (will be remapped) */ "ip\0" "glGetInteger64v\0" "\0" - /* _mesa_function_pool[13497]: TextureColorMaskSGIS (dynamic) */ + /* _mesa_function_pool[13936]: TextureColorMaskSGIS (dynamic) */ "iiii\0" "glTextureColorMaskSGIS\0" "\0" - /* _mesa_function_pool[13526]: RasterPos2s (offset 68) */ + /* _mesa_function_pool[13965]: RasterPos2s (offset 68) */ "ii\0" "glRasterPos2s\0" "\0" - /* _mesa_function_pool[13544]: GetColorTable (offset 343) */ + /* _mesa_function_pool[13983]: GetColorTable (offset 343) */ "iiip\0" "glGetColorTable\0" "glGetColorTableSGI\0" "glGetColorTableEXT\0" "\0" - /* _mesa_function_pool[13604]: SelectBuffer (offset 195) */ + /* _mesa_function_pool[14043]: SelectBuffer (offset 195) */ "ip\0" "glSelectBuffer\0" "\0" - /* _mesa_function_pool[13623]: Indexiv (offset 49) */ + /* _mesa_function_pool[14062]: Indexiv (offset 49) */ "p\0" "glIndexiv\0" "\0" - /* _mesa_function_pool[13636]: TexCoord3i (offset 114) */ + /* _mesa_function_pool[14075]: TexCoord3i (offset 114) */ "iii\0" "glTexCoord3i\0" "\0" - /* _mesa_function_pool[13654]: CopyColorTable (offset 342) */ + /* _mesa_function_pool[14093]: CopyColorTable (offset 342) */ "iiiii\0" "glCopyColorTable\0" "glCopyColorTableSGI\0" "\0" - /* _mesa_function_pool[13698]: GetHistogramParameterfv (offset 362) */ + /* _mesa_function_pool[14137]: GetHistogramParameterfv (offset 362) */ "iip\0" "glGetHistogramParameterfv\0" "glGetHistogramParameterfvEXT\0" "\0" - /* _mesa_function_pool[13758]: Frustum (offset 289) */ + /* _mesa_function_pool[14197]: Frustum (offset 289) */ "dddddd\0" "glFrustum\0" "\0" - /* _mesa_function_pool[13776]: GetString (offset 275) */ + /* _mesa_function_pool[14215]: GetString (offset 275) */ "i\0" "glGetString\0" "\0" - /* _mesa_function_pool[13791]: ColorPointervINTEL (dynamic) */ + /* _mesa_function_pool[14230]: ColorPointervINTEL (dynamic) */ "iip\0" "glColorPointervINTEL\0" "\0" - /* _mesa_function_pool[13817]: TexEnvf (offset 184) */ + /* _mesa_function_pool[14256]: TexEnvf (offset 184) */ "iif\0" "glTexEnvf\0" "\0" - /* _mesa_function_pool[13832]: TexCoord3d (offset 110) */ + /* _mesa_function_pool[14271]: TexCoord3d (offset 110) */ "ddd\0" "glTexCoord3d\0" "\0" - /* _mesa_function_pool[13850]: AlphaFragmentOp1ATI (will be remapped) */ + /* _mesa_function_pool[14289]: AlphaFragmentOp1ATI (will be remapped) */ "iiiiii\0" "glAlphaFragmentOp1ATI\0" "\0" - /* _mesa_function_pool[13880]: TexCoord3f (offset 112) */ + /* _mesa_function_pool[14319]: TexCoord3f (offset 112) */ "fff\0" "glTexCoord3f\0" "\0" - /* _mesa_function_pool[13898]: MultiTexCoord3ivARB (offset 397) */ + /* _mesa_function_pool[14337]: MultiTexCoord3ivARB (offset 397) */ "ip\0" "glMultiTexCoord3iv\0" "glMultiTexCoord3ivARB\0" "\0" - /* _mesa_function_pool[13943]: MultiTexCoord2sARB (offset 390) */ + /* _mesa_function_pool[14382]: MultiTexCoord2sARB (offset 390) */ "iii\0" "glMultiTexCoord2s\0" "glMultiTexCoord2sARB\0" "\0" - /* _mesa_function_pool[13987]: VertexAttrib1dvARB (will be remapped) */ + /* _mesa_function_pool[14426]: VertexAttrib1dvARB (will be remapped) */ "ip\0" "glVertexAttrib1dv\0" "glVertexAttrib1dvARB\0" "\0" - /* _mesa_function_pool[14030]: DeleteTextures (offset 327) */ + /* _mesa_function_pool[14469]: DeleteTextures (offset 327) */ "ip\0" "glDeleteTextures\0" "glDeleteTexturesEXT\0" "\0" - /* _mesa_function_pool[14071]: TexCoordPointerEXT (will be remapped) */ + /* _mesa_function_pool[14510]: TexCoordPointerEXT (will be remapped) */ "iiiip\0" "glTexCoordPointerEXT\0" "\0" - /* _mesa_function_pool[14099]: TexSubImage4DSGIS (dynamic) */ + /* _mesa_function_pool[14538]: TexSubImage4DSGIS (dynamic) */ "iiiiiiiiiiiip\0" "glTexSubImage4DSGIS\0" "\0" - /* _mesa_function_pool[14134]: TexCoord3s (offset 116) */ + /* _mesa_function_pool[14573]: TexCoord3s (offset 116) */ "iii\0" "glTexCoord3s\0" "\0" - /* _mesa_function_pool[14152]: GetTexLevelParameteriv (offset 285) */ + /* _mesa_function_pool[14591]: GetTexLevelParameteriv (offset 285) */ "iiip\0" "glGetTexLevelParameteriv\0" "\0" - /* _mesa_function_pool[14183]: CombinerStageParameterfvNV (dynamic) */ + /* _mesa_function_pool[14622]: DrawArraysInstanced (will be remapped) */ + "iiii\0" + "glDrawArraysInstanced\0" + "glDrawArraysInstancedARB\0" + "glDrawArraysInstancedEXT\0" + "\0" + /* _mesa_function_pool[14700]: CombinerStageParameterfvNV (dynamic) */ "iip\0" "glCombinerStageParameterfvNV\0" "\0" - /* _mesa_function_pool[14217]: StopInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[14734]: StopInstrumentsSGIX (dynamic) */ "i\0" "glStopInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[14242]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */ + /* _mesa_function_pool[14759]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */ "fffffffffffffff\0" "glTexCoord4fColor4fNormal3fVertex4fSUN\0" "\0" - /* _mesa_function_pool[14298]: ClearAccum (offset 204) */ + /* _mesa_function_pool[14815]: ClearAccum (offset 204) */ "ffff\0" "glClearAccum\0" "\0" - /* _mesa_function_pool[14317]: DeformSGIX (dynamic) */ + /* _mesa_function_pool[14834]: DeformSGIX (dynamic) */ "i\0" "glDeformSGIX\0" "\0" - /* _mesa_function_pool[14333]: GetVertexAttribfvARB (will be remapped) */ + /* _mesa_function_pool[14850]: GetVertexAttribfvARB (will be remapped) */ "iip\0" "glGetVertexAttribfv\0" "glGetVertexAttribfvARB\0" "\0" - /* _mesa_function_pool[14381]: SecondaryColor3ivEXT (will be remapped) */ + /* _mesa_function_pool[14898]: SecondaryColor3ivEXT (will be remapped) */ "p\0" "glSecondaryColor3iv\0" "glSecondaryColor3ivEXT\0" "\0" - /* _mesa_function_pool[14427]: TexCoord4iv (offset 123) */ + /* _mesa_function_pool[14944]: TexCoord4iv (offset 123) */ "p\0" "glTexCoord4iv\0" "\0" - /* _mesa_function_pool[14444]: UniformMatrix4x2fv (will be remapped) */ + /* _mesa_function_pool[14961]: UniformMatrix4x2fv (will be remapped) */ "iiip\0" "glUniformMatrix4x2fv\0" "\0" - /* _mesa_function_pool[14471]: GetDetailTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[14988]: GetDetailTexFuncSGIS (dynamic) */ "ip\0" "glGetDetailTexFuncSGIS\0" "\0" - /* _mesa_function_pool[14498]: GetCombinerStageParameterfvNV (dynamic) */ + /* _mesa_function_pool[15015]: GetCombinerStageParameterfvNV (dynamic) */ "iip\0" "glGetCombinerStageParameterfvNV\0" "\0" - /* _mesa_function_pool[14535]: PolygonOffset (offset 319) */ + /* _mesa_function_pool[15052]: PolygonOffset (offset 319) */ "ff\0" "glPolygonOffset\0" "\0" - /* _mesa_function_pool[14555]: BindVertexArray (will be remapped) */ + /* _mesa_function_pool[15072]: BindVertexArray (will be remapped) */ "i\0" "glBindVertexArray\0" "\0" - /* _mesa_function_pool[14576]: Color4ubVertex2fvSUN (dynamic) */ + /* _mesa_function_pool[15093]: Color4ubVertex2fvSUN (dynamic) */ "pp\0" "glColor4ubVertex2fvSUN\0" "\0" - /* _mesa_function_pool[14603]: Rectd (offset 86) */ + /* _mesa_function_pool[15120]: Rectd (offset 86) */ "dddd\0" "glRectd\0" "\0" - /* _mesa_function_pool[14617]: TexFilterFuncSGIS (dynamic) */ + /* _mesa_function_pool[15134]: TexFilterFuncSGIS (dynamic) */ "iiip\0" "glTexFilterFuncSGIS\0" "\0" - /* _mesa_function_pool[14643]: SampleMaskSGIS (will be remapped) */ + /* _mesa_function_pool[15160]: SampleMaskSGIS (will be remapped) */ "fi\0" "glSampleMaskSGIS\0" "glSampleMaskEXT\0" "\0" - /* _mesa_function_pool[14680]: GetAttribLocationARB (will be remapped) */ + /* _mesa_function_pool[15197]: GetAttribLocationARB (will be remapped) */ "ip\0" "glGetAttribLocation\0" "glGetAttribLocationARB\0" "\0" - /* _mesa_function_pool[14727]: RasterPos3i (offset 74) */ + /* _mesa_function_pool[15244]: RasterPos3i (offset 74) */ "iii\0" "glRasterPos3i\0" "\0" - /* _mesa_function_pool[14746]: VertexAttrib4ubvARB (will be remapped) */ + /* _mesa_function_pool[15263]: VertexAttrib4ubvARB (will be remapped) */ "ip\0" "glVertexAttrib4ubv\0" "glVertexAttrib4ubvARB\0" "\0" - /* _mesa_function_pool[14791]: DetailTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[15308]: DetailTexFuncSGIS (dynamic) */ "iip\0" "glDetailTexFuncSGIS\0" "\0" - /* _mesa_function_pool[14816]: Normal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[15333]: Normal3fVertex3fSUN (dynamic) */ "ffffff\0" "glNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[14846]: CopyTexImage2D (offset 324) */ + /* _mesa_function_pool[15363]: CopyTexImage2D (offset 324) */ "iiiiiiii\0" "glCopyTexImage2D\0" "glCopyTexImage2DEXT\0" "\0" - /* _mesa_function_pool[14893]: GetBufferPointervARB (will be remapped) */ + /* _mesa_function_pool[15410]: GetBufferPointervARB (will be remapped) */ "iip\0" "glGetBufferPointerv\0" "glGetBufferPointervARB\0" "\0" - /* _mesa_function_pool[14941]: ProgramEnvParameter4fARB (will be remapped) */ + /* _mesa_function_pool[15458]: ProgramEnvParameter4fARB (will be remapped) */ "iiffff\0" "glProgramEnvParameter4fARB\0" "glProgramParameter4fNV\0" "\0" - /* _mesa_function_pool[14999]: Uniform3ivARB (will be remapped) */ + /* _mesa_function_pool[15516]: Uniform3ivARB (will be remapped) */ "iip\0" "glUniform3iv\0" "glUniform3ivARB\0" "\0" - /* _mesa_function_pool[15033]: Lightfv (offset 160) */ + /* _mesa_function_pool[15550]: Lightfv (offset 160) */ "iip\0" "glLightfv\0" "\0" - /* _mesa_function_pool[15048]: ClearDepth (offset 208) */ + /* _mesa_function_pool[15565]: ClearDepth (offset 208) */ "d\0" "glClearDepth\0" "\0" - /* _mesa_function_pool[15064]: GetFenceivNV (will be remapped) */ + /* _mesa_function_pool[15581]: GetFenceivNV (will be remapped) */ "iip\0" "glGetFenceivNV\0" "\0" - /* _mesa_function_pool[15084]: WindowPos4dvMESA (will be remapped) */ + /* _mesa_function_pool[15601]: WindowPos4dvMESA (will be remapped) */ "p\0" "glWindowPos4dvMESA\0" "\0" - /* _mesa_function_pool[15106]: ColorSubTable (offset 346) */ + /* _mesa_function_pool[15623]: ColorSubTable (offset 346) */ "iiiiip\0" "glColorSubTable\0" "glColorSubTableEXT\0" "\0" - /* _mesa_function_pool[15149]: Color4fv (offset 30) */ + /* _mesa_function_pool[15666]: Color4fv (offset 30) */ "p\0" "glColor4fv\0" "\0" - /* _mesa_function_pool[15163]: MultiTexCoord4ivARB (offset 405) */ + /* _mesa_function_pool[15680]: MultiTexCoord4ivARB (offset 405) */ "ip\0" "glMultiTexCoord4iv\0" "glMultiTexCoord4ivARB\0" "\0" - /* _mesa_function_pool[15208]: ProgramLocalParameters4fvEXT (will be remapped) */ - "iiip\0" - "glProgramLocalParameters4fvEXT\0" + /* _mesa_function_pool[15725]: DrawElementsInstanced (will be remapped) */ + "iiipi\0" + "glDrawElementsInstanced\0" + "glDrawElementsInstancedARB\0" + "glDrawElementsInstancedEXT\0" "\0" - /* _mesa_function_pool[15245]: ColorPointer (offset 308) */ + /* _mesa_function_pool[15810]: ColorPointer (offset 308) */ "iiip\0" "glColorPointer\0" "\0" - /* _mesa_function_pool[15266]: Rects (offset 92) */ + /* _mesa_function_pool[15831]: Rects (offset 92) */ "iiii\0" "glRects\0" "\0" - /* _mesa_function_pool[15280]: GetMapAttribParameterfvNV (dynamic) */ + /* _mesa_function_pool[15845]: GetMapAttribParameterfvNV (dynamic) */ "iiip\0" "glGetMapAttribParameterfvNV\0" "\0" - /* _mesa_function_pool[15314]: Lightiv (offset 162) */ + /* _mesa_function_pool[15879]: Lightiv (offset 162) */ "iip\0" "glLightiv\0" "\0" - /* _mesa_function_pool[15329]: VertexAttrib4sARB (will be remapped) */ + /* _mesa_function_pool[15894]: VertexAttrib4sARB (will be remapped) */ "iiiii\0" "glVertexAttrib4s\0" "glVertexAttrib4sARB\0" "\0" - /* _mesa_function_pool[15373]: GetQueryObjectuivARB (will be remapped) */ + /* _mesa_function_pool[15938]: GetQueryObjectuivARB (will be remapped) */ "iip\0" "glGetQueryObjectuiv\0" "glGetQueryObjectuivARB\0" "\0" - /* _mesa_function_pool[15421]: GetTexParameteriv (offset 283) */ + /* _mesa_function_pool[15986]: GetTexParameteriv (offset 283) */ "iip\0" "glGetTexParameteriv\0" "\0" - /* _mesa_function_pool[15446]: MapParameterivNV (dynamic) */ + /* _mesa_function_pool[16011]: MapParameterivNV (dynamic) */ "iip\0" "glMapParameterivNV\0" "\0" - /* _mesa_function_pool[15470]: GenRenderbuffersEXT (will be remapped) */ + /* _mesa_function_pool[16035]: GenRenderbuffersEXT (will be remapped) */ "ip\0" "glGenRenderbuffers\0" "glGenRenderbuffersEXT\0" "\0" - /* _mesa_function_pool[15515]: VertexAttrib2dvARB (will be remapped) */ + /* _mesa_function_pool[16080]: VertexAttrib2dvARB (will be remapped) */ "ip\0" "glVertexAttrib2dv\0" "glVertexAttrib2dvARB\0" "\0" - /* _mesa_function_pool[15558]: EdgeFlagPointerEXT (will be remapped) */ + /* _mesa_function_pool[16123]: EdgeFlagPointerEXT (will be remapped) */ "iip\0" "glEdgeFlagPointerEXT\0" "\0" - /* _mesa_function_pool[15584]: VertexAttribs2svNV (will be remapped) */ + /* _mesa_function_pool[16149]: VertexAttribs2svNV (will be remapped) */ "iip\0" "glVertexAttribs2svNV\0" "\0" - /* _mesa_function_pool[15610]: WeightbvARB (dynamic) */ + /* _mesa_function_pool[16175]: WeightbvARB (dynamic) */ "ip\0" "glWeightbvARB\0" "\0" - /* _mesa_function_pool[15628]: VertexAttrib2fvARB (will be remapped) */ + /* _mesa_function_pool[16193]: VertexAttrib2fvARB (will be remapped) */ "ip\0" "glVertexAttrib2fv\0" "glVertexAttrib2fvARB\0" "\0" - /* _mesa_function_pool[15671]: GetBufferParameterivARB (will be remapped) */ + /* _mesa_function_pool[16236]: GetBufferParameterivARB (will be remapped) */ "iip\0" "glGetBufferParameteriv\0" "glGetBufferParameterivARB\0" "\0" - /* _mesa_function_pool[15725]: Rectdv (offset 87) */ + /* _mesa_function_pool[16290]: Rectdv (offset 87) */ "pp\0" "glRectdv\0" "\0" - /* _mesa_function_pool[15738]: ListParameteriSGIX (dynamic) */ + /* _mesa_function_pool[16303]: ListParameteriSGIX (dynamic) */ "iii\0" "glListParameteriSGIX\0" "\0" - /* _mesa_function_pool[15764]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[16329]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */ "iffffffffff\0" "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[15823]: InstrumentsBufferSGIX (dynamic) */ + /* _mesa_function_pool[16388]: InstrumentsBufferSGIX (dynamic) */ "ip\0" "glInstrumentsBufferSGIX\0" "\0" - /* _mesa_function_pool[15851]: VertexAttrib4NivARB (will be remapped) */ + /* _mesa_function_pool[16416]: VertexAttrib4NivARB (will be remapped) */ "ip\0" "glVertexAttrib4Niv\0" "glVertexAttrib4NivARB\0" "\0" - /* _mesa_function_pool[15896]: GetAttachedShaders (will be remapped) */ + /* _mesa_function_pool[16461]: GetAttachedShaders (will be remapped) */ "iipp\0" "glGetAttachedShaders\0" "\0" - /* _mesa_function_pool[15923]: GenVertexArraysAPPLE (will be remapped) */ + /* _mesa_function_pool[16488]: GenVertexArraysAPPLE (will be remapped) */ "ip\0" "glGenVertexArraysAPPLE\0" "\0" - /* _mesa_function_pool[15950]: Materialiv (offset 172) */ + /* _mesa_function_pool[16515]: Materialiv (offset 172) */ "iip\0" "glMaterialiv\0" "\0" - /* _mesa_function_pool[15968]: PushClientAttrib (offset 335) */ + /* _mesa_function_pool[16533]: PushClientAttrib (offset 335) */ "i\0" "glPushClientAttrib\0" "\0" - /* _mesa_function_pool[15990]: ProgramEnvParameters4fvEXT (will be remapped) */ + /* _mesa_function_pool[16555]: ProgramEnvParameters4fvEXT (will be remapped) */ "iiip\0" "glProgramEnvParameters4fvEXT\0" "\0" - /* _mesa_function_pool[16025]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[16590]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ "pppp\0" "glTexCoord2fColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[16071]: WindowPos2iMESA (will be remapped) */ + /* _mesa_function_pool[16636]: WindowPos2iMESA (will be remapped) */ "ii\0" "glWindowPos2i\0" "glWindowPos2iARB\0" "glWindowPos2iMESA\0" "\0" - /* _mesa_function_pool[16124]: SecondaryColor3fvEXT (will be remapped) */ + /* _mesa_function_pool[16689]: SecondaryColor3fvEXT (will be remapped) */ "p\0" "glSecondaryColor3fv\0" "glSecondaryColor3fvEXT\0" "\0" - /* _mesa_function_pool[16170]: PolygonMode (offset 174) */ + /* _mesa_function_pool[16735]: PolygonMode (offset 174) */ "ii\0" "glPolygonMode\0" "\0" - /* _mesa_function_pool[16188]: CompressedTexSubImage1DARB (will be remapped) */ + /* _mesa_function_pool[16753]: CompressedTexSubImage1DARB (will be remapped) */ "iiiiiip\0" "glCompressedTexSubImage1D\0" "glCompressedTexSubImage1DARB\0" "\0" - /* _mesa_function_pool[16252]: GetVertexAttribivNV (will be remapped) */ + /* _mesa_function_pool[16817]: GetVertexAttribivNV (will be remapped) */ "iip\0" "glGetVertexAttribivNV\0" "\0" - /* _mesa_function_pool[16279]: GetProgramStringARB (will be remapped) */ + /* _mesa_function_pool[16844]: GetProgramStringARB (will be remapped) */ "iip\0" "glGetProgramStringARB\0" "\0" - /* _mesa_function_pool[16306]: TexBumpParameterfvATI (will be remapped) */ + /* _mesa_function_pool[16871]: TexBumpParameterfvATI (will be remapped) */ "ip\0" "glTexBumpParameterfvATI\0" "\0" - /* _mesa_function_pool[16334]: CompileShaderARB (will be remapped) */ + /* _mesa_function_pool[16899]: CompileShaderARB (will be remapped) */ "i\0" "glCompileShader\0" "glCompileShaderARB\0" "\0" - /* _mesa_function_pool[16372]: DeleteShader (will be remapped) */ + /* _mesa_function_pool[16937]: DeleteShader (will be remapped) */ "i\0" "glDeleteShader\0" "\0" - /* _mesa_function_pool[16390]: DisableClientState (offset 309) */ + /* _mesa_function_pool[16955]: DisableClientState (offset 309) */ "i\0" "glDisableClientState\0" "\0" - /* _mesa_function_pool[16414]: TexGeni (offset 192) */ + /* _mesa_function_pool[16979]: TexGeni (offset 192) */ "iii\0" "glTexGeni\0" "\0" - /* _mesa_function_pool[16429]: TexGenf (offset 190) */ + /* _mesa_function_pool[16994]: TexGenf (offset 190) */ "iif\0" "glTexGenf\0" "\0" - /* _mesa_function_pool[16444]: Uniform3fARB (will be remapped) */ + /* _mesa_function_pool[17009]: Uniform3fARB (will be remapped) */ "ifff\0" "glUniform3f\0" "glUniform3fARB\0" "\0" - /* _mesa_function_pool[16477]: TexGend (offset 188) */ + /* _mesa_function_pool[17042]: TexGend (offset 188) */ "iid\0" "glTexGend\0" "\0" - /* _mesa_function_pool[16492]: ListParameterfvSGIX (dynamic) */ + /* _mesa_function_pool[17057]: ListParameterfvSGIX (dynamic) */ "iip\0" "glListParameterfvSGIX\0" "\0" - /* _mesa_function_pool[16519]: GetPolygonStipple (offset 274) */ + /* _mesa_function_pool[17084]: GetPolygonStipple (offset 274) */ "p\0" "glGetPolygonStipple\0" "\0" - /* _mesa_function_pool[16542]: Tangent3dvEXT (dynamic) */ + /* _mesa_function_pool[17107]: Tangent3dvEXT (dynamic) */ "p\0" "glTangent3dvEXT\0" "\0" - /* _mesa_function_pool[16561]: GetVertexAttribfvNV (will be remapped) */ - "iip\0" - "glGetVertexAttribfvNV\0" + /* _mesa_function_pool[17126]: BindBufferOffsetEXT (will be remapped) */ + "iiii\0" + "glBindBufferOffsetEXT\0" "\0" - /* _mesa_function_pool[16588]: WindowPos3sMESA (will be remapped) */ + /* _mesa_function_pool[17154]: WindowPos3sMESA (will be remapped) */ "iii\0" "glWindowPos3s\0" "glWindowPos3sARB\0" "glWindowPos3sMESA\0" "\0" - /* _mesa_function_pool[16642]: VertexAttrib2svNV (will be remapped) */ + /* _mesa_function_pool[17208]: VertexAttrib2svNV (will be remapped) */ "ip\0" "glVertexAttrib2svNV\0" "\0" - /* _mesa_function_pool[16666]: VertexAttribs1fvNV (will be remapped) */ - "iip\0" - "glVertexAttribs1fvNV\0" + /* _mesa_function_pool[17232]: DisableIndexedEXT (will be remapped) */ + "ii\0" + "glDisableIndexedEXT\0" + "\0" + /* _mesa_function_pool[17256]: BindBufferBaseEXT (will be remapped) */ + "iii\0" + "glBindBufferBaseEXT\0" + "glBindBufferBase\0" "\0" - /* _mesa_function_pool[16692]: TexCoord2fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[17298]: TexCoord2fVertex3fvSUN (dynamic) */ "pp\0" "glTexCoord2fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[16721]: WindowPos4sMESA (will be remapped) */ + /* _mesa_function_pool[17327]: WindowPos4sMESA (will be remapped) */ "iiii\0" "glWindowPos4sMESA\0" "\0" - /* _mesa_function_pool[16745]: VertexAttrib4NuivARB (will be remapped) */ + /* _mesa_function_pool[17351]: VertexAttrib4NuivARB (will be remapped) */ "ip\0" "glVertexAttrib4Nuiv\0" "glVertexAttrib4NuivARB\0" "\0" - /* _mesa_function_pool[16792]: ClientActiveTextureARB (offset 375) */ + /* _mesa_function_pool[17398]: ClientActiveTextureARB (offset 375) */ "i\0" "glClientActiveTexture\0" "glClientActiveTextureARB\0" "\0" - /* _mesa_function_pool[16842]: PixelTexGenSGIX (will be remapped) */ + /* _mesa_function_pool[17448]: PixelTexGenSGIX (will be remapped) */ "i\0" "glPixelTexGenSGIX\0" "\0" - /* _mesa_function_pool[16863]: ReplacementCodeusvSUN (dynamic) */ + /* _mesa_function_pool[17469]: ReplacementCodeusvSUN (dynamic) */ "p\0" "glReplacementCodeusvSUN\0" "\0" - /* _mesa_function_pool[16890]: Uniform4fARB (will be remapped) */ + /* _mesa_function_pool[17496]: Uniform4fARB (will be remapped) */ "iffff\0" "glUniform4f\0" "glUniform4fARB\0" "\0" - /* _mesa_function_pool[16924]: Color4sv (offset 34) */ + /* _mesa_function_pool[17530]: Color4sv (offset 34) */ "p\0" "glColor4sv\0" "\0" - /* _mesa_function_pool[16938]: FlushMappedBufferRange (will be remapped) */ + /* _mesa_function_pool[17544]: FlushMappedBufferRange (will be remapped) */ "iii\0" "glFlushMappedBufferRange\0" "\0" - /* _mesa_function_pool[16968]: IsProgramNV (will be remapped) */ + /* _mesa_function_pool[17574]: IsProgramNV (will be remapped) */ "i\0" "glIsProgramARB\0" "glIsProgramNV\0" "\0" - /* _mesa_function_pool[17000]: FlushMappedBufferRangeAPPLE (will be remapped) */ + /* _mesa_function_pool[17606]: FlushMappedBufferRangeAPPLE (will be remapped) */ "iii\0" "glFlushMappedBufferRangeAPPLE\0" "\0" - /* _mesa_function_pool[17035]: PixelZoom (offset 246) */ + /* _mesa_function_pool[17641]: PixelZoom (offset 246) */ "ff\0" "glPixelZoom\0" "\0" - /* _mesa_function_pool[17051]: ReplacementCodePointerSUN (dynamic) */ + /* _mesa_function_pool[17657]: ReplacementCodePointerSUN (dynamic) */ "iip\0" "glReplacementCodePointerSUN\0" "\0" - /* _mesa_function_pool[17084]: ProgramEnvParameter4dARB (will be remapped) */ + /* _mesa_function_pool[17690]: ProgramEnvParameter4dARB (will be remapped) */ "iidddd\0" "glProgramEnvParameter4dARB\0" "glProgramParameter4dNV\0" "\0" - /* _mesa_function_pool[17142]: ColorTableParameterfv (offset 340) */ + /* _mesa_function_pool[17748]: ColorTableParameterfv (offset 340) */ "iip\0" "glColorTableParameterfv\0" "glColorTableParameterfvSGI\0" "\0" - /* _mesa_function_pool[17198]: FragmentLightModelfSGIX (dynamic) */ + /* _mesa_function_pool[17804]: FragmentLightModelfSGIX (dynamic) */ "if\0" "glFragmentLightModelfSGIX\0" "\0" - /* _mesa_function_pool[17228]: Binormal3bvEXT (dynamic) */ + /* _mesa_function_pool[17834]: Binormal3bvEXT (dynamic) */ "p\0" "glBinormal3bvEXT\0" "\0" - /* _mesa_function_pool[17248]: PixelMapuiv (offset 252) */ + /* _mesa_function_pool[17854]: PixelMapuiv (offset 252) */ "iip\0" "glPixelMapuiv\0" "\0" - /* _mesa_function_pool[17267]: Color3dv (offset 12) */ + /* _mesa_function_pool[17873]: Color3dv (offset 12) */ "p\0" "glColor3dv\0" "\0" - /* _mesa_function_pool[17281]: IsTexture (offset 330) */ + /* _mesa_function_pool[17887]: IsTexture (offset 330) */ "i\0" "glIsTexture\0" "glIsTextureEXT\0" "\0" - /* _mesa_function_pool[17311]: VertexWeightfvEXT (dynamic) */ + /* _mesa_function_pool[17917]: VertexWeightfvEXT (dynamic) */ "p\0" "glVertexWeightfvEXT\0" "\0" - /* _mesa_function_pool[17334]: VertexAttrib1dARB (will be remapped) */ + /* _mesa_function_pool[17940]: VertexAttrib1dARB (will be remapped) */ "id\0" "glVertexAttrib1d\0" "glVertexAttrib1dARB\0" "\0" - /* _mesa_function_pool[17375]: ImageTransformParameterivHP (dynamic) */ + /* _mesa_function_pool[17981]: ImageTransformParameterivHP (dynamic) */ "iip\0" "glImageTransformParameterivHP\0" "\0" - /* _mesa_function_pool[17410]: TexCoord4i (offset 122) */ + /* _mesa_function_pool[18016]: TexCoord4i (offset 122) */ "iiii\0" "glTexCoord4i\0" "\0" - /* _mesa_function_pool[17429]: DeleteQueriesARB (will be remapped) */ + /* _mesa_function_pool[18035]: DeleteQueriesARB (will be remapped) */ "ip\0" "glDeleteQueries\0" "glDeleteQueriesARB\0" "\0" - /* _mesa_function_pool[17468]: Color4ubVertex2fSUN (dynamic) */ + /* _mesa_function_pool[18074]: Color4ubVertex2fSUN (dynamic) */ "iiiiff\0" "glColor4ubVertex2fSUN\0" "\0" - /* _mesa_function_pool[17498]: FragmentColorMaterialSGIX (dynamic) */ + /* _mesa_function_pool[18104]: FragmentColorMaterialSGIX (dynamic) */ "ii\0" "glFragmentColorMaterialSGIX\0" "\0" - /* _mesa_function_pool[17530]: CurrentPaletteMatrixARB (dynamic) */ + /* _mesa_function_pool[18136]: CurrentPaletteMatrixARB (dynamic) */ "i\0" "glCurrentPaletteMatrixARB\0" "\0" - /* _mesa_function_pool[17559]: GetMapdv (offset 266) */ + /* _mesa_function_pool[18165]: GetMapdv (offset 266) */ "iip\0" "glGetMapdv\0" "\0" - /* _mesa_function_pool[17575]: ObjectPurgeableAPPLE (will be remapped) */ + /* _mesa_function_pool[18181]: ObjectPurgeableAPPLE (will be remapped) */ "iii\0" "glObjectPurgeableAPPLE\0" "\0" - /* _mesa_function_pool[17603]: SamplePatternSGIS (will be remapped) */ + /* _mesa_function_pool[18209]: SamplePatternSGIS (will be remapped) */ "i\0" "glSamplePatternSGIS\0" "glSamplePatternEXT\0" "\0" - /* _mesa_function_pool[17645]: PixelStoref (offset 249) */ + /* _mesa_function_pool[18251]: PixelStoref (offset 249) */ "if\0" "glPixelStoref\0" "\0" - /* _mesa_function_pool[17663]: IsQueryARB (will be remapped) */ + /* _mesa_function_pool[18269]: IsQueryARB (will be remapped) */ "i\0" "glIsQuery\0" "glIsQueryARB\0" "\0" - /* _mesa_function_pool[17689]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */ + /* _mesa_function_pool[18295]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */ "iiiiifff\0" "glReplacementCodeuiColor4ubVertex3fSUN\0" "\0" - /* _mesa_function_pool[17738]: PixelStorei (offset 250) */ + /* _mesa_function_pool[18344]: PixelStorei (offset 250) */ "ii\0" "glPixelStorei\0" "\0" - /* _mesa_function_pool[17756]: VertexAttrib4usvARB (will be remapped) */ + /* _mesa_function_pool[18362]: VertexAttrib4usvARB (will be remapped) */ "ip\0" "glVertexAttrib4usv\0" "glVertexAttrib4usvARB\0" "\0" - /* _mesa_function_pool[17801]: LinkProgramARB (will be remapped) */ + /* _mesa_function_pool[18407]: LinkProgramARB (will be remapped) */ "i\0" "glLinkProgram\0" "glLinkProgramARB\0" "\0" - /* _mesa_function_pool[17835]: VertexAttrib2fNV (will be remapped) */ + /* _mesa_function_pool[18441]: VertexAttrib2fNV (will be remapped) */ "iff\0" "glVertexAttrib2fNV\0" "\0" - /* _mesa_function_pool[17859]: ShaderSourceARB (will be remapped) */ + /* _mesa_function_pool[18465]: ShaderSourceARB (will be remapped) */ "iipp\0" "glShaderSource\0" "glShaderSourceARB\0" "\0" - /* _mesa_function_pool[17898]: FragmentMaterialiSGIX (dynamic) */ + /* _mesa_function_pool[18504]: FragmentMaterialiSGIX (dynamic) */ "iii\0" "glFragmentMaterialiSGIX\0" "\0" - /* _mesa_function_pool[17927]: EvalCoord2dv (offset 233) */ + /* _mesa_function_pool[18533]: EvalCoord2dv (offset 233) */ "p\0" "glEvalCoord2dv\0" "\0" - /* _mesa_function_pool[17945]: VertexAttrib3svARB (will be remapped) */ + /* _mesa_function_pool[18551]: VertexAttrib3svARB (will be remapped) */ "ip\0" "glVertexAttrib3sv\0" "glVertexAttrib3svARB\0" "\0" - /* _mesa_function_pool[17988]: ColorMaterial (offset 151) */ + /* _mesa_function_pool[18594]: ColorMaterial (offset 151) */ "ii\0" "glColorMaterial\0" "\0" - /* _mesa_function_pool[18008]: CompressedTexSubImage3DARB (will be remapped) */ + /* _mesa_function_pool[18614]: CompressedTexSubImage3DARB (will be remapped) */ "iiiiiiiiiip\0" "glCompressedTexSubImage3D\0" "glCompressedTexSubImage3DARB\0" "\0" - /* _mesa_function_pool[18076]: WindowPos2ivMESA (will be remapped) */ + /* _mesa_function_pool[18682]: WindowPos2ivMESA (will be remapped) */ "p\0" "glWindowPos2iv\0" "glWindowPos2ivARB\0" "glWindowPos2ivMESA\0" "\0" - /* _mesa_function_pool[18131]: IsFramebufferEXT (will be remapped) */ + /* _mesa_function_pool[18737]: IsFramebufferEXT (will be remapped) */ "i\0" "glIsFramebuffer\0" "glIsFramebufferEXT\0" "\0" - /* _mesa_function_pool[18169]: Uniform4ivARB (will be remapped) */ + /* _mesa_function_pool[18775]: Uniform4ivARB (will be remapped) */ "iip\0" "glUniform4iv\0" "glUniform4ivARB\0" "\0" - /* _mesa_function_pool[18203]: GetVertexAttribdvARB (will be remapped) */ + /* _mesa_function_pool[18809]: GetVertexAttribdvARB (will be remapped) */ "iip\0" "glGetVertexAttribdv\0" "glGetVertexAttribdvARB\0" "\0" - /* _mesa_function_pool[18251]: TexBumpParameterivATI (will be remapped) */ + /* _mesa_function_pool[18857]: TexBumpParameterivATI (will be remapped) */ "ip\0" "glTexBumpParameterivATI\0" "\0" - /* _mesa_function_pool[18279]: GetSeparableFilter (offset 359) */ + /* _mesa_function_pool[18885]: GetSeparableFilter (offset 359) */ "iiippp\0" "glGetSeparableFilter\0" "glGetSeparableFilterEXT\0" "\0" - /* _mesa_function_pool[18332]: Binormal3dEXT (dynamic) */ + /* _mesa_function_pool[18938]: Binormal3dEXT (dynamic) */ "ddd\0" "glBinormal3dEXT\0" "\0" - /* _mesa_function_pool[18353]: SpriteParameteriSGIX (dynamic) */ + /* _mesa_function_pool[18959]: SpriteParameteriSGIX (dynamic) */ "ii\0" "glSpriteParameteriSGIX\0" "\0" - /* _mesa_function_pool[18380]: RequestResidentProgramsNV (will be remapped) */ + /* _mesa_function_pool[18986]: RequestResidentProgramsNV (will be remapped) */ "ip\0" "glRequestResidentProgramsNV\0" "\0" - /* _mesa_function_pool[18412]: TagSampleBufferSGIX (dynamic) */ + /* _mesa_function_pool[19018]: TagSampleBufferSGIX (dynamic) */ "\0" "glTagSampleBufferSGIX\0" "\0" - /* _mesa_function_pool[18436]: ReplacementCodeusSUN (dynamic) */ - "i\0" - "glReplacementCodeusSUN\0" + /* _mesa_function_pool[19042]: TransformFeedbackVaryingsEXT (will be remapped) */ + "iipi\0" + "glTransformFeedbackVaryingsEXT\0" + "glTransformFeedbackVaryings\0" "\0" - /* _mesa_function_pool[18462]: FeedbackBuffer (offset 194) */ + /* _mesa_function_pool[19107]: FeedbackBuffer (offset 194) */ "iip\0" "glFeedbackBuffer\0" "\0" - /* _mesa_function_pool[18484]: RasterPos2iv (offset 67) */ + /* _mesa_function_pool[19129]: RasterPos2iv (offset 67) */ "p\0" "glRasterPos2iv\0" "\0" - /* _mesa_function_pool[18502]: TexImage1D (offset 182) */ + /* _mesa_function_pool[19147]: TexImage1D (offset 182) */ "iiiiiiip\0" "glTexImage1D\0" "\0" - /* _mesa_function_pool[18525]: ListParameterivSGIX (dynamic) */ + /* _mesa_function_pool[19170]: ListParameterivSGIX (dynamic) */ "iip\0" "glListParameterivSGIX\0" "\0" - /* _mesa_function_pool[18552]: MultiDrawElementsEXT (will be remapped) */ + /* _mesa_function_pool[19197]: MultiDrawElementsEXT (will be remapped) */ "ipipi\0" "glMultiDrawElements\0" "glMultiDrawElementsEXT\0" "\0" - /* _mesa_function_pool[18602]: Color3s (offset 17) */ + /* _mesa_function_pool[19247]: Color3s (offset 17) */ "iii\0" "glColor3s\0" "\0" - /* _mesa_function_pool[18617]: Uniform1ivARB (will be remapped) */ + /* _mesa_function_pool[19262]: Uniform1ivARB (will be remapped) */ "iip\0" "glUniform1iv\0" "glUniform1ivARB\0" "\0" - /* _mesa_function_pool[18651]: WindowPos2sMESA (will be remapped) */ + /* _mesa_function_pool[19296]: WindowPos2sMESA (will be remapped) */ "ii\0" "glWindowPos2s\0" "glWindowPos2sARB\0" "glWindowPos2sMESA\0" "\0" - /* _mesa_function_pool[18704]: WeightusvARB (dynamic) */ + /* _mesa_function_pool[19349]: WeightusvARB (dynamic) */ "ip\0" "glWeightusvARB\0" "\0" - /* _mesa_function_pool[18723]: TexCoordPointer (offset 320) */ + /* _mesa_function_pool[19368]: TexCoordPointer (offset 320) */ "iiip\0" "glTexCoordPointer\0" "\0" - /* _mesa_function_pool[18747]: FogCoordPointerEXT (will be remapped) */ + /* _mesa_function_pool[19392]: FogCoordPointerEXT (will be remapped) */ "iip\0" "glFogCoordPointer\0" "glFogCoordPointerEXT\0" "\0" - /* _mesa_function_pool[18791]: IndexMaterialEXT (dynamic) */ + /* _mesa_function_pool[19436]: IndexMaterialEXT (dynamic) */ "ii\0" "glIndexMaterialEXT\0" "\0" - /* _mesa_function_pool[18814]: Color3i (offset 15) */ + /* _mesa_function_pool[19459]: Color3i (offset 15) */ "iii\0" "glColor3i\0" "\0" - /* _mesa_function_pool[18829]: FrontFace (offset 157) */ + /* _mesa_function_pool[19474]: FrontFace (offset 157) */ "i\0" "glFrontFace\0" "\0" - /* _mesa_function_pool[18844]: EvalCoord2d (offset 232) */ + /* _mesa_function_pool[19489]: EvalCoord2d (offset 232) */ "dd\0" "glEvalCoord2d\0" "\0" - /* _mesa_function_pool[18862]: SecondaryColor3ubvEXT (will be remapped) */ + /* _mesa_function_pool[19507]: SecondaryColor3ubvEXT (will be remapped) */ "p\0" "glSecondaryColor3ubv\0" "glSecondaryColor3ubvEXT\0" "\0" - /* _mesa_function_pool[18910]: EvalCoord2f (offset 234) */ + /* _mesa_function_pool[19555]: EvalCoord2f (offset 234) */ "ff\0" "glEvalCoord2f\0" "\0" - /* _mesa_function_pool[18928]: VertexAttrib4dvARB (will be remapped) */ + /* _mesa_function_pool[19573]: VertexAttrib4dvARB (will be remapped) */ "ip\0" "glVertexAttrib4dv\0" "glVertexAttrib4dvARB\0" "\0" - /* _mesa_function_pool[18971]: BindAttribLocationARB (will be remapped) */ + /* _mesa_function_pool[19616]: BindAttribLocationARB (will be remapped) */ "iip\0" "glBindAttribLocation\0" "glBindAttribLocationARB\0" "\0" - /* _mesa_function_pool[19021]: Color3b (offset 9) */ + /* _mesa_function_pool[19666]: Color3b (offset 9) */ "iii\0" "glColor3b\0" "\0" - /* _mesa_function_pool[19036]: MultiTexCoord2dARB (offset 384) */ + /* _mesa_function_pool[19681]: MultiTexCoord2dARB (offset 384) */ "idd\0" "glMultiTexCoord2d\0" "glMultiTexCoord2dARB\0" "\0" - /* _mesa_function_pool[19080]: ExecuteProgramNV (will be remapped) */ + /* _mesa_function_pool[19725]: ExecuteProgramNV (will be remapped) */ "iip\0" "glExecuteProgramNV\0" "\0" - /* _mesa_function_pool[19104]: Color3f (offset 13) */ + /* _mesa_function_pool[19749]: Color3f (offset 13) */ "fff\0" "glColor3f\0" "\0" - /* _mesa_function_pool[19119]: LightEnviSGIX (dynamic) */ + /* _mesa_function_pool[19764]: LightEnviSGIX (dynamic) */ "ii\0" "glLightEnviSGIX\0" "\0" - /* _mesa_function_pool[19139]: Color3d (offset 11) */ + /* _mesa_function_pool[19784]: Color3d (offset 11) */ "ddd\0" "glColor3d\0" "\0" - /* _mesa_function_pool[19154]: Normal3dv (offset 55) */ + /* _mesa_function_pool[19799]: Normal3dv (offset 55) */ "p\0" "glNormal3dv\0" "\0" - /* _mesa_function_pool[19169]: Lightf (offset 159) */ + /* _mesa_function_pool[19814]: Lightf (offset 159) */ "iif\0" "glLightf\0" "\0" - /* _mesa_function_pool[19183]: ReplacementCodeuiSUN (dynamic) */ + /* _mesa_function_pool[19828]: ReplacementCodeuiSUN (dynamic) */ "i\0" "glReplacementCodeuiSUN\0" "\0" - /* _mesa_function_pool[19209]: MatrixMode (offset 293) */ + /* _mesa_function_pool[19854]: MatrixMode (offset 293) */ "i\0" "glMatrixMode\0" "\0" - /* _mesa_function_pool[19225]: GetPixelMapusv (offset 273) */ + /* _mesa_function_pool[19870]: GetPixelMapusv (offset 273) */ "ip\0" "glGetPixelMapusv\0" "\0" - /* _mesa_function_pool[19246]: Lighti (offset 161) */ + /* _mesa_function_pool[19891]: Lighti (offset 161) */ "iii\0" "glLighti\0" "\0" - /* _mesa_function_pool[19260]: VertexAttribPointerNV (will be remapped) */ + /* _mesa_function_pool[19905]: VertexAttribPointerNV (will be remapped) */ "iiiip\0" "glVertexAttribPointerNV\0" "\0" - /* _mesa_function_pool[19291]: GetBooleanIndexedvEXT (will be remapped) */ + /* _mesa_function_pool[19936]: ProgramLocalParameters4fvEXT (will be remapped) */ + "iiip\0" + "glProgramLocalParameters4fvEXT\0" + "\0" + /* _mesa_function_pool[19973]: GetBooleanIndexedvEXT (will be remapped) */ "iip\0" "glGetBooleanIndexedvEXT\0" "\0" - /* _mesa_function_pool[19320]: GetFramebufferAttachmentParameterivEXT (will be remapped) */ + /* _mesa_function_pool[20002]: GetFramebufferAttachmentParameterivEXT (will be remapped) */ "iiip\0" "glGetFramebufferAttachmentParameteriv\0" "glGetFramebufferAttachmentParameterivEXT\0" "\0" - /* _mesa_function_pool[19405]: PixelTransformParameterfEXT (dynamic) */ + /* _mesa_function_pool[20087]: PixelTransformParameterfEXT (dynamic) */ "iif\0" "glPixelTransformParameterfEXT\0" "\0" - /* _mesa_function_pool[19440]: MultiTexCoord4dvARB (offset 401) */ + /* _mesa_function_pool[20122]: MultiTexCoord4dvARB (offset 401) */ "ip\0" "glMultiTexCoord4dv\0" "glMultiTexCoord4dvARB\0" "\0" - /* _mesa_function_pool[19485]: PixelTransformParameteriEXT (dynamic) */ + /* _mesa_function_pool[20167]: PixelTransformParameteriEXT (dynamic) */ "iii\0" "glPixelTransformParameteriEXT\0" "\0" - /* _mesa_function_pool[19520]: GetDoublev (offset 260) */ + /* _mesa_function_pool[20202]: GetDoublev (offset 260) */ "ip\0" "glGetDoublev\0" "\0" - /* _mesa_function_pool[19537]: MultMatrixd (offset 295) */ + /* _mesa_function_pool[20219]: MultMatrixd (offset 295) */ "p\0" "glMultMatrixd\0" "\0" - /* _mesa_function_pool[19554]: MultMatrixf (offset 294) */ + /* _mesa_function_pool[20236]: MultMatrixf (offset 294) */ "p\0" "glMultMatrixf\0" "\0" - /* _mesa_function_pool[19571]: TexCoord2fColor4ubVertex3fSUN (dynamic) */ + /* _mesa_function_pool[20253]: TexCoord2fColor4ubVertex3fSUN (dynamic) */ "ffiiiifff\0" "glTexCoord2fColor4ubVertex3fSUN\0" "\0" - /* _mesa_function_pool[19614]: Uniform1iARB (will be remapped) */ + /* _mesa_function_pool[20296]: Uniform1iARB (will be remapped) */ "ii\0" "glUniform1i\0" "glUniform1iARB\0" "\0" - /* _mesa_function_pool[19645]: VertexAttribPointerARB (will be remapped) */ + /* _mesa_function_pool[20327]: VertexAttribPointerARB (will be remapped) */ "iiiiip\0" "glVertexAttribPointer\0" "glVertexAttribPointerARB\0" "\0" - /* _mesa_function_pool[19700]: SharpenTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[20382]: VertexAttrib3sNV (will be remapped) */ + "iiii\0" + "glVertexAttrib3sNV\0" + "\0" + /* _mesa_function_pool[20407]: SharpenTexFuncSGIS (dynamic) */ "iip\0" "glSharpenTexFuncSGIS\0" "\0" - /* _mesa_function_pool[19726]: MultiTexCoord4fvARB (offset 403) */ + /* _mesa_function_pool[20433]: MultiTexCoord4fvARB (offset 403) */ "ip\0" "glMultiTexCoord4fv\0" "glMultiTexCoord4fvARB\0" "\0" - /* _mesa_function_pool[19771]: UniformMatrix2x3fv (will be remapped) */ + /* _mesa_function_pool[20478]: UniformMatrix2x3fv (will be remapped) */ "iiip\0" "glUniformMatrix2x3fv\0" "\0" - /* _mesa_function_pool[19798]: TrackMatrixNV (will be remapped) */ + /* _mesa_function_pool[20505]: TrackMatrixNV (will be remapped) */ "iiii\0" "glTrackMatrixNV\0" "\0" - /* _mesa_function_pool[19820]: CombinerParameteriNV (will be remapped) */ + /* _mesa_function_pool[20527]: CombinerParameteriNV (will be remapped) */ "ii\0" "glCombinerParameteriNV\0" "\0" - /* _mesa_function_pool[19847]: DeleteAsyncMarkersSGIX (dynamic) */ + /* _mesa_function_pool[20554]: DeleteAsyncMarkersSGIX (dynamic) */ "ii\0" "glDeleteAsyncMarkersSGIX\0" "\0" - /* _mesa_function_pool[19876]: IsAsyncMarkerSGIX (dynamic) */ + /* _mesa_function_pool[20583]: ReplacementCodeusSUN (dynamic) */ + "i\0" + "glReplacementCodeusSUN\0" + "\0" + /* _mesa_function_pool[20609]: IsAsyncMarkerSGIX (dynamic) */ "i\0" "glIsAsyncMarkerSGIX\0" "\0" - /* _mesa_function_pool[19899]: FrameZoomSGIX (dynamic) */ + /* _mesa_function_pool[20632]: FrameZoomSGIX (dynamic) */ "i\0" "glFrameZoomSGIX\0" "\0" - /* _mesa_function_pool[19918]: Normal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[20651]: Normal3fVertex3fvSUN (dynamic) */ "pp\0" "glNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[19945]: RasterPos4sv (offset 85) */ + /* _mesa_function_pool[20678]: RasterPos4sv (offset 85) */ "p\0" "glRasterPos4sv\0" "\0" - /* _mesa_function_pool[19963]: VertexAttrib4NsvARB (will be remapped) */ + /* _mesa_function_pool[20696]: VertexAttrib4NsvARB (will be remapped) */ "ip\0" "glVertexAttrib4Nsv\0" "glVertexAttrib4NsvARB\0" "\0" - /* _mesa_function_pool[20008]: VertexAttrib3fvARB (will be remapped) */ + /* _mesa_function_pool[20741]: VertexAttrib3fvARB (will be remapped) */ "ip\0" "glVertexAttrib3fv\0" "glVertexAttrib3fvARB\0" "\0" - /* _mesa_function_pool[20051]: ClearColor (offset 206) */ + /* _mesa_function_pool[20784]: ClearColor (offset 206) */ "ffff\0" "glClearColor\0" "\0" - /* _mesa_function_pool[20070]: GetSynciv (will be remapped) */ + /* _mesa_function_pool[20803]: GetSynciv (will be remapped) */ "iiipp\0" "glGetSynciv\0" "\0" - /* _mesa_function_pool[20089]: DeleteFramebuffersEXT (will be remapped) */ + /* _mesa_function_pool[20822]: DeleteFramebuffersEXT (will be remapped) */ "ip\0" "glDeleteFramebuffers\0" "glDeleteFramebuffersEXT\0" "\0" - /* _mesa_function_pool[20138]: GlobalAlphaFactorsSUN (dynamic) */ + /* _mesa_function_pool[20871]: GlobalAlphaFactorsSUN (dynamic) */ "i\0" "glGlobalAlphaFactorsSUN\0" "\0" - /* _mesa_function_pool[20165]: IsEnabledIndexedEXT (will be remapped) */ + /* _mesa_function_pool[20898]: IsEnabledIndexedEXT (will be remapped) */ "ii\0" "glIsEnabledIndexedEXT\0" "\0" - /* _mesa_function_pool[20191]: TexEnviv (offset 187) */ + /* _mesa_function_pool[20924]: TexEnviv (offset 187) */ "iip\0" "glTexEnviv\0" "\0" - /* _mesa_function_pool[20207]: TexSubImage3D (offset 372) */ + /* _mesa_function_pool[20940]: TexSubImage3D (offset 372) */ "iiiiiiiiiip\0" "glTexSubImage3D\0" "glTexSubImage3DEXT\0" "\0" - /* _mesa_function_pool[20255]: Tangent3fEXT (dynamic) */ + /* _mesa_function_pool[20988]: Tangent3fEXT (dynamic) */ "fff\0" "glTangent3fEXT\0" "\0" - /* _mesa_function_pool[20275]: SecondaryColor3uivEXT (will be remapped) */ + /* _mesa_function_pool[21008]: SecondaryColor3uivEXT (will be remapped) */ "p\0" "glSecondaryColor3uiv\0" "glSecondaryColor3uivEXT\0" "\0" - /* _mesa_function_pool[20323]: MatrixIndexubvARB (dynamic) */ + /* _mesa_function_pool[21056]: MatrixIndexubvARB (dynamic) */ "ip\0" "glMatrixIndexubvARB\0" "\0" - /* _mesa_function_pool[20347]: Color4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[21080]: Color4fNormal3fVertex3fSUN (dynamic) */ "ffffffffff\0" "glColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[20388]: PixelTexGenParameterfSGIS (will be remapped) */ + /* _mesa_function_pool[21121]: PixelTexGenParameterfSGIS (will be remapped) */ "if\0" "glPixelTexGenParameterfSGIS\0" "\0" - /* _mesa_function_pool[20420]: CreateShader (will be remapped) */ + /* _mesa_function_pool[21153]: CreateShader (will be remapped) */ "i\0" "glCreateShader\0" "\0" - /* _mesa_function_pool[20438]: GetColorTableParameterfv (offset 344) */ + /* _mesa_function_pool[21171]: GetColorTableParameterfv (offset 344) */ "iip\0" "glGetColorTableParameterfv\0" "glGetColorTableParameterfvSGI\0" "glGetColorTableParameterfvEXT\0" "\0" - /* _mesa_function_pool[20530]: FragmentLightModelfvSGIX (dynamic) */ + /* _mesa_function_pool[21263]: FragmentLightModelfvSGIX (dynamic) */ "ip\0" "glFragmentLightModelfvSGIX\0" "\0" - /* _mesa_function_pool[20561]: Bitmap (offset 8) */ + /* _mesa_function_pool[21294]: Bitmap (offset 8) */ "iiffffp\0" "glBitmap\0" "\0" - /* _mesa_function_pool[20579]: MultiTexCoord3fARB (offset 394) */ + /* _mesa_function_pool[21312]: MultiTexCoord3fARB (offset 394) */ "ifff\0" "glMultiTexCoord3f\0" "glMultiTexCoord3fARB\0" "\0" - /* _mesa_function_pool[20624]: GetTexLevelParameterfv (offset 284) */ + /* _mesa_function_pool[21357]: GetTexLevelParameterfv (offset 284) */ "iiip\0" "glGetTexLevelParameterfv\0" "\0" - /* _mesa_function_pool[20655]: GetPixelTexGenParameterfvSGIS (will be remapped) */ + /* _mesa_function_pool[21388]: GetPixelTexGenParameterfvSGIS (will be remapped) */ "ip\0" "glGetPixelTexGenParameterfvSGIS\0" "\0" - /* _mesa_function_pool[20691]: GenFramebuffersEXT (will be remapped) */ + /* _mesa_function_pool[21424]: GenFramebuffersEXT (will be remapped) */ "ip\0" "glGenFramebuffers\0" "glGenFramebuffersEXT\0" "\0" - /* _mesa_function_pool[20734]: GetProgramParameterdvNV (will be remapped) */ + /* _mesa_function_pool[21467]: GetProgramParameterdvNV (will be remapped) */ "iiip\0" "glGetProgramParameterdvNV\0" "\0" - /* _mesa_function_pool[20766]: Vertex2sv (offset 133) */ + /* _mesa_function_pool[21499]: Vertex2sv (offset 133) */ "p\0" "glVertex2sv\0" "\0" - /* _mesa_function_pool[20781]: GetIntegerv (offset 263) */ + /* _mesa_function_pool[21514]: GetIntegerv (offset 263) */ "ip\0" "glGetIntegerv\0" "\0" - /* _mesa_function_pool[20799]: IsVertexArrayAPPLE (will be remapped) */ + /* _mesa_function_pool[21532]: IsVertexArrayAPPLE (will be remapped) */ "i\0" "glIsVertexArray\0" "glIsVertexArrayAPPLE\0" "\0" - /* _mesa_function_pool[20839]: FragmentLightfvSGIX (dynamic) */ + /* _mesa_function_pool[21572]: FragmentLightfvSGIX (dynamic) */ "iip\0" "glFragmentLightfvSGIX\0" "\0" - /* _mesa_function_pool[20866]: DetachShader (will be remapped) */ + /* _mesa_function_pool[21599]: DetachShader (will be remapped) */ "ii\0" "glDetachShader\0" "\0" - /* _mesa_function_pool[20885]: VertexAttrib4NubARB (will be remapped) */ + /* _mesa_function_pool[21618]: VertexAttrib4NubARB (will be remapped) */ "iiiii\0" "glVertexAttrib4Nub\0" "glVertexAttrib4NubARB\0" "\0" - /* _mesa_function_pool[20933]: GetProgramEnvParameterfvARB (will be remapped) */ + /* _mesa_function_pool[21666]: GetProgramEnvParameterfvARB (will be remapped) */ "iip\0" "glGetProgramEnvParameterfvARB\0" "\0" - /* _mesa_function_pool[20968]: GetTrackMatrixivNV (will be remapped) */ + /* _mesa_function_pool[21701]: GetTrackMatrixivNV (will be remapped) */ "iiip\0" "glGetTrackMatrixivNV\0" "\0" - /* _mesa_function_pool[20995]: VertexAttrib3svNV (will be remapped) */ + /* _mesa_function_pool[21728]: VertexAttrib3svNV (will be remapped) */ "ip\0" "glVertexAttrib3svNV\0" "\0" - /* _mesa_function_pool[21019]: Uniform4fvARB (will be remapped) */ + /* _mesa_function_pool[21752]: Uniform4fvARB (will be remapped) */ "iip\0" "glUniform4fv\0" "glUniform4fvARB\0" "\0" - /* _mesa_function_pool[21053]: MultTransposeMatrixfARB (will be remapped) */ + /* _mesa_function_pool[21786]: MultTransposeMatrixfARB (will be remapped) */ "p\0" "glMultTransposeMatrixf\0" "glMultTransposeMatrixfARB\0" "\0" - /* _mesa_function_pool[21105]: GetTexEnviv (offset 277) */ + /* _mesa_function_pool[21838]: GetTexEnviv (offset 277) */ "iip\0" "glGetTexEnviv\0" "\0" - /* _mesa_function_pool[21124]: ColorFragmentOp1ATI (will be remapped) */ + /* _mesa_function_pool[21857]: ColorFragmentOp1ATI (will be remapped) */ "iiiiiii\0" "glColorFragmentOp1ATI\0" "\0" - /* _mesa_function_pool[21155]: GetUniformfvARB (will be remapped) */ + /* _mesa_function_pool[21888]: GetUniformfvARB (will be remapped) */ "iip\0" "glGetUniformfv\0" "glGetUniformfvARB\0" "\0" - /* _mesa_function_pool[21193]: EGLImageTargetRenderbufferStorageOES (will be remapped) */ + /* _mesa_function_pool[21926]: EGLImageTargetRenderbufferStorageOES (will be remapped) */ "ip\0" "glEGLImageTargetRenderbufferStorageOES\0" "\0" - /* _mesa_function_pool[21236]: PopClientAttrib (offset 334) */ + /* _mesa_function_pool[21969]: PopClientAttrib (offset 334) */ "\0" "glPopClientAttrib\0" "\0" - /* _mesa_function_pool[21256]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[21989]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ "iffffffffffff\0" "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[21327]: DetachObjectARB (will be remapped) */ + /* _mesa_function_pool[22060]: DetachObjectARB (will be remapped) */ "ii\0" "glDetachObjectARB\0" "\0" - /* _mesa_function_pool[21349]: VertexBlendARB (dynamic) */ + /* _mesa_function_pool[22082]: VertexBlendARB (dynamic) */ "i\0" "glVertexBlendARB\0" "\0" - /* _mesa_function_pool[21369]: WindowPos3iMESA (will be remapped) */ + /* _mesa_function_pool[22102]: WindowPos3iMESA (will be remapped) */ "iii\0" "glWindowPos3i\0" "glWindowPos3iARB\0" "glWindowPos3iMESA\0" "\0" - /* _mesa_function_pool[21423]: SeparableFilter2D (offset 360) */ + /* _mesa_function_pool[22156]: SeparableFilter2D (offset 360) */ "iiiiiipp\0" "glSeparableFilter2D\0" "glSeparableFilter2DEXT\0" "\0" - /* _mesa_function_pool[21476]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */ - "ppp\0" - "glReplacementCodeuiColor4ubVertex3fvSUN\0" + /* _mesa_function_pool[22209]: ProgramParameteriARB (will be remapped) */ + "iii\0" + "glProgramParameteriARB\0" "\0" - /* _mesa_function_pool[21521]: Map1d (offset 220) */ + /* _mesa_function_pool[22237]: Map1d (offset 220) */ "iddiip\0" "glMap1d\0" "\0" - /* _mesa_function_pool[21537]: Map1f (offset 221) */ + /* _mesa_function_pool[22253]: Map1f (offset 221) */ "iffiip\0" "glMap1f\0" "\0" - /* _mesa_function_pool[21553]: CompressedTexImage2DARB (will be remapped) */ + /* _mesa_function_pool[22269]: CompressedTexImage2DARB (will be remapped) */ "iiiiiiip\0" "glCompressedTexImage2D\0" "glCompressedTexImage2DARB\0" "\0" - /* _mesa_function_pool[21612]: ArrayElement (offset 306) */ + /* _mesa_function_pool[22328]: ArrayElement (offset 306) */ "i\0" "glArrayElement\0" "glArrayElementEXT\0" "\0" - /* _mesa_function_pool[21648]: TexImage2D (offset 183) */ + /* _mesa_function_pool[22364]: TexImage2D (offset 183) */ "iiiiiiiip\0" "glTexImage2D\0" "\0" - /* _mesa_function_pool[21672]: DepthBoundsEXT (will be remapped) */ + /* _mesa_function_pool[22388]: DepthBoundsEXT (will be remapped) */ "dd\0" "glDepthBoundsEXT\0" "\0" - /* _mesa_function_pool[21693]: ProgramParameters4fvNV (will be remapped) */ + /* _mesa_function_pool[22409]: ProgramParameters4fvNV (will be remapped) */ "iiip\0" "glProgramParameters4fvNV\0" "\0" - /* _mesa_function_pool[21724]: DeformationMap3fSGIX (dynamic) */ + /* _mesa_function_pool[22440]: DeformationMap3fSGIX (dynamic) */ "iffiiffiiffiip\0" "glDeformationMap3fSGIX\0" "\0" - /* _mesa_function_pool[21763]: GetProgramivNV (will be remapped) */ + /* _mesa_function_pool[22479]: GetProgramivNV (will be remapped) */ "iip\0" "glGetProgramivNV\0" "\0" - /* _mesa_function_pool[21785]: GetMinmaxParameteriv (offset 366) */ + /* _mesa_function_pool[22501]: GetMinmaxParameteriv (offset 366) */ "iip\0" "glGetMinmaxParameteriv\0" "glGetMinmaxParameterivEXT\0" "\0" - /* _mesa_function_pool[21839]: PixelTransferf (offset 247) */ + /* _mesa_function_pool[22555]: PixelTransferf (offset 247) */ "if\0" "glPixelTransferf\0" "\0" - /* _mesa_function_pool[21860]: CopyTexImage1D (offset 323) */ + /* _mesa_function_pool[22576]: CopyTexImage1D (offset 323) */ "iiiiiii\0" "glCopyTexImage1D\0" "glCopyTexImage1DEXT\0" "\0" - /* _mesa_function_pool[21906]: PushMatrix (offset 298) */ + /* _mesa_function_pool[22622]: PushMatrix (offset 298) */ "\0" "glPushMatrix\0" "\0" - /* _mesa_function_pool[21921]: Fogiv (offset 156) */ + /* _mesa_function_pool[22637]: Fogiv (offset 156) */ "ip\0" "glFogiv\0" "\0" - /* _mesa_function_pool[21933]: TexCoord1dv (offset 95) */ + /* _mesa_function_pool[22649]: TexCoord1dv (offset 95) */ "p\0" "glTexCoord1dv\0" "\0" - /* _mesa_function_pool[21950]: AlphaFragmentOp3ATI (will be remapped) */ + /* _mesa_function_pool[22666]: AlphaFragmentOp3ATI (will be remapped) */ "iiiiiiiiiiii\0" "glAlphaFragmentOp3ATI\0" "\0" - /* _mesa_function_pool[21986]: PixelTransferi (offset 248) */ + /* _mesa_function_pool[22702]: PixelTransferi (offset 248) */ "ii\0" "glPixelTransferi\0" "\0" - /* _mesa_function_pool[22007]: GetVertexAttribdvNV (will be remapped) */ + /* _mesa_function_pool[22723]: GetVertexAttribdvNV (will be remapped) */ "iip\0" "glGetVertexAttribdvNV\0" "\0" - /* _mesa_function_pool[22034]: VertexAttrib3fvNV (will be remapped) */ + /* _mesa_function_pool[22750]: VertexAttrib3fvNV (will be remapped) */ "ip\0" "glVertexAttrib3fvNV\0" "\0" - /* _mesa_function_pool[22058]: Rotatef (offset 300) */ + /* _mesa_function_pool[22774]: Rotatef (offset 300) */ "ffff\0" "glRotatef\0" "\0" - /* _mesa_function_pool[22074]: GetFinalCombinerInputParameterivNV (will be remapped) */ + /* _mesa_function_pool[22790]: GetFinalCombinerInputParameterivNV (will be remapped) */ "iip\0" "glGetFinalCombinerInputParameterivNV\0" "\0" - /* _mesa_function_pool[22116]: Vertex3i (offset 138) */ + /* _mesa_function_pool[22832]: Vertex3i (offset 138) */ "iii\0" "glVertex3i\0" "\0" - /* _mesa_function_pool[22132]: Vertex3f (offset 136) */ + /* _mesa_function_pool[22848]: Vertex3f (offset 136) */ "fff\0" "glVertex3f\0" "\0" - /* _mesa_function_pool[22148]: Clear (offset 203) */ + /* _mesa_function_pool[22864]: Clear (offset 203) */ "i\0" "glClear\0" "\0" - /* _mesa_function_pool[22159]: Vertex3d (offset 134) */ + /* _mesa_function_pool[22875]: Vertex3d (offset 134) */ "ddd\0" "glVertex3d\0" "\0" - /* _mesa_function_pool[22175]: GetMapParameterivNV (dynamic) */ + /* _mesa_function_pool[22891]: GetMapParameterivNV (dynamic) */ "iip\0" "glGetMapParameterivNV\0" "\0" - /* _mesa_function_pool[22202]: Uniform4iARB (will be remapped) */ + /* _mesa_function_pool[22918]: Uniform4iARB (will be remapped) */ "iiiii\0" "glUniform4i\0" "glUniform4iARB\0" "\0" - /* _mesa_function_pool[22236]: ReadBuffer (offset 254) */ + /* _mesa_function_pool[22952]: ReadBuffer (offset 254) */ "i\0" "glReadBuffer\0" "\0" - /* _mesa_function_pool[22252]: ConvolutionParameteri (offset 352) */ + /* _mesa_function_pool[22968]: ConvolutionParameteri (offset 352) */ "iii\0" "glConvolutionParameteri\0" "glConvolutionParameteriEXT\0" "\0" - /* _mesa_function_pool[22308]: Ortho (offset 296) */ + /* _mesa_function_pool[23024]: Ortho (offset 296) */ "dddddd\0" "glOrtho\0" "\0" - /* _mesa_function_pool[22324]: Binormal3sEXT (dynamic) */ + /* _mesa_function_pool[23040]: Binormal3sEXT (dynamic) */ "iii\0" "glBinormal3sEXT\0" "\0" - /* _mesa_function_pool[22345]: ListBase (offset 6) */ + /* _mesa_function_pool[23061]: ListBase (offset 6) */ "i\0" "glListBase\0" "\0" - /* _mesa_function_pool[22359]: Vertex3s (offset 140) */ + /* _mesa_function_pool[23075]: Vertex3s (offset 140) */ "iii\0" "glVertex3s\0" "\0" - /* _mesa_function_pool[22375]: ConvolutionParameterf (offset 350) */ + /* _mesa_function_pool[23091]: ConvolutionParameterf (offset 350) */ "iif\0" "glConvolutionParameterf\0" "glConvolutionParameterfEXT\0" "\0" - /* _mesa_function_pool[22431]: GetColorTableParameteriv (offset 345) */ + /* _mesa_function_pool[23147]: GetColorTableParameteriv (offset 345) */ "iip\0" "glGetColorTableParameteriv\0" "glGetColorTableParameterivSGI\0" "glGetColorTableParameterivEXT\0" "\0" - /* _mesa_function_pool[22523]: ProgramEnvParameter4dvARB (will be remapped) */ + /* _mesa_function_pool[23239]: ProgramEnvParameter4dvARB (will be remapped) */ "iip\0" "glProgramEnvParameter4dvARB\0" "glProgramParameter4dvNV\0" "\0" - /* _mesa_function_pool[22580]: ShadeModel (offset 177) */ + /* _mesa_function_pool[23296]: ShadeModel (offset 177) */ "i\0" "glShadeModel\0" "\0" - /* _mesa_function_pool[22596]: VertexAttribs2fvNV (will be remapped) */ + /* _mesa_function_pool[23312]: VertexAttribs2fvNV (will be remapped) */ "iip\0" "glVertexAttribs2fvNV\0" "\0" - /* _mesa_function_pool[22622]: Rectiv (offset 91) */ + /* _mesa_function_pool[23338]: Rectiv (offset 91) */ "pp\0" "glRectiv\0" "\0" - /* _mesa_function_pool[22635]: UseProgramObjectARB (will be remapped) */ + /* _mesa_function_pool[23351]: UseProgramObjectARB (will be remapped) */ "i\0" "glUseProgram\0" "glUseProgramObjectARB\0" "\0" - /* _mesa_function_pool[22673]: GetMapParameterfvNV (dynamic) */ + /* _mesa_function_pool[23389]: GetMapParameterfvNV (dynamic) */ "iip\0" "glGetMapParameterfvNV\0" "\0" - /* _mesa_function_pool[22700]: EndConditionalRenderNV (will be remapped) */ + /* _mesa_function_pool[23416]: EndConditionalRenderNV (will be remapped) */ "\0" "glEndConditionalRenderNV\0" "\0" - /* _mesa_function_pool[22727]: PassTexCoordATI (will be remapped) */ + /* _mesa_function_pool[23443]: PassTexCoordATI (will be remapped) */ "iii\0" "glPassTexCoordATI\0" "\0" - /* _mesa_function_pool[22750]: DeleteProgram (will be remapped) */ + /* _mesa_function_pool[23466]: DeleteProgram (will be remapped) */ "i\0" "glDeleteProgram\0" "\0" - /* _mesa_function_pool[22769]: Tangent3ivEXT (dynamic) */ + /* _mesa_function_pool[23485]: Tangent3ivEXT (dynamic) */ "p\0" "glTangent3ivEXT\0" "\0" - /* _mesa_function_pool[22788]: Tangent3dEXT (dynamic) */ + /* _mesa_function_pool[23504]: Tangent3dEXT (dynamic) */ "ddd\0" "glTangent3dEXT\0" "\0" - /* _mesa_function_pool[22808]: SecondaryColor3dvEXT (will be remapped) */ + /* _mesa_function_pool[23524]: SecondaryColor3dvEXT (will be remapped) */ "p\0" "glSecondaryColor3dv\0" "glSecondaryColor3dvEXT\0" "\0" - /* _mesa_function_pool[22854]: Vertex2fv (offset 129) */ + /* _mesa_function_pool[23570]: Vertex2fv (offset 129) */ "p\0" "glVertex2fv\0" "\0" - /* _mesa_function_pool[22869]: MultiDrawArraysEXT (will be remapped) */ + /* _mesa_function_pool[23585]: MultiDrawArraysEXT (will be remapped) */ "ippi\0" "glMultiDrawArrays\0" "glMultiDrawArraysEXT\0" "\0" - /* _mesa_function_pool[22914]: BindRenderbufferEXT (will be remapped) */ + /* _mesa_function_pool[23630]: BindRenderbufferEXT (will be remapped) */ "ii\0" "glBindRenderbuffer\0" "glBindRenderbufferEXT\0" "\0" - /* _mesa_function_pool[22959]: MultiTexCoord4dARB (offset 400) */ + /* _mesa_function_pool[23675]: MultiTexCoord4dARB (offset 400) */ "idddd\0" "glMultiTexCoord4d\0" "glMultiTexCoord4dARB\0" "\0" - /* _mesa_function_pool[23005]: Vertex3sv (offset 141) */ + /* _mesa_function_pool[23721]: FramebufferTextureFaceARB (will be remapped) */ + "iiiii\0" + "glFramebufferTextureFaceARB\0" + "\0" + /* _mesa_function_pool[23756]: Vertex3sv (offset 141) */ "p\0" "glVertex3sv\0" "\0" - /* _mesa_function_pool[23020]: SecondaryColor3usEXT (will be remapped) */ + /* _mesa_function_pool[23771]: SecondaryColor3usEXT (will be remapped) */ "iii\0" "glSecondaryColor3us\0" "glSecondaryColor3usEXT\0" "\0" - /* _mesa_function_pool[23068]: ProgramLocalParameter4fvARB (will be remapped) */ + /* _mesa_function_pool[23819]: ProgramLocalParameter4fvARB (will be remapped) */ "iip\0" "glProgramLocalParameter4fvARB\0" "\0" - /* _mesa_function_pool[23103]: DeleteProgramsNV (will be remapped) */ + /* _mesa_function_pool[23854]: DeleteProgramsNV (will be remapped) */ "ip\0" "glDeleteProgramsARB\0" "glDeleteProgramsNV\0" "\0" - /* _mesa_function_pool[23146]: EvalMesh1 (offset 236) */ + /* _mesa_function_pool[23897]: EvalMesh1 (offset 236) */ "iii\0" "glEvalMesh1\0" "\0" - /* _mesa_function_pool[23163]: MultiTexCoord1sARB (offset 382) */ + /* _mesa_function_pool[23914]: PauseTransformFeedback (will be remapped) */ + "\0" + "glPauseTransformFeedback\0" + "\0" + /* _mesa_function_pool[23941]: MultiTexCoord1sARB (offset 382) */ "ii\0" "glMultiTexCoord1s\0" "glMultiTexCoord1sARB\0" "\0" - /* _mesa_function_pool[23206]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[23984]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */ "iffffff\0" "glReplacementCodeuiColor3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[23253]: GetVertexAttribPointervNV (will be remapped) */ + /* _mesa_function_pool[24031]: GetVertexAttribPointervNV (will be remapped) */ "iip\0" "glGetVertexAttribPointerv\0" "glGetVertexAttribPointervARB\0" "glGetVertexAttribPointervNV\0" "\0" - /* _mesa_function_pool[23341]: DisableIndexedEXT (will be remapped) */ - "ii\0" - "glDisableIndexedEXT\0" + /* _mesa_function_pool[24119]: VertexAttribs1fvNV (will be remapped) */ + "iip\0" + "glVertexAttribs1fvNV\0" "\0" - /* _mesa_function_pool[23365]: MultiTexCoord1dvARB (offset 377) */ + /* _mesa_function_pool[24145]: MultiTexCoord1dvARB (offset 377) */ "ip\0" "glMultiTexCoord1dv\0" "glMultiTexCoord1dvARB\0" "\0" - /* _mesa_function_pool[23410]: Uniform2iARB (will be remapped) */ + /* _mesa_function_pool[24190]: Uniform2iARB (will be remapped) */ "iii\0" "glUniform2i\0" "glUniform2iARB\0" "\0" - /* _mesa_function_pool[23442]: Vertex2iv (offset 131) */ + /* _mesa_function_pool[24222]: Vertex2iv (offset 131) */ "p\0" "glVertex2iv\0" "\0" - /* _mesa_function_pool[23457]: GetProgramStringNV (will be remapped) */ + /* _mesa_function_pool[24237]: GetProgramStringNV (will be remapped) */ "iip\0" "glGetProgramStringNV\0" "\0" - /* _mesa_function_pool[23483]: ColorPointerEXT (will be remapped) */ + /* _mesa_function_pool[24263]: ColorPointerEXT (will be remapped) */ "iiiip\0" "glColorPointerEXT\0" "\0" - /* _mesa_function_pool[23508]: LineWidth (offset 168) */ + /* _mesa_function_pool[24288]: LineWidth (offset 168) */ "f\0" "glLineWidth\0" "\0" - /* _mesa_function_pool[23523]: MapBufferARB (will be remapped) */ + /* _mesa_function_pool[24303]: MapBufferARB (will be remapped) */ "ii\0" "glMapBuffer\0" "glMapBufferARB\0" "\0" - /* _mesa_function_pool[23554]: MultiDrawElementsBaseVertex (will be remapped) */ + /* _mesa_function_pool[24334]: MultiDrawElementsBaseVertex (will be remapped) */ "ipipip\0" "glMultiDrawElementsBaseVertex\0" "\0" - /* _mesa_function_pool[23592]: Binormal3svEXT (dynamic) */ + /* _mesa_function_pool[24372]: Binormal3svEXT (dynamic) */ "p\0" "glBinormal3svEXT\0" "\0" - /* _mesa_function_pool[23612]: ApplyTextureEXT (dynamic) */ + /* _mesa_function_pool[24392]: ApplyTextureEXT (dynamic) */ "i\0" "glApplyTextureEXT\0" "\0" - /* _mesa_function_pool[23633]: TexGendv (offset 189) */ + /* _mesa_function_pool[24413]: TexGendv (offset 189) */ "iip\0" "glTexGendv\0" "\0" - /* _mesa_function_pool[23649]: EnableIndexedEXT (will be remapped) */ + /* _mesa_function_pool[24429]: EnableIndexedEXT (will be remapped) */ "ii\0" "glEnableIndexedEXT\0" "\0" - /* _mesa_function_pool[23672]: TextureMaterialEXT (dynamic) */ + /* _mesa_function_pool[24452]: TextureMaterialEXT (dynamic) */ "ii\0" "glTextureMaterialEXT\0" "\0" - /* _mesa_function_pool[23697]: TextureLightEXT (dynamic) */ + /* _mesa_function_pool[24477]: TextureLightEXT (dynamic) */ "i\0" "glTextureLightEXT\0" "\0" - /* _mesa_function_pool[23718]: ResetMinmax (offset 370) */ + /* _mesa_function_pool[24498]: ResetMinmax (offset 370) */ "i\0" "glResetMinmax\0" "glResetMinmaxEXT\0" "\0" - /* _mesa_function_pool[23752]: SpriteParameterfSGIX (dynamic) */ + /* _mesa_function_pool[24532]: SpriteParameterfSGIX (dynamic) */ "if\0" "glSpriteParameterfSGIX\0" "\0" - /* _mesa_function_pool[23779]: EnableClientState (offset 313) */ + /* _mesa_function_pool[24559]: EnableClientState (offset 313) */ "i\0" "glEnableClientState\0" "\0" - /* _mesa_function_pool[23802]: VertexAttrib4sNV (will be remapped) */ + /* _mesa_function_pool[24582]: VertexAttrib4sNV (will be remapped) */ "iiiii\0" "glVertexAttrib4sNV\0" "\0" - /* _mesa_function_pool[23828]: GetConvolutionParameterfv (offset 357) */ + /* _mesa_function_pool[24608]: GetConvolutionParameterfv (offset 357) */ "iip\0" "glGetConvolutionParameterfv\0" "glGetConvolutionParameterfvEXT\0" "\0" - /* _mesa_function_pool[23892]: VertexAttribs4dvNV (will be remapped) */ + /* _mesa_function_pool[24672]: VertexAttribs4dvNV (will be remapped) */ "iip\0" "glVertexAttribs4dvNV\0" "\0" - /* _mesa_function_pool[23918]: VertexAttrib4dARB (will be remapped) */ + /* _mesa_function_pool[24698]: VertexAttrib4dARB (will be remapped) */ "idddd\0" "glVertexAttrib4d\0" "glVertexAttrib4dARB\0" "\0" - /* _mesa_function_pool[23962]: GetTexBumpParameterfvATI (will be remapped) */ + /* _mesa_function_pool[24742]: GetTexBumpParameterfvATI (will be remapped) */ "ip\0" "glGetTexBumpParameterfvATI\0" "\0" - /* _mesa_function_pool[23993]: ProgramNamedParameter4dNV (will be remapped) */ + /* _mesa_function_pool[24773]: ProgramNamedParameter4dNV (will be remapped) */ "iipdddd\0" "glProgramNamedParameter4dNV\0" "\0" - /* _mesa_function_pool[24030]: GetMaterialfv (offset 269) */ + /* _mesa_function_pool[24810]: GetMaterialfv (offset 269) */ "iip\0" "glGetMaterialfv\0" "\0" - /* _mesa_function_pool[24051]: VertexWeightfEXT (dynamic) */ + /* _mesa_function_pool[24831]: VertexWeightfEXT (dynamic) */ "f\0" "glVertexWeightfEXT\0" "\0" - /* _mesa_function_pool[24073]: Binormal3fEXT (dynamic) */ + /* _mesa_function_pool[24853]: Binormal3fEXT (dynamic) */ "fff\0" "glBinormal3fEXT\0" "\0" - /* _mesa_function_pool[24094]: CallList (offset 2) */ + /* _mesa_function_pool[24874]: CallList (offset 2) */ "i\0" "glCallList\0" "\0" - /* _mesa_function_pool[24108]: Materialfv (offset 170) */ + /* _mesa_function_pool[24888]: Materialfv (offset 170) */ "iip\0" "glMaterialfv\0" "\0" - /* _mesa_function_pool[24126]: TexCoord3fv (offset 113) */ + /* _mesa_function_pool[24906]: TexCoord3fv (offset 113) */ "p\0" "glTexCoord3fv\0" "\0" - /* _mesa_function_pool[24143]: FogCoordfvEXT (will be remapped) */ + /* _mesa_function_pool[24923]: FogCoordfvEXT (will be remapped) */ "p\0" "glFogCoordfv\0" "glFogCoordfvEXT\0" "\0" - /* _mesa_function_pool[24175]: MultiTexCoord1ivARB (offset 381) */ + /* _mesa_function_pool[24955]: MultiTexCoord1ivARB (offset 381) */ "ip\0" "glMultiTexCoord1iv\0" "glMultiTexCoord1ivARB\0" "\0" - /* _mesa_function_pool[24220]: SecondaryColor3ubEXT (will be remapped) */ + /* _mesa_function_pool[25000]: SecondaryColor3ubEXT (will be remapped) */ "iii\0" "glSecondaryColor3ub\0" "glSecondaryColor3ubEXT\0" "\0" - /* _mesa_function_pool[24268]: MultiTexCoord2ivARB (offset 389) */ + /* _mesa_function_pool[25048]: MultiTexCoord2ivARB (offset 389) */ "ip\0" "glMultiTexCoord2iv\0" "glMultiTexCoord2ivARB\0" "\0" - /* _mesa_function_pool[24313]: FogFuncSGIS (dynamic) */ + /* _mesa_function_pool[25093]: FogFuncSGIS (dynamic) */ "ip\0" "glFogFuncSGIS\0" "\0" - /* _mesa_function_pool[24331]: CopyTexSubImage2D (offset 326) */ + /* _mesa_function_pool[25111]: CopyTexSubImage2D (offset 326) */ "iiiiiiii\0" "glCopyTexSubImage2D\0" "glCopyTexSubImage2DEXT\0" "\0" - /* _mesa_function_pool[24384]: GetObjectParameterivARB (will be remapped) */ + /* _mesa_function_pool[25164]: GetObjectParameterivARB (will be remapped) */ "iip\0" "glGetObjectParameterivARB\0" "\0" - /* _mesa_function_pool[24415]: Color3iv (offset 16) */ + /* _mesa_function_pool[25195]: Color3iv (offset 16) */ "p\0" "glColor3iv\0" "\0" - /* _mesa_function_pool[24429]: TexCoord4fVertex4fSUN (dynamic) */ + /* _mesa_function_pool[25209]: TexCoord4fVertex4fSUN (dynamic) */ "ffffffff\0" "glTexCoord4fVertex4fSUN\0" "\0" - /* _mesa_function_pool[24463]: DrawElements (offset 311) */ + /* _mesa_function_pool[25243]: DrawElements (offset 311) */ "iiip\0" "glDrawElements\0" "\0" - /* _mesa_function_pool[24484]: BindVertexArrayAPPLE (will be remapped) */ + /* _mesa_function_pool[25264]: BindVertexArrayAPPLE (will be remapped) */ "i\0" "glBindVertexArrayAPPLE\0" "\0" - /* _mesa_function_pool[24510]: GetProgramLocalParameterdvARB (will be remapped) */ + /* _mesa_function_pool[25290]: GetProgramLocalParameterdvARB (will be remapped) */ "iip\0" "glGetProgramLocalParameterdvARB\0" "\0" - /* _mesa_function_pool[24547]: GetHistogramParameteriv (offset 363) */ + /* _mesa_function_pool[25327]: GetHistogramParameteriv (offset 363) */ "iip\0" "glGetHistogramParameteriv\0" "glGetHistogramParameterivEXT\0" "\0" - /* _mesa_function_pool[24607]: MultiTexCoord1iARB (offset 380) */ + /* _mesa_function_pool[25387]: MultiTexCoord1iARB (offset 380) */ "ii\0" "glMultiTexCoord1i\0" "glMultiTexCoord1iARB\0" "\0" - /* _mesa_function_pool[24650]: GetConvolutionFilter (offset 356) */ + /* _mesa_function_pool[25430]: GetConvolutionFilter (offset 356) */ "iiip\0" "glGetConvolutionFilter\0" "glGetConvolutionFilterEXT\0" "\0" - /* _mesa_function_pool[24705]: GetProgramivARB (will be remapped) */ + /* _mesa_function_pool[25485]: GetProgramivARB (will be remapped) */ "iip\0" "glGetProgramivARB\0" "\0" - /* _mesa_function_pool[24728]: BlendFuncSeparateEXT (will be remapped) */ + /* _mesa_function_pool[25508]: BlendFuncSeparateEXT (will be remapped) */ "iiii\0" "glBlendFuncSeparate\0" "glBlendFuncSeparateEXT\0" "glBlendFuncSeparateINGR\0" "\0" - /* _mesa_function_pool[24801]: MapBufferRange (will be remapped) */ + /* _mesa_function_pool[25581]: MapBufferRange (will be remapped) */ "iiii\0" "glMapBufferRange\0" "\0" - /* _mesa_function_pool[24824]: ProgramParameters4dvNV (will be remapped) */ + /* _mesa_function_pool[25604]: ProgramParameters4dvNV (will be remapped) */ "iiip\0" "glProgramParameters4dvNV\0" "\0" - /* _mesa_function_pool[24855]: TexCoord2fColor3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[25635]: TexCoord2fColor3fVertex3fvSUN (dynamic) */ "ppp\0" "glTexCoord2fColor3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[24892]: EvalPoint2 (offset 239) */ + /* _mesa_function_pool[25672]: EvalPoint2 (offset 239) */ "ii\0" "glEvalPoint2\0" "\0" - /* _mesa_function_pool[24909]: EvalPoint1 (offset 237) */ + /* _mesa_function_pool[25689]: EvalPoint1 (offset 237) */ "i\0" "glEvalPoint1\0" "\0" - /* _mesa_function_pool[24925]: Binormal3dvEXT (dynamic) */ + /* _mesa_function_pool[25705]: Binormal3dvEXT (dynamic) */ "p\0" "glBinormal3dvEXT\0" "\0" - /* _mesa_function_pool[24945]: PopMatrix (offset 297) */ + /* _mesa_function_pool[25725]: PopMatrix (offset 297) */ "\0" "glPopMatrix\0" "\0" - /* _mesa_function_pool[24959]: FinishFenceNV (will be remapped) */ + /* _mesa_function_pool[25739]: FinishFenceNV (will be remapped) */ "i\0" "glFinishFenceNV\0" "\0" - /* _mesa_function_pool[24978]: GetFogFuncSGIS (dynamic) */ + /* _mesa_function_pool[25758]: GetFogFuncSGIS (dynamic) */ "p\0" "glGetFogFuncSGIS\0" "\0" - /* _mesa_function_pool[24998]: GetUniformLocationARB (will be remapped) */ + /* _mesa_function_pool[25778]: GetUniformLocationARB (will be remapped) */ "ip\0" "glGetUniformLocation\0" "glGetUniformLocationARB\0" "\0" - /* _mesa_function_pool[25047]: SecondaryColor3fEXT (will be remapped) */ + /* _mesa_function_pool[25827]: SecondaryColor3fEXT (will be remapped) */ "fff\0" "glSecondaryColor3f\0" "glSecondaryColor3fEXT\0" "\0" - /* _mesa_function_pool[25093]: GetTexGeniv (offset 280) */ + /* _mesa_function_pool[25873]: GetTexGeniv (offset 280) */ "iip\0" "glGetTexGeniv\0" "\0" - /* _mesa_function_pool[25112]: CombinerInputNV (will be remapped) */ + /* _mesa_function_pool[25892]: CombinerInputNV (will be remapped) */ "iiiiii\0" "glCombinerInputNV\0" "\0" - /* _mesa_function_pool[25138]: VertexAttrib3sARB (will be remapped) */ + /* _mesa_function_pool[25918]: VertexAttrib3sARB (will be remapped) */ "iiii\0" "glVertexAttrib3s\0" "glVertexAttrib3sARB\0" "\0" - /* _mesa_function_pool[25181]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[25961]: IsTransformFeedback (will be remapped) */ + "i\0" + "glIsTransformFeedback\0" + "\0" + /* _mesa_function_pool[25986]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */ "ppp\0" "glReplacementCodeuiNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[25226]: Map2d (offset 222) */ + /* _mesa_function_pool[26031]: Map2d (offset 222) */ "iddiiddiip\0" "glMap2d\0" "\0" - /* _mesa_function_pool[25246]: Map2f (offset 223) */ + /* _mesa_function_pool[26051]: Map2f (offset 223) */ "iffiiffiip\0" "glMap2f\0" "\0" - /* _mesa_function_pool[25266]: ProgramStringARB (will be remapped) */ + /* _mesa_function_pool[26071]: ProgramStringARB (will be remapped) */ "iiip\0" "glProgramStringARB\0" "\0" - /* _mesa_function_pool[25291]: Vertex4s (offset 148) */ + /* _mesa_function_pool[26096]: Vertex4s (offset 148) */ "iiii\0" "glVertex4s\0" "\0" - /* _mesa_function_pool[25308]: TexCoord4fVertex4fvSUN (dynamic) */ + /* _mesa_function_pool[26113]: TexCoord4fVertex4fvSUN (dynamic) */ "pp\0" "glTexCoord4fVertex4fvSUN\0" "\0" - /* _mesa_function_pool[25337]: VertexAttrib3sNV (will be remapped) */ - "iiii\0" - "glVertexAttrib3sNV\0" + /* _mesa_function_pool[26142]: FragmentLightModelivSGIX (dynamic) */ + "ip\0" + "glFragmentLightModelivSGIX\0" "\0" - /* _mesa_function_pool[25362]: VertexAttrib1fNV (will be remapped) */ + /* _mesa_function_pool[26173]: VertexAttrib1fNV (will be remapped) */ "if\0" "glVertexAttrib1fNV\0" "\0" - /* _mesa_function_pool[25385]: Vertex4f (offset 144) */ + /* _mesa_function_pool[26196]: Vertex4f (offset 144) */ "ffff\0" "glVertex4f\0" "\0" - /* _mesa_function_pool[25402]: EvalCoord1d (offset 228) */ + /* _mesa_function_pool[26213]: EvalCoord1d (offset 228) */ "d\0" "glEvalCoord1d\0" "\0" - /* _mesa_function_pool[25419]: Vertex4d (offset 142) */ + /* _mesa_function_pool[26230]: Vertex4d (offset 142) */ "dddd\0" "glVertex4d\0" "\0" - /* _mesa_function_pool[25436]: RasterPos4dv (offset 79) */ + /* _mesa_function_pool[26247]: RasterPos4dv (offset 79) */ "p\0" "glRasterPos4dv\0" "\0" - /* _mesa_function_pool[25454]: FragmentLightfSGIX (dynamic) */ + /* _mesa_function_pool[26265]: FragmentLightfSGIX (dynamic) */ "iif\0" "glFragmentLightfSGIX\0" "\0" - /* _mesa_function_pool[25480]: GetCompressedTexImageARB (will be remapped) */ + /* _mesa_function_pool[26291]: GetCompressedTexImageARB (will be remapped) */ "iip\0" "glGetCompressedTexImage\0" "glGetCompressedTexImageARB\0" "\0" - /* _mesa_function_pool[25536]: GetTexGenfv (offset 279) */ + /* _mesa_function_pool[26347]: GetTexGenfv (offset 279) */ "iip\0" "glGetTexGenfv\0" "\0" - /* _mesa_function_pool[25555]: Vertex4i (offset 146) */ + /* _mesa_function_pool[26366]: Vertex4i (offset 146) */ "iiii\0" "glVertex4i\0" "\0" - /* _mesa_function_pool[25572]: VertexWeightPointerEXT (dynamic) */ + /* _mesa_function_pool[26383]: VertexWeightPointerEXT (dynamic) */ "iiip\0" "glVertexWeightPointerEXT\0" "\0" - /* _mesa_function_pool[25603]: GetHistogram (offset 361) */ + /* _mesa_function_pool[26414]: GetHistogram (offset 361) */ "iiiip\0" "glGetHistogram\0" "glGetHistogramEXT\0" "\0" - /* _mesa_function_pool[25643]: ActiveStencilFaceEXT (will be remapped) */ + /* _mesa_function_pool[26454]: ActiveStencilFaceEXT (will be remapped) */ "i\0" "glActiveStencilFaceEXT\0" "\0" - /* _mesa_function_pool[25669]: StencilFuncSeparateATI (will be remapped) */ + /* _mesa_function_pool[26480]: StencilFuncSeparateATI (will be remapped) */ "iiii\0" "glStencilFuncSeparateATI\0" "\0" - /* _mesa_function_pool[25700]: Materialf (offset 169) */ + /* _mesa_function_pool[26511]: Materialf (offset 169) */ "iif\0" "glMaterialf\0" "\0" - /* _mesa_function_pool[25717]: GetShaderSourceARB (will be remapped) */ + /* _mesa_function_pool[26528]: GetShaderSourceARB (will be remapped) */ "iipp\0" "glGetShaderSource\0" "glGetShaderSourceARB\0" "\0" - /* _mesa_function_pool[25762]: IglooInterfaceSGIX (dynamic) */ + /* _mesa_function_pool[26573]: IglooInterfaceSGIX (dynamic) */ "ip\0" "glIglooInterfaceSGIX\0" "\0" - /* _mesa_function_pool[25787]: Materiali (offset 171) */ + /* _mesa_function_pool[26598]: Materiali (offset 171) */ "iii\0" "glMateriali\0" "\0" - /* _mesa_function_pool[25804]: VertexAttrib4dNV (will be remapped) */ + /* _mesa_function_pool[26615]: VertexAttrib4dNV (will be remapped) */ "idddd\0" "glVertexAttrib4dNV\0" "\0" - /* _mesa_function_pool[25830]: MultiModeDrawElementsIBM (will be remapped) */ + /* _mesa_function_pool[26641]: MultiModeDrawElementsIBM (will be remapped) */ "ppipii\0" "glMultiModeDrawElementsIBM\0" "\0" - /* _mesa_function_pool[25865]: Indexsv (offset 51) */ + /* _mesa_function_pool[26676]: Indexsv (offset 51) */ "p\0" "glIndexsv\0" "\0" - /* _mesa_function_pool[25878]: MultiTexCoord4svARB (offset 407) */ + /* _mesa_function_pool[26689]: MultiTexCoord4svARB (offset 407) */ "ip\0" "glMultiTexCoord4sv\0" "glMultiTexCoord4svARB\0" "\0" - /* _mesa_function_pool[25923]: LightModelfv (offset 164) */ + /* _mesa_function_pool[26734]: LightModelfv (offset 164) */ "ip\0" "glLightModelfv\0" "\0" - /* _mesa_function_pool[25942]: TexCoord2dv (offset 103) */ + /* _mesa_function_pool[26753]: TexCoord2dv (offset 103) */ "p\0" "glTexCoord2dv\0" "\0" - /* _mesa_function_pool[25959]: GenQueriesARB (will be remapped) */ + /* _mesa_function_pool[26770]: GenQueriesARB (will be remapped) */ "ip\0" "glGenQueries\0" "glGenQueriesARB\0" "\0" - /* _mesa_function_pool[25992]: EvalCoord1dv (offset 229) */ + /* _mesa_function_pool[26803]: EvalCoord1dv (offset 229) */ "p\0" "glEvalCoord1dv\0" "\0" - /* _mesa_function_pool[26010]: ReplacementCodeuiVertex3fSUN (dynamic) */ + /* _mesa_function_pool[26821]: ReplacementCodeuiVertex3fSUN (dynamic) */ "ifff\0" "glReplacementCodeuiVertex3fSUN\0" "\0" - /* _mesa_function_pool[26047]: Translated (offset 303) */ + /* _mesa_function_pool[26858]: Translated (offset 303) */ "ddd\0" "glTranslated\0" "\0" - /* _mesa_function_pool[26065]: Translatef (offset 304) */ + /* _mesa_function_pool[26876]: Translatef (offset 304) */ "fff\0" "glTranslatef\0" "\0" - /* _mesa_function_pool[26083]: StencilMask (offset 209) */ + /* _mesa_function_pool[26894]: StencilMask (offset 209) */ "i\0" "glStencilMask\0" "\0" - /* _mesa_function_pool[26100]: Tangent3iEXT (dynamic) */ + /* _mesa_function_pool[26911]: Tangent3iEXT (dynamic) */ "iii\0" "glTangent3iEXT\0" "\0" - /* _mesa_function_pool[26120]: GetLightiv (offset 265) */ + /* _mesa_function_pool[26931]: GetLightiv (offset 265) */ "iip\0" "glGetLightiv\0" "\0" - /* _mesa_function_pool[26138]: DrawMeshArraysSUN (dynamic) */ + /* _mesa_function_pool[26949]: DrawMeshArraysSUN (dynamic) */ "iiii\0" "glDrawMeshArraysSUN\0" "\0" - /* _mesa_function_pool[26164]: IsList (offset 287) */ + /* _mesa_function_pool[26975]: IsList (offset 287) */ "i\0" "glIsList\0" "\0" - /* _mesa_function_pool[26176]: IsSync (will be remapped) */ + /* _mesa_function_pool[26987]: IsSync (will be remapped) */ "i\0" "glIsSync\0" "\0" - /* _mesa_function_pool[26188]: RenderMode (offset 196) */ + /* _mesa_function_pool[26999]: RenderMode (offset 196) */ "i\0" "glRenderMode\0" "\0" - /* _mesa_function_pool[26204]: GetMapControlPointsNV (dynamic) */ + /* _mesa_function_pool[27015]: GetMapControlPointsNV (dynamic) */ "iiiiiip\0" "glGetMapControlPointsNV\0" "\0" - /* _mesa_function_pool[26237]: DrawBuffersARB (will be remapped) */ + /* _mesa_function_pool[27048]: DrawBuffersARB (will be remapped) */ "ip\0" "glDrawBuffers\0" "glDrawBuffersARB\0" "glDrawBuffersATI\0" "\0" - /* _mesa_function_pool[26289]: ProgramLocalParameter4fARB (will be remapped) */ + /* _mesa_function_pool[27100]: ProgramLocalParameter4fARB (will be remapped) */ "iiffff\0" "glProgramLocalParameter4fARB\0" "\0" - /* _mesa_function_pool[26326]: SpriteParameterivSGIX (dynamic) */ + /* _mesa_function_pool[27137]: SpriteParameterivSGIX (dynamic) */ "ip\0" "glSpriteParameterivSGIX\0" "\0" - /* _mesa_function_pool[26354]: ProvokingVertexEXT (will be remapped) */ + /* _mesa_function_pool[27165]: ProvokingVertexEXT (will be remapped) */ "i\0" "glProvokingVertexEXT\0" "glProvokingVertex\0" "\0" - /* _mesa_function_pool[26396]: MultiTexCoord1fARB (offset 378) */ + /* _mesa_function_pool[27207]: MultiTexCoord1fARB (offset 378) */ "if\0" "glMultiTexCoord1f\0" "glMultiTexCoord1fARB\0" "\0" - /* _mesa_function_pool[26439]: LoadName (offset 198) */ + /* _mesa_function_pool[27250]: LoadName (offset 198) */ "i\0" "glLoadName\0" "\0" - /* _mesa_function_pool[26453]: VertexAttribs4ubvNV (will be remapped) */ + /* _mesa_function_pool[27264]: VertexAttribs4ubvNV (will be remapped) */ "iip\0" "glVertexAttribs4ubvNV\0" "\0" - /* _mesa_function_pool[26480]: WeightsvARB (dynamic) */ + /* _mesa_function_pool[27291]: WeightsvARB (dynamic) */ "ip\0" "glWeightsvARB\0" "\0" - /* _mesa_function_pool[26498]: Uniform1fvARB (will be remapped) */ + /* _mesa_function_pool[27309]: Uniform1fvARB (will be remapped) */ "iip\0" "glUniform1fv\0" "glUniform1fvARB\0" "\0" - /* _mesa_function_pool[26532]: CopyTexSubImage1D (offset 325) */ + /* _mesa_function_pool[27343]: CopyTexSubImage1D (offset 325) */ "iiiiii\0" "glCopyTexSubImage1D\0" "glCopyTexSubImage1DEXT\0" "\0" - /* _mesa_function_pool[26583]: CullFace (offset 152) */ + /* _mesa_function_pool[27394]: CullFace (offset 152) */ "i\0" "glCullFace\0" "\0" - /* _mesa_function_pool[26597]: BindTexture (offset 307) */ + /* _mesa_function_pool[27408]: BindTexture (offset 307) */ "ii\0" "glBindTexture\0" "glBindTextureEXT\0" "\0" - /* _mesa_function_pool[26632]: BeginFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[27443]: BeginFragmentShaderATI (will be remapped) */ "\0" "glBeginFragmentShaderATI\0" "\0" - /* _mesa_function_pool[26659]: MultiTexCoord4fARB (offset 402) */ + /* _mesa_function_pool[27470]: MultiTexCoord4fARB (offset 402) */ "iffff\0" "glMultiTexCoord4f\0" "glMultiTexCoord4fARB\0" "\0" - /* _mesa_function_pool[26705]: VertexAttribs3svNV (will be remapped) */ + /* _mesa_function_pool[27516]: VertexAttribs3svNV (will be remapped) */ "iip\0" "glVertexAttribs3svNV\0" "\0" - /* _mesa_function_pool[26731]: StencilFunc (offset 243) */ + /* _mesa_function_pool[27542]: StencilFunc (offset 243) */ "iii\0" "glStencilFunc\0" "\0" - /* _mesa_function_pool[26750]: CopyPixels (offset 255) */ + /* _mesa_function_pool[27561]: CopyPixels (offset 255) */ "iiiii\0" "glCopyPixels\0" "\0" - /* _mesa_function_pool[26770]: Rectsv (offset 93) */ + /* _mesa_function_pool[27581]: Rectsv (offset 93) */ "pp\0" "glRectsv\0" "\0" - /* _mesa_function_pool[26783]: ReplacementCodeuivSUN (dynamic) */ + /* _mesa_function_pool[27594]: ReplacementCodeuivSUN (dynamic) */ "p\0" "glReplacementCodeuivSUN\0" "\0" - /* _mesa_function_pool[26810]: EnableVertexAttribArrayARB (will be remapped) */ + /* _mesa_function_pool[27621]: EnableVertexAttribArrayARB (will be remapped) */ "i\0" "glEnableVertexAttribArray\0" "glEnableVertexAttribArrayARB\0" "\0" - /* _mesa_function_pool[26868]: NormalPointervINTEL (dynamic) */ + /* _mesa_function_pool[27679]: NormalPointervINTEL (dynamic) */ "ip\0" "glNormalPointervINTEL\0" "\0" - /* _mesa_function_pool[26894]: CopyConvolutionFilter2D (offset 355) */ + /* _mesa_function_pool[27705]: CopyConvolutionFilter2D (offset 355) */ "iiiiii\0" "glCopyConvolutionFilter2D\0" "glCopyConvolutionFilter2DEXT\0" "\0" - /* _mesa_function_pool[26957]: WindowPos3ivMESA (will be remapped) */ + /* _mesa_function_pool[27768]: WindowPos3ivMESA (will be remapped) */ "p\0" "glWindowPos3iv\0" "glWindowPos3ivARB\0" "glWindowPos3ivMESA\0" "\0" - /* _mesa_function_pool[27012]: CopyBufferSubData (will be remapped) */ + /* _mesa_function_pool[27823]: CopyBufferSubData (will be remapped) */ "iiiii\0" "glCopyBufferSubData\0" "\0" - /* _mesa_function_pool[27039]: NormalPointer (offset 318) */ + /* _mesa_function_pool[27850]: NormalPointer (offset 318) */ "iip\0" "glNormalPointer\0" "\0" - /* _mesa_function_pool[27060]: TexParameterfv (offset 179) */ + /* _mesa_function_pool[27871]: TexParameterfv (offset 179) */ "iip\0" "glTexParameterfv\0" "\0" - /* _mesa_function_pool[27082]: IsBufferARB (will be remapped) */ + /* _mesa_function_pool[27893]: IsBufferARB (will be remapped) */ "i\0" "glIsBuffer\0" "glIsBufferARB\0" "\0" - /* _mesa_function_pool[27110]: WindowPos4iMESA (will be remapped) */ + /* _mesa_function_pool[27921]: WindowPos4iMESA (will be remapped) */ "iiii\0" "glWindowPos4iMESA\0" "\0" - /* _mesa_function_pool[27134]: VertexAttrib4uivARB (will be remapped) */ + /* _mesa_function_pool[27945]: VertexAttrib4uivARB (will be remapped) */ "ip\0" "glVertexAttrib4uiv\0" "glVertexAttrib4uivARB\0" "\0" - /* _mesa_function_pool[27179]: Tangent3bvEXT (dynamic) */ + /* _mesa_function_pool[27990]: Tangent3bvEXT (dynamic) */ "p\0" "glTangent3bvEXT\0" "\0" - /* _mesa_function_pool[27198]: UniformMatrix3x4fv (will be remapped) */ + /* _mesa_function_pool[28009]: UniformMatrix3x4fv (will be remapped) */ "iiip\0" "glUniformMatrix3x4fv\0" "\0" - /* _mesa_function_pool[27225]: ClipPlane (offset 150) */ + /* _mesa_function_pool[28036]: ClipPlane (offset 150) */ "ip\0" "glClipPlane\0" "\0" - /* _mesa_function_pool[27241]: Recti (offset 90) */ + /* _mesa_function_pool[28052]: Recti (offset 90) */ "iiii\0" "glRecti\0" "\0" - /* _mesa_function_pool[27255]: DrawRangeElementsBaseVertex (will be remapped) */ + /* _mesa_function_pool[28066]: DrawRangeElementsBaseVertex (will be remapped) */ "iiiiipi\0" "glDrawRangeElementsBaseVertex\0" "\0" - /* _mesa_function_pool[27294]: TexCoordPointervINTEL (dynamic) */ + /* _mesa_function_pool[28105]: TexCoordPointervINTEL (dynamic) */ "iip\0" "glTexCoordPointervINTEL\0" "\0" - /* _mesa_function_pool[27323]: DeleteBuffersARB (will be remapped) */ + /* _mesa_function_pool[28134]: DeleteBuffersARB (will be remapped) */ "ip\0" "glDeleteBuffers\0" "glDeleteBuffersARB\0" "\0" - /* _mesa_function_pool[27362]: WindowPos4fvMESA (will be remapped) */ + /* _mesa_function_pool[28173]: PixelTransformParameterfvEXT (dynamic) */ + "iip\0" + "glPixelTransformParameterfvEXT\0" + "\0" + /* _mesa_function_pool[28209]: WindowPos4fvMESA (will be remapped) */ "p\0" "glWindowPos4fvMESA\0" "\0" - /* _mesa_function_pool[27384]: GetPixelMapuiv (offset 272) */ + /* _mesa_function_pool[28231]: GetPixelMapuiv (offset 272) */ "ip\0" "glGetPixelMapuiv\0" "\0" - /* _mesa_function_pool[27405]: Rectf (offset 88) */ + /* _mesa_function_pool[28252]: Rectf (offset 88) */ "ffff\0" "glRectf\0" "\0" - /* _mesa_function_pool[27419]: VertexAttrib1sNV (will be remapped) */ + /* _mesa_function_pool[28266]: VertexAttrib1sNV (will be remapped) */ "ii\0" "glVertexAttrib1sNV\0" "\0" - /* _mesa_function_pool[27442]: Indexfv (offset 47) */ + /* _mesa_function_pool[28289]: Indexfv (offset 47) */ "p\0" "glIndexfv\0" "\0" - /* _mesa_function_pool[27455]: SecondaryColor3svEXT (will be remapped) */ + /* _mesa_function_pool[28302]: SecondaryColor3svEXT (will be remapped) */ "p\0" "glSecondaryColor3sv\0" "glSecondaryColor3svEXT\0" "\0" - /* _mesa_function_pool[27501]: LoadTransposeMatrixfARB (will be remapped) */ + /* _mesa_function_pool[28348]: LoadTransposeMatrixfARB (will be remapped) */ "p\0" "glLoadTransposeMatrixf\0" "glLoadTransposeMatrixfARB\0" "\0" - /* _mesa_function_pool[27553]: GetPointerv (offset 329) */ + /* _mesa_function_pool[28400]: GetPointerv (offset 329) */ "ip\0" "glGetPointerv\0" "glGetPointervEXT\0" "\0" - /* _mesa_function_pool[27588]: Tangent3bEXT (dynamic) */ + /* _mesa_function_pool[28435]: Tangent3bEXT (dynamic) */ "iii\0" "glTangent3bEXT\0" "\0" - /* _mesa_function_pool[27608]: CombinerParameterfNV (will be remapped) */ + /* _mesa_function_pool[28455]: CombinerParameterfNV (will be remapped) */ "if\0" "glCombinerParameterfNV\0" "\0" - /* _mesa_function_pool[27635]: IndexMask (offset 212) */ + /* _mesa_function_pool[28482]: IndexMask (offset 212) */ "i\0" "glIndexMask\0" "\0" - /* _mesa_function_pool[27650]: BindProgramNV (will be remapped) */ + /* _mesa_function_pool[28497]: BindProgramNV (will be remapped) */ "ii\0" "glBindProgramARB\0" "glBindProgramNV\0" "\0" - /* _mesa_function_pool[27687]: VertexAttrib4svARB (will be remapped) */ + /* _mesa_function_pool[28534]: VertexAttrib4svARB (will be remapped) */ "ip\0" "glVertexAttrib4sv\0" "glVertexAttrib4svARB\0" "\0" - /* _mesa_function_pool[27730]: GetFloatv (offset 262) */ + /* _mesa_function_pool[28577]: GetFloatv (offset 262) */ "ip\0" "glGetFloatv\0" "\0" - /* _mesa_function_pool[27746]: CreateDebugObjectMESA (dynamic) */ + /* _mesa_function_pool[28593]: CreateDebugObjectMESA (dynamic) */ "\0" "glCreateDebugObjectMESA\0" "\0" - /* _mesa_function_pool[27772]: GetShaderiv (will be remapped) */ + /* _mesa_function_pool[28619]: GetShaderiv (will be remapped) */ "iip\0" "glGetShaderiv\0" "\0" - /* _mesa_function_pool[27791]: ClientWaitSync (will be remapped) */ + /* _mesa_function_pool[28638]: ClientWaitSync (will be remapped) */ "iii\0" "glClientWaitSync\0" "\0" - /* _mesa_function_pool[27813]: TexCoord4s (offset 124) */ + /* _mesa_function_pool[28660]: TexCoord4s (offset 124) */ "iiii\0" "glTexCoord4s\0" "\0" - /* _mesa_function_pool[27832]: TexCoord3sv (offset 117) */ + /* _mesa_function_pool[28679]: TexCoord3sv (offset 117) */ "p\0" "glTexCoord3sv\0" "\0" - /* _mesa_function_pool[27849]: BindFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[28696]: BindFragmentShaderATI (will be remapped) */ "i\0" "glBindFragmentShaderATI\0" "\0" - /* _mesa_function_pool[27876]: PopAttrib (offset 218) */ + /* _mesa_function_pool[28723]: PopAttrib (offset 218) */ "\0" "glPopAttrib\0" "\0" - /* _mesa_function_pool[27890]: Fogfv (offset 154) */ + /* _mesa_function_pool[28737]: Fogfv (offset 154) */ "ip\0" "glFogfv\0" "\0" - /* _mesa_function_pool[27902]: UnmapBufferARB (will be remapped) */ + /* _mesa_function_pool[28749]: UnmapBufferARB (will be remapped) */ "i\0" "glUnmapBuffer\0" "glUnmapBufferARB\0" "\0" - /* _mesa_function_pool[27936]: InitNames (offset 197) */ + /* _mesa_function_pool[28783]: InitNames (offset 197) */ "\0" "glInitNames\0" "\0" - /* _mesa_function_pool[27950]: Normal3sv (offset 61) */ + /* _mesa_function_pool[28797]: Normal3sv (offset 61) */ "p\0" "glNormal3sv\0" "\0" - /* _mesa_function_pool[27965]: Minmax (offset 368) */ + /* _mesa_function_pool[28812]: Minmax (offset 368) */ "iii\0" "glMinmax\0" "glMinmaxEXT\0" "\0" - /* _mesa_function_pool[27991]: TexCoord4d (offset 118) */ + /* _mesa_function_pool[28838]: TexCoord4d (offset 118) */ "dddd\0" "glTexCoord4d\0" "\0" - /* _mesa_function_pool[28010]: DeformationMap3dSGIX (dynamic) */ + /* _mesa_function_pool[28857]: DeformationMap3dSGIX (dynamic) */ "iddiiddiiddiip\0" "glDeformationMap3dSGIX\0" "\0" - /* _mesa_function_pool[28049]: TexCoord4f (offset 120) */ + /* _mesa_function_pool[28896]: TexCoord4f (offset 120) */ "ffff\0" "glTexCoord4f\0" "\0" - /* _mesa_function_pool[28068]: FogCoorddvEXT (will be remapped) */ + /* _mesa_function_pool[28915]: FogCoorddvEXT (will be remapped) */ "p\0" "glFogCoorddv\0" "glFogCoorddvEXT\0" "\0" - /* _mesa_function_pool[28100]: FinishTextureSUNX (dynamic) */ + /* _mesa_function_pool[28947]: FinishTextureSUNX (dynamic) */ "\0" "glFinishTextureSUNX\0" "\0" - /* _mesa_function_pool[28122]: GetFragmentLightfvSGIX (dynamic) */ + /* _mesa_function_pool[28969]: GetFragmentLightfvSGIX (dynamic) */ "iip\0" "glGetFragmentLightfvSGIX\0" "\0" - /* _mesa_function_pool[28152]: Binormal3fvEXT (dynamic) */ + /* _mesa_function_pool[28999]: Binormal3fvEXT (dynamic) */ "p\0" "glBinormal3fvEXT\0" "\0" - /* _mesa_function_pool[28172]: GetBooleanv (offset 258) */ + /* _mesa_function_pool[29019]: GetBooleanv (offset 258) */ "ip\0" "glGetBooleanv\0" "\0" - /* _mesa_function_pool[28190]: ColorFragmentOp3ATI (will be remapped) */ + /* _mesa_function_pool[29037]: ColorFragmentOp3ATI (will be remapped) */ "iiiiiiiiiiiii\0" "glColorFragmentOp3ATI\0" "\0" - /* _mesa_function_pool[28227]: Hint (offset 158) */ + /* _mesa_function_pool[29074]: Hint (offset 158) */ "ii\0" "glHint\0" "\0" - /* _mesa_function_pool[28238]: Color4dv (offset 28) */ + /* _mesa_function_pool[29085]: Color4dv (offset 28) */ "p\0" "glColor4dv\0" "\0" - /* _mesa_function_pool[28252]: VertexAttrib2svARB (will be remapped) */ + /* _mesa_function_pool[29099]: VertexAttrib2svARB (will be remapped) */ "ip\0" "glVertexAttrib2sv\0" "glVertexAttrib2svARB\0" "\0" - /* _mesa_function_pool[28295]: AreProgramsResidentNV (will be remapped) */ + /* _mesa_function_pool[29142]: AreProgramsResidentNV (will be remapped) */ "ipp\0" "glAreProgramsResidentNV\0" "\0" - /* _mesa_function_pool[28324]: WindowPos3svMESA (will be remapped) */ + /* _mesa_function_pool[29171]: WindowPos3svMESA (will be remapped) */ "p\0" "glWindowPos3sv\0" "glWindowPos3svARB\0" "glWindowPos3svMESA\0" "\0" - /* _mesa_function_pool[28379]: CopyColorSubTable (offset 347) */ + /* _mesa_function_pool[29226]: CopyColorSubTable (offset 347) */ "iiiii\0" "glCopyColorSubTable\0" "glCopyColorSubTableEXT\0" "\0" - /* _mesa_function_pool[28429]: WeightdvARB (dynamic) */ + /* _mesa_function_pool[29276]: WeightdvARB (dynamic) */ "ip\0" "glWeightdvARB\0" "\0" - /* _mesa_function_pool[28447]: DeleteRenderbuffersEXT (will be remapped) */ + /* _mesa_function_pool[29294]: DeleteRenderbuffersEXT (will be remapped) */ "ip\0" "glDeleteRenderbuffers\0" "glDeleteRenderbuffersEXT\0" "\0" - /* _mesa_function_pool[28498]: VertexAttrib4NubvARB (will be remapped) */ + /* _mesa_function_pool[29345]: VertexAttrib4NubvARB (will be remapped) */ "ip\0" "glVertexAttrib4Nubv\0" "glVertexAttrib4NubvARB\0" "\0" - /* _mesa_function_pool[28545]: VertexAttrib3dvNV (will be remapped) */ + /* _mesa_function_pool[29392]: VertexAttrib3dvNV (will be remapped) */ "ip\0" "glVertexAttrib3dvNV\0" "\0" - /* _mesa_function_pool[28569]: GetObjectParameterfvARB (will be remapped) */ + /* _mesa_function_pool[29416]: GetObjectParameterfvARB (will be remapped) */ "iip\0" "glGetObjectParameterfvARB\0" "\0" - /* _mesa_function_pool[28600]: Vertex4iv (offset 147) */ + /* _mesa_function_pool[29447]: Vertex4iv (offset 147) */ "p\0" "glVertex4iv\0" "\0" - /* _mesa_function_pool[28615]: GetProgramEnvParameterdvARB (will be remapped) */ + /* _mesa_function_pool[29462]: GetProgramEnvParameterdvARB (will be remapped) */ "iip\0" "glGetProgramEnvParameterdvARB\0" "\0" - /* _mesa_function_pool[28650]: TexCoord4dv (offset 119) */ + /* _mesa_function_pool[29497]: TexCoord4dv (offset 119) */ "p\0" "glTexCoord4dv\0" "\0" - /* _mesa_function_pool[28667]: LockArraysEXT (will be remapped) */ + /* _mesa_function_pool[29514]: LockArraysEXT (will be remapped) */ "ii\0" "glLockArraysEXT\0" "\0" - /* _mesa_function_pool[28687]: Begin (offset 7) */ + /* _mesa_function_pool[29534]: Begin (offset 7) */ "i\0" "glBegin\0" "\0" - /* _mesa_function_pool[28698]: LightModeli (offset 165) */ + /* _mesa_function_pool[29545]: LightModeli (offset 165) */ "ii\0" "glLightModeli\0" "\0" - /* _mesa_function_pool[28716]: Rectfv (offset 89) */ + /* _mesa_function_pool[29563]: Rectfv (offset 89) */ "pp\0" "glRectfv\0" "\0" - /* _mesa_function_pool[28729]: LightModelf (offset 163) */ + /* _mesa_function_pool[29576]: LightModelf (offset 163) */ "if\0" "glLightModelf\0" "\0" - /* _mesa_function_pool[28747]: GetTexParameterfv (offset 282) */ + /* _mesa_function_pool[29594]: GetTexParameterfv (offset 282) */ "iip\0" "glGetTexParameterfv\0" "\0" - /* _mesa_function_pool[28772]: GetLightfv (offset 264) */ + /* _mesa_function_pool[29619]: GetLightfv (offset 264) */ "iip\0" "glGetLightfv\0" "\0" - /* _mesa_function_pool[28790]: PixelTransformParameterivEXT (dynamic) */ + /* _mesa_function_pool[29637]: PixelTransformParameterivEXT (dynamic) */ "iip\0" "glPixelTransformParameterivEXT\0" "\0" - /* _mesa_function_pool[28826]: BinormalPointerEXT (dynamic) */ + /* _mesa_function_pool[29673]: BinormalPointerEXT (dynamic) */ "iip\0" "glBinormalPointerEXT\0" "\0" - /* _mesa_function_pool[28852]: VertexAttrib1dNV (will be remapped) */ + /* _mesa_function_pool[29699]: VertexAttrib1dNV (will be remapped) */ "id\0" "glVertexAttrib1dNV\0" "\0" - /* _mesa_function_pool[28875]: GetCombinerInputParameterivNV (will be remapped) */ + /* _mesa_function_pool[29722]: GetCombinerInputParameterivNV (will be remapped) */ "iiiip\0" "glGetCombinerInputParameterivNV\0" "\0" - /* _mesa_function_pool[28914]: Disable (offset 214) */ + /* _mesa_function_pool[29761]: Disable (offset 214) */ "i\0" "glDisable\0" "\0" - /* _mesa_function_pool[28927]: MultiTexCoord2fvARB (offset 387) */ + /* _mesa_function_pool[29774]: MultiTexCoord2fvARB (offset 387) */ "ip\0" "glMultiTexCoord2fv\0" "glMultiTexCoord2fvARB\0" "\0" - /* _mesa_function_pool[28972]: GetRenderbufferParameterivEXT (will be remapped) */ + /* _mesa_function_pool[29819]: GetRenderbufferParameterivEXT (will be remapped) */ "iip\0" "glGetRenderbufferParameteriv\0" "glGetRenderbufferParameterivEXT\0" "\0" - /* _mesa_function_pool[29038]: CombinerParameterivNV (will be remapped) */ + /* _mesa_function_pool[29885]: CombinerParameterivNV (will be remapped) */ "ip\0" "glCombinerParameterivNV\0" "\0" - /* _mesa_function_pool[29066]: GenFragmentShadersATI (will be remapped) */ + /* _mesa_function_pool[29913]: GenFragmentShadersATI (will be remapped) */ "i\0" "glGenFragmentShadersATI\0" "\0" - /* _mesa_function_pool[29093]: DrawArrays (offset 310) */ + /* _mesa_function_pool[29940]: DrawArrays (offset 310) */ "iii\0" "glDrawArrays\0" "glDrawArraysEXT\0" "\0" - /* _mesa_function_pool[29127]: WeightuivARB (dynamic) */ + /* _mesa_function_pool[29974]: WeightuivARB (dynamic) */ "ip\0" "glWeightuivARB\0" "\0" - /* _mesa_function_pool[29146]: VertexAttrib2sARB (will be remapped) */ + /* _mesa_function_pool[29993]: VertexAttrib2sARB (will be remapped) */ "iii\0" "glVertexAttrib2s\0" "glVertexAttrib2sARB\0" "\0" - /* _mesa_function_pool[29188]: ColorMask (offset 210) */ + /* _mesa_function_pool[30035]: ColorMask (offset 210) */ "iiii\0" "glColorMask\0" "\0" - /* _mesa_function_pool[29206]: GenAsyncMarkersSGIX (dynamic) */ + /* _mesa_function_pool[30053]: GenAsyncMarkersSGIX (dynamic) */ "i\0" "glGenAsyncMarkersSGIX\0" "\0" - /* _mesa_function_pool[29231]: Tangent3svEXT (dynamic) */ + /* _mesa_function_pool[30078]: Tangent3svEXT (dynamic) */ "p\0" "glTangent3svEXT\0" "\0" - /* _mesa_function_pool[29250]: GetListParameterivSGIX (dynamic) */ + /* _mesa_function_pool[30097]: GetListParameterivSGIX (dynamic) */ "iip\0" "glGetListParameterivSGIX\0" "\0" - /* _mesa_function_pool[29280]: BindBufferARB (will be remapped) */ + /* _mesa_function_pool[30127]: BindBufferARB (will be remapped) */ "ii\0" "glBindBuffer\0" "glBindBufferARB\0" "\0" - /* _mesa_function_pool[29313]: GetInfoLogARB (will be remapped) */ + /* _mesa_function_pool[30160]: GetInfoLogARB (will be remapped) */ "iipp\0" "glGetInfoLogARB\0" "\0" - /* _mesa_function_pool[29335]: RasterPos4iv (offset 83) */ + /* _mesa_function_pool[30182]: RasterPos4iv (offset 83) */ "p\0" "glRasterPos4iv\0" "\0" - /* _mesa_function_pool[29353]: Enable (offset 215) */ + /* _mesa_function_pool[30200]: Enable (offset 215) */ "i\0" "glEnable\0" "\0" - /* _mesa_function_pool[29365]: LineStipple (offset 167) */ + /* _mesa_function_pool[30212]: LineStipple (offset 167) */ "ii\0" "glLineStipple\0" "\0" - /* _mesa_function_pool[29383]: VertexAttribs4svNV (will be remapped) */ + /* _mesa_function_pool[30230]: VertexAttribs4svNV (will be remapped) */ "iip\0" "glVertexAttribs4svNV\0" "\0" - /* _mesa_function_pool[29409]: EdgeFlagPointerListIBM (dynamic) */ + /* _mesa_function_pool[30256]: EdgeFlagPointerListIBM (dynamic) */ "ipi\0" "glEdgeFlagPointerListIBM\0" "\0" - /* _mesa_function_pool[29439]: UniformMatrix3x2fv (will be remapped) */ + /* _mesa_function_pool[30286]: UniformMatrix3x2fv (will be remapped) */ "iiip\0" "glUniformMatrix3x2fv\0" "\0" - /* _mesa_function_pool[29466]: GetMinmaxParameterfv (offset 365) */ + /* _mesa_function_pool[30313]: GetMinmaxParameterfv (offset 365) */ "iip\0" "glGetMinmaxParameterfv\0" "glGetMinmaxParameterfvEXT\0" "\0" - /* _mesa_function_pool[29520]: VertexAttrib1fvARB (will be remapped) */ + /* _mesa_function_pool[30367]: VertexAttrib1fvARB (will be remapped) */ "ip\0" "glVertexAttrib1fv\0" "glVertexAttrib1fvARB\0" "\0" - /* _mesa_function_pool[29563]: GenBuffersARB (will be remapped) */ + /* _mesa_function_pool[30410]: GenBuffersARB (will be remapped) */ "ip\0" "glGenBuffers\0" "glGenBuffersARB\0" "\0" - /* _mesa_function_pool[29596]: VertexAttribs1svNV (will be remapped) */ + /* _mesa_function_pool[30443]: VertexAttribs1svNV (will be remapped) */ "iip\0" "glVertexAttribs1svNV\0" "\0" - /* _mesa_function_pool[29622]: Vertex3fv (offset 137) */ + /* _mesa_function_pool[30469]: Vertex3fv (offset 137) */ "p\0" "glVertex3fv\0" "\0" - /* _mesa_function_pool[29637]: GetTexBumpParameterivATI (will be remapped) */ + /* _mesa_function_pool[30484]: GetTexBumpParameterivATI (will be remapped) */ "ip\0" "glGetTexBumpParameterivATI\0" "\0" - /* _mesa_function_pool[29668]: Binormal3bEXT (dynamic) */ + /* _mesa_function_pool[30515]: Binormal3bEXT (dynamic) */ "iii\0" "glBinormal3bEXT\0" "\0" - /* _mesa_function_pool[29689]: FragmentMaterialivSGIX (dynamic) */ + /* _mesa_function_pool[30536]: FragmentMaterialivSGIX (dynamic) */ "iip\0" "glFragmentMaterialivSGIX\0" "\0" - /* _mesa_function_pool[29719]: IsRenderbufferEXT (will be remapped) */ + /* _mesa_function_pool[30566]: IsRenderbufferEXT (will be remapped) */ "i\0" "glIsRenderbuffer\0" "glIsRenderbufferEXT\0" "\0" - /* _mesa_function_pool[29759]: GenProgramsNV (will be remapped) */ + /* _mesa_function_pool[30606]: GenProgramsNV (will be remapped) */ "ip\0" "glGenProgramsARB\0" "glGenProgramsNV\0" "\0" - /* _mesa_function_pool[29796]: VertexAttrib4dvNV (will be remapped) */ + /* _mesa_function_pool[30643]: VertexAttrib4dvNV (will be remapped) */ "ip\0" "glVertexAttrib4dvNV\0" "\0" - /* _mesa_function_pool[29820]: EndFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[30667]: EndFragmentShaderATI (will be remapped) */ "\0" "glEndFragmentShaderATI\0" "\0" - /* _mesa_function_pool[29845]: Binormal3iEXT (dynamic) */ + /* _mesa_function_pool[30692]: Binormal3iEXT (dynamic) */ "iii\0" "glBinormal3iEXT\0" "\0" - /* _mesa_function_pool[29866]: WindowPos2fMESA (will be remapped) */ + /* _mesa_function_pool[30713]: WindowPos2fMESA (will be remapped) */ "ff\0" "glWindowPos2f\0" "glWindowPos2fARB\0" @@ -4381,410 +4467,426 @@ static const char _mesa_function_pool[] = ; /* these functions need to be remapped */ -static const struct { - GLint pool_index; - GLint remap_index; -} MESA_remap_table_functions[] = { +static const struct gl_function_pool_remap MESA_remap_table_functions[] = { { 1461, AttachShader_remap_index }, - { 8794, CreateProgram_remap_index }, - { 20420, CreateShader_remap_index }, - { 22750, DeleteProgram_remap_index }, - { 16372, DeleteShader_remap_index }, - { 20866, DetachShader_remap_index }, - { 15896, GetAttachedShaders_remap_index }, + { 8995, CreateProgram_remap_index }, + { 21153, CreateShader_remap_index }, + { 23466, DeleteProgram_remap_index }, + { 16937, DeleteShader_remap_index }, + { 21599, DetachShader_remap_index }, + { 16461, GetAttachedShaders_remap_index }, { 4275, GetProgramInfoLog_remap_index }, { 361, GetProgramiv_remap_index }, - { 5608, GetShaderInfoLog_remap_index }, - { 27772, GetShaderiv_remap_index }, - { 11879, IsProgram_remap_index }, - { 10914, IsShader_remap_index }, - { 8898, StencilFuncSeparate_remap_index }, + { 5721, GetShaderInfoLog_remap_index }, + { 28619, GetShaderiv_remap_index }, + { 12198, IsProgram_remap_index }, + { 11197, IsShader_remap_index }, + { 9099, StencilFuncSeparate_remap_index }, { 3487, StencilMaskSeparate_remap_index }, - { 6684, StencilOpSeparate_remap_index }, - { 19771, UniformMatrix2x3fv_remap_index }, + { 6803, StencilOpSeparate_remap_index }, + { 20478, UniformMatrix2x3fv_remap_index }, { 2615, UniformMatrix2x4fv_remap_index }, - { 29439, UniformMatrix3x2fv_remap_index }, - { 27198, UniformMatrix3x4fv_remap_index }, - { 14444, UniformMatrix4x2fv_remap_index }, + { 30286, UniformMatrix3x2fv_remap_index }, + { 28009, UniformMatrix3x4fv_remap_index }, + { 14961, UniformMatrix4x2fv_remap_index }, { 2937, UniformMatrix4x3fv_remap_index }, - { 8812, LoadTransposeMatrixdARB_remap_index }, - { 27501, LoadTransposeMatrixfARB_remap_index }, - { 4848, MultTransposeMatrixdARB_remap_index }, - { 21053, MultTransposeMatrixfARB_remap_index }, + { 14622, DrawArraysInstanced_remap_index }, + { 15725, DrawElementsInstanced_remap_index }, + { 9013, LoadTransposeMatrixdARB_remap_index }, + { 28348, LoadTransposeMatrixfARB_remap_index }, + { 4904, MultTransposeMatrixdARB_remap_index }, + { 21786, MultTransposeMatrixfARB_remap_index }, { 172, SampleCoverageARB_remap_index }, - { 5032, CompressedTexImage1DARB_remap_index }, - { 21553, CompressedTexImage2DARB_remap_index }, + { 5117, CompressedTexImage1DARB_remap_index }, + { 22269, CompressedTexImage2DARB_remap_index }, { 3550, CompressedTexImage3DARB_remap_index }, - { 16188, CompressedTexSubImage1DARB_remap_index }, + { 16753, CompressedTexSubImage1DARB_remap_index }, { 1880, CompressedTexSubImage2DARB_remap_index }, - { 18008, CompressedTexSubImage3DARB_remap_index }, - { 25480, GetCompressedTexImageARB_remap_index }, + { 18614, CompressedTexSubImage3DARB_remap_index }, + { 26291, GetCompressedTexImageARB_remap_index }, { 3395, DisableVertexAttribArrayARB_remap_index }, - { 26810, EnableVertexAttribArrayARB_remap_index }, - { 28615, GetProgramEnvParameterdvARB_remap_index }, - { 20933, GetProgramEnvParameterfvARB_remap_index }, - { 24510, GetProgramLocalParameterdvARB_remap_index }, - { 7126, GetProgramLocalParameterfvARB_remap_index }, - { 16279, GetProgramStringARB_remap_index }, - { 24705, GetProgramivARB_remap_index }, - { 18203, GetVertexAttribdvARB_remap_index }, - { 14333, GetVertexAttribfvARB_remap_index }, - { 8707, GetVertexAttribivARB_remap_index }, - { 17084, ProgramEnvParameter4dARB_remap_index }, - { 22523, ProgramEnvParameter4dvARB_remap_index }, - { 14941, ProgramEnvParameter4fARB_remap_index }, - { 7989, ProgramEnvParameter4fvARB_remap_index }, + { 27621, EnableVertexAttribArrayARB_remap_index }, + { 29462, GetProgramEnvParameterdvARB_remap_index }, + { 21666, GetProgramEnvParameterfvARB_remap_index }, + { 25290, GetProgramLocalParameterdvARB_remap_index }, + { 7245, GetProgramLocalParameterfvARB_remap_index }, + { 16844, GetProgramStringARB_remap_index }, + { 25485, GetProgramivARB_remap_index }, + { 18809, GetVertexAttribdvARB_remap_index }, + { 14850, GetVertexAttribfvARB_remap_index }, + { 8908, GetVertexAttribivARB_remap_index }, + { 17690, ProgramEnvParameter4dARB_remap_index }, + { 23239, ProgramEnvParameter4dvARB_remap_index }, + { 15458, ProgramEnvParameter4fARB_remap_index }, + { 8108, ProgramEnvParameter4fvARB_remap_index }, { 3513, ProgramLocalParameter4dARB_remap_index }, - { 11589, ProgramLocalParameter4dvARB_remap_index }, - { 26289, ProgramLocalParameter4fARB_remap_index }, - { 23068, ProgramLocalParameter4fvARB_remap_index }, - { 25266, ProgramStringARB_remap_index }, - { 17334, VertexAttrib1dARB_remap_index }, - { 13987, VertexAttrib1dvARB_remap_index }, + { 11908, ProgramLocalParameter4dvARB_remap_index }, + { 27100, ProgramLocalParameter4fARB_remap_index }, + { 23819, ProgramLocalParameter4fvARB_remap_index }, + { 26071, ProgramStringARB_remap_index }, + { 17940, VertexAttrib1dARB_remap_index }, + { 14426, VertexAttrib1dvARB_remap_index }, { 3688, VertexAttrib1fARB_remap_index }, - { 29520, VertexAttrib1fvARB_remap_index }, - { 6210, VertexAttrib1sARB_remap_index }, + { 30367, VertexAttrib1fvARB_remap_index }, + { 6329, VertexAttrib1sARB_remap_index }, { 2054, VertexAttrib1svARB_remap_index }, - { 13418, VertexAttrib2dARB_remap_index }, - { 15515, VertexAttrib2dvARB_remap_index }, + { 13857, VertexAttrib2dARB_remap_index }, + { 16080, VertexAttrib2dvARB_remap_index }, { 1480, VertexAttrib2fARB_remap_index }, - { 15628, VertexAttrib2fvARB_remap_index }, - { 29146, VertexAttrib2sARB_remap_index }, - { 28252, VertexAttrib2svARB_remap_index }, - { 10045, VertexAttrib3dARB_remap_index }, - { 7692, VertexAttrib3dvARB_remap_index }, + { 16193, VertexAttrib2fvARB_remap_index }, + { 29993, VertexAttrib2sARB_remap_index }, + { 29099, VertexAttrib2svARB_remap_index }, + { 10282, VertexAttrib3dARB_remap_index }, + { 7811, VertexAttrib3dvARB_remap_index }, { 1567, VertexAttrib3fARB_remap_index }, - { 20008, VertexAttrib3fvARB_remap_index }, - { 25138, VertexAttrib3sARB_remap_index }, - { 17945, VertexAttrib3svARB_remap_index }, + { 20741, VertexAttrib3fvARB_remap_index }, + { 25918, VertexAttrib3sARB_remap_index }, + { 18551, VertexAttrib3svARB_remap_index }, { 4301, VertexAttrib4NbvARB_remap_index }, - { 15851, VertexAttrib4NivARB_remap_index }, - { 19963, VertexAttrib4NsvARB_remap_index }, - { 20885, VertexAttrib4NubARB_remap_index }, - { 28498, VertexAttrib4NubvARB_remap_index }, - { 16745, VertexAttrib4NuivARB_remap_index }, + { 16416, VertexAttrib4NivARB_remap_index }, + { 20696, VertexAttrib4NsvARB_remap_index }, + { 21618, VertexAttrib4NubARB_remap_index }, + { 29345, VertexAttrib4NubvARB_remap_index }, + { 17351, VertexAttrib4NuivARB_remap_index }, { 2810, VertexAttrib4NusvARB_remap_index }, - { 9639, VertexAttrib4bvARB_remap_index }, - { 23918, VertexAttrib4dARB_remap_index }, - { 18928, VertexAttrib4dvARB_remap_index }, - { 10152, VertexAttrib4fARB_remap_index }, - { 10556, VertexAttrib4fvARB_remap_index }, - { 9091, VertexAttrib4ivARB_remap_index }, - { 15329, VertexAttrib4sARB_remap_index }, - { 27687, VertexAttrib4svARB_remap_index }, - { 14746, VertexAttrib4ubvARB_remap_index }, - { 27134, VertexAttrib4uivARB_remap_index }, - { 17756, VertexAttrib4usvARB_remap_index }, - { 19645, VertexAttribPointerARB_remap_index }, - { 29280, BindBufferARB_remap_index }, - { 5923, BufferDataARB_remap_index }, + { 9876, VertexAttrib4bvARB_remap_index }, + { 24698, VertexAttrib4dARB_remap_index }, + { 19573, VertexAttrib4dvARB_remap_index }, + { 10389, VertexAttrib4fARB_remap_index }, + { 10793, VertexAttrib4fvARB_remap_index }, + { 9292, VertexAttrib4ivARB_remap_index }, + { 15894, VertexAttrib4sARB_remap_index }, + { 28534, VertexAttrib4svARB_remap_index }, + { 15263, VertexAttrib4ubvARB_remap_index }, + { 27945, VertexAttrib4uivARB_remap_index }, + { 18362, VertexAttrib4usvARB_remap_index }, + { 20327, VertexAttribPointerARB_remap_index }, + { 30127, BindBufferARB_remap_index }, + { 6036, BufferDataARB_remap_index }, { 1382, BufferSubDataARB_remap_index }, - { 27323, DeleteBuffersARB_remap_index }, - { 29563, GenBuffersARB_remap_index }, - { 15671, GetBufferParameterivARB_remap_index }, - { 14893, GetBufferPointervARB_remap_index }, + { 28134, DeleteBuffersARB_remap_index }, + { 30410, GenBuffersARB_remap_index }, + { 16236, GetBufferParameterivARB_remap_index }, + { 15410, GetBufferPointervARB_remap_index }, { 1335, GetBufferSubDataARB_remap_index }, - { 27082, IsBufferARB_remap_index }, - { 23523, MapBufferARB_remap_index }, - { 27902, UnmapBufferARB_remap_index }, + { 27893, IsBufferARB_remap_index }, + { 24303, MapBufferARB_remap_index }, + { 28749, UnmapBufferARB_remap_index }, { 268, BeginQueryARB_remap_index }, - { 17429, DeleteQueriesARB_remap_index }, - { 10850, EndQueryARB_remap_index }, - { 25959, GenQueriesARB_remap_index }, + { 18035, DeleteQueriesARB_remap_index }, + { 11087, EndQueryARB_remap_index }, + { 26770, GenQueriesARB_remap_index }, { 1772, GetQueryObjectivARB_remap_index }, - { 15373, GetQueryObjectuivARB_remap_index }, + { 15938, GetQueryObjectuivARB_remap_index }, { 1624, GetQueryivARB_remap_index }, - { 17663, IsQueryARB_remap_index }, - { 7302, AttachObjectARB_remap_index }, - { 16334, CompileShaderARB_remap_index }, + { 18269, IsQueryARB_remap_index }, + { 7421, AttachObjectARB_remap_index }, + { 16899, CompileShaderARB_remap_index }, { 2879, CreateProgramObjectARB_remap_index }, - { 5868, CreateShaderObjectARB_remap_index }, - { 12835, DeleteObjectARB_remap_index }, - { 21327, DetachObjectARB_remap_index }, - { 10628, GetActiveUniformARB_remap_index }, - { 8410, GetAttachedObjectsARB_remap_index }, - { 8689, GetHandleARB_remap_index }, - { 29313, GetInfoLogARB_remap_index }, - { 28569, GetObjectParameterfvARB_remap_index }, - { 24384, GetObjectParameterivARB_remap_index }, - { 25717, GetShaderSourceARB_remap_index }, - { 24998, GetUniformLocationARB_remap_index }, - { 21155, GetUniformfvARB_remap_index }, - { 11211, GetUniformivARB_remap_index }, - { 17801, LinkProgramARB_remap_index }, - { 17859, ShaderSourceARB_remap_index }, - { 6584, Uniform1fARB_remap_index }, - { 26498, Uniform1fvARB_remap_index }, - { 19614, Uniform1iARB_remap_index }, - { 18617, Uniform1ivARB_remap_index }, + { 5981, CreateShaderObjectARB_remap_index }, + { 13274, DeleteObjectARB_remap_index }, + { 22060, DetachObjectARB_remap_index }, + { 10865, GetActiveUniformARB_remap_index }, + { 8583, GetAttachedObjectsARB_remap_index }, + { 8890, GetHandleARB_remap_index }, + { 30160, GetInfoLogARB_remap_index }, + { 29416, GetObjectParameterfvARB_remap_index }, + { 25164, GetObjectParameterivARB_remap_index }, + { 26528, GetShaderSourceARB_remap_index }, + { 25778, GetUniformLocationARB_remap_index }, + { 21888, GetUniformfvARB_remap_index }, + { 11530, GetUniformivARB_remap_index }, + { 18407, LinkProgramARB_remap_index }, + { 18465, ShaderSourceARB_remap_index }, + { 6703, Uniform1fARB_remap_index }, + { 27309, Uniform1fvARB_remap_index }, + { 20296, Uniform1iARB_remap_index }, + { 19262, Uniform1ivARB_remap_index }, { 2003, Uniform2fARB_remap_index }, - { 12671, Uniform2fvARB_remap_index }, - { 23410, Uniform2iARB_remap_index }, + { 13110, Uniform2fvARB_remap_index }, + { 24190, Uniform2iARB_remap_index }, { 2123, Uniform2ivARB_remap_index }, - { 16444, Uniform3fARB_remap_index }, - { 8440, Uniform3fvARB_remap_index }, - { 5542, Uniform3iARB_remap_index }, - { 14999, Uniform3ivARB_remap_index }, - { 16890, Uniform4fARB_remap_index }, - { 21019, Uniform4fvARB_remap_index }, - { 22202, Uniform4iARB_remap_index }, - { 18169, Uniform4ivARB_remap_index }, - { 7354, UniformMatrix2fvARB_remap_index }, + { 17009, Uniform3fARB_remap_index }, + { 8613, Uniform3fvARB_remap_index }, + { 5627, Uniform3iARB_remap_index }, + { 15516, Uniform3ivARB_remap_index }, + { 17496, Uniform4fARB_remap_index }, + { 21752, Uniform4fvARB_remap_index }, + { 22918, Uniform4iARB_remap_index }, + { 18775, Uniform4ivARB_remap_index }, + { 7473, UniformMatrix2fvARB_remap_index }, { 17, UniformMatrix3fvARB_remap_index }, { 2475, UniformMatrix4fvARB_remap_index }, - { 22635, UseProgramObjectARB_remap_index }, - { 13106, ValidateProgramARB_remap_index }, - { 18971, BindAttribLocationARB_remap_index }, + { 23351, UseProgramObjectARB_remap_index }, + { 13545, ValidateProgramARB_remap_index }, + { 19616, BindAttribLocationARB_remap_index }, { 4346, GetActiveAttribARB_remap_index }, - { 14680, GetAttribLocationARB_remap_index }, - { 26237, DrawBuffersARB_remap_index }, - { 11694, RenderbufferStorageMultisample_remap_index }, - { 16938, FlushMappedBufferRange_remap_index }, - { 24801, MapBufferRange_remap_index }, - { 14555, BindVertexArray_remap_index }, - { 12965, GenVertexArrays_remap_index }, - { 27012, CopyBufferSubData_remap_index }, - { 27791, ClientWaitSync_remap_index }, + { 15197, GetAttribLocationARB_remap_index }, + { 27048, DrawBuffersARB_remap_index }, + { 12013, RenderbufferStorageMultisample_remap_index }, + { 12417, FramebufferTextureARB_remap_index }, + { 23721, FramebufferTextureFaceARB_remap_index }, + { 22209, ProgramParameteriARB_remap_index }, + { 17544, FlushMappedBufferRange_remap_index }, + { 25581, MapBufferRange_remap_index }, + { 15072, BindVertexArray_remap_index }, + { 13404, GenVertexArrays_remap_index }, + { 27823, CopyBufferSubData_remap_index }, + { 28638, ClientWaitSync_remap_index }, { 2394, DeleteSync_remap_index }, - { 6251, FenceSync_remap_index }, - { 13477, GetInteger64v_remap_index }, - { 20070, GetSynciv_remap_index }, - { 26176, IsSync_remap_index }, - { 8358, WaitSync_remap_index }, + { 6370, FenceSync_remap_index }, + { 13916, GetInteger64v_remap_index }, + { 20803, GetSynciv_remap_index }, + { 26987, IsSync_remap_index }, + { 8531, WaitSync_remap_index }, { 3363, DrawElementsBaseVertex_remap_index }, - { 27255, DrawRangeElementsBaseVertex_remap_index }, - { 23554, MultiDrawElementsBaseVertex_remap_index }, - { 4711, PolygonOffsetEXT_remap_index }, - { 20655, GetPixelTexGenParameterfvSGIS_remap_index }, + { 28066, DrawRangeElementsBaseVertex_remap_index }, + { 24334, MultiDrawElementsBaseVertex_remap_index }, + { 4480, BindTransformFeedback_remap_index }, + { 2906, DeleteTransformFeedbacks_remap_index }, + { 5660, DrawTransformFeedback_remap_index }, + { 8750, GenTransformFeedbacks_remap_index }, + { 25961, IsTransformFeedback_remap_index }, + { 23914, PauseTransformFeedback_remap_index }, + { 4824, ResumeTransformFeedback_remap_index }, + { 4739, PolygonOffsetEXT_remap_index }, + { 21388, GetPixelTexGenParameterfvSGIS_remap_index }, { 3895, GetPixelTexGenParameterivSGIS_remap_index }, - { 20388, PixelTexGenParameterfSGIS_remap_index }, + { 21121, PixelTexGenParameterfSGIS_remap_index }, { 580, PixelTexGenParameterfvSGIS_remap_index }, - { 11249, PixelTexGenParameteriSGIS_remap_index }, - { 12242, PixelTexGenParameterivSGIS_remap_index }, - { 14643, SampleMaskSGIS_remap_index }, - { 17603, SamplePatternSGIS_remap_index }, - { 23483, ColorPointerEXT_remap_index }, - { 15558, EdgeFlagPointerEXT_remap_index }, - { 5196, IndexPointerEXT_remap_index }, - { 5276, NormalPointerEXT_remap_index }, - { 14071, TexCoordPointerEXT_remap_index }, - { 6046, VertexPointerEXT_remap_index }, + { 11568, PixelTexGenParameteriSGIS_remap_index }, + { 12591, PixelTexGenParameterivSGIS_remap_index }, + { 15160, SampleMaskSGIS_remap_index }, + { 18209, SamplePatternSGIS_remap_index }, + { 24263, ColorPointerEXT_remap_index }, + { 16123, EdgeFlagPointerEXT_remap_index }, + { 5281, IndexPointerEXT_remap_index }, + { 5361, NormalPointerEXT_remap_index }, + { 14510, TexCoordPointerEXT_remap_index }, + { 6159, VertexPointerEXT_remap_index }, { 3165, PointParameterfEXT_remap_index }, - { 6891, PointParameterfvEXT_remap_index }, - { 28667, LockArraysEXT_remap_index }, - { 13170, UnlockArraysEXT_remap_index }, - { 7898, CullParameterdvEXT_remap_index }, - { 10423, CullParameterfvEXT_remap_index }, + { 7010, PointParameterfvEXT_remap_index }, + { 29514, LockArraysEXT_remap_index }, + { 13609, UnlockArraysEXT_remap_index }, + { 8017, CullParameterdvEXT_remap_index }, + { 10660, CullParameterfvEXT_remap_index }, { 1151, SecondaryColor3bEXT_remap_index }, - { 7050, SecondaryColor3bvEXT_remap_index }, - { 9268, SecondaryColor3dEXT_remap_index }, - { 22808, SecondaryColor3dvEXT_remap_index }, - { 25047, SecondaryColor3fEXT_remap_index }, - { 16124, SecondaryColor3fvEXT_remap_index }, + { 7169, SecondaryColor3bvEXT_remap_index }, + { 9469, SecondaryColor3dEXT_remap_index }, + { 23524, SecondaryColor3dvEXT_remap_index }, + { 25827, SecondaryColor3fEXT_remap_index }, + { 16689, SecondaryColor3fvEXT_remap_index }, { 426, SecondaryColor3iEXT_remap_index }, - { 14381, SecondaryColor3ivEXT_remap_index }, - { 8926, SecondaryColor3sEXT_remap_index }, - { 27455, SecondaryColor3svEXT_remap_index }, - { 24220, SecondaryColor3ubEXT_remap_index }, - { 18862, SecondaryColor3ubvEXT_remap_index }, - { 11444, SecondaryColor3uiEXT_remap_index }, - { 20275, SecondaryColor3uivEXT_remap_index }, - { 23020, SecondaryColor3usEXT_remap_index }, - { 11517, SecondaryColor3usvEXT_remap_index }, - { 10499, SecondaryColorPointerEXT_remap_index }, - { 22869, MultiDrawArraysEXT_remap_index }, - { 18552, MultiDrawElementsEXT_remap_index }, - { 18747, FogCoordPointerEXT_remap_index }, + { 14898, SecondaryColor3ivEXT_remap_index }, + { 9127, SecondaryColor3sEXT_remap_index }, + { 28302, SecondaryColor3svEXT_remap_index }, + { 25000, SecondaryColor3ubEXT_remap_index }, + { 19507, SecondaryColor3ubvEXT_remap_index }, + { 11763, SecondaryColor3uiEXT_remap_index }, + { 21008, SecondaryColor3uivEXT_remap_index }, + { 23771, SecondaryColor3usEXT_remap_index }, + { 11836, SecondaryColor3usvEXT_remap_index }, + { 10736, SecondaryColorPointerEXT_remap_index }, + { 23585, MultiDrawArraysEXT_remap_index }, + { 19197, MultiDrawElementsEXT_remap_index }, + { 19392, FogCoordPointerEXT_remap_index }, { 4044, FogCoorddEXT_remap_index }, - { 28068, FogCoorddvEXT_remap_index }, + { 28915, FogCoorddvEXT_remap_index }, { 4136, FogCoordfEXT_remap_index }, - { 24143, FogCoordfvEXT_remap_index }, - { 16842, PixelTexGenSGIX_remap_index }, - { 24728, BlendFuncSeparateEXT_remap_index }, - { 5958, FlushVertexArrayRangeNV_remap_index }, - { 4660, VertexArrayRangeNV_remap_index }, - { 25112, CombinerInputNV_remap_index }, + { 24923, FogCoordfvEXT_remap_index }, + { 17448, PixelTexGenSGIX_remap_index }, + { 25508, BlendFuncSeparateEXT_remap_index }, + { 6071, FlushVertexArrayRangeNV_remap_index }, + { 4688, VertexArrayRangeNV_remap_index }, + { 25892, CombinerInputNV_remap_index }, { 1946, CombinerOutputNV_remap_index }, - { 27608, CombinerParameterfNV_remap_index }, - { 4580, CombinerParameterfvNV_remap_index }, - { 19820, CombinerParameteriNV_remap_index }, - { 29038, CombinerParameterivNV_remap_index }, - { 6328, FinalCombinerInputNV_remap_index }, - { 8755, GetCombinerInputParameterfvNV_remap_index }, - { 28875, GetCombinerInputParameterivNV_remap_index }, - { 6127, GetCombinerOutputParameterfvNV_remap_index }, - { 12171, GetCombinerOutputParameterivNV_remap_index }, - { 5703, GetFinalCombinerInputParameterfvNV_remap_index }, - { 22074, GetFinalCombinerInputParameterivNV_remap_index }, - { 11189, ResizeBuffersMESA_remap_index }, - { 9872, WindowPos2dMESA_remap_index }, + { 28455, CombinerParameterfNV_remap_index }, + { 4608, CombinerParameterfvNV_remap_index }, + { 20527, CombinerParameteriNV_remap_index }, + { 29885, CombinerParameterivNV_remap_index }, + { 6447, FinalCombinerInputNV_remap_index }, + { 8956, GetCombinerInputParameterfvNV_remap_index }, + { 29722, GetCombinerInputParameterivNV_remap_index }, + { 12692, GetCombinerOutputParameterfvNV_remap_index }, + { 12520, GetCombinerOutputParameterivNV_remap_index }, + { 5816, GetFinalCombinerInputParameterfvNV_remap_index }, + { 22790, GetFinalCombinerInputParameterivNV_remap_index }, + { 11508, ResizeBuffersMESA_remap_index }, + { 10109, WindowPos2dMESA_remap_index }, { 944, WindowPos2dvMESA_remap_index }, - { 29866, WindowPos2fMESA_remap_index }, - { 6995, WindowPos2fvMESA_remap_index }, - { 16071, WindowPos2iMESA_remap_index }, - { 18076, WindowPos2ivMESA_remap_index }, - { 18651, WindowPos2sMESA_remap_index }, - { 4946, WindowPos2svMESA_remap_index }, - { 6820, WindowPos3dMESA_remap_index }, - { 12450, WindowPos3dvMESA_remap_index }, + { 30713, WindowPos2fMESA_remap_index }, + { 7114, WindowPos2fvMESA_remap_index }, + { 16636, WindowPos2iMESA_remap_index }, + { 18682, WindowPos2ivMESA_remap_index }, + { 19296, WindowPos2sMESA_remap_index }, + { 5031, WindowPos2svMESA_remap_index }, + { 6939, WindowPos3dMESA_remap_index }, + { 12838, WindowPos3dvMESA_remap_index }, { 472, WindowPos3fMESA_remap_index }, - { 13231, WindowPos3fvMESA_remap_index }, - { 21369, WindowPos3iMESA_remap_index }, - { 26957, WindowPos3ivMESA_remap_index }, - { 16588, WindowPos3sMESA_remap_index }, - { 28324, WindowPos3svMESA_remap_index }, - { 9823, WindowPos4dMESA_remap_index }, - { 15084, WindowPos4dvMESA_remap_index }, - { 12409, WindowPos4fMESA_remap_index }, - { 27362, WindowPos4fvMESA_remap_index }, - { 27110, WindowPos4iMESA_remap_index }, - { 11028, WindowPos4ivMESA_remap_index }, - { 16721, WindowPos4sMESA_remap_index }, + { 13670, WindowPos3fvMESA_remap_index }, + { 22102, WindowPos3iMESA_remap_index }, + { 27768, WindowPos3ivMESA_remap_index }, + { 17154, WindowPos3sMESA_remap_index }, + { 29171, WindowPos3svMESA_remap_index }, + { 10060, WindowPos4dMESA_remap_index }, + { 15601, WindowPos4dvMESA_remap_index }, + { 12797, WindowPos4fMESA_remap_index }, + { 28209, WindowPos4fvMESA_remap_index }, + { 27921, WindowPos4iMESA_remap_index }, + { 11311, WindowPos4ivMESA_remap_index }, + { 17327, WindowPos4sMESA_remap_index }, { 2857, WindowPos4svMESA_remap_index }, - { 12210, MultiModeDrawArraysIBM_remap_index }, - { 25830, MultiModeDrawElementsIBM_remap_index }, - { 10878, DeleteFencesNV_remap_index }, - { 24959, FinishFenceNV_remap_index }, + { 12559, MultiModeDrawArraysIBM_remap_index }, + { 26641, MultiModeDrawElementsIBM_remap_index }, + { 11115, DeleteFencesNV_remap_index }, + { 25739, FinishFenceNV_remap_index }, { 3287, GenFencesNV_remap_index }, - { 15064, GetFenceivNV_remap_index }, - { 7287, IsFenceNV_remap_index }, - { 12098, SetFenceNV_remap_index }, + { 15581, GetFenceivNV_remap_index }, + { 7406, IsFenceNV_remap_index }, + { 12447, SetFenceNV_remap_index }, { 3744, TestFenceNV_remap_index }, - { 28295, AreProgramsResidentNV_remap_index }, - { 27650, BindProgramNV_remap_index }, - { 23103, DeleteProgramsNV_remap_index }, - { 19080, ExecuteProgramNV_remap_index }, - { 29759, GenProgramsNV_remap_index }, - { 20734, GetProgramParameterdvNV_remap_index }, - { 9330, GetProgramParameterfvNV_remap_index }, - { 23457, GetProgramStringNV_remap_index }, - { 21763, GetProgramivNV_remap_index }, - { 20968, GetTrackMatrixivNV_remap_index }, - { 23253, GetVertexAttribPointervNV_remap_index }, - { 22007, GetVertexAttribdvNV_remap_index }, - { 16561, GetVertexAttribfvNV_remap_index }, - { 16252, GetVertexAttribivNV_remap_index }, - { 16968, IsProgramNV_remap_index }, - { 8336, LoadProgramNV_remap_index }, - { 24824, ProgramParameters4dvNV_remap_index }, - { 21693, ProgramParameters4fvNV_remap_index }, - { 18380, RequestResidentProgramsNV_remap_index }, - { 19798, TrackMatrixNV_remap_index }, - { 28852, VertexAttrib1dNV_remap_index }, - { 12039, VertexAttrib1dvNV_remap_index }, - { 25362, VertexAttrib1fNV_remap_index }, + { 29142, AreProgramsResidentNV_remap_index }, + { 28497, BindProgramNV_remap_index }, + { 23854, DeleteProgramsNV_remap_index }, + { 19725, ExecuteProgramNV_remap_index }, + { 30606, GenProgramsNV_remap_index }, + { 21467, GetProgramParameterdvNV_remap_index }, + { 9531, GetProgramParameterfvNV_remap_index }, + { 24237, GetProgramStringNV_remap_index }, + { 22479, GetProgramivNV_remap_index }, + { 21701, GetTrackMatrixivNV_remap_index }, + { 24031, GetVertexAttribPointervNV_remap_index }, + { 22723, GetVertexAttribdvNV_remap_index }, + { 8426, GetVertexAttribfvNV_remap_index }, + { 16817, GetVertexAttribivNV_remap_index }, + { 17574, IsProgramNV_remap_index }, + { 8509, LoadProgramNV_remap_index }, + { 25604, ProgramParameters4dvNV_remap_index }, + { 22409, ProgramParameters4fvNV_remap_index }, + { 18986, RequestResidentProgramsNV_remap_index }, + { 20505, TrackMatrixNV_remap_index }, + { 29699, VertexAttrib1dNV_remap_index }, + { 12358, VertexAttrib1dvNV_remap_index }, + { 26173, VertexAttrib1fNV_remap_index }, { 2245, VertexAttrib1fvNV_remap_index }, - { 27419, VertexAttrib1sNV_remap_index }, - { 13304, VertexAttrib1svNV_remap_index }, + { 28266, VertexAttrib1sNV_remap_index }, + { 13743, VertexAttrib1svNV_remap_index }, { 4251, VertexAttrib2dNV_remap_index }, - { 11954, VertexAttrib2dvNV_remap_index }, - { 17835, VertexAttrib2fNV_remap_index }, - { 11565, VertexAttrib2fvNV_remap_index }, - { 5106, VertexAttrib2sNV_remap_index }, - { 16642, VertexAttrib2svNV_remap_index }, - { 10020, VertexAttrib3dNV_remap_index }, - { 28545, VertexAttrib3dvNV_remap_index }, - { 9142, VertexAttrib3fNV_remap_index }, - { 22034, VertexAttrib3fvNV_remap_index }, - { 25337, VertexAttrib3sNV_remap_index }, - { 20995, VertexAttrib3svNV_remap_index }, - { 25804, VertexAttrib4dNV_remap_index }, - { 29796, VertexAttrib4dvNV_remap_index }, + { 12273, VertexAttrib2dvNV_remap_index }, + { 18441, VertexAttrib2fNV_remap_index }, + { 11884, VertexAttrib2fvNV_remap_index }, + { 5191, VertexAttrib2sNV_remap_index }, + { 17208, VertexAttrib2svNV_remap_index }, + { 10257, VertexAttrib3dNV_remap_index }, + { 29392, VertexAttrib3dvNV_remap_index }, + { 9343, VertexAttrib3fNV_remap_index }, + { 22750, VertexAttrib3fvNV_remap_index }, + { 20382, VertexAttrib3sNV_remap_index }, + { 21728, VertexAttrib3svNV_remap_index }, + { 26615, VertexAttrib4dNV_remap_index }, + { 30643, VertexAttrib4dvNV_remap_index }, { 3945, VertexAttrib4fNV_remap_index }, - { 8386, VertexAttrib4fvNV_remap_index }, - { 23802, VertexAttrib4sNV_remap_index }, + { 8559, VertexAttrib4fvNV_remap_index }, + { 24582, VertexAttrib4sNV_remap_index }, { 1293, VertexAttrib4svNV_remap_index }, { 4409, VertexAttrib4ubNV_remap_index }, { 734, VertexAttrib4ubvNV_remap_index }, - { 19260, VertexAttribPointerNV_remap_index }, + { 19905, VertexAttribPointerNV_remap_index }, { 2097, VertexAttribs1dvNV_remap_index }, - { 16666, VertexAttribs1fvNV_remap_index }, - { 29596, VertexAttribs1svNV_remap_index }, - { 9167, VertexAttribs2dvNV_remap_index }, - { 22596, VertexAttribs2fvNV_remap_index }, - { 15584, VertexAttribs2svNV_remap_index }, - { 4608, VertexAttribs3dvNV_remap_index }, + { 24119, VertexAttribs1fvNV_remap_index }, + { 30443, VertexAttribs1svNV_remap_index }, + { 9368, VertexAttribs2dvNV_remap_index }, + { 23312, VertexAttribs2fvNV_remap_index }, + { 16149, VertexAttribs2svNV_remap_index }, + { 4636, VertexAttribs3dvNV_remap_index }, { 1977, VertexAttribs3fvNV_remap_index }, - { 26705, VertexAttribs3svNV_remap_index }, - { 23892, VertexAttribs4dvNV_remap_index }, - { 4634, VertexAttribs4fvNV_remap_index }, - { 29383, VertexAttribs4svNV_remap_index }, - { 26453, VertexAttribs4ubvNV_remap_index }, - { 23962, GetTexBumpParameterfvATI_remap_index }, - { 29637, GetTexBumpParameterivATI_remap_index }, - { 16306, TexBumpParameterfvATI_remap_index }, - { 18251, TexBumpParameterivATI_remap_index }, - { 13850, AlphaFragmentOp1ATI_remap_index }, - { 9682, AlphaFragmentOp2ATI_remap_index }, - { 21950, AlphaFragmentOp3ATI_remap_index }, - { 26632, BeginFragmentShaderATI_remap_index }, - { 27849, BindFragmentShaderATI_remap_index }, - { 21124, ColorFragmentOp1ATI_remap_index }, + { 27516, VertexAttribs3svNV_remap_index }, + { 24672, VertexAttribs4dvNV_remap_index }, + { 4662, VertexAttribs4fvNV_remap_index }, + { 30230, VertexAttribs4svNV_remap_index }, + { 27264, VertexAttribs4ubvNV_remap_index }, + { 24742, GetTexBumpParameterfvATI_remap_index }, + { 30484, GetTexBumpParameterivATI_remap_index }, + { 16871, TexBumpParameterfvATI_remap_index }, + { 18857, TexBumpParameterivATI_remap_index }, + { 14289, AlphaFragmentOp1ATI_remap_index }, + { 9919, AlphaFragmentOp2ATI_remap_index }, + { 22666, AlphaFragmentOp3ATI_remap_index }, + { 27443, BeginFragmentShaderATI_remap_index }, + { 28696, BindFragmentShaderATI_remap_index }, + { 21857, ColorFragmentOp1ATI_remap_index }, { 3823, ColorFragmentOp2ATI_remap_index }, - { 28190, ColorFragmentOp3ATI_remap_index }, - { 4753, DeleteFragmentShaderATI_remap_index }, - { 29820, EndFragmentShaderATI_remap_index }, - { 29066, GenFragmentShadersATI_remap_index }, - { 22727, PassTexCoordATI_remap_index }, - { 6026, SampleMapATI_remap_index }, - { 5799, SetFragmentShaderConstantATI_remap_index }, + { 29037, ColorFragmentOp3ATI_remap_index }, + { 4781, DeleteFragmentShaderATI_remap_index }, + { 30667, EndFragmentShaderATI_remap_index }, + { 29913, GenFragmentShadersATI_remap_index }, + { 23443, PassTexCoordATI_remap_index }, + { 6139, SampleMapATI_remap_index }, + { 5912, SetFragmentShaderConstantATI_remap_index }, { 319, PointParameteriNV_remap_index }, - { 12611, PointParameterivNV_remap_index }, - { 25643, ActiveStencilFaceEXT_remap_index }, - { 24484, BindVertexArrayAPPLE_remap_index }, + { 12999, PointParameterivNV_remap_index }, + { 26454, ActiveStencilFaceEXT_remap_index }, + { 25264, BindVertexArrayAPPLE_remap_index }, { 2522, DeleteVertexArraysAPPLE_remap_index }, - { 15923, GenVertexArraysAPPLE_remap_index }, - { 20799, IsVertexArrayAPPLE_remap_index }, + { 16488, GenVertexArraysAPPLE_remap_index }, + { 21532, IsVertexArrayAPPLE_remap_index }, { 775, GetProgramNamedParameterdvNV_remap_index }, { 3128, GetProgramNamedParameterfvNV_remap_index }, - { 23993, ProgramNamedParameter4dNV_remap_index }, - { 12886, ProgramNamedParameter4dvNV_remap_index }, - { 7923, ProgramNamedParameter4fNV_remap_index }, - { 10464, ProgramNamedParameter4fvNV_remap_index }, - { 21672, DepthBoundsEXT_remap_index }, + { 24773, ProgramNamedParameter4dNV_remap_index }, + { 13325, ProgramNamedParameter4dvNV_remap_index }, + { 8042, ProgramNamedParameter4fNV_remap_index }, + { 10701, ProgramNamedParameter4fvNV_remap_index }, + { 22388, DepthBoundsEXT_remap_index }, { 1043, BlendEquationSeparateEXT_remap_index }, - { 13005, BindFramebufferEXT_remap_index }, - { 22914, BindRenderbufferEXT_remap_index }, - { 8605, CheckFramebufferStatusEXT_remap_index }, - { 20089, DeleteFramebuffersEXT_remap_index }, - { 28447, DeleteRenderbuffersEXT_remap_index }, - { 11978, FramebufferRenderbufferEXT_remap_index }, - { 12115, FramebufferTexture1DEXT_remap_index }, - { 10258, FramebufferTexture2DEXT_remap_index }, - { 9925, FramebufferTexture3DEXT_remap_index }, - { 20691, GenFramebuffersEXT_remap_index }, - { 15470, GenRenderbuffersEXT_remap_index }, - { 5745, GenerateMipmapEXT_remap_index }, - { 19320, GetFramebufferAttachmentParameterivEXT_remap_index }, - { 28972, GetRenderbufferParameterivEXT_remap_index }, - { 18131, IsFramebufferEXT_remap_index }, - { 29719, IsRenderbufferEXT_remap_index }, - { 7234, RenderbufferStorageEXT_remap_index }, + { 13444, BindFramebufferEXT_remap_index }, + { 23630, BindRenderbufferEXT_remap_index }, + { 8806, CheckFramebufferStatusEXT_remap_index }, + { 20822, DeleteFramebuffersEXT_remap_index }, + { 29294, DeleteRenderbuffersEXT_remap_index }, + { 12297, FramebufferRenderbufferEXT_remap_index }, + { 12464, FramebufferTexture1DEXT_remap_index }, + { 10495, FramebufferTexture2DEXT_remap_index }, + { 10162, FramebufferTexture3DEXT_remap_index }, + { 21424, GenFramebuffersEXT_remap_index }, + { 16035, GenRenderbuffersEXT_remap_index }, + { 5858, GenerateMipmapEXT_remap_index }, + { 20002, GetFramebufferAttachmentParameterivEXT_remap_index }, + { 29819, GetRenderbufferParameterivEXT_remap_index }, + { 18737, IsFramebufferEXT_remap_index }, + { 30566, IsRenderbufferEXT_remap_index }, + { 7353, RenderbufferStorageEXT_remap_index }, { 651, BlitFramebufferEXT_remap_index }, - { 12705, BufferParameteriAPPLE_remap_index }, - { 17000, FlushMappedBufferRangeAPPLE_remap_index }, + { 13144, BufferParameteriAPPLE_remap_index }, + { 17606, FlushMappedBufferRangeAPPLE_remap_index }, { 2701, FramebufferTextureLayerEXT_remap_index }, - { 8307, ColorMaskIndexedEXT_remap_index }, - { 23341, DisableIndexedEXT_remap_index }, - { 23649, EnableIndexedEXT_remap_index }, - { 19291, GetBooleanIndexedvEXT_remap_index }, - { 9715, GetIntegerIndexedvEXT_remap_index }, - { 20165, IsEnabledIndexedEXT_remap_index }, + { 4956, ColorMaskIndexedEXT_remap_index }, + { 17232, DisableIndexedEXT_remap_index }, + { 24429, EnableIndexedEXT_remap_index }, + { 19973, GetBooleanIndexedvEXT_remap_index }, + { 9952, GetIntegerIndexedvEXT_remap_index }, + { 20898, IsEnabledIndexedEXT_remap_index }, { 4074, BeginConditionalRenderNV_remap_index }, - { 22700, EndConditionalRenderNV_remap_index }, - { 26354, ProvokingVertexEXT_remap_index }, - { 9551, GetTexParameterPointervAPPLE_remap_index }, + { 23416, EndConditionalRenderNV_remap_index }, + { 8453, BeginTransformFeedbackEXT_remap_index }, + { 17256, BindBufferBaseEXT_remap_index }, + { 17126, BindBufferOffsetEXT_remap_index }, + { 11136, BindBufferRangeEXT_remap_index }, + { 13059, EndTransformFeedbackEXT_remap_index }, + { 9804, GetTransformFeedbackVaryingEXT_remap_index }, + { 19042, TransformFeedbackVaryingsEXT_remap_index }, + { 27165, ProvokingVertexEXT_remap_index }, + { 9752, GetTexParameterPointervAPPLE_remap_index }, { 4436, TextureRangeAPPLE_remap_index }, - { 10330, GetObjectParameterivAPPLE_remap_index }, - { 17575, ObjectPurgeableAPPLE_remap_index }, - { 4900, ObjectUnpurgeableAPPLE_remap_index }, - { 25669, StencilFuncSeparateATI_remap_index }, - { 15990, ProgramEnvParameters4fvEXT_remap_index }, - { 15208, ProgramLocalParameters4fvEXT_remap_index }, - { 12539, GetQueryObjecti64vEXT_remap_index }, - { 9193, GetQueryObjectui64vEXT_remap_index }, - { 21193, EGLImageTargetRenderbufferStorageOES_remap_index }, - { 10817, EGLImageTargetTexture2DOES_remap_index }, + { 10567, GetObjectParameterivAPPLE_remap_index }, + { 18181, ObjectPurgeableAPPLE_remap_index }, + { 4985, ObjectUnpurgeableAPPLE_remap_index }, + { 26480, StencilFuncSeparateATI_remap_index }, + { 16555, ProgramEnvParameters4fvEXT_remap_index }, + { 19936, ProgramLocalParameters4fvEXT_remap_index }, + { 12927, GetQueryObjecti64vEXT_remap_index }, + { 9394, GetQueryObjectui64vEXT_remap_index }, + { 21926, EGLImageTargetRenderbufferStorageOES_remap_index }, + { 11054, EGLImageTargetTexture2DOES_remap_index }, { -1, -1 } }; @@ -4793,108 +4895,108 @@ static const struct gl_function_remap MESA_alt_functions[] = { /* from GL_EXT_blend_color */ { 2440, _gloffset_BlendColor }, /* from GL_EXT_blend_minmax */ - { 9982, _gloffset_BlendEquation }, + { 10219, _gloffset_BlendEquation }, /* from GL_EXT_color_subtable */ - { 15106, _gloffset_ColorSubTable }, - { 28379, _gloffset_CopyColorSubTable }, + { 15623, _gloffset_ColorSubTable }, + { 29226, _gloffset_CopyColorSubTable }, /* from GL_EXT_convolution */ { 213, _gloffset_ConvolutionFilter1D }, { 2284, _gloffset_CopyConvolutionFilter1D }, { 3624, _gloffset_GetConvolutionParameteriv }, - { 7583, _gloffset_ConvolutionFilter2D }, - { 7749, _gloffset_ConvolutionParameteriv }, - { 8209, _gloffset_ConvolutionParameterfv }, - { 18279, _gloffset_GetSeparableFilter }, - { 21423, _gloffset_SeparableFilter2D }, - { 22252, _gloffset_ConvolutionParameteri }, - { 22375, _gloffset_ConvolutionParameterf }, - { 23828, _gloffset_GetConvolutionParameterfv }, - { 24650, _gloffset_GetConvolutionFilter }, - { 26894, _gloffset_CopyConvolutionFilter2D }, + { 7702, _gloffset_ConvolutionFilter2D }, + { 7868, _gloffset_ConvolutionParameteriv }, + { 8328, _gloffset_ConvolutionParameterfv }, + { 18885, _gloffset_GetSeparableFilter }, + { 22156, _gloffset_SeparableFilter2D }, + { 22968, _gloffset_ConvolutionParameteri }, + { 23091, _gloffset_ConvolutionParameterf }, + { 24608, _gloffset_GetConvolutionParameterfv }, + { 25430, _gloffset_GetConvolutionFilter }, + { 27705, _gloffset_CopyConvolutionFilter2D }, /* from GL_EXT_copy_texture */ - { 13364, _gloffset_CopyTexSubImage3D }, - { 14846, _gloffset_CopyTexImage2D }, - { 21860, _gloffset_CopyTexImage1D }, - { 24331, _gloffset_CopyTexSubImage2D }, - { 26532, _gloffset_CopyTexSubImage1D }, + { 13803, _gloffset_CopyTexSubImage3D }, + { 15363, _gloffset_CopyTexImage2D }, + { 22576, _gloffset_CopyTexImage1D }, + { 25111, _gloffset_CopyTexSubImage2D }, + { 27343, _gloffset_CopyTexSubImage1D }, /* from GL_EXT_draw_range_elements */ - { 8492, _gloffset_DrawRangeElements }, + { 8665, _gloffset_DrawRangeElements }, /* from GL_EXT_histogram */ { 812, _gloffset_Histogram }, { 3088, _gloffset_ResetHistogram }, - { 8864, _gloffset_GetMinmax }, - { 13698, _gloffset_GetHistogramParameterfv }, - { 21785, _gloffset_GetMinmaxParameteriv }, - { 23718, _gloffset_ResetMinmax }, - { 24547, _gloffset_GetHistogramParameteriv }, - { 25603, _gloffset_GetHistogram }, - { 27965, _gloffset_Minmax }, - { 29466, _gloffset_GetMinmaxParameterfv }, + { 9065, _gloffset_GetMinmax }, + { 14137, _gloffset_GetHistogramParameterfv }, + { 22501, _gloffset_GetMinmaxParameteriv }, + { 24498, _gloffset_ResetMinmax }, + { 25327, _gloffset_GetHistogramParameteriv }, + { 26414, _gloffset_GetHistogram }, + { 28812, _gloffset_Minmax }, + { 30313, _gloffset_GetMinmaxParameterfv }, /* from GL_EXT_paletted_texture */ - { 7445, _gloffset_ColorTable }, - { 13544, _gloffset_GetColorTable }, - { 20438, _gloffset_GetColorTableParameterfv }, - { 22431, _gloffset_GetColorTableParameteriv }, + { 7564, _gloffset_ColorTable }, + { 13983, _gloffset_GetColorTable }, + { 21171, _gloffset_GetColorTableParameterfv }, + { 23147, _gloffset_GetColorTableParameteriv }, /* from GL_EXT_subtexture */ - { 6166, _gloffset_TexSubImage1D }, - { 9478, _gloffset_TexSubImage2D }, + { 6285, _gloffset_TexSubImage1D }, + { 9679, _gloffset_TexSubImage2D }, /* from GL_EXT_texture3D */ { 1658, _gloffset_TexImage3D }, - { 20207, _gloffset_TexSubImage3D }, + { 20940, _gloffset_TexSubImage3D }, /* from GL_EXT_texture_object */ { 2964, _gloffset_PrioritizeTextures }, - { 6615, _gloffset_AreTexturesResident }, - { 12063, _gloffset_GenTextures }, - { 14030, _gloffset_DeleteTextures }, - { 17281, _gloffset_IsTexture }, - { 26597, _gloffset_BindTexture }, + { 6734, _gloffset_AreTexturesResident }, + { 12382, _gloffset_GenTextures }, + { 14469, _gloffset_DeleteTextures }, + { 17887, _gloffset_IsTexture }, + { 27408, _gloffset_BindTexture }, /* from GL_EXT_vertex_array */ - { 21612, _gloffset_ArrayElement }, - { 27553, _gloffset_GetPointerv }, - { 29093, _gloffset_DrawArrays }, + { 22328, _gloffset_ArrayElement }, + { 28400, _gloffset_GetPointerv }, + { 29940, _gloffset_DrawArrays }, /* from GL_SGI_color_table */ - { 6733, _gloffset_ColorTableParameteriv }, - { 7445, _gloffset_ColorTable }, - { 13544, _gloffset_GetColorTable }, - { 13654, _gloffset_CopyColorTable }, - { 17142, _gloffset_ColorTableParameterfv }, - { 20438, _gloffset_GetColorTableParameterfv }, - { 22431, _gloffset_GetColorTableParameteriv }, + { 6852, _gloffset_ColorTableParameteriv }, + { 7564, _gloffset_ColorTable }, + { 13983, _gloffset_GetColorTable }, + { 14093, _gloffset_CopyColorTable }, + { 17748, _gloffset_ColorTableParameterfv }, + { 21171, _gloffset_GetColorTableParameterfv }, + { 23147, _gloffset_GetColorTableParameteriv }, /* from GL_VERSION_1_3 */ { 381, _gloffset_MultiTexCoord3sARB }, { 613, _gloffset_ActiveTextureARB }, { 3761, _gloffset_MultiTexCoord1fvARB }, - { 5301, _gloffset_MultiTexCoord3dARB }, - { 5346, _gloffset_MultiTexCoord2iARB }, - { 5470, _gloffset_MultiTexCoord2svARB }, - { 7401, _gloffset_MultiTexCoord2fARB }, - { 9223, _gloffset_MultiTexCoord3fvARB }, - { 9744, _gloffset_MultiTexCoord4sARB }, - { 10378, _gloffset_MultiTexCoord2dvARB }, - { 10760, _gloffset_MultiTexCoord1svARB }, - { 11050, _gloffset_MultiTexCoord3svARB }, - { 11111, _gloffset_MultiTexCoord4iARB }, - { 11834, _gloffset_MultiTexCoord3iARB }, - { 12568, _gloffset_MultiTexCoord1dARB }, - { 12734, _gloffset_MultiTexCoord3dvARB }, - { 13898, _gloffset_MultiTexCoord3ivARB }, - { 13943, _gloffset_MultiTexCoord2sARB }, - { 15163, _gloffset_MultiTexCoord4ivARB }, - { 16792, _gloffset_ClientActiveTextureARB }, - { 19036, _gloffset_MultiTexCoord2dARB }, - { 19440, _gloffset_MultiTexCoord4dvARB }, - { 19726, _gloffset_MultiTexCoord4fvARB }, - { 20579, _gloffset_MultiTexCoord3fARB }, - { 22959, _gloffset_MultiTexCoord4dARB }, - { 23163, _gloffset_MultiTexCoord1sARB }, - { 23365, _gloffset_MultiTexCoord1dvARB }, - { 24175, _gloffset_MultiTexCoord1ivARB }, - { 24268, _gloffset_MultiTexCoord2ivARB }, - { 24607, _gloffset_MultiTexCoord1iARB }, - { 25878, _gloffset_MultiTexCoord4svARB }, - { 26396, _gloffset_MultiTexCoord1fARB }, - { 26659, _gloffset_MultiTexCoord4fARB }, - { 28927, _gloffset_MultiTexCoord2fvARB }, + { 5386, _gloffset_MultiTexCoord3dARB }, + { 5431, _gloffset_MultiTexCoord2iARB }, + { 5555, _gloffset_MultiTexCoord2svARB }, + { 7520, _gloffset_MultiTexCoord2fARB }, + { 9424, _gloffset_MultiTexCoord3fvARB }, + { 9981, _gloffset_MultiTexCoord4sARB }, + { 10615, _gloffset_MultiTexCoord2dvARB }, + { 10997, _gloffset_MultiTexCoord1svARB }, + { 11369, _gloffset_MultiTexCoord3svARB }, + { 11430, _gloffset_MultiTexCoord4iARB }, + { 12153, _gloffset_MultiTexCoord3iARB }, + { 12956, _gloffset_MultiTexCoord1dARB }, + { 13173, _gloffset_MultiTexCoord3dvARB }, + { 14337, _gloffset_MultiTexCoord3ivARB }, + { 14382, _gloffset_MultiTexCoord2sARB }, + { 15680, _gloffset_MultiTexCoord4ivARB }, + { 17398, _gloffset_ClientActiveTextureARB }, + { 19681, _gloffset_MultiTexCoord2dARB }, + { 20122, _gloffset_MultiTexCoord4dvARB }, + { 20433, _gloffset_MultiTexCoord4fvARB }, + { 21312, _gloffset_MultiTexCoord3fARB }, + { 23675, _gloffset_MultiTexCoord4dARB }, + { 23941, _gloffset_MultiTexCoord1sARB }, + { 24145, _gloffset_MultiTexCoord1dvARB }, + { 24955, _gloffset_MultiTexCoord1ivARB }, + { 25048, _gloffset_MultiTexCoord2ivARB }, + { 25387, _gloffset_MultiTexCoord1iARB }, + { 26689, _gloffset_MultiTexCoord4svARB }, + { 27207, _gloffset_MultiTexCoord1fARB }, + { 27470, _gloffset_MultiTexCoord4fARB }, + { 29774, _gloffset_MultiTexCoord2fvARB }, { -1, -1 } }; @@ -4902,7 +5004,7 @@ static const struct gl_function_remap MESA_alt_functions[] = { #if defined(need_GL_3DFX_tbuffer) static const struct gl_function_remap GL_3DFX_tbuffer_functions[] = { - { 8267, -1 }, /* TbufferMask3DFX */ + { 8386, -1 }, /* TbufferMask3DFX */ { -1, -1 } }; #endif @@ -4956,6 +5058,13 @@ static const struct gl_function_remap GL_ARB_draw_elements_base_vertex_functions }; #endif +#if defined(need_GL_ARB_draw_instanced) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_draw_instanced_functions[] = { + { -1, -1 } +}; +#endif + #if defined(need_GL_ARB_framebuffer_object) /* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_ARB_framebuffer_object_functions[] = { @@ -4963,6 +5072,14 @@ static const struct gl_function_remap GL_ARB_framebuffer_object_functions[] = { }; #endif +#if defined(need_GL_ARB_geometry_shader4) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_geometry_shader4_functions[] = { + { 11333, -1 }, /* FramebufferTextureLayer */ + { -1, -1 } +}; +#endif + #if defined(need_GL_ARB_map_buffer_range) /* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = { @@ -4973,10 +5090,10 @@ static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = { #if defined(need_GL_ARB_matrix_palette) static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = { { 3339, -1 }, /* MatrixIndexusvARB */ - { 11655, -1 }, /* MatrixIndexuivARB */ - { 12856, -1 }, /* MatrixIndexPointerARB */ - { 17530, -1 }, /* CurrentPaletteMatrixARB */ - { 20323, -1 }, /* MatrixIndexubvARB */ + { 11974, -1 }, /* MatrixIndexuivARB */ + { 13295, -1 }, /* MatrixIndexPointerARB */ + { 18136, -1 }, /* CurrentPaletteMatrixARB */ + { 21056, -1 }, /* MatrixIndexubvARB */ { -1, -1 } }; #endif @@ -5030,6 +5147,13 @@ static const struct gl_function_remap GL_ARB_texture_compression_functions[] = { }; #endif +#if defined(need_GL_ARB_transform_feedback2) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_transform_feedback2_functions[] = { + { -1, -1 } +}; +#endif + #if defined(need_GL_ARB_transpose_matrix) /* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_ARB_transpose_matrix_functions[] = { @@ -5047,15 +5171,15 @@ static const struct gl_function_remap GL_ARB_vertex_array_object_functions[] = { #if defined(need_GL_ARB_vertex_blend) static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = { { 2226, -1 }, /* WeightubvARB */ - { 5633, -1 }, /* WeightivARB */ - { 9847, -1 }, /* WeightPointerARB */ - { 12325, -1 }, /* WeightfvARB */ - { 15610, -1 }, /* WeightbvARB */ - { 18704, -1 }, /* WeightusvARB */ - { 21349, -1 }, /* VertexBlendARB */ - { 26480, -1 }, /* WeightsvARB */ - { 28429, -1 }, /* WeightdvARB */ - { 29127, -1 }, /* WeightuivARB */ + { 5746, -1 }, /* WeightivARB */ + { 10084, -1 }, /* WeightPointerARB */ + { 12674, -1 }, /* WeightfvARB */ + { 16175, -1 }, /* WeightbvARB */ + { 19349, -1 }, /* WeightusvARB */ + { 22082, -1 }, /* VertexBlendARB */ + { 27291, -1 }, /* WeightsvARB */ + { 29276, -1 }, /* WeightdvARB */ + { 29974, -1 }, /* WeightuivARB */ { -1, -1 } }; #endif @@ -5146,15 +5270,15 @@ static const struct gl_function_remap GL_EXT_blend_func_separate_functions[] = { #if defined(need_GL_EXT_blend_minmax) static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = { - { 9982, _gloffset_BlendEquation }, + { 10219, _gloffset_BlendEquation }, { -1, -1 } }; #endif #if defined(need_GL_EXT_color_subtable) static const struct gl_function_remap GL_EXT_color_subtable_functions[] = { - { 15106, _gloffset_ColorSubTable }, - { 28379, _gloffset_CopyColorSubTable }, + { 15623, _gloffset_ColorSubTable }, + { 29226, _gloffset_CopyColorSubTable }, { -1, -1 } }; #endif @@ -5171,55 +5295,55 @@ static const struct gl_function_remap GL_EXT_convolution_functions[] = { { 213, _gloffset_ConvolutionFilter1D }, { 2284, _gloffset_CopyConvolutionFilter1D }, { 3624, _gloffset_GetConvolutionParameteriv }, - { 7583, _gloffset_ConvolutionFilter2D }, - { 7749, _gloffset_ConvolutionParameteriv }, - { 8209, _gloffset_ConvolutionParameterfv }, - { 18279, _gloffset_GetSeparableFilter }, - { 21423, _gloffset_SeparableFilter2D }, - { 22252, _gloffset_ConvolutionParameteri }, - { 22375, _gloffset_ConvolutionParameterf }, - { 23828, _gloffset_GetConvolutionParameterfv }, - { 24650, _gloffset_GetConvolutionFilter }, - { 26894, _gloffset_CopyConvolutionFilter2D }, + { 7702, _gloffset_ConvolutionFilter2D }, + { 7868, _gloffset_ConvolutionParameteriv }, + { 8328, _gloffset_ConvolutionParameterfv }, + { 18885, _gloffset_GetSeparableFilter }, + { 22156, _gloffset_SeparableFilter2D }, + { 22968, _gloffset_ConvolutionParameteri }, + { 23091, _gloffset_ConvolutionParameterf }, + { 24608, _gloffset_GetConvolutionParameterfv }, + { 25430, _gloffset_GetConvolutionFilter }, + { 27705, _gloffset_CopyConvolutionFilter2D }, { -1, -1 } }; #endif #if defined(need_GL_EXT_coordinate_frame) static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = { - { 9362, -1 }, /* TangentPointerEXT */ - { 11169, -1 }, /* Binormal3ivEXT */ - { 11787, -1 }, /* Tangent3sEXT */ - { 12921, -1 }, /* Tangent3fvEXT */ - { 16542, -1 }, /* Tangent3dvEXT */ - { 17228, -1 }, /* Binormal3bvEXT */ - { 18332, -1 }, /* Binormal3dEXT */ - { 20255, -1 }, /* Tangent3fEXT */ - { 22324, -1 }, /* Binormal3sEXT */ - { 22769, -1 }, /* Tangent3ivEXT */ - { 22788, -1 }, /* Tangent3dEXT */ - { 23592, -1 }, /* Binormal3svEXT */ - { 24073, -1 }, /* Binormal3fEXT */ - { 24925, -1 }, /* Binormal3dvEXT */ - { 26100, -1 }, /* Tangent3iEXT */ - { 27179, -1 }, /* Tangent3bvEXT */ - { 27588, -1 }, /* Tangent3bEXT */ - { 28152, -1 }, /* Binormal3fvEXT */ - { 28826, -1 }, /* BinormalPointerEXT */ - { 29231, -1 }, /* Tangent3svEXT */ - { 29668, -1 }, /* Binormal3bEXT */ - { 29845, -1 }, /* Binormal3iEXT */ + { 9563, -1 }, /* TangentPointerEXT */ + { 11488, -1 }, /* Binormal3ivEXT */ + { 12106, -1 }, /* Tangent3sEXT */ + { 13360, -1 }, /* Tangent3fvEXT */ + { 17107, -1 }, /* Tangent3dvEXT */ + { 17834, -1 }, /* Binormal3bvEXT */ + { 18938, -1 }, /* Binormal3dEXT */ + { 20988, -1 }, /* Tangent3fEXT */ + { 23040, -1 }, /* Binormal3sEXT */ + { 23485, -1 }, /* Tangent3ivEXT */ + { 23504, -1 }, /* Tangent3dEXT */ + { 24372, -1 }, /* Binormal3svEXT */ + { 24853, -1 }, /* Binormal3fEXT */ + { 25705, -1 }, /* Binormal3dvEXT */ + { 26911, -1 }, /* Tangent3iEXT */ + { 27990, -1 }, /* Tangent3bvEXT */ + { 28435, -1 }, /* Tangent3bEXT */ + { 28999, -1 }, /* Binormal3fvEXT */ + { 29673, -1 }, /* BinormalPointerEXT */ + { 30078, -1 }, /* Tangent3svEXT */ + { 30515, -1 }, /* Binormal3bEXT */ + { 30692, -1 }, /* Binormal3iEXT */ { -1, -1 } }; #endif #if defined(need_GL_EXT_copy_texture) static const struct gl_function_remap GL_EXT_copy_texture_functions[] = { - { 13364, _gloffset_CopyTexSubImage3D }, - { 14846, _gloffset_CopyTexImage2D }, - { 21860, _gloffset_CopyTexImage1D }, - { 24331, _gloffset_CopyTexSubImage2D }, - { 26532, _gloffset_CopyTexSubImage1D }, + { 13803, _gloffset_CopyTexSubImage3D }, + { 15363, _gloffset_CopyTexImage2D }, + { 22576, _gloffset_CopyTexImage1D }, + { 25111, _gloffset_CopyTexSubImage2D }, + { 27343, _gloffset_CopyTexSubImage1D }, { -1, -1 } }; #endif @@ -5245,9 +5369,16 @@ static const struct gl_function_remap GL_EXT_draw_buffers2_functions[] = { }; #endif +#if defined(need_GL_EXT_draw_instanced) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_draw_instanced_functions[] = { + { -1, -1 } +}; +#endif + #if defined(need_GL_EXT_draw_range_elements) static const struct gl_function_remap GL_EXT_draw_range_elements_functions[] = { - { 8492, _gloffset_DrawRangeElements }, + { 8665, _gloffset_DrawRangeElements }, { -1, -1 } }; #endif @@ -5291,37 +5422,37 @@ static const struct gl_function_remap GL_EXT_gpu_program_parameters_functions[] static const struct gl_function_remap GL_EXT_histogram_functions[] = { { 812, _gloffset_Histogram }, { 3088, _gloffset_ResetHistogram }, - { 8864, _gloffset_GetMinmax }, - { 13698, _gloffset_GetHistogramParameterfv }, - { 21785, _gloffset_GetMinmaxParameteriv }, - { 23718, _gloffset_ResetMinmax }, - { 24547, _gloffset_GetHistogramParameteriv }, - { 25603, _gloffset_GetHistogram }, - { 27965, _gloffset_Minmax }, - { 29466, _gloffset_GetMinmaxParameterfv }, + { 9065, _gloffset_GetMinmax }, + { 14137, _gloffset_GetHistogramParameterfv }, + { 22501, _gloffset_GetMinmaxParameteriv }, + { 24498, _gloffset_ResetMinmax }, + { 25327, _gloffset_GetHistogramParameteriv }, + { 26414, _gloffset_GetHistogram }, + { 28812, _gloffset_Minmax }, + { 30313, _gloffset_GetMinmaxParameterfv }, { -1, -1 } }; #endif #if defined(need_GL_EXT_index_func) static const struct gl_function_remap GL_EXT_index_func_functions[] = { - { 10209, -1 }, /* IndexFuncEXT */ + { 10446, -1 }, /* IndexFuncEXT */ { -1, -1 } }; #endif #if defined(need_GL_EXT_index_material) static const struct gl_function_remap GL_EXT_index_material_functions[] = { - { 18791, -1 }, /* IndexMaterialEXT */ + { 19436, -1 }, /* IndexMaterialEXT */ { -1, -1 } }; #endif #if defined(need_GL_EXT_light_texture) static const struct gl_function_remap GL_EXT_light_texture_functions[] = { - { 23612, -1 }, /* ApplyTextureEXT */ - { 23672, -1 }, /* TextureMaterialEXT */ - { 23697, -1 }, /* TextureLightEXT */ + { 24392, -1 }, /* ApplyTextureEXT */ + { 24452, -1 }, /* TextureMaterialEXT */ + { 24477, -1 }, /* TextureLightEXT */ { -1, -1 } }; #endif @@ -5342,20 +5473,20 @@ static const struct gl_function_remap GL_EXT_multisample_functions[] = { #if defined(need_GL_EXT_paletted_texture) static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = { - { 7445, _gloffset_ColorTable }, - { 13544, _gloffset_GetColorTable }, - { 20438, _gloffset_GetColorTableParameterfv }, - { 22431, _gloffset_GetColorTableParameteriv }, + { 7564, _gloffset_ColorTable }, + { 13983, _gloffset_GetColorTable }, + { 21171, _gloffset_GetColorTableParameterfv }, + { 23147, _gloffset_GetColorTableParameteriv }, { -1, -1 } }; #endif #if defined(need_GL_EXT_pixel_transform) static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = { - { 9603, -1 }, /* PixelTransformParameterfvEXT */ - { 19405, -1 }, /* PixelTransformParameterfEXT */ - { 19485, -1 }, /* PixelTransformParameteriEXT */ - { 28790, -1 }, /* PixelTransformParameterivEXT */ + { 20087, -1 }, /* PixelTransformParameterfEXT */ + { 20167, -1 }, /* PixelTransformParameteriEXT */ + { 28173, -1 }, /* PixelTransformParameterfvEXT */ + { 29637, -1 }, /* PixelTransformParameterivEXT */ { -1, -1 } }; #endif @@ -5397,8 +5528,8 @@ static const struct gl_function_remap GL_EXT_stencil_two_side_functions[] = { #if defined(need_GL_EXT_subtexture) static const struct gl_function_remap GL_EXT_subtexture_functions[] = { - { 6166, _gloffset_TexSubImage1D }, - { 9478, _gloffset_TexSubImage2D }, + { 6285, _gloffset_TexSubImage1D }, + { 9679, _gloffset_TexSubImage2D }, { -1, -1 } }; #endif @@ -5406,7 +5537,7 @@ static const struct gl_function_remap GL_EXT_subtexture_functions[] = { #if defined(need_GL_EXT_texture3D) static const struct gl_function_remap GL_EXT_texture3D_functions[] = { { 1658, _gloffset_TexImage3D }, - { 20207, _gloffset_TexSubImage3D }, + { 20940, _gloffset_TexSubImage3D }, { -1, -1 } }; #endif @@ -5421,18 +5552,18 @@ static const struct gl_function_remap GL_EXT_texture_array_functions[] = { #if defined(need_GL_EXT_texture_object) static const struct gl_function_remap GL_EXT_texture_object_functions[] = { { 2964, _gloffset_PrioritizeTextures }, - { 6615, _gloffset_AreTexturesResident }, - { 12063, _gloffset_GenTextures }, - { 14030, _gloffset_DeleteTextures }, - { 17281, _gloffset_IsTexture }, - { 26597, _gloffset_BindTexture }, + { 6734, _gloffset_AreTexturesResident }, + { 12382, _gloffset_GenTextures }, + { 14469, _gloffset_DeleteTextures }, + { 17887, _gloffset_IsTexture }, + { 27408, _gloffset_BindTexture }, { -1, -1 } }; #endif #if defined(need_GL_EXT_texture_perturb_normal) static const struct gl_function_remap GL_EXT_texture_perturb_normal_functions[] = { - { 12275, -1 }, /* TextureNormalEXT */ + { 12624, -1 }, /* TextureNormalEXT */ { -1, -1 } }; #endif @@ -5444,21 +5575,28 @@ static const struct gl_function_remap GL_EXT_timer_query_functions[] = { }; #endif +#if defined(need_GL_EXT_transform_feedback) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_transform_feedback_functions[] = { + { -1, -1 } +}; +#endif + #if defined(need_GL_EXT_vertex_array) /* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_EXT_vertex_array_functions[] = { - { 21612, _gloffset_ArrayElement }, - { 27553, _gloffset_GetPointerv }, - { 29093, _gloffset_DrawArrays }, + { 22328, _gloffset_ArrayElement }, + { 28400, _gloffset_GetPointerv }, + { 29940, _gloffset_DrawArrays }, { -1, -1 } }; #endif #if defined(need_GL_EXT_vertex_weighting) static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = { - { 17311, -1 }, /* VertexWeightfvEXT */ - { 24051, -1 }, /* VertexWeightfEXT */ - { 25572, -1 }, /* VertexWeightPointerEXT */ + { 17917, -1 }, /* VertexWeightfvEXT */ + { 24831, -1 }, /* VertexWeightfEXT */ + { 26383, -1 }, /* VertexWeightPointerEXT */ { -1, -1 } }; #endif @@ -5467,10 +5605,10 @@ static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = { static const struct gl_function_remap GL_HP_image_transform_functions[] = { { 2157, -1 }, /* GetImageTransformParameterfvHP */ { 3305, -1 }, /* ImageTransformParameterfHP */ - { 9056, -1 }, /* ImageTransformParameterfvHP */ - { 10678, -1 }, /* ImageTransformParameteriHP */ - { 10940, -1 }, /* GetImageTransformParameterivHP */ - { 17375, -1 }, /* ImageTransformParameterivHP */ + { 9257, -1 }, /* ImageTransformParameterfvHP */ + { 10915, -1 }, /* ImageTransformParameteriHP */ + { 11223, -1 }, /* GetImageTransformParameterivHP */ + { 17981, -1 }, /* ImageTransformParameterivHP */ { -1, -1 } }; #endif @@ -5485,13 +5623,13 @@ static const struct gl_function_remap GL_IBM_multimode_draw_arrays_functions[] = #if defined(need_GL_IBM_vertex_array_lists) static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = { { 3857, -1 }, /* SecondaryColorPointerListIBM */ - { 5167, -1 }, /* NormalPointerListIBM */ - { 6789, -1 }, /* FogCoordPointerListIBM */ - { 7096, -1 }, /* VertexPointerListIBM */ - { 10599, -1 }, /* ColorPointerListIBM */ - { 11894, -1 }, /* TexCoordPointerListIBM */ - { 12297, -1 }, /* IndexPointerListIBM */ - { 29409, -1 }, /* EdgeFlagPointerListIBM */ + { 5252, -1 }, /* NormalPointerListIBM */ + { 6908, -1 }, /* FogCoordPointerListIBM */ + { 7215, -1 }, /* VertexPointerListIBM */ + { 10836, -1 }, /* ColorPointerListIBM */ + { 12213, -1 }, /* TexCoordPointerListIBM */ + { 12646, -1 }, /* IndexPointerListIBM */ + { 30256, -1 }, /* EdgeFlagPointerListIBM */ { -1, -1 } }; #endif @@ -5505,10 +5643,10 @@ static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] = #if defined(need_GL_INTEL_parallel_arrays) static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = { - { 11281, -1 }, /* VertexPointervINTEL */ - { 13791, -1 }, /* ColorPointervINTEL */ - { 26868, -1 }, /* NormalPointervINTEL */ - { 27294, -1 }, /* TexCoordPointervINTEL */ + { 11600, -1 }, /* VertexPointervINTEL */ + { 14230, -1 }, /* ColorPointervINTEL */ + { 27679, -1 }, /* NormalPointervINTEL */ + { 28105, -1 }, /* TexCoordPointervINTEL */ { -1, -1 } }; #endif @@ -5525,7 +5663,7 @@ static const struct gl_function_remap GL_MESA_shader_debug_functions[] = { { 1522, -1 }, /* GetDebugLogLengthMESA */ { 3063, -1 }, /* ClearDebugLogMESA */ { 4018, -1 }, /* GetDebugLogMESA */ - { 27746, -1 }, /* CreateDebugObjectMESA */ + { 28593, -1 }, /* CreateDebugObjectMESA */ { -1, -1 } }; #endif @@ -5546,15 +5684,15 @@ static const struct gl_function_remap GL_NV_condtitional_render_functions[] = { #if defined(need_GL_NV_evaluators) static const struct gl_function_remap GL_NV_evaluators_functions[] = { - { 5834, -1 }, /* GetMapAttribParameterivNV */ - { 7551, -1 }, /* MapControlPointsNV */ - { 7650, -1 }, /* MapParameterfvNV */ - { 9461, -1 }, /* EvalMapsNV */ - { 15280, -1 }, /* GetMapAttribParameterfvNV */ - { 15446, -1 }, /* MapParameterivNV */ - { 22175, -1 }, /* GetMapParameterivNV */ - { 22673, -1 }, /* GetMapParameterfvNV */ - { 26204, -1 }, /* GetMapControlPointsNV */ + { 5947, -1 }, /* GetMapAttribParameterivNV */ + { 7670, -1 }, /* MapControlPointsNV */ + { 7769, -1 }, /* MapParameterfvNV */ + { 9662, -1 }, /* EvalMapsNV */ + { 15845, -1 }, /* GetMapAttribParameterfvNV */ + { 16011, -1 }, /* MapParameterivNV */ + { 22891, -1 }, /* GetMapParameterivNV */ + { 23389, -1 }, /* GetMapParameterfvNV */ + { 27015, -1 }, /* GetMapControlPointsNV */ { -1, -1 } }; #endif @@ -5589,8 +5727,8 @@ static const struct gl_function_remap GL_NV_register_combiners_functions[] = { #if defined(need_GL_NV_register_combiners2) static const struct gl_function_remap GL_NV_register_combiners2_functions[] = { - { 14183, -1 }, /* CombinerStageParameterfvNV */ - { 14498, -1 }, /* GetCombinerStageParameterfvNV */ + { 14700, -1 }, /* CombinerStageParameterfvNV */ + { 15015, -1 }, /* GetCombinerStageParameterfvNV */ { -1, -1 } }; #endif @@ -5618,23 +5756,23 @@ static const struct gl_function_remap GL_OES_EGL_image_functions[] = { #if defined(need_GL_PGI_misc_hints) static const struct gl_function_remap GL_PGI_misc_hints_functions[] = { - { 7735, -1 }, /* HintPGI */ + { 7854, -1 }, /* HintPGI */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_detail_texture) static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = { - { 14471, -1 }, /* GetDetailTexFuncSGIS */ - { 14791, -1 }, /* DetailTexFuncSGIS */ + { 14988, -1 }, /* GetDetailTexFuncSGIS */ + { 15308, -1 }, /* DetailTexFuncSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_fog_function) static const struct gl_function_remap GL_SGIS_fog_function_functions[] = { - { 24313, -1 }, /* FogFuncSGIS */ - { 24978, -1 }, /* GetFogFuncSGIS */ + { 25093, -1 }, /* FogFuncSGIS */ + { 25758, -1 }, /* GetFogFuncSGIS */ { -1, -1 } }; #endif @@ -5662,8 +5800,8 @@ static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = { #if defined(need_GL_SGIS_sharpen_texture) static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = { - { 5895, -1 }, /* GetSharpenTexFuncSGIS */ - { 19700, -1 }, /* SharpenTexFuncSGIS */ + { 6008, -1 }, /* GetSharpenTexFuncSGIS */ + { 20407, -1 }, /* SharpenTexFuncSGIS */ { -1, -1 } }; #endif @@ -5671,22 +5809,22 @@ static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = { #if defined(need_GL_SGIS_texture4D) static const struct gl_function_remap GL_SGIS_texture4D_functions[] = { { 894, -1 }, /* TexImage4DSGIS */ - { 14099, -1 }, /* TexSubImage4DSGIS */ + { 14538, -1 }, /* TexSubImage4DSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_texture_color_mask) static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = { - { 13497, -1 }, /* TextureColorMaskSGIS */ + { 13936, -1 }, /* TextureColorMaskSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_texture_filter4) static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = { - { 6072, -1 }, /* GetTexFilterFuncSGIS */ - { 14617, -1 }, /* TexFilterFuncSGIS */ + { 6185, -1 }, /* GetTexFilterFuncSGIS */ + { 15134, -1 }, /* TexFilterFuncSGIS */ { -1, -1 } }; #endif @@ -5695,17 +5833,17 @@ static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = { static const struct gl_function_remap GL_SGIX_async_functions[] = { { 3014, -1 }, /* AsyncMarkerSGIX */ { 3997, -1 }, /* FinishAsyncSGIX */ - { 4734, -1 }, /* PollAsyncSGIX */ - { 19847, -1 }, /* DeleteAsyncMarkersSGIX */ - { 19876, -1 }, /* IsAsyncMarkerSGIX */ - { 29206, -1 }, /* GenAsyncMarkersSGIX */ + { 4762, -1 }, /* PollAsyncSGIX */ + { 20554, -1 }, /* DeleteAsyncMarkersSGIX */ + { 20609, -1 }, /* IsAsyncMarkerSGIX */ + { 30053, -1 }, /* GenAsyncMarkersSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_flush_raster) static const struct gl_function_remap GL_SGIX_flush_raster_functions[] = { - { 6443, -1 }, /* FlushRasterSGIX */ + { 6562, -1 }, /* FlushRasterSGIX */ { -1, -1 } }; #endif @@ -5713,37 +5851,37 @@ static const struct gl_function_remap GL_SGIX_flush_raster_functions[] = { #if defined(need_GL_SGIX_fragment_lighting) static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = { { 2410, -1 }, /* FragmentMaterialfvSGIX */ - { 2906, -1 }, /* FragmentLightModelivSGIX */ - { 4685, -1 }, /* FragmentLightiSGIX */ - { 5575, -1 }, /* GetFragmentMaterialfvSGIX */ - { 7163, -1 }, /* FragmentMaterialfSGIX */ - { 7324, -1 }, /* GetFragmentLightivSGIX */ - { 8161, -1 }, /* FragmentLightModeliSGIX */ - { 9524, -1 }, /* FragmentLightivSGIX */ - { 9790, -1 }, /* GetFragmentMaterialivSGIX */ - { 17198, -1 }, /* FragmentLightModelfSGIX */ - { 17498, -1 }, /* FragmentColorMaterialSGIX */ - { 17898, -1 }, /* FragmentMaterialiSGIX */ - { 19119, -1 }, /* LightEnviSGIX */ - { 20530, -1 }, /* FragmentLightModelfvSGIX */ - { 20839, -1 }, /* FragmentLightfvSGIX */ - { 25454, -1 }, /* FragmentLightfSGIX */ - { 28122, -1 }, /* GetFragmentLightfvSGIX */ - { 29689, -1 }, /* FragmentMaterialivSGIX */ + { 4713, -1 }, /* FragmentLightiSGIX */ + { 5688, -1 }, /* GetFragmentMaterialfvSGIX */ + { 7282, -1 }, /* FragmentMaterialfSGIX */ + { 7443, -1 }, /* GetFragmentLightivSGIX */ + { 8280, -1 }, /* FragmentLightModeliSGIX */ + { 9725, -1 }, /* FragmentLightivSGIX */ + { 10027, -1 }, /* GetFragmentMaterialivSGIX */ + { 17804, -1 }, /* FragmentLightModelfSGIX */ + { 18104, -1 }, /* FragmentColorMaterialSGIX */ + { 18504, -1 }, /* FragmentMaterialiSGIX */ + { 19764, -1 }, /* LightEnviSGIX */ + { 21263, -1 }, /* FragmentLightModelfvSGIX */ + { 21572, -1 }, /* FragmentLightfvSGIX */ + { 26142, -1 }, /* FragmentLightModelivSGIX */ + { 26265, -1 }, /* FragmentLightfSGIX */ + { 28969, -1 }, /* GetFragmentLightfvSGIX */ + { 30536, -1 }, /* FragmentMaterialivSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_framezoom) static const struct gl_function_remap GL_SGIX_framezoom_functions[] = { - { 19899, -1 }, /* FrameZoomSGIX */ + { 20632, -1 }, /* FrameZoomSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_igloo_interface) static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = { - { 25762, -1 }, /* IglooInterfaceSGIX */ + { 26573, -1 }, /* IglooInterfaceSGIX */ { -1, -1 } }; #endif @@ -5751,11 +5889,11 @@ static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = { #if defined(need_GL_SGIX_instruments) static const struct gl_function_remap GL_SGIX_instruments_functions[] = { { 2573, -1 }, /* ReadInstrumentsSGIX */ - { 5651, -1 }, /* PollInstrumentsSGIX */ - { 9422, -1 }, /* GetInstrumentsSGIX */ - { 11492, -1 }, /* StartInstrumentsSGIX */ - { 14217, -1 }, /* StopInstrumentsSGIX */ - { 15823, -1 }, /* InstrumentsBufferSGIX */ + { 5764, -1 }, /* PollInstrumentsSGIX */ + { 9623, -1 }, /* GetInstrumentsSGIX */ + { 11811, -1 }, /* StartInstrumentsSGIX */ + { 14734, -1 }, /* StopInstrumentsSGIX */ + { 16388, -1 }, /* InstrumentsBufferSGIX */ { -1, -1 } }; #endif @@ -5764,10 +5902,10 @@ static const struct gl_function_remap GL_SGIX_instruments_functions[] = { static const struct gl_function_remap GL_SGIX_list_priority_functions[] = { { 1125, -1 }, /* ListParameterfSGIX */ { 2763, -1 }, /* GetListParameterfvSGIX */ - { 15738, -1 }, /* ListParameteriSGIX */ - { 16492, -1 }, /* ListParameterfvSGIX */ - { 18525, -1 }, /* ListParameterivSGIX */ - { 29250, -1 }, /* GetListParameterivSGIX */ + { 16303, -1 }, /* ListParameteriSGIX */ + { 17057, -1 }, /* ListParameterfvSGIX */ + { 19170, -1 }, /* ListParameterivSGIX */ + { 30097, -1 }, /* GetListParameterivSGIX */ { -1, -1 } }; #endif @@ -5782,53 +5920,53 @@ static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = { #if defined(need_GL_SGIX_polynomial_ffd) static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = { { 3251, -1 }, /* LoadIdentityDeformationMapSGIX */ - { 14317, -1 }, /* DeformSGIX */ - { 21724, -1 }, /* DeformationMap3fSGIX */ - { 28010, -1 }, /* DeformationMap3dSGIX */ + { 14834, -1 }, /* DeformSGIX */ + { 22440, -1 }, /* DeformationMap3fSGIX */ + { 28857, -1 }, /* DeformationMap3dSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_reference_plane) static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = { - { 13048, -1 }, /* ReferencePlaneSGIX */ + { 13487, -1 }, /* ReferencePlaneSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_sprite) static const struct gl_function_remap GL_SGIX_sprite_functions[] = { - { 8577, -1 }, /* SpriteParameterfvSGIX */ - { 18353, -1 }, /* SpriteParameteriSGIX */ - { 23752, -1 }, /* SpriteParameterfSGIX */ - { 26326, -1 }, /* SpriteParameterivSGIX */ + { 8778, -1 }, /* SpriteParameterfvSGIX */ + { 18959, -1 }, /* SpriteParameteriSGIX */ + { 24532, -1 }, /* SpriteParameterfSGIX */ + { 27137, -1 }, /* SpriteParameterivSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_tag_sample_buffer) static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = { - { 18412, -1 }, /* TagSampleBufferSGIX */ + { 19018, -1 }, /* TagSampleBufferSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGI_color_table) static const struct gl_function_remap GL_SGI_color_table_functions[] = { - { 6733, _gloffset_ColorTableParameteriv }, - { 7445, _gloffset_ColorTable }, - { 13544, _gloffset_GetColorTable }, - { 13654, _gloffset_CopyColorTable }, - { 17142, _gloffset_ColorTableParameterfv }, - { 20438, _gloffset_GetColorTableParameterfv }, - { 22431, _gloffset_GetColorTableParameteriv }, + { 6852, _gloffset_ColorTableParameteriv }, + { 7564, _gloffset_ColorTable }, + { 13983, _gloffset_GetColorTable }, + { 14093, _gloffset_CopyColorTable }, + { 17748, _gloffset_ColorTableParameterfv }, + { 21171, _gloffset_GetColorTableParameterfv }, + { 23147, _gloffset_GetColorTableParameteriv }, { -1, -1 } }; #endif #if defined(need_GL_SUNX_constant_data) static const struct gl_function_remap GL_SUNX_constant_data_functions[] = { - { 28100, -1 }, /* FinishTextureSUNX */ + { 28947, -1 }, /* FinishTextureSUNX */ { -1, -1 } }; #endif @@ -5837,19 +5975,19 @@ static const struct gl_function_remap GL_SUNX_constant_data_functions[] = { static const struct gl_function_remap GL_SUN_global_alpha_functions[] = { { 3035, -1 }, /* GlobalAlphaFactorubSUN */ { 4224, -1 }, /* GlobalAlphaFactoriSUN */ - { 5676, -1 }, /* GlobalAlphaFactordSUN */ - { 8661, -1 }, /* GlobalAlphaFactoruiSUN */ - { 9013, -1 }, /* GlobalAlphaFactorbSUN */ - { 11807, -1 }, /* GlobalAlphaFactorfSUN */ - { 11926, -1 }, /* GlobalAlphaFactorusSUN */ - { 20138, -1 }, /* GlobalAlphaFactorsSUN */ + { 5789, -1 }, /* GlobalAlphaFactordSUN */ + { 8862, -1 }, /* GlobalAlphaFactoruiSUN */ + { 9214, -1 }, /* GlobalAlphaFactorbSUN */ + { 12126, -1 }, /* GlobalAlphaFactorfSUN */ + { 12245, -1 }, /* GlobalAlphaFactorusSUN */ + { 20871, -1 }, /* GlobalAlphaFactorsSUN */ { -1, -1 } }; #endif #if defined(need_GL_SUN_mesh_array) static const struct gl_function_remap GL_SUN_mesh_array_functions[] = { - { 26138, -1 }, /* DrawMeshArraysSUN */ + { 26949, -1 }, /* DrawMeshArraysSUN */ { -1, -1 } }; #endif @@ -5857,12 +5995,12 @@ static const struct gl_function_remap GL_SUN_mesh_array_functions[] = { #if defined(need_GL_SUN_triangle_list) static const struct gl_function_remap GL_SUN_triangle_list_functions[] = { { 3971, -1 }, /* ReplacementCodeubSUN */ - { 5515, -1 }, /* ReplacementCodeubvSUN */ - { 16863, -1 }, /* ReplacementCodeusvSUN */ - { 17051, -1 }, /* ReplacementCodePointerSUN */ - { 18436, -1 }, /* ReplacementCodeusSUN */ - { 19183, -1 }, /* ReplacementCodeuiSUN */ - { 26783, -1 }, /* ReplacementCodeuivSUN */ + { 5600, -1 }, /* ReplacementCodeubvSUN */ + { 17469, -1 }, /* ReplacementCodeusvSUN */ + { 17657, -1 }, /* ReplacementCodePointerSUN */ + { 19828, -1 }, /* ReplacementCodeuiSUN */ + { 20583, -1 }, /* ReplacementCodeusSUN */ + { 27594, -1 }, /* ReplacementCodeuivSUN */ { -1, -1 } }; #endif @@ -5878,37 +6016,37 @@ static const struct gl_function_remap GL_SUN_vertex_functions[] = { { 2642, -1 }, /* Color4ubVertex3fvSUN */ { 4105, -1 }, /* Color4ubVertex3fSUN */ { 4181, -1 }, /* TexCoord2fVertex3fSUN */ - { 4480, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */ - { 4810, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */ - { 5410, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */ - { 6480, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */ - { 7192, -1 }, /* TexCoord2fNormal3fVertex3fSUN */ - { 7960, -1 }, /* Color3fVertex3fSUN */ - { 8972, -1 }, /* Color3fVertex3fvSUN */ - { 9387, -1 }, /* Color4fNormal3fVertex3fvSUN */ - { 10088, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */ - { 11355, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */ - { 12779, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */ - { 13190, -1 }, /* TexCoord2fColor3fVertex3fSUN */ - { 14242, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */ - { 14576, -1 }, /* Color4ubVertex2fvSUN */ - { 14816, -1 }, /* Normal3fVertex3fSUN */ - { 15764, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */ - { 16025, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */ - { 16692, -1 }, /* TexCoord2fVertex3fvSUN */ - { 17468, -1 }, /* Color4ubVertex2fSUN */ - { 17689, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */ - { 19571, -1 }, /* TexCoord2fColor4ubVertex3fSUN */ - { 19918, -1 }, /* Normal3fVertex3fvSUN */ - { 20347, -1 }, /* Color4fNormal3fVertex3fSUN */ - { 21256, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */ - { 21476, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */ - { 23206, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */ - { 24429, -1 }, /* TexCoord4fVertex4fSUN */ - { 24855, -1 }, /* TexCoord2fColor3fVertex3fvSUN */ - { 25181, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */ - { 25308, -1 }, /* TexCoord4fVertex4fvSUN */ - { 26010, -1 }, /* ReplacementCodeuiVertex3fSUN */ + { 4508, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */ + { 4866, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */ + { 5495, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */ + { 6240, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */ + { 6599, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */ + { 7311, -1 }, /* TexCoord2fNormal3fVertex3fSUN */ + { 8079, -1 }, /* Color3fVertex3fSUN */ + { 9173, -1 }, /* Color3fVertex3fvSUN */ + { 9588, -1 }, /* Color4fNormal3fVertex3fvSUN */ + { 10325, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */ + { 11674, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */ + { 13218, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */ + { 13629, -1 }, /* TexCoord2fColor3fVertex3fSUN */ + { 14759, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */ + { 15093, -1 }, /* Color4ubVertex2fvSUN */ + { 15333, -1 }, /* Normal3fVertex3fSUN */ + { 16329, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */ + { 16590, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */ + { 17298, -1 }, /* TexCoord2fVertex3fvSUN */ + { 18074, -1 }, /* Color4ubVertex2fSUN */ + { 18295, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */ + { 20253, -1 }, /* TexCoord2fColor4ubVertex3fSUN */ + { 20651, -1 }, /* Normal3fVertex3fvSUN */ + { 21080, -1 }, /* Color4fNormal3fVertex3fSUN */ + { 21989, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */ + { 23984, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */ + { 25209, -1 }, /* TexCoord4fVertex4fSUN */ + { 25635, -1 }, /* TexCoord2fColor3fVertex3fvSUN */ + { 25986, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */ + { 26113, -1 }, /* TexCoord4fVertex4fvSUN */ + { 26821, -1 }, /* ReplacementCodeuiVertex3fSUN */ { -1, -1 } }; #endif @@ -5919,37 +6057,37 @@ static const struct gl_function_remap GL_VERSION_1_3_functions[] = { { 381, _gloffset_MultiTexCoord3sARB }, { 613, _gloffset_ActiveTextureARB }, { 3761, _gloffset_MultiTexCoord1fvARB }, - { 5301, _gloffset_MultiTexCoord3dARB }, - { 5346, _gloffset_MultiTexCoord2iARB }, - { 5470, _gloffset_MultiTexCoord2svARB }, - { 7401, _gloffset_MultiTexCoord2fARB }, - { 9223, _gloffset_MultiTexCoord3fvARB }, - { 9744, _gloffset_MultiTexCoord4sARB }, - { 10378, _gloffset_MultiTexCoord2dvARB }, - { 10760, _gloffset_MultiTexCoord1svARB }, - { 11050, _gloffset_MultiTexCoord3svARB }, - { 11111, _gloffset_MultiTexCoord4iARB }, - { 11834, _gloffset_MultiTexCoord3iARB }, - { 12568, _gloffset_MultiTexCoord1dARB }, - { 12734, _gloffset_MultiTexCoord3dvARB }, - { 13898, _gloffset_MultiTexCoord3ivARB }, - { 13943, _gloffset_MultiTexCoord2sARB }, - { 15163, _gloffset_MultiTexCoord4ivARB }, - { 16792, _gloffset_ClientActiveTextureARB }, - { 19036, _gloffset_MultiTexCoord2dARB }, - { 19440, _gloffset_MultiTexCoord4dvARB }, - { 19726, _gloffset_MultiTexCoord4fvARB }, - { 20579, _gloffset_MultiTexCoord3fARB }, - { 22959, _gloffset_MultiTexCoord4dARB }, - { 23163, _gloffset_MultiTexCoord1sARB }, - { 23365, _gloffset_MultiTexCoord1dvARB }, - { 24175, _gloffset_MultiTexCoord1ivARB }, - { 24268, _gloffset_MultiTexCoord2ivARB }, - { 24607, _gloffset_MultiTexCoord1iARB }, - { 25878, _gloffset_MultiTexCoord4svARB }, - { 26396, _gloffset_MultiTexCoord1fARB }, - { 26659, _gloffset_MultiTexCoord4fARB }, - { 28927, _gloffset_MultiTexCoord2fvARB }, + { 5386, _gloffset_MultiTexCoord3dARB }, + { 5431, _gloffset_MultiTexCoord2iARB }, + { 5555, _gloffset_MultiTexCoord2svARB }, + { 7520, _gloffset_MultiTexCoord2fARB }, + { 9424, _gloffset_MultiTexCoord3fvARB }, + { 9981, _gloffset_MultiTexCoord4sARB }, + { 10615, _gloffset_MultiTexCoord2dvARB }, + { 10997, _gloffset_MultiTexCoord1svARB }, + { 11369, _gloffset_MultiTexCoord3svARB }, + { 11430, _gloffset_MultiTexCoord4iARB }, + { 12153, _gloffset_MultiTexCoord3iARB }, + { 12956, _gloffset_MultiTexCoord1dARB }, + { 13173, _gloffset_MultiTexCoord3dvARB }, + { 14337, _gloffset_MultiTexCoord3ivARB }, + { 14382, _gloffset_MultiTexCoord2sARB }, + { 15680, _gloffset_MultiTexCoord4ivARB }, + { 17398, _gloffset_ClientActiveTextureARB }, + { 19681, _gloffset_MultiTexCoord2dARB }, + { 20122, _gloffset_MultiTexCoord4dvARB }, + { 20433, _gloffset_MultiTexCoord4fvARB }, + { 21312, _gloffset_MultiTexCoord3fARB }, + { 23675, _gloffset_MultiTexCoord4dARB }, + { 23941, _gloffset_MultiTexCoord1sARB }, + { 24145, _gloffset_MultiTexCoord1dvARB }, + { 24955, _gloffset_MultiTexCoord1ivARB }, + { 25048, _gloffset_MultiTexCoord2ivARB }, + { 25387, _gloffset_MultiTexCoord1iARB }, + { 26689, _gloffset_MultiTexCoord4svARB }, + { 27207, _gloffset_MultiTexCoord1fARB }, + { 27470, _gloffset_MultiTexCoord4fARB }, + { 29774, _gloffset_MultiTexCoord2fvARB }, { -1, -1 } }; #endif @@ -5982,3 +6120,17 @@ static const struct gl_function_remap GL_VERSION_2_1_functions[] = { }; #endif +#if defined(need_GL_VERSION_3_0) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_VERSION_3_0_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_VERSION_3_1) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_VERSION_3_1_functions[] = { + { -1, -1 } +}; +#endif + diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c index 4d7b0aff0..adc1199d8 100644 --- a/mesalib/src/mesa/main/renderbuffer.c +++ b/mesalib/src/mesa/main/renderbuffer.c @@ -49,12 +49,6 @@ #include "fbobject.h" #include "renderbuffer.h" -#include "rbadaptors.h" - - -/* 32-bit color index format. Not a public format. */ -#define COLOR_INDEX32 0x424243 - /* * Routines for get/put values in common buffer formats follow. @@ -992,6 +986,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, pixelSize = 4 * sizeof(GLubyte); break; case GL_RGBA16: + case GL_RGBA16_SNORM: /* for accum buffer */ rb->Format = MESA_FORMAT_SIGNED_RGBA_16; rb->DataType = GL_SHORT; @@ -1091,21 +1086,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoValues = put_mono_values_uint; pixelSize = sizeof(GLuint); break; - case GL_COLOR_INDEX8_EXT: - case GL_COLOR_INDEX16_EXT: - case COLOR_INDEX32: - rb->Format = MESA_FORMAT_CI8; - rb->DataType = GL_UNSIGNED_BYTE; - rb->GetPointer = get_pointer_ubyte; - rb->GetRow = get_row_ubyte; - rb->GetValues = get_values_ubyte; - rb->PutRow = put_row_ubyte; - rb->PutRowRGB = NULL; - rb->PutMonoRow = put_mono_row_ubyte; - rb->PutValues = put_values_ubyte; - rb->PutMonoValues = put_mono_values_ubyte; - pixelSize = sizeof(GLubyte); - break; default: _mesa_problem(ctx, "Bad internalFormat in _mesa_soft_renderbuffer_storage"); return GL_FALSE; @@ -1777,7 +1757,7 @@ _mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, } rb->Format = MESA_FORMAT_SIGNED_RGBA_16; - rb->InternalFormat = GL_RGBA16; + rb->InternalFormat = GL_RGBA16_SNORM; rb->AllocStorage = _mesa_soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, BUFFER_ACCUM, rb); @@ -1909,8 +1889,6 @@ void _mesa_add_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName, struct gl_renderbuffer *rb) { - GLenum baseFormat; - assert(fb); assert(rb); assert(bufferName < BUFFER_COUNT); @@ -1931,26 +1909,6 @@ _mesa_add_renderbuffer(struct gl_framebuffer *fb, assert(!rb->Name); } - /* If Mesa's compiled with deep color channels (16 or 32 bits / channel) - * and the device driver is expecting 8-bit values (GLubyte), we can - * use a "renderbuffer adaptor/wrapper" to do the necessary conversions. - */ - baseFormat = _mesa_get_format_base_format(rb->Format); - if (baseFormat == GL_RGBA) { - if (CHAN_BITS == 16 && rb->DataType == GL_UNSIGNED_BYTE) { - GET_CURRENT_CONTEXT(ctx); - rb = _mesa_new_renderbuffer_16wrap8(ctx, rb); - } - else if (CHAN_BITS == 32 && rb->DataType == GL_UNSIGNED_BYTE) { - GET_CURRENT_CONTEXT(ctx); - rb = _mesa_new_renderbuffer_32wrap8(ctx, rb); - } - else if (CHAN_BITS == 32 && rb->DataType == GL_UNSIGNED_SHORT) { - GET_CURRENT_CONTEXT(ctx); - rb = _mesa_new_renderbuffer_32wrap16(ctx, rb); - } - } - fb->Attachment[bufferName].Type = GL_RENDERBUFFER_EXT; fb->Attachment[bufferName].Complete = GL_TRUE; _mesa_reference_renderbuffer(&fb->Attachment[bufferName].Renderbuffer, rb); diff --git a/mesalib/src/mesa/main/renderbuffer.h b/mesalib/src/mesa/main/renderbuffer.h index 7c205e141..bc92b2698 100644 --- a/mesalib/src/mesa/main/renderbuffer.h +++ b/mesalib/src/mesa/main/renderbuffer.h @@ -26,6 +26,11 @@ #ifndef RENDERBUFFER_H #define RENDERBUFFER_H +#include "glheader.h" +#include "mtypes.h" + +struct gl_framebuffer; +struct gl_renderbuffer; extern void _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name); diff --git a/mesalib/src/mesa/main/restart.c b/mesalib/src/mesa/main/restart.c new file mode 100644 index 000000000..ff366496f --- /dev/null +++ b/mesalib/src/mesa/main/restart.c @@ -0,0 +1,68 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#include "glheader.h" +#include "imports.h" +#include "context.h" +#include "restart.h" + + +/** + */ +void GLAPIENTRY +_mesa_PrimitiveRestart(void) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestart()"); + return; + } + + /* XXX call into vbo module */ +} + + + +/** + */ +void GLAPIENTRY +_mesa_PrimitiveRestartIndex(GLuint index) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndex()"); + return; + } + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + + ctx->Array.RestartIndex = index; +} diff --git a/mesalib/src/mesa/main/restart.h b/mesalib/src/mesa/main/restart.h new file mode 100644 index 000000000..25f58f24c --- /dev/null +++ b/mesalib/src/mesa/main/restart.h @@ -0,0 +1,41 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +#ifndef RESTART_H +#define RESTART_H + +#include "glheader.h" + +extern void GLAPIENTRY +_mesa_PrimitiveRestart(void); + + +extern void GLAPIENTRY +_mesa_PrimitiveRestartIndex(GLuint index); + + +#endif diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c new file mode 100644 index 000000000..c25d2a197 --- /dev/null +++ b/mesalib/src/mesa/main/shaderapi.c @@ -0,0 +1,1642 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2004-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009-2010 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file shaderapi.c + * \author Brian Paul + * + * Implementation of GLSL-related API functions. + * The glUniform* functions are in uniforms.c + * + * + * XXX things to do: + * 1. Check that the right error code is generated for all _mesa_error() calls. + * 2. Insert FLUSH_VERTICES calls in various places + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/dispatch.h" +#include "main/enums.h" +#include "main/hash.h" +#include "main/shaderapi.h" +#include "main/shaderobj.h" +#include "program/program.h" +#include "program/prog_parameter.h" +#include "program/prog_uniform.h" +#include "talloc.h" + + +/** Define this to enable shader substitution (see below) */ +#define SHADER_SUBST 0 + + +/** + * Return mask of GLSL_x flags by examining the MESA_GLSL env var. + */ +static GLbitfield +get_shader_flags(void) +{ + GLbitfield flags = 0x0; + const char *env = _mesa_getenv("MESA_GLSL"); + + if (env) { + if (strstr(env, "dump")) + flags |= GLSL_DUMP; + if (strstr(env, "log")) + flags |= GLSL_LOG; + if (strstr(env, "nopvert")) + flags |= GLSL_NOP_VERT; + if (strstr(env, "nopfrag")) + flags |= GLSL_NOP_FRAG; + if (strstr(env, "nopt")) + flags |= GLSL_NO_OPT; + else if (strstr(env, "opt")) + flags |= GLSL_OPT; + if (strstr(env, "uniform")) + flags |= GLSL_UNIFORMS; + if (strstr(env, "useprog")) + flags |= GLSL_USE_PROG; + } + + return flags; +} + + +/** + * Initialize context's shader state. + */ +void +_mesa_init_shader_state(GLcontext *ctx) +{ + /* Device drivers may override these to control what kind of instructions + * are generated by the GLSL compiler. + */ + struct gl_shader_compiler_options options; + GLuint i; + + memset(&options, 0, sizeof(options)); + options.MaxUnrollIterations = 32; + + /* Default pragma settings */ + options.DefaultPragmas.Optimize = GL_TRUE; + + for(i = 0; i < MESA_SHADER_TYPES; ++i) + memcpy(&ctx->ShaderCompilerOptions[i], &options, sizeof(options)); + + ctx->Shader.Flags = get_shader_flags(); +} + + +/** + * Free the per-context shader-related state. + */ +void +_mesa_free_shader_state(GLcontext *ctx) +{ + _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, NULL); +} + + +/** + * Return the size of the given GLSL datatype, in floats (components). + */ +GLint +_mesa_sizeof_glsl_type(GLenum type) +{ + switch (type) { + case GL_FLOAT: + case GL_INT: + case GL_BOOL: + case GL_SAMPLER_1D: + case GL_SAMPLER_2D: + case GL_SAMPLER_3D: + case GL_SAMPLER_CUBE: + case GL_SAMPLER_1D_SHADOW: + case GL_SAMPLER_2D_SHADOW: + case GL_SAMPLER_2D_RECT_ARB: + case GL_SAMPLER_2D_RECT_SHADOW_ARB: + case GL_SAMPLER_1D_ARRAY_EXT: + case GL_SAMPLER_2D_ARRAY_EXT: + case GL_SAMPLER_1D_ARRAY_SHADOW_EXT: + case GL_SAMPLER_2D_ARRAY_SHADOW_EXT: + case GL_SAMPLER_CUBE_SHADOW_EXT: + return 1; + case GL_FLOAT_VEC2: + case GL_INT_VEC2: + case GL_UNSIGNED_INT_VEC2: + case GL_BOOL_VEC2: + return 2; + case GL_FLOAT_VEC3: + case GL_INT_VEC3: + case GL_UNSIGNED_INT_VEC3: + case GL_BOOL_VEC3: + return 3; + case GL_FLOAT_VEC4: + case GL_INT_VEC4: + case GL_UNSIGNED_INT_VEC4: + case GL_BOOL_VEC4: + return 4; + case GL_FLOAT_MAT2: + case GL_FLOAT_MAT2x3: + case GL_FLOAT_MAT2x4: + return 8; /* two float[4] vectors */ + case GL_FLOAT_MAT3: + case GL_FLOAT_MAT3x2: + case GL_FLOAT_MAT3x4: + return 12; /* three float[4] vectors */ + case GL_FLOAT_MAT4: + case GL_FLOAT_MAT4x2: + case GL_FLOAT_MAT4x3: + return 16; /* four float[4] vectors */ + default: + _mesa_problem(NULL, "Invalid type in _mesa_sizeof_glsl_type()"); + return 1; + } +} + + +/** + * Copy string from <src> to <dst>, up to maxLength characters, returning + * length of <dst> in <length>. + * \param src the strings source + * \param maxLength max chars to copy + * \param length returns number of chars copied + * \param dst the string destination + */ +void +_mesa_copy_string(GLchar *dst, GLsizei maxLength, + GLsizei *length, const GLchar *src) +{ + GLsizei len; + for (len = 0; len < maxLength - 1 && src && src[len]; len++) + dst[len] = src[len]; + if (maxLength > 0) + dst[len] = 0; + if (length) + *length = len; +} + + + +/** + * Find the length of the longest transform feedback varying name + * which was specified with glTransformFeedbackVaryings(). + */ +static GLint +longest_feedback_varying_name(const struct gl_shader_program *shProg) +{ + GLuint i; + GLint max = 0; + for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) { + GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]); + if (len > max) + max = len; + } + return max; +} + + + +static GLboolean +is_program(GLcontext *ctx, GLuint name) +{ + struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name); + return shProg ? GL_TRUE : GL_FALSE; +} + + +static GLboolean +is_shader(GLcontext *ctx, GLuint name) +{ + struct gl_shader *shader = _mesa_lookup_shader(ctx, name); + return shader ? GL_TRUE : GL_FALSE; +} + + +/** + * Attach shader to a shader program. + */ +static void +attach_shader(GLcontext *ctx, GLuint program, GLuint shader) +{ + struct gl_shader_program *shProg; + struct gl_shader *sh; + GLuint i, n; + + shProg = _mesa_lookup_shader_program_err(ctx, program, "glAttachShader"); + if (!shProg) + return; + + sh = _mesa_lookup_shader_err(ctx, shader, "glAttachShader"); + if (!sh) { + return; + } + + n = shProg->NumShaders; + for (i = 0; i < n; i++) { + if (shProg->Shaders[i] == sh) { + /* The shader is already attched to this program. The + * GL_ARB_shader_objects spec says: + * + * "The error INVALID_OPERATION is generated by AttachObjectARB + * if <obj> is already attached to <containerObj>." + */ + _mesa_error(ctx, GL_INVALID_OPERATION, "glAttachShader"); + return; + } + } + + /* grow list */ + shProg->Shaders = (struct gl_shader **) + _mesa_realloc(shProg->Shaders, + n * sizeof(struct gl_shader *), + (n + 1) * sizeof(struct gl_shader *)); + if (!shProg->Shaders) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader"); + return; + } + + /* append */ + shProg->Shaders[n] = NULL; /* since realloc() didn't zero the new space */ + _mesa_reference_shader(ctx, &shProg->Shaders[n], sh); + shProg->NumShaders++; +} + + +static GLint +get_attrib_location(GLcontext *ctx, GLuint program, const GLchar *name) +{ + struct gl_shader_program *shProg + = _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation"); + + if (!shProg) { + return -1; + } + + if (!shProg->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetAttribLocation(program not linked)"); + return -1; + } + + if (!name) + return -1; + + if (shProg->VertexProgram) { + const struct gl_program_parameter_list *attribs = + shProg->VertexProgram->Base.Attributes; + if (attribs) { + GLint i = _mesa_lookup_parameter_index(attribs, -1, name); + if (i >= 0) { + return attribs->Parameters[i].StateIndexes[0]; + } + } + } + return -1; +} + + +static void +bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, + const GLchar *name) +{ + struct gl_shader_program *shProg; + const GLint size = -1; /* unknown size */ + GLint i, oldIndex; + GLenum datatype = GL_FLOAT_VEC4; + + shProg = _mesa_lookup_shader_program_err(ctx, program, + "glBindAttribLocation"); + if (!shProg) { + return; + } + + if (!name) + return; + + if (strncmp(name, "gl_", 3) == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindAttribLocation(illegal name)"); + return; + } + + if (index >= ctx->Const.VertexProgram.MaxAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindAttribLocation(index)"); + return; + } + + if (shProg->LinkStatus) { + /* get current index/location for the attribute */ + oldIndex = get_attrib_location(ctx, program, name); + } + else { + oldIndex = -1; + } + + /* this will replace the current value if it's already in the list */ + i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index); + if (i < 0) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindAttribLocation"); + return; + } + + /* + * Note that this attribute binding won't go into effect until + * glLinkProgram is called again. + */ +} + + +static GLuint +create_shader(GLcontext *ctx, GLenum type) +{ + struct gl_shader *sh; + GLuint name; + + name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1); + + switch (type) { + case GL_FRAGMENT_SHADER: + case GL_VERTEX_SHADER: + case GL_GEOMETRY_SHADER_ARB: + sh = ctx->Driver.NewShader(ctx, name, type); + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "CreateShader(type)"); + return 0; + } + + _mesa_HashInsert(ctx->Shared->ShaderObjects, name, sh); + + return name; +} + + +static GLuint +create_shader_program(GLcontext *ctx) +{ + GLuint name; + struct gl_shader_program *shProg; + + name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1); + + shProg = ctx->Driver.NewShaderProgram(ctx, name); + + _mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg); + + assert(shProg->RefCount == 1); + + return name; +} + + +/** + * Named w/ "2" to indicate OpenGL 2.x vs GL_ARB_fragment_programs's + * DeleteProgramARB. + */ +static void +delete_shader_program(GLcontext *ctx, GLuint name) +{ + /* + * NOTE: deleting shaders/programs works a bit differently than + * texture objects (and buffer objects, etc). Shader/program + * handles/IDs exist in the hash table until the object is really + * deleted (refcount==0). With texture objects, the handle/ID is + * removed from the hash table in glDeleteTextures() while the tex + * object itself might linger until its refcount goes to zero. + */ + struct gl_shader_program *shProg; + + shProg = _mesa_lookup_shader_program_err(ctx, name, "glDeleteProgram"); + if (!shProg) + return; + + shProg->DeletePending = GL_TRUE; + + /* effectively, decr shProg's refcount */ + _mesa_reference_shader_program(ctx, &shProg, NULL); +} + + +static void +delete_shader(GLcontext *ctx, GLuint shader) +{ + struct gl_shader *sh; + + sh = _mesa_lookup_shader_err(ctx, shader, "glDeleteShader"); + if (!sh) + return; + + sh->DeletePending = GL_TRUE; + + /* effectively, decr sh's refcount */ + _mesa_reference_shader(ctx, &sh, NULL); +} + + +static void +detach_shader(GLcontext *ctx, GLuint program, GLuint shader) +{ + struct gl_shader_program *shProg; + GLuint n; + GLuint i, j; + + shProg = _mesa_lookup_shader_program_err(ctx, program, "glDetachShader"); + if (!shProg) + return; + + n = shProg->NumShaders; + + for (i = 0; i < n; i++) { + if (shProg->Shaders[i]->Name == shader) { + /* found it */ + struct gl_shader **newList; + + /* release */ + _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL); + + /* alloc new, smaller array */ + newList = (struct gl_shader **) + malloc((n - 1) * sizeof(struct gl_shader *)); + if (!newList) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader"); + return; + } + for (j = 0; j < i; j++) { + newList[j] = shProg->Shaders[j]; + } + while (++i < n) + newList[j++] = shProg->Shaders[i]; + free(shProg->Shaders); + + shProg->Shaders = newList; + shProg->NumShaders = n - 1; + +#ifdef DEBUG + /* sanity check */ + { + for (j = 0; j < shProg->NumShaders; j++) { + assert(shProg->Shaders[j]->Type == GL_VERTEX_SHADER || + shProg->Shaders[j]->Type == GL_FRAGMENT_SHADER); + assert(shProg->Shaders[j]->RefCount > 0); + } + } +#endif + + return; + } + } + + /* not found */ + { + GLenum err; + if (is_shader(ctx, shader)) + err = GL_INVALID_OPERATION; + else if (is_program(ctx, shader)) + err = GL_INVALID_OPERATION; + else + err = GL_INVALID_VALUE; + _mesa_error(ctx, err, "glDetachProgram(shader)"); + return; + } +} + + +static void +get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, + GLsizei maxLength, GLsizei *length, GLint *size, + GLenum *type, GLchar *nameOut) +{ + const struct gl_program_parameter_list *attribs = NULL; + struct gl_shader_program *shProg; + + shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib"); + if (!shProg) + return; + + if (shProg->VertexProgram) + attribs = shProg->VertexProgram->Base.Attributes; + + if (!attribs || index >= attribs->NumParameters) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveAttrib(index)"); + return; + } + + _mesa_copy_string(nameOut, maxLength, length, + attribs->Parameters[index].Name); + + if (size) + *size = attribs->Parameters[index].Size + / _mesa_sizeof_glsl_type(attribs->Parameters[index].DataType); + + if (type) + *type = attribs->Parameters[index].DataType; +} + + +/** + * Return list of shaders attached to shader program. + */ +static void +get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, + GLsizei *count, GLuint *obj) +{ + struct gl_shader_program *shProg = + _mesa_lookup_shader_program_err(ctx, program, "glGetAttachedShaders"); + if (shProg) { + GLuint i; + for (i = 0; i < (GLuint) maxCount && i < shProg->NumShaders; i++) { + obj[i] = shProg->Shaders[i]->Name; + } + if (count) + *count = i; + } +} + + +/** + * glGetHandleARB() - return ID/name of currently bound shader program. + */ +static GLuint +get_handle(GLcontext *ctx, GLenum pname) +{ + if (pname == GL_PROGRAM_OBJECT_ARB) { + if (ctx->Shader.CurrentProgram) + return ctx->Shader.CurrentProgram->Name; + else + return 0; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetHandleARB"); + return 0; + } +} + + +/** + * glGetProgramiv() - get shader program state. + * Note that this is for GLSL shader programs, not ARB vertex/fragment + * programs (see glGetProgramivARB). + */ +static void +get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) +{ + const struct gl_program_parameter_list *attribs; + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); + + if (!shProg) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramiv(program)"); + return; + } + + if (shProg->VertexProgram) + attribs = shProg->VertexProgram->Base.Attributes; + else + attribs = NULL; + + switch (pname) { + case GL_DELETE_STATUS: + *params = shProg->DeletePending; + break; + case GL_LINK_STATUS: + *params = shProg->LinkStatus; + break; + case GL_VALIDATE_STATUS: + *params = shProg->Validated; + break; + case GL_INFO_LOG_LENGTH: + *params = shProg->InfoLog ? strlen(shProg->InfoLog) + 1 : 0; + break; + case GL_ATTACHED_SHADERS: + *params = shProg->NumShaders; + break; + case GL_ACTIVE_ATTRIBUTES: + *params = attribs ? attribs->NumParameters : 0; + break; + case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: + *params = _mesa_longest_parameter_name(attribs, PROGRAM_INPUT) + 1; + break; + case GL_ACTIVE_UNIFORMS: + *params = shProg->Uniforms ? shProg->Uniforms->NumUniforms : 0; + break; + case GL_ACTIVE_UNIFORM_MAX_LENGTH: + *params = _mesa_longest_uniform_name(shProg->Uniforms); + if (*params > 0) + (*params)++; /* add one for terminating zero */ + break; + case GL_PROGRAM_BINARY_LENGTH_OES: + *params = 0; + break; +#if FEATURE_EXT_transform_feedback + case GL_TRANSFORM_FEEDBACK_VARYINGS: + *params = shProg->TransformFeedback.NumVarying; + break; + case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: + *params = longest_feedback_varying_name(shProg) + 1; + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: + *params = shProg->TransformFeedback.BufferMode; + break; +#endif +#if FEATURE_ARB_geometry_shader4 + case GL_GEOMETRY_VERTICES_OUT_ARB: + *params = shProg->Geom.VerticesOut; + break; + case GL_GEOMETRY_INPUT_TYPE_ARB: + *params = shProg->Geom.InputType; + break; + case GL_GEOMETRY_OUTPUT_TYPE_ARB: + *params = shProg->Geom.OutputType; + break; +#endif + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)"); + return; + } +} + + +/** + * glGetShaderiv() - get GLSL shader state + */ +static void +get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params) +{ + struct gl_shader *shader = + _mesa_lookup_shader_err(ctx, name, "glGetShaderiv"); + + if (!shader) { + return; + } + + switch (pname) { + case GL_SHADER_TYPE: + *params = shader->Type; + break; + case GL_DELETE_STATUS: + *params = shader->DeletePending; + break; + case GL_COMPILE_STATUS: + *params = shader->CompileStatus; + break; + case GL_INFO_LOG_LENGTH: + *params = shader->InfoLog ? strlen(shader->InfoLog) + 1 : 0; + break; + case GL_SHADER_SOURCE_LENGTH: + *params = shader->Source ? strlen((char *) shader->Source) + 1 : 0; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetShaderiv(pname)"); + return; + } +} + + +static void +get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize, + GLsizei *length, GLchar *infoLog) +{ + struct gl_shader_program *shProg + = _mesa_lookup_shader_program(ctx, program); + if (!shProg) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramInfoLog(program)"); + return; + } + _mesa_copy_string(infoLog, bufSize, length, shProg->InfoLog); +} + + +static void +get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize, + GLsizei *length, GLchar *infoLog) +{ + struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); + if (!sh) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderInfoLog(shader)"); + return; + } + _mesa_copy_string(infoLog, bufSize, length, sh->InfoLog); +} + + +/** + * Return shader source code. + */ +static void +get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength, + GLsizei *length, GLchar *sourceOut) +{ + struct gl_shader *sh; + sh = _mesa_lookup_shader_err(ctx, shader, "glGetShaderSource"); + if (!sh) { + return; + } + _mesa_copy_string(sourceOut, maxLength, length, sh->Source); +} + + +/** + * Set/replace shader source code. + */ +static void +shader_source(GLcontext *ctx, GLuint shader, const GLchar *source) +{ + struct gl_shader *sh; + + sh = _mesa_lookup_shader_err(ctx, shader, "glShaderSource"); + if (!sh) + return; + + /* free old shader source string and install new one */ + if (sh->Source) { + free((void *) sh->Source); + } + sh->Source = source; + sh->CompileStatus = GL_FALSE; +#ifdef DEBUG + sh->SourceChecksum = _mesa_str_checksum(sh->Source); +#endif +} + + +/** + * Compile a shader. + */ +static void +compile_shader(GLcontext *ctx, GLuint shaderObj) +{ + struct gl_shader *sh; + struct gl_shader_compiler_options *options; + + sh = _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader"); + if (!sh) + return; + + options = &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(sh->Type)]; + + /* set default pragma state for shader */ + sh->Pragmas = options->DefaultPragmas; + + /* this call will set the sh->CompileStatus field to indicate if + * compilation was successful. + */ + _mesa_glsl_compile_shader(ctx, sh); +} + + +/** + * Link a program's shaders. + */ +static void +link_program(GLcontext *ctx, GLuint program) +{ + struct gl_shader_program *shProg; + struct gl_transform_feedback_object *obj = + ctx->TransformFeedback.CurrentObject; + + shProg = _mesa_lookup_shader_program_err(ctx, program, "glLinkProgram"); + if (!shProg) + return; + + if (obj->Active && shProg == ctx->Shader.CurrentProgram) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glLinkProgram(transform feedback active"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + + _mesa_glsl_link_shader(ctx, shProg); + + /* debug code */ + if (0) { + GLuint i; + + printf("Link %u shaders in program %u: %s\n", + shProg->NumShaders, shProg->Name, + shProg->LinkStatus ? "Success" : "Failed"); + + for (i = 0; i < shProg->NumShaders; i++) { + printf(" shader %u, type 0x%x\n", + shProg->Shaders[i]->Name, + shProg->Shaders[i]->Type); + } + } +} + + +/** + * Print basic shader info (for debug). + */ +static void +print_shader_info(const struct gl_shader_program *shProg) +{ + GLuint i; + + printf("Mesa: glUseProgram(%u)\n", shProg->Name); + for (i = 0; i < shProg->NumShaders; i++) { + const char *s; + switch (shProg->Shaders[i]->Type) { + case GL_VERTEX_SHADER: + s = "vertex"; + break; + case GL_FRAGMENT_SHADER: + s = "fragment"; + break; + case GL_GEOMETRY_SHADER: + s = "geometry"; + break; + default: + s = ""; + } + printf(" %s shader %u, checksum %u\n", s, + shProg->Shaders[i]->Name, + shProg->Shaders[i]->SourceChecksum); + } + if (shProg->VertexProgram) + printf(" vert prog %u\n", shProg->VertexProgram->Base.Id); + if (shProg->FragmentProgram) + printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id); +} + + +/** + * Use the named shader program for subsequent rendering. + */ +void +_mesa_use_program(GLcontext *ctx, GLuint program) +{ + struct gl_shader_program *shProg; + struct gl_transform_feedback_object *obj = + ctx->TransformFeedback.CurrentObject; + + if (obj->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUseProgram(transform feedback active)"); + return; + } + + if (ctx->Shader.CurrentProgram && + ctx->Shader.CurrentProgram->Name == program) { + /* no-op */ + return; + } + + if (program) { + shProg = _mesa_lookup_shader_program_err(ctx, program, "glUseProgram"); + if (!shProg) { + return; + } + if (!shProg->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUseProgram(program %u not linked)", program); + return; + } + + /* debug code */ + if (ctx->Shader.Flags & GLSL_USE_PROG) { + print_shader_info(shProg); + } + } + else { + shProg = NULL; + } + + if (ctx->Shader.CurrentProgram != shProg) { + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, shProg); + } + + if (ctx->Driver.UseProgram) + ctx->Driver.UseProgram(ctx, shProg); +} + + +/** + * Validate a program's samplers. + * Specifically, check that there aren't two samplers of different types + * pointing to the same texture unit. + * \return GL_TRUE if valid, GL_FALSE if invalid + */ +static GLboolean +validate_samplers(GLcontext *ctx, const struct gl_program *prog, char *errMsg) +{ + static const char *targetName[] = { + "TEXTURE_2D_ARRAY", + "TEXTURE_1D_ARRAY", + "TEXTURE_CUBE", + "TEXTURE_3D", + "TEXTURE_RECT", + "TEXTURE_2D", + "TEXTURE_1D", + }; + GLint targetUsed[MAX_TEXTURE_IMAGE_UNITS]; + GLbitfield samplersUsed = prog->SamplersUsed; + GLuint i; + + assert(Elements(targetName) == NUM_TEXTURE_TARGETS); + + if (samplersUsed == 0x0) + return GL_TRUE; + + for (i = 0; i < Elements(targetUsed); i++) + targetUsed[i] = -1; + + /* walk over bits which are set in 'samplers' */ + while (samplersUsed) { + GLuint unit; + gl_texture_index target; + GLint sampler = _mesa_ffs(samplersUsed) - 1; + assert(sampler >= 0); + assert(sampler < MAX_TEXTURE_IMAGE_UNITS); + unit = prog->SamplerUnits[sampler]; + target = prog->SamplerTargets[sampler]; + if (targetUsed[unit] != -1 && targetUsed[unit] != target) { + _mesa_snprintf(errMsg, 100, + "Texture unit %d is accessed both as %s and %s", + unit, targetName[targetUsed[unit]], targetName[target]); + return GL_FALSE; + } + targetUsed[unit] = target; + samplersUsed ^= (1 << sampler); + } + + return GL_TRUE; +} + + +/** + * Do validation of the given shader program. + * \param errMsg returns error message if validation fails. + * \return GL_TRUE if valid, GL_FALSE if invalid (and set errMsg) + */ +static GLboolean +validate_shader_program(GLcontext *ctx, + const struct gl_shader_program *shProg, + char *errMsg) +{ + const struct gl_vertex_program *vp = shProg->VertexProgram; + const struct gl_fragment_program *fp = shProg->FragmentProgram; + + if (!shProg->LinkStatus) { + return GL_FALSE; + } + + /* From the GL spec, a program is invalid if any of these are true: + + any two active samplers in the current program object are of + different types, but refer to the same texture image unit, + + any active sampler in the current program object refers to a texture + image unit where fixed-function fragment processing accesses a + texture target that does not match the sampler type, or + + the sum of the number of active samplers in the program and the + number of texture image units enabled for fixed-function fragment + processing exceeds the combined limit on the total number of texture + image units allowed. + */ + + + /* + * Check: any two active samplers in the current program object are of + * different types, but refer to the same texture image unit, + */ + if (vp && !validate_samplers(ctx, &vp->Base, errMsg)) { + return GL_FALSE; + } + if (fp && !validate_samplers(ctx, &fp->Base, errMsg)) { + return GL_FALSE; + } + + return GL_TRUE; +} + + +/** + * Called via glValidateProgram() + */ +static void +validate_program(GLcontext *ctx, GLuint program) +{ + struct gl_shader_program *shProg; + char errMsg[100]; + + shProg = _mesa_lookup_shader_program_err(ctx, program, "glValidateProgram"); + if (!shProg) { + return; + } + + shProg->Validated = validate_shader_program(ctx, shProg, errMsg); + if (!shProg->Validated) { + /* update info log */ + if (shProg->InfoLog) { + talloc_free(shProg->InfoLog); + } + shProg->InfoLog = talloc_strdup(shProg, errMsg); + } +} + + + +void GLAPIENTRY +_mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader) +{ + GET_CURRENT_CONTEXT(ctx); + attach_shader(ctx, program, shader); +} + + +void GLAPIENTRY +_mesa_AttachShader(GLuint program, GLuint shader) +{ + GET_CURRENT_CONTEXT(ctx); + attach_shader(ctx, program, shader); +} + + +void GLAPIENTRY +_mesa_BindAttribLocationARB(GLhandleARB program, GLuint index, + const GLcharARB *name) +{ + GET_CURRENT_CONTEXT(ctx); + bind_attrib_location(ctx, program, index, name); +} + + +void GLAPIENTRY +_mesa_CompileShaderARB(GLhandleARB shaderObj) +{ + GET_CURRENT_CONTEXT(ctx); + compile_shader(ctx, shaderObj); +} + + +GLuint GLAPIENTRY +_mesa_CreateShader(GLenum type) +{ + GET_CURRENT_CONTEXT(ctx); + return create_shader(ctx, type); +} + + +GLhandleARB GLAPIENTRY +_mesa_CreateShaderObjectARB(GLenum type) +{ + GET_CURRENT_CONTEXT(ctx); + return create_shader(ctx, type); +} + + +GLuint GLAPIENTRY +_mesa_CreateProgram(void) +{ + GET_CURRENT_CONTEXT(ctx); + return create_shader_program(ctx); +} + + +GLhandleARB GLAPIENTRY +_mesa_CreateProgramObjectARB(void) +{ + GET_CURRENT_CONTEXT(ctx); + return create_shader_program(ctx); +} + + +void GLAPIENTRY +_mesa_DeleteObjectARB(GLhandleARB obj) +{ + if (obj) { + GET_CURRENT_CONTEXT(ctx); + if (is_program(ctx, obj)) { + delete_shader_program(ctx, obj); + } + else if (is_shader(ctx, obj)) { + delete_shader(ctx, obj); + } + else { + /* error? */ + } + } +} + + +void GLAPIENTRY +_mesa_DeleteProgram(GLuint name) +{ + if (name) { + GET_CURRENT_CONTEXT(ctx); + delete_shader_program(ctx, name); + } +} + + +void GLAPIENTRY +_mesa_DeleteShader(GLuint name) +{ + if (name) { + GET_CURRENT_CONTEXT(ctx); + delete_shader(ctx, name); + } +} + + +void GLAPIENTRY +_mesa_DetachObjectARB(GLhandleARB program, GLhandleARB shader) +{ + GET_CURRENT_CONTEXT(ctx); + detach_shader(ctx, program, shader); +} + + +void GLAPIENTRY +_mesa_DetachShader(GLuint program, GLuint shader) +{ + GET_CURRENT_CONTEXT(ctx); + detach_shader(ctx, program, shader); +} + + +void GLAPIENTRY +_mesa_GetActiveAttribARB(GLhandleARB program, GLuint index, + GLsizei maxLength, GLsizei * length, GLint * size, + GLenum * type, GLcharARB * name) +{ + GET_CURRENT_CONTEXT(ctx); + get_active_attrib(ctx, program, index, maxLength, length, size, type, name); +} + + +void GLAPIENTRY +_mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount, + GLsizei * count, GLhandleARB * obj) +{ + GET_CURRENT_CONTEXT(ctx); + get_attached_shaders(ctx, container, maxCount, count, obj); +} + + +void GLAPIENTRY +_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount, + GLsizei *count, GLuint *obj) +{ + GET_CURRENT_CONTEXT(ctx); + get_attached_shaders(ctx, program, maxCount, count, obj); +} + + +GLint GLAPIENTRY +_mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name) +{ + GET_CURRENT_CONTEXT(ctx); + return get_attrib_location(ctx, program, name); +} + + +void GLAPIENTRY +_mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei * length, + GLcharARB * infoLog) +{ + GET_CURRENT_CONTEXT(ctx); + if (is_program(ctx, object)) { + get_program_info_log(ctx, object, maxLength, length, infoLog); + } + else if (is_shader(ctx, object)) { + get_shader_info_log(ctx, object, maxLength, length, infoLog); + } + else { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetInfoLogARB"); + } +} + + +void GLAPIENTRY +_mesa_GetObjectParameterivARB(GLhandleARB object, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + /* Implement in terms of GetProgramiv, GetShaderiv */ + if (is_program(ctx, object)) { + if (pname == GL_OBJECT_TYPE_ARB) { + *params = GL_PROGRAM_OBJECT_ARB; + } + else { + get_programiv(ctx, object, pname, params); + } + } + else if (is_shader(ctx, object)) { + if (pname == GL_OBJECT_TYPE_ARB) { + *params = GL_SHADER_OBJECT_ARB; + } + else { + get_shaderiv(ctx, object, pname, params); + } + } + else { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectParameterivARB"); + } +} + + +void GLAPIENTRY +_mesa_GetObjectParameterfvARB(GLhandleARB object, GLenum pname, + GLfloat *params) +{ + GLint iparams[1]; /* XXX is one element enough? */ + _mesa_GetObjectParameterivARB(object, pname, iparams); + params[0] = (GLfloat) iparams[0]; +} + + +void GLAPIENTRY +_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + get_programiv(ctx, program, pname, params); +} + + +void GLAPIENTRY +_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + get_shaderiv(ctx, shader, pname, params); +} + + +void GLAPIENTRY +_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize, + GLsizei *length, GLchar *infoLog) +{ + GET_CURRENT_CONTEXT(ctx); + get_program_info_log(ctx, program, bufSize, length, infoLog); +} + + +void GLAPIENTRY +_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize, + GLsizei *length, GLchar *infoLog) +{ + GET_CURRENT_CONTEXT(ctx); + get_shader_info_log(ctx, shader, bufSize, length, infoLog); +} + + +void GLAPIENTRY +_mesa_GetShaderSourceARB(GLhandleARB shader, GLsizei maxLength, + GLsizei *length, GLcharARB *sourceOut) +{ + GET_CURRENT_CONTEXT(ctx); + get_shader_source(ctx, shader, maxLength, length, sourceOut); +} + + +GLhandleARB GLAPIENTRY +_mesa_GetHandleARB(GLenum pname) +{ + GET_CURRENT_CONTEXT(ctx); + return get_handle(ctx, pname); +} + + +GLboolean GLAPIENTRY +_mesa_IsProgram(GLuint name) +{ + GET_CURRENT_CONTEXT(ctx); + return is_program(ctx, name); +} + + +GLboolean GLAPIENTRY +_mesa_IsShader(GLuint name) +{ + GET_CURRENT_CONTEXT(ctx); + return is_shader(ctx, name); +} + + +void GLAPIENTRY +_mesa_LinkProgramARB(GLhandleARB programObj) +{ + GET_CURRENT_CONTEXT(ctx); + link_program(ctx, programObj); +} + + + +/** + * Read shader source code from a file. + * Useful for debugging to override an app's shader. + */ +static GLcharARB * +read_shader(const char *fname) +{ + const int max = 50*1000; + FILE *f = fopen(fname, "r"); + GLcharARB *buffer, *shader; + int len; + + if (!f) { + return NULL; + } + + buffer = (char *) malloc(max); + len = fread(buffer, 1, max, f); + buffer[len] = 0; + + fclose(f); + + shader = _mesa_strdup(buffer); + free(buffer); + + return shader; +} + + +/** + * Called via glShaderSource() and glShaderSourceARB() API functions. + * Basically, concatenate the source code strings into one long string + * and pass it to _mesa_shader_source(). + */ +void GLAPIENTRY +_mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, + const GLcharARB ** string, const GLint * length) +{ + GET_CURRENT_CONTEXT(ctx); + GLint *offsets; + GLsizei i, totalLength; + GLcharARB *source; + GLuint checksum; + + if (!shaderObj || string == NULL) { + _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB"); + return; + } + + /* + * This array holds offsets of where the appropriate string ends, thus the + * last element will be set to the total length of the source code. + */ + offsets = (GLint *) malloc(count * sizeof(GLint)); + if (offsets == NULL) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); + return; + } + + for (i = 0; i < count; i++) { + if (string[i] == NULL) { + free((GLvoid *) offsets); + _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)"); + return; + } + if (length == NULL || length[i] < 0) + offsets[i] = strlen(string[i]); + else + offsets[i] = length[i]; + /* accumulate string lengths */ + if (i > 0) + offsets[i] += offsets[i - 1]; + } + + /* Total length of source string is sum off all strings plus two. + * One extra byte for terminating zero, another extra byte to silence + * valgrind warnings in the parser/grammer code. + */ + totalLength = offsets[count - 1] + 2; + source = (GLcharARB *) malloc(totalLength * sizeof(GLcharARB)); + if (source == NULL) { + free((GLvoid *) offsets); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); + return; + } + + for (i = 0; i < count; i++) { + GLint start = (i > 0) ? offsets[i - 1] : 0; + memcpy(source + start, string[i], + (offsets[i] - start) * sizeof(GLcharARB)); + } + source[totalLength - 1] = '\0'; + source[totalLength - 2] = '\0'; + + if (SHADER_SUBST) { + /* Compute the shader's source code checksum then try to open a file + * named newshader_<CHECKSUM>. If it exists, use it in place of the + * original shader source code. For debugging. + */ + char filename[100]; + GLcharARB *newSource; + + checksum = _mesa_str_checksum(source); + + _mesa_snprintf(filename, sizeof(filename), "newshader_%d", checksum); + + newSource = read_shader(filename); + if (newSource) { + fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n", + shaderObj, checksum, filename); + free(source); + source = newSource; + } + } + + shader_source(ctx, shaderObj, source); + + if (SHADER_SUBST) { + struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj); + if (sh) + sh->SourceChecksum = checksum; /* save original checksum */ + } + + free(offsets); +} + + +void GLAPIENTRY +_mesa_UseProgramObjectARB(GLhandleARB program) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_use_program(ctx, program); +} + + +void GLAPIENTRY +_mesa_ValidateProgramARB(GLhandleARB program) +{ + GET_CURRENT_CONTEXT(ctx); + validate_program(ctx, program); +} + +#ifdef FEATURE_ES2 + +void GLAPIENTRY +_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, + GLint* range, GLint* precision) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__); +} + + +void GLAPIENTRY +_mesa_ReleaseShaderCompiler(void) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__); +} + + +void GLAPIENTRY +_mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, + const void* binary, GLint length) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__); +} + +#endif /* FEATURE_ES2 */ + + +#if FEATURE_ARB_geometry_shader4 + +void GLAPIENTRY +_mesa_ProgramParameteriARB(GLuint program, GLenum pname, + GLint value) +{ + struct gl_shader_program *shProg; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + shProg = _mesa_lookup_shader_program_err(ctx, program, + "glProgramParameteri"); + if (!shProg) + return; + + switch (pname) { + case GL_GEOMETRY_VERTICES_OUT_ARB: + if (value < 1 || + value > ctx->Const.GeometryProgram.MaxGeometryOutputVertices) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glProgramParameteri(GL_GEOMETRY_VERTICES_OUT_ARB=%d", + value); + return; + } + shProg->Geom.VerticesOut = value; + break; + case GL_GEOMETRY_INPUT_TYPE_ARB: + switch (value) { + case GL_POINTS: + case GL_LINES: + case GL_LINES_ADJACENCY_ARB: + case GL_TRIANGLES: + case GL_TRIANGLES_ADJACENCY_ARB: + shProg->Geom.InputType = value; + break; + default: + _mesa_error(ctx, GL_INVALID_VALUE, + "glProgramParameteri(geometry input type = %s", + _mesa_lookup_enum_by_nr(value)); + return; + } + break; + case GL_GEOMETRY_OUTPUT_TYPE_ARB: + switch (value) { + case GL_POINTS: + case GL_LINE_STRIP: + case GL_TRIANGLE_STRIP: + shProg->Geom.OutputType = value; + break; + default: + _mesa_error(ctx, GL_INVALID_VALUE, + "glProgramParameteri(geometry output type = %s", + _mesa_lookup_enum_by_nr(value)); + return; + } + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteriARB(pname=%s)", + _mesa_lookup_enum_by_nr(pname)); + break; + } +} + +#endif + + +/** + * Plug in shader-related functions into API dispatch table. + */ +void +_mesa_init_shader_dispatch(struct _glapi_table *exec) +{ +#if FEATURE_GL + /* GL_ARB_vertex/fragment_shader */ + SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); + SET_GetHandleARB(exec, _mesa_GetHandleARB); + SET_DetachObjectARB(exec, _mesa_DetachObjectARB); + SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB); + SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB); + SET_CompileShaderARB(exec, _mesa_CompileShaderARB); + SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB); + SET_AttachObjectARB(exec, _mesa_AttachObjectARB); + SET_LinkProgramARB(exec, _mesa_LinkProgramARB); + SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB); + SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB); + SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB); + SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB); + SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB); + SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB); + SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB); + + /* OpenGL 2.0 */ + SET_AttachShader(exec, _mesa_AttachShader); + SET_CreateProgram(exec, _mesa_CreateProgram); + SET_CreateShader(exec, _mesa_CreateShader); + SET_DeleteProgram(exec, _mesa_DeleteProgram); + SET_DeleteShader(exec, _mesa_DeleteShader); + SET_DetachShader(exec, _mesa_DetachShader); + SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders); + SET_GetProgramiv(exec, _mesa_GetProgramiv); + SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog); + SET_GetShaderiv(exec, _mesa_GetShaderiv); + SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog); + SET_IsProgram(exec, _mesa_IsProgram); + SET_IsShader(exec, _mesa_IsShader); + +#if FEATURE_ARB_vertex_shader + SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB); + SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB); + SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB); +#endif + +#if FEATURE_ARB_geometry_shader4 + SET_ProgramParameteriARB(exec, _mesa_ProgramParameteriARB); +#endif +#endif /* FEATURE_GL */ +} + diff --git a/mesalib/src/mesa/main/shaderapi.h b/mesalib/src/mesa/main/shaderapi.h new file mode 100644 index 000000000..16e22530d --- /dev/null +++ b/mesalib/src/mesa/main/shaderapi.h @@ -0,0 +1,169 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2004-2007 Brian Paul All Rights Reserved. + * Copyright (C) 2010 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef SHADERAPI_H +#define SHADERAPI_H + + +#include "glheader.h" +#include "mtypes.h" + + +extern GLint +_mesa_sizeof_glsl_type(GLenum type); + +extern void +_mesa_copy_string(GLchar *dst, GLsizei maxLength, + GLsizei *length, const GLchar *src); + +extern void +_mesa_use_program(GLcontext *ctx, GLuint program); + + +extern void +_mesa_init_shader_dispatch(struct _glapi_table *exec); + + + +extern void GLAPIENTRY +_mesa_AttachObjectARB(GLhandleARB, GLhandleARB); + +extern void GLAPIENTRY +_mesa_CompileShaderARB(GLhandleARB); + +extern GLhandleARB GLAPIENTRY +_mesa_CreateProgramObjectARB(void); + +extern GLhandleARB GLAPIENTRY +_mesa_CreateShaderObjectARB(GLenum type); + +extern void GLAPIENTRY +_mesa_DeleteObjectARB(GLhandleARB obj); + +extern void GLAPIENTRY +_mesa_DetachObjectARB(GLhandleARB, GLhandleARB); + +extern void GLAPIENTRY +_mesa_GetAttachedObjectsARB(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); + +extern GLhandleARB GLAPIENTRY +_mesa_GetHandleARB(GLenum pname); + +extern void GLAPIENTRY +_mesa_GetInfoLogARB(GLhandleARB, GLsizei, GLsizei *, GLcharARB *); + +extern void GLAPIENTRY +_mesa_GetObjectParameterfvARB(GLhandleARB, GLenum, GLfloat *); + +extern void GLAPIENTRY +_mesa_GetObjectParameterivARB(GLhandleARB, GLenum, GLint *); + +extern void GLAPIENTRY +_mesa_GetShaderSourceARB(GLhandleARB, GLsizei, GLsizei *, GLcharARB *); + +extern GLboolean GLAPIENTRY +_mesa_IsProgram(GLuint name); + +extern GLboolean GLAPIENTRY +_mesa_IsShader(GLuint name); + +extern void GLAPIENTRY +_mesa_LinkProgramARB(GLhandleARB programObj); + +extern void GLAPIENTRY +_mesa_ShaderSourceARB(GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); + +extern void GLAPIENTRY +_mesa_UseProgramObjectARB(GLhandleARB); + +extern void GLAPIENTRY +_mesa_ValidateProgramARB(GLhandleARB); + + +extern void GLAPIENTRY +_mesa_BindAttribLocationARB(GLhandleARB, GLuint, const GLcharARB *); + +extern void GLAPIENTRY +_mesa_GetActiveAttribARB(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, + GLenum *, GLcharARB *); + +extern GLint GLAPIENTRY +_mesa_GetAttribLocationARB(GLhandleARB, const GLcharARB *); + + + +extern void GLAPIENTRY +_mesa_AttachShader(GLuint program, GLuint shader); + +extern GLuint GLAPIENTRY +_mesa_CreateShader(GLenum); + +extern GLuint GLAPIENTRY +_mesa_CreateProgram(void); + +extern void GLAPIENTRY +_mesa_DeleteProgram(GLuint program); + +extern void GLAPIENTRY +_mesa_DeleteShader(GLuint shader); + +extern void GLAPIENTRY +_mesa_DetachShader(GLuint program, GLuint shader); + +extern void GLAPIENTRY +_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount, + GLsizei *count, GLuint *obj); + +extern void GLAPIENTRY +_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params); + +extern void GLAPIENTRY +_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize, + GLsizei *length, GLchar *infoLog); + +extern void GLAPIENTRY +_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params); + +extern void GLAPIENTRY +_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize, + GLsizei *length, GLchar *infoLog); + + +extern void GLAPIENTRY +_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, + GLint *range, GLint *precision); + +extern void GLAPIENTRY +_mesa_ReleaseShaderCompiler(void); + +extern void GLAPIENTRY +_mesa_ShaderBinary(GLint n, const GLuint *shaders, GLenum binaryformat, + const void* binary, GLint length); + +extern void GLAPIENTRY +_mesa_ProgramParameteriARB(GLuint program, GLenum pname, + GLint value); + +#endif /* SHADERAPI_H */ diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c new file mode 100644 index 000000000..2de8f2798 --- /dev/null +++ b/mesalib/src/mesa/main/shaderobj.c @@ -0,0 +1,408 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2004-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009-2010 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file shaderobj.c + * \author Brian Paul + * + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/hash.h" +#include "main/shaderobj.h" +#include "program/program.h" +#include "program/prog_parameter.h" +#include "program/prog_uniform.h" +#include "talloc.h" + +/**********************************************************************/ +/*** Shader object functions ***/ +/**********************************************************************/ + + +/** + * Set ptr to point to sh. + * If ptr is pointing to another shader, decrement its refcount (and delete + * if refcount hits zero). + * Then set ptr to point to sh, incrementing its refcount. + */ +void +_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr, + struct gl_shader *sh) +{ + assert(ptr); + if (*ptr == sh) { + /* no-op */ + return; + } + if (*ptr) { + /* Unreference the old shader */ + GLboolean deleteFlag = GL_FALSE; + struct gl_shader *old = *ptr; + + ASSERT(old->RefCount > 0); + old->RefCount--; + /*printf("SHADER DECR %p (%d) to %d\n", + (void*) old, old->Name, old->RefCount);*/ + deleteFlag = (old->RefCount == 0); + + if (deleteFlag) { + _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name); + ctx->Driver.DeleteShader(ctx, old); + } + + *ptr = NULL; + } + assert(!*ptr); + + if (sh) { + /* reference new */ + sh->RefCount++; + /*printf("SHADER INCR %p (%d) to %d\n", + (void*) sh, sh->Name, sh->RefCount);*/ + *ptr = sh; + } +} + +void +_mesa_init_shader(GLcontext *ctx, struct gl_shader *shader) +{ + shader->RefCount = 1; +} + +/** + * Allocate a new gl_shader object, initialize it. + * Called via ctx->Driver.NewShader() + */ +struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) +{ + struct gl_shader *shader; + assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER || + type == GL_GEOMETRY_SHADER_ARB); + shader = talloc_zero(NULL, struct gl_shader); + if (shader) { + shader->Type = type; + shader->Name = name; + _mesa_init_shader(ctx, shader); + } + return shader; +} + + +/** + * Delete a shader object. + * Called via ctx->Driver.DeleteShader(). + */ +static void +_mesa_delete_shader(GLcontext *ctx, struct gl_shader *sh) +{ + if (sh->Source) + free((void *) sh->Source); + _mesa_reference_program(ctx, &sh->Program, NULL); + talloc_free(sh); +} + + +/** + * Lookup a GLSL shader object. + */ +struct gl_shader * +_mesa_lookup_shader(GLcontext *ctx, GLuint name) +{ + if (name) { + struct gl_shader *sh = (struct gl_shader *) + _mesa_HashLookup(ctx->Shared->ShaderObjects, name); + /* Note that both gl_shader and gl_shader_program objects are kept + * in the same hash table. Check the object's type to be sure it's + * what we're expecting. + */ + if (sh && sh->Type == GL_SHADER_PROGRAM_MESA) { + return NULL; + } + return sh; + } + return NULL; +} + + +/** + * As above, but record an error if shader is not found. + */ +struct gl_shader * +_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller) +{ + if (!name) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s", caller); + return NULL; + } + else { + struct gl_shader *sh = (struct gl_shader *) + _mesa_HashLookup(ctx->Shared->ShaderObjects, name); + if (!sh) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s", caller); + return NULL; + } + if (sh->Type == GL_SHADER_PROGRAM_MESA) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller); + return NULL; + } + return sh; + } +} + + + +/**********************************************************************/ +/*** Shader Program object functions ***/ +/**********************************************************************/ + + +/** + * Set ptr to point to shProg. + * If ptr is pointing to another object, decrement its refcount (and delete + * if refcount hits zero). + * Then set ptr to point to shProg, incrementing its refcount. + */ +void +_mesa_reference_shader_program(GLcontext *ctx, + struct gl_shader_program **ptr, + struct gl_shader_program *shProg) +{ + assert(ptr); + if (*ptr == shProg) { + /* no-op */ + return; + } + if (*ptr) { + /* Unreference the old shader program */ + GLboolean deleteFlag = GL_FALSE; + struct gl_shader_program *old = *ptr; + + ASSERT(old->RefCount > 0); + old->RefCount--; +#if 0 + printf("ShaderProgram %p ID=%u RefCount-- to %d\n", + (void *) old, old->Name, old->RefCount); +#endif + deleteFlag = (old->RefCount == 0); + + if (deleteFlag) { + _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name); + ctx->Driver.DeleteShaderProgram(ctx, old); + } + + *ptr = NULL; + } + assert(!*ptr); + + if (shProg) { + shProg->RefCount++; +#if 0 + printf("ShaderProgram %p ID=%u RefCount++ to %d\n", + (void *) shProg, shProg->Name, shProg->RefCount); +#endif + *ptr = shProg; + } +} + +void +_mesa_init_shader_program(GLcontext *ctx, struct gl_shader_program *prog) +{ + prog->Type = GL_SHADER_PROGRAM_MESA; + prog->RefCount = 1; + prog->Attributes = _mesa_new_parameter_list(); +#if FEATURE_ARB_geometry_shader4 + prog->Geom.VerticesOut = 0; + prog->Geom.InputType = GL_TRIANGLES; + prog->Geom.OutputType = GL_TRIANGLE_STRIP; +#endif +} + +/** + * Allocate a new gl_shader_program object, initialize it. + * Called via ctx->Driver.NewShaderProgram() + */ +static struct gl_shader_program * +_mesa_new_shader_program(GLcontext *ctx, GLuint name) +{ + struct gl_shader_program *shProg; + shProg = talloc_zero(NULL, struct gl_shader_program); + if (shProg) { + shProg->Name = name; + _mesa_init_shader_program(ctx, shProg); + } + return shProg; +} + + +/** + * Clear (free) the shader program state that gets produced by linking. + */ +void +_mesa_clear_shader_program_data(GLcontext *ctx, + struct gl_shader_program *shProg) +{ + _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); + _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL); + _mesa_reference_geomprog(ctx, &shProg->GeometryProgram, NULL); + + if (shProg->Uniforms) { + _mesa_free_uniform_list(shProg->Uniforms); + shProg->Uniforms = NULL; + } + + if (shProg->Varying) { + _mesa_free_parameter_list(shProg->Varying); + shProg->Varying = NULL; + } +} + + +/** + * Free all the data that hangs off a shader program object, but not the + * object itself. + */ +void +_mesa_free_shader_program_data(GLcontext *ctx, + struct gl_shader_program *shProg) +{ + GLuint i; + + assert(shProg->Type == GL_SHADER_PROGRAM_MESA); + + _mesa_clear_shader_program_data(ctx, shProg); + + if (shProg->Attributes) { + _mesa_free_parameter_list(shProg->Attributes); + shProg->Attributes = NULL; + } + + /* detach shaders */ + for (i = 0; i < shProg->NumShaders; i++) { + _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL); + } + shProg->NumShaders = 0; + + if (shProg->Shaders) { + free(shProg->Shaders); + shProg->Shaders = NULL; + } + + if (shProg->InfoLog) { + talloc_free(shProg->InfoLog); + shProg->InfoLog = NULL; + } + + /* Transform feedback varying vars */ + for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) { + free(shProg->TransformFeedback.VaryingNames[i]); + } + free(shProg->TransformFeedback.VaryingNames); + shProg->TransformFeedback.VaryingNames = NULL; + shProg->TransformFeedback.NumVarying = 0; + + + for (i = 0; i < shProg->_NumLinkedShaders; i++) { + ctx->Driver.DeleteShader(ctx, shProg->_LinkedShaders[i]); + } + shProg->_NumLinkedShaders = 0; +} + + +/** + * Free/delete a shader program object. + * Called via ctx->Driver.DeleteShaderProgram(). + */ +static void +_mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg) +{ + _mesa_free_shader_program_data(ctx, shProg); + + talloc_free(shProg); +} + + +/** + * Lookup a GLSL program object. + */ +struct gl_shader_program * +_mesa_lookup_shader_program(GLcontext *ctx, GLuint name) +{ + struct gl_shader_program *shProg; + if (name) { + shProg = (struct gl_shader_program *) + _mesa_HashLookup(ctx->Shared->ShaderObjects, name); + /* Note that both gl_shader and gl_shader_program objects are kept + * in the same hash table. Check the object's type to be sure it's + * what we're expecting. + */ + if (shProg && shProg->Type != GL_SHADER_PROGRAM_MESA) { + return NULL; + } + return shProg; + } + return NULL; +} + + +/** + * As above, but record an error if program is not found. + */ +struct gl_shader_program * +_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name, + const char *caller) +{ + if (!name) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s", caller); + return NULL; + } + else { + struct gl_shader_program *shProg = (struct gl_shader_program *) + _mesa_HashLookup(ctx->Shared->ShaderObjects, name); + if (!shProg) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s", caller); + return NULL; + } + if (shProg->Type != GL_SHADER_PROGRAM_MESA) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller); + return NULL; + } + return shProg; + } +} + + +void +_mesa_init_shader_object_functions(struct dd_function_table *driver) +{ + driver->NewShader = _mesa_new_shader; + driver->DeleteShader = _mesa_delete_shader; + driver->NewShaderProgram = _mesa_new_shader_program; + driver->DeleteShaderProgram = _mesa_delete_shader_program; + driver->CompileShader = _mesa_ir_compile_shader; + driver->LinkShader = _mesa_ir_link_shader; +} diff --git a/mesalib/src/mesa/shader/shader_api.h b/mesalib/src/mesa/main/shaderobj.h index d08d47373..cbe7ae7b0 100644 --- a/mesalib/src/mesa/shader/shader_api.h +++ b/mesalib/src/mesa/main/shaderobj.h @@ -1,9 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 7.6 + * Version: 6.5.3 * - * Copyright (C) 2004-2006 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * Copyright (C) 2004-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,14 +23,17 @@ */ -#ifndef SHADER_API_H -#define SHADER_API_H +#ifndef SHADEROBJ_H +#define SHADEROBJ_H #include "main/glheader.h" #include "main/mtypes.h" +#include "program/ir_to_mesa.h" - +#ifdef __cplusplus +extern "C" { +#endif /** * Internal functions */ @@ -42,59 +44,91 @@ _mesa_init_shader_state(GLcontext * ctx); extern void _mesa_free_shader_state(GLcontext *ctx); -/* -extern struct gl_shader_program * -_mesa_new_shader_program(GLcontext *ctx, GLuint name); -*/ -extern void -_mesa_clear_shader_program_data(GLcontext *ctx, - struct gl_shader_program *shProg); extern void -_mesa_free_shader_program_data(GLcontext *ctx, - struct gl_shader_program *shProg); +_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr, + struct gl_shader *sh); + +extern struct gl_shader * +_mesa_lookup_shader(GLcontext *ctx, GLuint name); + +extern struct gl_shader * +_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller); + -extern void -_mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg); extern void _mesa_reference_shader_program(GLcontext *ctx, struct gl_shader_program **ptr, struct gl_shader_program *shProg); - -extern struct gl_shader_program * -_mesa_lookup_shader_program(GLcontext *ctx, GLuint name); - +extern void +_mesa_init_shader(GLcontext *ctx, struct gl_shader *shader); extern struct gl_shader * _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); extern void -_mesa_free_shader(GLcontext *ctx, struct gl_shader *sh); - -extern void -_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr, - struct gl_shader *sh); +_mesa_init_shader_program(GLcontext *ctx, struct gl_shader_program *prog); -extern struct gl_shader * -_mesa_lookup_shader(GLcontext *ctx, GLuint name); +extern struct gl_shader_program * +_mesa_lookup_shader_program(GLcontext *ctx, GLuint name); +extern struct gl_shader_program * +_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name, + const char *caller); extern void -_mesa_update_shader_textures_used(struct gl_program *prog); - +_mesa_clear_shader_program_data(GLcontext *ctx, + struct gl_shader_program *shProg); extern void -_mesa_use_program(GLcontext *ctx, GLuint program); +_mesa_free_shader_program_data(GLcontext *ctx, + struct gl_shader_program *shProg); + -extern GLboolean -_mesa_validate_shader_program(GLcontext *ctx, - const struct gl_shader_program *shProg, - char *errMsg); +extern void +_mesa_init_shader_object_functions(struct dd_function_table *driver); extern void -_mesa_init_glsl_driver_functions(struct dd_function_table *driver); +_mesa_init_shader_state(GLcontext *ctx); +extern void +_mesa_free_shader_state(GLcontext *ctx); -#endif /* SHADER_API_H */ +static INLINE GLuint +_mesa_shader_type_to_index(GLenum v) +{ + switch(v) + { + case GL_VERTEX_SHADER: + return MESA_SHADER_VERTEX; + case GL_FRAGMENT_SHADER: + return MESA_SHADER_FRAGMENT; + case GL_GEOMETRY_SHADER: + return MESA_SHADER_GEOMETRY; + default: + ASSERT(0); + return ~0; + } +} + +static INLINE GLenum +_mesa_shader_index_to_type(GLuint i) +{ + GLenum enums[MESA_SHADER_TYPES] = { + GL_VERTEX_SHADER, + GL_FRAGMENT_SHADER, + GL_GEOMETRY_SHADER , + }; + if(i >= MESA_SHADER_TYPES) + return 0; + else + return enums[i]; +} + +#ifdef __cplusplus +} +#endif + +#endif /* SHADEROBJ_H */ diff --git a/mesalib/src/mesa/main/shaders.c b/mesalib/src/mesa/main/shaders.c deleted file mode 100644 index f382680b4..000000000 --- a/mesalib/src/mesa/main/shaders.c +++ /dev/null @@ -1,741 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 2004-2008 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include "glheader.h" -#include "context.h" -#include "shaders.h" -#include "shader/shader_api.h" - - -/** Define this to enable shader substitution (see below) */ -#define SHADER_SUBST 0 - - - -/** - * These are basically just wrappers/adaptors for calling the - * ctx->Driver.foobar() GLSL-related functions. - * - * Things are biased toward the OpenGL 2.0 functions rather than the - * ARB extensions (i.e. the ARB functions are layered on the 2.0 functions). - * - * The general idea here is to allow enough modularity such that a - * completely different GLSL implemenation can be plugged in and co-exist - * with Mesa's native GLSL code. - */ - - - -void GLAPIENTRY -_mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.AttachShader(ctx, program, shader); -} - - -void GLAPIENTRY -_mesa_AttachShader(GLuint program, GLuint shader) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.AttachShader(ctx, program, shader); -} - - -void GLAPIENTRY -_mesa_BindAttribLocationARB(GLhandleARB program, GLuint index, - const GLcharARB *name) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.BindAttribLocation(ctx, program, index, name); -} - - -void GLAPIENTRY -_mesa_CompileShaderARB(GLhandleARB shaderObj) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.CompileShader(ctx, shaderObj); -} - - -GLuint GLAPIENTRY -_mesa_CreateShader(GLenum type) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.CreateShader(ctx, type); -} - - -GLhandleARB GLAPIENTRY -_mesa_CreateShaderObjectARB(GLenum type) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.CreateShader(ctx, type); -} - - -GLuint GLAPIENTRY -_mesa_CreateProgram(void) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.CreateProgram(ctx); -} - - -GLhandleARB GLAPIENTRY -_mesa_CreateProgramObjectARB(void) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.CreateProgram(ctx); -} - - -void GLAPIENTRY -_mesa_DeleteObjectARB(GLhandleARB obj) -{ - if (obj) { - GET_CURRENT_CONTEXT(ctx); - if (ctx->Driver.IsProgram(ctx, obj)) { - ctx->Driver.DeleteProgram2(ctx, obj); - } - else if (ctx->Driver.IsShader(ctx, obj)) { - ctx->Driver.DeleteShader(ctx, obj); - } - else { - /* error? */ - } - } -} - - -void GLAPIENTRY -_mesa_DeleteProgram(GLuint name) -{ - if (name) { - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.DeleteProgram2(ctx, name); - } -} - - -void GLAPIENTRY -_mesa_DeleteShader(GLuint name) -{ - if (name) { - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.DeleteShader(ctx, name); - } -} - - -void GLAPIENTRY -_mesa_DetachObjectARB(GLhandleARB program, GLhandleARB shader) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.DetachShader(ctx, program, shader); -} - - -void GLAPIENTRY -_mesa_DetachShader(GLuint program, GLuint shader) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.DetachShader(ctx, program, shader); -} - - -void GLAPIENTRY -_mesa_GetActiveAttribARB(GLhandleARB program, GLuint index, - GLsizei maxLength, GLsizei * length, GLint * size, - GLenum * type, GLcharARB * name) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetActiveAttrib(ctx, program, index, maxLength, length, size, - type, name); -} - - -void GLAPIENTRY -_mesa_GetActiveUniformARB(GLhandleARB program, GLuint index, - GLsizei maxLength, GLsizei * length, GLint * size, - GLenum * type, GLcharARB * name) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetActiveUniform(ctx, program, index, maxLength, length, size, - type, name); -} - - -void GLAPIENTRY -_mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount, - GLsizei * count, GLhandleARB * obj) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetAttachedShaders(ctx, container, maxCount, count, obj); -} - - -void GLAPIENTRY -_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount, - GLsizei *count, GLuint *obj) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetAttachedShaders(ctx, program, maxCount, count, obj); -} - - -GLint GLAPIENTRY -_mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.GetAttribLocation(ctx, program, name); -} - - -void GLAPIENTRY -_mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei * length, - GLcharARB * infoLog) -{ - GET_CURRENT_CONTEXT(ctx); - /* Implement in terms of GetProgramInfoLog, GetShaderInfoLog */ - if (ctx->Driver.IsProgram(ctx, object)) { - ctx->Driver.GetProgramInfoLog(ctx, object, maxLength, length, infoLog); - } - else if (ctx->Driver.IsShader(ctx, object)) { - ctx->Driver.GetShaderInfoLog(ctx, object, maxLength, length, infoLog); - } - else { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetInfoLogARB"); - } -} - - -void GLAPIENTRY -_mesa_GetObjectParameterivARB(GLhandleARB object, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - /* Implement in terms of GetProgramiv, GetShaderiv */ - if (ctx->Driver.IsProgram(ctx, object)) { - if (pname == GL_OBJECT_TYPE_ARB) { - *params = GL_PROGRAM_OBJECT_ARB; - } - else { - ctx->Driver.GetProgramiv(ctx, object, pname, params); - } - } - else if (ctx->Driver.IsShader(ctx, object)) { - if (pname == GL_OBJECT_TYPE_ARB) { - *params = GL_SHADER_OBJECT_ARB; - } - else { - ctx->Driver.GetShaderiv(ctx, object, pname, params); - } - } - else { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectParameterivARB"); - } -} - - -void GLAPIENTRY -_mesa_GetObjectParameterfvARB(GLhandleARB object, GLenum pname, - GLfloat *params) -{ - GLint iparams[1]; /* XXX is one element enough? */ - _mesa_GetObjectParameterivARB(object, pname, iparams); - params[0] = (GLfloat) iparams[0]; -} - - -void GLAPIENTRY -_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetProgramiv(ctx, program, pname, params); -} - - -void GLAPIENTRY -_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetShaderiv(ctx, shader, pname, params); -} - - -void GLAPIENTRY -_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize, - GLsizei *length, GLchar *infoLog) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetProgramInfoLog(ctx, program, bufSize, length, infoLog); -} - - -void GLAPIENTRY -_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize, - GLsizei *length, GLchar *infoLog) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetShaderInfoLog(ctx, shader, bufSize, length, infoLog); -} - - -void GLAPIENTRY -_mesa_GetShaderSourceARB(GLhandleARB shader, GLsizei maxLength, - GLsizei *length, GLcharARB *sourceOut) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetShaderSource(ctx, shader, maxLength, length, sourceOut); -} - - -void GLAPIENTRY -_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat * params) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetUniformfv(ctx, program, location, params); -} - - -void GLAPIENTRY -_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.GetUniformiv(ctx, program, location, params); -} - - - -#if 0 -GLint GLAPIENTRY -_mesa_GetUniformLocation(GLuint program, const GLcharARB *name) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.GetUniformLocation(ctx, program, name); -} -#endif - - -GLhandleARB GLAPIENTRY -_mesa_GetHandleARB(GLenum pname) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.GetHandle(ctx, pname); -} - - -GLint GLAPIENTRY -_mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.GetUniformLocation(ctx, programObj, name); -} - - -GLboolean GLAPIENTRY -_mesa_IsProgram(GLuint name) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.IsProgram(ctx, name); -} - - -GLboolean GLAPIENTRY -_mesa_IsShader(GLuint name) -{ - GET_CURRENT_CONTEXT(ctx); - return ctx->Driver.IsShader(ctx, name); -} - - -void GLAPIENTRY -_mesa_LinkProgramARB(GLhandleARB programObj) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.LinkProgram(ctx, programObj); -} - - - -/** - * Read shader source code from a file. - * Useful for debugging to override an app's shader. - */ -static GLcharARB * -_mesa_read_shader(const char *fname) -{ - const int max = 50*1000; - FILE *f = fopen(fname, "r"); - GLcharARB *buffer, *shader; - int len; - - if (!f) { - return NULL; - } - - buffer = (char *) malloc(max); - len = fread(buffer, 1, max, f); - buffer[len] = 0; - - fclose(f); - - shader = _mesa_strdup(buffer); - free(buffer); - - return shader; -} - - -/** - * Called via glShaderSource() and glShaderSourceARB() API functions. - * Basically, concatenate the source code strings into one long string - * and pass it to ctx->Driver.ShaderSource(). - */ -void GLAPIENTRY -_mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, - const GLcharARB ** string, const GLint * length) -{ - GET_CURRENT_CONTEXT(ctx); - GLint *offsets; - GLsizei i, totalLength; - GLcharARB *source; - GLuint checksum; - - if (!shaderObj || string == NULL) { - _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB"); - return; - } - - /* - * This array holds offsets of where the appropriate string ends, thus the - * last element will be set to the total length of the source code. - */ - offsets = (GLint *) malloc(count * sizeof(GLint)); - if (offsets == NULL) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); - return; - } - - for (i = 0; i < count; i++) { - if (string[i] == NULL) { - free((GLvoid *) offsets); - _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)"); - return; - } - if (length == NULL || length[i] < 0) - offsets[i] = strlen(string[i]); - else - offsets[i] = length[i]; - /* accumulate string lengths */ - if (i > 0) - offsets[i] += offsets[i - 1]; - } - - /* Total length of source string is sum off all strings plus two. - * One extra byte for terminating zero, another extra byte to silence - * valgrind warnings in the parser/grammer code. - */ - totalLength = offsets[count - 1] + 2; - source = (GLcharARB *) malloc(totalLength * sizeof(GLcharARB)); - if (source == NULL) { - free((GLvoid *) offsets); - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB"); - return; - } - - for (i = 0; i < count; i++) { - GLint start = (i > 0) ? offsets[i - 1] : 0; - memcpy(source + start, string[i], - (offsets[i] - start) * sizeof(GLcharARB)); - } - source[totalLength - 1] = '\0'; - source[totalLength - 2] = '\0'; - - if (SHADER_SUBST) { - /* Compute the shader's source code checksum then try to open a file - * named newshader_<CHECKSUM>. If it exists, use it in place of the - * original shader source code. For debugging. - */ - char filename[100]; - GLcharARB *newSource; - - checksum = _mesa_str_checksum(source); - - sprintf(filename, "newshader_%d", checksum); - - newSource = _mesa_read_shader(filename); - if (newSource) { - fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n", - shaderObj, checksum, filename); - free(source); - source = newSource; - } - } - - ctx->Driver.ShaderSource(ctx, shaderObj, source); - - if (SHADER_SUBST) { - struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj); - if (sh) - sh->SourceChecksum = checksum; /* save original checksum */ - } - - free(offsets); -} - - -void GLAPIENTRY -_mesa_Uniform1fARB(GLint location, GLfloat v0) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, 1, &v0, GL_FLOAT); -} - -void GLAPIENTRY -_mesa_Uniform2fARB(GLint location, GLfloat v0, GLfloat v1) -{ - GET_CURRENT_CONTEXT(ctx); - GLfloat v[2]; - v[0] = v0; - v[1] = v1; - ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC2); -} - -void GLAPIENTRY -_mesa_Uniform3fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) -{ - GET_CURRENT_CONTEXT(ctx); - GLfloat v[3]; - v[0] = v0; - v[1] = v1; - v[2] = v2; - ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC3); -} - -void GLAPIENTRY -_mesa_Uniform4fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, - GLfloat v3) -{ - GET_CURRENT_CONTEXT(ctx); - GLfloat v[4]; - v[0] = v0; - v[1] = v1; - v[2] = v2; - v[3] = v3; - ctx->Driver.Uniform(ctx, location, 1, v, GL_FLOAT_VEC4); -} - -void GLAPIENTRY -_mesa_Uniform1iARB(GLint location, GLint v0) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, 1, &v0, GL_INT); -} - -void GLAPIENTRY -_mesa_Uniform2iARB(GLint location, GLint v0, GLint v1) -{ - GET_CURRENT_CONTEXT(ctx); - GLint v[2]; - v[0] = v0; - v[1] = v1; - ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC2); -} - -void GLAPIENTRY -_mesa_Uniform3iARB(GLint location, GLint v0, GLint v1, GLint v2) -{ - GET_CURRENT_CONTEXT(ctx); - GLint v[3]; - v[0] = v0; - v[1] = v1; - v[2] = v2; - ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC3); -} - -void GLAPIENTRY -_mesa_Uniform4iARB(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) -{ - GET_CURRENT_CONTEXT(ctx); - GLint v[4]; - v[0] = v0; - v[1] = v1; - v[2] = v2; - v[3] = v3; - ctx->Driver.Uniform(ctx, location, 1, v, GL_INT_VEC4); -} - -void GLAPIENTRY -_mesa_Uniform1fvARB(GLint location, GLsizei count, const GLfloat * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT); -} - -void GLAPIENTRY -_mesa_Uniform2fvARB(GLint location, GLsizei count, const GLfloat * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC2); -} - -void GLAPIENTRY -_mesa_Uniform3fvARB(GLint location, GLsizei count, const GLfloat * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC3); -} - -void GLAPIENTRY -_mesa_Uniform4fvARB(GLint location, GLsizei count, const GLfloat * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, count, value, GL_FLOAT_VEC4); -} - -void GLAPIENTRY -_mesa_Uniform1ivARB(GLint location, GLsizei count, const GLint * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, count, value, GL_INT); -} - -void GLAPIENTRY -_mesa_Uniform2ivARB(GLint location, GLsizei count, const GLint * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC2); -} - -void GLAPIENTRY -_mesa_Uniform3ivARB(GLint location, GLsizei count, const GLint * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC3); -} - -void GLAPIENTRY -_mesa_Uniform4ivARB(GLint location, GLsizei count, const GLint * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.Uniform(ctx, location, count, value, GL_INT_VEC4); -} - - -void GLAPIENTRY -_mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose, - const GLfloat * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 2, 2, location, count, transpose, value); -} - -void GLAPIENTRY -_mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose, - const GLfloat * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 3, 3, location, count, transpose, value); -} - -void GLAPIENTRY -_mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose, - const GLfloat * value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 4, 4, location, count, transpose, value); -} - - -/** - * Non-square UniformMatrix are OpenGL 2.1 - */ -void GLAPIENTRY -_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 2, 3, location, count, transpose, value); -} - -void GLAPIENTRY -_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 3, 2, location, count, transpose, value); -} - -void GLAPIENTRY -_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 2, 4, location, count, transpose, value); -} - -void GLAPIENTRY -_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 4, 2, location, count, transpose, value); -} - -void GLAPIENTRY -_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 3, 4, location, count, transpose, value); -} - -void GLAPIENTRY -_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.UniformMatrix(ctx, 4, 3, location, count, transpose, value); -} - - -void GLAPIENTRY -_mesa_UseProgramObjectARB(GLhandleARB program) -{ - GET_CURRENT_CONTEXT(ctx); - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - ctx->Driver.UseProgram(ctx, program); -} - - -void GLAPIENTRY -_mesa_ValidateProgramARB(GLhandleARB program) -{ - GET_CURRENT_CONTEXT(ctx); - ctx->Driver.ValidateProgram(ctx, program); -} - diff --git a/mesalib/src/mesa/main/shaders.h b/mesalib/src/mesa/main/shaders.h deleted file mode 100644 index 17339ccf6..000000000 --- a/mesalib/src/mesa/main/shaders.h +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2004-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef SHADERS_H -#define SHADERS_H - - -#include "glheader.h" -#include "mtypes.h" - - -extern void GLAPIENTRY -_mesa_DeleteObjectARB(GLhandleARB obj); - -extern GLhandleARB GLAPIENTRY -_mesa_GetHandleARB(GLenum pname); - -extern void GLAPIENTRY -_mesa_DetachObjectARB (GLhandleARB, GLhandleARB); - -extern GLhandleARB GLAPIENTRY -_mesa_CreateShaderObjectARB (GLenum); - -extern void GLAPIENTRY -_mesa_ShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); - -extern void GLAPIENTRY -_mesa_CompileShaderARB (GLhandleARB); - -extern GLhandleARB GLAPIENTRY -_mesa_CreateProgramObjectARB (void); - -extern void GLAPIENTRY -_mesa_AttachObjectARB (GLhandleARB, GLhandleARB); - -extern void GLAPIENTRY -_mesa_LinkProgramARB (GLhandleARB); - -extern void GLAPIENTRY -_mesa_UseProgramObjectARB (GLhandleARB); - -extern void GLAPIENTRY -_mesa_ValidateProgramARB (GLhandleARB); - -extern void GLAPIENTRY -_mesa_Uniform1fARB (GLint, GLfloat); - -extern void GLAPIENTRY -_mesa_Uniform2fARB (GLint, GLfloat, GLfloat); - -extern void GLAPIENTRY -_mesa_Uniform3fARB (GLint, GLfloat, GLfloat, GLfloat); - -extern void GLAPIENTRY -_mesa_Uniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); - -extern void GLAPIENTRY -_mesa_Uniform1iARB (GLint, GLint); - -extern void GLAPIENTRY -_mesa_Uniform2iARB (GLint, GLint, GLint); - -extern void GLAPIENTRY -_mesa_Uniform3iARB (GLint, GLint, GLint, GLint); - -extern void GLAPIENTRY -_mesa_Uniform4iARB (GLint, GLint, GLint, GLint, GLint); - -extern void GLAPIENTRY -_mesa_Uniform1fvARB (GLint, GLsizei, const GLfloat *); - -extern void GLAPIENTRY -_mesa_Uniform2fvARB (GLint, GLsizei, const GLfloat *); - -extern void GLAPIENTRY -_mesa_Uniform3fvARB (GLint, GLsizei, const GLfloat *); - -extern void GLAPIENTRY -_mesa_Uniform4fvARB (GLint, GLsizei, const GLfloat *); - -extern void GLAPIENTRY -_mesa_Uniform1ivARB (GLint, GLsizei, const GLint *); - -extern void GLAPIENTRY -_mesa_Uniform2ivARB (GLint, GLsizei, const GLint *); - -extern void GLAPIENTRY -_mesa_Uniform3ivARB (GLint, GLsizei, const GLint *); - -extern void GLAPIENTRY -_mesa_Uniform4ivARB (GLint, GLsizei, const GLint *); - -extern void GLAPIENTRY -_mesa_UniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); - -extern void GLAPIENTRY -_mesa_UniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); - -extern void GLAPIENTRY -_mesa_UniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); - -extern void GLAPIENTRY -_mesa_GetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); - -extern void GLAPIENTRY -_mesa_GetObjectParameterivARB (GLhandleARB, GLenum, GLint *); - -extern void GLAPIENTRY -_mesa_GetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); - -extern void GLAPIENTRY -_mesa_GetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); - -extern GLint GLAPIENTRY -_mesa_GetUniformLocationARB (GLhandleARB, const GLcharARB *); - -extern void GLAPIENTRY -_mesa_GetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); - -extern void GLAPIENTRY -_mesa_GetUniformfvARB (GLhandleARB, GLint, GLfloat *); - -extern void GLAPIENTRY -_mesa_GetUniformivARB (GLhandleARB, GLint, GLint *); - -extern void GLAPIENTRY -_mesa_GetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); - -#if FEATURE_ARB_vertex_shader - -extern void GLAPIENTRY -_mesa_BindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); - -extern void GLAPIENTRY -_mesa_GetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); - -extern GLint GLAPIENTRY -_mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *); - -#endif /* FEATURE_ARB_vertex_shader */ - - -/* 2.0 */ -extern void GLAPIENTRY -_mesa_AttachShader(GLuint program, GLuint shader); - -extern GLuint GLAPIENTRY -_mesa_CreateShader(GLenum); - -extern GLuint GLAPIENTRY -_mesa_CreateProgram(void); - -extern void GLAPIENTRY -_mesa_DeleteProgram(GLuint program); - -extern void GLAPIENTRY -_mesa_DeleteShader(GLuint shader); - -extern void GLAPIENTRY -_mesa_DetachShader(GLuint program, GLuint shader); - -extern void GLAPIENTRY -_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount, - GLsizei *count, GLuint *obj); - -extern void GLAPIENTRY -_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params); - -extern void GLAPIENTRY -_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize, - GLsizei *length, GLchar *infoLog); - -extern void GLAPIENTRY -_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params); - -extern void GLAPIENTRY -_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize, - GLsizei *length, GLchar *infoLog); - -extern GLboolean GLAPIENTRY -_mesa_IsProgram(GLuint program); - -extern GLboolean GLAPIENTRY -_mesa_IsShader(GLuint shader); - - - -/* 2.1 */ -extern void GLAPIENTRY -_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value); - -extern void GLAPIENTRY -_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value); - -extern void GLAPIENTRY -_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value); - -extern void GLAPIENTRY -_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value); - -extern void GLAPIENTRY -_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value); - -extern void GLAPIENTRY -_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, - const GLfloat *value); - - -#endif /* SHADERS_H */ diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c index e364e2404..a56c70fa7 100644 --- a/mesalib/src/mesa/main/shared.c +++ b/mesalib/src/mesa/main/shared.c @@ -32,18 +32,15 @@ #include "imports.h" #include "mtypes.h" #include "hash.h" -#include "arrayobj.h" +#if FEATURE_ATI_fragment_shader +#include "atifragshader.h" +#endif #include "bufferobj.h" #include "shared.h" -#include "shader/program.h" -#include "shader/shader_api.h" +#include "program/program.h" #include "dlist.h" -#if FEATURE_ATI_fragment_shader -#include "shader/atifragshader.h" -#endif -#if FEATURE_ARB_sync +#include "shaderobj.h" #include "syncobj.h" -#endif /** * Allocate and initialize a shared context state structure. @@ -123,9 +120,7 @@ _mesa_alloc_shared_state(GLcontext *ctx) shared->RenderBuffers = _mesa_NewHashTable(); #endif -#if FEATURE_ARB_sync make_empty_list(& shared->SyncObjects); -#endif return shared; } @@ -228,12 +223,12 @@ delete_shader_cb(GLuint id, void *data, void *userData) GLcontext *ctx = (GLcontext *) userData; struct gl_shader *sh = (struct gl_shader *) data; if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER) { - _mesa_free_shader(ctx, sh); + ctx->Driver.DeleteShader(ctx, sh); } else { struct gl_shader_program *shProg = (struct gl_shader_program *) data; ASSERT(shProg->Type == GL_SHADER_PROGRAM_MESA); - _mesa_free_shader_program(ctx, shProg); + ctx->Driver.DeleteShaderProgram(ctx, shProg); } } @@ -289,6 +284,10 @@ free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) { GLuint i; + /* Free the dummy/fallback texture object */ + if (shared->FallbackTex) + ctx->Driver.DeleteTexture(ctx, shared->FallbackTex); + /* * Free display lists */ @@ -334,7 +333,6 @@ free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) _mesa_reference_buffer_object(ctx, &shared->NullBufferObj, NULL); #endif -#if FEATURE_ARB_sync { struct simple_node *node; struct simple_node *temp; @@ -343,7 +341,6 @@ free_shared_state(GLcontext *ctx, struct gl_shared_state *shared) _mesa_unref_sync_object(ctx, (struct gl_sync_object *) node); } } -#endif /* * Free texture objects (after FBOs since some textures might have diff --git a/mesalib/src/mesa/main/shared.h b/mesalib/src/mesa/main/shared.h index ef164a145..5166a0ce5 100644 --- a/mesalib/src/mesa/main/shared.h +++ b/mesalib/src/mesa/main/shared.h @@ -25,6 +25,7 @@ #ifndef SHARED_H #define SHARED_H +#include "mtypes.h" struct gl_shared_state * _mesa_alloc_shared_state(GLcontext *ctx); diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c index b971cc976..4a3dffe4c 100644 --- a/mesalib/src/mesa/main/state.c +++ b/mesalib/src/mesa/main/state.c @@ -41,8 +41,8 @@ #include "light.h" #include "matrix.h" #include "pixel.h" -#include "shader/program.h" -#include "shader/prog_parameter.h" +#include "program/program.h" +#include "program/prog_parameter.h" #include "state.h" #include "stencil.h" #include "texenvprogram.h" @@ -250,6 +250,7 @@ update_program(GLcontext *ctx) const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current; const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current; + const struct gl_geometry_program *prevGP = ctx->GeometryProgram._Current; GLbitfield new_state = 0x0; /* @@ -291,6 +292,15 @@ update_program(GLcontext *ctx) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); } + if (shProg && shProg->LinkStatus && shProg->GeometryProgram) { + /* Use shader programs */ + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, + shProg->GeometryProgram); + } else { + /* no fragment program */ + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram._Current, NULL); + } + /* Examine vertex program after fragment program as * _mesa_get_fixed_func_vertex_program() needs to know active * fragprog inputs. @@ -327,7 +337,15 @@ update_program(GLcontext *ctx) (struct gl_program *) ctx->FragmentProgram._Current); } } - + + if (ctx->GeometryProgram._Current != prevGP) { + new_state |= _NEW_PROGRAM; + if (ctx->Driver.BindProgram) { + ctx->Driver.BindProgram(ctx, MESA_GEOMETRY_PROGRAM, + (struct gl_program *) ctx->GeometryProgram._Current); + } + } + if (ctx->VertexProgram._Current != prevVP) { new_state |= _NEW_PROGRAM; if (ctx->Driver.BindProgram) { @@ -356,6 +374,16 @@ update_program_constants(GLcontext *ctx) } } + if (ctx->GeometryProgram._Current) { + const struct gl_program_parameter_list *params = + ctx->GeometryProgram._Current->Base.Parameters; + /*FIXME: StateFlags is always 0 because we have unnamed constant + * not state changes */ + if (params /*&& params->StateFlags & ctx->NewState*/) { + new_state |= _NEW_PROGRAM_CONSTANTS; + } + } + if (ctx->VertexProgram._Current) { const struct gl_program_parameter_list *params = ctx->VertexProgram._Current->Base.Parameters; @@ -537,7 +565,7 @@ _mesa_update_state_locked( GLcontext *ctx ) /* Determine which state flags effect vertex/fragment program state */ if (ctx->FragmentProgram._MaintainTexEnvProgram) { - prog_flags |= (_NEW_TEXTURE | _NEW_FOG | + prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG | _NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE | _NEW_PROGRAM); } diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c index 5b7aaa1d0..791092d9d 100644 --- a/mesalib/src/mesa/main/syncobj.c +++ b/mesalib/src/mesa/main/syncobj.c @@ -59,6 +59,8 @@ #include "imports.h" #include "context.h" #include "macros.h" +#include "get.h" +#include "dispatch.h" #if FEATURE_ARB_sync #include "syncobj.h" @@ -136,6 +138,19 @@ _mesa_init_sync_object_functions(struct dd_function_table *driver) } +void GLAPIENTRY +_mesa_init_sync_dispatch(struct _glapi_table *disp) +{ + SET_IsSync(disp, _mesa_IsSync); + SET_DeleteSync(disp, _mesa_DeleteSync); + SET_FenceSync(disp, _mesa_FenceSync); + SET_ClientWaitSync(disp, _mesa_ClientWaitSync); + SET_WaitSync(disp, _mesa_WaitSync); + SET_GetInteger64v(disp, _mesa_GetInteger64v); + SET_GetSynciv(disp, _mesa_GetSynciv); +} + + /** * Allocate/init the context state related to sync objects. */ diff --git a/mesalib/src/mesa/main/syncobj.h b/mesalib/src/mesa/main/syncobj.h index 161ea4411..326df650f 100644 --- a/mesalib/src/mesa/main/syncobj.h +++ b/mesalib/src/mesa/main/syncobj.h @@ -31,12 +31,19 @@ #ifndef SYNCOBJ_H #define SYNCOBJ_H -#include "context.h" +#include "main/mtypes.h" + +struct dd_function_table; + +#if FEATURE_ARB_sync extern void GLAPIENTRY _mesa_init_sync_object_functions(struct dd_function_table *driver); extern void GLAPIENTRY +_mesa_init_sync_dispatch(struct _glapi_table *disp); + +extern void GLAPIENTRY _mesa_init_sync(GLcontext *); extern void GLAPIENTRY @@ -67,4 +74,42 @@ extern void GLAPIENTRY _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#else /* FEATURE_ARB_sync */ + +#include "main/compiler.h" + +static INLINE void +_mesa_init_sync_object_functions(struct dd_function_table *driver) +{ +} + +static INLINE void +_mesa_init_sync_dispatch(struct _glapi_table *disp) +{ +} + +static INLINE void +_mesa_init_sync(GLcontext *ctx) +{ +} + +static INLINE void +_mesa_free_sync_data(GLcontext *ctx) +{ +} + +static INLINE void +_mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) +{ + ASSERT_NO_FEATURE(); +} + +#endif /* FEATURE_ARB_sync */ + #endif /* SYNCOBJ_H */ diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c index cff6de89e..e911524cb 100644 --- a/mesalib/src/mesa/main/texcompress.c +++ b/mesalib/src/mesa/main/texcompress.c @@ -33,7 +33,6 @@ #include "glheader.h" #include "imports.h" #include "colormac.h" -#include "context.h" #include "formats.h" #include "texcompress.h" @@ -107,6 +106,24 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all) } #endif /* FEATURE_EXT_texture_sRGB */ return n; + +#if FEATURE_ES1 || FEATURE_ES2 + if (formats) { + formats[n++] = GL_PALETTE4_RGB8_OES; + formats[n++] = GL_PALETTE4_RGBA8_OES; + formats[n++] = GL_PALETTE4_R5_G6_B5_OES; + formats[n++] = GL_PALETTE4_RGBA4_OES; + formats[n++] = GL_PALETTE4_RGB5_A1_OES; + formats[n++] = GL_PALETTE8_RGB8_OES; + formats[n++] = GL_PALETTE8_RGBA8_OES; + formats[n++] = GL_PALETTE8_R5_G6_B5_OES; + formats[n++] = GL_PALETTE8_RGBA4_OES; + formats[n++] = GL_PALETTE8_RGB5_A1_OES; + } + else { + n += 10; + } +#endif } diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c index 04acf05e5..c8b45bd3a 100644 --- a/mesalib/src/mesa/main/texcompress_fxt1.c +++ b/mesalib/src/mesa/main/texcompress_fxt1.c @@ -32,9 +32,9 @@ #include "glheader.h" #include "imports.h" #include "colormac.h" -#include "context.h" #include "convolve.h" #include "image.h" +#include "macros.h" #include "mipmap.h" #include "texcompress.h" #include "texcompress_fxt1.h" diff --git a/mesalib/src/mesa/main/texcompress_fxt1.h b/mesalib/src/mesa/main/texcompress_fxt1.h index d63ca71e2..38048b26c 100644 --- a/mesalib/src/mesa/main/texcompress_fxt1.h +++ b/mesalib/src/mesa/main/texcompress_fxt1.h @@ -25,9 +25,11 @@ #ifndef TEXCOMPRESS_FXT1_H #define TEXCOMPRESS_FXT1_H -#include "main/mtypes.h" +#include "glheader.h" #include "texstore.h" +struct gl_texture_image; + #if FEATURE_texture_fxt1 extern GLboolean diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c index fcd28a4b4..45a2f9c17 100644 --- a/mesalib/src/mesa/main/texcompress_s3tc.c +++ b/mesalib/src/mesa/main/texcompress_s3tc.c @@ -36,10 +36,10 @@ #include "glheader.h" #include "imports.h" #include "colormac.h" -#include "context.h" #include "convolve.h" #include "dlopen.h" #include "image.h" +#include "macros.h" #include "texcompress.h" #include "texcompress_s3tc.h" #include "texstore.h" @@ -48,7 +48,7 @@ #if FEATURE_texture_s3tc -#ifdef __MINGW32__ +#if defined(_WIN32) || defined(WIN32) #define DXTN_LIBNAME "dxtn.dll" #define RTLD_LAZY 0 #define RTLD_GLOBAL 0 @@ -78,7 +78,7 @@ nonlinear_to_linear(GLubyte cs8) table[i] = cs / 12.92f; } else { - table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); + table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4); } } tableReady = GL_TRUE; @@ -149,7 +149,6 @@ _mesa_init_texture_s3tc( GLcontext *ctx ) } if (dxtlibhandle) { ctx->Mesa_DXTn = GL_TRUE; - _mesa_warning(ctx, "software DXTn compression/decompression available"); } #else (void) ctx; @@ -168,7 +167,8 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1); + ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1 || + dstFormat == MESA_FORMAT_SRGB_DXT1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -231,7 +231,8 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1 || + dstFormat == MESA_FORMAT_SRGBA_DXT1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -293,7 +294,8 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3 || + dstFormat == MESA_FORMAT_SRGBA_DXT3); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -354,7 +356,8 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5 || + dstFormat == MESA_FORMAT_SRGBA_DXT5); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c index 4442fb8cf..3a55128c7 100644 --- a/mesalib/src/mesa/main/texenv.c +++ b/mesalib/src/mesa/main/texenv.c @@ -196,57 +196,34 @@ set_combiner_source(GLcontext *ctx, /* * Translate pname to (term, alpha). + * + * The enums were given sequential values for a reason. */ switch (pname) { case GL_SOURCE0_RGB: - term = 0; - alpha = GL_FALSE; - break; case GL_SOURCE1_RGB: - term = 1; - alpha = GL_FALSE; - break; case GL_SOURCE2_RGB: - term = 2; - alpha = GL_FALSE; - break; case GL_SOURCE3_RGB_NV: - if (ctx->Extensions.NV_texture_env_combine4) { - term = 3; - alpha = GL_FALSE; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } + term = pname - GL_SOURCE0_RGB; + alpha = GL_FALSE; break; case GL_SOURCE0_ALPHA: - term = 0; - alpha = GL_TRUE; - break; case GL_SOURCE1_ALPHA: - term = 1; - alpha = GL_TRUE; - break; case GL_SOURCE2_ALPHA: - term = 2; - alpha = GL_TRUE; - break; case GL_SOURCE3_ALPHA_NV: - if (ctx->Extensions.NV_texture_env_combine4) { - term = 3; - alpha = GL_TRUE; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } + term = pname - GL_SOURCE0_ALPHA; + alpha = GL_TRUE; break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } + if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + assert(term < MAX_COMBINER_TERMS); /* @@ -310,68 +287,33 @@ set_combiner_operand(GLcontext *ctx, return; } + /* The enums were given sequential values for a reason. + */ switch (pname) { case GL_OPERAND0_RGB: - term = 0; - alpha = GL_FALSE; - break; case GL_OPERAND1_RGB: - term = 1; - alpha = GL_FALSE; - break; case GL_OPERAND2_RGB: - if (ctx->Extensions.ARB_texture_env_combine) { - term = 2; - alpha = GL_FALSE; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; case GL_OPERAND3_RGB_NV: - if (ctx->Extensions.NV_texture_env_combine4) { - term = 3; - alpha = GL_FALSE; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } + term = pname - GL_OPERAND0_RGB; + alpha = GL_FALSE; break; case GL_OPERAND0_ALPHA: - term = 0; - alpha = GL_TRUE; - break; case GL_OPERAND1_ALPHA: - term = 1; - alpha = GL_TRUE; - break; case GL_OPERAND2_ALPHA: - if (ctx->Extensions.ARB_texture_env_combine) { - term = 2; - alpha = GL_TRUE; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } - break; case GL_OPERAND3_ALPHA_NV: - if (ctx->Extensions.NV_texture_env_combine4) { - term = 3; - alpha = GL_TRUE; - } - else { - TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); - return; - } + term = pname - GL_OPERAND0_ALPHA; + alpha = GL_TRUE; break; default: TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); return; } + if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) { + TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname); + return; + } + assert(term < MAX_COMBINER_TERMS); /* @@ -380,10 +322,23 @@ set_combiner_operand(GLcontext *ctx, switch (param) { case GL_SRC_COLOR: case GL_ONE_MINUS_SRC_COLOR: - legal = !alpha; + /* The color input can only be used with GL_OPERAND[01]_RGB in the EXT + * version. In the ARB and NV versions they can be used for any RGB + * operand. + */ + legal = !alpha + && ((term < 2) || ctx->Extensions.ARB_texture_env_combine + || ctx->Extensions.NV_texture_env_combine4); break; - case GL_SRC_ALPHA: case GL_ONE_MINUS_SRC_ALPHA: + /* GL_ONE_MINUS_SRC_ALPHA can only be used with + * GL_OPERAND[01]_(RGB|ALPHA) in the EXT version. In the ARB and NV + * versions it can be used for any operand. + */ + legal = (term < 2) || ctx->Extensions.ARB_texture_env_combine + || ctx->Extensions.NV_texture_env_combine4; + break; + case GL_SRC_ALPHA: legal = GL_TRUE; break; default: diff --git a/mesalib/src/mesa/main/texenvprogram.c b/mesalib/src/mesa/main/texenvprogram.c index 964ba13c7..20f02cefe 100644 --- a/mesalib/src/mesa/main/texenvprogram.c +++ b/mesalib/src/mesa/main/texenvprogram.c @@ -28,13 +28,13 @@ #include "glheader.h" #include "imports.h" -#include "shader/program.h" -#include "shader/prog_parameter.h" -#include "shader/prog_cache.h" -#include "shader/prog_instruction.h" -#include "shader/prog_print.h" -#include "shader/prog_statevars.h" -#include "shader/programopt.h" +#include "program/program.h" +#include "program/prog_parameter.h" +#include "program/prog_cache.h" +#include "program/prog_instruction.h" +#include "program/prog_print.h" +#include "program/prog_statevars.h" +#include "program/programopt.h" #include "texenvprogram.h" @@ -98,6 +98,7 @@ struct state_key { GLuint fog_enabled:1; GLuint fog_mode:2; /**< FOG_x */ GLuint inputs_available:12; + GLuint num_draw_buffers:4; /* NOTE: This array of structs must be last! (see "keySize" below) */ struct { @@ -485,6 +486,9 @@ static GLuint make_state_key( GLcontext *ctx, struct state_key *key ) inputs_referenced |= FRAG_BIT_FOGC; /* maybe */ } + /* _NEW_BUFFERS */ + key->num_draw_buffers = ctx->DrawBuffer->_NumColorDrawBuffers; + key->inputs_available = (inputs_available & inputs_referenced); /* compute size of state key, ignoring unused texture units */ @@ -903,7 +907,7 @@ static struct ureg get_zero( struct texenv_fragment_program *p ) static void program_error( struct texenv_fragment_program *p, const char *msg ) { - _mesa_problem(NULL, msg); + _mesa_problem(NULL, "%s", msg); p->error = 1; } @@ -1199,11 +1203,14 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit) else alpha_saturate = GL_FALSE; - /* If this is the very last calculation, emit direct to output reg: + /* If this is the very last calculation (and various other conditions + * are met), emit directly to the color output register. Otherwise, + * emit to a temporary register. */ if (key->separate_specular || unit != p->last_tex_stage || alpha_shift || + key->num_draw_buffers != 1 || rgb_shift) dest = get_temp( p ); else @@ -1438,10 +1445,10 @@ create_new_program(GLcontext *ctx, struct state_key *key, p.program->Base.Parameters = _mesa_new_parameter_list(); p.program->Base.InputsRead = 0x0; - if (ctx->DrawBuffer->_NumColorDrawBuffers == 1) + if (key->num_draw_buffers == 1) p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR; else { - for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) + for (i = 0; i < key->num_draw_buffers; i++) p.program->Base.OutputsWritten |= (1 << (FRAG_RESULT_DATA0 + i)); } @@ -1493,8 +1500,8 @@ create_new_program(GLcontext *ctx, struct state_key *key, cf = get_source( &p, SRC_PREVIOUS, 0 ); - for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { - if (ctx->DrawBuffer->_NumColorDrawBuffers == 1) + for (i = 0; i < key->num_draw_buffers; i++) { + if (key->num_draw_buffers == 1) out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR ); else { out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i ); diff --git a/mesalib/src/mesa/main/texfetch.c b/mesalib/src/mesa/main/texfetch.c index b37039429..c03bc71cd 100644 --- a/mesalib/src/mesa/main/texfetch.c +++ b/mesalib/src/mesa/main/texfetch.c @@ -34,7 +34,7 @@ #include "colormac.h" -#include "context.h" +#include "macros.h" #include "texcompress.h" #include "texcompress_fxt1.h" #include "texcompress_s3tc.h" @@ -60,7 +60,7 @@ nonlinear_to_linear(GLubyte cs8) table[i] = cs / 12.92f; } else { - table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); + table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4); } } tableReady = GL_TRUE; @@ -115,7 +115,7 @@ static void store_null_texel(struct gl_texture_image *texImage, * XXX this is somewhat temporary. */ static struct { - GLuint Name; + gl_format Name; FetchTexelFuncF Fetch1D; FetchTexelFuncF Fetch2D; FetchTexelFuncF Fetch3D; @@ -124,222 +124,13 @@ static struct { texfetch_funcs[MESA_FORMAT_COUNT] = { { - MESA_FORMAT_SRGB8, - fetch_texel_1d_srgb8, - fetch_texel_2d_srgb8, - fetch_texel_3d_srgb8, - store_texel_srgb8 - }, - { - MESA_FORMAT_SRGBA8, - fetch_texel_1d_srgba8, - fetch_texel_2d_srgba8, - fetch_texel_3d_srgba8, - store_texel_srgba8 - }, - { - MESA_FORMAT_SARGB8, - fetch_texel_1d_sargb8, - fetch_texel_2d_sargb8, - fetch_texel_3d_sargb8, - store_texel_sargb8 - }, - { - MESA_FORMAT_SL8, - fetch_texel_1d_sl8, - fetch_texel_2d_sl8, - fetch_texel_3d_sl8, - store_texel_sl8 - }, - { - MESA_FORMAT_SLA8, - fetch_texel_1d_sla8, - fetch_texel_2d_sla8, - fetch_texel_3d_sla8, - store_texel_sla8 - }, - { - MESA_FORMAT_RGB_FXT1, - NULL, - _mesa_fetch_texel_2d_f_rgb_fxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_FXT1, - NULL, - _mesa_fetch_texel_2d_f_rgba_fxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_DXT1, - NULL, - _mesa_fetch_texel_2d_f_rgb_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_DXT1, - NULL, - _mesa_fetch_texel_2d_f_rgba_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_DXT3, - NULL, - _mesa_fetch_texel_2d_f_rgba_dxt3, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_DXT5, - NULL, - _mesa_fetch_texel_2d_f_rgba_dxt5, - NULL, - NULL - }, - { - MESA_FORMAT_SRGB_DXT1, - NULL, - _mesa_fetch_texel_2d_f_srgb_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_SRGBA_DXT1, - NULL, - _mesa_fetch_texel_2d_f_srgba_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_SRGBA_DXT3, - NULL, - _mesa_fetch_texel_2d_f_srgba_dxt3, - NULL, - NULL - }, - { - MESA_FORMAT_SRGBA_DXT5, - NULL, - _mesa_fetch_texel_2d_f_srgba_dxt5, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_FLOAT32, - fetch_texel_1d_f_rgba_f32, - fetch_texel_2d_f_rgba_f32, - fetch_texel_3d_f_rgba_f32, - store_texel_rgba_f32 - }, - { - MESA_FORMAT_RGBA_FLOAT16, - fetch_texel_1d_f_rgba_f16, - fetch_texel_2d_f_rgba_f16, - fetch_texel_3d_f_rgba_f16, - store_texel_rgba_f16 - }, - { - MESA_FORMAT_RGB_FLOAT32, - fetch_texel_1d_f_rgb_f32, - fetch_texel_2d_f_rgb_f32, - fetch_texel_3d_f_rgb_f32, - store_texel_rgb_f32 - }, - { - MESA_FORMAT_RGB_FLOAT16, - fetch_texel_1d_f_rgb_f16, - fetch_texel_2d_f_rgb_f16, - fetch_texel_3d_f_rgb_f16, - store_texel_rgb_f16 - }, - { - MESA_FORMAT_ALPHA_FLOAT32, - fetch_texel_1d_f_alpha_f32, - fetch_texel_2d_f_alpha_f32, - fetch_texel_3d_f_alpha_f32, - store_texel_alpha_f32 - }, - { - MESA_FORMAT_ALPHA_FLOAT16, - fetch_texel_1d_f_alpha_f16, - fetch_texel_2d_f_alpha_f16, - fetch_texel_3d_f_alpha_f16, - store_texel_alpha_f16 - }, - { - MESA_FORMAT_LUMINANCE_FLOAT32, - fetch_texel_1d_f_luminance_f32, - fetch_texel_2d_f_luminance_f32, - fetch_texel_3d_f_luminance_f32, - store_texel_luminance_f32 - }, - { - MESA_FORMAT_LUMINANCE_FLOAT16, - fetch_texel_1d_f_luminance_f16, - fetch_texel_2d_f_luminance_f16, - fetch_texel_3d_f_luminance_f16, - store_texel_luminance_f16 - }, - { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, - fetch_texel_1d_f_luminance_alpha_f32, - fetch_texel_2d_f_luminance_alpha_f32, - fetch_texel_3d_f_luminance_alpha_f32, - store_texel_luminance_alpha_f32 - }, - { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, - fetch_texel_1d_f_luminance_alpha_f16, - fetch_texel_2d_f_luminance_alpha_f16, - fetch_texel_3d_f_luminance_alpha_f16, - store_texel_luminance_alpha_f16 - }, - { - MESA_FORMAT_INTENSITY_FLOAT32, - fetch_texel_1d_f_intensity_f32, - fetch_texel_2d_f_intensity_f32, - fetch_texel_3d_f_intensity_f32, - store_texel_intensity_f32 - }, - { - MESA_FORMAT_INTENSITY_FLOAT16, - fetch_texel_1d_f_intensity_f16, - fetch_texel_2d_f_intensity_f16, - fetch_texel_3d_f_intensity_f16, - store_texel_intensity_f16 - }, - { - MESA_FORMAT_DUDV8, - fetch_texel_1d_dudv8, - fetch_texel_2d_dudv8, - fetch_texel_3d_dudv8, - NULL - }, - { - MESA_FORMAT_SIGNED_RGBA8888, - fetch_texel_1d_signed_rgba8888, - fetch_texel_2d_signed_rgba8888, - fetch_texel_3d_signed_rgba8888, - store_texel_signed_rgba8888 - }, - { - MESA_FORMAT_SIGNED_RGBA8888_REV, - fetch_texel_1d_signed_rgba8888_rev, - fetch_texel_2d_signed_rgba8888_rev, - fetch_texel_3d_signed_rgba8888_rev, - store_texel_signed_rgba8888_rev - }, - { - MESA_FORMAT_SIGNED_RGBA_16, - NULL, /* XXX to do */ - NULL, - NULL, - NULL + MESA_FORMAT_NONE, + fetch_null_texelf, + fetch_null_texelf, + fetch_null_texelf, + store_null_texel }, + { MESA_FORMAT_RGBA8888, fetch_texel_1d_f_rgba8888, @@ -563,6 +354,330 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_2d_f_z32, fetch_texel_3d_f_z32, store_texel_z32 + }, + { + MESA_FORMAT_S8, + NULL, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_SRGB8, + fetch_texel_1d_srgb8, + fetch_texel_2d_srgb8, + fetch_texel_3d_srgb8, + store_texel_srgb8 + }, + { + MESA_FORMAT_SRGBA8, + fetch_texel_1d_srgba8, + fetch_texel_2d_srgba8, + fetch_texel_3d_srgba8, + store_texel_srgba8 + }, + { + MESA_FORMAT_SARGB8, + fetch_texel_1d_sargb8, + fetch_texel_2d_sargb8, + fetch_texel_3d_sargb8, + store_texel_sargb8 + }, + { + MESA_FORMAT_SL8, + fetch_texel_1d_sl8, + fetch_texel_2d_sl8, + fetch_texel_3d_sl8, + store_texel_sl8 + }, + { + MESA_FORMAT_SLA8, + fetch_texel_1d_sla8, + fetch_texel_2d_sla8, + fetch_texel_3d_sla8, + store_texel_sla8 + }, + { + MESA_FORMAT_SRGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt5, + NULL, + NULL + }, + + { + MESA_FORMAT_RGB_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt5, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FLOAT32, + fetch_texel_1d_f_rgba_f32, + fetch_texel_2d_f_rgba_f32, + fetch_texel_3d_f_rgba_f32, + store_texel_rgba_f32 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + fetch_texel_1d_f_rgba_f16, + fetch_texel_2d_f_rgba_f16, + fetch_texel_3d_f_rgba_f16, + store_texel_rgba_f16 + }, + { + MESA_FORMAT_RGB_FLOAT32, + fetch_texel_1d_f_rgb_f32, + fetch_texel_2d_f_rgb_f32, + fetch_texel_3d_f_rgb_f32, + store_texel_rgb_f32 + }, + { + MESA_FORMAT_RGB_FLOAT16, + fetch_texel_1d_f_rgb_f16, + fetch_texel_2d_f_rgb_f16, + fetch_texel_3d_f_rgb_f16, + store_texel_rgb_f16 + }, + { + MESA_FORMAT_ALPHA_FLOAT32, + fetch_texel_1d_f_alpha_f32, + fetch_texel_2d_f_alpha_f32, + fetch_texel_3d_f_alpha_f32, + store_texel_alpha_f32 + }, + { + MESA_FORMAT_ALPHA_FLOAT16, + fetch_texel_1d_f_alpha_f16, + fetch_texel_2d_f_alpha_f16, + fetch_texel_3d_f_alpha_f16, + store_texel_alpha_f16 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT32, + fetch_texel_1d_f_luminance_f32, + fetch_texel_2d_f_luminance_f32, + fetch_texel_3d_f_luminance_f32, + store_texel_luminance_f32 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT16, + fetch_texel_1d_f_luminance_f16, + fetch_texel_2d_f_luminance_f16, + fetch_texel_3d_f_luminance_f16, + store_texel_luminance_f16 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, + fetch_texel_1d_f_luminance_alpha_f32, + fetch_texel_2d_f_luminance_alpha_f32, + fetch_texel_3d_f_luminance_alpha_f32, + store_texel_luminance_alpha_f32 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, + fetch_texel_1d_f_luminance_alpha_f16, + fetch_texel_2d_f_luminance_alpha_f16, + fetch_texel_3d_f_luminance_alpha_f16, + store_texel_luminance_alpha_f16 + }, + { + MESA_FORMAT_INTENSITY_FLOAT32, + fetch_texel_1d_f_intensity_f32, + fetch_texel_2d_f_intensity_f32, + fetch_texel_3d_f_intensity_f32, + store_texel_intensity_f32 + }, + { + MESA_FORMAT_INTENSITY_FLOAT16, + fetch_texel_1d_f_intensity_f16, + fetch_texel_2d_f_intensity_f16, + fetch_texel_3d_f_intensity_f16, + store_texel_intensity_f16 + }, + + /* non-normalized, signed int */ + { + MESA_FORMAT_RGBA_INT8, + fetch_texel_1d_rgba_int8, + fetch_texel_2d_rgba_int8, + fetch_texel_3d_rgba_int8, + store_texel_rgba_int8 + }, + { + MESA_FORMAT_RGBA_INT16, + fetch_texel_1d_rgba_int16, + fetch_texel_2d_rgba_int16, + fetch_texel_3d_rgba_int16, + store_texel_rgba_int16 + }, + { + MESA_FORMAT_RGBA_INT32, + fetch_texel_1d_rgba_int32, + fetch_texel_2d_rgba_int32, + fetch_texel_3d_rgba_int32, + store_texel_rgba_int32 + }, + + /* non-normalized, unsigned int */ + { + MESA_FORMAT_RGBA_UINT8, + fetch_texel_1d_rgba_uint8, + fetch_texel_2d_rgba_uint8, + fetch_texel_3d_rgba_uint8, + store_texel_rgba_uint8 + }, + { + MESA_FORMAT_RGBA_UINT16, + fetch_texel_1d_rgba_uint16, + fetch_texel_2d_rgba_uint16, + fetch_texel_3d_rgba_uint16, + store_texel_rgba_uint16 + }, + { + MESA_FORMAT_RGBA_UINT32, + fetch_texel_1d_rgba_uint32, + fetch_texel_2d_rgba_uint32, + fetch_texel_3d_rgba_uint32, + store_texel_rgba_uint32 + }, + + /* dudv */ + { + MESA_FORMAT_DUDV8, + fetch_texel_1d_dudv8, + fetch_texel_2d_dudv8, + fetch_texel_3d_dudv8, + NULL + }, + + /* signed, normalized */ + { + MESA_FORMAT_SIGNED_R8, + fetch_texel_1d_signed_r8, + fetch_texel_2d_signed_r8, + fetch_texel_3d_signed_r8, + store_texel_signed_r8 + }, + { + MESA_FORMAT_SIGNED_RG88, + fetch_texel_1d_signed_rg88, + fetch_texel_2d_signed_rg88, + fetch_texel_3d_signed_rg88, + store_texel_signed_rg88 + }, + { + MESA_FORMAT_SIGNED_RGBX8888, + fetch_texel_1d_signed_rgbx8888, + fetch_texel_2d_signed_rgbx8888, + fetch_texel_3d_signed_rgbx8888, + store_texel_signed_rgbx8888 + }, + { + MESA_FORMAT_SIGNED_RGBA8888, + fetch_texel_1d_signed_rgba8888, + fetch_texel_2d_signed_rgba8888, + fetch_texel_3d_signed_rgba8888, + store_texel_signed_rgba8888 + }, + { + MESA_FORMAT_SIGNED_RGBA8888_REV, + fetch_texel_1d_signed_rgba8888_rev, + fetch_texel_2d_signed_rgba8888_rev, + fetch_texel_3d_signed_rgba8888_rev, + store_texel_signed_rgba8888_rev + }, + { + MESA_FORMAT_SIGNED_R_16, + fetch_texel_1d_signed_r_16, + fetch_texel_2d_signed_r_16, + fetch_texel_3d_signed_r_16, + store_texel_signed_r_16 + }, + { + MESA_FORMAT_SIGNED_RG_16, + fetch_texel_1d_signed_rg_16, + fetch_texel_2d_signed_rg_16, + fetch_texel_3d_signed_rg_16, + store_texel_signed_rg_16 + }, + { + MESA_FORMAT_SIGNED_RGB_16, + fetch_texel_1d_signed_rgb_16, + fetch_texel_2d_signed_rgb_16, + fetch_texel_3d_signed_rgb_16, + store_texel_signed_rgb_16 + }, + { + MESA_FORMAT_SIGNED_RGBA_16, + fetch_texel_1d_signed_rgba_16, + fetch_texel_2d_signed_rgba_16, + fetch_texel_3d_signed_rgba_16, + store_texel_signed_rgba_16 + }, + { + MESA_FORMAT_RGBA_16, + fetch_texel_1d_rgba_16, + fetch_texel_2d_rgba_16, + fetch_texel_3d_rgba_16, + store_texel_rgba_16 } }; @@ -570,49 +685,39 @@ texfetch_funcs[MESA_FORMAT_COUNT] = static FetchTexelFuncF _mesa_get_texel_fetch_func(gl_format format, GLuint dims) { - FetchTexelFuncF f = NULL; - GLuint i; - /* XXX replace loop with direct table lookup */ - for (i = 0; i < MESA_FORMAT_COUNT; i++) { - if (texfetch_funcs[i].Name == format) { - switch (dims) { - case 1: - f = texfetch_funcs[i].Fetch1D; - break; - case 2: - f = texfetch_funcs[i].Fetch2D; - break; - case 3: - f = texfetch_funcs[i].Fetch3D; - break; - } - if (!f) - f = fetch_null_texelf; - return f; - } +#ifdef DEBUG + /* check that the table entries are sorted by format name */ + gl_format fmt; + for (fmt = 0; fmt < MESA_FORMAT_COUNT; fmt++) { + assert(texfetch_funcs[fmt].Name == fmt); + } +#endif + + assert(Elements(texfetch_funcs) == MESA_FORMAT_COUNT); + assert(format < MESA_FORMAT_COUNT); + + switch (dims) { + case 1: + return texfetch_funcs[format].Fetch1D; + case 2: + return texfetch_funcs[format].Fetch2D; + case 3: + return texfetch_funcs[format].Fetch3D; + default: + assert(0 && "bad dims in _mesa_get_texel_fetch_func"); + return NULL; } - return NULL; } StoreTexelFunc _mesa_get_texel_store_func(gl_format format) { - GLuint i; - /* XXX replace loop with direct table lookup */ - for (i = 0; i < MESA_FORMAT_COUNT; i++) { - if (texfetch_funcs[i].Name == format) { - if (texfetch_funcs[i].StoreTexel) - return texfetch_funcs[i].StoreTexel; - else - return store_null_texel; - } - } - return NULL; + assert(format < MESA_FORMAT_COUNT); + return texfetch_funcs[format].StoreTexel; } - /** * Adaptor for fetching a GLchan texel from a float-valued texture. */ diff --git a/mesalib/src/mesa/main/texfetch_tmp.h b/mesalib/src/mesa/main/texfetch_tmp.h index b11ed5c39..f94355437 100644 --- a/mesalib/src/mesa/main/texfetch_tmp.h +++ b/mesalib/src/mesa/main/texfetch_tmp.h @@ -1195,6 +1195,174 @@ static void store_texel_sla8(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_RGBA_INT8 **************************************************/ + +static void +FETCH(rgba_int8)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 4); + texel[RCOMP] = (GLfloat) src[0]; + texel[GCOMP] = (GLfloat) src[1]; + texel[BCOMP] = (GLfloat) src[2]; + texel[ACOMP] = (GLfloat) src[3]; +} + +#if DIM == 3 +static void +store_texel_rgba_int8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLbyte *rgba = (const GLbyte *) texel; + GLbyte *dst = TEXEL_ADDR(GLbyte, texImage, i, j, k, 4); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + + +/* MESA_FORMAT_RGBA_INT16 **************************************************/ + +static void +FETCH(rgba_int16)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLshort *src = TEXEL_ADDR(GLshort, texImage, i, j, k, 4); + texel[RCOMP] = (GLfloat) src[0]; + texel[GCOMP] = (GLfloat) src[1]; + texel[BCOMP] = (GLfloat) src[2]; + texel[ACOMP] = (GLfloat) src[3]; +} + +#if DIM == 3 +static void +store_texel_rgba_int16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLshort *rgba = (const GLshort *) texel; + GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 4); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + + +/* MESA_FORMAT_RGBA_INT32 **************************************************/ + +static void +FETCH(rgba_int32)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLint *src = TEXEL_ADDR(GLint, texImage, i, j, k, 4); + texel[RCOMP] = (GLfloat) src[0]; + texel[GCOMP] = (GLfloat) src[1]; + texel[BCOMP] = (GLfloat) src[2]; + texel[ACOMP] = (GLfloat) src[3]; +} + +#if DIM == 3 +static void +store_texel_rgba_int32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLint *rgba = (const GLint *) texel; + GLint *dst = TEXEL_ADDR(GLint, texImage, i, j, k, 4); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + + +/* MESA_FORMAT_RGBA_UINT8 **************************************************/ + +static void +FETCH(rgba_uint8)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4); + texel[RCOMP] = (GLfloat) src[0]; + texel[GCOMP] = (GLfloat) src[1]; + texel[BCOMP] = (GLfloat) src[2]; + texel[ACOMP] = (GLfloat) src[3]; +} + +#if DIM == 3 +static void +store_texel_rgba_uint8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + + +/* MESA_FORMAT_RGBA_UINT16 **************************************************/ + +static void +FETCH(rgba_uint16)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 4); + texel[RCOMP] = (GLfloat) src[0]; + texel[GCOMP] = (GLfloat) src[1]; + texel[BCOMP] = (GLfloat) src[2]; + texel[ACOMP] = (GLfloat) src[3]; +} + +#if DIM == 3 +static void +store_texel_rgba_uint16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLushort *rgba = (const GLushort *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 4); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + + +/* MESA_FORMAT_RGBA_UINT32 **************************************************/ + +static void +FETCH(rgba_uint32)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 4); + texel[RCOMP] = (GLfloat) src[0]; + texel[GCOMP] = (GLfloat) src[1]; + texel[BCOMP] = (GLfloat) src[2]; + texel[ACOMP] = (GLfloat) src[3]; +} + +#if DIM == 3 +static void +store_texel_rgba_uint32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLuint *rgba = (const GLuint *) texel; + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 4); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + + /* MESA_FORMAT_DUDV8 ********************************************************/ /* this format by definition produces 0,0,0,1 as rgba values, @@ -1209,6 +1377,76 @@ static void FETCH(dudv8)(const struct gl_texture_image *texImage, texel[ACOMP] = 0; } + +/* MESA_FORMAT_SIGNED_R8 ***********************************************/ + +static void FETCH(signed_r8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1); + texel[RCOMP] = BYTE_TO_FLOAT_TEX( s ); + texel[GCOMP] = 0.0F; + texel[BCOMP] = 0.0F; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_signed_r8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLbyte *rgba = (const GLbyte *) texel; + GLbyte *dst = TEXEL_ADDR(GLbyte, texImage, i, j, k, 1); + *dst = rgba[RCOMP]; +} +#endif + + +/* MESA_FORMAT_SIGNED_RG88 ***********************************************/ + +static void FETCH(signed_rg88)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1); + texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) ); + texel[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s & 0xff) ); + texel[BCOMP] = 0.0F; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_signed_rg88(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLbyte *rg = (const GLbyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 2); + *dst = PACK_COLOR_88(rg[RCOMP], rg[GCOMP]); +} +#endif + + +/* MESA_FORMAT_SIGNED_RGBX8888 ***********************************************/ + +static void FETCH(signed_rgbx8888)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) ); + texel[GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 16) ); + texel[BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 8) ); + texel[ACOMP] = 1.0f; +} + +#if DIM == 3 +static void store_texel_signed_rgbx8888(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLbyte *rgba = (const GLbyte *) texel; + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], 255); +} +#endif + + /* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/ static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage, @@ -1253,6 +1491,142 @@ static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage, +/* MESA_FORMAT_SIGNED_R_16 ***********************************************/ + +static void +FETCH(signed_r_16)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1); + texel[RCOMP] = SHORT_TO_FLOAT_TEX( s ); + texel[GCOMP] = 0.0F; + texel[BCOMP] = 0.0F; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void +store_texel_signed_r_16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLshort *rgba = (const GLshort *) texel; + GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 1); + *dst = rgba[0]; +} +#endif + + +/* MESA_FORMAT_SIGNED_RG_16 ***********************************************/ + +static void +FETCH(signed_rg_16)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2); + texel[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] ); + texel[GCOMP] = SHORT_TO_FLOAT_TEX( s[1] ); + texel[BCOMP] = 0.0F; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void +store_texel_signed_rg_16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLshort *rgba = (const GLshort *) texel; + GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 2); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; +} +#endif + + +/* MESA_FORMAT_SIGNED_RGBA_16 ***********************************************/ + +static void +FETCH(signed_rgb_16)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 3); + texel[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] ); + texel[GCOMP] = SHORT_TO_FLOAT_TEX( s[1] ); + texel[BCOMP] = SHORT_TO_FLOAT_TEX( s[2] ); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void +store_texel_signed_rgb_16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLshort *rgba = (const GLshort *) texel; + GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 3); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; +} +#endif + + +/* MESA_FORMAT_SIGNED_RGBA_16 ***********************************************/ + +static void +FETCH(signed_rgba_16)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 4); + texel[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] ); + texel[GCOMP] = SHORT_TO_FLOAT_TEX( s[1] ); + texel[BCOMP] = SHORT_TO_FLOAT_TEX( s[2] ); + texel[ACOMP] = SHORT_TO_FLOAT_TEX( s[3] ); +} + +#if DIM == 3 +static void +store_texel_signed_rgba_16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLshort *rgba = (const GLshort *) texel; + GLshort *dst = TEXEL_ADDR(GLshort, texImage, i, j, k, 4); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + + + +/* MESA_FORMAT_RGBA_16 ***********************************************/ + +static void +FETCH(rgba_16)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4); + texel[RCOMP] = USHORT_TO_FLOAT( s[0] ); + texel[GCOMP] = USHORT_TO_FLOAT( s[1] ); + texel[BCOMP] = USHORT_TO_FLOAT( s[2] ); + texel[ACOMP] = USHORT_TO_FLOAT( s[3] ); +} + +#if DIM == 3 +static void +store_texel_rgba_16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLushort *rgba = (const GLushort *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 4); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; + dst[3] = rgba[ACOMP]; +} +#endif + + + /* MESA_FORMAT_YCBCR *********************************************************/ /* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats. diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index 096945a64..b9271ef58 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -61,12 +61,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, (void) type; switch (internalFormat) { - /* RGBA formats */ + /* shallow RGBA formats */ case 4: case GL_RGBA: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: case GL_RGBA8: return MESA_FORMAT_RGBA8888; case GL_RGB5_A1: @@ -76,12 +73,15 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGBA4: return MESA_FORMAT_ARGB4444; - /* RGB formats */ + /* deep RGBA formats */ + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + return MESA_FORMAT_RGBA_16; + + /* shallow RGB formats */ case 3: case GL_RGB: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: case GL_RGB8: return MESA_FORMAT_RGB888; case GL_R3_G3_B2: @@ -91,6 +91,12 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGB5: return MESA_FORMAT_RGB565; + /* deep RGB formats */ + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + return MESA_FORMAT_RGBA_16; + /* Alpha formats */ case GL_ALPHA: case GL_ALPHA4: @@ -294,6 +300,32 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, } } + if (ctx->VersionMajor * 10 + ctx->VersionMinor >= 31) { + switch (internalFormat) { + case GL_RED_SNORM: + case GL_R8_SNORM: + return MESA_FORMAT_SIGNED_R8; + case GL_RG_SNORM: + case GL_RG8_SNORM: + return MESA_FORMAT_SIGNED_RG88; + case GL_RGB_SNORM: + case GL_RGB8_SNORM: + return MESA_FORMAT_SIGNED_RGBX8888; + case GL_RGBA_SNORM: + case GL_RGBA8_SNORM: + return MESA_FORMAT_SIGNED_RGBA8888; + case GL_R16_SNORM: + return MESA_FORMAT_SIGNED_R_16; + case GL_RG16_SNORM: + return MESA_FORMAT_SIGNED_RG_16; + case GL_RGB16_SNORM: + return MESA_FORMAT_SIGNED_RGB_16; + case GL_RGBA16_SNORM: + return MESA_FORMAT_SIGNED_RGBA_16; + default: + ; /* fall-through */ + } + } #if FEATURE_EXT_texture_sRGB if (ctx->Extensions.EXT_texture_sRGB) { @@ -350,6 +382,53 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, } #endif /* FEATURE_EXT_texture_sRGB */ + if (ctx->Extensions.EXT_texture_integer) { + switch (internalFormat) { + case GL_RGBA32UI_EXT: + case GL_RGB32UI_EXT: + case GL_ALPHA32UI_EXT: + case GL_INTENSITY32UI_EXT: + case GL_LUMINANCE32UI_EXT: + case GL_LUMINANCE_ALPHA32UI_EXT: + return MESA_FORMAT_RGBA_UINT32; + case GL_RGBA16UI_EXT: + case GL_RGB16UI_EXT: + case GL_ALPHA16UI_EXT: + case GL_INTENSITY16UI_EXT: + case GL_LUMINANCE16UI_EXT: + case GL_LUMINANCE_ALPHA16UI_EXT: + return MESA_FORMAT_RGBA_UINT16; + case GL_RGBA8UI_EXT: + case GL_RGB8UI_EXT: + case GL_ALPHA8UI_EXT: + case GL_INTENSITY8UI_EXT: + case GL_LUMINANCE8UI_EXT: + case GL_LUMINANCE_ALPHA8UI_EXT: + return MESA_FORMAT_RGBA_UINT8; + case GL_RGBA32I_EXT: + case GL_RGB32I_EXT: + case GL_ALPHA32I_EXT: + case GL_INTENSITY32I_EXT: + case GL_LUMINANCE32I_EXT: + case GL_LUMINANCE_ALPHA32I_EXT: + return MESA_FORMAT_RGBA_INT32; + case GL_RGBA16I_EXT: + case GL_RGB16I_EXT: + case GL_ALPHA16I_EXT: + case GL_INTENSITY16I_EXT: + case GL_LUMINANCE16I_EXT: + case GL_LUMINANCE_ALPHA16I_EXT: + return MESA_FORMAT_RGBA_INT16; + case GL_RGBA8I_EXT: + case GL_RGB8I_EXT: + case GL_ALPHA8I_EXT: + case GL_INTENSITY8I_EXT: + case GL_LUMINANCE8I_EXT: + case GL_LUMINANCE_ALPHA8I_EXT: + return MESA_FORMAT_RGBA_INT8; + } + } + _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); return MESA_FORMAT_NONE; } diff --git a/mesalib/src/mesa/main/texgen.c b/mesalib/src/mesa/main/texgen.c index e70ea3029..108ea4cd4 100644 --- a/mesalib/src/mesa/main/texgen.c +++ b/mesalib/src/mesa/main/texgen.c @@ -192,6 +192,38 @@ _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) _mesa_TexGenfv( coord, pname, p ); } +#if FEATURE_ES1 + +void GLAPIENTRY +_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + _mesa_GetTexGenfv(GL_S, pname, params); +} + + +void GLAPIENTRY +_es_TexGenf(GLenum coord, GLenum pname, GLfloat param) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + /* set S, T, and R at the same time */ + _mesa_TexGenf(GL_S, pname, param); + _mesa_TexGenf(GL_T, pname, param); + _mesa_TexGenf(GL_R, pname, param); +} + + +void GLAPIENTRY +_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + /* set S, T, and R at the same time */ + _mesa_TexGenfv(GL_S, pname, params); + _mesa_TexGenfv(GL_T, pname, params); + _mesa_TexGenfv(GL_R, pname, params); +} + +#endif static void GLAPIENTRY _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) diff --git a/mesalib/src/mesa/main/texgen.h b/mesalib/src/mesa/main/texgen.h index eb4626033..9ed802383 100644 --- a/mesalib/src/mesa/main/texgen.h +++ b/mesalib/src/mesa/main/texgen.h @@ -27,15 +27,13 @@ #define TEXGEN_H -#include "main/mtypes.h" +#include "compiler.h" +#include "glheader.h" +struct _glapi_table; -#if FEATURE_texgen -#define _MESA_INIT_TEXGEN_FUNCTIONS(driver, impl) \ - do { \ - (driver)->TexGen = impl ## TexGen; \ - } while (0) +#if FEATURE_texgen extern void GLAPIENTRY _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); @@ -52,9 +50,18 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); extern void _mesa_init_texgen_dispatch(struct _glapi_table *disp); -#else /* FEATURE_texgen */ -#define _MESA_INIT_TEXGEN_FUNCTIONS(driver, impl) do { } while (0) +extern void GLAPIENTRY +_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params); + +extern void GLAPIENTRY +_es_TexGenf(GLenum coord, GLenum pname, GLfloat param); + +extern void GLAPIENTRY +_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params); + + +#else /* FEATURE_texgen */ static void _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c index 7ad91805b..00134ea9f 100644 --- a/mesalib/src/mesa/main/texgetimage.c +++ b/mesalib/src/mesa/main/texgetimage.c @@ -224,7 +224,7 @@ linear_to_nonlinear(GLfloat cl) cs = 12.92f * cl; } else { - cs = (GLfloat)(1.055 * _mesa_pow(cl, 0.41666) - 0.055); + cs = (GLfloat)(1.055 * pow(cl, 0.41666) - 0.055); } return cs; } diff --git a/mesalib/src/mesa/main/texgetimage.h b/mesalib/src/mesa/main/texgetimage.h index 088d27c7e..866ab7049 100644 --- a/mesalib/src/mesa/main/texgetimage.h +++ b/mesalib/src/mesa/main/texgetimage.h @@ -27,6 +27,7 @@ #ifndef TEXGETIMAGE_H #define TEXGETIMAGE_H +#include "mtypes.h" extern void _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index d72e91b3a..ca1bd6096 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -46,6 +46,7 @@ #include "texfetch.h" #include "teximage.h" #include "texstate.h" +#include "texpal.h" #include "mtypes.h" @@ -347,41 +348,136 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat ) case GL_SLUMINANCE8_EXT: return GL_LUMINANCE; default: - ; /* fallthrough */ + ; /* fallthrough */ } } - #endif /* FEATURE_EXT_texture_sRGB */ - return -1; /* error */ -} + if (ctx->Extensions.EXT_texture_integer) { + switch (internalFormat) { + case GL_RGBA8UI_EXT: + case GL_RGBA16UI_EXT: + case GL_RGBA32UI_EXT: + case GL_RGBA8I_EXT: + case GL_RGBA16I_EXT: + case GL_RGBA32I_EXT: + return GL_RGBA; + case GL_RGB8UI_EXT: + case GL_RGB16UI_EXT: + case GL_RGB32UI_EXT: + case GL_RGB8I_EXT: + case GL_RGB16I_EXT: + case GL_RGB32I_EXT: + return GL_RGB; + case GL_ALPHA8UI_EXT: + case GL_ALPHA16UI_EXT: + case GL_ALPHA32UI_EXT: + case GL_ALPHA8I_EXT: + case GL_ALPHA16I_EXT: + case GL_ALPHA32I_EXT: + return GL_ALPHA; + case GL_INTENSITY8UI_EXT: + case GL_INTENSITY16UI_EXT: + case GL_INTENSITY32UI_EXT: + case GL_INTENSITY8I_EXT: + case GL_INTENSITY16I_EXT: + case GL_INTENSITY32I_EXT: + return GL_INTENSITY; + case GL_LUMINANCE8UI_EXT: + case GL_LUMINANCE16UI_EXT: + case GL_LUMINANCE32UI_EXT: + case GL_LUMINANCE8I_EXT: + case GL_LUMINANCE16I_EXT: + case GL_LUMINANCE32I_EXT: + return GL_LUMINANCE; + case GL_LUMINANCE_ALPHA8UI_EXT: + case GL_LUMINANCE_ALPHA16UI_EXT: + case GL_LUMINANCE_ALPHA32UI_EXT: + case GL_LUMINANCE_ALPHA8I_EXT: + case GL_LUMINANCE_ALPHA16I_EXT: + case GL_LUMINANCE_ALPHA32I_EXT: + return GL_LUMINANCE_ALPHA; + default: + ; /* fallthrough */ + } + } + if (ctx->Extensions.ARB_texture_rg) { + switch (internalFormat) { + case GL_R8: + case GL_R16: + case GL_R16F: + case GL_R32F: + case GL_R8I: + case GL_R8UI: + case GL_R16I: + case GL_R16UI: + case GL_R32I: + case GL_R32UI: + return GL_R; + case GL_RG: + case GL_RG_INTEGER: + case GL_RG8: + case GL_RG16: + case GL_RG16F: + case GL_RG32F: + case GL_RG8I: + case GL_RG8UI: + case GL_RG16I: + case GL_RG16UI: + case GL_RG32I: + case GL_RG32UI: + return GL_RG; + default: + ; /* fallthrough */ + } + } -/** - * Test if it is a supported compressed format. - * - * \param internalFormat the internal format token provided by the user. - * - * \ret GL_TRUE if \p internalFormat is a supported compressed format, or - * GL_FALSE otherwise. - * - * Currently only GL_COMPRESSED_RGB_FXT1_3DFX and GL_COMPRESSED_RGBA_FXT1_3DFX - * are supported. - */ -static GLboolean -is_compressed_format(GLcontext *ctx, GLenum internalFormat) -{ - GLint supported[100]; /* 100 should be plenty */ - GLuint i, n; + if (ctx->Extensions.EXT_texture_shared_exponent) { + switch (internalFormat) { + case GL_RGB9_E5_EXT: + return GL_RGB; + default: + ; /* fallthrough */ + } + } - n = _mesa_get_compressed_formats(ctx, supported, GL_TRUE); - ASSERT(n < 100); - for (i = 0; i < n; i++) { - if ((GLint) internalFormat == supported[i]) { - return GL_TRUE; + if (ctx->Extensions.EXT_packed_float) { + switch (internalFormat) { + case GL_R11F_G11F_B10F_EXT: + return GL_RGB; + default: + ; /* fallthrough */ } } - return GL_FALSE; + + if (ctx->Extensions.ARB_depth_buffer_float) { + switch (internalFormat) { + case GL_DEPTH_COMPONENT32F: + return GL_DEPTH_COMPONENT; + case GL_DEPTH32F_STENCIL8: + return GL_DEPTH_STENCIL; + default: + ; /* fallthrough */ + } + } + + if (ctx->Extensions.EXT_texture_compression_rgtc) { + switch (internalFormat) { + case GL_COMPRESSED_RED: + case GL_COMPRESSED_RED_RGTC1_EXT: + case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: + return GL_RED; + case GL_COMPRESSED_RG: + case GL_COMPRESSED_RED_GREEN_RGTC2_EXT: + case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: + return GL_RG; + default: + ; /* fallthrough */ + } + } + + return -1; /* error */ } @@ -1307,9 +1403,9 @@ texture_error_check( GLcontext *ctx, GLenum target, if (type != GL_UNSIGNED_SHORT_8_8_MESA && type != GL_UNSIGNED_SHORT_8_8_REV_MESA) { char message[100]; - sprintf(message, - "glTexImage%d(format/type YCBCR mismatch", dimensions); - _mesa_error(ctx, GL_INVALID_ENUM, message); + _mesa_snprintf(message, sizeof(message), + "glTexImage%dD(format/type YCBCR mismatch", dimensions); + _mesa_error(ctx, GL_INVALID_ENUM, "%s", message); return GL_TRUE; /* error */ } if (target != GL_TEXTURE_2D && @@ -1323,10 +1419,10 @@ texture_error_check( GLcontext *ctx, GLenum target, if (border != 0) { if (!isProxy) { char message[100]; - sprintf(message, - "glTexImage%d(format=GL_YCBCR_MESA and border=%d)", - dimensions, border); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_snprintf(message, sizeof(message), + "glTexImage%dD(format=GL_YCBCR_MESA and border=%d)", + dimensions, border); + _mesa_error(ctx, GL_INVALID_VALUE, "%s", message); } return GL_TRUE; } @@ -1349,16 +1445,16 @@ texture_error_check( GLcontext *ctx, GLenum target, } /* additional checks for compressed textures */ - if (is_compressed_format(ctx, internalFormat)) { + if (_mesa_is_compressed_format(ctx, internalFormat)) { if (!target_can_be_compressed(ctx, target) && !isProxy) { _mesa_error(ctx, GL_INVALID_ENUM, - "glTexImage%d(target)", dimensions); + "glTexImage%dD(target)", dimensions); return GL_TRUE; } if (border != 0) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexImage%D(border!=0)", dimensions); + "glTexImage%dD(border!=0)", dimensions); } return GL_TRUE; } @@ -1536,7 +1632,7 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions, if (!target_can_be_compressed(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, - "glTexSubImage%D(target=%s)", dimensions, + "glTexSubImage%dD(target=%s)", dimensions, _mesa_lookup_enum_by_nr(target)); return GL_TRUE; } @@ -1547,19 +1643,19 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions, /* offset must be multiple of block size */ if ((xoffset % bw != 0) || (yoffset % bh != 0)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%D(xoffset = %d, yoffset = %d)", + "glTexSubImage%dD(xoffset = %d, yoffset = %d)", dimensions, xoffset, yoffset); return GL_TRUE; } /* size must be multiple of bw by bh or equal to whole texture size */ if ((width % bw != 0) && (GLuint) width != destTex->Width) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%D(width = %d)", dimensions, width); + "glTexSubImage%dD(width = %d)", dimensions, width); return GL_TRUE; } if ((height % bh != 0) && (GLuint) height != destTex->Height) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%D(height = %d)", dimensions, height); + "glTexSubImage%dD(height = %d)", dimensions, height); return GL_TRUE; } } @@ -1715,15 +1811,15 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } - if (is_compressed_format(ctx, internalFormat)) { + if (_mesa_is_compressed_format(ctx, internalFormat)) { if (!target_can_be_compressed(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, - "glCopyTexImage%d(target)", dimensions); + "glCopyTexImage%dD(target)", dimensions); return GL_TRUE; } if (border != 0) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexImage%D(border!=0)", dimensions); + "glCopyTexImage%dD(border!=0)", dimensions); return GL_TRUE; } } @@ -1731,7 +1827,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, /* make sure we have depth/stencil buffers */ if (!ctx->ReadBuffer->_DepthBuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexImage%D(no depth)", dimensions); + "glCopyTexImage%dD(no depth)", dimensions); return GL_TRUE; } } @@ -1739,7 +1835,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, /* make sure we have depth/stencil buffers */ if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexImage%D(no depth/stencil buffer)", dimensions); + "glCopyTexImage%dD(no depth/stencil buffer)", dimensions); return GL_TRUE; } } @@ -1904,24 +2000,24 @@ copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions, if (_mesa_is_format_compressed(teximage->TexFormat)) { if (!target_can_be_compressed(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, - "glCopyTexSubImage%d(target)", dimensions); + "glCopyTexSubImage%dD(target)", dimensions); return GL_TRUE; } /* offset must be multiple of 4 */ if ((xoffset & 3) || (yoffset & 3)) { _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%D(xoffset or yoffset)", dimensions); + "glCopyTexSubImage%dD(xoffset or yoffset)", dimensions); return GL_TRUE; } /* size must be multiple of 4 */ if ((width & 3) != 0 && (GLuint) width != teximage->Width) { _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%D(width)", dimensions); + "glCopyTexSubImage%dD(width)", dimensions); return GL_TRUE; } if ((height & 3) != 0 && (GLuint) height != teximage->Height) { _mesa_error(ctx, GL_INVALID_VALUE, - "glCopyTexSubImage%D(height)", dimensions); + "glCopyTexSubImage%dD(height)", dimensions); return GL_TRUE; } } @@ -1941,7 +2037,7 @@ copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions, if (teximage->_BaseFormat == GL_DEPTH_COMPONENT) { if (!ctx->ReadBuffer->_DepthBuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexSubImage%D(no depth buffer)", + "glCopyTexSubImage%dD(no depth buffer)", dimensions); return GL_TRUE; } @@ -1949,7 +2045,7 @@ copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions, else if (teximage->_BaseFormat == GL_DEPTH_STENCIL_EXT) { if (!ctx->ReadBuffer->_DepthBuffer || !ctx->ReadBuffer->_StencilBuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glCopyTexSubImage%D(no depth/stencil buffer)", + "glCopyTexSubImage%dD(no depth/stencil buffer)", dimensions); return GL_TRUE; } @@ -2087,6 +2183,45 @@ override_internal_format(GLenum internalFormat, GLint width, GLint height) } +/** + * Choose the actual hardware format for a texture image. + * Try to use the same format as the previous image level when possible. + * Otherwise, ask the driver for the best format. + * It's important to try to choose a consistant format for all levels + * for efficient texture memory layout/allocation. In particular, this + * comes up during automatic mipmap generation. + */ +void +_mesa_choose_texture_format(GLcontext *ctx, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLenum target, GLint level, + GLenum internalFormat, GLenum format, GLenum type) +{ + /* see if we've already chosen a format for the previous level */ + if (level > 0) { + struct gl_texture_image *prevImage = + _mesa_select_tex_image(ctx, texObj, target, level - 1); + /* See if the prev level is defined and has an internal format which + * matches the new internal format. + */ + if (prevImage && + prevImage->Width > 0 && + prevImage->InternalFormat == internalFormat) { + /* use the same format */ + texImage->TexFormat = prevImage->TexFormat; + return; + } + } + + /* choose format from scratch */ + texImage->TexFormat = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + format, type); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); +} + + + /* * Called from the API. Note that width includes the border. */ @@ -2147,11 +2282,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, postConvWidth, 1, 1, border, internalFormat); - /* Choose actual texture format */ - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, - format, type); - ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, format, type); /* Give the texture to the driver. <pixels> may be null. */ ASSERT(ctx->Driver.TexImage1D); @@ -2186,12 +2318,14 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, } else { /* no error, set the tex image parameters */ + struct gl_texture_object *texObj = + _mesa_get_current_tex_object(ctx, target); ASSERT(texImage); _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, format, type); } } else { @@ -2267,11 +2401,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, postConvWidth, postConvHeight, 1, border, internalFormat); - /* Choose actual texture format */ - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, - format, type); - ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, format, type); /* Give the texture to the driver. <pixels> may be null. */ ASSERT(ctx->Driver.TexImage2D); @@ -2313,11 +2444,13 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, } else { /* no error, set the tex image parameters */ + struct gl_texture_object *texObj = + _mesa_get_current_tex_object(ctx, target); _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, postConvHeight, 1, border, internalFormat); - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, format, type); } } else { @@ -2383,11 +2516,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, width, height, depth, border, internalFormat); - /* Choose actual texture format */ - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, - format, type); - ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, format, type); /* Give the texture to the driver. <pixels> may be null. */ ASSERT(ctx->Driver.TexImage3D); @@ -2424,10 +2554,12 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, } else { /* no error, set the tex image parameters */ + struct gl_texture_object *texObj = + _mesa_get_current_tex_object(ctx, target); _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, format, type); } } else { @@ -2457,6 +2589,12 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (!ctx->Extensions.OES_EGL_image) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glEGLImageTargetTexture2DOES(unsupported)"); + return; + } + if (target != GL_TEXTURE_2D) { _mesa_error(ctx, GL_INVALID_ENUM, "glEGLImageTargetTexture2D(target=%d)", target); @@ -2734,11 +2872,8 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); - /* Choose actual texture format */ - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, - GL_NONE, GL_NONE); - ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); ASSERT(ctx->Driver.CopyTexImage1D); ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat, @@ -2815,11 +2950,8 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, postConvWidth, postConvHeight, 1, border, internalFormat); - /* Choose actual texture format */ - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, - GL_NONE, GL_NONE); - ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); ASSERT(ctx->Driver.CopyTexImage2D); ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat, @@ -3103,11 +3235,15 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions, /* 3D compressed textures not allowed */ return GL_INVALID_ENUM; } + else { + assert(0); + return GL_INVALID_ENUM; + } maxTextureSize = 1 << (maxLevels - 1); /* This will detect any invalid internalFormat value */ - if (!is_compressed_format(ctx, internalFormat)) + if (!_mesa_is_compressed_format(ctx, internalFormat)) return GL_INVALID_ENUM; /* This should really never fail */ @@ -3212,7 +3348,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, maxTextureSize = 1 << (maxLevels - 1); /* this will catch any invalid compressed format token */ - if (!is_compressed_format(ctx, format)) + if (!_mesa_is_compressed_format(ctx, format)) return GL_INVALID_ENUM; if (width < 1 || width > maxTextureSize) @@ -3340,11 +3476,8 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, border, internalFormat); - /* Choose actual texture format */ - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, - GL_NONE, GL_NONE); - ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); ASSERT(ctx->Driver.CompressedTexImage1D); ctx->Driver.CompressedTexImage1D(ctx, target, level, @@ -3392,6 +3525,8 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, texImage = _mesa_select_tex_image(ctx, texObj, target, level); _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, border, internalFormat); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); } _mesa_unlock_texture(ctx, texObj); } @@ -3402,7 +3537,6 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, } } - void GLAPIENTRY _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, @@ -3418,6 +3552,24 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, _mesa_lookup_enum_by_nr(internalFormat), width, height, border, imageSize, data); +#if FEATURE_ES + switch (internalFormat) { + case GL_PALETTE4_RGB8_OES: + case GL_PALETTE4_RGBA8_OES: + case GL_PALETTE4_R5_G6_B5_OES: + case GL_PALETTE4_RGBA4_OES: + case GL_PALETTE4_RGB5_A1_OES: + case GL_PALETTE8_RGB8_OES: + case GL_PALETTE8_RGBA8_OES: + case GL_PALETTE8_R5_G6_B5_OES: + case GL_PALETTE8_RGBA4_OES: + case GL_PALETTE8_RGB5_A1_OES: + _mesa_cpal_compressed_teximage2d(target, level, internalFormat, + width, height, imageSize, data); + return; + } +#endif + if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && @@ -3450,11 +3602,8 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); - /* Choose actual texture format */ - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, - GL_NONE, GL_NONE); - ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); ASSERT(ctx->Driver.CompressedTexImage2D); ctx->Driver.CompressedTexImage2D(ctx, target, level, @@ -3504,6 +3653,8 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, texImage = _mesa_select_tex_image(ctx, texObj, target, level); _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); } _mesa_unlock_texture(ctx, texObj); } @@ -3560,10 +3711,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, border, internalFormat); /* Choose actual texture format */ - texImage->TexFormat = - ctx->Driver.ChooseTextureFormat(ctx, internalFormat, - GL_NONE, GL_NONE); - ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); ASSERT(ctx->Driver.CompressedTexImage3D); ctx->Driver.CompressedTexImage3D(ctx, target, level, @@ -3612,6 +3761,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, texImage = _mesa_select_tex_image(ctx, texObj, target, level); _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); + _mesa_choose_texture_format(ctx, texObj, texImage, target, level, + internalFormat, GL_NONE, GL_NONE); } _mesa_unlock_texture(ctx, texObj); } diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index d82cc9852..0dcacab3c 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -73,6 +73,14 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, extern void +_mesa_choose_texture_format(GLcontext *ctx, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLenum target, GLint level, + GLenum internalFormat, GLenum format, GLenum type); + + +extern void _mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage); diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 2753b55c3..1df165cf6 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -40,7 +40,7 @@ #include "teximage.h" #include "texobj.h" #include "mtypes.h" -#include "shader/prog_instruction.h" +#include "program/prog_instruction.h" @@ -416,7 +416,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, */ if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) { char s[100]; - sprintf(s, "base level = %d is invalid", baseLevel); + _mesa_snprintf(s, sizeof(s), "base level = %d is invalid", baseLevel); incomplete(t, s); t->_Complete = GL_FALSE; return; @@ -425,7 +425,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Always need the base level image */ if (!t->Image[0][baseLevel]) { char s[100]; - sprintf(s, "Image[baseLevel=%d] == NULL", baseLevel); + _mesa_snprintf(s, sizeof(s), "Image[baseLevel=%d] == NULL", baseLevel); incomplete(t, s); t->_Complete = GL_FALSE; return; diff --git a/mesalib/src/mesa/main/texpal.c b/mesalib/src/mesa/main/texpal.c new file mode 100644 index 000000000..a25e7aa4f --- /dev/null +++ b/mesalib/src/mesa/main/texpal.c @@ -0,0 +1,204 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + **************************************************************************/ + + +/** + * Code to convert compressed/paletted texture images to ordinary images. + * See the GL_OES_compressed_paletted_texture spec at + * http://khronos.org/registry/gles/extensions/OES/OES_compressed_paletted_texture.txt + * + * XXX this makes it impossible to add hardware support... + */ + + +#include "glheader.h" +#include "compiler.h" /* for ASSERT */ +#include "context.h" +#include "mtypes.h" +#include "imports.h" +#include "pixelstore.h" +#include "teximage.h" +#include "texpal.h" + +#if FEATURE_ES + + +static const struct cpal_format_info { + GLenum cpal_format; + GLenum format; + GLenum type; + GLuint palette_size; + GLuint size; +} formats[] = { + { GL_PALETTE4_RGB8_OES, GL_RGB, GL_UNSIGNED_BYTE, 16, 3 }, + { GL_PALETTE4_RGBA8_OES, GL_RGBA, GL_UNSIGNED_BYTE, 16, 4 }, + { GL_PALETTE4_R5_G6_B5_OES, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 16, 2 }, + { GL_PALETTE4_RGBA4_OES, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 16, 2 }, + { GL_PALETTE4_RGB5_A1_OES, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 16, 2 }, + { GL_PALETTE8_RGB8_OES, GL_RGB, GL_UNSIGNED_BYTE, 256, 3 }, + { GL_PALETTE8_RGBA8_OES, GL_RGBA, GL_UNSIGNED_BYTE, 256, 4 }, + { GL_PALETTE8_R5_G6_B5_OES, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 256, 2 }, + { GL_PALETTE8_RGBA4_OES, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 256, 2 }, + { GL_PALETTE8_RGB5_A1_OES, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 256, 2 } +}; + + +/** + * Get a color/entry from the palette. + */ +static GLuint +get_palette_entry(const struct cpal_format_info *info, const GLubyte *palette, + GLuint index, GLubyte *pixel) +{ + memcpy(pixel, palette + info->size * index, info->size); + return info->size; +} + + +/** + * Convert paletted texture to color texture. + */ +static void +paletted_to_color(const struct cpal_format_info *info, const GLubyte *palette, + const void *indices, GLuint num_pixels, GLubyte *image) +{ + GLubyte *pix = image; + GLuint remain, i; + + if (info->palette_size == 16) { + /* 4 bits per index */ + const GLubyte *ind = (const GLubyte *) indices; + + /* two pixels per iteration */ + remain = num_pixels % 2; + for (i = 0; i < num_pixels / 2; i++) { + pix += get_palette_entry(info, palette, (ind[i] >> 4) & 0xf, pix); + pix += get_palette_entry(info, palette, ind[i] & 0xf, pix); + } + if (remain) { + get_palette_entry(info, palette, (ind[i] >> 4) & 0xf, pix); + } + } + else { + /* 8 bits per index */ + const GLubyte *ind = (const GLubyte *) indices; + for (i = 0; i < num_pixels; i++) + pix += get_palette_entry(info, palette, ind[i], pix); + } +} + + +static const struct cpal_format_info * +cpal_get_info(GLint level, GLenum internalFormat, + GLsizei width, GLsizei height, GLsizei imageSize) +{ + const struct cpal_format_info *info; + GLint lvl, num_levels; + GLsizei w, h, expect_size; + + info = &formats[internalFormat - GL_PALETTE4_RGB8_OES]; + ASSERT(info->cpal_format == internalFormat); + + if (level > 0) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, + "glCompressedTexImage2D(level=%d)", level); + return NULL; + } + + num_levels = -level + 1; + expect_size = info->palette_size * info->size; + for (lvl = 0; lvl < num_levels; lvl++) { + w = width >> lvl; + if (!w) + w = 1; + h = height >> lvl; + if (!h) + h = 1; + + if (info->palette_size == 16) + expect_size += (w * h + 1) / 2; + else + expect_size += w * h; + } + if (expect_size > imageSize) { + _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE, + "glCompressedTexImage2D(imageSize=%d)", imageSize); + return NULL; + } + return info; +} + +/** + * Convert a call to glCompressedTexImage2D() where internalFormat is a + * compressed palette format into a regular GLubyte/RGBA glTexImage2D() call. + */ +void +_mesa_cpal_compressed_teximage2d(GLenum target, GLint level, + GLenum internalFormat, + GLsizei width, GLsizei height, + GLsizei imageSize, const void *palette) +{ + const struct cpal_format_info *info; + GLint lvl, num_levels; + const GLubyte *indices; + GLint saved_align, align; + GET_CURRENT_CONTEXT(ctx); + + info = cpal_get_info(level, internalFormat, width, height, imageSize); + if (!info) + return; + + info = &formats[internalFormat - GL_PALETTE4_RGB8_OES]; + ASSERT(info->cpal_format == internalFormat); + num_levels = -level + 1; + + /* first image follows the palette */ + indices = (const GLubyte *) palette + info->palette_size * info->size; + + saved_align = ctx->Unpack.Alignment; + align = saved_align; + + for (lvl = 0; lvl < num_levels; lvl++) { + GLsizei w, h; + GLuint num_texels; + GLubyte *image = NULL; + + w = width >> lvl; + if (!w) + w = 1; + h = height >> lvl; + if (!h) + h = 1; + num_texels = w * h; + if (w * info->size % align) { + _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 1); + align = 1; + } + + /* allocate and fill dest image buffer */ + if (palette) { + image = (GLubyte *) malloc(num_texels * info->size); + paletted_to_color(info, palette, indices, num_texels, image); + } + + _mesa_TexImage2D(target, lvl, info->format, w, h, 0, + info->format, info->type, image); + if (image) + free(image); + + /* advance index pointer to point to next src mipmap */ + if (info->palette_size == 16) + indices += (num_texels + 1) / 2; + else + indices += num_texels; + } + + if (saved_align != align) + _mesa_PixelStorei(GL_UNPACK_ALIGNMENT, saved_align); +} + +#endif diff --git a/mesalib/src/mesa/shader/slang/slang_link.h b/mesalib/src/mesa/main/texpal.h index 2b44d2078..eeff5a9e2 100644 --- a/mesalib/src/mesa/shader/slang/slang_link.h +++ b/mesalib/src/mesa/main/texpal.h @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 7.2 + * Version: 7.8 * - * Copyright (C) 2008 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2010 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -22,16 +22,17 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef SLANG_LINK_H -#define SLANG_LINK_H 1 -#include "slang_compile.h" +#ifndef TEXPAL_H +#define TEXPAL_H +#include "main/glheader.h" extern void -_slang_link(GLcontext *ctx, GLhandleARB h, - struct gl_shader_program *shProg); +_mesa_cpal_compressed_teximage2d(GLenum target, GLint level, + GLenum internalFormat, + GLsizei width, GLsizei height, + GLsizei imageSize, const void *palette); -#endif - +#endif /* TEXPAL_H */ diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index 0fde89b50..745a0aeec 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -39,7 +39,7 @@ #include "main/texparam.h" #include "main/teximage.h" #include "main/texstate.h" -#include "shader/prog_instruction.h" +#include "program/prog_instruction.h" /** @@ -371,7 +371,7 @@ set_tex_parameteri(GLcontext *ctx, } return GL_FALSE; -#ifdef FEATURE_OES_draw_texture +#if FEATURE_OES_draw_texture case GL_TEXTURE_CROP_RECT_OES: texObj->CropRect[0] = params[0]; texObj->CropRect[1] = params[1]; @@ -604,7 +604,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) } break; -#ifdef FEATURE_OES_draw_texture +#if FEATURE_OES_draw_texture case GL_TEXTURE_CROP_RECT_OES: { /* convert float params to int */ @@ -940,6 +940,18 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, "glGetTexLevelParameter[if]v(pname)"); } break; + case GL_TEXTURE_SHARED_SIZE: + if (ctx->VersionMajor >= 3) { + /* XXX return number of exponent bits for shared exponent texture + * formats, like GL_RGB9_E5. + */ + *params = 0; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetTexLevelParameter[if]v(pname)"); + } + break; /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: @@ -1148,7 +1160,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) else error = GL_TRUE; break; -#ifdef FEATURE_OES_draw_texture +#if FEATURE_OES_draw_texture case GL_TEXTURE_CROP_RECT_OES: params[0] = obj->CropRect[0]; params[1] = obj->CropRect[1]; @@ -1318,7 +1330,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) error = GL_TRUE; } break; -#ifdef FEATURE_OES_draw_texture +#if FEATURE_OES_draw_texture case GL_TEXTURE_CROP_RECT_OES: params[0] = obj->CropRect[0]; params[1] = obj->CropRect[1]; diff --git a/mesalib/src/mesa/main/texrender.c b/mesalib/src/mesa/main/texrender.c index d29af5a5b..c68105b39 100644 --- a/mesalib/src/mesa/main/texrender.c +++ b/mesalib/src/mesa/main/texrender.c @@ -1,6 +1,7 @@ #include "context.h" #include "colormac.h" +#include "macros.h" #include "texfetch.h" #include "texrender.h" #include "renderbuffer.h" diff --git a/mesalib/src/mesa/main/texrender.h b/mesalib/src/mesa/main/texrender.h index 7c3fb0871..1e87d594a 100644 --- a/mesalib/src/mesa/main/texrender.h +++ b/mesalib/src/mesa/main/texrender.h @@ -1,6 +1,7 @@ #ifndef TEXRENDER_H #define TEXRENDER_H +#include "mtypes.h" extern void _mesa_render_texture(GLcontext *ctx, diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index fce17c2b6..dae173d1b 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -528,7 +528,7 @@ update_texture_state( GLcontext *ctx ) /* Get the bitmask of texture target enables. * enableBits will be a mask of the TEXTURE_*_BIT flags indicating * which texture targets are enabled (fixed function) or referenced - * by a fragment shader/program. When multiple flags are set, we'll + * by a fragment program/program. When multiple flags are set, we'll * settle on the one with highest priority (see below). */ if (vprog) { diff --git a/mesalib/src/mesa/main/texstate.h b/mesalib/src/mesa/main/texstate.h index 17ac68000..912cb6779 100644 --- a/mesalib/src/mesa/main/texstate.h +++ b/mesalib/src/mesa/main/texstate.h @@ -32,6 +32,7 @@ #define TEXSTATE_H +#include "compiler.h" #include "mtypes.h" diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 65e3fcaa9..2989fdb72 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -55,7 +55,6 @@ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" -#include "context.h" #include "convolve.h" #include "image.h" #include "macros.h" @@ -2225,6 +2224,140 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS) static GLboolean +_mesa_texstore_rgba_16(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_RGBA_16); + ASSERT(texelBytes == 8); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == GL_RGBA && + srcFormat == GL_RGBA && + srcType == GL_UNSIGNED_SHORT) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLushort *dstUS = (GLushort *) dstRow; + for (col = 0; col < srcWidth; col++) { + GLushort r, g, b, a; + + UNCLAMPED_FLOAT_TO_USHORT(r, src[0]); + UNCLAMPED_FLOAT_TO_USHORT(g, src[1]); + UNCLAMPED_FLOAT_TO_USHORT(b, src[2]); + UNCLAMPED_FLOAT_TO_USHORT(a, src[3]); + dstUS[col*4+0] = r; + dstUS[col*4+1] = g; + dstUS[col*4+2] = b; + dstUS[col*4+3] = a; + src += 4; + } + dstRow += dstRowStride; + } + } + free((void *) tempImage); + } + return GL_TRUE; +} + + +static GLboolean +_mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_SIGNED_R_16 || + dstFormat == MESA_FORMAT_SIGNED_RG_16 || + dstFormat == MESA_FORMAT_SIGNED_RGB_16 || + dstFormat == MESA_FORMAT_SIGNED_RGBA_16); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == GL_RGBA && + dstFormat == MESA_FORMAT_SIGNED_RGBA_16 && + srcFormat == GL_RGBA && + srcType == GL_SHORT) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + const GLuint comps = _mesa_get_format_bytes(dstFormat) / 2; + GLint img, row, col; + + if (!tempImage) + return GL_FALSE; + + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + + /* Note: tempImage is always float[4] / RGBA. We convert to 1, 2, + * 3 or 4 components/pixel here. + */ + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLshort *dstRowS = (GLshort *) dstRow; + for (col = 0; col < srcWidth; col++) { + GLuint c; + for (c = 0; c < comps; c++) { + GLshort p; + UNCLAMPED_FLOAT_TO_SHORT(p, src[col * 4 + c]); + dstRowS[col * comps + c] = p; + } + } + dstRow += dstRowStride; + src += 4 * srcWidth; + } + } + free((void *) tempImage); + } + return GL_TRUE; +} + + +static GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); @@ -2551,6 +2684,147 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) return GL_TRUE; } + +/** + * Store a texture in MESA_FORMAT_SIGNED_R8 format. + */ +static GLboolean +_mesa_texstore_signed_r8(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_SIGNED_R8); + ASSERT(texelBytes == 1); + + /* XXX look at adding optimized paths */ + { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *srcRow = tempImage; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLubyte *dstB = (GLubyte *) dstRow; + for (col = 0; col < srcWidth; col++) { + dstB[col] = FLOAT_TO_BYTE_TEX(srcRow[RCOMP]); + } + dstRow += dstRowStride; + } + } + free((void *) tempImage); + } + return GL_TRUE; +} + + +/** + * Store a texture in MESA_FORMAT_SIGNED_RG88 format. + */ +static GLboolean +_mesa_texstore_signed_rg88(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_SIGNED_RG88); + ASSERT(texelBytes == 1); + + /* XXX look at adding optimized paths */ + { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *srcRow = tempImage; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLushort *dstUS = (GLushort *) dstRow; + for (col = 0; col < srcWidth; col++) { + dstUS[col] = PACK_COLOR_88(FLOAT_TO_BYTE_TEX(srcRow[RCOMP]), + FLOAT_TO_BYTE_TEX(srcRow[GCOMP])); + } + dstRow += dstRowStride; + } + } + free((void *) tempImage); + } + return GL_TRUE; +} + + +/** + * Store a texture in MESA_FORMAT_SIGNED_RGBX8888. + */ +static GLboolean +_mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBX8888); + ASSERT(texelBytes == 4); + + { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *srcRow = tempImage; + GLint img, row, col; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLuint *dstUI = (GLuint *) dstRow; + for (col = 0; col < srcWidth; col++) { + dstUI[col] = PACK_COLOR_8888( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]), + FLOAT_TO_BYTE_TEX(srcRow[GCOMP]), + FLOAT_TO_BYTE_TEX(srcRow[BCOMP]), + 0xff ); + srcRow += 4; + } + dstRow += dstRowStride; + } + } + free((void *) tempImage); + } + return GL_TRUE; +} + + + /** * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or MESA_FORMAT_SIGNED_RGBA8888_REV */ @@ -2672,6 +2946,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) return GL_TRUE; } + /** * Store a combined depth/stencil texture image. */ @@ -3002,6 +3277,392 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) } +/* non-normalized, signed int8 */ +static GLboolean +_mesa_texstore_rgba_int8(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + const GLint components = _mesa_components_in_format(baseFormat); + + ASSERT(dstFormat == MESA_FORMAT_RGBA_INT8); + ASSERT(baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_INTENSITY); + ASSERT(texelBytes == components * sizeof(GLbyte)); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == srcFormat && + srcType == GL_BYTE) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLint img, row; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLbyte *dstTexel = (GLbyte *) dstRow; + GLint i; + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLbyte) src[i]; + } + dstRow += dstRowStride; + src += srcWidth * components; + } + } + + free((void *) tempImage); + } + return GL_TRUE; +} + + +/* non-normalized, signed int16 */ +static GLboolean +_mesa_texstore_rgba_int16(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + const GLint components = _mesa_components_in_format(baseFormat); + + ASSERT(dstFormat == MESA_FORMAT_RGBA_INT16); + ASSERT(baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_INTENSITY); + ASSERT(texelBytes == components * sizeof(GLshort)); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == srcFormat && + srcType == GL_INT) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLint img, row; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLshort *dstTexel = (GLshort *) dstRow; + GLint i; + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLint) src[i]; + } + dstRow += dstRowStride; + src += srcWidth * components; + } + } + + free((void *) tempImage); + } + return GL_TRUE; +} + + +/* non-normalized, signed int32 */ +static GLboolean +_mesa_texstore_rgba_int32(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + const GLint components = _mesa_components_in_format(baseFormat); + + ASSERT(dstFormat == MESA_FORMAT_RGBA_INT32); + ASSERT(baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_INTENSITY); + ASSERT(texelBytes == components * sizeof(GLint)); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == srcFormat && + srcType == GL_INT) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLint img, row; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLint *dstTexel = (GLint *) dstRow; + GLint i; + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLint) src[i]; + } + dstRow += dstRowStride; + src += srcWidth * components; + } + } + + free((void *) tempImage); + } + return GL_TRUE; +} + + +/* non-normalized, unsigned int8 */ +static GLboolean +_mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + const GLint components = _mesa_components_in_format(baseFormat); + + ASSERT(dstFormat == MESA_FORMAT_RGBA_UINT8); + ASSERT(baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_INTENSITY); + ASSERT(texelBytes == components * sizeof(GLubyte)); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == srcFormat && + srcType == GL_UNSIGNED_BYTE) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLint img, row; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLubyte *dstTexel = (GLubyte *) dstRow; + GLint i; + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLubyte) src[i]; + } + dstRow += dstRowStride; + src += srcWidth * components; + } + } + + free((void *) tempImage); + } + return GL_TRUE; +} + + +/* non-normalized, unsigned int16 */ +static GLboolean +_mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + const GLint components = _mesa_components_in_format(baseFormat); + + ASSERT(dstFormat == MESA_FORMAT_RGBA_UINT16); + ASSERT(baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_INTENSITY); + ASSERT(texelBytes == components * sizeof(GLushort)); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == srcFormat && + srcType == GL_UNSIGNED_SHORT) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLint img, row; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLushort *dstTexel = (GLushort *) dstRow; + GLint i; + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLushort) src[i]; + } + dstRow += dstRowStride; + src += srcWidth * components; + } + } + + free((void *) tempImage); + } + return GL_TRUE; +} + + +/* non-normalized, unsigned int32 */ +static GLboolean +_mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) +{ + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + const GLint components = _mesa_components_in_format(baseFormat); + + ASSERT(dstFormat == MESA_FORMAT_RGBA_UINT32); + ASSERT(baseInternalFormat == GL_RGBA || + baseInternalFormat == GL_RGB || + baseInternalFormat == GL_ALPHA || + baseInternalFormat == GL_LUMINANCE || + baseInternalFormat == GL_LUMINANCE_ALPHA || + baseInternalFormat == GL_INTENSITY); + ASSERT(texelBytes == components * sizeof(GLuint)); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + baseInternalFormat == srcFormat && + srcType == GL_UNSIGNED_INT) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = tempImage; + GLint img, row; + if (!tempImage) + return GL_FALSE; + _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLuint *dstTexel = (GLuint *) dstRow; + GLint i; + for (i = 0; i < srcWidth * components; i++) { + dstTexel[i] = (GLuint) src[i]; + } + dstRow += dstRowStride; + src += srcWidth * components; + } + } + + free((void *) tempImage); + } + return GL_TRUE; +} + + + + #if FEATURE_EXT_texture_sRGB static GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS) @@ -3196,10 +3857,28 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, { MESA_FORMAT_INTENSITY_FLOAT32, _mesa_texstore_rgba_float32 }, { MESA_FORMAT_INTENSITY_FLOAT16, _mesa_texstore_rgba_float16 }, + + { MESA_FORMAT_RGBA_INT8, _mesa_texstore_rgba_int8 }, + { MESA_FORMAT_RGBA_INT16, _mesa_texstore_rgba_int16 }, + { MESA_FORMAT_RGBA_INT32, _mesa_texstore_rgba_int32 }, + { MESA_FORMAT_RGBA_UINT8, _mesa_texstore_rgba_uint8 }, + { MESA_FORMAT_RGBA_UINT16, _mesa_texstore_rgba_uint16 }, + { MESA_FORMAT_RGBA_UINT32, _mesa_texstore_rgba_uint32 }, + { MESA_FORMAT_DUDV8, _mesa_texstore_dudv8 }, + + { MESA_FORMAT_SIGNED_R8, _mesa_texstore_signed_r8 }, + { MESA_FORMAT_SIGNED_RG88, _mesa_texstore_signed_rg88 }, + { MESA_FORMAT_SIGNED_RGBX8888, _mesa_texstore_signed_rgbx8888 }, + { MESA_FORMAT_SIGNED_RGBA8888, _mesa_texstore_signed_rgba8888 }, { MESA_FORMAT_SIGNED_RGBA8888_REV, _mesa_texstore_signed_rgba8888 }, - { MESA_FORMAT_SIGNED_RGBA_16, NULL }, + + { MESA_FORMAT_SIGNED_R_16, _mesa_texstore_signed_rgba_16 }, + { MESA_FORMAT_SIGNED_RG_16, _mesa_texstore_signed_rgba_16 }, + { MESA_FORMAT_SIGNED_RGB_16, _mesa_texstore_signed_rgba_16 }, + { MESA_FORMAT_SIGNED_RGBA_16, _mesa_texstore_signed_rgba_16 }, + { MESA_FORMAT_RGBA_16, _mesa_texstore_rgba_16 } }; diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c new file mode 100644 index 000000000..5c8c1fd22 --- /dev/null +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -0,0 +1,944 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2010 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * Vertex transform feedback support. + * + * Authors: + * Brian Paul + */ + + +#include "buffers.h" +#include "bufferobj.h" +#include "context.h" +#include "hash.h" +#include "transformfeedback.h" +#include "shaderapi.h" +#include "shaderobj.h" +#include "main/dispatch.h" + +#include "program/prog_parameter.h" +//#include "program/shader_api.h" + + +#if FEATURE_EXT_transform_feedback + + +/** + * Do reference counting of transform feedback buffers. + */ +static void +reference_transform_feedback_object(struct gl_transform_feedback_object **ptr, + struct gl_transform_feedback_object *obj) +{ + if (*ptr == obj) + return; + + if (*ptr) { + /* Unreference the old object */ + struct gl_transform_feedback_object *oldObj = *ptr; + + ASSERT(oldObj->RefCount > 0); + oldObj->RefCount--; + + if (oldObj->RefCount == 0) { + GET_CURRENT_CONTEXT(ctx); + if (ctx) + ctx->Driver.DeleteTransformFeedback(ctx, oldObj); + } + + *ptr = NULL; + } + ASSERT(!*ptr); + + if (obj) { + /* reference new object */ + if (obj->RefCount == 0) { + _mesa_problem(NULL, "referencing deleted transform feedback object"); + *ptr = NULL; + } + else { + obj->RefCount++; + *ptr = obj; + } + } +} + + +/** + * Check if the given primitive mode (as in glBegin(mode)) is compatible + * with the current transform feedback mode (if it's enabled). + * This is to be called from glBegin(), glDrawArrays(), glDrawElements(), etc. + * + * \return GL_TRUE if the mode is OK, GL_FALSE otherwise. + */ +GLboolean +_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode) +{ + if (ctx->TransformFeedback.CurrentObject->Active) { + switch (mode) { + case GL_POINTS: + return ctx->TransformFeedback.Mode == GL_POINTS; + case GL_LINES: + case GL_LINE_STRIP: + case GL_LINE_LOOP: + return ctx->TransformFeedback.Mode == GL_LINES; + default: + return ctx->TransformFeedback.Mode == GL_TRIANGLES; + } + } + return GL_TRUE; +} + + +/** + * Check that all the buffer objects currently bound for transform + * feedback actually exist. Raise a GL_INVALID_OPERATION error if + * any buffers are missing. + * \return GL_TRUE for success, GL_FALSE if error + */ +GLboolean +_mesa_validate_transform_feedback_buffers(GLcontext *ctx) +{ + /* XXX to do */ + return GL_TRUE; +} + + + +/** + * Per-context init for transform feedback. + */ +void +_mesa_init_transform_feedback(GLcontext *ctx) +{ + /* core mesa expects this, even a dummy one, to be available */ + ASSERT(ctx->Driver.NewTransformFeedback); + + ctx->TransformFeedback.DefaultObject = + ctx->Driver.NewTransformFeedback(ctx, 0); + + assert(ctx->TransformFeedback.DefaultObject->RefCount == 1); + + reference_transform_feedback_object(&ctx->TransformFeedback.CurrentObject, + ctx->TransformFeedback.DefaultObject); + + assert(ctx->TransformFeedback.DefaultObject->RefCount == 2); + + ctx->TransformFeedback.Objects = _mesa_NewHashTable(); + + _mesa_reference_buffer_object(ctx, + &ctx->TransformFeedback.CurrentBuffer, + ctx->Shared->NullBufferObj); +} + + + +/** + * Callback for _mesa_HashDeleteAll(). + */ +static void +delete_cb(GLuint key, void *data, void *userData) +{ + GLcontext *ctx = (GLcontext *) userData; + struct gl_transform_feedback_object *obj = + (struct gl_transform_feedback_object *) data; + + ctx->Driver.DeleteTransformFeedback(ctx, obj); +} + + +/** + * Per-context free/clean-up for transform feedback. + */ +void +_mesa_free_transform_feedback(GLcontext *ctx) +{ + /* core mesa expects this, even a dummy one, to be available */ + ASSERT(ctx->Driver.NewTransformFeedback); + + _mesa_reference_buffer_object(ctx, + &ctx->TransformFeedback.CurrentBuffer, + NULL); + + /* Delete all feedback objects */ + _mesa_HashDeleteAll(ctx->TransformFeedback.Objects, delete_cb, ctx); + _mesa_DeleteHashTable(ctx->TransformFeedback.Objects); + + /* Delete the default feedback object */ + assert(ctx->Driver.DeleteTransformFeedback); + ctx->Driver.DeleteTransformFeedback(ctx, + ctx->TransformFeedback.DefaultObject); + + ctx->TransformFeedback.CurrentObject = NULL; +} + + +#else /* FEATURE_EXT_transform_feedback */ + +/* forward declarations */ +static struct gl_transform_feedback_object * +new_transform_feedback(GLcontext *ctx, GLuint name); + +static void +delete_transform_feedback(GLcontext *ctx, + struct gl_transform_feedback_object *obj); + +/* dummy per-context init/clean-up for transform feedback */ +void +_mesa_init_transform_feedback(GLcontext *ctx) +{ + ctx->TransformFeedback.DefaultObject = new_transform_feedback(ctx, 0); + ctx->TransformFeedback.CurrentObject = ctx->TransformFeedback.DefaultObject; + _mesa_reference_buffer_object(ctx, + &ctx->TransformFeedback.CurrentBuffer, + ctx->Shared->NullBufferObj); +} + +void +_mesa_free_transform_feedback(GLcontext *ctx) +{ + _mesa_reference_buffer_object(ctx, + &ctx->TransformFeedback.CurrentBuffer, + NULL); + ctx->TransformFeedback.CurrentObject = NULL; + delete_transform_feedback(ctx, ctx->TransformFeedback.DefaultObject); +} + +#endif /* FEATURE_EXT_transform_feedback */ + + +/** Default fallback for ctx->Driver.NewTransformFeedback() */ +static struct gl_transform_feedback_object * +new_transform_feedback(GLcontext *ctx, GLuint name) +{ + struct gl_transform_feedback_object *obj; + obj = CALLOC_STRUCT(gl_transform_feedback_object); + if (obj) { + obj->Name = name; + obj->RefCount = 1; + } + return obj; +} + +/** Default fallback for ctx->Driver.DeleteTransformFeedback() */ +static void +delete_transform_feedback(GLcontext *ctx, + struct gl_transform_feedback_object *obj) +{ + GLuint i; + + for (i = 0; i < Elements(obj->Buffers); i++) { + _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL); + } + + free(obj); +} + + +#if FEATURE_EXT_transform_feedback + + +/** Default fallback for ctx->Driver.BeginTransformFeedback() */ +static void +begin_transform_feedback(GLcontext *ctx, GLenum mode, + struct gl_transform_feedback_object *obj) +{ + /* nop */ +} + +/** Default fallback for ctx->Driver.EndTransformFeedback() */ +static void +end_transform_feedback(GLcontext *ctx, + struct gl_transform_feedback_object *obj) +{ + /* nop */ +} + +/** Default fallback for ctx->Driver.PauseTransformFeedback() */ +static void +pause_transform_feedback(GLcontext *ctx, + struct gl_transform_feedback_object *obj) +{ + /* nop */ +} + +/** Default fallback for ctx->Driver.ResumeTransformFeedback() */ +static void +resume_transform_feedback(GLcontext *ctx, + struct gl_transform_feedback_object *obj) +{ + /* nop */ +} + +/** Default fallback for ctx->Driver.DrawTransformFeedback() */ +static void +draw_transform_feedback(GLcontext *ctx, GLenum mode, + struct gl_transform_feedback_object *obj) +{ + /* XXX to do */ + /* + * Get number of vertices in obj's feedback buffer. + * Call ctx->Exec.DrawArrays(mode, 0, count); + */ +} + + +/** + * Plug in default device driver functions for transform feedback. + * Most drivers will override some/all of these. + */ +void +_mesa_init_transform_feedback_functions(struct dd_function_table *driver) +{ + driver->NewTransformFeedback = new_transform_feedback; + driver->DeleteTransformFeedback = delete_transform_feedback; + driver->BeginTransformFeedback = begin_transform_feedback; + driver->EndTransformFeedback = end_transform_feedback; + driver->PauseTransformFeedback = pause_transform_feedback; + driver->ResumeTransformFeedback = resume_transform_feedback; + driver->DrawTransformFeedback = draw_transform_feedback; +} + + +void +_mesa_init_transform_feedback_dispatch(struct _glapi_table *disp) +{ + SET_BeginTransformFeedbackEXT(disp, _mesa_BeginTransformFeedback); + SET_EndTransformFeedbackEXT(disp, _mesa_EndTransformFeedback); + SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange); + SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase); + SET_BindBufferOffsetEXT(disp, _mesa_BindBufferOffsetEXT); + SET_TransformFeedbackVaryingsEXT(disp, _mesa_TransformFeedbackVaryings); + SET_GetTransformFeedbackVaryingEXT(disp, _mesa_GetTransformFeedbackVarying); +} + + +/** + ** Begin API functions + **/ + + +void GLAPIENTRY +_mesa_BeginTransformFeedback(GLenum mode) +{ + struct gl_transform_feedback_object *obj; + GET_CURRENT_CONTEXT(ctx); + + obj = ctx->TransformFeedback.CurrentObject; + + switch (mode) { + case GL_POINTS: + case GL_LINES: + case GL_TRIANGLES: + /* legal */ + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glBeginTransformFeedback(mode)"); + return; + } + + if (obj->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBeginTransformFeedback(already active)"); + return; + } + + obj->Active = GL_TRUE; + ctx->TransformFeedback.Mode = mode; + + assert(ctx->Driver.BeginTransformFeedback); + ctx->Driver.BeginTransformFeedback(ctx, mode, obj); +} + + +void GLAPIENTRY +_mesa_EndTransformFeedback(void) +{ + struct gl_transform_feedback_object *obj; + GET_CURRENT_CONTEXT(ctx); + + obj = ctx->TransformFeedback.CurrentObject; + + if (!obj->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glEndTransformFeedback(not active)"); + return; + } + + ctx->TransformFeedback.CurrentObject->Active = GL_FALSE; + + assert(ctx->Driver.EndTransformFeedback); + ctx->Driver.EndTransformFeedback(ctx, obj); +} + + +/** + * Helper used by BindBufferRange() and BindBufferBase(). + */ +static void +bind_buffer_range(GLcontext *ctx, GLuint index, + struct gl_buffer_object *bufObj, + GLintptr offset, GLsizeiptr size) +{ + struct gl_transform_feedback_object *obj = + ctx->TransformFeedback.CurrentObject; + + /* The general binding point */ + _mesa_reference_buffer_object(ctx, + &ctx->TransformFeedback.CurrentBuffer, + bufObj); + + /* The per-attribute binding point */ + _mesa_reference_buffer_object(ctx, + &obj->Buffers[index], + bufObj); + + obj->BufferNames[index] = bufObj->Name; + + obj->Offset[index] = offset; + obj->Size[index] = size; +} + + +/** + * Specify a buffer object to receive vertex shader results. Plus, + * specify the starting offset to place the results, and max size. + */ +void GLAPIENTRY +_mesa_BindBufferRange(GLenum target, GLuint index, + GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + struct gl_transform_feedback_object *obj; + struct gl_buffer_object *bufObj; + GET_CURRENT_CONTEXT(ctx); + + if (target != GL_TRANSFORM_FEEDBACK_BUFFER) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferRange(target)"); + return; + } + + obj = ctx->TransformFeedback.CurrentObject; + + if (obj->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindBufferRange(transform feedback active)"); + return; + } + + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d)", index); + return; + } + + if ((size <= 0) || (size & 0x3)) { + /* must be positive and multiple of four */ + _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size%d)", (int) size); + return; + } + + if (offset & 0x3) { + /* must be multiple of four */ + _mesa_error(ctx, GL_INVALID_VALUE, + "glBindBufferRange(offset=%d)", (int) offset); + return; + } + + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindBufferRange(invalid buffer=%u)", buffer); + return; + } + + if (offset + size >= bufObj->Size) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glBindBufferRange(offset + size %d > buffer size %d)", + (int) (offset + size), (int) (bufObj->Size)); + return; + } + + bind_buffer_range(ctx, index, bufObj, offset, size); +} + + +/** + * Specify a buffer object to receive vertex shader results. + * As above, but start at offset = 0. + */ +void GLAPIENTRY +_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) +{ + struct gl_transform_feedback_object *obj; + struct gl_buffer_object *bufObj; + GLsizeiptr size; + GET_CURRENT_CONTEXT(ctx); + + if (target != GL_TRANSFORM_FEEDBACK_BUFFER) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferBase(target)"); + return; + } + + obj = ctx->TransformFeedback.CurrentObject; + + if (obj->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindBufferRange(transform feedback active)"); + return; + } + + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferBase(index=%d)", index); + return; + } + + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindBufferBase(invalid buffer=%u)", buffer); + return; + } + + /* default size is the buffer size rounded down to nearest + * multiple of four. + */ + size = bufObj->Size & ~0x3; + + bind_buffer_range(ctx, index, bufObj, 0, size); +} + + +/** + * Specify a buffer object to receive vertex shader results, plus the + * offset in the buffer to start placing results. + * This function is part of GL_EXT_transform_feedback, but not GL3. + */ +void GLAPIENTRY +_mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, + GLintptr offset) +{ + struct gl_transform_feedback_object *obj; + struct gl_buffer_object *bufObj; + GET_CURRENT_CONTEXT(ctx); + GLsizeiptr size; + + if (target != GL_TRANSFORM_FEEDBACK_BUFFER) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferOffsetEXT(target)"); + return; + } + + obj = ctx->TransformFeedback.CurrentObject; + + if (obj->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindBufferRange(transform feedback active)"); + return; + } + + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glBindBufferOffsetEXT(index=%d)", index); + return; + } + + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindBufferOffsetEXT(invalid buffer=%u)", buffer); + return; + } + + /* default size is the buffer size rounded down to nearest + * multiple of four. + */ + size = (bufObj->Size - offset) & ~0x3; + + bind_buffer_range(ctx, index, bufObj, offset, size); +} + + +/** + * This function specifies the vertex shader outputs to be written + * to the feedback buffer(s), and in what order. + */ +void GLAPIENTRY +_mesa_TransformFeedbackVaryings(GLuint program, GLsizei count, + const GLchar **varyings, GLenum bufferMode) +{ + struct gl_shader_program *shProg; + GLuint i; + GET_CURRENT_CONTEXT(ctx); + + switch (bufferMode) { + case GL_INTERLEAVED_ATTRIBS: + break; + case GL_SEPARATE_ATTRIBS: + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "glTransformFeedbackVaryings(bufferMode)"); + return; + } + + if (count < 0 || count > ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glTransformFeedbackVaryings(count=%d)", count); + return; + } + + shProg = _mesa_lookup_shader_program(ctx, program); + if (!shProg) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glTransformFeedbackVaryings(program=%u)", program); + return; + } + + /* free existing varyings, if any */ + for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) { + free(shProg->TransformFeedback.VaryingNames[i]); + } + free(shProg->TransformFeedback.VaryingNames); + + /* allocate new memory for varying names */ + shProg->TransformFeedback.VaryingNames = + (GLchar **) malloc(count * sizeof(GLchar *)); + + if (!shProg->TransformFeedback.VaryingNames) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTransformFeedbackVaryings()"); + return; + } + + /* Save the new names and the count */ + for (i = 0; i < (GLuint) count; i++) { + shProg->TransformFeedback.VaryingNames[i] = _mesa_strdup(varyings[i]); + } + shProg->TransformFeedback.NumVarying = count; + + shProg->TransformFeedback.BufferMode = bufferMode; + + /* The varyings won't be used until shader link time */ +} + + +/** + * Get info about the vertex shader's outputs which are to be written + * to the feedback buffer(s). + */ +void GLAPIENTRY +_mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, + GLsizei bufSize, GLsizei *length, + GLsizei *size, GLenum *type, GLchar *name) +{ + const struct gl_shader_program *shProg; + const GLchar *varyingName; + GLint v; + GET_CURRENT_CONTEXT(ctx); + + shProg = _mesa_lookup_shader_program(ctx, program); + if (!shProg) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetTransformFeedbackVaryings(program=%u)", program); + return; + } + + if (index >= shProg->TransformFeedback.NumVarying) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetTransformFeedbackVaryings(index=%u)", index); + return; + } + + varyingName = shProg->TransformFeedback.VaryingNames[index]; + + v = _mesa_lookup_parameter_index(shProg->Varying, -1, varyingName); + if (v >= 0) { + struct gl_program_parameter *param = &shProg->Varying->Parameters[v]; + + /* return the varying's name and length */ + _mesa_copy_string(name, bufSize, length, varyingName); + + /* return the datatype and value's size (in datatype units) */ + if (type) + *type = param->DataType; + if (size) + *size = param->Size; + } + else { + name[0] = 0; + if (length) + *length = 0; + if (type) + *type = 0; + if (size) + *size = 0; + } +} + + + +static struct gl_transform_feedback_object * +lookup_transform_feedback_object(GLcontext *ctx, GLuint name) +{ + if (name == 0) { + return ctx->TransformFeedback.DefaultObject; + } + else + return (struct gl_transform_feedback_object *) + _mesa_HashLookup(ctx->TransformFeedback.Objects, name); +} + + +/** + * Create new transform feedback objects. Transform feedback objects + * encapsulate the state related to transform feedback to allow quickly + * switching state (and drawing the results, below). + * Part of GL_ARB_transform_feedback2. + */ +void GLAPIENTRY +_mesa_GenTransformFeedbacks(GLsizei n, GLuint *names) +{ + GLuint first; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGenTransformFeedbacks(n < 0)"); + return; + } + + if (!names) + return; + + /* we don't need contiguous IDs, but this might be faster */ + first = _mesa_HashFindFreeKeyBlock(ctx->TransformFeedback.Objects, n); + if (first) { + GLsizei i; + for (i = 0; i < n; i++) { + struct gl_transform_feedback_object *obj + = ctx->Driver.NewTransformFeedback(ctx, first + i); + if (!obj) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTransformFeedbacks"); + return; + } + names[i] = first + i; + _mesa_HashInsert(ctx->TransformFeedback.Objects, first + i, obj); + } + } + else { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTransformFeedbacks"); + } +} + + +/** + * Is the given ID a transform feedback object? + * Part of GL_ARB_transform_feedback2. + */ +GLboolean GLAPIENTRY +_mesa_IsTransformFeedback(GLuint name) +{ + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + + if (name && lookup_transform_feedback_object(ctx, name)) + return GL_TRUE; + else + return GL_FALSE; +} + + +/** + * Bind the given transform feedback object. + * Part of GL_ARB_transform_feedback2. + */ +void GLAPIENTRY +_mesa_BindTransformFeedback(GLenum target, GLuint name) +{ + struct gl_transform_feedback_object *obj; + GET_CURRENT_CONTEXT(ctx); + + if (target != GL_TRANSFORM_FEEDBACK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBindTransformFeedback(target)"); + return; + } + + if (ctx->TransformFeedback.CurrentObject->Active && + !ctx->TransformFeedback.CurrentObject->Paused) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindTransformFeedback(transform is active, or not paused)"); + return; + } + + obj = lookup_transform_feedback_object(ctx, name); + if (!obj) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindTransformFeedback(name=%u)", name); + return; + } + + reference_transform_feedback_object(&ctx->TransformFeedback.CurrentObject, + obj); +} + + +/** + * Delete the given transform feedback objects. + * Part of GL_ARB_transform_feedback2. + */ +void GLAPIENTRY +_mesa_DeleteTransformFeedbacks(GLsizei n, const GLuint *names) +{ + GLint i; + GET_CURRENT_CONTEXT(ctx); + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteTransformFeedbacks(n < 0)"); + return; + } + + if (!names) + return; + + for (i = 0; i < n; i++) { + if (names[i] > 0) { + struct gl_transform_feedback_object *obj + = lookup_transform_feedback_object(ctx, names[i]); + if (obj) { + if (obj->Active) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glDeleteTransformFeedbacks(object %u is active)", + names[i]); + return; + } + _mesa_HashRemove(ctx->TransformFeedback.Objects, names[i]); + /* unref, but object may not be deleted until later */ + reference_transform_feedback_object(&obj, NULL); + } + } + } +} + + +/** + * Pause transform feedback. + * Part of GL_ARB_transform_feedback2. + */ +void GLAPIENTRY +_mesa_PauseTransformFeedback(void) +{ + struct gl_transform_feedback_object *obj; + GET_CURRENT_CONTEXT(ctx); + + obj = ctx->TransformFeedback.CurrentObject; + + if (!obj->Active || obj->Paused) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPauseTransformFeedback(feedback not active or already paused)"); + return; + } + + obj->Paused = GL_TRUE; + + assert(ctx->Driver.PauseTransformFeedback); + ctx->Driver.PauseTransformFeedback(ctx, obj); +} + + +/** + * Resume transform feedback. + * Part of GL_ARB_transform_feedback2. + */ +void GLAPIENTRY +_mesa_ResumeTransformFeedback(void) +{ + struct gl_transform_feedback_object *obj; + GET_CURRENT_CONTEXT(ctx); + + obj = ctx->TransformFeedback.CurrentObject; + + if (!obj->Active || !obj->Paused) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glPauseTransformFeedback(feedback not active or not paused)"); + return; + } + + obj->Paused = GL_FALSE; + + assert(ctx->Driver.ResumeTransformFeedback); + ctx->Driver.ResumeTransformFeedback(ctx, obj); +} + + +/** + * Draw the vertex data in a transform feedback object. + * \param mode GL_POINTS, GL_LINES, GL_TRIANGLE_STRIP, etc. + * \param name the transform feedback object + * The number of vertices comes from the transform feedback object. + * User still has to setup of the vertex attribute info with + * glVertexPointer, glColorPointer, etc. + * Part of GL_ARB_transform_feedback2. + */ +void GLAPIENTRY +_mesa_DrawTransformFeedback(GLenum mode, GLuint name) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_transform_feedback_object *obj = + lookup_transform_feedback_object(ctx, name); + + if (mode > GL_POLYGON) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glDrawTransformFeedback(mode=0x%x)", mode); + return; + } + if (!obj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glDrawTransformFeedback(name = %u)", name); + return; + } + + /* XXX check if EndTransformFeedback has never been called while + * the object was bound + */ + + assert(ctx->Driver.DrawTransformFeedback); + ctx->Driver.DrawTransformFeedback(ctx, mode, obj); +} + + +/* +XXX misc to do: + +glGet*() for + +GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED +GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE +GL_TRANSFORM_FEEDBACK_BINDING +*/ + + +#endif /* FEATURE_EXT_transform_feedback */ diff --git a/mesalib/src/mesa/main/transformfeedback.h b/mesalib/src/mesa/main/transformfeedback.h new file mode 100644 index 000000000..4d38522d6 --- /dev/null +++ b/mesalib/src/mesa/main/transformfeedback.h @@ -0,0 +1,132 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2010 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef TRANSFORM_FEEDBACK_H +#define TRANSFORM_FEEDBACK_H + +#include "main/mtypes.h" + + +extern void +_mesa_init_transform_feedback(GLcontext *ctx); + +extern void +_mesa_free_transform_feedback(GLcontext *ctx); + +#if FEATURE_EXT_transform_feedback + +extern GLboolean +_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode); + +extern GLboolean +_mesa_validate_transform_feedback_buffers(GLcontext *ctx); + + +extern void +_mesa_init_transform_feedback_functions(struct dd_function_table *driver); + +extern void +_mesa_init_transform_feedback_dispatch(struct _glapi_table *disp); + + +/*** GL_EXT_transform_feedback ***/ + +extern void GLAPIENTRY +_mesa_BeginTransformFeedback(GLenum mode); + +extern void GLAPIENTRY +_mesa_EndTransformFeedback(void); + +extern void GLAPIENTRY +_mesa_BindBufferRange(GLenum target, GLuint index, + GLuint buffer, GLintptr offset, GLsizeiptr size); + +extern void GLAPIENTRY +_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer); + +extern void GLAPIENTRY +_mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, + GLintptr offset); + +extern void GLAPIENTRY +_mesa_TransformFeedbackVaryings(GLuint program, GLsizei count, + const GLchar **varyings, GLenum bufferMode); + +extern void GLAPIENTRY +_mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, + GLsizei bufSize, GLsizei *length, + GLsizei *size, GLenum *type, GLchar *name); + + + +/*** GL_ARB_transform_feedback2 ***/ + +extern void GLAPIENTRY +_mesa_GenTransformFeedbacks(GLsizei n, GLuint *names); + +extern GLboolean GLAPIENTRY +_mesa_IsTransformFeedback(GLuint name); + +extern void GLAPIENTRY +_mesa_BindTransformFeedback(GLenum target, GLuint name); + +extern void GLAPIENTRY +_mesa_DeleteTransformFeedbacks(GLsizei n, const GLuint *names); + +extern void GLAPIENTRY +_mesa_PauseTransformFeedback(void); + +extern void GLAPIENTRY +_mesa_ResumeTransformFeedback(void); + +extern void GLAPIENTRY +_mesa_DrawTransformFeedback(GLenum mode, GLuint name); + +#else /* FEATURE_EXT_transform_feedback */ + +static INLINE GLboolean +_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode) +{ + return GL_TRUE; +} + +static INLINE GLboolean +_mesa_validate_transform_feedback_buffers(GLcontext *ctx) +{ + return GL_TRUE; +} + +static INLINE void +_mesa_init_transform_feedback_functions(struct dd_function_table *driver) +{ +} + +static INLINE void +_mesa_init_transform_feedback_dispatch(struct _glapi_table *disp) +{ +} + +#endif /* FEATURE_EXT_transform_feedback */ + +#endif /* TRANSFORM_FEEDBACK_H */ diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c new file mode 100644 index 000000000..a5d7da51f --- /dev/null +++ b/mesalib/src/mesa/main/uniforms.c @@ -0,0 +1,1382 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2004-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009-2010 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file uniforms.c + * Functions related to GLSL uniform variables. + * \author Brian Paul + */ + +/** + * XXX things to do: + * 1. Check that the right error code is generated for all _mesa_error() calls. + * 2. Insert FLUSH_VERTICES calls in various places + */ + + +#include "main/glheader.h" +#include "main/context.h" +#include "main/dispatch.h" +#include "main/shaderapi.h" +#include "main/shaderobj.h" +#include "main/uniforms.h" +#include "program/prog_parameter.h" +#include "program/prog_statevars.h" +#include "program/prog_uniform.h" + + + +static GLenum +base_uniform_type(GLenum type) +{ + switch (type) { +#if 0 /* not needed, for now */ + case GL_BOOL: + case GL_BOOL_VEC2: + case GL_BOOL_VEC3: + case GL_BOOL_VEC4: + return GL_BOOL; +#endif + case GL_FLOAT: + case GL_FLOAT_VEC2: + case GL_FLOAT_VEC3: + case GL_FLOAT_VEC4: + return GL_FLOAT; + case GL_UNSIGNED_INT: + case GL_UNSIGNED_INT_VEC2: + case GL_UNSIGNED_INT_VEC3: + case GL_UNSIGNED_INT_VEC4: + return GL_UNSIGNED_INT; + case GL_INT: + case GL_INT_VEC2: + case GL_INT_VEC3: + case GL_INT_VEC4: + return GL_INT; + default: + _mesa_problem(NULL, "Invalid type in base_uniform_type()"); + return GL_FLOAT; + } +} + + +static GLboolean +is_boolean_type(GLenum type) +{ + switch (type) { + case GL_BOOL: + case GL_BOOL_VEC2: + case GL_BOOL_VEC3: + case GL_BOOL_VEC4: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +static GLboolean +is_sampler_type(GLenum type) +{ + switch (type) { + case GL_SAMPLER_1D: + case GL_SAMPLER_2D: + case GL_SAMPLER_3D: + case GL_SAMPLER_CUBE: + case GL_SAMPLER_1D_SHADOW: + case GL_SAMPLER_2D_SHADOW: + case GL_SAMPLER_2D_RECT_ARB: + case GL_SAMPLER_2D_RECT_SHADOW_ARB: + case GL_SAMPLER_1D_ARRAY_EXT: + case GL_SAMPLER_2D_ARRAY_EXT: + case GL_SAMPLER_1D_ARRAY_SHADOW_EXT: + case GL_SAMPLER_2D_ARRAY_SHADOW_EXT: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +static struct gl_program_parameter * +get_uniform_parameter(const struct gl_shader_program *shProg, GLuint index) +{ + const struct gl_program *prog = NULL; + GLint progPos; + + progPos = shProg->Uniforms->Uniforms[index].VertPos; + if (progPos >= 0) { + prog = &shProg->VertexProgram->Base; + } + else { + progPos = shProg->Uniforms->Uniforms[index].FragPos; + if (progPos >= 0) { + prog = &shProg->FragmentProgram->Base; + } else { + progPos = shProg->Uniforms->Uniforms[index].GeomPos; + if (progPos >= 0) { + prog = &shProg->GeometryProgram->Base; + } + } + } + + if (!prog || progPos < 0) + return NULL; /* should never happen */ + + return &prog->Parameters->Parameters[progPos]; +} + + +/** + * Called by glGetActiveUniform(). + */ +static void +_mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index, + GLsizei maxLength, GLsizei *length, GLint *size, + GLenum *type, GLchar *nameOut) +{ + const struct gl_shader_program *shProg; + const struct gl_program *prog = NULL; + const struct gl_program_parameter *param; + GLint progPos; + + shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniform"); + if (!shProg) + return; + + if (!shProg->Uniforms || index >= shProg->Uniforms->NumUniforms) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)"); + return; + } + + progPos = shProg->Uniforms->Uniforms[index].VertPos; + if (progPos >= 0) { + prog = &shProg->VertexProgram->Base; + } + else { + progPos = shProg->Uniforms->Uniforms[index].FragPos; + if (progPos >= 0) { + prog = &shProg->FragmentProgram->Base; + } else { + progPos = shProg->Uniforms->Uniforms[index].GeomPos; + if (progPos >= 0) { + prog = &shProg->GeometryProgram->Base; + } + } + } + + if (!prog || progPos < 0) + return; /* should never happen */ + + ASSERT(progPos < prog->Parameters->NumParameters); + param = &prog->Parameters->Parameters[progPos]; + + if (nameOut) { + _mesa_copy_string(nameOut, maxLength, length, param->Name); + } + + if (size) { + GLint typeSize = _mesa_sizeof_glsl_type(param->DataType); + if ((GLint) param->Size > typeSize) { + /* This is an array. + * Array elements are placed on vector[4] boundaries so they're + * a multiple of four floats. We round typeSize up to next multiple + * of four to get the right size below. + */ + typeSize = (typeSize + 3) & ~3; + } + /* Note that the returned size is in units of the <type>, not bytes */ + *size = param->Size / typeSize; + } + + if (type) { + *type = param->DataType; + } +} + + + +static void +get_matrix_dims(GLenum type, GLint *rows, GLint *cols) +{ + switch (type) { + case GL_FLOAT_MAT2: + *rows = *cols = 2; + break; + case GL_FLOAT_MAT2x3: + *rows = 3; + *cols = 2; + break; + case GL_FLOAT_MAT2x4: + *rows = 4; + *cols = 2; + break; + case GL_FLOAT_MAT3: + *rows = 3; + *cols = 3; + break; + case GL_FLOAT_MAT3x2: + *rows = 2; + *cols = 3; + break; + case GL_FLOAT_MAT3x4: + *rows = 4; + *cols = 3; + break; + case GL_FLOAT_MAT4: + *rows = 4; + *cols = 4; + break; + case GL_FLOAT_MAT4x2: + *rows = 2; + *cols = 4; + break; + case GL_FLOAT_MAT4x3: + *rows = 3; + *cols = 4; + break; + default: + *rows = *cols = 0; + } +} + + +/** + * Determine the number of rows and columns occupied by a uniform + * according to its datatype. For non-matrix types (such as GL_FLOAT_VEC4), + * the number of rows = 1 and cols = number of elements in the vector. + */ +static void +get_uniform_rows_cols(const struct gl_program_parameter *p, + GLint *rows, GLint *cols) +{ + get_matrix_dims(p->DataType, rows, cols); + if (*rows == 0 && *cols == 0) { + /* not a matrix type, probably a float or vector */ + if (p->Size <= 4) { + *rows = 1; + *cols = p->Size; + } + else { + *rows = p->Size / 4 + 1; + if (p->Size % 4 == 0) + *cols = 4; + else + *cols = p->Size % 4; + } + } +} + + +/** + * Helper for get_uniform[fi]v() functions. + * Given a shader program name and uniform location, return a pointer + * to the shader program and return the program parameter position. + */ +static void +lookup_uniform_parameter(GLcontext *ctx, GLuint program, GLint location, + struct gl_program **progOut, GLint *paramPosOut) +{ + struct gl_shader_program *shProg + = _mesa_lookup_shader_program_err(ctx, program, "glGetUniform[if]v"); + struct gl_program *prog = NULL; + GLint progPos = -1; + + /* if shProg is NULL, we'll have already recorded an error */ + + if (shProg) { + if (!shProg->Uniforms || + location < 0 || + location >= (GLint) shProg->Uniforms->NumUniforms) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformfv(location)"); + } + else { + /* OK, find the gl_program and program parameter location */ + progPos = shProg->Uniforms->Uniforms[location].VertPos; + if (progPos >= 0) { + prog = &shProg->VertexProgram->Base; + } + else { + progPos = shProg->Uniforms->Uniforms[location].FragPos; + if (progPos >= 0) { + prog = &shProg->FragmentProgram->Base; + } else { + progPos = shProg->Uniforms->Uniforms[location].GeomPos; + if (progPos >= 0) { + prog = &shProg->GeometryProgram->Base; + } + } + } + } + } + + *progOut = prog; + *paramPosOut = progPos; +} + + +/** + * GLGL uniform arrays and structs require special handling. + * + * The GL_ARB_shader_objects spec says that if you use + * glGetUniformLocation to get the location of an array, you CANNOT + * access other elements of the array by adding an offset to the + * returned location. For example, you must call + * glGetUniformLocation("foo[16]") if you want to set the 16th element + * of the array with glUniform(). + * + * HOWEVER, some other OpenGL drivers allow accessing array elements + * by adding an offset to the returned array location. And some apps + * seem to depend on that behaviour. + * + * Mesa's gl_uniform_list doesn't directly support this since each + * entry in the list describes one uniform variable, not one uniform + * element. We could insert dummy entries in the list for each array + * element after [0] but that causes complications elsewhere. + * + * We solve this problem by encoding two values in the location that's + * returned by glGetUniformLocation(): + * a) index into gl_uniform_list::Uniforms[] for the uniform + * b) an array/field offset (0 for simple types) + * + * These two values are encoded in the high and low halves of a GLint. + * By putting the uniform number in the high part and the offset in the + * low part, we can support the unofficial ability to index into arrays + * by adding offsets to the location value. + */ +static void +merge_location_offset(GLint *location, GLint offset) +{ + *location = (*location << 16) | offset; +} + + +/** + * Separate the uniform location and parameter offset. See above. + */ +static void +split_location_offset(GLint *location, GLint *offset) +{ + *offset = *location & 0xffff; + *location = *location >> 16; +} + + + +/** + * Called via glGetUniformfv(). + */ +static void +_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, + GLfloat *params) +{ + struct gl_program *prog; + GLint paramPos; + GLint offset; + + split_location_offset(&location, &offset); + + lookup_uniform_parameter(ctx, program, location, &prog, ¶mPos); + + if (prog) { + const struct gl_program_parameter *p = + &prog->Parameters->Parameters[paramPos]; + GLint rows, cols, i, j, k; + + get_uniform_rows_cols(p, &rows, &cols); + + k = 0; + for (i = 0; i < rows; i++) { + for (j = 0; j < cols; j++ ) { + params[k++] = prog->Parameters->ParameterValues[paramPos+i][j]; + } + } + } +} + + +/** + * Called via glGetUniformiv(). + * \sa _mesa_get_uniformfv, only difference is a cast. + */ +static void +_mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location, + GLint *params) +{ + struct gl_program *prog; + GLint paramPos; + GLint offset; + + split_location_offset(&location, &offset); + + lookup_uniform_parameter(ctx, program, location, &prog, ¶mPos); + + if (prog) { + const struct gl_program_parameter *p = + &prog->Parameters->Parameters[paramPos]; + GLint rows, cols, i, j, k; + + get_uniform_rows_cols(p, &rows, &cols); + + k = 0; + for (i = 0; i < rows; i++) { + for (j = 0; j < cols; j++ ) { + params[k++] = (GLint) prog->Parameters->ParameterValues[paramPos+i][j]; + } + } + } +} + + +/** + * Called via glGetUniformLocation(). + * + * The return value will encode two values, the uniform location and an + * offset (used for arrays, structs). + */ +GLint +_mesa_get_uniform_location(GLcontext *ctx, struct gl_shader_program *shProg, + const GLchar *name) +{ + GLint offset = 0, location = -1; + + if (shProg->LinkStatus == GL_FALSE) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformfv(program)"); + return -1; + } + + /* XXX we should return -1 if the uniform was declared, but not + * actually used. + */ + + /* XXX we need to be able to parse uniform names for structs and arrays + * such as: + * mymatrix[1] + * mystruct.field1 + */ + + { + /* handle 1-dimension arrays here... */ + char *c = strchr(name, '['); + if (c) { + /* truncate name at [ */ + const GLint len = c - name; + GLchar *newName = malloc(len + 1); + if (!newName) + return -1; /* out of mem */ + memcpy(newName, name, len); + newName[len] = 0; + + location = _mesa_lookup_uniform(shProg->Uniforms, newName); + if (location >= 0) { + const GLint element = atoi(c + 1); + if (element > 0) { + /* get type of the uniform array element */ + struct gl_program_parameter *p; + p = get_uniform_parameter(shProg, location); + if (p) { + GLint rows, cols; + get_matrix_dims(p->DataType, &rows, &cols); + if (rows < 1) + rows = 1; + offset = element * rows; + } + } + } + + free(newName); + } + } + + if (location < 0) { + location = _mesa_lookup_uniform(shProg->Uniforms, name); + } + + if (location >= 0) { + merge_location_offset(&location, offset); + } + + return location; +} + + + +/** + * Update the vertex/fragment program's TexturesUsed array. + * + * This needs to be called after glUniform(set sampler var) is called. + * A call to glUniform(samplerVar, value) causes a sampler to point to a + * particular texture unit. We know the sampler's texture target + * (1D/2D/3D/etc) from compile time but the sampler's texture unit is + * set by glUniform() calls. + * + * So, scan the program->SamplerUnits[] and program->SamplerTargets[] + * information to update the prog->TexturesUsed[] values. + * Each value of TexturesUsed[unit] is one of zero, TEXTURE_1D_INDEX, + * TEXTURE_2D_INDEX, TEXTURE_3D_INDEX, etc. + * We'll use that info for state validation before rendering. + */ +void +_mesa_update_shader_textures_used(struct gl_program *prog) +{ + GLuint s; + + memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed)); + + for (s = 0; s < MAX_SAMPLERS; s++) { + if (prog->SamplersUsed & (1 << s)) { + GLuint unit = prog->SamplerUnits[s]; + GLuint tgt = prog->SamplerTargets[s]; + assert(unit < MAX_TEXTURE_IMAGE_UNITS); + assert(tgt < NUM_TEXTURE_TARGETS); + prog->TexturesUsed[unit] |= (1 << tgt); + } + } +} + + +/** + * Check if the type given by userType is allowed to set a uniform of the + * target type. Generally, equivalence is required, but setting Boolean + * uniforms can be done with glUniformiv or glUniformfv. + */ +static GLboolean +compatible_types(GLenum userType, GLenum targetType) +{ + if (userType == targetType) + return GL_TRUE; + + if (targetType == GL_BOOL && (userType == GL_FLOAT || + userType == GL_UNSIGNED_INT || + userType == GL_INT)) + return GL_TRUE; + + if (targetType == GL_BOOL_VEC2 && (userType == GL_FLOAT_VEC2 || + userType == GL_UNSIGNED_INT_VEC2 || + userType == GL_INT_VEC2)) + return GL_TRUE; + + if (targetType == GL_BOOL_VEC3 && (userType == GL_FLOAT_VEC3 || + userType == GL_UNSIGNED_INT_VEC3 || + userType == GL_INT_VEC3)) + return GL_TRUE; + + if (targetType == GL_BOOL_VEC4 && (userType == GL_FLOAT_VEC4 || + userType == GL_UNSIGNED_INT_VEC4 || + userType == GL_INT_VEC4)) + return GL_TRUE; + + if (is_sampler_type(targetType) && userType == GL_INT) + return GL_TRUE; + + return GL_FALSE; +} + + +/** + * Set the value of a program's uniform variable. + * \param program the program whose uniform to update + * \param index the index of the program parameter for the uniform + * \param offset additional parameter slot offset (for arrays) + * \param type the incoming datatype of 'values' + * \param count the number of uniforms to set + * \param elems number of elements per uniform (1, 2, 3 or 4) + * \param values the new values, of datatype 'type' + */ +static void +set_program_uniform(GLcontext *ctx, struct gl_program *program, + GLint index, GLint offset, + GLenum type, GLsizei count, GLint elems, + const void *values) +{ + const struct gl_program_parameter *param = + &program->Parameters->Parameters[index]; + + assert(offset >= 0); + assert(elems >= 1); + assert(elems <= 4); + + if (!compatible_types(type, param->DataType)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)"); + return; + } + + if (index + offset > (GLint) program->Parameters->Size) { + /* out of bounds! */ + return; + } + + if (param->Type == PROGRAM_SAMPLER) { + /* This controls which texture unit which is used by a sampler */ + GLboolean changed = GL_FALSE; + GLint i; + + /* this should have been caught by the compatible_types() check */ + ASSERT(type == GL_INT); + + /* loop over number of samplers to change */ + for (i = 0; i < count; i++) { + GLuint sampler = + (GLuint) program->Parameters->ParameterValues[index + offset + i][0]; + GLuint texUnit = ((GLuint *) values)[i]; + + /* check that the sampler (tex unit index) is legal */ + if (texUnit >= ctx->Const.MaxTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glUniform1(invalid sampler/tex unit index for '%s')", + param->Name); + return; + } + + /* This maps a sampler to a texture unit: */ + if (sampler < MAX_SAMPLERS) { +#if 0 + printf("Set program %p sampler %d '%s' to unit %u\n", + program, sampler, param->Name, texUnit); +#endif + if (program->SamplerUnits[sampler] != texUnit) { + program->SamplerUnits[sampler] = texUnit; + changed = GL_TRUE; + } + } + } + + if (changed) { + /* When a sampler's value changes it usually requires rewriting + * a GPU program's TEX instructions since there may not be a + * sampler->texture lookup table. We signal this with the + * ProgramStringNotify() callback. + */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE | _NEW_PROGRAM); + _mesa_update_shader_textures_used(program); + /* Do we need to care about the return value here? + * This should not be the first time the driver was notified of + * this program. + */ + (void) ctx->Driver.ProgramStringNotify(ctx, program->Target, program); + } + } + else { + /* ordinary uniform variable */ + const GLboolean isUniformBool = is_boolean_type(param->DataType); + const GLenum basicType = base_uniform_type(type); + const GLint slots = (param->Size + 3) / 4; + const GLint typeSize = _mesa_sizeof_glsl_type(param->DataType); + GLsizei k, i; + + if ((GLint) param->Size > typeSize) { + /* an array */ + /* we'll ignore extra data below */ + } + else { + /* non-array: count must be at most one; count == 0 is handled by the loop below */ + if (count > 1) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUniform(uniform '%s' is not an array)", + param->Name); + return; + } + } + + /* loop over number of array elements */ + for (k = 0; k < count; k++) { + GLfloat *uniformVal; + + if (offset + k >= slots) { + /* Extra array data is ignored */ + break; + } + + /* uniformVal (the destination) is always float[4] */ + uniformVal = program->Parameters->ParameterValues[index + offset + k]; + + if (basicType == GL_INT) { + /* convert user's ints to floats */ + const GLint *iValues = ((const GLint *) values) + k * elems; + for (i = 0; i < elems; i++) { + uniformVal[i] = (GLfloat) iValues[i]; + } + } + else if (basicType == GL_UNSIGNED_INT) { + /* convert user's uints to floats */ + const GLuint *iValues = ((const GLuint *) values) + k * elems; + for (i = 0; i < elems; i++) { + uniformVal[i] = (GLfloat) iValues[i]; + } + } + else { + const GLfloat *fValues = ((const GLfloat *) values) + k * elems; + assert(basicType == GL_FLOAT); + for (i = 0; i < elems; i++) { + uniformVal[i] = fValues[i]; + } + } + + /* if the uniform is bool-valued, convert to 1.0 or 0.0 */ + if (isUniformBool) { + for (i = 0; i < elems; i++) { + uniformVal[i] = uniformVal[i] ? 1.0f : 0.0f; + } + } + } + } +} + + +/** + * Called via glUniform*() functions. + */ +void +_mesa_uniform(GLcontext *ctx, struct gl_shader_program *shProg, + GLint location, GLsizei count, + const GLvoid *values, GLenum type) +{ + struct gl_uniform *uniform; + GLint elems, offset; + + if (!shProg || !shProg->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(program not linked)"); + return; + } + + if (location == -1) + return; /* The standard specifies this as a no-op */ + + if (location < -1) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(location=%d)", + location); + return; + } + + split_location_offset(&location, &offset); + + if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) { + _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location=%d)", location); + return; + } + + if (count < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(count < 0)"); + return; + } + + elems = _mesa_sizeof_glsl_type(type); + + FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + + uniform = &shProg->Uniforms->Uniforms[location]; + + if (ctx->Shader.Flags & GLSL_UNIFORMS) { + const GLenum basicType = base_uniform_type(type); + GLint i; + printf("Mesa: set program %u uniform %s (loc %d) to: ", + shProg->Name, uniform->Name, location); + if (basicType == GL_INT) { + const GLint *v = (const GLint *) values; + for (i = 0; i < count * elems; i++) { + printf("%d ", v[i]); + } + } + else if (basicType == GL_UNSIGNED_INT) { + const GLuint *v = (const GLuint *) values; + for (i = 0; i < count * elems; i++) { + printf("%u ", v[i]); + } + } + else { + const GLfloat *v = (const GLfloat *) values; + assert(basicType == GL_FLOAT); + for (i = 0; i < count * elems; i++) { + printf("%g ", v[i]); + } + } + printf("\n"); + } + + /* A uniform var may be used by both a vertex shader and a fragment + * shader. We may need to update one or both shader's uniform here: + */ + if (shProg->VertexProgram) { + /* convert uniform location to program parameter index */ + GLint index = uniform->VertPos; + if (index >= 0) { + set_program_uniform(ctx, &shProg->VertexProgram->Base, + index, offset, type, count, elems, values); + } + } + + if (shProg->FragmentProgram) { + /* convert uniform location to program parameter index */ + GLint index = uniform->FragPos; + if (index >= 0) { + set_program_uniform(ctx, &shProg->FragmentProgram->Base, + index, offset, type, count, elems, values); + } + } + + if (shProg->GeometryProgram) { + /* convert uniform location to program parameter index */ + GLint index = uniform->GeomPos; + if (index >= 0) { + set_program_uniform(ctx, &shProg->GeometryProgram->Base, + index, offset, type, count, elems, values); + } + } + + uniform->Initialized = GL_TRUE; +} + + +/** + * Set a matrix-valued program parameter. + */ +static void +set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, + GLuint index, GLuint offset, + GLuint count, GLuint rows, GLuint cols, + GLboolean transpose, const GLfloat *values) +{ + GLuint mat, row, col; + GLuint src = 0; + const struct gl_program_parameter * param = &program->Parameters->Parameters[index]; + const GLuint slots = (param->Size + 3) / 4; + const GLint typeSize = _mesa_sizeof_glsl_type(param->DataType); + GLint nr, nc; + + /* check that the number of rows, columns is correct */ + get_matrix_dims(param->DataType, &nr, &nc); + if (rows != nr || cols != nc) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUniformMatrix(matrix size mismatch)"); + return; + } + + if ((GLint) param->Size <= typeSize) { + /* non-array: count must be at most one; count == 0 is handled by the loop below */ + if (count > 1) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUniformMatrix(uniform is not an array)"); + return; + } + } + + /* + * Note: the _columns_ of a matrix are stored in program registers, not + * the rows. So, the loops below look a little funny. + * XXX could optimize this a bit... + */ + + /* loop over matrices */ + for (mat = 0; mat < count; mat++) { + + /* each matrix: */ + for (col = 0; col < cols; col++) { + GLfloat *v; + if (offset >= slots) { + /* Ignore writes beyond the end of (the used part of) an array */ + return; + } + v = program->Parameters->ParameterValues[index + offset]; + for (row = 0; row < rows; row++) { + if (transpose) { + v[row] = values[src + row * cols + col]; + } + else { + v[row] = values[src + col * rows + row]; + } + } + + offset++; + } + + src += rows * cols; /* next matrix */ + } +} + + +/** + * Called by glUniformMatrix*() functions. + * Note: cols=2, rows=4 ==> array[2] of vec4 + */ +void +_mesa_uniform_matrix(GLcontext *ctx, struct gl_shader_program *shProg, + GLint cols, GLint rows, + GLint location, GLsizei count, + GLboolean transpose, const GLfloat *values) +{ + struct gl_uniform *uniform; + GLint offset; + + if (!shProg || !shProg->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUniformMatrix(program not linked)"); + return; + } + + if (location == -1) + return; /* The standard specifies this as a no-op */ + + if (location < -1) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(location)"); + return; + } + + split_location_offset(&location, &offset); + + if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) { + _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)"); + return; + } + if (values == NULL) { + _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); + + uniform = &shProg->Uniforms->Uniforms[location]; + + if (shProg->VertexProgram) { + /* convert uniform location to program parameter index */ + GLint index = uniform->VertPos; + if (index >= 0) { + set_program_uniform_matrix(ctx, &shProg->VertexProgram->Base, + index, offset, + count, rows, cols, transpose, values); + } + } + + if (shProg->FragmentProgram) { + /* convert uniform location to program parameter index */ + GLint index = uniform->FragPos; + if (index >= 0) { + set_program_uniform_matrix(ctx, &shProg->FragmentProgram->Base, + index, offset, + count, rows, cols, transpose, values); + } + } + + if (shProg->GeometryProgram) { + /* convert uniform location to program parameter index */ + GLint index = uniform->GeomPos; + if (index >= 0) { + set_program_uniform_matrix(ctx, &shProg->GeometryProgram->Base, + index, offset, + count, rows, cols, transpose, values); + } + } + + uniform->Initialized = GL_TRUE; +} + + +void GLAPIENTRY +_mesa_Uniform1fARB(GLint location, GLfloat v0) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, &v0, GL_FLOAT); +} + +void GLAPIENTRY +_mesa_Uniform2fARB(GLint location, GLfloat v0, GLfloat v1) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat v[2]; + v[0] = v0; + v[1] = v1; + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_FLOAT_VEC2); +} + +void GLAPIENTRY +_mesa_Uniform3fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat v[3]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_FLOAT_VEC3); +} + +void GLAPIENTRY +_mesa_Uniform4fARB(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, + GLfloat v3) +{ + GET_CURRENT_CONTEXT(ctx); + GLfloat v[4]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + v[3] = v3; + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_FLOAT_VEC4); +} + +void GLAPIENTRY +_mesa_Uniform1iARB(GLint location, GLint v0) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, &v0, GL_INT); +} + +void GLAPIENTRY +_mesa_Uniform2iARB(GLint location, GLint v0, GLint v1) +{ + GET_CURRENT_CONTEXT(ctx); + GLint v[2]; + v[0] = v0; + v[1] = v1; + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_INT_VEC2); +} + +void GLAPIENTRY +_mesa_Uniform3iARB(GLint location, GLint v0, GLint v1, GLint v2) +{ + GET_CURRENT_CONTEXT(ctx); + GLint v[3]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_INT_VEC3); +} + +void GLAPIENTRY +_mesa_Uniform4iARB(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + GET_CURRENT_CONTEXT(ctx); + GLint v[4]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + v[3] = v3; + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_INT_VEC4); +} + +void GLAPIENTRY +_mesa_Uniform1fvARB(GLint location, GLsizei count, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_FLOAT); +} + +void GLAPIENTRY +_mesa_Uniform2fvARB(GLint location, GLsizei count, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_FLOAT_VEC2); +} + +void GLAPIENTRY +_mesa_Uniform3fvARB(GLint location, GLsizei count, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_FLOAT_VEC3); +} + +void GLAPIENTRY +_mesa_Uniform4fvARB(GLint location, GLsizei count, const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_FLOAT_VEC4); +} + +void GLAPIENTRY +_mesa_Uniform1ivARB(GLint location, GLsizei count, const GLint * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_INT); +} + +void GLAPIENTRY +_mesa_Uniform2ivARB(GLint location, GLsizei count, const GLint * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_INT_VEC2); +} + +void GLAPIENTRY +_mesa_Uniform3ivARB(GLint location, GLsizei count, const GLint * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_INT_VEC3); +} + +void GLAPIENTRY +_mesa_Uniform4ivARB(GLint location, GLsizei count, const GLint * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_INT_VEC4); +} + + +/** OpenGL 3.0 GLuint-valued functions **/ +void GLAPIENTRY +_mesa_Uniform1ui(GLint location, GLuint v0) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, &v0, GL_UNSIGNED_INT); +} + +void GLAPIENTRY +_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint v[2]; + v[0] = v0; + v[1] = v1; + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_UNSIGNED_INT_VEC2); +} + +void GLAPIENTRY +_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint v[3]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_UNSIGNED_INT_VEC3); +} + +void GLAPIENTRY +_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +{ + GET_CURRENT_CONTEXT(ctx); + GLuint v[4]; + v[0] = v0; + v[1] = v1; + v[2] = v2; + v[3] = v3; + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, 1, v, GL_UNSIGNED_INT_VEC4); +} + +void GLAPIENTRY +_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_UNSIGNED_INT); +} + +void GLAPIENTRY +_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_UNSIGNED_INT_VEC2); +} + +void GLAPIENTRY +_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_UNSIGNED_INT_VEC3); +} + +void GLAPIENTRY +_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform(ctx, ctx->Shader.CurrentProgram, location, count, value, GL_UNSIGNED_INT_VEC4); +} + + + +void GLAPIENTRY +_mesa_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose, + const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 2, 2, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose, + const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 3, 3, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose, + const GLfloat * value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 4, 4, location, count, transpose, value); +} + + +/** + * Non-square UniformMatrix are OpenGL 2.1 + */ +void GLAPIENTRY +_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 2, 3, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 3, 2, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 2, 4, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 4, 2, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 3, 4, location, count, transpose, value); +} + +void GLAPIENTRY +_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_uniform_matrix(ctx, ctx->Shader.CurrentProgram, + 4, 3, location, count, transpose, value); +} + + +void GLAPIENTRY +_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_get_uniformfv(ctx, program, location, params); +} + + +void GLAPIENTRY +_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_get_uniformiv(ctx, program, location, params); +} + + +GLint GLAPIENTRY +_mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name) +{ + struct gl_shader_program *shProg; + + GET_CURRENT_CONTEXT(ctx); + + shProg = _mesa_lookup_shader_program_err(ctx, programObj, + "glGetUniformLocation"); + if (!shProg) + return -1; + + return _mesa_get_uniform_location(ctx, shProg, name); +} + + +void GLAPIENTRY +_mesa_GetActiveUniformARB(GLhandleARB program, GLuint index, + GLsizei maxLength, GLsizei * length, GLint * size, + GLenum * type, GLcharARB * name) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_get_active_uniform(ctx, program, index, maxLength, length, size, + type, name); +} + + +/** + * Plug in shader uniform-related functions into API dispatch table. + */ +void +_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec) +{ +#if FEATURE_GL + SET_Uniform1fARB(exec, _mesa_Uniform1fARB); + SET_Uniform2fARB(exec, _mesa_Uniform2fARB); + SET_Uniform3fARB(exec, _mesa_Uniform3fARB); + SET_Uniform4fARB(exec, _mesa_Uniform4fARB); + SET_Uniform1iARB(exec, _mesa_Uniform1iARB); + SET_Uniform2iARB(exec, _mesa_Uniform2iARB); + SET_Uniform3iARB(exec, _mesa_Uniform3iARB); + SET_Uniform4iARB(exec, _mesa_Uniform4iARB); + SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB); + SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB); + SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB); + SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB); + SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB); + SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB); + SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB); + SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB); + SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB); + SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB); + SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB); + + SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB); + SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB); + SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB); + SET_GetUniformivARB(exec, _mesa_GetUniformivARB); + + /* OpenGL 2.1 */ + SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv); + SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv); + SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv); + SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv); + SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv); + SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv); + + /* OpenGL 3.0 */ + /* XXX finish dispatch */ + (void) _mesa_Uniform1ui; + (void) _mesa_Uniform2ui; + (void) _mesa_Uniform3ui; + (void) _mesa_Uniform4ui; + (void) _mesa_Uniform1uiv; + (void) _mesa_Uniform2uiv; + (void) _mesa_Uniform3uiv; + (void) _mesa_Uniform4uiv; +#endif /* FEATURE_GL */ +} diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h new file mode 100644 index 000000000..f823c6144 --- /dev/null +++ b/mesalib/src/mesa/main/uniforms.h @@ -0,0 +1,175 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2010 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef UNIFORMS_H +#define UNIFORMS_H + +#include "glheader.h" + +struct gl_program; +struct _glapi_table; + +extern void GLAPIENTRY +_mesa_Uniform1fARB(GLint, GLfloat); + +extern void GLAPIENTRY +_mesa_Uniform2fARB(GLint, GLfloat, GLfloat); + +extern void GLAPIENTRY +_mesa_Uniform3fARB(GLint, GLfloat, GLfloat, GLfloat); + +extern void GLAPIENTRY +_mesa_Uniform4fARB(GLint, GLfloat, GLfloat, GLfloat, GLfloat); + +extern void GLAPIENTRY +_mesa_Uniform1iARB(GLint, GLint); + +extern void GLAPIENTRY +_mesa_Uniform2iARB(GLint, GLint, GLint); + +extern void GLAPIENTRY +_mesa_Uniform3iARB(GLint, GLint, GLint, GLint); + +extern void GLAPIENTRY +_mesa_Uniform4iARB(GLint, GLint, GLint, GLint, GLint); + +extern void GLAPIENTRY +_mesa_Uniform1fvARB(GLint, GLsizei, const GLfloat *); + +extern void GLAPIENTRY +_mesa_Uniform2fvARB(GLint, GLsizei, const GLfloat *); + +extern void GLAPIENTRY +_mesa_Uniform3fvARB(GLint, GLsizei, const GLfloat *); + +extern void GLAPIENTRY +_mesa_Uniform4fvARB(GLint, GLsizei, const GLfloat *); + +extern void GLAPIENTRY +_mesa_Uniform1ivARB(GLint, GLsizei, const GLint *); + +extern void GLAPIENTRY +_mesa_Uniform2ivARB(GLint, GLsizei, const GLint *); + +extern void GLAPIENTRY +_mesa_Uniform3ivARB(GLint, GLsizei, const GLint *); + +extern void GLAPIENTRY +_mesa_Uniform4ivARB(GLint, GLsizei, const GLint *); + +extern void GLAPIENTRY +_mesa_Uniform1ui(GLint location, GLuint v0); + +extern void GLAPIENTRY +_mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1); + +extern void GLAPIENTRY +_mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2); + +extern void GLAPIENTRY +_mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); + +extern void GLAPIENTRY +_mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value); + +extern void GLAPIENTRY +_mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value); + +extern void GLAPIENTRY +_mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value); + +extern void GLAPIENTRY +_mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value); + + +extern void GLAPIENTRY +_mesa_UniformMatrix2fvARB(GLint, GLsizei, GLboolean, const GLfloat *); + +extern void GLAPIENTRY +_mesa_UniformMatrix3fvARB(GLint, GLsizei, GLboolean, const GLfloat *); + +extern void GLAPIENTRY +_mesa_UniformMatrix4fvARB(GLint, GLsizei, GLboolean, const GLfloat *); + +extern void GLAPIENTRY +_mesa_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value); + +extern void GLAPIENTRY +_mesa_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value); + +extern void GLAPIENTRY +_mesa_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value); + +extern void GLAPIENTRY +_mesa_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value); + +extern void GLAPIENTRY +_mesa_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value); + +extern void GLAPIENTRY +_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, + const GLfloat *value); + + +extern void GLAPIENTRY +_mesa_GetActiveUniformARB(GLhandleARB, GLuint, GLsizei, GLsizei *, + GLint *, GLenum *, GLcharARB *); + +extern void GLAPIENTRY +_mesa_GetUniformfvARB(GLhandleARB, GLint, GLfloat *); + +extern void GLAPIENTRY +_mesa_GetUniformivARB(GLhandleARB, GLint, GLint *); + +extern GLint GLAPIENTRY +_mesa_GetUniformLocationARB(GLhandleARB, const GLcharARB *); + +GLint +_mesa_get_uniform_location(GLcontext *ctx, struct gl_shader_program *shProg, + const GLchar *name); + +void +_mesa_uniform(GLcontext *ctx, struct gl_shader_program *shader_program, + GLint location, GLsizei count, + const GLvoid *values, GLenum type); + +void +_mesa_uniform_matrix(GLcontext *ctx, struct gl_shader_program *shProg, + GLint cols, GLint rows, + GLint location, GLsizei count, + GLboolean transpose, const GLfloat *values); + +extern void +_mesa_update_shader_textures_used(struct gl_program *prog); + + +extern void +_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec); + +#endif /* UNIFORMS_H */ diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index b4128f84d..d19de7ff6 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -31,6 +31,7 @@ #include "enable.h" #include "enums.h" #include "hash.h" +#include "macros.h" #include "mtypes.h" #include "varray.h" #include "arrayobj.h" @@ -710,6 +711,266 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, #endif +/** + * New in GL3: + * Set an integer-valued vertex attribute array. + * Note that these arrays DO NOT alias the conventional GL vertex arrays + * (position, normal, color, fog, texcoord, etc). + */ +void GLAPIENTRY +_mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type, + GLboolean normalized, + GLsizei stride, const GLvoid *ptr) +{ + /* NOTE: until we have integer-valued vertex attributes, just + * route this through the regular glVertexAttribPointer() function. + */ + _mesa_VertexAttribPointerARB(index, size, type, normalized, stride, ptr); +} + + + +void GLAPIENTRY +_mesa_EnableVertexAttribArrayARB(GLuint index) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index >= ctx->Const.VertexProgram.MaxAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glEnableVertexAttribArrayARB(index)"); + return; + } + + ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); + + FLUSH_VERTICES(ctx, _NEW_ARRAY); + ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_TRUE; + ctx->Array.ArrayObj->_Enabled |= _NEW_ARRAY_ATTRIB(index); + ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); +} + + +void GLAPIENTRY +_mesa_DisableVertexAttribArrayARB(GLuint index) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index >= ctx->Const.VertexProgram.MaxAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glEnableVertexAttribArrayARB(index)"); + return; + } + + ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); + + FLUSH_VERTICES(ctx, _NEW_ARRAY); + ctx->Array.ArrayObj->VertexAttrib[index].Enabled = GL_FALSE; + ctx->Array.ArrayObj->_Enabled &= ~_NEW_ARRAY_ATTRIB(index); + ctx->Array.NewState |= _NEW_ARRAY_ATTRIB(index); +} + + +/** + * Return info for a vertex attribute array (no alias with legacy + * vertex attributes (pos, normal, color, etc)). This function does + * not handle the 4-element GL_CURRENT_VERTEX_ATTRIB_ARB query. + */ +static GLuint +get_vertex_array_attrib(GLcontext *ctx, GLuint index, GLenum pname, + const char *caller) +{ + const struct gl_client_array *array; + + if (index >= MAX_VERTEX_GENERIC_ATTRIBS) { + _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)", caller, index); + return 0; + } + + ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); + + array = &ctx->Array.ArrayObj->VertexAttrib[index]; + + switch (pname) { + case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: + return array->Enabled; + case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: + return array->Size; + case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: + return array->Stride; + case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: + return array->Type; + case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB: + return array->Normalized; + case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: + return array->BufferObj->Name; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=0x%x)", caller, pname); + return 0; + } +} + + +void GLAPIENTRY +_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { + if (index == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetVertexAttribfv(index==0)"); + } + else { + const GLfloat *v = ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]; + FLUSH_CURRENT(ctx, 0); + COPY_4V(params, v); + } + } + else { + params[0] = (GLfloat) get_vertex_array_attrib(ctx, index, pname, + "glGetVertexAttribfv"); + } +} + + +void GLAPIENTRY +_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { + if (index == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetVertexAttribdv(index==0)"); + } + else { + const GLfloat *v = ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]; + FLUSH_CURRENT(ctx, 0); + params[0] = (GLdouble) v[0]; + params[1] = (GLdouble) v[1]; + params[2] = (GLdouble) v[2]; + params[3] = (GLdouble) v[3]; + } + } + else { + params[0] = (GLdouble) get_vertex_array_attrib(ctx, index, pname, + "glGetVertexAttribdv"); + } +} + + +void GLAPIENTRY +_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { + if (index == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetVertexAttribiv(index==0)"); + } + else { + const GLfloat *v = ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]; + FLUSH_CURRENT(ctx, 0); + /* XXX should floats in[0,1] be scaled to full int range? */ + params[0] = (GLint) v[0]; + params[1] = (GLint) v[1]; + params[2] = (GLint) v[2]; + params[3] = (GLint) v[3]; + } + } + else { + params[0] = (GLint) get_vertex_array_attrib(ctx, index, pname, + "glGetVertexAttribiv"); + } +} + + +/** GL 3.0 */ +void GLAPIENTRY +_mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { + if (index == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetVertexAttribIiv(index==0)"); + } + else { + const GLfloat *v = ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]; + FLUSH_CURRENT(ctx, 0); + /* XXX we don't have true integer-valued vertex attribs yet */ + params[0] = (GLint) v[0]; + params[1] = (GLint) v[1]; + params[2] = (GLint) v[2]; + params[3] = (GLint) v[3]; + } + } + else { + params[0] = (GLint) get_vertex_array_attrib(ctx, index, pname, + "glGetVertexAttribIiv"); + } +} + + +/** GL 3.0 */ +void GLAPIENTRY +_mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { + if (index == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetVertexAttribIuiv(index==0)"); + } + else { + const GLfloat *v = ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index]; + FLUSH_CURRENT(ctx, 0); + /* XXX we don't have true integer-valued vertex attribs yet */ + params[0] = (GLuint) v[0]; + params[1] = (GLuint) v[1]; + params[2] = (GLuint) v[2]; + params[3] = (GLuint) v[3]; + } + } + else { + params[0] = get_vertex_array_attrib(ctx, index, pname, + "glGetVertexAttribIuiv"); + } +} + + +void GLAPIENTRY +_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (index >= ctx->Const.VertexProgram.MaxAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetVertexAttribPointerARB(index)"); + return; + } + + if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetVertexAttribPointerARB(pname)"); + return; + } + + ASSERT(index < Elements(ctx->Array.ArrayObj->VertexAttrib)); + + *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr; +} + + void GLAPIENTRY _mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *ptr) @@ -995,8 +1256,8 @@ _mesa_UnlockArraysEXT( void ) /* GL_EXT_multi_draw_arrays */ /* Somebody forgot to spec the first and count parameters as const! <sigh> */ void GLAPIENTRY -_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, - GLsizei *count, GLsizei primcount ) +_mesa_MultiDrawArraysEXT( GLenum mode, const GLint *first, + const GLsizei *count, GLsizei primcount ) { GET_CURRENT_CONTEXT(ctx); GLint i; @@ -1054,6 +1315,27 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, /** + * GL 3.1 glPrimitiveRestartIndex(). + */ +void GLAPIENTRY +_mesa_PrimitiveRestartIndex(GLuint index) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndex()"); + return; + } + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + + ctx->Array.RestartIndex = index; +} + + +/** * Copy one client vertex array to another. */ void @@ -1086,10 +1368,10 @@ print_array(const char *name, GLint index, const struct gl_client_array *array) printf(" %s[%d]: ", name, index); else printf(" %s: ", name); - printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %u), MaxElem=%u\n", + printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %lu), MaxElem=%u\n", array->Ptr, array->Type, array->Size, array->_ElementSize, array->StrideB, - array->BufferObj->Name, array->BufferObj->Size, + array->BufferObj->Name, (unsigned long) array->BufferObj->Size, array->_MaxElement); } diff --git a/mesalib/src/mesa/main/varray.h b/mesalib/src/mesa/main/varray.h index ef790c504..c7c3e3ec7 100644 --- a/mesalib/src/mesa/main/varray.h +++ b/mesalib/src/mesa/main/varray.h @@ -116,14 +116,51 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +void GLAPIENTRY +_mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type, + GLboolean normalized, + GLsizei stride, const GLvoid *ptr); + + +extern void GLAPIENTRY +_mesa_EnableVertexAttribArrayARB(GLuint index); + + +extern void GLAPIENTRY +_mesa_DisableVertexAttribArrayARB(GLuint index); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params); + + +extern void GLAPIENTRY +_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer); + extern void GLAPIENTRY _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer); extern void GLAPIENTRY -_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, - GLsizei *count, GLsizei primcount ); +_mesa_MultiDrawArraysEXT( GLenum mode, const GLint *first, + const GLsizei *count, GLsizei primcount ); extern void GLAPIENTRY _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, @@ -174,6 +211,9 @@ _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, const GLvoid *indices, GLint basevertex); +extern void GLAPIENTRY +_mesa_PrimitiveRestartIndex(GLuint index); + extern void _mesa_copy_client_array(GLcontext *ctx, diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index a39b68065..5997ca00f 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -32,8 +32,11 @@ * Return major and minor version numbers. */ static void -compute_version(const GLcontext *ctx, GLuint *major, GLuint *minor) +compute_version(GLcontext *ctx) { + GLuint major, minor; + static const int max = 100; + const GLboolean ver_1_3 = (ctx->Extensions.ARB_multisample && ctx->Extensions.ARB_multitexture && ctx->Extensions.ARB_texture_border_clamp && @@ -81,50 +84,201 @@ compute_version(const GLcontext *ctx, GLuint *major, GLuint *minor) (ctx->Extensions.EXT_stencil_two_side || ctx->Extensions.ATI_separate_stencil)); const GLboolean ver_2_1 = (ver_2_0 && - ctx->Extensions.ARB_shading_language_120 && + ctx->Const.GLSLVersion >= 120 && ctx->Extensions.EXT_pixel_buffer_object && ctx->Extensions.EXT_texture_sRGB); - if (ver_2_1) { - *major = 2; - *minor = 1; + const GLboolean ver_3_0 = (ver_2_1 && + ctx->Extensions.ARB_half_float_pixel && + ctx->Extensions.ARB_map_buffer_range && + ctx->Extensions.ARB_texture_float && + ctx->Extensions.ARB_texture_rg && + ctx->Extensions.APPLE_vertex_array_object && + ctx->Extensions.EXT_draw_buffers2 && + ctx->Extensions.EXT_framebuffer_blit && + ctx->Extensions.EXT_framebuffer_multisample && + ctx->Extensions.EXT_framebuffer_object && + ctx->Extensions.EXT_framebuffer_sRGB && + ctx->Extensions.EXT_packed_depth_stencil && + ctx->Extensions.EXT_packed_float && + ctx->Extensions.EXT_texture_array && + ctx->Extensions.EXT_texture_compression_rgtc && + ctx->Extensions.EXT_texture_integer && + ctx->Extensions.EXT_texture_shared_exponent && + ctx->Extensions.EXT_transform_feedback && + ctx->Extensions.NV_conditional_render); + const GLboolean ver_3_1 = (ver_3_0 && + ctx->Extensions.ARB_copy_buffer && + ctx->Extensions.ARB_draw_instanced && + ctx->Extensions.ARB_texture_buffer_object && + ctx->Extensions.ARB_uniform_buffer_object && + ctx->Extensions.NV_primitive_restart && + ctx->Extensions.NV_texture_rectangle && + ctx->Const.MaxVertexTextureImageUnits >= 16); + const GLboolean ver_3_2 = (ver_3_1 && + ctx->Extensions.ARB_depth_clamp && + ctx->Extensions.ARB_draw_elements_base_vertex && + ctx->Extensions.ARB_fragment_coord_conventions && + ctx->Extensions.ARB_geometry_shader4 && + ctx->Extensions.EXT_provoking_vertex && + ctx->Extensions.ARB_seamless_cube_map && + ctx->Extensions.ARB_sync && + ctx->Extensions.ARB_texture_multisample && + ctx->Extensions.EXT_vertex_array_bgra); + const GLboolean ver_3_3 = (ver_3_2 && + ctx->Extensions.ARB_blend_func_extended && + ctx->Extensions.ARB_explicit_attrib_location && + ctx->Extensions.ARB_instanced_arrays && + ctx->Extensions.ARB_occlusion_query2 && + ctx->Extensions.ARB_sampler_objects && + ctx->Extensions.ARB_texture_rgb10_a2ui && + ctx->Extensions.ARB_timer_query && + ctx->Extensions.ARB_vertex_type_2_10_10_10_rev && + ctx->Extensions.EXT_texture_swizzle); + + if (ver_3_3) { + major = 3; + minor = 3; + } + else if (ver_3_2) { + major = 3; + minor = 2; + } + else if (ver_3_1) { + major = 3; + minor = 1; + } + else if (ver_3_0) { + major = 3; + minor = 0; + } + else if (ver_2_1) { + major = 2; + minor = 1; } else if (ver_2_0) { - *major = 2; - *minor = 0; + major = 2; + minor = 0; } else if (ver_1_5) { - *major = 1; - *minor = 5; + major = 1; + minor = 5; } else if (ver_1_4) { - *major = 1; - *minor = 4; + major = 1; + minor = 4; } else if (ver_1_3) { - *major = 1; - *minor = 3; + major = 1; + minor = 3; } else { - *major = 1; - *minor = 2; + major = 1; + minor = 2; + } + + ctx->VersionMajor = major; + ctx->VersionMinor = minor; + ctx->VersionString = (char *) malloc(max); + if (ctx->VersionString) { + _mesa_snprintf(ctx->VersionString, max, + "%u.%u Mesa " MESA_VERSION_STRING, + ctx->VersionMajor, ctx->VersionMinor); } } +static void +compute_version_es1(GLcontext *ctx) +{ + static const int max = 100; + + /* OpenGL ES 1.0 is derived from OpenGL 1.3 */ + const GLboolean ver_1_0 = (ctx->Extensions.ARB_multisample && + ctx->Extensions.ARB_multitexture && + ctx->Extensions.ARB_texture_compression && + ctx->Extensions.EXT_texture_env_add && + ctx->Extensions.ARB_texture_env_combine && + ctx->Extensions.ARB_texture_env_dot3); + /* OpenGL ES 1.1 is derived from OpenGL 1.5 */ + const GLboolean ver_1_1 = (ver_1_0 && + ctx->Extensions.EXT_point_parameters && + ctx->Extensions.SGIS_generate_mipmap && + ctx->Extensions.ARB_vertex_buffer_object); + + if (ver_1_1) { + ctx->VersionMajor = 1; + ctx->VersionMinor = 1; + } else if (ver_1_0) { + ctx->VersionMajor = 1; + ctx->VersionMinor = 0; + } else { + _mesa_problem(ctx, "Incomplete OpenGL ES 1.0 support."); + } + + ctx->VersionString = (char *) malloc(max); + if (ctx->VersionString) { + _mesa_snprintf(ctx->VersionString, max, + "OpenGL ES-CM 1.%d Mesa " MESA_VERSION_STRING, + ctx->VersionMinor); + } +} + +static void +compute_version_es2(GLcontext *ctx) +{ + static const int max = 100; + + /* OpenGL ES 2.0 is derived from OpenGL 2.0 */ + const GLboolean ver_2_0 = (ctx->Extensions.ARB_multisample && + ctx->Extensions.ARB_multitexture && + ctx->Extensions.ARB_texture_compression && + ctx->Extensions.ARB_texture_cube_map && + ctx->Extensions.ARB_texture_mirrored_repeat && + ctx->Extensions.EXT_blend_color && + ctx->Extensions.EXT_blend_func_separate && + ctx->Extensions.EXT_blend_minmax && + ctx->Extensions.EXT_blend_subtract && + ctx->Extensions.EXT_stencil_wrap && + ctx->Extensions.ARB_vertex_buffer_object && + ctx->Extensions.ARB_shader_objects && + ctx->Extensions.ARB_vertex_shader && + ctx->Extensions.ARB_fragment_shader && + ctx->Extensions.ARB_texture_non_power_of_two && + ctx->Extensions.EXT_blend_equation_separate); + if (ver_2_0) { + ctx->VersionMajor = 2; + ctx->VersionMinor = 0; + } else { + _mesa_problem(ctx, "Incomplete OpenGL ES 2.0 support."); + } + + ctx->VersionString = (char *) malloc(max); + if (ctx->VersionString) { + _mesa_snprintf(ctx->VersionString, max, + "OpenGL ES 2.0 Mesa " MESA_VERSION_STRING); + } +} /** * Set the context's VersionMajor, VersionMinor, VersionString fields. - * This should only be called once as part of context initialization. + * This should only be called once as part of context initialization + * or to perform version check for GLX_ARB_create_context_profile. */ void _mesa_compute_version(GLcontext *ctx) { - static const int max = 100; + if (ctx->VersionMajor) + return; - compute_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor); - - ctx->VersionString = (char *) malloc(max); - if (ctx->VersionString) { - _mesa_snprintf(ctx->VersionString, max, "%u.%u Mesa " MESA_VERSION_STRING, - ctx->VersionMajor, ctx->VersionMinor); + switch (ctx->API) { + case API_OPENGL: + compute_version(ctx); + break; + case API_OPENGLES: + compute_version_es1(ctx); + break; + case API_OPENGLES2: + compute_version_es2(ctx); + break; } + } diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h index 9955be24a..1289ca985 100644 --- a/mesalib/src/mesa/main/version.h +++ b/mesalib/src/mesa/main/version.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.8 + * Version: 7.9 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. @@ -33,9 +33,9 @@ /* Mesa version */ #define MESA_MAJOR 7 -#define MESA_MINOR 8 -#define MESA_PATCH 2 -#define MESA_VERSION_STRING "7.8.2" +#define MESA_MINOR 9 +#define MESA_PATCH 0 +#define MESA_VERSION_STRING "7.9" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) diff --git a/mesalib/src/mesa/main/viewport.h b/mesalib/src/mesa/main/viewport.h index f08fef279..ec054a7c5 100644 --- a/mesalib/src/mesa/main/viewport.h +++ b/mesalib/src/mesa/main/viewport.h @@ -27,6 +27,8 @@ #ifndef VIEWPORT_H #define VIEWPORT_H +#include "glheader.h" +#include "mtypes.h" extern void GLAPIENTRY _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c index 0dd3e5e52..ca352e88e 100644 --- a/mesalib/src/mesa/main/vtxfmt.c +++ b/mesalib/src/mesa/main/vtxfmt.c @@ -140,6 +140,8 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex); SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex); SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex); + SET_DrawArraysInstanced(tab, vfmt->DrawArraysInstanced); + SET_DrawElementsInstanced(tab, vfmt->DrawElementsInstanced); /* GL_NV_vertex_program */ SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV); diff --git a/mesalib/src/mesa/main/vtxfmt.h b/mesalib/src/mesa/main/vtxfmt.h index fb6c23abe..aad38b87c 100644 --- a/mesalib/src/mesa/main/vtxfmt.h +++ b/mesalib/src/mesa/main/vtxfmt.h @@ -33,6 +33,9 @@ #ifndef _VTXFMT_H_ #define _VTXFMT_H_ +#include "compiler.h" +#include "mtypes.h" + #if FEATURE_beginend extern void _mesa_init_exec_vtxfmt( GLcontext *ctx ); diff --git a/mesalib/src/mesa/main/vtxfmt_tmp.h b/mesalib/src/mesa/main/vtxfmt_tmp.h index 037c4b188..9ec6ea49a 100644 --- a/mesalib/src/mesa/main/vtxfmt_tmp.h +++ b/mesalib/src/mesa/main/vtxfmt_tmp.h @@ -391,6 +391,25 @@ static void GLAPIENTRY TAG(MultiDrawElementsBaseVertex)( GLenum mode, primcount, basevertex )); } +static void GLAPIENTRY +TAG(DrawArraysInstanced)(GLenum mode, GLint first, + GLsizei count, GLsizei primcount) +{ + PRE_LOOPBACK( DrawArraysInstanced ); + CALL_DrawArraysInstanced(GET_DISPATCH(), (mode, first, count, primcount)); +} + +static void GLAPIENTRY +TAG(DrawElementsInstanced)(GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices, + GLsizei primcount) +{ + PRE_LOOPBACK( DrawElementsInstanced ); + CALL_DrawElementsInstanced(GET_DISPATCH(), + (mode, count, type, indices, primcount)); +} + + static void GLAPIENTRY TAG(EvalMesh1)( GLenum mode, GLint i1, GLint i2 ) { PRE_LOOPBACK( EvalMesh1 ); @@ -574,6 +593,8 @@ static GLvertexformat TAG(vtxfmt) = { TAG(DrawElementsBaseVertex), TAG(DrawRangeElementsBaseVertex), TAG(MultiDrawElementsBaseVertex), + TAG(DrawArraysInstanced), + TAG(DrawElementsInstanced), TAG(EvalMesh1), TAG(EvalMesh2) }; diff --git a/mesalib/src/mesa/math/m_matrix.c b/mesalib/src/mesa/math/m_matrix.c index 4b33d0bbb..048b231c4 100644 --- a/mesalib/src/mesa/math/m_matrix.c +++ b/mesalib/src/mesa/math/m_matrix.c @@ -804,8 +804,8 @@ _math_matrix_rotate( GLmatrix *mat, GLfloat m[16]; GLboolean optimized; - s = (GLfloat) _mesa_sin( angle * DEG2RAD ); - c = (GLfloat) _mesa_cos( angle * DEG2RAD ); + s = (GLfloat) sin( angle * DEG2RAD ); + c = (GLfloat) cos( angle * DEG2RAD ); memcpy(m, Identity, sizeof(GLfloat)*16); optimized = GL_FALSE; diff --git a/mesalib/src/mesa/math/m_matrix.h b/mesalib/src/mesa/math/m_matrix.h index 3bc5de6cd..a69afb858 100644 --- a/mesalib/src/mesa/math/m_matrix.h +++ b/mesalib/src/mesa/math/m_matrix.h @@ -32,6 +32,8 @@ #define _M_MATRIX_H +#include "main/glheader.h" + /** * \name Symbolic names to some of the entries in the matrix diff --git a/mesalib/src/mesa/math/m_translate.c b/mesalib/src/mesa/math/m_translate.c index b12b07957..51daf7bfd 100644 --- a/mesalib/src/mesa/math/m_translate.c +++ b/mesalib/src/mesa/math/m_translate.c @@ -29,8 +29,8 @@ #include "main/glheader.h" +#include "main/macros.h" #include "main/mtypes.h" /* GLchan hack */ -#include "main/colormac.h" #include "m_translate.h" diff --git a/mesalib/src/mesa/math/m_translate.h b/mesalib/src/mesa/math/m_translate.h index c677682d5..580410311 100644 --- a/mesalib/src/mesa/math/m_translate.h +++ b/mesalib/src/mesa/math/m_translate.h @@ -26,7 +26,8 @@ #ifndef _M_TRANSLATE_H_ #define _M_TRANSLATE_H_ -#include "main/config.h" +#include "main/compiler.h" +#include "main/glheader.h" #include "main/mtypes.h" /* hack for GLchan */ diff --git a/mesalib/src/mesa/math/m_xform.h b/mesalib/src/mesa/math/m_xform.h index 33421ad1c..14ac956a7 100644 --- a/mesalib/src/mesa/math/m_xform.h +++ b/mesalib/src/mesa/math/m_xform.h @@ -27,10 +27,10 @@ #define _M_XFORM_H +#include "main/compiler.h" #include "main/glheader.h" -#include "main/config.h" -#include "math/m_vector.h" #include "math/m_matrix.h" +#include "math/m_vector.h" #ifdef USE_X86_ASM #define _XFORMAPI _ASMAPI diff --git a/mesalib/src/mesa/shader/Makefile b/mesalib/src/mesa/program/Makefile index 400a543bd..400a543bd 100644 --- a/mesalib/src/mesa/shader/Makefile +++ b/mesalib/src/mesa/program/Makefile diff --git a/mesalib/src/mesa/shader/arbprogparse.c b/mesalib/src/mesa/program/arbprogparse.c index 6373529e4..f834aaf56 100644 --- a/mesalib/src/mesa/shader/arbprogparse.c +++ b/mesalib/src/mesa/program/arbprogparse.c @@ -109,6 +109,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, program->Base.NumNativeTexIndirections = prog.NumTexIndirections; program->Base.InputsRead = prog.InputsRead; program->Base.OutputsWritten = prog.OutputsWritten; + program->Base.IndirectRegisterFiles = prog.IndirectRegisterFiles; for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) { program->Base.TexturesUsed[i] = prog.TexturesUsed[i]; if (prog.TexturesUsed[i]) @@ -199,6 +200,7 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, program->Base.NumNativeAddressRegs = prog.NumNativeAddressRegs; program->Base.InputsRead = prog.InputsRead; program->Base.OutputsWritten = prog.OutputsWritten; + program->Base.IndirectRegisterFiles = prog.IndirectRegisterFiles; program->IsPositionInvariant = (state.option.PositionInvariant) ? GL_TRUE : GL_FALSE; diff --git a/mesalib/src/mesa/shader/arbprogparse.h b/mesalib/src/mesa/program/arbprogparse.h index 980d39fb9..980d39fb9 100644 --- a/mesalib/src/mesa/shader/arbprogparse.h +++ b/mesalib/src/mesa/program/arbprogparse.h diff --git a/mesalib/src/mesa/shader/descrip.mms b/mesalib/src/mesa/program/descrip.mms index 59730020d..59730020d 100644 --- a/mesalib/src/mesa/shader/descrip.mms +++ b/mesalib/src/mesa/program/descrip.mms diff --git a/mesalib/src/mesa/shader/hash_table.c b/mesalib/src/mesa/program/hash_table.c index fa6ba2bfd..f7ef366c1 100644 --- a/mesalib/src/mesa/shader/hash_table.c +++ b/mesalib/src/mesa/program/hash_table.c @@ -142,6 +142,23 @@ hash_table_insert(struct hash_table *ht, void *data, const void *key) insert_at_head(& ht->buckets[bucket], & node->link); } +void +hash_table_remove(struct hash_table *ht, const void *key) +{ + const unsigned hash_value = (*ht->hash)(key); + const unsigned bucket = hash_value % ht->num_buckets; + struct node *node; + + foreach(node, & ht->buckets[bucket]) { + struct hash_node *hn = (struct hash_node *) node; + + if ((*ht->compare)(hn->key, key) == 0) { + remove_from_list(node); + free(node); + return; + } + } +} unsigned hash_table_string_hash(const void *key) @@ -157,3 +174,17 @@ hash_table_string_hash(const void *key) return hash; } + + +unsigned +hash_table_pointer_hash(const void *key) +{ + return (unsigned)((uintptr_t) key / sizeof(void *)); +} + + +int +hash_table_pointer_compare(const void *key1, const void *key2) +{ + return key1 == key2 ? 0 : 1; +} diff --git a/mesalib/src/mesa/shader/hash_table.h b/mesalib/src/mesa/program/hash_table.h index 7b302f5db..f1c4fdcd1 100644 --- a/mesalib/src/mesa/shader/hash_table.h +++ b/mesalib/src/mesa/program/hash_table.h @@ -31,13 +31,15 @@ #ifndef HASH_TABLE_H #define HASH_TABLE_H -#include <string.h> - struct hash_table; typedef unsigned (*hash_func_t)(const void *key); typedef int (*hash_compare_func_t)(const void *key1, const void *key2); +#ifdef __cplusplus +extern "C" { +#endif + /** * Hash table constructor * @@ -90,6 +92,10 @@ extern void *hash_table_find(struct hash_table *ht, const void *key); extern void hash_table_insert(struct hash_table *ht, void *data, const void *key); +/** + * Remove a specific element from a hash table. + */ +extern void hash_table_remove(struct hash_table *ht, const void *key); /** * Compute hash value of a string @@ -114,4 +120,31 @@ extern unsigned hash_table_string_hash(const void *key); */ #define hash_table_string_compare ((hash_compare_func_t) strcmp) + +/** + * Compute hash value of a pointer + * + * \param key Pointer to be used as a hash key + * + * \note + * The memory pointed to by \c key is \b never accessed. The value of \c key + * itself is used as the hash key + * + * \sa hash_table_pointer_compare + */ +unsigned +hash_table_pointer_hash(const void *key); + + +/** + * Compare two pointers used as keys + * + * \sa hash_table_pointer_hash + */ +int +hash_table_pointer_compare(const void *key1, const void *key2); + +#ifdef __cplusplus +} +#endif #endif /* HASH_TABLE_H */ diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp new file mode 100644 index 000000000..93b6c305f --- /dev/null +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -0,0 +1,2965 @@ +/* + * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. + * Copyright (C) 2008 VMware, Inc. All Rights Reserved. + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file ir_to_mesa.cpp + * + * Translates the IR to ARB_fragment_program text if possible, + * printing the result + */ + +#include <stdio.h> +#include "main/compiler.h" +#include "ir.h" +#include "ir_visitor.h" +#include "ir_print_visitor.h" +#include "ir_expression_flattening.h" +#include "glsl_types.h" +#include "glsl_parser_extras.h" +#include "../glsl/program.h" +#include "ir_optimization.h" +#include "ast.h" + +extern "C" { +#include "main/mtypes.h" +#include "main/shaderapi.h" +#include "main/shaderobj.h" +#include "main/uniforms.h" +#include "program/hash_table.h" +#include "program/prog_instruction.h" +#include "program/prog_optimize.h" +#include "program/prog_print.h" +#include "program/program.h" +#include "program/prog_uniform.h" +#include "program/prog_parameter.h" +} + +static int swizzle_for_size(int size); + +/** + * This struct is a corresponding struct to Mesa prog_src_register, with + * wider fields. + */ +typedef struct ir_to_mesa_src_reg { + ir_to_mesa_src_reg(int file, int index, const glsl_type *type) + { + this->file = file; + this->index = index; + if (type && (type->is_scalar() || type->is_vector() || type->is_matrix())) + this->swizzle = swizzle_for_size(type->vector_elements); + else + this->swizzle = SWIZZLE_XYZW; + this->negate = 0; + this->reladdr = NULL; + } + + ir_to_mesa_src_reg() + { + this->file = PROGRAM_UNDEFINED; + this->index = 0; + this->swizzle = 0; + this->negate = 0; + this->reladdr = NULL; + } + + int file; /**< PROGRAM_* from Mesa */ + int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ + int negate; /**< NEGATE_XYZW mask from mesa */ + /** Register index should be offset by the integer in this reg. */ + ir_to_mesa_src_reg *reladdr; +} ir_to_mesa_src_reg; + +typedef struct ir_to_mesa_dst_reg { + int file; /**< PROGRAM_* from Mesa */ + int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ + GLuint cond_mask:4; + /** Register index should be offset by the integer in this reg. */ + ir_to_mesa_src_reg *reladdr; +} ir_to_mesa_dst_reg; + +extern ir_to_mesa_src_reg ir_to_mesa_undef; + +class ir_to_mesa_instruction : public exec_node { +public: + /* Callers of this talloc-based new need not call delete. It's + * easier to just talloc_free 'ctx' (or any of its ancestors). */ + static void* operator new(size_t size, void *ctx) + { + void *node; + + node = talloc_zero_size(ctx, size); + assert(node != NULL); + + return node; + } + + enum prog_opcode op; + ir_to_mesa_dst_reg dst_reg; + ir_to_mesa_src_reg src_reg[3]; + /** Pointer to the ir source this tree came from for debugging */ + ir_instruction *ir; + GLboolean cond_update; + int sampler; /**< sampler index */ + int tex_target; /**< One of TEXTURE_*_INDEX */ + GLboolean tex_shadow; + + class function_entry *function; /* Set on OPCODE_CAL or OPCODE_BGNSUB */ +}; + +class variable_storage : public exec_node { +public: + variable_storage(ir_variable *var, int file, int index) + : file(file), index(index), var(var) + { + /* empty */ + } + + int file; + int index; + ir_variable *var; /* variable that maps to this, if any */ +}; + +class function_entry : public exec_node { +public: + ir_function_signature *sig; + + /** + * identifier of this function signature used by the program. + * + * At the point that Mesa instructions for function calls are + * generated, we don't know the address of the first instruction of + * the function body. So we make the BranchTarget that is called a + * small integer and rewrite them during set_branchtargets(). + */ + int sig_id; + + /** + * Pointer to first instruction of the function body. + * + * Set during function body emits after main() is processed. + */ + ir_to_mesa_instruction *bgn_inst; + + /** + * Index of the first instruction of the function body in actual + * Mesa IR. + * + * Set after convertion from ir_to_mesa_instruction to prog_instruction. + */ + int inst; + + /** Storage for the return value. */ + ir_to_mesa_src_reg return_reg; +}; + +class ir_to_mesa_visitor : public ir_visitor { +public: + ir_to_mesa_visitor(); + ~ir_to_mesa_visitor(); + + function_entry *current_function; + + GLcontext *ctx; + struct gl_program *prog; + struct gl_shader_program *shader_program; + struct gl_shader_compiler_options *options; + + int next_temp; + + variable_storage *find_variable_storage(ir_variable *var); + + function_entry *get_function_signature(ir_function_signature *sig); + + ir_to_mesa_src_reg get_temp(const glsl_type *type); + void reladdr_to_temp(ir_instruction *ir, + ir_to_mesa_src_reg *reg, int *num_reladdr); + + struct ir_to_mesa_src_reg src_reg_for_float(float val); + + /** + * \name Visit methods + * + * As typical for the visitor pattern, there must be one \c visit method for + * each concrete subclass of \c ir_instruction. Virtual base classes within + * the hierarchy should not have \c visit methods. + */ + /*@{*/ + virtual void visit(ir_variable *); + virtual void visit(ir_loop *); + virtual void visit(ir_loop_jump *); + virtual void visit(ir_function_signature *); + virtual void visit(ir_function *); + virtual void visit(ir_expression *); + virtual void visit(ir_swizzle *); + virtual void visit(ir_dereference_variable *); + virtual void visit(ir_dereference_array *); + virtual void visit(ir_dereference_record *); + virtual void visit(ir_assignment *); + virtual void visit(ir_constant *); + virtual void visit(ir_call *); + virtual void visit(ir_return *); + virtual void visit(ir_discard *); + virtual void visit(ir_texture *); + virtual void visit(ir_if *); + /*@}*/ + + struct ir_to_mesa_src_reg result; + + /** List of variable_storage */ + exec_list variables; + + /** List of function_entry */ + exec_list function_signatures; + int next_signature_id; + + /** List of ir_to_mesa_instruction */ + exec_list instructions; + + ir_to_mesa_instruction *ir_to_mesa_emit_op0(ir_instruction *ir, + enum prog_opcode op); + + ir_to_mesa_instruction *ir_to_mesa_emit_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0); + + ir_to_mesa_instruction *ir_to_mesa_emit_op2(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1); + + ir_to_mesa_instruction *ir_to_mesa_emit_op3(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1, + ir_to_mesa_src_reg src2); + + void ir_to_mesa_emit_scalar_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0); + + void ir_to_mesa_emit_scalar_op2(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1); + + GLboolean try_emit_mad(ir_expression *ir, + int mul_operand); + + int get_sampler_uniform_value(ir_dereference *deref); + + void *mem_ctx; +}; + +ir_to_mesa_src_reg ir_to_mesa_undef = ir_to_mesa_src_reg(PROGRAM_UNDEFINED, 0, NULL); + +ir_to_mesa_dst_reg ir_to_mesa_undef_dst = { + PROGRAM_UNDEFINED, 0, SWIZZLE_NOOP, COND_TR, NULL, +}; + +ir_to_mesa_dst_reg ir_to_mesa_address_reg = { + PROGRAM_ADDRESS, 0, WRITEMASK_X, COND_TR, NULL +}; + +static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 3); + +static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) + { + va_list args; + va_start(args, fmt); + prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, args); + va_end(args); + + prog->LinkStatus = GL_FALSE; + } + +static int swizzle_for_size(int size) +{ + int size_swizzles[4] = { + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z), + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W), + }; + + return size_swizzles[size - 1]; +} + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op3(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1, + ir_to_mesa_src_reg src2) +{ + ir_to_mesa_instruction *inst = new(mem_ctx) ir_to_mesa_instruction(); + int num_reladdr = 0; + + /* If we have to do relative addressing, we want to load the ARL + * reg directly for one of the regs, and preload the other reladdr + * sources into temps. + */ + num_reladdr += dst.reladdr != NULL; + num_reladdr += src0.reladdr != NULL; + num_reladdr += src1.reladdr != NULL; + num_reladdr += src2.reladdr != NULL; + + reladdr_to_temp(ir, &src2, &num_reladdr); + reladdr_to_temp(ir, &src1, &num_reladdr); + reladdr_to_temp(ir, &src0, &num_reladdr); + + if (dst.reladdr) { + ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, + *dst.reladdr); + + num_reladdr--; + } + assert(num_reladdr == 0); + + inst->op = op; + inst->dst_reg = dst; + inst->src_reg[0] = src0; + inst->src_reg[1] = src1; + inst->src_reg[2] = src2; + inst->ir = ir; + + inst->function = NULL; + + this->instructions.push_tail(inst); + + return inst; +} + + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op2(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1) +{ + return ir_to_mesa_emit_op3(ir, op, dst, src0, src1, ir_to_mesa_undef); +} + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0) +{ + assert(dst.writemask != 0); + return ir_to_mesa_emit_op3(ir, op, dst, + src0, ir_to_mesa_undef, ir_to_mesa_undef); +} + +ir_to_mesa_instruction * +ir_to_mesa_visitor::ir_to_mesa_emit_op0(ir_instruction *ir, + enum prog_opcode op) +{ + return ir_to_mesa_emit_op3(ir, op, ir_to_mesa_undef_dst, + ir_to_mesa_undef, + ir_to_mesa_undef, + ir_to_mesa_undef); +} + +inline ir_to_mesa_dst_reg +ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg reg) +{ + ir_to_mesa_dst_reg dst_reg; + + dst_reg.file = reg.file; + dst_reg.index = reg.index; + dst_reg.writemask = WRITEMASK_XYZW; + dst_reg.cond_mask = COND_TR; + dst_reg.reladdr = reg.reladdr; + + return dst_reg; +} + +inline ir_to_mesa_src_reg +ir_to_mesa_src_reg_from_dst(ir_to_mesa_dst_reg reg) +{ + return ir_to_mesa_src_reg(reg.file, reg.index, NULL); +} + +/** + * Emits Mesa scalar opcodes to produce unique answers across channels. + * + * Some Mesa opcodes are scalar-only, like ARB_fp/vp. The src X + * channel determines the result across all channels. So to do a vec4 + * of this operation, we want to emit a scalar per source channel used + * to produce dest channels. + */ +void +ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op2(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg orig_src0, + ir_to_mesa_src_reg orig_src1) +{ + int i, j; + int done_mask = ~dst.writemask; + + /* Mesa RCP is a scalar operation splatting results to all channels, + * like ARB_fp/vp. So emit as many RCPs as necessary to cover our + * dst channels. + */ + for (i = 0; i < 4; i++) { + GLuint this_mask = (1 << i); + ir_to_mesa_instruction *inst; + ir_to_mesa_src_reg src0 = orig_src0; + ir_to_mesa_src_reg src1 = orig_src1; + + if (done_mask & this_mask) + continue; + + GLuint src0_swiz = GET_SWZ(src0.swizzle, i); + GLuint src1_swiz = GET_SWZ(src1.swizzle, i); + for (j = i + 1; j < 4; j++) { + if (!(done_mask & (1 << j)) && + GET_SWZ(src0.swizzle, j) == src0_swiz && + GET_SWZ(src1.swizzle, j) == src1_swiz) { + this_mask |= (1 << j); + } + } + src0.swizzle = MAKE_SWIZZLE4(src0_swiz, src0_swiz, + src0_swiz, src0_swiz); + src1.swizzle = MAKE_SWIZZLE4(src1_swiz, src1_swiz, + src1_swiz, src1_swiz); + + inst = ir_to_mesa_emit_op2(ir, op, + dst, + src0, + src1); + inst->dst_reg.writemask = this_mask; + done_mask |= this_mask; + } +} + +void +ir_to_mesa_visitor::ir_to_mesa_emit_scalar_op1(ir_instruction *ir, + enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0) +{ + ir_to_mesa_src_reg undef = ir_to_mesa_undef; + + undef.swizzle = SWIZZLE_XXXX; + + ir_to_mesa_emit_scalar_op2(ir, op, dst, src0, undef); +} + +struct ir_to_mesa_src_reg +ir_to_mesa_visitor::src_reg_for_float(float val) +{ + ir_to_mesa_src_reg src_reg(PROGRAM_CONSTANT, -1, NULL); + + src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, + &val, 1, &src_reg.swizzle); + + return src_reg; +} + +static int +type_size(const struct glsl_type *type) +{ + unsigned int i; + int size; + + switch (type->base_type) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + case GLSL_TYPE_FLOAT: + case GLSL_TYPE_BOOL: + if (type->is_matrix()) { + return type->matrix_columns; + } else { + /* Regardless of size of vector, it gets a vec4. This is bad + * packing for things like floats, but otherwise arrays become a + * mess. Hopefully a later pass over the code can pack scalars + * down if appropriate. + */ + return 1; + } + case GLSL_TYPE_ARRAY: + return type_size(type->fields.array) * type->length; + case GLSL_TYPE_STRUCT: + size = 0; + for (i = 0; i < type->length; i++) { + size += type_size(type->fields.structure[i].type); + } + return size; + case GLSL_TYPE_SAMPLER: + /* Samplers take up one slot in UNIFORMS[], but they're baked in + * at link time. + */ + return 1; + default: + assert(0); + return 0; + } +} + +/** + * In the initial pass of codegen, we assign temporary numbers to + * intermediate results. (not SSA -- variable assignments will reuse + * storage). Actual register allocation for the Mesa VM occurs in a + * pass over the Mesa IR later. + */ +ir_to_mesa_src_reg +ir_to_mesa_visitor::get_temp(const glsl_type *type) +{ + ir_to_mesa_src_reg src_reg; + int swizzle[4]; + int i; + + src_reg.file = PROGRAM_TEMPORARY; + src_reg.index = next_temp; + src_reg.reladdr = NULL; + next_temp += type_size(type); + + if (type->is_array() || type->is_record()) { + src_reg.swizzle = SWIZZLE_NOOP; + } else { + for (i = 0; i < type->vector_elements; i++) + swizzle[i] = i; + for (; i < 4; i++) + swizzle[i] = type->vector_elements - 1; + src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], + swizzle[2], swizzle[3]); + } + src_reg.negate = 0; + + return src_reg; +} + +variable_storage * +ir_to_mesa_visitor::find_variable_storage(ir_variable *var) +{ + + variable_storage *entry; + + foreach_iter(exec_list_iterator, iter, this->variables) { + entry = (variable_storage *)iter.get(); + + if (entry->var == var) + return entry; + } + + return NULL; +} + +struct statevar_element { + const char *field; + int tokens[STATE_LENGTH]; + int swizzle; +}; + +static struct statevar_element gl_DepthRange_elements[] = { + {"near", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX}, + {"far", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY}, + {"diff", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ}, +}; + +static struct statevar_element gl_ClipPlane_elements[] = { + {NULL, {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW} +}; + +static struct statevar_element gl_Point_elements[] = { + {"size", {STATE_POINT_SIZE}, SWIZZLE_XXXX}, + {"sizeMin", {STATE_POINT_SIZE}, SWIZZLE_YYYY}, + {"sizeMax", {STATE_POINT_SIZE}, SWIZZLE_ZZZZ}, + {"fadeThresholdSize", {STATE_POINT_SIZE}, SWIZZLE_WWWW}, + {"distanceConstantAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX}, + {"distanceLinearAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY}, + {"distanceQuadraticAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ}, +}; + +static struct statevar_element gl_FrontMaterial_elements[] = { + {"emission", {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW}, + {"ambient", {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"shininess", {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX}, +}; + +static struct statevar_element gl_BackMaterial_elements[] = { + {"emission", {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW}, + {"ambient", {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"shininess", {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX}, +}; + +static struct statevar_element gl_LightSource_elements[] = { + {"ambient", {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_LIGHT, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, + {"position", {STATE_LIGHT, 0, STATE_POSITION}, SWIZZLE_XYZW}, + {"halfVector", {STATE_LIGHT, 0, STATE_HALF_VECTOR}, SWIZZLE_XYZW}, + {"spotDirection", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_XYZW}, + {"spotCosCutoff", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_WWWW}, + {"spotCutoff", {STATE_LIGHT, 0, STATE_SPOT_CUTOFF}, SWIZZLE_XXXX}, + {"spotExponent", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_WWWW}, + {"constantAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_XXXX}, + {"linearAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_YYYY}, + {"quadraticAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ}, +}; + +static struct statevar_element gl_LightModel_elements[] = { + {"ambient", {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_FrontLightModelProduct_elements[] = { + {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_BackLightModelProduct_elements[] = { + {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_FrontLightProduct_elements[] = { + {"ambient", {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_LIGHTPROD, 0, 0, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_LIGHTPROD, 0, 0, STATE_SPECULAR}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_BackLightProduct_elements[] = { + {"ambient", {STATE_LIGHTPROD, 0, 1, STATE_AMBIENT}, SWIZZLE_XYZW}, + {"diffuse", {STATE_LIGHTPROD, 0, 1, STATE_DIFFUSE}, SWIZZLE_XYZW}, + {"specular", {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_TextureEnvColor_elements[] = { + {NULL, {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_EyePlaneS_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_EyePlaneT_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_EyePlaneR_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_EyePlaneQ_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_ObjectPlaneS_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_ObjectPlaneT_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_ObjectPlaneR_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_ObjectPlaneQ_elements[] = { + {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW}, +}; + +static struct statevar_element gl_Fog_elements[] = { + {"color", {STATE_FOG_COLOR}, SWIZZLE_XYZW}, + {"density", {STATE_FOG_PARAMS}, SWIZZLE_XXXX}, + {"start", {STATE_FOG_PARAMS}, SWIZZLE_YYYY}, + {"end", {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ}, + {"scale", {STATE_FOG_PARAMS}, SWIZZLE_WWWW}, +}; + +static struct statevar_element gl_NormalScale_elements[] = { + {NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX}, +}; + +#define MATRIX(name, statevar, modifier) \ + static struct statevar_element name ## _elements[] = { \ + { NULL, { statevar, 0, 0, 0, modifier}, SWIZZLE_XYZW }, \ + { NULL, { statevar, 0, 1, 1, modifier}, SWIZZLE_XYZW }, \ + { NULL, { statevar, 0, 2, 2, modifier}, SWIZZLE_XYZW }, \ + { NULL, { statevar, 0, 3, 3, modifier}, SWIZZLE_XYZW }, \ + } + +MATRIX(gl_ModelViewMatrix, + STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_ModelViewMatrixInverse, + STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_ModelViewMatrixTranspose, + STATE_MODELVIEW_MATRIX, 0); +MATRIX(gl_ModelViewMatrixInverseTranspose, + STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE); + +MATRIX(gl_ProjectionMatrix, + STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_ProjectionMatrixInverse, + STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_ProjectionMatrixTranspose, + STATE_PROJECTION_MATRIX, 0); +MATRIX(gl_ProjectionMatrixInverseTranspose, + STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE); + +MATRIX(gl_ModelViewProjectionMatrix, + STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_ModelViewProjectionMatrixInverse, + STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_ModelViewProjectionMatrixTranspose, + STATE_MVP_MATRIX, 0); +MATRIX(gl_ModelViewProjectionMatrixInverseTranspose, + STATE_MVP_MATRIX, STATE_MATRIX_INVERSE); + +MATRIX(gl_TextureMatrix, + STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE); +MATRIX(gl_TextureMatrixInverse, + STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS); +MATRIX(gl_TextureMatrixTranspose, + STATE_TEXTURE_MATRIX, 0); +MATRIX(gl_TextureMatrixInverseTranspose, + STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE); + +static struct statevar_element gl_NormalMatrix_elements[] = { + { NULL, { STATE_MODELVIEW_MATRIX, 0, 0, 0, STATE_MATRIX_INVERSE}, + SWIZZLE_XYZW }, + { NULL, { STATE_MODELVIEW_MATRIX, 0, 1, 1, STATE_MATRIX_INVERSE}, + SWIZZLE_XYZW }, + { NULL, { STATE_MODELVIEW_MATRIX, 0, 2, 2, STATE_MATRIX_INVERSE}, + SWIZZLE_XYZW }, +}; + +#undef MATRIX + +#define STATEVAR(name) {#name, name ## _elements, Elements(name ## _elements)} + +static const struct statevar { + const char *name; + struct statevar_element *elements; + unsigned int num_elements; +} statevars[] = { + STATEVAR(gl_DepthRange), + STATEVAR(gl_ClipPlane), + STATEVAR(gl_Point), + STATEVAR(gl_FrontMaterial), + STATEVAR(gl_BackMaterial), + STATEVAR(gl_LightSource), + STATEVAR(gl_LightModel), + STATEVAR(gl_FrontLightModelProduct), + STATEVAR(gl_BackLightModelProduct), + STATEVAR(gl_FrontLightProduct), + STATEVAR(gl_BackLightProduct), + STATEVAR(gl_TextureEnvColor), + STATEVAR(gl_EyePlaneS), + STATEVAR(gl_EyePlaneT), + STATEVAR(gl_EyePlaneR), + STATEVAR(gl_EyePlaneQ), + STATEVAR(gl_ObjectPlaneS), + STATEVAR(gl_ObjectPlaneT), + STATEVAR(gl_ObjectPlaneR), + STATEVAR(gl_ObjectPlaneQ), + STATEVAR(gl_Fog), + + STATEVAR(gl_ModelViewMatrix), + STATEVAR(gl_ModelViewMatrixInverse), + STATEVAR(gl_ModelViewMatrixTranspose), + STATEVAR(gl_ModelViewMatrixInverseTranspose), + + STATEVAR(gl_ProjectionMatrix), + STATEVAR(gl_ProjectionMatrixInverse), + STATEVAR(gl_ProjectionMatrixTranspose), + STATEVAR(gl_ProjectionMatrixInverseTranspose), + + STATEVAR(gl_ModelViewProjectionMatrix), + STATEVAR(gl_ModelViewProjectionMatrixInverse), + STATEVAR(gl_ModelViewProjectionMatrixTranspose), + STATEVAR(gl_ModelViewProjectionMatrixInverseTranspose), + + STATEVAR(gl_TextureMatrix), + STATEVAR(gl_TextureMatrixInverse), + STATEVAR(gl_TextureMatrixTranspose), + STATEVAR(gl_TextureMatrixInverseTranspose), + + STATEVAR(gl_NormalMatrix), + STATEVAR(gl_NormalScale), +}; + +void +ir_to_mesa_visitor::visit(ir_variable *ir) +{ + if (strcmp(ir->name, "gl_FragCoord") == 0) { + struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog; + + fp->OriginUpperLeft = ir->origin_upper_left; + fp->PixelCenterInteger = ir->pixel_center_integer; + } + + if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) { + unsigned int i; + + for (i = 0; i < Elements(statevars); i++) { + if (strcmp(ir->name, statevars[i].name) == 0) + break; + } + + if (i == Elements(statevars)) { + fail_link(this->shader_program, + "Failed to find builtin uniform `%s'\n", ir->name); + return; + } + + const struct statevar *statevar = &statevars[i]; + + int array_count; + if (ir->type->is_array()) { + array_count = ir->type->length; + } else { + array_count = 1; + } + + /* Check if this statevar's setup in the STATE file exactly + * matches how we'll want to reference it as a + * struct/array/whatever. If not, then we need to move it into + * temporary storage and hope that it'll get copy-propagated + * out. + */ + for (i = 0; i < statevar->num_elements; i++) { + if (statevar->elements[i].swizzle != SWIZZLE_XYZW) { + break; + } + } + + struct variable_storage *storage; + ir_to_mesa_dst_reg dst; + if (i == statevar->num_elements) { + /* We'll set the index later. */ + storage = new(mem_ctx) variable_storage(ir, PROGRAM_STATE_VAR, -1); + this->variables.push_tail(storage); + + dst = ir_to_mesa_undef_dst; + } else { + storage = new(mem_ctx) variable_storage(ir, PROGRAM_TEMPORARY, + this->next_temp); + this->variables.push_tail(storage); + this->next_temp += type_size(ir->type); + + dst = ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg(PROGRAM_TEMPORARY, + storage->index, + NULL)); + } + + + for (int a = 0; a < array_count; a++) { + for (unsigned int i = 0; i < statevar->num_elements; i++) { + struct statevar_element *element = &statevar->elements[i]; + int tokens[STATE_LENGTH]; + + memcpy(tokens, element->tokens, sizeof(element->tokens)); + if (ir->type->is_array()) { + tokens[1] = a; + } + + int index = _mesa_add_state_reference(this->prog->Parameters, + (gl_state_index *)tokens); + + if (storage->file == PROGRAM_STATE_VAR) { + if (storage->index == -1) { + storage->index = index; + } else { + assert(index == + (int)(storage->index + a * statevar->num_elements + i)); + } + } else { + ir_to_mesa_src_reg src(PROGRAM_STATE_VAR, index, NULL); + src.swizzle = element->swizzle; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, dst, src); + /* even a float takes up a whole vec4 reg in a struct/array. */ + dst.index++; + } + } + } + if (storage->file == PROGRAM_TEMPORARY && + dst.index != storage->index + type_size(ir->type)) { + fail_link(this->shader_program, + "failed to load builtin uniform `%s' (%d/%d regs loaded)\n", + ir->name, dst.index - storage->index, + type_size(ir->type)); + } + } +} + +void +ir_to_mesa_visitor::visit(ir_loop *ir) +{ + ir_dereference_variable *counter = NULL; + + if (ir->counter != NULL) + counter = new(ir) ir_dereference_variable(ir->counter); + + if (ir->from != NULL) { + assert(ir->counter != NULL); + + ir_assignment *a = new(ir) ir_assignment(counter, ir->from, NULL); + + a->accept(this); + delete a; + } + + ir_to_mesa_emit_op0(NULL, OPCODE_BGNLOOP); + + if (ir->to) { + ir_expression *e = + new(ir) ir_expression(ir->cmp, glsl_type::bool_type, + counter, ir->to); + ir_if *if_stmt = new(ir) ir_if(e); + + ir_loop_jump *brk = new(ir) ir_loop_jump(ir_loop_jump::jump_break); + + if_stmt->then_instructions.push_tail(brk); + + if_stmt->accept(this); + + delete if_stmt; + delete e; + delete brk; + } + + visit_exec_list(&ir->body_instructions, this); + + if (ir->increment) { + ir_expression *e = + new(ir) ir_expression(ir_binop_add, counter->type, + counter, ir->increment); + + ir_assignment *a = new(ir) ir_assignment(counter, e, NULL); + + a->accept(this); + delete a; + delete e; + } + + ir_to_mesa_emit_op0(NULL, OPCODE_ENDLOOP); +} + +void +ir_to_mesa_visitor::visit(ir_loop_jump *ir) +{ + switch (ir->mode) { + case ir_loop_jump::jump_break: + ir_to_mesa_emit_op0(NULL, OPCODE_BRK); + break; + case ir_loop_jump::jump_continue: + ir_to_mesa_emit_op0(NULL, OPCODE_CONT); + break; + } +} + + +void +ir_to_mesa_visitor::visit(ir_function_signature *ir) +{ + assert(0); + (void)ir; +} + +void +ir_to_mesa_visitor::visit(ir_function *ir) +{ + /* Ignore function bodies other than main() -- we shouldn't see calls to + * them since they should all be inlined before we get to ir_to_mesa. + */ + if (strcmp(ir->name, "main") == 0) { + const ir_function_signature *sig; + exec_list empty; + + sig = ir->matching_signature(&empty); + + assert(sig); + + foreach_iter(exec_list_iterator, iter, sig->body) { + ir_instruction *ir = (ir_instruction *)iter.get(); + + ir->accept(this); + } + } +} + +GLboolean +ir_to_mesa_visitor::try_emit_mad(ir_expression *ir, int mul_operand) +{ + int nonmul_operand = 1 - mul_operand; + ir_to_mesa_src_reg a, b, c; + + ir_expression *expr = ir->operands[mul_operand]->as_expression(); + if (!expr || expr->operation != ir_binop_mul) + return false; + + expr->operands[0]->accept(this); + a = this->result; + expr->operands[1]->accept(this); + b = this->result; + ir->operands[nonmul_operand]->accept(this); + c = this->result; + + this->result = get_temp(ir->type); + ir_to_mesa_emit_op3(ir, OPCODE_MAD, + ir_to_mesa_dst_reg_from_src(this->result), a, b, c); + + return true; +} + +void +ir_to_mesa_visitor::reladdr_to_temp(ir_instruction *ir, + ir_to_mesa_src_reg *reg, int *num_reladdr) +{ + if (!reg->reladdr) + return; + + ir_to_mesa_emit_op1(ir, OPCODE_ARL, ir_to_mesa_address_reg, *reg->reladdr); + + if (*num_reladdr != 1) { + ir_to_mesa_src_reg temp = get_temp(glsl_type::vec4_type); + + ir_to_mesa_emit_op1(ir, OPCODE_MOV, + ir_to_mesa_dst_reg_from_src(temp), *reg); + *reg = temp; + } + + (*num_reladdr)--; +} + +void +ir_to_mesa_visitor::visit(ir_expression *ir) +{ + unsigned int operand; + struct ir_to_mesa_src_reg op[2]; + struct ir_to_mesa_src_reg result_src; + struct ir_to_mesa_dst_reg result_dst; + const glsl_type *vec4_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 4, 1); + const glsl_type *vec3_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 3, 1); + const glsl_type *vec2_type = glsl_type::get_instance(GLSL_TYPE_FLOAT, 2, 1); + + /* Quick peephole: Emit OPCODE_MAD(a, b, c) instead of ADD(MUL(a, b), c) + */ + if (ir->operation == ir_binop_add) { + if (try_emit_mad(ir, 1)) + return; + if (try_emit_mad(ir, 0)) + return; + } + + for (operand = 0; operand < ir->get_num_operands(); operand++) { + this->result.file = PROGRAM_UNDEFINED; + ir->operands[operand]->accept(this); + if (this->result.file == PROGRAM_UNDEFINED) { + ir_print_visitor v; + printf("Failed to get tree for expression operand:\n"); + ir->operands[operand]->accept(&v); + exit(1); + } + op[operand] = this->result; + + /* Matrix expression operands should have been broken down to vector + * operations already. + */ + assert(!ir->operands[operand]->type->is_matrix()); + } + + int vector_elements = ir->operands[0]->type->vector_elements; + if (ir->operands[1]) { + vector_elements = MAX2(vector_elements, + ir->operands[1]->type->vector_elements); + } + + this->result.file = PROGRAM_UNDEFINED; + + /* Storage for our result. Ideally for an assignment we'd be using + * the actual storage for the result here, instead. + */ + result_src = get_temp(ir->type); + /* convenience for the emit functions below. */ + result_dst = ir_to_mesa_dst_reg_from_src(result_src); + /* Limit writes to the channels that will be used by result_src later. + * This does limit this temp's use as a temporary for multi-instruction + * sequences. + */ + result_dst.writemask = (1 << ir->type->vector_elements) - 1; + + switch (ir->operation) { + case ir_unop_logic_not: + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, + op[0], src_reg_for_float(0.0)); + break; + case ir_unop_neg: + op[0].negate = ~op[0].negate; + result_src = op[0]; + break; + case ir_unop_abs: + ir_to_mesa_emit_op1(ir, OPCODE_ABS, result_dst, op[0]); + break; + case ir_unop_sign: + ir_to_mesa_emit_op1(ir, OPCODE_SSG, result_dst, op[0]); + break; + case ir_unop_rcp: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, op[0]); + break; + + case ir_unop_exp2: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_EX2, result_dst, op[0]); + break; + case ir_unop_exp: + case ir_unop_log: + assert(!"not reached: should be handled by ir_explog_to_explog2"); + break; + case ir_unop_log2: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_LG2, result_dst, op[0]); + break; + case ir_unop_sin: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_SIN, result_dst, op[0]); + break; + case ir_unop_cos: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_COS, result_dst, op[0]); + break; + + case ir_unop_dFdx: + ir_to_mesa_emit_op1(ir, OPCODE_DDX, result_dst, op[0]); + break; + case ir_unop_dFdy: + ir_to_mesa_emit_op1(ir, OPCODE_DDY, result_dst, op[0]); + break; + + case ir_unop_noise: { + const enum prog_opcode opcode = + prog_opcode(OPCODE_NOISE1 + + (ir->operands[0]->type->vector_elements) - 1); + assert((opcode >= OPCODE_NOISE1) && (opcode <= OPCODE_NOISE4)); + + ir_to_mesa_emit_op1(ir, opcode, result_dst, op[0]); + break; + } + + case ir_binop_add: + ir_to_mesa_emit_op2(ir, OPCODE_ADD, result_dst, op[0], op[1]); + break; + case ir_binop_sub: + ir_to_mesa_emit_op2(ir, OPCODE_SUB, result_dst, op[0], op[1]); + break; + + case ir_binop_mul: + ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, op[0], op[1]); + break; + case ir_binop_div: + assert(!"not reached: should be handled by ir_div_to_mul_rcp"); + case ir_binop_mod: + assert(!"ir_binop_mod should have been converted to b * fract(a/b)"); + break; + + case ir_binop_less: + ir_to_mesa_emit_op2(ir, OPCODE_SLT, result_dst, op[0], op[1]); + break; + case ir_binop_greater: + ir_to_mesa_emit_op2(ir, OPCODE_SGT, result_dst, op[0], op[1]); + break; + case ir_binop_lequal: + ir_to_mesa_emit_op2(ir, OPCODE_SLE, result_dst, op[0], op[1]); + break; + case ir_binop_gequal: + ir_to_mesa_emit_op2(ir, OPCODE_SGE, result_dst, op[0], op[1]); + break; + case ir_binop_equal: + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, op[0], op[1]); + break; + case ir_binop_nequal: + ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); + break; + case ir_binop_all_equal: + /* "==" operator producing a scalar boolean. */ + if (ir->operands[0]->type->is_vector() || + ir->operands[1]->type->is_vector()) { + ir_to_mesa_src_reg temp = get_temp(glsl_type::vec4_type); + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + ir_to_mesa_dst_reg_from_src(temp), op[0], op[1]); + if (vector_elements == 4) + ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, temp, temp); + else if (vector_elements == 3) + ir_to_mesa_emit_op2(ir, OPCODE_DP3, result_dst, temp, temp); + else + ir_to_mesa_emit_op2(ir, OPCODE_DP2, result_dst, temp, temp); + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, + result_dst, result_src, src_reg_for_float(0.0)); + } else { + ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, op[0], op[1]); + } + break; + case ir_binop_any_nequal: + /* "!=" operator producing a scalar boolean. */ + if (ir->operands[0]->type->is_vector() || + ir->operands[1]->type->is_vector()) { + ir_to_mesa_src_reg temp = get_temp(glsl_type::vec4_type); + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + ir_to_mesa_dst_reg_from_src(temp), op[0], op[1]); + if (vector_elements == 4) + ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, temp, temp); + else if (vector_elements == 3) + ir_to_mesa_emit_op2(ir, OPCODE_DP3, result_dst, temp, temp); + else + ir_to_mesa_emit_op2(ir, OPCODE_DP2, result_dst, temp, temp); + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + result_dst, result_src, src_reg_for_float(0.0)); + } else { + ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); + } + break; + + case ir_unop_any: + switch (ir->operands[0]->type->vector_elements) { + case 4: + ir_to_mesa_emit_op2(ir, OPCODE_DP4, result_dst, op[0], op[0]); + break; + case 3: + ir_to_mesa_emit_op2(ir, OPCODE_DP3, result_dst, op[0], op[0]); + break; + case 2: + ir_to_mesa_emit_op2(ir, OPCODE_DP2, result_dst, op[0], op[0]); + break; + default: + assert(!"unreached: ir_unop_any of non-bvec"); + break; + } + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + result_dst, result_src, src_reg_for_float(0.0)); + break; + + case ir_binop_logic_xor: + ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]); + break; + + case ir_binop_logic_or: + /* This could be a saturated add and skip the SNE. */ + ir_to_mesa_emit_op2(ir, OPCODE_ADD, + result_dst, + op[0], op[1]); + + ir_to_mesa_emit_op2(ir, OPCODE_SNE, + result_dst, + result_src, src_reg_for_float(0.0)); + break; + + case ir_binop_logic_and: + /* the bool args are stored as float 0.0 or 1.0, so "mul" gives us "and". */ + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + result_dst, + op[0], op[1]); + break; + + case ir_binop_dot: + if (ir->operands[0]->type == vec4_type) { + assert(ir->operands[1]->type == vec4_type); + ir_to_mesa_emit_op2(ir, OPCODE_DP4, + result_dst, + op[0], op[1]); + } else if (ir->operands[0]->type == vec3_type) { + assert(ir->operands[1]->type == vec3_type); + ir_to_mesa_emit_op2(ir, OPCODE_DP3, + result_dst, + op[0], op[1]); + } else if (ir->operands[0]->type == vec2_type) { + assert(ir->operands[1]->type == vec2_type); + ir_to_mesa_emit_op2(ir, OPCODE_DP2, + result_dst, + op[0], op[1]); + } + break; + + case ir_binop_cross: + ir_to_mesa_emit_op2(ir, OPCODE_XPD, result_dst, op[0], op[1]); + break; + + case ir_unop_sqrt: + /* sqrt(x) = x * rsq(x). */ + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); + ir_to_mesa_emit_op2(ir, OPCODE_MUL, result_dst, result_src, op[0]); + /* For incoming channels <= 0, set the result to 0. */ + op[0].negate = ~op[0].negate; + ir_to_mesa_emit_op3(ir, OPCODE_CMP, result_dst, + op[0], result_src, src_reg_for_float(0.0)); + break; + case ir_unop_rsq: + ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]); + break; + case ir_unop_i2f: + case ir_unop_b2f: + case ir_unop_b2i: + /* Mesa IR lacks types, ints are stored as truncated floats. */ + result_src = op[0]; + break; + case ir_unop_f2i: + ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); + break; + case ir_unop_f2b: + case ir_unop_i2b: + ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, + op[0], src_reg_for_float(0.0)); + break; + case ir_unop_trunc: + ir_to_mesa_emit_op1(ir, OPCODE_TRUNC, result_dst, op[0]); + break; + case ir_unop_ceil: + op[0].negate = ~op[0].negate; + ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]); + result_src.negate = ~result_src.negate; + break; + case ir_unop_floor: + ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]); + break; + case ir_unop_fract: + ir_to_mesa_emit_op1(ir, OPCODE_FRC, result_dst, op[0]); + break; + + case ir_binop_min: + ir_to_mesa_emit_op2(ir, OPCODE_MIN, result_dst, op[0], op[1]); + break; + case ir_binop_max: + ir_to_mesa_emit_op2(ir, OPCODE_MAX, result_dst, op[0], op[1]); + break; + case ir_binop_pow: + ir_to_mesa_emit_scalar_op2(ir, OPCODE_POW, result_dst, op[0], op[1]); + break; + + case ir_unop_bit_not: + case ir_unop_u2f: + case ir_binop_lshift: + case ir_binop_rshift: + case ir_binop_bit_and: + case ir_binop_bit_xor: + case ir_binop_bit_or: + assert(!"GLSL 1.30 features unsupported"); + break; + } + + this->result = result_src; +} + + +void +ir_to_mesa_visitor::visit(ir_swizzle *ir) +{ + ir_to_mesa_src_reg src_reg; + int i; + int swizzle[4]; + + /* Note that this is only swizzles in expressions, not those on the left + * hand side of an assignment, which do write masking. See ir_assignment + * for that. + */ + + ir->val->accept(this); + src_reg = this->result; + assert(src_reg.file != PROGRAM_UNDEFINED); + + for (i = 0; i < 4; i++) { + if (i < ir->type->vector_elements) { + switch (i) { + case 0: + swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.x); + break; + case 1: + swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.y); + break; + case 2: + swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.z); + break; + case 3: + swizzle[i] = GET_SWZ(src_reg.swizzle, ir->mask.w); + break; + } + } else { + /* If the type is smaller than a vec4, replicate the last + * channel out. + */ + swizzle[i] = swizzle[ir->type->vector_elements - 1]; + } + } + + src_reg.swizzle = MAKE_SWIZZLE4(swizzle[0], + swizzle[1], + swizzle[2], + swizzle[3]); + + this->result = src_reg; +} + +void +ir_to_mesa_visitor::visit(ir_dereference_variable *ir) +{ + variable_storage *entry = find_variable_storage(ir->var); + + if (!entry) { + switch (ir->var->mode) { + case ir_var_uniform: + entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_UNIFORM, + ir->var->location); + this->variables.push_tail(entry); + break; + case ir_var_in: + case ir_var_out: + case ir_var_inout: + /* The linker assigns locations for varyings and attributes, + * including deprecated builtins (like gl_Color), user-assign + * generic attributes (glBindVertexLocation), and + * user-defined varyings. + * + * FINISHME: We would hit this path for function arguments. Fix! + */ + assert(ir->var->location != -1); + if (ir->var->mode == ir_var_in || + ir->var->mode == ir_var_inout) { + entry = new(mem_ctx) variable_storage(ir->var, + PROGRAM_INPUT, + ir->var->location); + + if (this->prog->Target == GL_VERTEX_PROGRAM_ARB && + ir->var->location >= VERT_ATTRIB_GENERIC0) { + _mesa_add_attribute(prog->Attributes, + ir->var->name, + _mesa_sizeof_glsl_type(ir->var->type->gl_type), + ir->var->type->gl_type, + ir->var->location - VERT_ATTRIB_GENERIC0); + } + } else { + entry = new(mem_ctx) variable_storage(ir->var, + PROGRAM_OUTPUT, + ir->var->location); + } + + break; + case ir_var_auto: + case ir_var_temporary: + entry = new(mem_ctx) variable_storage(ir->var, PROGRAM_TEMPORARY, + this->next_temp); + this->variables.push_tail(entry); + + next_temp += type_size(ir->var->type); + break; + } + + if (!entry) { + printf("Failed to make storage for %s\n", ir->var->name); + exit(1); + } + } + + this->result = ir_to_mesa_src_reg(entry->file, entry->index, ir->var->type); +} + +void +ir_to_mesa_visitor::visit(ir_dereference_array *ir) +{ + ir_constant *index; + ir_to_mesa_src_reg src_reg; + int element_size = type_size(ir->type); + + index = ir->array_index->constant_expression_value(); + + ir->array->accept(this); + src_reg = this->result; + + if (index) { + src_reg.index += index->value.i[0] * element_size; + } else { + ir_to_mesa_src_reg array_base = this->result; + /* Variable index array dereference. It eats the "vec4" of the + * base of the array and an index that offsets the Mesa register + * index. + */ + ir->array_index->accept(this); + + ir_to_mesa_src_reg index_reg; + + if (element_size == 1) { + index_reg = this->result; + } else { + index_reg = get_temp(glsl_type::float_type); + + ir_to_mesa_emit_op2(ir, OPCODE_MUL, + ir_to_mesa_dst_reg_from_src(index_reg), + this->result, src_reg_for_float(element_size)); + } + + src_reg.reladdr = talloc(mem_ctx, ir_to_mesa_src_reg); + memcpy(src_reg.reladdr, &index_reg, sizeof(index_reg)); + } + + /* If the type is smaller than a vec4, replicate the last channel out. */ + if (ir->type->is_scalar() || ir->type->is_vector()) + src_reg.swizzle = swizzle_for_size(ir->type->vector_elements); + else + src_reg.swizzle = SWIZZLE_NOOP; + + this->result = src_reg; +} + +void +ir_to_mesa_visitor::visit(ir_dereference_record *ir) +{ + unsigned int i; + const glsl_type *struct_type = ir->record->type; + int offset = 0; + + ir->record->accept(this); + + for (i = 0; i < struct_type->length; i++) { + if (strcmp(struct_type->fields.structure[i].name, ir->field) == 0) + break; + offset += type_size(struct_type->fields.structure[i].type); + } + this->result.swizzle = swizzle_for_size(ir->type->vector_elements); + this->result.index += offset; +} + +/** + * We want to be careful in assignment setup to hit the actual storage + * instead of potentially using a temporary like we might with the + * ir_dereference handler. + */ +static struct ir_to_mesa_dst_reg +get_assignment_lhs(ir_dereference *ir, ir_to_mesa_visitor *v) +{ + /* The LHS must be a dereference. If the LHS is a variable indexed array + * access of a vector, it must be separated into a series conditional moves + * before reaching this point (see ir_vec_index_to_cond_assign). + */ + assert(ir->as_dereference()); + ir_dereference_array *deref_array = ir->as_dereference_array(); + if (deref_array) { + assert(!deref_array->array->type->is_vector()); + } + + /* Use the rvalue deref handler for the most part. We'll ignore + * swizzles in it and write swizzles using writemask, though. + */ + ir->accept(v); + return ir_to_mesa_dst_reg_from_src(v->result); +} + +void +ir_to_mesa_visitor::visit(ir_assignment *ir) +{ + struct ir_to_mesa_dst_reg l; + struct ir_to_mesa_src_reg r; + int i; + + ir->rhs->accept(this); + r = this->result; + + l = get_assignment_lhs(ir->lhs, this); + + /* FINISHME: This should really set to the correct maximal writemask for each + * FINISHME: component written (in the loops below). This case can only + * FINISHME: occur for matrices, arrays, and structures. + */ + if (ir->write_mask == 0) { + assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector()); + l.writemask = WRITEMASK_XYZW; + } else if (ir->lhs->type->is_scalar()) { + /* FINISHME: This hack makes writing to gl_FragDepth, which lives in the + * FINISHME: W component of fragment shader output zero, work correctly. + */ + l.writemask = WRITEMASK_XYZW; + } else { + int swizzles[4]; + int first_enabled_chan = 0; + int rhs_chan = 0; + + assert(ir->lhs->type->is_vector()); + l.writemask = ir->write_mask; + + for (int i = 0; i < 4; i++) { + if (l.writemask & (1 << i)) { + first_enabled_chan = GET_SWZ(r.swizzle, i); + break; + } + } + + /* Swizzle a small RHS vector into the channels being written. + * + * glsl ir treats write_mask as dictating how many channels are + * present on the RHS while Mesa IR treats write_mask as just + * showing which channels of the vec4 RHS get written. + */ + for (int i = 0; i < 4; i++) { + if (l.writemask & (1 << i)) + swizzles[i] = GET_SWZ(r.swizzle, rhs_chan++); + else + swizzles[i] = first_enabled_chan; + } + r.swizzle = MAKE_SWIZZLE4(swizzles[0], swizzles[1], + swizzles[2], swizzles[3]); + } + + assert(l.file != PROGRAM_UNDEFINED); + assert(r.file != PROGRAM_UNDEFINED); + + if (ir->condition) { + ir_to_mesa_src_reg condition; + + ir->condition->accept(this); + condition = this->result; + + /* We use the OPCODE_CMP (a < 0 ? b : c) for conditional moves, + * and the condition we produced is 0.0 or 1.0. By flipping the + * sign, we can choose which value OPCODE_CMP produces without + * an extra computing the condition. + */ + condition.negate = ~condition.negate; + for (i = 0; i < type_size(ir->lhs->type); i++) { + ir_to_mesa_emit_op3(ir, OPCODE_CMP, l, + condition, r, ir_to_mesa_src_reg_from_dst(l)); + l.index++; + r.index++; + } + } else { + for (i = 0; i < type_size(ir->lhs->type); i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); + l.index++; + r.index++; + } + } +} + + +void +ir_to_mesa_visitor::visit(ir_constant *ir) +{ + ir_to_mesa_src_reg src_reg; + GLfloat stack_vals[4] = { 0 }; + GLfloat *values = stack_vals; + unsigned int i; + + /* Unfortunately, 4 floats is all we can get into + * _mesa_add_unnamed_constant. So, make a temp to store an + * aggregate constant and move each constant value into it. If we + * get lucky, copy propagation will eliminate the extra moves. + */ + + if (ir->type->base_type == GLSL_TYPE_STRUCT) { + ir_to_mesa_src_reg temp_base = get_temp(ir->type); + ir_to_mesa_dst_reg temp = ir_to_mesa_dst_reg_from_src(temp_base); + + foreach_iter(exec_list_iterator, iter, ir->components) { + ir_constant *field_value = (ir_constant *)iter.get(); + int size = type_size(field_value->type); + + assert(size > 0); + + field_value->accept(this); + src_reg = this->result; + + for (i = 0; i < (unsigned int)size; i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, temp, src_reg); + + src_reg.index++; + temp.index++; + } + } + this->result = temp_base; + return; + } + + if (ir->type->is_array()) { + ir_to_mesa_src_reg temp_base = get_temp(ir->type); + ir_to_mesa_dst_reg temp = ir_to_mesa_dst_reg_from_src(temp_base); + int size = type_size(ir->type->fields.array); + + assert(size > 0); + + for (i = 0; i < ir->type->length; i++) { + ir->array_elements[i]->accept(this); + src_reg = this->result; + for (int j = 0; j < size; j++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, temp, src_reg); + + src_reg.index++; + temp.index++; + } + } + this->result = temp_base; + return; + } + + if (ir->type->is_matrix()) { + ir_to_mesa_src_reg mat = get_temp(ir->type); + ir_to_mesa_dst_reg mat_column = ir_to_mesa_dst_reg_from_src(mat); + + for (i = 0; i < ir->type->matrix_columns; i++) { + assert(ir->type->base_type == GLSL_TYPE_FLOAT); + values = &ir->value.f[i * ir->type->vector_elements]; + + src_reg = ir_to_mesa_src_reg(PROGRAM_CONSTANT, -1, NULL); + src_reg.index = _mesa_add_unnamed_constant(this->prog->Parameters, + values, + ir->type->vector_elements, + &src_reg.swizzle); + ir_to_mesa_emit_op1(ir, OPCODE_MOV, mat_column, src_reg); + + mat_column.index++; + } + + this->result = mat; + return; + } + + src_reg.file = PROGRAM_CONSTANT; + switch (ir->type->base_type) { + case GLSL_TYPE_FLOAT: + values = &ir->value.f[0]; + break; + case GLSL_TYPE_UINT: + for (i = 0; i < ir->type->vector_elements; i++) { + values[i] = ir->value.u[i]; + } + break; + case GLSL_TYPE_INT: + for (i = 0; i < ir->type->vector_elements; i++) { + values[i] = ir->value.i[i]; + } + break; + case GLSL_TYPE_BOOL: + for (i = 0; i < ir->type->vector_elements; i++) { + values[i] = ir->value.b[i]; + } + break; + default: + assert(!"Non-float/uint/int/bool constant"); + } + + this->result = ir_to_mesa_src_reg(PROGRAM_CONSTANT, -1, ir->type); + this->result.index = _mesa_add_unnamed_constant(this->prog->Parameters, + values, + ir->type->vector_elements, + &this->result.swizzle); +} + +function_entry * +ir_to_mesa_visitor::get_function_signature(ir_function_signature *sig) +{ + function_entry *entry; + + foreach_iter(exec_list_iterator, iter, this->function_signatures) { + entry = (function_entry *)iter.get(); + + if (entry->sig == sig) + return entry; + } + + entry = talloc(mem_ctx, function_entry); + entry->sig = sig; + entry->sig_id = this->next_signature_id++; + entry->bgn_inst = NULL; + + /* Allocate storage for all the parameters. */ + foreach_iter(exec_list_iterator, iter, sig->parameters) { + ir_variable *param = (ir_variable *)iter.get(); + variable_storage *storage; + + storage = find_variable_storage(param); + assert(!storage); + + storage = new(mem_ctx) variable_storage(param, PROGRAM_TEMPORARY, + this->next_temp); + this->variables.push_tail(storage); + + this->next_temp += type_size(param->type); + } + + if (!sig->return_type->is_void()) { + entry->return_reg = get_temp(sig->return_type); + } else { + entry->return_reg = ir_to_mesa_undef; + } + + this->function_signatures.push_tail(entry); + return entry; +} + +void +ir_to_mesa_visitor::visit(ir_call *ir) +{ + ir_to_mesa_instruction *call_inst; + ir_function_signature *sig = ir->get_callee(); + function_entry *entry = get_function_signature(sig); + int i; + + /* Process in parameters. */ + exec_list_iterator sig_iter = sig->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param_rval = (ir_rvalue *)iter.get(); + ir_variable *param = (ir_variable *)sig_iter.get(); + + if (param->mode == ir_var_in || + param->mode == ir_var_inout) { + variable_storage *storage = find_variable_storage(param); + assert(storage); + + param_rval->accept(this); + ir_to_mesa_src_reg r = this->result; + + ir_to_mesa_dst_reg l; + l.file = storage->file; + l.index = storage->index; + l.reladdr = NULL; + l.writemask = WRITEMASK_XYZW; + l.cond_mask = COND_TR; + + for (i = 0; i < type_size(param->type); i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); + l.index++; + r.index++; + } + } + + sig_iter.next(); + } + assert(!sig_iter.has_next()); + + /* Emit call instruction */ + call_inst = ir_to_mesa_emit_op1(ir, OPCODE_CAL, + ir_to_mesa_undef_dst, ir_to_mesa_undef); + call_inst->function = entry; + + /* Process out parameters. */ + sig_iter = sig->parameters.iterator(); + foreach_iter(exec_list_iterator, iter, *ir) { + ir_rvalue *param_rval = (ir_rvalue *)iter.get(); + ir_variable *param = (ir_variable *)sig_iter.get(); + + if (param->mode == ir_var_out || + param->mode == ir_var_inout) { + variable_storage *storage = find_variable_storage(param); + assert(storage); + + ir_to_mesa_src_reg r; + r.file = storage->file; + r.index = storage->index; + r.reladdr = NULL; + r.swizzle = SWIZZLE_NOOP; + r.negate = 0; + + param_rval->accept(this); + ir_to_mesa_dst_reg l = ir_to_mesa_dst_reg_from_src(this->result); + + for (i = 0; i < type_size(param->type); i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); + l.index++; + r.index++; + } + } + + sig_iter.next(); + } + assert(!sig_iter.has_next()); + + /* Process return value. */ + this->result = entry->return_reg; +} + +class get_sampler_name : public ir_hierarchical_visitor +{ +public: + get_sampler_name(ir_to_mesa_visitor *mesa, ir_dereference *last) + { + this->mem_ctx = mesa->mem_ctx; + this->mesa = mesa; + this->name = NULL; + this->offset = 0; + this->last = last; + } + + virtual ir_visitor_status visit(ir_dereference_variable *ir) + { + this->name = ir->var->name; + return visit_continue; + } + + virtual ir_visitor_status visit_leave(ir_dereference_record *ir) + { + this->name = talloc_asprintf(mem_ctx, "%s.%s", name, ir->field); + return visit_continue; + } + + virtual ir_visitor_status visit_leave(ir_dereference_array *ir) + { + ir_constant *index = ir->array_index->as_constant(); + int i; + + if (index) { + i = index->value.i[0]; + } else { + /* GLSL 1.10 and 1.20 allowed variable sampler array indices, + * while GLSL 1.30 requires that the array indices be + * constant integer expressions. We don't expect any driver + * to actually work with a really variable array index, so + * all that would work would be an unrolled loop counter that ends + * up being constant above. + */ + mesa->shader_program->InfoLog = + talloc_asprintf_append(mesa->shader_program->InfoLog, + "warning: Variable sampler array index " + "unsupported.\nThis feature of the language " + "was removed in GLSL 1.20 and is unlikely " + "to be supported for 1.10 in Mesa.\n"); + i = 0; + } + if (ir != last) { + this->name = talloc_asprintf(mem_ctx, "%s[%d]", name, i); + } else { + offset = i; + } + return visit_continue; + } + + ir_to_mesa_visitor *mesa; + const char *name; + void *mem_ctx; + int offset; + ir_dereference *last; +}; + +int +ir_to_mesa_visitor::get_sampler_uniform_value(ir_dereference *sampler) +{ + get_sampler_name getname(this, sampler); + + sampler->accept(&getname); + + GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1, + getname.name); + + if (index < 0) { + fail_link(this->shader_program, + "failed to find sampler named %s.\n", getname.name); + return 0; + } + + index += getname.offset; + + return this->prog->Parameters->ParameterValues[index][0]; +} + +void +ir_to_mesa_visitor::visit(ir_texture *ir) +{ + ir_to_mesa_src_reg result_src, coord, lod_info, projector; + ir_to_mesa_dst_reg result_dst, coord_dst; + ir_to_mesa_instruction *inst = NULL; + prog_opcode opcode = OPCODE_NOP; + + ir->coordinate->accept(this); + + /* Put our coords in a temp. We'll need to modify them for shadow, + * projection, or LOD, so the only case we'd use it as is is if + * we're doing plain old texturing. Mesa IR optimization should + * handle cleaning up our mess in that case. + */ + coord = get_temp(glsl_type::vec4_type); + coord_dst = ir_to_mesa_dst_reg_from_src(coord); + ir_to_mesa_emit_op1(ir, OPCODE_MOV, coord_dst, + this->result); + + if (ir->projector) { + ir->projector->accept(this); + projector = this->result; + } + + /* Storage for our result. Ideally for an assignment we'd be using + * the actual storage for the result here, instead. + */ + result_src = get_temp(glsl_type::vec4_type); + result_dst = ir_to_mesa_dst_reg_from_src(result_src); + + switch (ir->op) { + case ir_tex: + opcode = OPCODE_TEX; + break; + case ir_txb: + opcode = OPCODE_TXB; + ir->lod_info.bias->accept(this); + lod_info = this->result; + break; + case ir_txl: + opcode = OPCODE_TXL; + ir->lod_info.lod->accept(this); + lod_info = this->result; + break; + case ir_txd: + case ir_txf: + assert(!"GLSL 1.30 features unsupported"); + break; + } + + if (ir->projector) { + if (opcode == OPCODE_TEX) { + /* Slot the projector in as the last component of the coord. */ + coord_dst.writemask = WRITEMASK_W; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, coord_dst, projector); + coord_dst.writemask = WRITEMASK_XYZW; + opcode = OPCODE_TXP; + } else { + ir_to_mesa_src_reg coord_w = coord; + coord_w.swizzle = SWIZZLE_WWWW; + + /* For the other TEX opcodes there's no projective version + * since the last slot is taken up by lod info. Do the + * projective divide now. + */ + coord_dst.writemask = WRITEMASK_W; + ir_to_mesa_emit_op1(ir, OPCODE_RCP, coord_dst, projector); + + coord_dst.writemask = WRITEMASK_XYZ; + ir_to_mesa_emit_op2(ir, OPCODE_MUL, coord_dst, coord, coord_w); + + coord_dst.writemask = WRITEMASK_XYZW; + coord.swizzle = SWIZZLE_XYZW; + } + } + + if (ir->shadow_comparitor) { + /* Slot the shadow value in as the second to last component of the + * coord. + */ + ir->shadow_comparitor->accept(this); + coord_dst.writemask = WRITEMASK_Z; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, coord_dst, this->result); + coord_dst.writemask = WRITEMASK_XYZW; + } + + if (opcode == OPCODE_TXL || opcode == OPCODE_TXB) { + /* Mesa IR stores lod or lod bias in the last channel of the coords. */ + coord_dst.writemask = WRITEMASK_W; + ir_to_mesa_emit_op1(ir, OPCODE_MOV, coord_dst, lod_info); + coord_dst.writemask = WRITEMASK_XYZW; + } + + inst = ir_to_mesa_emit_op1(ir, opcode, result_dst, coord); + + if (ir->shadow_comparitor) + inst->tex_shadow = GL_TRUE; + + inst->sampler = get_sampler_uniform_value(ir->sampler); + + const glsl_type *sampler_type = ir->sampler->type; + + switch (sampler_type->sampler_dimensionality) { + case GLSL_SAMPLER_DIM_1D: + inst->tex_target = (sampler_type->sampler_array) + ? TEXTURE_1D_ARRAY_INDEX : TEXTURE_1D_INDEX; + break; + case GLSL_SAMPLER_DIM_2D: + inst->tex_target = (sampler_type->sampler_array) + ? TEXTURE_2D_ARRAY_INDEX : TEXTURE_2D_INDEX; + break; + case GLSL_SAMPLER_DIM_3D: + inst->tex_target = TEXTURE_3D_INDEX; + break; + case GLSL_SAMPLER_DIM_CUBE: + inst->tex_target = TEXTURE_CUBE_INDEX; + break; + case GLSL_SAMPLER_DIM_RECT: + inst->tex_target = TEXTURE_RECT_INDEX; + break; + case GLSL_SAMPLER_DIM_BUF: + assert(!"FINISHME: Implement ARB_texture_buffer_object"); + break; + default: + assert(!"Should not get here."); + } + + this->result = result_src; +} + +void +ir_to_mesa_visitor::visit(ir_return *ir) +{ + if (ir->get_value()) { + ir_to_mesa_dst_reg l; + int i; + + assert(current_function); + + ir->get_value()->accept(this); + ir_to_mesa_src_reg r = this->result; + + l = ir_to_mesa_dst_reg_from_src(current_function->return_reg); + + for (i = 0; i < type_size(current_function->sig->return_type); i++) { + ir_to_mesa_emit_op1(ir, OPCODE_MOV, l, r); + l.index++; + r.index++; + } + } + + ir_to_mesa_emit_op0(ir, OPCODE_RET); +} + +void +ir_to_mesa_visitor::visit(ir_discard *ir) +{ + struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog; + + assert(ir->condition == NULL); /* FINISHME */ + + ir_to_mesa_emit_op0(ir, OPCODE_KIL_NV); + fp->UsesKill = GL_TRUE; +} + +void +ir_to_mesa_visitor::visit(ir_if *ir) +{ + ir_to_mesa_instruction *cond_inst, *if_inst, *else_inst = NULL; + ir_to_mesa_instruction *prev_inst; + + prev_inst = (ir_to_mesa_instruction *)this->instructions.get_tail(); + + ir->condition->accept(this); + assert(this->result.file != PROGRAM_UNDEFINED); + + if (this->options->EmitCondCodes) { + cond_inst = (ir_to_mesa_instruction *)this->instructions.get_tail(); + + /* See if we actually generated any instruction for generating + * the condition. If not, then cook up a move to a temp so we + * have something to set cond_update on. + */ + if (cond_inst == prev_inst) { + ir_to_mesa_src_reg temp = get_temp(glsl_type::bool_type); + cond_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_MOV, + ir_to_mesa_dst_reg_from_src(temp), + result); + } + cond_inst->cond_update = GL_TRUE; + + if_inst = ir_to_mesa_emit_op0(ir->condition, OPCODE_IF); + if_inst->dst_reg.cond_mask = COND_NE; + } else { + if_inst = ir_to_mesa_emit_op1(ir->condition, + OPCODE_IF, ir_to_mesa_undef_dst, + this->result); + } + + this->instructions.push_tail(if_inst); + + visit_exec_list(&ir->then_instructions, this); + + if (!ir->else_instructions.is_empty()) { + else_inst = ir_to_mesa_emit_op0(ir->condition, OPCODE_ELSE); + visit_exec_list(&ir->else_instructions, this); + } + + if_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_ENDIF, + ir_to_mesa_undef_dst, ir_to_mesa_undef); +} + +ir_to_mesa_visitor::ir_to_mesa_visitor() +{ + result.file = PROGRAM_UNDEFINED; + next_temp = 1; + next_signature_id = 1; + current_function = NULL; + mem_ctx = talloc_new(NULL); +} + +ir_to_mesa_visitor::~ir_to_mesa_visitor() +{ + talloc_free(mem_ctx); +} + +static struct prog_src_register +mesa_src_reg_from_ir_src_reg(ir_to_mesa_src_reg reg) +{ + struct prog_src_register mesa_reg; + + mesa_reg.File = reg.file; + assert(reg.index < (1 << INST_INDEX_BITS) - 1); + mesa_reg.Index = reg.index; + mesa_reg.Swizzle = reg.swizzle; + mesa_reg.RelAddr = reg.reladdr != NULL; + mesa_reg.Negate = reg.negate; + mesa_reg.Abs = 0; + mesa_reg.HasIndex2 = GL_FALSE; + mesa_reg.RelAddr2 = 0; + mesa_reg.Index2 = 0; + + return mesa_reg; +} + +static void +set_branchtargets(ir_to_mesa_visitor *v, + struct prog_instruction *mesa_instructions, + int num_instructions) +{ + int if_count = 0, loop_count = 0; + int *if_stack, *loop_stack; + int if_stack_pos = 0, loop_stack_pos = 0; + int i, j; + + for (i = 0; i < num_instructions; i++) { + switch (mesa_instructions[i].Opcode) { + case OPCODE_IF: + if_count++; + break; + case OPCODE_BGNLOOP: + loop_count++; + break; + case OPCODE_BRK: + case OPCODE_CONT: + mesa_instructions[i].BranchTarget = -1; + break; + default: + break; + } + } + + if_stack = talloc_zero_array(v->mem_ctx, int, if_count); + loop_stack = talloc_zero_array(v->mem_ctx, int, loop_count); + + for (i = 0; i < num_instructions; i++) { + switch (mesa_instructions[i].Opcode) { + case OPCODE_IF: + if_stack[if_stack_pos] = i; + if_stack_pos++; + break; + case OPCODE_ELSE: + mesa_instructions[if_stack[if_stack_pos - 1]].BranchTarget = i; + if_stack[if_stack_pos - 1] = i; + break; + case OPCODE_ENDIF: + mesa_instructions[if_stack[if_stack_pos - 1]].BranchTarget = i; + if_stack_pos--; + break; + case OPCODE_BGNLOOP: + loop_stack[loop_stack_pos] = i; + loop_stack_pos++; + break; + case OPCODE_ENDLOOP: + loop_stack_pos--; + /* Rewrite any breaks/conts at this nesting level (haven't + * already had a BranchTarget assigned) to point to the end + * of the loop. + */ + for (j = loop_stack[loop_stack_pos]; j < i; j++) { + if (mesa_instructions[j].Opcode == OPCODE_BRK || + mesa_instructions[j].Opcode == OPCODE_CONT) { + if (mesa_instructions[j].BranchTarget == -1) { + mesa_instructions[j].BranchTarget = i; + } + } + } + /* The loop ends point at each other. */ + mesa_instructions[i].BranchTarget = loop_stack[loop_stack_pos]; + mesa_instructions[loop_stack[loop_stack_pos]].BranchTarget = i; + break; + case OPCODE_CAL: + foreach_iter(exec_list_iterator, iter, v->function_signatures) { + function_entry *entry = (function_entry *)iter.get(); + + if (entry->sig_id == mesa_instructions[i].BranchTarget) { + mesa_instructions[i].BranchTarget = entry->inst; + break; + } + } + break; + default: + break; + } + } +} + +static void +print_program(struct prog_instruction *mesa_instructions, + ir_instruction **mesa_instruction_annotation, + int num_instructions) +{ + ir_instruction *last_ir = NULL; + int i; + int indent = 0; + + for (i = 0; i < num_instructions; i++) { + struct prog_instruction *mesa_inst = mesa_instructions + i; + ir_instruction *ir = mesa_instruction_annotation[i]; + + fprintf(stdout, "%3d: ", i); + + if (last_ir != ir && ir) { + int j; + + for (j = 0; j < indent; j++) { + fprintf(stdout, " "); + } + ir->print(); + printf("\n"); + last_ir = ir; + + fprintf(stdout, " "); /* line number spacing. */ + } + + indent = _mesa_fprint_instruction_opt(stdout, mesa_inst, indent, + PROG_PRINT_DEBUG, NULL); + } +} + +static void +count_resources(struct gl_program *prog) +{ + unsigned int i; + + prog->SamplersUsed = 0; + + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = &prog->Instructions[i]; + + if (_mesa_is_tex_instruction(inst->Opcode)) { + prog->SamplerTargets[inst->TexSrcUnit] = + (gl_texture_index)inst->TexSrcTarget; + prog->SamplersUsed |= 1 << inst->TexSrcUnit; + if (inst->TexShadow) { + prog->ShadowSamplers |= 1 << inst->TexSrcUnit; + } + } + } + + _mesa_update_shader_textures_used(prog); +} + +struct uniform_sort { + struct gl_uniform *u; + int pos; +}; + +/* The shader_program->Uniforms list is almost sorted in increasing + * uniform->{Frag,Vert}Pos locations, but not quite when there are + * uniforms shared between targets. We need to add parameters in + * increasing order for the targets. + */ +static int +sort_uniforms(const void *a, const void *b) +{ + struct uniform_sort *u1 = (struct uniform_sort *)a; + struct uniform_sort *u2 = (struct uniform_sort *)b; + + return u1->pos - u2->pos; +} + +/* Add the uniforms to the parameters. The linker chose locations + * in our parameters lists (which weren't created yet), which the + * uniforms code will use to poke values into our parameters list + * when uniforms are updated. + */ +static void +add_uniforms_to_parameters_list(struct gl_shader_program *shader_program, + struct gl_shader *shader, + struct gl_program *prog) +{ + unsigned int i; + unsigned int next_sampler = 0, num_uniforms = 0; + struct uniform_sort *sorted_uniforms; + + sorted_uniforms = talloc_array(NULL, struct uniform_sort, + shader_program->Uniforms->NumUniforms); + + for (i = 0; i < shader_program->Uniforms->NumUniforms; i++) { + struct gl_uniform *uniform = shader_program->Uniforms->Uniforms + i; + int parameter_index = -1; + + switch (shader->Type) { + case GL_VERTEX_SHADER: + parameter_index = uniform->VertPos; + break; + case GL_FRAGMENT_SHADER: + parameter_index = uniform->FragPos; + break; + case GL_GEOMETRY_SHADER: + parameter_index = uniform->GeomPos; + break; + } + + /* Only add uniforms used in our target. */ + if (parameter_index != -1) { + sorted_uniforms[num_uniforms].pos = parameter_index; + sorted_uniforms[num_uniforms].u = uniform; + num_uniforms++; + } + } + + qsort(sorted_uniforms, num_uniforms, sizeof(struct uniform_sort), + sort_uniforms); + + for (i = 0; i < num_uniforms; i++) { + struct gl_uniform *uniform = sorted_uniforms[i].u; + int parameter_index = sorted_uniforms[i].pos; + const glsl_type *type = uniform->Type; + unsigned int size; + + if (type->is_vector() || + type->is_scalar()) { + size = type->vector_elements; + } else { + size = type_size(type) * 4; + } + + gl_register_file file; + if (type->is_sampler() || + (type->is_array() && type->fields.array->is_sampler())) { + file = PROGRAM_SAMPLER; + } else { + file = PROGRAM_UNIFORM; + } + + GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1, + uniform->Name); + + if (index < 0) { + index = _mesa_add_parameter(prog->Parameters, file, + uniform->Name, size, type->gl_type, + NULL, NULL, 0x0); + + /* Sampler uniform values are stored in prog->SamplerUnits, + * and the entry in that array is selected by this index we + * store in ParameterValues[]. + */ + if (file == PROGRAM_SAMPLER) { + for (unsigned int j = 0; j < size / 4; j++) + prog->Parameters->ParameterValues[index + j][0] = next_sampler++; + } + + /* The location chosen in the Parameters list here (returned + * from _mesa_add_uniform) has to match what the linker chose. + */ + if (index != parameter_index) { + fail_link(shader_program, "Allocation of uniform `%s' to target " + "failed (%d vs %d)\n", + uniform->Name, index, parameter_index); + } + } + } + + talloc_free(sorted_uniforms); +} + +static void +set_uniform_initializer(GLcontext *ctx, void *mem_ctx, + struct gl_shader_program *shader_program, + const char *name, const glsl_type *type, + ir_constant *val) +{ + if (type->is_record()) { + ir_constant *field_constant; + + field_constant = (ir_constant *)val->components.get_head(); + + for (unsigned int i = 0; i < type->length; i++) { + const glsl_type *field_type = type->fields.structure[i].type; + const char *field_name = talloc_asprintf(mem_ctx, "%s.%s", name, + type->fields.structure[i].name); + set_uniform_initializer(ctx, mem_ctx, shader_program, field_name, + field_type, field_constant); + field_constant = (ir_constant *)field_constant->next; + } + return; + } + + int loc = _mesa_get_uniform_location(ctx, shader_program, name); + + if (loc == -1) { + fail_link(shader_program, + "Couldn't find uniform for initializer %s\n", name); + return; + } + + for (unsigned int i = 0; i < (type->is_array() ? type->length : 1); i++) { + ir_constant *element; + const glsl_type *element_type; + if (type->is_array()) { + element = val->array_elements[i]; + element_type = type->fields.array; + } else { + element = val; + element_type = type; + } + + void *values; + + if (element_type->base_type == GLSL_TYPE_BOOL) { + int *conv = talloc_array(mem_ctx, int, element_type->components()); + for (unsigned int j = 0; j < element_type->components(); j++) { + conv[j] = element->value.b[j]; + } + values = (void *)conv; + element_type = glsl_type::get_instance(GLSL_TYPE_INT, + element_type->vector_elements, + 1); + } else { + values = &element->value; + } + + if (element_type->is_matrix()) { + _mesa_uniform_matrix(ctx, shader_program, + element_type->matrix_columns, + element_type->vector_elements, + loc, 1, GL_FALSE, (GLfloat *)values); + loc += element_type->matrix_columns; + } else { + _mesa_uniform(ctx, shader_program, loc, element_type->matrix_columns, + values, element_type->gl_type); + loc += type_size(element_type); + } + } +} + +static void +set_uniform_initializers(GLcontext *ctx, + struct gl_shader_program *shader_program) +{ + void *mem_ctx = NULL; + + for (unsigned int i = 0; i < shader_program->_NumLinkedShaders; i++) { + struct gl_shader *shader = shader_program->_LinkedShaders[i]; + foreach_iter(exec_list_iterator, iter, *shader->ir) { + ir_instruction *ir = (ir_instruction *)iter.get(); + ir_variable *var = ir->as_variable(); + + if (!var || var->mode != ir_var_uniform || !var->constant_value) + continue; + + if (!mem_ctx) + mem_ctx = talloc_new(NULL); + + set_uniform_initializer(ctx, mem_ctx, shader_program, var->name, + var->type, var->constant_value); + } + } + + talloc_free(mem_ctx); +} + +struct gl_program * +get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program, + struct gl_shader *shader) +{ + ir_to_mesa_visitor v; + struct prog_instruction *mesa_instructions, *mesa_inst; + ir_instruction **mesa_instruction_annotation; + int i; + struct gl_program *prog; + GLenum target; + const char *target_string; + GLboolean progress; + struct gl_shader_compiler_options *options = + &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)]; + + switch (shader->Type) { + case GL_VERTEX_SHADER: + target = GL_VERTEX_PROGRAM_ARB; + target_string = "vertex"; + break; + case GL_FRAGMENT_SHADER: + target = GL_FRAGMENT_PROGRAM_ARB; + target_string = "fragment"; + break; + default: + assert(!"should not be reached"); + return NULL; + } + + validate_ir_tree(shader->ir); + + prog = ctx->Driver.NewProgram(ctx, target, shader_program->Name); + if (!prog) + return NULL; + prog->Parameters = _mesa_new_parameter_list(); + prog->Varying = _mesa_new_parameter_list(); + prog->Attributes = _mesa_new_parameter_list(); + v.ctx = ctx; + v.prog = prog; + v.shader_program = shader_program; + v.options = options; + + add_uniforms_to_parameters_list(shader_program, shader, prog); + + /* Emit Mesa IR for main(). */ + visit_exec_list(shader->ir, &v); + v.ir_to_mesa_emit_op0(NULL, OPCODE_END); + + /* Now emit bodies for any functions that were used. */ + do { + progress = GL_FALSE; + + foreach_iter(exec_list_iterator, iter, v.function_signatures) { + function_entry *entry = (function_entry *)iter.get(); + + if (!entry->bgn_inst) { + v.current_function = entry; + + entry->bgn_inst = v.ir_to_mesa_emit_op0(NULL, OPCODE_BGNSUB); + entry->bgn_inst->function = entry; + + visit_exec_list(&entry->sig->body, &v); + + ir_to_mesa_instruction *last; + last = (ir_to_mesa_instruction *)v.instructions.get_tail(); + if (last->op != OPCODE_RET) + v.ir_to_mesa_emit_op0(NULL, OPCODE_RET); + + ir_to_mesa_instruction *end; + end = v.ir_to_mesa_emit_op0(NULL, OPCODE_ENDSUB); + end->function = entry; + + progress = GL_TRUE; + } + } + } while (progress); + + prog->NumTemporaries = v.next_temp; + + int num_instructions = 0; + foreach_iter(exec_list_iterator, iter, v.instructions) { + num_instructions++; + } + + mesa_instructions = + (struct prog_instruction *)calloc(num_instructions, + sizeof(*mesa_instructions)); + mesa_instruction_annotation = talloc_array(v.mem_ctx, ir_instruction *, + num_instructions); + + mesa_inst = mesa_instructions; + i = 0; + foreach_iter(exec_list_iterator, iter, v.instructions) { + ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get(); + + mesa_inst->Opcode = inst->op; + mesa_inst->CondUpdate = inst->cond_update; + mesa_inst->DstReg.File = inst->dst_reg.file; + mesa_inst->DstReg.Index = inst->dst_reg.index; + mesa_inst->DstReg.CondMask = inst->dst_reg.cond_mask; + mesa_inst->DstReg.WriteMask = inst->dst_reg.writemask; + mesa_inst->DstReg.RelAddr = inst->dst_reg.reladdr != NULL; + mesa_inst->SrcReg[0] = mesa_src_reg_from_ir_src_reg(inst->src_reg[0]); + mesa_inst->SrcReg[1] = mesa_src_reg_from_ir_src_reg(inst->src_reg[1]); + mesa_inst->SrcReg[2] = mesa_src_reg_from_ir_src_reg(inst->src_reg[2]); + mesa_inst->TexSrcUnit = inst->sampler; + mesa_inst->TexSrcTarget = inst->tex_target; + mesa_inst->TexShadow = inst->tex_shadow; + mesa_instruction_annotation[i] = inst->ir; + + /* Set IndirectRegisterFiles. */ + if (mesa_inst->DstReg.RelAddr) + prog->IndirectRegisterFiles |= 1 << mesa_inst->DstReg.File; + + for (unsigned src = 0; src < 3; src++) + if (mesa_inst->SrcReg[src].RelAddr) + prog->IndirectRegisterFiles |= 1 << mesa_inst->SrcReg[src].File; + + if (options->EmitNoIfs && mesa_inst->Opcode == OPCODE_IF) { + fail_link(shader_program, "Couldn't flatten if statement\n"); + } + + switch (mesa_inst->Opcode) { + case OPCODE_BGNSUB: + inst->function->inst = i; + mesa_inst->Comment = strdup(inst->function->sig->function_name()); + break; + case OPCODE_ENDSUB: + mesa_inst->Comment = strdup(inst->function->sig->function_name()); + break; + case OPCODE_CAL: + mesa_inst->BranchTarget = inst->function->sig_id; /* rewritten later */ + break; + case OPCODE_ARL: + prog->NumAddressRegs = 1; + break; + default: + break; + } + + mesa_inst++; + i++; + } + + set_branchtargets(&v, mesa_instructions, num_instructions); + + if (ctx->Shader.Flags & GLSL_DUMP) { + printf("\n"); + printf("GLSL IR for linked %s program %d:\n", target_string, + shader_program->Name); + _mesa_print_ir(shader->ir, NULL); + printf("\n"); + printf("\n"); + printf("Mesa IR for linked %s program %d:\n", target_string, + shader_program->Name); + print_program(mesa_instructions, mesa_instruction_annotation, + num_instructions); + } + + prog->Instructions = mesa_instructions; + prog->NumInstructions = num_instructions; + + do_set_program_inouts(shader->ir, prog); + count_resources(prog); + + _mesa_reference_program(ctx, &shader->Program, prog); + + if ((ctx->Shader.Flags & GLSL_NO_OPT) == 0) { + _mesa_optimize_program(ctx, prog); + } + + return prog; +} + +extern "C" { +GLboolean +_mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader) +{ + assert(shader->CompileStatus); + (void) ctx; + + return GL_TRUE; +} + +GLboolean +_mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) +{ + assert(prog->LinkStatus); + + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + bool progress; + exec_list *ir = prog->_LinkedShaders[i]->ir; + struct gl_shader_compiler_options *options = + &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(prog->_LinkedShaders[i]->Type)]; + + do { + progress = false; + + /* Lowering */ + do_mat_op_to_vec(ir); + do_mod_to_fract(ir); + do_div_to_mul_rcp(ir); + do_explog_to_explog2(ir); + + progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress; + + progress = do_common_optimization(ir, true, options->MaxUnrollIterations) || progress; + + if (options->EmitNoIfs) + progress = do_if_to_cond_assign(ir) || progress; + + if (options->EmitNoNoise) + progress = lower_noise(ir) || progress; + + /* If there are forms of indirect addressing that the driver + * cannot handle, perform the lowering pass. + */ + if (options->EmitNoIndirectInput || options->EmitNoIndirectOutput + || options->EmitNoIndirectTemp || options->EmitNoIndirectUniform) + progress = + lower_variable_index_to_cond_assign(ir, + options->EmitNoIndirectInput, + options->EmitNoIndirectOutput, + options->EmitNoIndirectTemp, + options->EmitNoIndirectUniform) + || progress; + + progress = do_vec_index_to_cond_assign(ir) || progress; + } while (progress); + + validate_ir_tree(ir); + } + + for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) { + struct gl_program *linked_prog; + bool ok = true; + + linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); + + switch (prog->_LinkedShaders[i]->Type) { + case GL_VERTEX_SHADER: + _mesa_reference_vertprog(ctx, &prog->VertexProgram, + (struct gl_vertex_program *)linked_prog); + ok = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, + linked_prog); + break; + case GL_FRAGMENT_SHADER: + _mesa_reference_fragprog(ctx, &prog->FragmentProgram, + (struct gl_fragment_program *)linked_prog); + ok = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, + linked_prog); + break; + } + if (!ok) { + return GL_FALSE; + } + _mesa_reference_program(ctx, &linked_prog, NULL); + } + + return GL_TRUE; +} + +void +_mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader) +{ + struct _mesa_glsl_parse_state *state = + new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader); + + const char *source = shader->Source; + /* Check if the user called glCompileShader without first calling + * glShaderSource. This should fail to compile, but not raise a GL_ERROR. + */ + if (source == NULL) { + shader->CompileStatus = GL_FALSE; + return; + } + + state->error = preprocess(state, &source, &state->info_log, + &ctx->Extensions, ctx->API); + + if (ctx->Shader.Flags & GLSL_DUMP) { + printf("GLSL source for shader %d:\n", shader->Name); + printf("%s\n", shader->Source); + } + + if (!state->error) { + _mesa_glsl_lexer_ctor(state, source); + _mesa_glsl_parse(state); + _mesa_glsl_lexer_dtor(state); + } + + talloc_free(shader->ir); + shader->ir = new(shader) exec_list; + if (!state->error && !state->translation_unit.is_empty()) + _mesa_ast_to_hir(shader->ir, state); + + if (!state->error && !shader->ir->is_empty()) { + validate_ir_tree(shader->ir); + + /* Do some optimization at compile time to reduce shader IR size + * and reduce later work if the same shader is linked multiple times + */ + while (do_common_optimization(shader->ir, false, 32)) + ; + + validate_ir_tree(shader->ir); + } + + shader->symbols = state->symbols; + + shader->CompileStatus = !state->error; + shader->InfoLog = state->info_log; + shader->Version = state->language_version; + memcpy(shader->builtins_to_link, state->builtins_to_link, + sizeof(shader->builtins_to_link[0]) * state->num_builtins_to_link); + shader->num_builtins_to_link = state->num_builtins_to_link; + + if (ctx->Shader.Flags & GLSL_LOG) { + _mesa_write_shader_to_file(shader); + } + + if (ctx->Shader.Flags & GLSL_DUMP) { + if (shader->CompileStatus) { + printf("GLSL IR for shader %d:\n", shader->Name); + _mesa_print_ir(shader->ir, NULL); + printf("\n\n"); + } else { + printf("GLSL shader %d failed to compile.\n", shader->Name); + } + if (shader->InfoLog && shader->InfoLog[0] != 0) { + printf("GLSL shader %d info log:\n", shader->Name); + printf("%s\n", shader->InfoLog); + } + } + + /* Retain any live IR, but trash the rest. */ + reparent_ir(shader->ir, shader->ir); + + talloc_free(state); + + if (shader->CompileStatus) { + if (!ctx->Driver.CompileShader(ctx, shader)) + shader->CompileStatus = GL_FALSE; + } +} + +void +_mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog) +{ + unsigned int i; + + _mesa_clear_shader_program_data(ctx, prog); + + prog->LinkStatus = GL_TRUE; + + for (i = 0; i < prog->NumShaders; i++) { + if (!prog->Shaders[i]->CompileStatus) { + fail_link(prog, "linking with uncompiled shader"); + prog->LinkStatus = GL_FALSE; + } + } + + prog->Varying = _mesa_new_parameter_list(); + _mesa_reference_vertprog(ctx, &prog->VertexProgram, NULL); + _mesa_reference_fragprog(ctx, &prog->FragmentProgram, NULL); + + if (prog->LinkStatus) { + link_shaders(ctx, prog); + } + + if (prog->LinkStatus) { + if (!ctx->Driver.LinkShader(ctx, prog)) { + prog->LinkStatus = GL_FALSE; + } + } + + set_uniform_initializers(ctx, prog); + + if (ctx->Shader.Flags & GLSL_DUMP) { + if (!prog->LinkStatus) { + printf("GLSL shader program %d failed to link\n", prog->Name); + } + + if (prog->InfoLog && prog->InfoLog[0] != 0) { + printf("GLSL shader program %d info log:\n", prog->Name); + printf("%s\n", prog->InfoLog); + } + } +} + +} /* extern "C" */ diff --git a/mesalib/src/mesa/program/ir_to_mesa.h b/mesalib/src/mesa/program/ir_to_mesa.h new file mode 100644 index 000000000..ecaacde4b --- /dev/null +++ b/mesalib/src/mesa/program/ir_to_mesa.h @@ -0,0 +1,38 @@ +/* + * Copyright © 2010 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "main/config.h" +#include "main/mtypes.h" + +void _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *sh); +void _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog); +GLboolean _mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader); +GLboolean _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog); + +#ifdef __cplusplus +} +#endif diff --git a/mesalib/src/mesa/shader/lex.yy.c b/mesalib/src/mesa/program/lex.yy.c index 4c5c644a6..135eca6fd 100644 --- a/mesalib/src/mesa/shader/lex.yy.c +++ b/mesalib/src/mesa/program/lex.yy.c @@ -53,7 +53,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,6 +83,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -157,7 +158,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -1034,12 +1043,11 @@ static yyconst flex_int16_t yy_chk[1368] = */ #include "main/glheader.h" #include "main/imports.h" -#include "shader/prog_instruction.h" -#include "shader/prog_statevars.h" - -#include "shader/symbol_table.h" -#include "shader/program_parser.h" -#include "shader/program_parse.tab.h" +#include "program/prog_instruction.h" +#include "program/prog_statevars.h" +#include "program/symbol_table.h" +#include "program/program_parser.h" +#include "program/program_parse.tab.h" #define require_ARB_vp (yyextra->mode == ARB_vertex) #define require_ARB_fp (yyextra->mode == ARB_fragment) @@ -1151,8 +1159,21 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) } \ } while(0); +#define YY_NO_INPUT + +/* Yes, this is intentionally doing nothing. We have this line of code +here only to avoid the compiler complaining about an unput function +that is defined, but never called. */ +#define YY_USER_INIT while (0) { unput(0); } + #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1156 "lex.yy.c" + +/* Flex defines a couple of functions with no declarations nor the +static keyword. Declare them here to avoid a compiler warning. */ +int yyget_column (yyscan_t yyscanner); +void yyset_column (int column_no , yyscan_t yyscanner); + +#line 1177 "lex.yy.c" #define INITIAL 0 @@ -1289,7 +1310,12 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1297,7 +1323,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1308,7 +1334,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1393,10 +1419,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 157 "program_lexer.l" +#line 169 "program_lexer.l" -#line 1400 "lex.yy.c" +#line 1426 "lex.yy.c" yylval = yylval_param; @@ -1485,17 +1511,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 159 "program_lexer.l" +#line 171 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 160 "program_lexer.l" +#line 172 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 161 "program_lexer.l" +#line 173 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1503,692 +1529,692 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 165 "program_lexer.l" +#line 177 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 166 "program_lexer.l" +#line 178 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 167 "program_lexer.l" +#line 179 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 168 "program_lexer.l" +#line 180 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 169 "program_lexer.l" +#line 181 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 170 "program_lexer.l" +#line 182 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 171 "program_lexer.l" +#line 183 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 173 "program_lexer.l" +#line 185 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, 3); } YY_BREAK case 12: YY_RULE_SETUP -#line 174 "program_lexer.l" +#line 186 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, 3); } YY_BREAK case 13: YY_RULE_SETUP -#line 175 "program_lexer.l" +#line 187 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, 3); } YY_BREAK case 14: YY_RULE_SETUP -#line 177 "program_lexer.l" +#line 189 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, 3); } YY_BREAK case 15: YY_RULE_SETUP -#line 178 "program_lexer.l" +#line 190 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); } YY_BREAK case 16: YY_RULE_SETUP -#line 180 "program_lexer.l" +#line 192 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); } YY_BREAK case 17: YY_RULE_SETUP -#line 181 "program_lexer.l" +#line 193 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); } YY_BREAK case 18: YY_RULE_SETUP -#line 182 "program_lexer.l" +#line 194 "program_lexer.l" { return_opcode( 1, BIN_OP, DP3, 3); } YY_BREAK case 19: YY_RULE_SETUP -#line 183 "program_lexer.l" +#line 195 "program_lexer.l" { return_opcode( 1, BIN_OP, DP4, 3); } YY_BREAK case 20: YY_RULE_SETUP -#line 184 "program_lexer.l" +#line 196 "program_lexer.l" { return_opcode( 1, BIN_OP, DPH, 3); } YY_BREAK case 21: YY_RULE_SETUP -#line 185 "program_lexer.l" +#line 197 "program_lexer.l" { return_opcode( 1, BIN_OP, DST, 3); } YY_BREAK case 22: YY_RULE_SETUP -#line 187 "program_lexer.l" +#line 199 "program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, 3); } YY_BREAK case 23: YY_RULE_SETUP -#line 188 "program_lexer.l" +#line 200 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); } YY_BREAK case 24: YY_RULE_SETUP -#line 190 "program_lexer.l" +#line 202 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, 3); } YY_BREAK case 25: YY_RULE_SETUP -#line 191 "program_lexer.l" +#line 203 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, 3); } YY_BREAK case 26: YY_RULE_SETUP -#line 193 "program_lexer.l" +#line 205 "program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, 3); } YY_BREAK case 27: YY_RULE_SETUP -#line 195 "program_lexer.l" +#line 207 "program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, 3); } YY_BREAK case 28: YY_RULE_SETUP -#line 196 "program_lexer.l" +#line 208 "program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, 3); } YY_BREAK case 29: YY_RULE_SETUP -#line 197 "program_lexer.l" +#line 209 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); } YY_BREAK case 30: YY_RULE_SETUP -#line 198 "program_lexer.l" +#line 210 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, 3); } YY_BREAK case 31: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 212 "program_lexer.l" { return_opcode( 1, TRI_OP, MAD, 3); } YY_BREAK case 32: YY_RULE_SETUP -#line 201 "program_lexer.l" +#line 213 "program_lexer.l" { return_opcode( 1, BIN_OP, MAX, 3); } YY_BREAK case 33: YY_RULE_SETUP -#line 202 "program_lexer.l" +#line 214 "program_lexer.l" { return_opcode( 1, BIN_OP, MIN, 3); } YY_BREAK case 34: YY_RULE_SETUP -#line 203 "program_lexer.l" +#line 215 "program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, 3); } YY_BREAK case 35: YY_RULE_SETUP -#line 204 "program_lexer.l" +#line 216 "program_lexer.l" { return_opcode( 1, BIN_OP, MUL, 3); } YY_BREAK case 36: YY_RULE_SETUP -#line 206 "program_lexer.l" +#line 218 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } YY_BREAK case 37: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 219 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } YY_BREAK case 38: YY_RULE_SETUP -#line 208 "program_lexer.l" +#line 220 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } YY_BREAK case 39: YY_RULE_SETUP -#line 209 "program_lexer.l" +#line 221 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } YY_BREAK case 40: YY_RULE_SETUP -#line 210 "program_lexer.l" +#line 222 "program_lexer.l" { return_opcode( 1, BINSC_OP, POW, 3); } YY_BREAK case 41: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 224 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, 3); } YY_BREAK case 42: YY_RULE_SETUP -#line 213 "program_lexer.l" +#line 225 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, RFL, 3); } YY_BREAK case 43: YY_RULE_SETUP -#line 214 "program_lexer.l" +#line 226 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, 3); } YY_BREAK case 44: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 228 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } YY_BREAK case 45: YY_RULE_SETUP -#line 217 "program_lexer.l" +#line 229 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } YY_BREAK case 46: YY_RULE_SETUP -#line 218 "program_lexer.l" +#line 230 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SFL, 3); } YY_BREAK case 47: YY_RULE_SETUP -#line 219 "program_lexer.l" +#line 231 "program_lexer.l" { return_opcode( 1, BIN_OP, SGE, 3); } YY_BREAK case 48: YY_RULE_SETUP -#line 220 "program_lexer.l" +#line 232 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SGT, 3); } YY_BREAK case 49: YY_RULE_SETUP -#line 221 "program_lexer.l" +#line 233 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } YY_BREAK case 50: YY_RULE_SETUP -#line 222 "program_lexer.l" +#line 234 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SLE, 3); } YY_BREAK case 51: YY_RULE_SETUP -#line 223 "program_lexer.l" +#line 235 "program_lexer.l" { return_opcode( 1, BIN_OP, SLT, 3); } YY_BREAK case 52: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 236 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SNE, 3); } YY_BREAK case 53: YY_RULE_SETUP -#line 225 "program_lexer.l" +#line 237 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, STR, 3); } YY_BREAK case 54: YY_RULE_SETUP -#line 226 "program_lexer.l" +#line 238 "program_lexer.l" { return_opcode( 1, BIN_OP, SUB, 3); } YY_BREAK case 55: YY_RULE_SETUP -#line 227 "program_lexer.l" +#line 239 "program_lexer.l" { return_opcode( 1, SWZ, SWZ, 3); } YY_BREAK case 56: YY_RULE_SETUP -#line 229 "program_lexer.l" +#line 241 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); } YY_BREAK case 57: YY_RULE_SETUP -#line 230 "program_lexer.l" +#line 242 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } YY_BREAK case 58: YY_RULE_SETUP -#line 231 "program_lexer.l" +#line 243 "program_lexer.l" { return_opcode(require_NV_fp, TXD_OP, TXD, 3); } YY_BREAK case 59: YY_RULE_SETUP -#line 232 "program_lexer.l" +#line 244 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } YY_BREAK case 60: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 246 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } YY_BREAK case 61: YY_RULE_SETUP -#line 235 "program_lexer.l" +#line 247 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } YY_BREAK case 62: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 248 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); } YY_BREAK case 63: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 249 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); } YY_BREAK case 64: YY_RULE_SETUP -#line 239 "program_lexer.l" +#line 251 "program_lexer.l" { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } YY_BREAK case 65: YY_RULE_SETUP -#line 240 "program_lexer.l" +#line 252 "program_lexer.l" { return_opcode( 1, BIN_OP, XPD, 3); } YY_BREAK case 66: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 254 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 67: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 255 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 68: YY_RULE_SETUP -#line 244 "program_lexer.l" +#line 256 "program_lexer.l" { return PROGRAM; } YY_BREAK case 69: YY_RULE_SETUP -#line 245 "program_lexer.l" +#line 257 "program_lexer.l" { return STATE; } YY_BREAK case 70: YY_RULE_SETUP -#line 246 "program_lexer.l" +#line 258 "program_lexer.l" { return RESULT; } YY_BREAK case 71: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 260 "program_lexer.l" { return AMBIENT; } YY_BREAK case 72: YY_RULE_SETUP -#line 249 "program_lexer.l" +#line 261 "program_lexer.l" { return ATTENUATION; } YY_BREAK case 73: YY_RULE_SETUP -#line 250 "program_lexer.l" +#line 262 "program_lexer.l" { return BACK; } YY_BREAK case 74: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 263 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 75: YY_RULE_SETUP -#line 252 "program_lexer.l" +#line 264 "program_lexer.l" { return COLOR; } YY_BREAK case 76: YY_RULE_SETUP -#line 253 "program_lexer.l" +#line 265 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 77: YY_RULE_SETUP -#line 254 "program_lexer.l" +#line 266 "program_lexer.l" { return DIFFUSE; } YY_BREAK case 78: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 267 "program_lexer.l" { return DIRECTION; } YY_BREAK case 79: YY_RULE_SETUP -#line 256 "program_lexer.l" +#line 268 "program_lexer.l" { return EMISSION; } YY_BREAK case 80: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 269 "program_lexer.l" { return ENV; } YY_BREAK case 81: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 270 "program_lexer.l" { return EYE; } YY_BREAK case 82: YY_RULE_SETUP -#line 259 "program_lexer.l" +#line 271 "program_lexer.l" { return FOGCOORD; } YY_BREAK case 83: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 272 "program_lexer.l" { return FOG; } YY_BREAK case 84: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 273 "program_lexer.l" { return FRONT; } YY_BREAK case 85: YY_RULE_SETUP -#line 262 "program_lexer.l" +#line 274 "program_lexer.l" { return HALF; } YY_BREAK case 86: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 275 "program_lexer.l" { return INVERSE; } YY_BREAK case 87: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 276 "program_lexer.l" { return INVTRANS; } YY_BREAK case 88: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 277 "program_lexer.l" { return LIGHT; } YY_BREAK case 89: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 278 "program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 90: YY_RULE_SETUP -#line 267 "program_lexer.l" +#line 279 "program_lexer.l" { return LIGHTPROD; } YY_BREAK case 91: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 280 "program_lexer.l" { return LOCAL; } YY_BREAK case 92: YY_RULE_SETUP -#line 269 "program_lexer.l" +#line 281 "program_lexer.l" { return MATERIAL; } YY_BREAK case 93: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 282 "program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 94: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 283 "program_lexer.l" { return MATRIX; } YY_BREAK case 95: YY_RULE_SETUP -#line 272 "program_lexer.l" +#line 284 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 96: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 285 "program_lexer.l" { return MODELVIEW; } YY_BREAK case 97: YY_RULE_SETUP -#line 274 "program_lexer.l" +#line 286 "program_lexer.l" { return MVP; } YY_BREAK case 98: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 287 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 99: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 288 "program_lexer.l" { return OBJECT; } YY_BREAK case 100: YY_RULE_SETUP -#line 277 "program_lexer.l" +#line 289 "program_lexer.l" { return PALETTE; } YY_BREAK case 101: YY_RULE_SETUP -#line 278 "program_lexer.l" +#line 290 "program_lexer.l" { return PARAMS; } YY_BREAK case 102: YY_RULE_SETUP -#line 279 "program_lexer.l" +#line 291 "program_lexer.l" { return PLANE; } YY_BREAK case 103: YY_RULE_SETUP -#line 280 "program_lexer.l" +#line 292 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT_TOK); } YY_BREAK case 104: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 293 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 105: YY_RULE_SETUP -#line 282 "program_lexer.l" +#line 294 "program_lexer.l" { return POSITION; } YY_BREAK case 106: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 295 "program_lexer.l" { return PRIMARY; } YY_BREAK case 107: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 296 "program_lexer.l" { return PROJECTION; } YY_BREAK case 108: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 297 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 109: YY_RULE_SETUP -#line 286 "program_lexer.l" +#line 298 "program_lexer.l" { return ROW; } YY_BREAK case 110: YY_RULE_SETUP -#line 287 "program_lexer.l" +#line 299 "program_lexer.l" { return SCENECOLOR; } YY_BREAK case 111: YY_RULE_SETUP -#line 288 "program_lexer.l" +#line 300 "program_lexer.l" { return SECONDARY; } YY_BREAK case 112: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 301 "program_lexer.l" { return SHININESS; } YY_BREAK case 113: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 302 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE_TOK); } YY_BREAK case 114: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 303 "program_lexer.l" { return SPECULAR; } YY_BREAK case 115: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 304 "program_lexer.l" { return SPOT; } YY_BREAK case 116: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 305 "program_lexer.l" { return TEXCOORD; } YY_BREAK case 117: YY_RULE_SETUP -#line 294 "program_lexer.l" +#line 306 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 118: YY_RULE_SETUP -#line 295 "program_lexer.l" +#line 307 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 119: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 308 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 120: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 309 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 121: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 310 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 122: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 311 "program_lexer.l" { return TEXTURE; } YY_BREAK case 123: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 312 "program_lexer.l" { return TRANSPOSE; } YY_BREAK case 124: YY_RULE_SETUP -#line 301 "program_lexer.l" +#line 313 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 125: YY_RULE_SETUP -#line 302 "program_lexer.l" +#line 314 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 126: YY_RULE_SETUP -#line 304 "program_lexer.l" +#line 316 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 127: YY_RULE_SETUP -#line 305 "program_lexer.l" +#line 317 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 128: YY_RULE_SETUP -#line 306 "program_lexer.l" +#line 318 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 129: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 319 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 130: YY_RULE_SETUP -#line 308 "program_lexer.l" +#line 320 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 131: YY_RULE_SETUP -#line 309 "program_lexer.l" +#line 321 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 132: YY_RULE_SETUP -#line 310 "program_lexer.l" +#line 322 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 133: YY_RULE_SETUP -#line 311 "program_lexer.l" +#line 323 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 134: YY_RULE_SETUP -#line 312 "program_lexer.l" +#line 324 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 135: YY_RULE_SETUP -#line 313 "program_lexer.l" +#line 325 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 136: YY_RULE_SETUP -#line 314 "program_lexer.l" +#line 326 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 137: YY_RULE_SETUP -#line 315 "program_lexer.l" +#line 327 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 138: YY_RULE_SETUP -#line 316 "program_lexer.l" +#line 328 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 139: YY_RULE_SETUP -#line 318 "program_lexer.l" +#line 330 "program_lexer.l" { return handle_ident(yyextra, yytext, yylval); } YY_BREAK case 140: YY_RULE_SETUP -#line 320 "program_lexer.l" +#line 332 "program_lexer.l" { return DOT_DOT; } YY_BREAK case 141: YY_RULE_SETUP -#line 322 "program_lexer.l" +#line 334 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2196,7 +2222,7 @@ YY_RULE_SETUP YY_BREAK case 142: YY_RULE_SETUP -#line 326 "program_lexer.l" +#line 338 "program_lexer.l" { yylval->real = _mesa_strtof(yytext, NULL); return REAL; @@ -2208,7 +2234,7 @@ case 143: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 330 "program_lexer.l" +#line 342 "program_lexer.l" { yylval->real = _mesa_strtof(yytext, NULL); return REAL; @@ -2216,7 +2242,7 @@ YY_RULE_SETUP YY_BREAK case 144: YY_RULE_SETUP -#line 334 "program_lexer.l" +#line 346 "program_lexer.l" { yylval->real = _mesa_strtof(yytext, NULL); return REAL; @@ -2224,7 +2250,7 @@ YY_RULE_SETUP YY_BREAK case 145: YY_RULE_SETUP -#line 338 "program_lexer.l" +#line 350 "program_lexer.l" { yylval->real = _mesa_strtof(yytext, NULL); return REAL; @@ -2232,7 +2258,7 @@ YY_RULE_SETUP YY_BREAK case 146: YY_RULE_SETUP -#line 343 "program_lexer.l" +#line 355 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2241,7 +2267,7 @@ YY_RULE_SETUP YY_BREAK case 147: YY_RULE_SETUP -#line 349 "program_lexer.l" +#line 361 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2251,7 +2277,7 @@ YY_RULE_SETUP YY_BREAK case 148: YY_RULE_SETUP -#line 355 "program_lexer.l" +#line 367 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2260,7 +2286,7 @@ YY_RULE_SETUP YY_BREAK case 149: YY_RULE_SETUP -#line 360 "program_lexer.l" +#line 372 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2269,7 +2295,7 @@ YY_RULE_SETUP YY_BREAK case 150: YY_RULE_SETUP -#line 366 "program_lexer.l" +#line 378 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2279,7 +2305,7 @@ YY_RULE_SETUP YY_BREAK case 151: YY_RULE_SETUP -#line 372 "program_lexer.l" +#line 384 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2289,7 +2315,7 @@ YY_RULE_SETUP YY_BREAK case 152: YY_RULE_SETUP -#line 378 "program_lexer.l" +#line 390 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2298,7 +2324,7 @@ YY_RULE_SETUP YY_BREAK case 153: YY_RULE_SETUP -#line 384 "program_lexer.l" +#line 396 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2308,7 +2334,7 @@ YY_RULE_SETUP YY_BREAK case 154: YY_RULE_SETUP -#line 391 "program_lexer.l" +#line 403 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2320,7 +2346,7 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 400 "program_lexer.l" +#line 412 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2329,7 +2355,7 @@ YY_RULE_SETUP YY_BREAK case 156: YY_RULE_SETUP -#line 406 "program_lexer.l" +#line 418 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2339,7 +2365,7 @@ YY_RULE_SETUP YY_BREAK case 157: YY_RULE_SETUP -#line 412 "program_lexer.l" +#line 424 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2348,7 +2374,7 @@ YY_RULE_SETUP YY_BREAK case 158: YY_RULE_SETUP -#line 417 "program_lexer.l" +#line 429 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2357,7 +2383,7 @@ YY_RULE_SETUP YY_BREAK case 159: YY_RULE_SETUP -#line 423 "program_lexer.l" +#line 435 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2367,7 +2393,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 429 "program_lexer.l" +#line 441 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2377,7 +2403,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 435 "program_lexer.l" +#line 447 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2386,7 +2412,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 441 "program_lexer.l" +#line 453 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2396,7 +2422,7 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 449 "program_lexer.l" +#line 461 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2410,7 +2436,7 @@ YY_RULE_SETUP YY_BREAK case 164: YY_RULE_SETUP -#line 460 "program_lexer.l" +#line 472 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2422,13 +2448,13 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 469 "program_lexer.l" +#line 481 "program_lexer.l" { return DOT; } YY_BREAK case 166: /* rule 166 can match eol */ YY_RULE_SETUP -#line 471 "program_lexer.l" +#line 483 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2439,7 +2465,7 @@ YY_RULE_SETUP YY_BREAK case 167: YY_RULE_SETUP -#line 478 "program_lexer.l" +#line 490 "program_lexer.l" /* eat whitespace */ ; YY_BREAK case 168: @@ -2447,20 +2473,20 @@ case 168: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 479 "program_lexer.l" +#line 491 "program_lexer.l" /* eat comments */ ; YY_BREAK case 169: YY_RULE_SETUP -#line 480 "program_lexer.l" +#line 492 "program_lexer.l" { return yytext[0]; } YY_BREAK case 170: YY_RULE_SETUP -#line 481 "program_lexer.l" +#line 493 "program_lexer.l" ECHO; YY_BREAK -#line 2464 "lex.yy.c" +#line 2490 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3228,8 +3254,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -3635,7 +3661,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 481 "program_lexer.l" +#line 493 "program_lexer.l" diff --git a/mesalib/src/mesa/shader/nvfragparse.c b/mesalib/src/mesa/program/nvfragparse.c index 0de3c5804..0de3c5804 100644 --- a/mesalib/src/mesa/shader/nvfragparse.c +++ b/mesalib/src/mesa/program/nvfragparse.c diff --git a/mesalib/src/mesa/shader/nvfragparse.h b/mesalib/src/mesa/program/nvfragparse.h index 544ab80c5..e28a6c493 100644 --- a/mesalib/src/mesa/shader/nvfragparse.h +++ b/mesalib/src/mesa/program/nvfragparse.h @@ -30,6 +30,7 @@ #ifndef NVFRAGPARSE_H #define NVFRAGPARSE_H +#include "main/mtypes.h" extern void _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum target, diff --git a/mesalib/src/mesa/shader/nvvertparse.c b/mesalib/src/mesa/program/nvvertparse.c index 631b315af..1ac83d0e5 100644 --- a/mesalib/src/mesa/shader/nvvertparse.c +++ b/mesalib/src/mesa/program/nvvertparse.c @@ -40,7 +40,7 @@ #include "main/glheader.h" #include "main/context.h" #include "main/imports.h" -#include "nvprogram.h" +#include "main/nvprogram.h" #include "nvvertparse.h" #include "prog_instruction.h" #include "prog_parameter.h" @@ -64,6 +64,7 @@ struct parse_state { GLbitfield inputsRead; GLbitfield outputsWritten; GLboolean anyProgRegsWritten; + GLboolean indirectRegisterFiles; GLuint numInst; /* number of instructions parsed */ }; @@ -410,6 +411,7 @@ Parse_ParamReg(struct parse_state *parseState, struct prog_src_register *srcReg) srcReg->RelAddr = GL_TRUE; srcReg->File = PROGRAM_ENV_PARAM; + parseState->indirectRegisterFiles |= (1 << srcReg->File); /* Look for +/-N offset */ if (!Peek_Token(parseState, token)) RETURN_ERROR; @@ -1096,7 +1098,7 @@ Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction * } } else { - srcReg->File = 0; + srcReg->File = PROGRAM_UNDEFINED; } /* semicolon */ @@ -1308,6 +1310,7 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, parseState.inputsRead = 0; parseState.outputsWritten = 0; parseState.anyProgRegsWritten = GL_FALSE; + parseState.indirectRegisterFiles = 0x0; /* Reset error state */ _mesa_set_program_error(ctx, -1, NULL); @@ -1408,6 +1411,8 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, program->Base.Parameters = _mesa_new_parameter_list (); program->Base.NumParameters = 0; + program->Base.IndirectRegisterFiles = parseState.indirectRegisterFiles; + state_tokens[0] = STATE_VERTEX_PROGRAM; state_tokens[1] = STATE_ENV; /* Add refs to all of the potential params, in order. If we want to not diff --git a/mesalib/src/mesa/shader/nvvertparse.h b/mesalib/src/mesa/program/nvvertparse.h index 9919e2238..91ef79e6c 100644 --- a/mesalib/src/mesa/shader/nvvertparse.h +++ b/mesalib/src/mesa/program/nvvertparse.h @@ -29,6 +29,7 @@ #ifndef NVVERTPARSE_H #define NVVERTPARSE_H +#include "main/mtypes.h" extern void _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum target, diff --git a/mesalib/src/mesa/shader/prog_cache.c b/mesalib/src/mesa/program/prog_cache.c index e5b602fc0..8af689754 100644 --- a/mesalib/src/mesa/shader/prog_cache.c +++ b/mesalib/src/mesa/program/prog_cache.c @@ -29,8 +29,8 @@ #include "main/glheader.h" #include "main/mtypes.h" #include "main/imports.h" -#include "shader/prog_cache.h" -#include "shader/program.h" +#include "program/prog_cache.h" +#include "program/program.h" struct cache_item diff --git a/mesalib/src/mesa/shader/prog_cache.h b/mesalib/src/mesa/program/prog_cache.h index 4e1ccac03..bfe8f99d4 100644 --- a/mesalib/src/mesa/shader/prog_cache.h +++ b/mesalib/src/mesa/program/prog_cache.h @@ -30,6 +30,9 @@ #define PROG_CACHE_H +#include "main/mtypes.h" + + /** Opaque type */ struct gl_program_cache; diff --git a/mesalib/src/mesa/shader/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c index 37750cc33..2ae5bc572 100644 --- a/mesalib/src/mesa/shader/prog_execute.c +++ b/mesalib/src/mesa/program/prog_execute.c @@ -37,7 +37,7 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" +#include "main/macros.h" #include "prog_execute.h" #include "prog_instruction.h" #include "prog_parameter.h" @@ -81,6 +81,22 @@ static const GLfloat ZeroVec[4] = { 0.0F, 0.0F, 0.0F, 0.0F }; /** + * Return TRUE for +0 and other positive values, FALSE otherwise. + * Used for RCC opcode. + */ +static INLINE GLboolean +positive(float x) +{ + fi_type fi; + fi.f = x; + if (fi.i & 0x80000000) + return GL_FALSE; + return GL_TRUE; +} + + + +/** * Return a pointer to the 4-element float vector specified by the given * source register. */ @@ -755,6 +771,13 @@ _mesa_execute_program(GLcontext * ctx, result[2] = a[2] < 0.0F ? b[2] : c[2]; result[3] = a[3] < 0.0F ? b[3] : c[3]; store_vector4(inst, machine, result); + if (DEBUG_PROG) { + printf("CMP (%g %g %g %g) = (%g %g %g %g) < 0 ? (%g %g %g %g) : (%g %g %g %g)\n", + result[0], result[1], result[2], result[3], + a[0], a[1], a[2], a[3], + b[0], b[1], b[2], b[3], + c[0], c[1], c[2], c[3]); + } } break; case OPCODE_COS: @@ -762,7 +785,7 @@ _mesa_execute_program(GLcontext * ctx, GLfloat a[4], result[4]; fetch_vector1(&inst->SrcReg[0], machine, a); result[0] = result[1] = result[2] = result[3] - = (GLfloat) _mesa_cos(a[0]); + = (GLfloat) cos(a[0]); store_vector4(inst, machine, result); } break; @@ -876,7 +899,7 @@ _mesa_execute_program(GLcontext * ctx, * result.z = result.x * APPX(result.y) * We do what the ARB extension says. */ - q[2] = (GLfloat) _mesa_pow(2.0, t[0]); + q[2] = (GLfloat) pow(2.0, t[0]); } q[1] = t[0] - floor_t0; q[3] = 1.0F; @@ -887,7 +910,7 @@ _mesa_execute_program(GLcontext * ctx, { GLfloat a[4], result[4], val; fetch_vector1(&inst->SrcReg[0], machine, a); - val = (GLfloat) _mesa_pow(2.0, a[0]); + val = (GLfloat) pow(2.0, a[0]); /* if (IS_INF_OR_NAN(val)) val = 1.0e10; @@ -1009,7 +1032,7 @@ _mesa_execute_program(GLcontext * ctx, if (a[1] == 0.0 && a[3] == 0.0) result[2] = 1.0F; else - result[2] = (GLfloat) _mesa_pow(a[1], a[3]); + result[2] = (GLfloat) pow(a[1], a[3]); } else { result[2] = 0.0F; @@ -1336,10 +1359,48 @@ _mesa_execute_program(GLcontext * ctx, fetch_vector1(&inst->SrcReg[0], machine, a); fetch_vector1(&inst->SrcReg[1], machine, b); result[0] = result[1] = result[2] = result[3] - = (GLfloat) _mesa_pow(a[0], b[0]); + = (GLfloat) pow(a[0], b[0]); + store_vector4(inst, machine, result); + } + break; + case OPCODE_RCC: /* clamped riciprocal */ + { + const float largest = 1.884467e+19, smallest = 5.42101e-20; + GLfloat a[4], r, result[4]; + fetch_vector1(&inst->SrcReg[0], machine, a); + if (DEBUG_PROG) { + if (a[0] == 0) + printf("RCC(0)\n"); + else if (IS_INF_OR_NAN(a[0])) + printf("RCC(inf)\n"); + } + if (a[0] == 1.0F) { + r = 1.0F; + } + else { + r = 1.0F / a[0]; + } + if (positive(r)) { + if (r > largest) { + r = largest; + } + else if (r < smallest) { + r = smallest; + } + } + else { + if (r < -largest) { + r = -largest; + } + else if (r > -smallest) { + r = -smallest; + } + } + result[0] = result[1] = result[2] = result[3] = r; store_vector4(inst, machine, result); } break; + case OPCODE_RCP: { GLfloat a[4], result[4]; @@ -1393,8 +1454,8 @@ _mesa_execute_program(GLcontext * ctx, { GLfloat a[4], result[4]; fetch_vector1(&inst->SrcReg[0], machine, a); - result[0] = (GLfloat) _mesa_cos(a[0]); - result[1] = (GLfloat) _mesa_sin(a[0]); + result[0] = (GLfloat) cos(a[0]); + result[1] = (GLfloat) sin(a[0]); result[2] = 0.0; /* undefined! */ result[3] = 0.0; /* undefined! */ store_vector4(inst, machine, result); @@ -1465,7 +1526,7 @@ _mesa_execute_program(GLcontext * ctx, GLfloat a[4], result[4]; fetch_vector1(&inst->SrcReg[0], machine, a); result[0] = result[1] = result[2] = result[3] - = (GLfloat) _mesa_sin(a[0]); + = (GLfloat) sin(a[0]); store_vector4(inst, machine, result); } break; @@ -1625,6 +1686,22 @@ _mesa_execute_program(GLcontext * ctx, store_vector4(inst, machine, color); } break; + case OPCODE_TXL: + /* Texel lookup with explicit LOD */ + { + GLfloat texcoord[4], color[4], lod; + + fetch_vector4(&inst->SrcReg[0], machine, texcoord); + + /* texcoord[3] is the LOD */ + lod = texcoord[3]; + + machine->FetchTexelLod(ctx, texcoord, lod, + machine->Samplers[inst->TexSrcUnit], color); + + store_vector4(inst, machine, color); + } + break; case OPCODE_TXP: /* GL_ARB_fragment_program only */ /* Texture lookup w/ projective divide */ { @@ -1767,7 +1844,7 @@ _mesa_execute_program(GLcontext * ctx, break; case OPCODE_PRINT: { - if (inst->SrcReg[0].File != -1) { + if (inst->SrcReg[0].File != PROGRAM_UNDEFINED) { GLfloat a[4]; fetch_vector4(&inst->SrcReg[0], machine, a); printf("%s%g, %g, %g, %g\n", (const char *) inst->Data, @@ -1788,7 +1865,11 @@ _mesa_execute_program(GLcontext * ctx, numExec++; if (numExec > maxExec) { - _mesa_problem(ctx, "Infinite loop detected in fragment program"); + static GLboolean reported = GL_FALSE; + if (!reported) { + _mesa_problem(ctx, "Infinite loop detected in fragment program"); + reported = GL_TRUE; + } return GL_TRUE; } diff --git a/mesalib/src/mesa/shader/prog_execute.h b/mesalib/src/mesa/program/prog_execute.h index adefc5439..f59b65176 100644 --- a/mesalib/src/mesa/shader/prog_execute.h +++ b/mesalib/src/mesa/program/prog_execute.h @@ -26,6 +26,7 @@ #define PROG_EXECUTE_H #include "main/config.h" +#include "main/mtypes.h" typedef void (*FetchTexelLodFunc)(GLcontext *ctx, const GLfloat texcoord[4], diff --git a/mesalib/src/mesa/shader/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c index 81099cb99..5d6cb476c 100644 --- a/mesalib/src/mesa/shader/prog_instruction.c +++ b/mesalib/src/mesa/program/prog_instruction.c @@ -177,7 +177,9 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_DPH, "DPH", 2, 1 }, { OPCODE_DST, "DST", 2, 1 }, { OPCODE_ELSE, "ELSE", 0, 0 }, + { OPCODE_EMIT_VERTEX, "EMIT_VERTEX", 0, 0 }, { OPCODE_END, "END", 0, 0 }, + { OPCODE_END_PRIMITIVE, "END_PRIMITIVE", 0, 0 }, { OPCODE_ENDIF, "ENDIF", 0, 0 }, { OPCODE_ENDLOOP,"ENDLOOP", 0, 0 }, { OPCODE_ENDSUB, "ENDSUB", 0, 0 }, diff --git a/mesalib/src/mesa/shader/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h index 28c797a4b..ca90de7ce 100644 --- a/mesalib/src/mesa/shader/prog_instruction.h +++ b/mesalib/src/mesa/program/prog_instruction.h @@ -38,7 +38,7 @@ #define PROG_INSTRUCTION_H -#include "main/mfeatures.h" +#include "main/glheader.h" /** @@ -139,8 +139,7 @@ /** - * Program instruction opcodes, for both vertex and fragment programs. - * \note changes to this opcode list must be reflected in t_vb_arbprogram.c + * Program instruction opcodes for vertex, fragment and geometry programs. */ typedef enum prog_opcode { /* ARB_vp ARB_fp NV_vp NV_fp GLSL */ @@ -150,27 +149,29 @@ typedef enum prog_opcode { OPCODE_ADD, /* X X X X X */ OPCODE_AND, /* */ OPCODE_ARA, /* 2 */ - OPCODE_ARL, /* X X */ + OPCODE_ARL, /* X X X */ OPCODE_ARL_NV, /* 2 */ OPCODE_ARR, /* 2 */ OPCODE_BGNLOOP, /* opt */ OPCODE_BGNSUB, /* opt */ OPCODE_BRA, /* 2 X */ OPCODE_BRK, /* 2 opt */ - OPCODE_CAL, /* 2 2 */ - OPCODE_CMP, /* X */ + OPCODE_CAL, /* 2 2 X */ + OPCODE_CMP, /* X X */ OPCODE_CONT, /* opt */ OPCODE_COS, /* X 2 X X */ OPCODE_DDX, /* X X */ OPCODE_DDY, /* X X */ - OPCODE_DP2, /* 2 */ + OPCODE_DP2, /* 2 X */ OPCODE_DP2A, /* 2 */ OPCODE_DP3, /* X X X X X */ OPCODE_DP4, /* X X X X X */ OPCODE_DPH, /* X X 1.1 */ OPCODE_DST, /* X X X X */ OPCODE_ELSE, /* X */ + OPCODE_EMIT_VERTEX,/* X */ OPCODE_END, /* X X X X opt */ + OPCODE_END_PRIMITIVE,/* X */ OPCODE_ENDIF, /* opt */ OPCODE_ENDLOOP, /* opt */ OPCODE_ENDSUB, /* opt */ @@ -184,7 +185,7 @@ typedef enum prog_opcode { OPCODE_LG2, /* X X 2 X X */ OPCODE_LIT, /* X X X X */ OPCODE_LOG, /* X X X */ - OPCODE_LRP, /* X X */ + OPCODE_LRP, /* X X X */ OPCODE_MAD, /* X X X X X */ OPCODE_MAX, /* X X X X X */ OPCODE_MIN, /* X X X X X */ @@ -195,8 +196,8 @@ typedef enum prog_opcode { OPCODE_NOISE3, /* X */ OPCODE_NOISE4, /* X */ OPCODE_NOT, /* */ - OPCODE_NRM3, /* */ - OPCODE_NRM4, /* */ + OPCODE_NRM3, /* X */ + OPCODE_NRM4, /* X */ OPCODE_OR, /* */ OPCODE_PK2H, /* X */ OPCODE_PK2US, /* X */ @@ -208,7 +209,7 @@ typedef enum prog_opcode { OPCODE_PUSHA, /* 3 */ OPCODE_RCC, /* 1.1 */ OPCODE_RCP, /* X X X X X */ - OPCODE_RET, /* 2 2 */ + OPCODE_RET, /* 2 2 X */ OPCODE_RFL, /* X X */ OPCODE_RSQ, /* X X X X X */ OPCODE_SCS, /* X */ @@ -270,6 +271,22 @@ struct prog_src_register * instruction which allows per-component negation. */ GLuint Negate:4; + + /** + * Is the register two-dimensional. + * Two dimensional registers are of the + * REGISTER[index][index2] format. + * They are used by the geometry shaders where + * the first index is the index within an array + * and the second index is the semantic of the + * array, e.g. gl_PositionIn[index] would become + * INPUT[index][gl_PositionIn] + */ + GLuint HasIndex2:1; + GLuint RelAddr2:1; + GLint Index2:(INST_INDEX_BITS+1); /**< Extra bit here for sign bit. + * May be negative for relative + * addressing. */ }; @@ -384,7 +401,7 @@ struct prog_instruction /** * For BRA and CAL instructions, the location to jump to. * For BGNLOOP, points to ENDLOOP (and vice-versa). - * For BRK, points to BGNLOOP (which points to ENDLOOP). + * For BRK, points to ENDLOOP * For IF, points to ELSE or ENDIF. * For ELSE, points to ENDIF. */ diff --git a/mesalib/src/mesa/shader/prog_noise.c b/mesalib/src/mesa/program/prog_noise.c index 1713ddb5f..1713ddb5f 100644 --- a/mesalib/src/mesa/shader/prog_noise.c +++ b/mesalib/src/mesa/program/prog_noise.c diff --git a/mesalib/src/mesa/shader/prog_noise.h b/mesalib/src/mesa/program/prog_noise.h index c4779479f..dd7986efc 100644 --- a/mesalib/src/mesa/shader/prog_noise.h +++ b/mesalib/src/mesa/program/prog_noise.h @@ -25,6 +25,8 @@ #ifndef PROG_NOISE #define PROG_NOISE +#include "main/glheader.h" + extern GLfloat _mesa_noise1(GLfloat); extern GLfloat _mesa_noise2(GLfloat, GLfloat); extern GLfloat _mesa_noise3(GLfloat, GLfloat, GLfloat); diff --git a/mesalib/src/mesa/shader/prog_optimize.c b/mesalib/src/mesa/program/prog_optimize.c index 2941a17da..0dc779073 100644 --- a/mesalib/src/mesa/shader/prog_optimize.c +++ b/mesalib/src/mesa/program/prog_optimize.c @@ -34,44 +34,126 @@ #define MAX_LOOP_NESTING 50 - +/* MAX_PROGRAM_TEMPS is a low number (256), and we want to be able to + * register allocate many temporary values into that small number of + * temps. So allow large temporary indices coming into the register + * allocator. + */ +#define REG_ALLOCATE_MAX_PROGRAM_TEMPS ((1 << INST_INDEX_BITS) - 1) static GLboolean dbg = GL_FALSE; -/* Returns the mask of channels read from the given srcreg in this instruction. +#define NO_MASK 0xf + +/** + * Returns the mask of channels (bitmask of WRITEMASK_X,Y,Z,W) which + * are read from the given src in this instruction, We also provide + * one optional masks which may mask other components in the dst + * register */ static GLuint -get_src_arg_mask(const struct prog_instruction *inst, int arg) +get_src_arg_mask(const struct prog_instruction *inst, + GLuint arg, GLuint dst_mask) { - int writemask = inst->DstReg.WriteMask; + GLuint read_mask, channel_mask; + GLuint comp; - if (inst->CondUpdate) - writemask = WRITEMASK_XYZW; + ASSERT(arg < _mesa_num_inst_src_regs(inst->Opcode)); - switch (inst->Opcode) { - case OPCODE_MOV: - case OPCODE_ABS: - case OPCODE_ADD: - case OPCODE_MUL: - case OPCODE_SUB: - return writemask; - case OPCODE_RCP: - case OPCODE_SIN: - case OPCODE_COS: - case OPCODE_RSQ: - case OPCODE_POW: - case OPCODE_EX2: - return WRITEMASK_X; - case OPCODE_DP2: - return WRITEMASK_XY; - case OPCODE_DP3: - case OPCODE_XPD: - return WRITEMASK_XYZ; - default: - return WRITEMASK_XYZW; + /* Form the dst register, find the written channels */ + if (inst->CondUpdate) { + channel_mask = WRITEMASK_XYZW; + } + else { + switch (inst->Opcode) { + case OPCODE_MOV: + case OPCODE_MIN: + case OPCODE_MAX: + case OPCODE_ABS: + case OPCODE_ADD: + case OPCODE_MAD: + case OPCODE_MUL: + case OPCODE_SUB: + channel_mask = inst->DstReg.WriteMask & dst_mask; + break; + case OPCODE_RCP: + case OPCODE_SIN: + case OPCODE_COS: + case OPCODE_RSQ: + case OPCODE_POW: + case OPCODE_EX2: + case OPCODE_LOG: + channel_mask = WRITEMASK_X; + break; + case OPCODE_DP2: + channel_mask = WRITEMASK_XY; + break; + case OPCODE_DP3: + case OPCODE_XPD: + channel_mask = WRITEMASK_XYZ; + break; + default: + channel_mask = WRITEMASK_XYZW; + break; + } } + + /* Now, given the src swizzle and the written channels, find which + * components are actually read + */ + read_mask = 0x0; + for (comp = 0; comp < 4; ++comp) { + const GLuint coord = GET_SWZ(inst->SrcReg[arg].Swizzle, comp); + ASSERT(coord < 4); + if (channel_mask & (1 << comp) && coord <= SWIZZLE_W) + read_mask |= 1 << coord; + } + + return read_mask; } + +/** + * For a MOV instruction, compute a write mask when src register also has + * a mask + */ +static GLuint +get_dst_mask_for_mov(const struct prog_instruction *mov, GLuint src_mask) +{ + const GLuint mask = mov->DstReg.WriteMask; + GLuint comp; + GLuint updated_mask = 0x0; + + ASSERT(mov->Opcode == OPCODE_MOV); + + for (comp = 0; comp < 4; ++comp) { + GLuint src_comp; + if ((mask & (1 << comp)) == 0) + continue; + src_comp = GET_SWZ(mov->SrcReg[0].Swizzle, comp); + if ((src_mask & (1 << src_comp)) == 0) + continue; + updated_mask |= 1 << comp; + } + + return updated_mask; +} + + +/** + * Ensure that the swizzle is regular. That is, all of the swizzle + * terms are SWIZZLE_X,Y,Z,W and not SWIZZLE_ZERO or SWIZZLE_ONE. + */ +static GLboolean +is_swizzle_regular(GLuint swz) +{ + return GET_SWZ(swz,0) <= SWIZZLE_W && + GET_SWZ(swz,1) <= SWIZZLE_W && + GET_SWZ(swz,2) <= SWIZZLE_W && + GET_SWZ(swz,3) <= SWIZZLE_W; +} + + /** * In 'prog' remove instruction[i] if removeFlags[i] == TRUE. * \return number of instructions removed @@ -148,84 +230,15 @@ replace_regs(struct gl_program *prog, gl_register_file file, const GLint map[]) /** - * Consolidate temporary registers to use low numbers. For example, if the - * shader only uses temps 4, 5, 8, replace them with 0, 1, 2. - */ -static void -_mesa_consolidate_registers(struct gl_program *prog) -{ - GLboolean tempUsed[MAX_PROGRAM_TEMPS]; - GLint tempMap[MAX_PROGRAM_TEMPS]; - GLuint tempMax = 0, i; - - if (dbg) { - printf("Optimize: Begin register consolidation\n"); - } - - memset(tempUsed, 0, sizeof(tempUsed)); - - for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { - tempMap[i] = -1; - } - - /* set tempUsed[i] if temporary [i] is referenced */ - for (i = 0; i < prog->NumInstructions; i++) { - const struct prog_instruction *inst = prog->Instructions + i; - const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); - GLuint j; - for (j = 0; j < numSrc; j++) { - if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { - const GLuint index = inst->SrcReg[j].Index; - ASSERT(index < MAX_PROGRAM_TEMPS); - tempUsed[index] = GL_TRUE; - tempMax = MAX2(tempMax, index); - break; - } - } - if (inst->DstReg.File == PROGRAM_TEMPORARY) { - const GLuint index = inst->DstReg.Index; - ASSERT(index < MAX_PROGRAM_TEMPS); - tempUsed[index] = GL_TRUE; - tempMax = MAX2(tempMax, index); - } - } - - /* allocate a new index for each temp that's used */ - { - GLuint freeTemp = 0; - for (i = 0; i <= tempMax; i++) { - if (tempUsed[i]) { - tempMap[i] = freeTemp++; - /*printf("replace %u with %u\n", i, tempMap[i]);*/ - } - } - if (freeTemp == tempMax + 1) { - /* no consolidation possible */ - return; - } - if (dbg) { - printf("Replace regs 0..%u with 0..%u\n", tempMax, freeTemp-1); - } - } - - replace_regs(prog, PROGRAM_TEMPORARY, tempMap); - - if (dbg) { - printf("Optimize: End register consolidation\n"); - } -} - - -/** * Remove dead instructions from the given program. * This is very primitive for now. Basically look for temp registers * that are written to but never read. Remove any instructions that * write to such registers. Be careful with condition code setters. */ -static void -_mesa_remove_dead_code(struct gl_program *prog) +static GLboolean +_mesa_remove_dead_code_global(struct gl_program *prog) { - GLboolean tempRead[MAX_PROGRAM_TEMPS][4]; + GLboolean tempRead[REG_ALLOCATE_MAX_PROGRAM_TEMPS][4]; GLboolean *removeInst; /* per-instruction removal flag */ GLuint i, rem = 0, comp; @@ -250,8 +263,8 @@ _mesa_remove_dead_code(struct gl_program *prog) if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { const GLuint index = inst->SrcReg[j].Index; GLuint read_mask; - ASSERT(index < MAX_PROGRAM_TEMPS); - read_mask = get_src_arg_mask(inst, j); + ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS); + read_mask = get_src_arg_mask(inst, j, NO_MASK); if (inst->SrcReg[j].RelAddr) { if (dbg) @@ -260,25 +273,12 @@ _mesa_remove_dead_code(struct gl_program *prog) } for (comp = 0; comp < 4; comp++) { - GLuint swz = (inst->SrcReg[j].Swizzle >> (3 * comp)) & 0x7; - - if ((read_mask & (1 << comp)) == 0) + const GLuint swz = GET_SWZ(inst->SrcReg[j].Swizzle, comp); + ASSERT(swz < 4); + if ((read_mask & (1 << swz)) == 0) continue; - - switch (swz) { - case SWIZZLE_X: - tempRead[index][0] = GL_TRUE; - break; - case SWIZZLE_Y: - tempRead[index][1] = GL_TRUE; - break; - case SWIZZLE_Z: - tempRead[index][2] = GL_TRUE; - break; - case SWIZZLE_W: - tempRead[index][3] = GL_TRUE; - break; - } + if (swz <= SWIZZLE_W) + tempRead[index][swz] = GL_TRUE; } } } @@ -286,7 +286,7 @@ _mesa_remove_dead_code(struct gl_program *prog) /* check dst reg */ if (inst->DstReg.File == PROGRAM_TEMPORARY) { const GLuint index = inst->DstReg.Index; - ASSERT(index < MAX_PROGRAM_TEMPS); + ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS); if (inst->DstReg.RelAddr) { if (dbg) @@ -348,10 +348,11 @@ _mesa_remove_dead_code(struct gl_program *prog) done: free(removeInst); + return rem != 0; } -enum temp_use +enum inst_use { READ, WRITE, @@ -359,13 +360,19 @@ enum temp_use END }; + /** - * Scan forward in program from 'start' for the next occurance of TEMP[index]. + * Scan forward in program from 'start' for the next occurances of TEMP[index]. + * We look if an instruction reads the component given by the masks and if they + * are overwritten. * Return READ, WRITE, FLOW or END to indicate the next usage or an indicator * that we can't look further. */ -static enum temp_use -find_next_temp_use(const struct gl_program *prog, GLuint start, GLuint index) +static enum inst_use +find_next_use(const struct gl_program *prog, + GLuint start, + GLuint index, + GLuint mask) { GLuint i; @@ -373,30 +380,50 @@ find_next_temp_use(const struct gl_program *prog, GLuint start, GLuint index) const struct prog_instruction *inst = prog->Instructions + i; switch (inst->Opcode) { case OPCODE_BGNLOOP: - case OPCODE_ENDLOOP: case OPCODE_BGNSUB: + case OPCODE_BRA: + case OPCODE_CAL: + case OPCODE_CONT: + case OPCODE_IF: + case OPCODE_ELSE: + case OPCODE_ENDIF: + case OPCODE_ENDLOOP: case OPCODE_ENDSUB: + case OPCODE_RET: return FLOW; + case OPCODE_END: + return END; default: { const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); GLuint j; for (j = 0; j < numSrc; j++) { - if (inst->SrcReg[j].File == PROGRAM_TEMPORARY && - inst->SrcReg[j].Index == index) + if (inst->SrcReg[j].RelAddr || + (inst->SrcReg[j].File == PROGRAM_TEMPORARY && + inst->SrcReg[j].Index == index && + (get_src_arg_mask(inst,j,NO_MASK) & mask))) return READ; } - if (inst->DstReg.File == PROGRAM_TEMPORARY && - inst->DstReg.Index == index) - return WRITE; + if (_mesa_num_inst_dst_regs(inst->Opcode) == 1 && + inst->DstReg.File == PROGRAM_TEMPORARY && + inst->DstReg.Index == index) { + mask &= ~inst->DstReg.WriteMask; + if (mask == 0) + return WRITE; + } } } } - return END; } -static GLboolean _mesa_is_flow_control_opcode(enum prog_opcode opcode) + +/** + * Is the given instruction opcode a flow-control opcode? + * XXX maybe move this into prog_instruction.[ch] + */ +static GLboolean +_mesa_is_flow_control_opcode(enum prog_opcode opcode) { switch (opcode) { case OPCODE_BGNLOOP: @@ -417,6 +444,37 @@ static GLboolean _mesa_is_flow_control_opcode(enum prog_opcode opcode) } } + +/** + * Test if the given instruction is a simple MOV (no conditional updating, + * not relative addressing, no negation/abs, etc). + */ +static GLboolean +can_downward_mov_be_modifed(const struct prog_instruction *mov) +{ + return + mov->Opcode == OPCODE_MOV && + mov->CondUpdate == GL_FALSE && + mov->SrcReg[0].RelAddr == 0 && + mov->SrcReg[0].Negate == 0 && + mov->SrcReg[0].Abs == 0 && + mov->SrcReg[0].HasIndex2 == 0 && + mov->SrcReg[0].RelAddr2 == 0 && + mov->DstReg.RelAddr == 0 && + mov->DstReg.CondMask == COND_TR && + mov->SaturateMode == SATURATE_OFF; +} + + +static GLboolean +can_upward_mov_be_modifed(const struct prog_instruction *mov) +{ + return + can_downward_mov_be_modifed(mov) && + mov->DstReg.File == PROGRAM_TEMPORARY; +} + + /** * Try to remove use of extraneous MOV instructions, to free them up for dead * code removal. @@ -444,14 +502,15 @@ _mesa_remove_extra_move_use(struct gl_program *prog) for (i = 0; i + 1 < prog->NumInstructions; i++) { const struct prog_instruction *mov = prog->Instructions + i; + GLuint dst_mask, src_mask; + if (can_upward_mov_be_modifed(mov) == GL_FALSE) + continue; - if (mov->Opcode != OPCODE_MOV || - mov->DstReg.File != PROGRAM_TEMPORARY || - mov->DstReg.RelAddr || - mov->DstReg.CondMask != COND_TR || - mov->SaturateMode != SATURATE_OFF || - mov->SrcReg[0].RelAddr) - continue; + /* Scanning the code, we maintain the components which are still active in + * these two masks + */ + dst_mask = mov->DstReg.WriteMask; + src_mask = get_src_arg_mask(mov, 0, NO_MASK); /* Walk through remaining instructions until the or src reg gets * rewritten or we get into some flow-control, eliminating the use of @@ -459,61 +518,60 @@ _mesa_remove_extra_move_use(struct gl_program *prog) */ for (j = i + 1; j < prog->NumInstructions; j++) { struct prog_instruction *inst2 = prog->Instructions + j; - GLuint arg; + GLuint arg; if (_mesa_is_flow_control_opcode(inst2->Opcode)) break; /* First rewrite this instruction's args if appropriate. */ for (arg = 0; arg < _mesa_num_inst_src_regs(inst2->Opcode); arg++) { - int comp; - int read_mask = get_src_arg_mask(inst2, arg); + GLuint comp, read_mask; if (inst2->SrcReg[arg].File != mov->DstReg.File || inst2->SrcReg[arg].Index != mov->DstReg.Index || inst2->SrcReg[arg].RelAddr || inst2->SrcReg[arg].Abs) continue; + read_mask = get_src_arg_mask(inst2, arg, NO_MASK); - /* Check that all the sources for this arg of inst2 come from inst1 - * or constants. - */ - for (comp = 0; comp < 4; comp++) { - int src_swz = GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); - - /* If the MOV didn't write that channel, can't use it. */ - if ((read_mask & (1 << comp)) && - src_swz <= SWIZZLE_W && - (mov->DstReg.WriteMask & (1 << src_swz)) == 0) - break; - } - if (comp != 4) - continue; - - /* Adjust the swizzles of inst2 to point at MOV's source */ - for (comp = 0; comp < 4; comp++) { - int inst2_swz = GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); - - if (inst2_swz <= SWIZZLE_W) { - GLuint s = GET_SWZ(mov->SrcReg[0].Swizzle, inst2_swz); - inst2->SrcReg[arg].Swizzle &= ~(7 << (3 * comp)); - inst2->SrcReg[arg].Swizzle |= s << (3 * comp); - inst2->SrcReg[arg].Negate ^= (((mov->SrcReg[0].Negate >> - inst2_swz) & 0x1) << comp); - } - } - inst2->SrcReg[arg].File = mov->SrcReg[0].File; - inst2->SrcReg[arg].Index = mov->SrcReg[0].Index; + /* Adjust the swizzles of inst2 to point at MOV's source if ALL the + * components read still come from the mov instructions + */ + if (is_swizzle_regular(inst2->SrcReg[arg].Swizzle) && + (read_mask & dst_mask) == read_mask) { + for (comp = 0; comp < 4; comp++) { + const GLuint inst2_swz = + GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); + const GLuint s = GET_SWZ(mov->SrcReg[0].Swizzle, inst2_swz); + inst2->SrcReg[arg].Swizzle &= ~(7 << (3 * comp)); + inst2->SrcReg[arg].Swizzle |= s << (3 * comp); + inst2->SrcReg[arg].Negate ^= (((mov->SrcReg[0].Negate >> + inst2_swz) & 0x1) << comp); + } + inst2->SrcReg[arg].File = mov->SrcReg[0].File; + inst2->SrcReg[arg].Index = mov->SrcReg[0].Index; + } } - /* If this instruction overwrote part of the move, our time is up. */ - if ((inst2->DstReg.File == mov->DstReg.File && - (inst2->DstReg.RelAddr || - inst2->DstReg.Index == mov->DstReg.Index)) || - (inst2->DstReg.File == mov->SrcReg[0].File && - (inst2->DstReg.RelAddr || - inst2->DstReg.Index == mov->SrcReg[0].Index))) - break; + /* The source of MOV is written. This potentially deactivates some + * components from the src and dst of the MOV instruction + */ + if (inst2->DstReg.File == mov->DstReg.File && + (inst2->DstReg.RelAddr || + inst2->DstReg.Index == mov->DstReg.Index)) { + dst_mask &= ~inst2->DstReg.WriteMask; + src_mask = get_src_arg_mask(mov, 0, dst_mask); + } + + /* Idem when the destination of mov is written */ + if (inst2->DstReg.File == mov->SrcReg[0].File && + (inst2->DstReg.RelAddr || + inst2->DstReg.Index == mov->SrcReg[0].Index)) { + src_mask &= ~inst2->DstReg.WriteMask; + dst_mask &= get_dst_mask_for_mov(mov, src_mask); + } + if (dst_mask == 0) + break; } } @@ -523,14 +581,151 @@ _mesa_remove_extra_move_use(struct gl_program *prog) } } + +/** + * Complements dead_code_global. Try to remove code in block of code by + * carefully monitoring the swizzles. Both functions should be merged into one + * with a proper control flow graph + */ +static GLboolean +_mesa_remove_dead_code_local(struct gl_program *prog) +{ + GLboolean *removeInst; + GLuint i, arg, rem = 0; + + removeInst = (GLboolean *) + calloc(1, prog->NumInstructions * sizeof(GLboolean)); + + for (i = 0; i < prog->NumInstructions; i++) { + const struct prog_instruction *inst = prog->Instructions + i; + const GLuint index = inst->DstReg.Index; + const GLuint mask = inst->DstReg.WriteMask; + enum inst_use use; + + /* We must deactivate the pass as soon as some indirection is used */ + if (inst->DstReg.RelAddr) + goto done; + for (arg = 0; arg < _mesa_num_inst_src_regs(inst->Opcode); arg++) + if (inst->SrcReg[arg].RelAddr) + goto done; + + if (_mesa_is_flow_control_opcode(inst->Opcode) || + _mesa_num_inst_dst_regs(inst->Opcode) == 0 || + inst->DstReg.File != PROGRAM_TEMPORARY || + inst->DstReg.RelAddr) + continue; + + use = find_next_use(prog, i+1, index, mask); + if (use == WRITE || use == END) + removeInst[i] = GL_TRUE; + } + + rem = remove_instructions(prog, removeInst); + +done: + free(removeInst); + return rem != 0; +} + + +/** + * Try to inject the destination of mov as the destination of inst and recompute + * the swizzles operators for the sources of inst if required. Return GL_TRUE + * of the substitution was possible, GL_FALSE otherwise + */ +static GLboolean +_mesa_merge_mov_into_inst(struct prog_instruction *inst, + const struct prog_instruction *mov) +{ + /* Indirection table which associates destination and source components for + * the mov instruction + */ + const GLuint mask = get_src_arg_mask(mov, 0, NO_MASK); + + /* Some components are not written by inst. We cannot remove the mov */ + if (mask != (inst->DstReg.WriteMask & mask)) + return GL_FALSE; + + /* Depending on the instruction, we may need to recompute the swizzles. + * Also, some other instructions (like TEX) are not linear. We will only + * consider completely active sources and destinations + */ + switch (inst->Opcode) { + + /* Carstesian instructions: we compute the swizzle */ + case OPCODE_MOV: + case OPCODE_MIN: + case OPCODE_MAX: + case OPCODE_ABS: + case OPCODE_ADD: + case OPCODE_MAD: + case OPCODE_MUL: + case OPCODE_SUB: + { + GLuint dst_to_src_comp[4] = {0,0,0,0}; + GLuint dst_comp, arg; + for (dst_comp = 0; dst_comp < 4; ++dst_comp) { + if (mov->DstReg.WriteMask & (1 << dst_comp)) { + const GLuint src_comp = GET_SWZ(mov->SrcReg[0].Swizzle, dst_comp); + ASSERT(src_comp < 4); + dst_to_src_comp[dst_comp] = src_comp; + } + } + + /* Patch each source of the instruction */ + for (arg = 0; arg < _mesa_num_inst_src_regs(inst->Opcode); arg++) { + const GLuint arg_swz = inst->SrcReg[arg].Swizzle; + inst->SrcReg[arg].Swizzle = 0; + + /* Reset each active component of the swizzle */ + for (dst_comp = 0; dst_comp < 4; ++dst_comp) { + GLuint src_comp, arg_comp; + if ((mov->DstReg.WriteMask & (1 << dst_comp)) == 0) + continue; + src_comp = dst_to_src_comp[dst_comp]; + ASSERT(src_comp < 4); + arg_comp = GET_SWZ(arg_swz, src_comp); + ASSERT(arg_comp < 4); + inst->SrcReg[arg].Swizzle |= arg_comp << (3*dst_comp); + } + } + inst->DstReg = mov->DstReg; + return GL_TRUE; + } + + /* Dot products and scalar instructions: we only change the destination */ + case OPCODE_RCP: + case OPCODE_SIN: + case OPCODE_COS: + case OPCODE_RSQ: + case OPCODE_POW: + case OPCODE_EX2: + case OPCODE_LOG: + case OPCODE_DP2: + case OPCODE_DP3: + case OPCODE_DP4: + inst->DstReg = mov->DstReg; + return GL_TRUE; + + /* All other instructions require fully active components with no swizzle */ + default: + if (mov->SrcReg[0].Swizzle != SWIZZLE_XYZW || + inst->DstReg.WriteMask != WRITEMASK_XYZW) + return GL_FALSE; + inst->DstReg = mov->DstReg; + return GL_TRUE; + } +} + + /** * Try to remove extraneous MOV instructions from the given program. */ -static void +static GLboolean _mesa_remove_extra_moves(struct gl_program *prog) { GLboolean *removeInst; /* per-instruction removal flag */ - GLuint i, rem, loopNesting = 0, subroutineNesting = 0; + GLuint i, rem = 0, nesting = 0; if (dbg) { printf("Optimize: Begin remove extra moves\n"); @@ -549,29 +744,28 @@ _mesa_remove_extra_moves(struct gl_program *prog) */ for (i = 0; i < prog->NumInstructions; i++) { - const struct prog_instruction *inst = prog->Instructions + i; + const struct prog_instruction *mov = prog->Instructions + i; - switch (inst->Opcode) { + switch (mov->Opcode) { case OPCODE_BGNLOOP: - loopNesting++; - break; - case OPCODE_ENDLOOP: - loopNesting--; - break; case OPCODE_BGNSUB: - subroutineNesting++; + case OPCODE_IF: + nesting++; break; + case OPCODE_ENDLOOP: case OPCODE_ENDSUB: - subroutineNesting--; + case OPCODE_ENDIF: + nesting--; break; case OPCODE_MOV: if (i > 0 && - loopNesting == 0 && - subroutineNesting == 0 && - inst->SrcReg[0].File == PROGRAM_TEMPORARY && - inst->SrcReg[0].Swizzle == SWIZZLE_XYZW) { + can_downward_mov_be_modifed(mov) && + mov->SrcReg[0].File == PROGRAM_TEMPORARY && + nesting == 0) + { + /* see if this MOV can be removed */ - const GLuint tempIndex = inst->SrcReg[0].Index; + const GLuint id = mov->SrcReg[0].Index; struct prog_instruction *prevInst; GLuint prevI; @@ -582,11 +776,13 @@ _mesa_remove_extra_moves(struct gl_program *prog) prevInst = prog->Instructions + prevI; if (prevInst->DstReg.File == PROGRAM_TEMPORARY && - prevInst->DstReg.Index == tempIndex && - prevInst->DstReg.WriteMask == WRITEMASK_XYZW) { + prevInst->DstReg.Index == id && + prevInst->DstReg.RelAddr == 0 && + prevInst->DstReg.CondSrc == 0 && + prevInst->DstReg.CondMask == COND_TR) { - enum temp_use next_use = - find_next_temp_use(prog, i + 1, tempIndex); + const GLuint dst_mask = prevInst->DstReg.WriteMask; + enum inst_use next_use = find_next_use(prog, i+1, id, dst_mask); if (next_use == WRITE || next_use == END) { /* OK, we can safely remove this MOV instruction. @@ -596,18 +792,13 @@ _mesa_remove_extra_moves(struct gl_program *prog) * Into: * prevI: FOO z, x, y; */ - - /* patch up prev inst */ - prevInst->DstReg.File = inst->DstReg.File; - prevInst->DstReg.Index = inst->DstReg.Index; - - /* flag this instruction for removal */ - removeInst[i] = GL_TRUE; - - if (dbg) { - printf("Remove MOV at %u\n", i); - printf("new prev inst %u: ", prevI); - _mesa_print_instruction(prevInst); + if (_mesa_merge_mov_into_inst(prevInst, mov)) { + removeInst[i] = GL_TRUE; + if (dbg) { + printf("Remove MOV at %u\n", i); + printf("new prev inst %u: ", prevI); + _mesa_print_instruction(prevInst); + } } } } @@ -627,6 +818,8 @@ _mesa_remove_extra_moves(struct gl_program *prog) printf("Optimize: End remove extra moves. %u instructions removed\n", rem); /*_mesa_print_program(prog);*/ } + + return rem != 0; } @@ -642,7 +835,7 @@ struct interval struct interval_list { GLuint Num; - struct interval Intervals[MAX_PROGRAM_TEMPS]; + struct interval Intervals[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; }; @@ -713,6 +906,7 @@ compare_start(const void *a, const void *b) return 0; } + /** sort the interval list according to interval starts */ static void sort_interval_list_by_start(struct interval_list *list) @@ -728,15 +922,33 @@ sort_interval_list_by_start(struct interval_list *list) #endif } +struct loop_info +{ + GLuint Start, End; /**< Start, end instructions of loop */ +}; /** * Update the intermediate interval info for register 'index' and * instruction 'ic'. */ static void -update_interval(GLint intBegin[], GLint intEnd[], GLuint index, GLuint ic) +update_interval(GLint intBegin[], GLint intEnd[], + struct loop_info *loopStack, GLuint loopStackDepth, + GLuint index, GLuint ic) { - ASSERT(index < MAX_PROGRAM_TEMPS); + int i; + + /* If the register is used in a loop, extend its lifetime through the end + * of the outermost loop that doesn't contain its definition. + */ + for (i = 0; i < loopStackDepth; i++) { + if (intBegin[index] < loopStack[i].Start) { + ic = loopStack[i].End; + break; + } + } + + ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS); if (intBegin[index] == -1) { ASSERT(intEnd[index] == -1); intBegin[index] = intEnd[index] = ic; @@ -753,18 +965,14 @@ update_interval(GLint intBegin[], GLint intEnd[], GLuint index, GLuint ic) GLboolean _mesa_find_temp_intervals(const struct prog_instruction *instructions, GLuint numInstructions, - GLint intBegin[MAX_PROGRAM_TEMPS], - GLint intEnd[MAX_PROGRAM_TEMPS]) + GLint intBegin[REG_ALLOCATE_MAX_PROGRAM_TEMPS], + GLint intEnd[REG_ALLOCATE_MAX_PROGRAM_TEMPS]) { - struct loop_info - { - GLuint Start, End; /**< Start, end instructions of loop */ - }; struct loop_info loopStack[MAX_LOOP_NESTING]; GLuint loopStackDepth = 0; GLuint i; - for (i = 0; i < MAX_PROGRAM_TEMPS; i++){ + for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++){ intBegin[i] = intEnd[i] = -1; } @@ -790,24 +998,16 @@ _mesa_find_temp_intervals(const struct prog_instruction *instructions, const GLuint index = inst->SrcReg[j].Index; if (inst->SrcReg[j].RelAddr) return GL_FALSE; - update_interval(intBegin, intEnd, index, i); - if (loopStackDepth > 0) { - /* extend temp register's interval to end of loop */ - GLuint loopEnd = loopStack[loopStackDepth - 1].End; - update_interval(intBegin, intEnd, index, loopEnd); - } + update_interval(intBegin, intEnd, loopStack, loopStackDepth, + index, i); } } if (inst->DstReg.File == PROGRAM_TEMPORARY) { const GLuint index = inst->DstReg.Index; if (inst->DstReg.RelAddr) return GL_FALSE; - update_interval(intBegin, intEnd, index, i); - if (loopStackDepth > 0) { - /* extend temp register's interval to end of loop */ - GLuint loopEnd = loopStack[loopStackDepth - 1].End; - update_interval(intBegin, intEnd, index, loopEnd); - } + update_interval(intBegin, intEnd, loopStack, loopStackDepth, + index, i); } } } @@ -827,7 +1027,8 @@ static GLboolean find_live_intervals(struct gl_program *prog, struct interval_list *liveIntervals) { - GLint intBegin[MAX_PROGRAM_TEMPS], intEnd[MAX_PROGRAM_TEMPS]; + GLint intBegin[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; + GLint intEnd[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; GLuint i; /* @@ -847,7 +1048,7 @@ find_live_intervals(struct gl_program *prog, /* Build live intervals list from intermediate arrays */ liveIntervals->Num = 0; - for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { + for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++) { if (intBegin[i] >= 0) { struct interval inv; inv.Reg = i; @@ -883,10 +1084,10 @@ find_live_intervals(struct gl_program *prog, /** Scan the array of used register flags to find free entry */ static GLint -alloc_register(GLboolean usedRegs[MAX_PROGRAM_TEMPS]) +alloc_register(GLboolean usedRegs[REG_ALLOCATE_MAX_PROGRAM_TEMPS]) { GLuint k; - for (k = 0; k < MAX_PROGRAM_TEMPS; k++) { + for (k = 0; k < REG_ALLOCATE_MAX_PROGRAM_TEMPS; k++) { if (!usedRegs[k]) { usedRegs[k] = GL_TRUE; return k; @@ -908,8 +1109,8 @@ static void _mesa_reallocate_registers(struct gl_program *prog) { struct interval_list liveIntervals; - GLint registerMap[MAX_PROGRAM_TEMPS]; - GLboolean usedRegs[MAX_PROGRAM_TEMPS]; + GLint registerMap[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; + GLboolean usedRegs[REG_ALLOCATE_MAX_PROGRAM_TEMPS]; GLuint i; GLint maxTemp = -1; @@ -918,7 +1119,7 @@ _mesa_reallocate_registers(struct gl_program *prog) _mesa_print_program(prog); } - for (i = 0; i < MAX_PROGRAM_TEMPS; i++){ + for (i = 0; i < REG_ALLOCATE_MAX_PROGRAM_TEMPS; i++){ registerMap[i] = -1; usedRegs[i] = GL_FALSE; } @@ -1013,6 +1214,17 @@ _mesa_reallocate_registers(struct gl_program *prog) } +#if 0 +static void +print_it(GLcontext *ctx, struct gl_program *program, const char *txt) { + fprintf(stderr, "%s (%u inst):\n", txt, program->NumInstructions); + _mesa_print_program(program); + _mesa_print_program_parameters(ctx, program); + fprintf(stderr, "\n\n"); +} +#endif + + /** * Apply optimizations to the given program to eliminate unnecessary * instructions, temp regs, etc. @@ -1020,16 +1232,19 @@ _mesa_reallocate_registers(struct gl_program *prog) void _mesa_optimize_program(GLcontext *ctx, struct gl_program *program) { - _mesa_remove_extra_move_use(program); - - if (1) - _mesa_remove_dead_code(program); - - if (0) /* not tested much yet */ - _mesa_remove_extra_moves(program); - - if (0) - _mesa_consolidate_registers(program); - else + GLboolean any_change; + + /* Stop when no modifications were output */ + do { + any_change = GL_FALSE; + _mesa_remove_extra_move_use(program); + if (_mesa_remove_dead_code_global(program)) + any_change = GL_TRUE; + if (_mesa_remove_extra_moves(program)) + any_change = GL_TRUE; + if (_mesa_remove_dead_code_local(program)) + any_change = GL_TRUE; _mesa_reallocate_registers(program); + } while (any_change); } + diff --git a/mesalib/src/mesa/shader/prog_optimize.h b/mesalib/src/mesa/program/prog_optimize.h index 43894a272..06cd9cb2c 100644 --- a/mesalib/src/mesa/shader/prog_optimize.h +++ b/mesalib/src/mesa/program/prog_optimize.h @@ -27,6 +27,7 @@ #include "main/config.h" +#include "main/mtypes.h" struct gl_program; diff --git a/mesalib/src/mesa/shader/prog_parameter.c b/mesalib/src/mesa/program/prog_parameter.c index 25bb4f3d4..6bf8a081b 100644 --- a/mesalib/src/mesa/shader/prog_parameter.c +++ b/mesalib/src/mesa/program/prog_parameter.c @@ -284,99 +284,13 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, return pos; } - -/** - * Add a uniform to the parameter list. - * Note that if the uniform is an array, size may be greater than - * what's implied by the datatype. - * \param name uniform's name - * \param size number of floats to allocate - * \param datatype GL_FLOAT_VEC3, GL_FLOAT_MAT4, etc. - */ -GLint -_mesa_add_uniform(struct gl_program_parameter_list *paramList, - const char *name, GLuint size, GLenum datatype, - const GLfloat *values) -{ - GLint i = _mesa_lookup_parameter_index(paramList, -1, name); - ASSERT(datatype != GL_NONE); - if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_UNIFORM) { - ASSERT(paramList->Parameters[i].Size == size); - ASSERT(paramList->Parameters[i].DataType == datatype); - /* already in list */ - return i; - } - else { - i = _mesa_add_parameter(paramList, PROGRAM_UNIFORM, name, - size, datatype, values, NULL, 0x0); - return i; - } -} - - -/** - * Mark the named uniform as 'used'. - */ -void -_mesa_use_uniform(struct gl_program_parameter_list *paramList, - const char *name) -{ - GLuint i; - for (i = 0; i < paramList->NumParameters; i++) { - struct gl_program_parameter *p = paramList->Parameters + i; - if ((p->Type == PROGRAM_UNIFORM || p->Type == PROGRAM_SAMPLER) && - strcmp(p->Name, name) == 0) { - p->Used = GL_TRUE; - /* Note that large uniforms may occupy several slots so we're - * not done searching yet. - */ - } - } -} - - -/** - * Add a sampler to the parameter list. - * \param name uniform's name - * \param datatype GL_SAMPLER_2D, GL_SAMPLER_2D_RECT_ARB, etc. - * \param index the sampler number (as seen in TEX instructions) - * \return sampler index (starting at zero) or -1 if error - */ -GLint -_mesa_add_sampler(struct gl_program_parameter_list *paramList, - const char *name, GLenum datatype) -{ - GLint i = _mesa_lookup_parameter_index(paramList, -1, name); - if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_SAMPLER) { - ASSERT(paramList->Parameters[i].Size == 1); - ASSERT(paramList->Parameters[i].DataType == datatype); - /* already in list */ - return (GLint) paramList->ParameterValues[i][0]; - } - else { - GLuint i; - const GLint size = 1; /* a sampler is basically a texture unit number */ - GLfloat value[4]; - GLint numSamplers = 0; - for (i = 0; i < paramList->NumParameters; i++) { - if (paramList->Parameters[i].Type == PROGRAM_SAMPLER) - numSamplers++; - } - value[0] = (GLfloat) numSamplers; - value[1] = value[2] = value[3] = 0.0F; - (void) _mesa_add_parameter(paramList, PROGRAM_SAMPLER, name, - size, datatype, value, NULL, 0x0); - return numSamplers; - } -} - - /** * Add parameter representing a varying variable. */ GLint _mesa_add_varying(struct gl_program_parameter_list *paramList, - const char *name, GLuint size, GLbitfield flags) + const char *name, GLuint size, GLenum datatype, + GLbitfield flags) { GLint i = _mesa_lookup_parameter_index(paramList, -1, name); if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_VARYING) { @@ -386,7 +300,7 @@ _mesa_add_varying(struct gl_program_parameter_list *paramList, else { /*assert(size == 4);*/ i = _mesa_add_parameter(paramList, PROGRAM_VARYING, name, - size, GL_NONE, NULL, NULL, flags); + size, datatype, NULL, NULL, flags); return i; } } @@ -568,8 +482,10 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list, assert(vSize >= 1); assert(vSize <= 4); - if (!list) - return -1; + if (!list) { + *posOut = -1; + return GL_FALSE; + } for (i = 0; i < list->NumParameters; i++) { if (list->Parameters[i].Type == PROGRAM_CONSTANT) { @@ -590,7 +506,7 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list, if (vSize == 1) { /* look for v[0] anywhere within float[4] value */ GLuint j; - for (j = 0; j < 4; j++) { + for (j = 0; j < list->Parameters[i].Size; j++) { if (list->ParameterValues[i][j] == v[0]) { /* found it */ *posOut = i; @@ -656,7 +572,6 @@ _mesa_clone_parameter_list(const struct gl_program_parameter_list *list) list->ParameterValues[i], NULL, 0x0); ASSERT(j >= 0); pCopy = clone->Parameters + j; - pCopy->Used = p->Used; pCopy->Flags = p->Flags; /* copy state indexes */ if (p->Type == PROGRAM_STATE_VAR) { diff --git a/mesalib/src/mesa/shader/prog_parameter.h b/mesalib/src/mesa/program/prog_parameter.h index 1111c8597..10cbbe57a 100644 --- a/mesalib/src/mesa/shader/prog_parameter.h +++ b/mesalib/src/mesa/program/prog_parameter.h @@ -64,8 +64,7 @@ struct gl_program_parameter * The next program parameter's Size will be Size-4 of this parameter. */ GLuint Size; - GLboolean Used; /**< Helper flag for GLSL uniform tracking */ - GLboolean Initialized; /**< Has the ParameterValue[] been set? */ + GLboolean Initialized; /**< debug: Has the ParameterValue[] been set? */ GLbitfield Flags; /**< Bitmask of PROG_PARAM_*_BIT */ /** * A sequence of STATE_* tokens and integers to identify GL state. @@ -132,21 +131,9 @@ _mesa_add_unnamed_constant(struct gl_program_parameter_list *paramList, GLuint *swizzleOut); extern GLint -_mesa_add_uniform(struct gl_program_parameter_list *paramList, - const char *name, GLuint size, GLenum datatype, - const GLfloat *values); - -extern void -_mesa_use_uniform(struct gl_program_parameter_list *paramList, - const char *name); - -extern GLint -_mesa_add_sampler(struct gl_program_parameter_list *paramList, - const char *name, GLenum datatype); - -extern GLint _mesa_add_varying(struct gl_program_parameter_list *paramList, - const char *name, GLuint size, GLbitfield flags); + const char *name, GLuint size, GLenum datatype, + GLbitfield flags); extern GLint _mesa_add_attribute(struct gl_program_parameter_list *paramList, diff --git a/mesalib/src/mesa/shader/prog_parameter_layout.c b/mesalib/src/mesa/program/prog_parameter_layout.c index a88857383..d7dc97edb 100644 --- a/mesalib/src/mesa/shader/prog_parameter_layout.c +++ b/mesalib/src/mesa/program/prog_parameter_layout.c @@ -28,6 +28,7 @@ * \author Ian Romanick <ian.d.romanick@intel.com> */ +#include "main/compiler.h" #include "main/mtypes.h" #include "prog_parameter.h" #include "prog_parameter_layout.h" diff --git a/mesalib/src/mesa/shader/prog_parameter_layout.h b/mesalib/src/mesa/program/prog_parameter_layout.h index 99a7b6c72..99a7b6c72 100644 --- a/mesalib/src/mesa/shader/prog_parameter_layout.h +++ b/mesalib/src/mesa/program/prog_parameter_layout.h diff --git a/mesalib/src/mesa/shader/prog_print.c b/mesalib/src/mesa/program/prog_print.c index f66c240ce..00aa6de96 100644 --- a/mesalib/src/mesa/shader/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -265,7 +265,8 @@ arb_output_attrib_string(GLint index, GLenum progType) */ static const char * reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, - GLboolean relAddr, const struct gl_program *prog) + GLboolean relAddr, const struct gl_program *prog, + GLboolean hasIndex2, GLboolean relAddr2, GLint index2) { static char str[100]; const char *addr = relAddr ? "ADDR+" : ""; @@ -275,6 +276,11 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, switch (mode) { case PROG_PRINT_DEBUG: sprintf(str, "%s[%s%d]", file_string(f, mode), addr, index); + if (hasIndex2) { + int offset = strlen(str); + const char *addr2 = relAddr2 ? "ADDR+" : ""; + sprintf(str+offset, "[%s%d]", addr2, index2); + } break; case PROG_PRINT_ARB: @@ -478,7 +484,8 @@ fprint_dst_reg(FILE * f, { fprintf(f, "%s%s", reg_string((gl_register_file) dstReg->File, - dstReg->Index, mode, dstReg->RelAddr, prog), + dstReg->Index, mode, dstReg->RelAddr, prog, + GL_FALSE, GL_FALSE, 0), _mesa_writemask_string(dstReg->WriteMask)); if (dstReg->CondMask != COND_TR) { @@ -508,7 +515,8 @@ fprint_src_reg(FILE *f, fprintf(f, "%s%s%s%s", abs, reg_string((gl_register_file) srcReg->File, - srcReg->Index, mode, srcReg->RelAddr, prog), + srcReg->Index, mode, srcReg->RelAddr, prog, + srcReg->HasIndex2, srcReg->RelAddr2, srcReg->Index2), _mesa_swizzle_string(srcReg->Swizzle, srcReg->Negate, GL_FALSE), abs); @@ -532,12 +540,12 @@ fprint_comment(FILE *f, const struct prog_instruction *inst) } -static void -fprint_alu_instruction(FILE *f, - const struct prog_instruction *inst, - const char *opcode_string, GLuint numRegs, - gl_prog_print_mode mode, - const struct gl_program *prog) +void +_mesa_fprint_alu_instruction(FILE *f, + const struct prog_instruction *inst, + const char *opcode_string, GLuint numRegs, + gl_prog_print_mode mode, + const struct gl_program *prog) { GLuint j; @@ -574,8 +582,8 @@ void _mesa_print_alu_instruction(const struct prog_instruction *inst, const char *opcode_string, GLuint numRegs) { - fprint_alu_instruction(stderr, inst, opcode_string, - numRegs, PROG_PRINT_DEBUG, NULL); + _mesa_fprint_alu_instruction(stderr, inst, opcode_string, + numRegs, PROG_PRINT_DEBUG, NULL); } @@ -773,20 +781,26 @@ _mesa_fprint_instruction_opt(FILE *f, fprintf(f, "# %s\n", inst->Comment); } break; + case OPCODE_EMIT_VERTEX: + fprintf(f, "EMIT_VERTEX\n"); + break; + case OPCODE_END_PRIMITIVE: + fprintf(f, "END_PRIMITIVE\n"); + break; /* XXX may need other special-case instructions */ default: if (inst->Opcode < MAX_OPCODE) { /* typical alu instruction */ - fprint_alu_instruction(f, inst, - _mesa_opcode_string(inst->Opcode), - _mesa_num_inst_src_regs(inst->Opcode), - mode, prog); + _mesa_fprint_alu_instruction(f, inst, + _mesa_opcode_string(inst->Opcode), + _mesa_num_inst_src_regs(inst->Opcode), + mode, prog); } else { - fprint_alu_instruction(f, inst, - _mesa_opcode_string(inst->Opcode), - 3/*_mesa_num_inst_src_regs(inst->Opcode)*/, - mode, prog); + _mesa_fprint_alu_instruction(f, inst, + _mesa_opcode_string(inst->Opcode), + 3/*_mesa_num_inst_src_regs(inst->Opcode)*/, + mode, prog); } break; } @@ -842,6 +856,8 @@ _mesa_fprint_program_opt(FILE *f, else fprintf(f, "# Fragment Program/Shader %u\n", prog->Id); break; + case MESA_GEOMETRY_PROGRAM: + fprintf(f, "# Geometry Shader\n"); } for (i = 0; i < prog->NumInstructions; i++) { @@ -876,7 +892,7 @@ binary(GLbitfield64 val) static char buf[80]; GLint i, len = 0; for (i = 63; i >= 0; --i) { - if (val & (1ULL << i)) + if (val & (BITFIELD64_BIT(i))) buf[len++] = '1'; else if (len > 0 || i == 0) buf[len++] = '0'; @@ -901,12 +917,15 @@ _mesa_fprint_program_parameters(FILE *f, fprintf(f, "InputsRead: 0x%x (0b%s)\n", prog->InputsRead, binary(prog->InputsRead)); fprintf(f, "OutputsWritten: 0x%llx (0b%s)\n", - prog->OutputsWritten, binary(prog->OutputsWritten)); + (unsigned long long)prog->OutputsWritten, + binary(prog->OutputsWritten)); fprintf(f, "NumInstructions=%d\n", prog->NumInstructions); fprintf(f, "NumTemporaries=%d\n", prog->NumTemporaries); fprintf(f, "NumParameters=%d\n", prog->NumParameters); fprintf(f, "NumAttributes=%d\n", prog->NumAttributes); fprintf(f, "NumAddressRegs=%d\n", prog->NumAddressRegs); + fprintf(f, "IndirectRegisterFiles: 0x%x (0b%s)\n", + prog->IndirectRegisterFiles, binary(prog->IndirectRegisterFiles)); fprintf(f, "SamplersUsed: 0x%x (0b%s)\n", prog->SamplersUsed, binary(prog->SamplersUsed)); fprintf(f, "Samplers=[ "); @@ -996,8 +1015,10 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) if (shader->Type == GL_FRAGMENT_SHADER) type = "frag"; - else + else if (shader->Type == GL_VERTEX_SHADER) type = "vert"; + else + type = "geom"; _mesa_snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type); f = fopen(filename, "w"); @@ -1012,11 +1033,11 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) fprintf(f, "/* Compile status: %s */\n", shader->CompileStatus ? "ok" : "fail"); - if (!shader->CompileStatus) { - fprintf(f, "/* Log Info: */\n"); + fprintf(f, "/* Log Info: */\n"); + if (shader->InfoLog) { fputs(shader->InfoLog, f); } - else { + if (shader->CompileStatus && shader->Program) { fprintf(f, "/* GPU code */\n"); fprintf(f, "/*\n"); _mesa_fprint_program_opt(f, shader->Program, PROG_PRINT_DEBUG, GL_TRUE); diff --git a/mesalib/src/mesa/shader/prog_print.h b/mesalib/src/mesa/program/prog_print.h index 9ab745601..78b90aeb4 100644 --- a/mesalib/src/mesa/shader/prog_print.h +++ b/mesalib/src/mesa/program/prog_print.h @@ -26,6 +26,16 @@ #ifndef PROG_PRINT_H #define PROG_PRINT_H +#include <stdio.h> + +#include "main/glheader.h" +#include "main/mtypes.h" + +struct gl_program; +struct gl_program_parameter_list; +struct gl_shader; +struct prog_instruction; + /** * The output style to use when printing programs. @@ -56,6 +66,13 @@ extern void _mesa_print_swizzle(GLuint swizzle); extern void +_mesa_fprint_alu_instruction(FILE *f, + const struct prog_instruction *inst, + const char *opcode_string, GLuint numRegs, + gl_prog_print_mode mode, + const struct gl_program *prog); + +extern void _mesa_print_alu_instruction(const struct prog_instruction *inst, const char *opcode_string, GLuint numRegs); diff --git a/mesalib/src/mesa/shader/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c index ead3ece95..2687f8ae2 100644 --- a/mesalib/src/mesa/shader/prog_statevars.c +++ b/mesalib/src/mesa/program/prog_statevars.c @@ -1052,6 +1052,8 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) append_token(str, state[1]); append_index(str, state[2]); break; + case STATE_NORMAL_SCALE: + break; case STATE_INTERNAL: append_token(str, state[1]); if (state[1] == STATE_CURRENT_ATTRIB) diff --git a/mesalib/src/mesa/shader/prog_statevars.h b/mesalib/src/mesa/program/prog_statevars.h index 1753471ff..1753471ff 100644 --- a/mesalib/src/mesa/shader/prog_statevars.h +++ b/mesalib/src/mesa/program/prog_statevars.h diff --git a/mesalib/src/mesa/shader/prog_uniform.c b/mesalib/src/mesa/program/prog_uniform.c index c408a8492..28acb8871 100644 --- a/mesalib/src/mesa/shader/prog_uniform.c +++ b/mesalib/src/mesa/program/prog_uniform.c @@ -44,6 +44,10 @@ void _mesa_free_uniform_list(struct gl_uniform_list *list) { GLuint i; + + if (!list) + return; + for (i = 0; i < list->NumUniforms; i++) { free((void *) list->Uniforms[i].Name); } @@ -61,7 +65,8 @@ _mesa_append_uniform(struct gl_uniform_list *list, GLint index; assert(target == GL_VERTEX_PROGRAM_ARB || - target == GL_FRAGMENT_PROGRAM_ARB); + target == GL_FRAGMENT_PROGRAM_ARB || + target == MESA_GEOMETRY_PROGRAM); index = _mesa_lookup_uniform(list, name); if (index < 0) { @@ -90,6 +95,7 @@ _mesa_append_uniform(struct gl_uniform_list *list, uniform->Name = _mesa_strdup(name); uniform->VertPos = -1; uniform->FragPos = -1; + uniform->GeomPos = -1; uniform->Initialized = GL_FALSE; list->NumUniforms++; @@ -106,13 +112,18 @@ _mesa_append_uniform(struct gl_uniform_list *list, return GL_FALSE; } uniform->VertPos = progPos; - } - else { + } else if (target == GL_FRAGMENT_PROGRAM_ARB) { if (uniform->FragPos != -1) { /* this uniform is already in the list - that shouldn't happen */ return GL_FALSE; } uniform->FragPos = progPos; + } else { + if (uniform->GeomPos != -1) { + /* this uniform is already in the list - that shouldn't happen */ + return GL_FALSE; + } + uniform->GeomPos = progPos; } return uniform; @@ -156,10 +167,11 @@ _mesa_print_uniforms(const struct gl_uniform_list *list) GLuint i; printf("Uniform list %p:\n", (void *) list); for (i = 0; i < list->NumUniforms; i++) { - printf("%d: %s %d %d\n", + printf("%d: %s %d %d %d\n", i, list->Uniforms[i].Name, list->Uniforms[i].VertPos, - list->Uniforms[i].FragPos); + list->Uniforms[i].FragPos, + list->Uniforms[i].GeomPos); } } diff --git a/mesalib/src/mesa/shader/prog_uniform.h b/mesalib/src/mesa/program/prog_uniform.h index 22a2bfd97..67f78006e 100644 --- a/mesalib/src/mesa/shader/prog_uniform.h +++ b/mesalib/src/mesa/program/prog_uniform.h @@ -31,8 +31,7 @@ #ifndef PROG_UNIFORM_H #define PROG_UNIFORM_H -#include "main/mtypes.h" -#include "prog_statevars.h" +#include "main/glheader.h" /** @@ -50,11 +49,9 @@ struct gl_uniform const char *Name; /**< Null-terminated string */ GLint VertPos; GLint FragPos; + GLint GeomPos; GLboolean Initialized; /**< For debug. Has this uniform been set? */ -#if 0 - GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ - GLuint Size; /**< Number of components (1..4) */ -#endif + const struct glsl_type *Type; }; diff --git a/mesalib/src/mesa/shader/program.c b/mesalib/src/mesa/program/program.c index f77a77375..06b9539bd 100644 --- a/mesalib/src/mesa/shader/program.c +++ b/mesalib/src/mesa/program/program.c @@ -55,13 +55,21 @@ _mesa_init_program(GLcontext *ctx) /* * If this assertion fails, we need to increase the field - * size for register indexes. + * size for register indexes (see INST_INDEX_BITS). */ ASSERT(ctx->Const.VertexProgram.MaxUniformComponents / 4 <= (1 << INST_INDEX_BITS)); ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents / 4 <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.VertexProgram.MaxTemps <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.FragmentProgram.MaxTemps <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= (1 << INST_INDEX_BITS)); + + ASSERT(ctx->Const.VertexProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS); + ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS); + /* If this fails, increase prog_instruction::TexSrcUnit size */ ASSERT(MAX_TEXTURE_UNITS < (1 << 5)); @@ -74,7 +82,8 @@ _mesa_init_program(GLcontext *ctx) #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program ctx->VertexProgram.Enabled = GL_FALSE; #if FEATURE_es2_glsl - ctx->VertexProgram.PointSizeEnabled = GL_TRUE; + ctx->VertexProgram.PointSizeEnabled = + (ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE; #else ctx->VertexProgram.PointSizeEnabled = GL_FALSE; #endif @@ -97,6 +106,13 @@ _mesa_init_program(GLcontext *ctx) ctx->FragmentProgram.Cache = _mesa_new_program_cache(); #endif +#if FEATURE_ARB_geometry_shader4 + ctx->GeometryProgram.Enabled = GL_FALSE; + /* right now by default we don't have a geometry program */ + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, + NULL); + ctx->GeometryProgram.Cache = _mesa_new_program_cache(); +#endif /* XXX probably move this stuff */ #if FEATURE_ATI_fragment_shader @@ -122,6 +138,10 @@ _mesa_free_program_data(GLcontext *ctx) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL); _mesa_delete_program_cache(ctx, ctx->FragmentProgram.Cache); #endif +#if FEATURE_ARB_geometry_shader4 + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, NULL); + _mesa_delete_program_cache(ctx, ctx->GeometryProgram.Cache); +#endif /* XXX probably move this stuff */ #if FEATURE_ATI_fragment_shader if (ctx->ATIFragmentShader.Current) { @@ -157,6 +177,12 @@ _mesa_update_default_objects_program(GLcontext *ctx) assert(ctx->FragmentProgram.Current); #endif +#if FEATURE_ARB_geometry_shader4 + _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, + (struct gl_geometry_program *) + ctx->Shared->DefaultGeometryProgram); +#endif + /* XXX probably move this stuff */ #if FEATURE_ATI_fragment_shader if (ctx->ATIFragmentShader.Current) { @@ -285,6 +311,20 @@ _mesa_init_vertex_program( GLcontext *ctx, struct gl_vertex_program *prog, /** + * Initialize a new geometry program object. + */ +struct gl_program * +_mesa_init_geometry_program( GLcontext *ctx, struct gl_geometry_program *prog, + GLenum target, GLuint id) +{ + if (prog) + return _mesa_init_program_struct( ctx, &prog->Base, target, id ); + else + return NULL; +} + + +/** * Allocate and initialize a new fragment/vertex program object but * don't put it into the program hash table. Called via * ctx->Driver.NewProgram. May be overridden (ie. replaced) by a @@ -312,6 +352,11 @@ _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) CALLOC_STRUCT(gl_fragment_program), target, id ); break; + case MESA_GEOMETRY_PROGRAM: + prog = _mesa_init_geometry_program(ctx, + CALLOC_STRUCT(gl_geometry_program), + target, id); + break; default: _mesa_problem(ctx, "bad target in _mesa_new_program"); prog = NULL; @@ -386,6 +431,8 @@ _mesa_reference_program(GLcontext *ctx, else if ((*ptr)->Target == GL_FRAGMENT_PROGRAM_ARB) ASSERT(prog->Target == GL_FRAGMENT_PROGRAM_ARB || prog->Target == GL_FRAGMENT_PROGRAM_NV); + else if ((*ptr)->Target == MESA_GEOMETRY_PROGRAM) + ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM); } if (*ptr == prog) { return; /* no change */ @@ -397,7 +444,8 @@ _mesa_reference_program(GLcontext *ctx, #if 0 printf("Program %p ID=%u Target=%s Refcount-- to %d\n", *ptr, (*ptr)->Id, - ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB ? "VP" : "FP"), + ((*ptr)->Target == GL_VERTEX_PROGRAM_ARB ? "VP" : + ((*ptr)->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")), (*ptr)->RefCount - 1); #endif ASSERT((*ptr)->RefCount > 0); @@ -421,7 +469,8 @@ _mesa_reference_program(GLcontext *ctx, #if 0 printf("Program %p ID=%u Target=%s Refcount++ to %d\n", prog, prog->Id, - (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" : "FP"), + (prog->Target == GL_VERTEX_PROGRAM_ARB ? "VP" : + (prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")), prog->RefCount); #endif /*_glthread_UNLOCK_MUTEX(prog->Mutex);*/ @@ -471,6 +520,7 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) if (prog->Attributes) clone->Attributes = _mesa_clone_parameter_list(prog->Attributes); memcpy(clone->LocalParams, prog->LocalParams, sizeof(clone->LocalParams)); + clone->IndirectRegisterFiles = prog->IndirectRegisterFiles; clone->NumInstructions = prog->NumInstructions; clone->NumTemporaries = prog->NumTemporaries; clone->NumParameters = prog->NumParameters; @@ -509,6 +559,16 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) fpc->PixelCenterInteger = fp->PixelCenterInteger; } break; + case MESA_GEOMETRY_PROGRAM: + { + const struct gl_geometry_program *gp + = (const struct gl_geometry_program *) prog; + struct gl_geometry_program *gpc = (struct gl_geometry_program *) clone; + gpc->VerticesOut = gp->VerticesOut; + gpc->InputType = gp->InputType; + gpc->OutputType = gp->OutputType; + } + break; default: _mesa_problem(NULL, "Unexpected target in _mesa_clone_program"); } @@ -816,12 +876,16 @@ _mesa_find_used_registers(const struct gl_program *prog, const GLuint n = _mesa_num_inst_src_regs(inst->Opcode); if (inst->DstReg.File == file) { - used[inst->DstReg.Index] = GL_TRUE; + ASSERT(inst->DstReg.Index < usedSize); + if(inst->DstReg.Index < usedSize) + used[inst->DstReg.Index] = GL_TRUE; } for (j = 0; j < n; j++) { if (inst->SrcReg[j].File == file) { - used[inst->SrcReg[j].Index] = GL_TRUE; + ASSERT(inst->SrcReg[j].Index < usedSize); + if(inst->SrcReg[j].Index < usedSize) + used[inst->SrcReg[j].Index] = GL_TRUE; } } } diff --git a/mesalib/src/mesa/shader/program.h b/mesalib/src/mesa/program/program.h index af9f4170d..f8f379808 100644 --- a/mesalib/src/mesa/shader/program.h +++ b/mesalib/src/mesa/program/program.h @@ -74,6 +74,11 @@ _mesa_init_fragment_program(GLcontext *ctx, GLenum target, GLuint id); extern struct gl_program * +_mesa_init_geometry_program(GLcontext *ctx, + struct gl_geometry_program *prog, + GLenum target, GLuint id); + +extern struct gl_program * _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id); extern void @@ -105,6 +110,15 @@ _mesa_reference_fragprog(GLcontext *ctx, (struct gl_program *) prog); } +static INLINE void +_mesa_reference_geomprog(GLcontext *ctx, + struct gl_geometry_program **ptr, + struct gl_geometry_program *prog) +{ + _mesa_reference_program(ctx, (struct gl_program **) ptr, + (struct gl_program *) prog); +} + extern struct gl_program * _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog); @@ -115,6 +129,12 @@ _mesa_clone_vertex_program(GLcontext *ctx, return (struct gl_vertex_program *) _mesa_clone_program(ctx, &prog->Base); } +static INLINE struct gl_geometry_program * +_mesa_clone_geometry_program(GLcontext *ctx, + const struct gl_geometry_program *prog) +{ + return (struct gl_geometry_program *) _mesa_clone_program(ctx, &prog->Base); +} static INLINE struct gl_fragment_program * _mesa_clone_fragment_program(GLcontext *ctx, @@ -147,5 +167,37 @@ _mesa_find_free_register(const GLboolean used[], extern void _mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog); +/* keep these in the same order as TGSI_PROCESSOR_* */ + +static INLINE GLuint +_mesa_program_target_to_index(GLenum v) +{ + switch(v) + { + case GL_VERTEX_PROGRAM_ARB: + return MESA_SHADER_VERTEX; + case GL_FRAGMENT_PROGRAM_ARB: + return MESA_SHADER_FRAGMENT; + case GL_GEOMETRY_PROGRAM_NV: + return MESA_SHADER_GEOMETRY; + default: + ASSERT(0); + return ~0; + } +} + +static INLINE GLenum +_mesa_program_index_to_target(GLuint i) +{ + GLenum enums[MESA_SHADER_TYPES] = { + GL_VERTEX_PROGRAM_ARB, + GL_FRAGMENT_PROGRAM_ARB, + GL_GEOMETRY_PROGRAM_NV, + }; + if(i >= MESA_SHADER_TYPES) + return 0; + else + return enums[i]; +} #endif /* PROGRAM_H */ diff --git a/mesalib/src/mesa/shader/program_lexer.l b/mesalib/src/mesa/program/program_lexer.l index fe18272cd..0a50dab97 100644 --- a/mesalib/src/mesa/shader/program_lexer.l +++ b/mesalib/src/mesa/program/program_lexer.l @@ -23,12 +23,11 @@ */ #include "main/glheader.h" #include "main/imports.h" -#include "shader/prog_instruction.h" -#include "shader/prog_statevars.h" - -#include "shader/symbol_table.h" -#include "shader/program_parser.h" -#include "shader/program_parse.tab.h" +#include "program/prog_instruction.h" +#include "program/prog_statevars.h" +#include "program/symbol_table.h" +#include "program/program_parser.h" +#include "program/program_parse.tab.h" #define require_ARB_vp (yyextra->mode == ARB_vertex) #define require_ARB_fp (yyextra->mode == ARB_fragment) @@ -140,7 +139,20 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) } \ } while(0); +#define YY_NO_INPUT + +/* Yes, this is intentionally doing nothing. We have this line of code +here only to avoid the compiler complaining about an unput function +that is defined, but never called. */ +#define YY_USER_INIT while (0) { unput(0); } + #define YY_EXTRA_TYPE struct asm_parser_state * + +/* Flex defines a couple of functions with no declarations nor the +static keyword. Declare them here to avoid a compiler warning. */ +int yyget_column (yyscan_t yyscanner); +void yyset_column (int column_no , yyscan_t yyscanner); + %} num [0-9]+ diff --git a/mesalib/src/mesa/shader/program_parse.tab.c b/mesalib/src/mesa/program/program_parse.tab.c index 64a987e16..08ead30de 100644 --- a/mesalib/src/mesa/shader/program_parse.tab.c +++ b/mesalib/src/mesa/program/program_parse.tab.c @@ -98,14 +98,14 @@ #include "main/mtypes.h" #include "main/imports.h" -#include "shader/program.h" -#include "shader/prog_parameter.h" -#include "shader/prog_parameter_layout.h" -#include "shader/prog_statevars.h" -#include "shader/prog_instruction.h" +#include "program/program.h" +#include "program/prog_parameter.h" +#include "program/prog_parameter_layout.h" +#include "program/prog_statevars.h" +#include "program/prog_instruction.h" -#include "shader/symbol_table.h" -#include "shader/program_parser.h" +#include "program/symbol_table.h" +#include "program/program_parser.h" extern void *yy_scan_string(char *); extern void yy_delete_buffer(void *); @@ -532,14 +532,14 @@ YYID (yyi) # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus ) + || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus ) + || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -798,29 +798,29 @@ static const yytype_uint16 yyrline[] = 415, 459, 464, 474, 518, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 538, 550, 558, 575, 582, 601, 612, 632, 657, 664, 697, 704, 719, - 774, 817, 826, 847, 857, 861, 890, 909, 909, 911, - 918, 930, 931, 932, 935, 949, 963, 983, 994, 1006, - 1008, 1009, 1010, 1011, 1014, 1014, 1014, 1014, 1015, 1018, - 1022, 1027, 1034, 1041, 1048, 1071, 1094, 1095, 1096, 1097, - 1098, 1099, 1102, 1121, 1125, 1131, 1135, 1139, 1143, 1152, - 1161, 1165, 1170, 1176, 1187, 1187, 1188, 1190, 1194, 1198, - 1202, 1208, 1208, 1210, 1228, 1254, 1257, 1268, 1274, 1280, - 1281, 1288, 1294, 1300, 1308, 1314, 1320, 1328, 1334, 1340, - 1348, 1349, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, - 1360, 1361, 1362, 1365, 1374, 1378, 1382, 1388, 1397, 1401, - 1405, 1414, 1418, 1424, 1430, 1437, 1442, 1450, 1460, 1462, - 1470, 1476, 1480, 1484, 1490, 1501, 1510, 1514, 1519, 1523, - 1527, 1531, 1537, 1544, 1548, 1554, 1562, 1573, 1580, 1584, - 1590, 1600, 1611, 1615, 1633, 1642, 1645, 1651, 1655, 1659, - 1665, 1676, 1681, 1686, 1691, 1696, 1701, 1709, 1712, 1717, - 1730, 1738, 1749, 1757, 1757, 1759, 1759, 1761, 1771, 1776, - 1783, 1793, 1802, 1807, 1814, 1824, 1834, 1846, 1846, 1847, - 1847, 1849, 1859, 1867, 1877, 1885, 1893, 1902, 1913, 1917, - 1923, 1924, 1925, 1928, 1928, 1931, 1966, 1970, 1970, 1973, - 1980, 1989, 2003, 2012, 2021, 2025, 2034, 2043, 2054, 2061, - 2066, 2075, 2087, 2090, 2099, 2110, 2111, 2112, 2115, 2116, - 2117, 2120, 2121, 2124, 2125, 2128, 2129, 2132, 2143, 2154, - 2165, 2191, 2192 + 774, 817, 826, 848, 858, 862, 891, 910, 910, 912, + 919, 931, 932, 933, 936, 950, 964, 984, 995, 1007, + 1009, 1010, 1011, 1012, 1015, 1015, 1015, 1015, 1016, 1019, + 1023, 1028, 1035, 1042, 1049, 1072, 1095, 1096, 1097, 1098, + 1099, 1100, 1103, 1122, 1126, 1132, 1136, 1140, 1144, 1153, + 1162, 1166, 1171, 1177, 1188, 1188, 1189, 1191, 1195, 1199, + 1203, 1209, 1209, 1211, 1229, 1255, 1258, 1269, 1275, 1281, + 1282, 1289, 1295, 1301, 1309, 1315, 1321, 1329, 1335, 1341, + 1349, 1350, 1353, 1354, 1355, 1356, 1357, 1358, 1359, 1360, + 1361, 1362, 1363, 1366, 1375, 1379, 1383, 1389, 1398, 1402, + 1406, 1415, 1419, 1425, 1431, 1438, 1443, 1451, 1461, 1463, + 1471, 1477, 1481, 1485, 1491, 1502, 1511, 1515, 1520, 1524, + 1528, 1532, 1538, 1545, 1549, 1555, 1563, 1574, 1581, 1585, + 1591, 1601, 1612, 1616, 1634, 1643, 1646, 1652, 1656, 1660, + 1666, 1677, 1682, 1687, 1692, 1697, 1702, 1710, 1713, 1718, + 1731, 1739, 1750, 1758, 1758, 1760, 1760, 1762, 1772, 1777, + 1784, 1794, 1803, 1808, 1815, 1825, 1835, 1847, 1847, 1848, + 1848, 1850, 1860, 1868, 1878, 1886, 1894, 1903, 1914, 1918, + 1924, 1925, 1926, 1929, 1929, 1932, 1967, 1971, 1971, 1974, + 1981, 1990, 2004, 2013, 2022, 2026, 2035, 2044, 2055, 2062, + 2067, 2076, 2088, 2091, 2100, 2111, 2112, 2113, 2116, 2117, + 2118, 2121, 2122, 2125, 2126, 2129, 2130, 2133, 2144, 2155, + 2166, 2192, 2193 }; #endif @@ -2844,6 +2844,7 @@ yyreduce: (yyval.src_reg).Base.File = (yyvsp[(1) - (4)].sym)->param_binding_type; if ((yyvsp[(3) - (4)].src_reg).Base.RelAddr) { + state->prog->IndirectRegisterFiles |= (1 << (yyval.src_reg).Base.File); (yyvsp[(1) - (4)].sym)->param_accessed_indirectly = 1; (yyval.src_reg).Base.RelAddr = 1; @@ -2858,7 +2859,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 848 "program_parse.y" +#line 849 "program_parse.y" { gl_register_file file = ((yyvsp[(1) - (1)].temp_sym).name != NULL) ? (yyvsp[(1) - (1)].temp_sym).param_binding_type @@ -2871,7 +2872,7 @@ yyreduce: case 64: /* Line 1455 of yacc.c */ -#line 858 "program_parse.y" +#line 859 "program_parse.y" { set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, (yyvsp[(1) - (1)].result)); ;} @@ -2880,7 +2881,7 @@ yyreduce: case 65: /* Line 1455 of yacc.c */ -#line 862 "program_parse.y" +#line 863 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2912,7 +2913,7 @@ yyreduce: case 66: /* Line 1455 of yacc.c */ -#line 891 "program_parse.y" +#line 892 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2934,7 +2935,7 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 912 "program_parse.y" +#line 913 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); @@ -2944,7 +2945,7 @@ yyreduce: case 70: /* Line 1455 of yacc.c */ -#line 919 "program_parse.y" +#line 920 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2959,30 +2960,30 @@ yyreduce: case 71: /* Line 1455 of yacc.c */ -#line 930 "program_parse.y" +#line 931 "program_parse.y" { (yyval.integer) = 0; ;} break; case 72: /* Line 1455 of yacc.c */ -#line 931 "program_parse.y" +#line 932 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 73: /* Line 1455 of yacc.c */ -#line 932 "program_parse.y" +#line 933 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; case 74: /* Line 1455 of yacc.c */ -#line 936 "program_parse.y" +#line 937 "program_parse.y" { - if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { + if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 4095)) { char s[100]; _mesa_snprintf(s, sizeof(s), "relative address offset too large (%d)", (yyvsp[(1) - (1)].integer)); @@ -2997,9 +2998,9 @@ yyreduce: case 75: /* Line 1455 of yacc.c */ -#line 950 "program_parse.y" +#line 951 "program_parse.y" { - if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { + if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 4096)) { char s[100]; _mesa_snprintf(s, sizeof(s), "relative address offset too large (%d)", (yyvsp[(1) - (1)].integer)); @@ -3014,7 +3015,7 @@ yyreduce: case 76: /* Line 1455 of yacc.c */ -#line 964 "program_parse.y" +#line 965 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -3037,7 +3038,7 @@ yyreduce: case 77: /* Line 1455 of yacc.c */ -#line 984 "program_parse.y" +#line 985 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -3051,7 +3052,7 @@ yyreduce: case 78: /* Line 1455 of yacc.c */ -#line 995 "program_parse.y" +#line 996 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -3066,21 +3067,21 @@ yyreduce: case 83: /* Line 1455 of yacc.c */ -#line 1011 "program_parse.y" +#line 1012 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 1015 "program_parse.y" +#line 1016 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 89: /* Line 1455 of yacc.c */ -#line 1019 "program_parse.y" +#line 1020 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} @@ -3089,7 +3090,7 @@ yyreduce: case 90: /* Line 1455 of yacc.c */ -#line 1023 "program_parse.y" +#line 1024 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} @@ -3098,7 +3099,7 @@ yyreduce: case 91: /* Line 1455 of yacc.c */ -#line 1027 "program_parse.y" +#line 1028 "program_parse.y" { (yyval.dst_reg).CondMask = COND_TR; (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP; @@ -3109,7 +3110,7 @@ yyreduce: case 92: /* Line 1455 of yacc.c */ -#line 1035 "program_parse.y" +#line 1036 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3119,7 +3120,7 @@ yyreduce: case 93: /* Line 1455 of yacc.c */ -#line 1042 "program_parse.y" +#line 1043 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3129,7 +3130,7 @@ yyreduce: case 94: /* Line 1455 of yacc.c */ -#line 1049 "program_parse.y" +#line 1050 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3155,7 +3156,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 1072 "program_parse.y" +#line 1073 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3181,7 +3182,7 @@ yyreduce: case 102: /* Line 1455 of yacc.c */ -#line 1103 "program_parse.y" +#line 1104 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -3203,7 +3204,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 1122 "program_parse.y" +#line 1123 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3212,7 +3213,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 1126 "program_parse.y" +#line 1127 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3221,7 +3222,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 1132 "program_parse.y" +#line 1133 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} @@ -3230,7 +3231,7 @@ yyreduce: case 106: /* Line 1455 of yacc.c */ -#line 1136 "program_parse.y" +#line 1137 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} @@ -3239,7 +3240,7 @@ yyreduce: case 107: /* Line 1455 of yacc.c */ -#line 1140 "program_parse.y" +#line 1141 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} @@ -3248,7 +3249,7 @@ yyreduce: case 108: /* Line 1455 of yacc.c */ -#line 1144 "program_parse.y" +#line 1145 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3262,7 +3263,7 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 1153 "program_parse.y" +#line 1154 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3276,7 +3277,7 @@ yyreduce: case 110: /* Line 1455 of yacc.c */ -#line 1162 "program_parse.y" +#line 1163 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3285,7 +3286,7 @@ yyreduce: case 111: /* Line 1455 of yacc.c */ -#line 1166 "program_parse.y" +#line 1167 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3295,7 +3296,7 @@ yyreduce: case 112: /* Line 1455 of yacc.c */ -#line 1171 "program_parse.y" +#line 1172 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} @@ -3304,7 +3305,7 @@ yyreduce: case 113: /* Line 1455 of yacc.c */ -#line 1177 "program_parse.y" +#line 1178 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3318,7 +3319,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 1191 "program_parse.y" +#line 1192 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} @@ -3327,7 +3328,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 1195 "program_parse.y" +#line 1196 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} @@ -3336,7 +3337,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 1199 "program_parse.y" +#line 1200 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} @@ -3345,7 +3346,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 1203 "program_parse.y" +#line 1204 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3354,7 +3355,7 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 1211 "program_parse.y" +#line 1212 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3366,7 +3367,7 @@ yyreduce: s->param_binding_type = (yyvsp[(3) - (3)].temp_sym).param_binding_type; s->param_binding_begin = (yyvsp[(3) - (3)].temp_sym).param_binding_begin; s->param_binding_length = (yyvsp[(3) - (3)].temp_sym).param_binding_length; - s->param_binding_swizzle = SWIZZLE_XYZW; + s->param_binding_swizzle = (yyvsp[(3) - (3)].temp_sym).param_binding_swizzle; s->param_is_array = 0; } ;} @@ -3375,7 +3376,7 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 1229 "program_parse.y" +#line 1230 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { free((yyvsp[(2) - (6)].string)); @@ -3403,7 +3404,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 1254 "program_parse.y" +#line 1255 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3412,7 +3413,7 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 1258 "program_parse.y" +#line 1259 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) > state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3426,7 +3427,7 @@ yyreduce: case 127: /* Line 1455 of yacc.c */ -#line 1269 "program_parse.y" +#line 1270 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} @@ -3435,7 +3436,7 @@ yyreduce: case 128: /* Line 1455 of yacc.c */ -#line 1275 "program_parse.y" +#line 1276 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} @@ -3444,7 +3445,7 @@ yyreduce: case 130: /* Line 1455 of yacc.c */ -#line 1282 "program_parse.y" +#line 1283 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); @@ -3454,7 +3455,7 @@ yyreduce: case 131: /* Line 1455 of yacc.c */ -#line 1289 "program_parse.y" +#line 1290 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3465,7 +3466,7 @@ yyreduce: case 132: /* Line 1455 of yacc.c */ -#line 1295 "program_parse.y" +#line 1296 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3476,7 +3477,7 @@ yyreduce: case 133: /* Line 1455 of yacc.c */ -#line 1301 "program_parse.y" +#line 1302 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3487,7 +3488,7 @@ yyreduce: case 134: /* Line 1455 of yacc.c */ -#line 1309 "program_parse.y" +#line 1310 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3498,7 +3499,7 @@ yyreduce: case 135: /* Line 1455 of yacc.c */ -#line 1315 "program_parse.y" +#line 1316 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3509,7 +3510,7 @@ yyreduce: case 136: /* Line 1455 of yacc.c */ -#line 1321 "program_parse.y" +#line 1322 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3520,7 +3521,7 @@ yyreduce: case 137: /* Line 1455 of yacc.c */ -#line 1329 "program_parse.y" +#line 1330 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3531,7 +3532,7 @@ yyreduce: case 138: /* Line 1455 of yacc.c */ -#line 1335 "program_parse.y" +#line 1336 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3542,7 +3543,7 @@ yyreduce: case 139: /* Line 1455 of yacc.c */ -#line 1341 "program_parse.y" +#line 1342 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3553,98 +3554,98 @@ yyreduce: case 140: /* Line 1455 of yacc.c */ -#line 1348 "program_parse.y" +#line 1349 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 141: /* Line 1455 of yacc.c */ -#line 1349 "program_parse.y" +#line 1350 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 142: /* Line 1455 of yacc.c */ -#line 1352 "program_parse.y" +#line 1353 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 143: /* Line 1455 of yacc.c */ -#line 1353 "program_parse.y" +#line 1354 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 144: /* Line 1455 of yacc.c */ -#line 1354 "program_parse.y" +#line 1355 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 145: /* Line 1455 of yacc.c */ -#line 1355 "program_parse.y" +#line 1356 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 146: /* Line 1455 of yacc.c */ -#line 1356 "program_parse.y" +#line 1357 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 147: /* Line 1455 of yacc.c */ -#line 1357 "program_parse.y" +#line 1358 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 148: /* Line 1455 of yacc.c */ -#line 1358 "program_parse.y" +#line 1359 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 149: /* Line 1455 of yacc.c */ -#line 1359 "program_parse.y" +#line 1360 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 150: /* Line 1455 of yacc.c */ -#line 1360 "program_parse.y" +#line 1361 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 151: /* Line 1455 of yacc.c */ -#line 1361 "program_parse.y" +#line 1362 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 152: /* Line 1455 of yacc.c */ -#line 1362 "program_parse.y" +#line 1363 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 153: /* Line 1455 of yacc.c */ -#line 1366 "program_parse.y" +#line 1367 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3656,7 +3657,7 @@ yyreduce: case 154: /* Line 1455 of yacc.c */ -#line 1375 "program_parse.y" +#line 1376 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3665,7 +3666,7 @@ yyreduce: case 155: /* Line 1455 of yacc.c */ -#line 1379 "program_parse.y" +#line 1380 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} @@ -3674,7 +3675,7 @@ yyreduce: case 156: /* Line 1455 of yacc.c */ -#line 1383 "program_parse.y" +#line 1384 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} @@ -3683,7 +3684,7 @@ yyreduce: case 157: /* Line 1455 of yacc.c */ -#line 1389 "program_parse.y" +#line 1390 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3695,7 +3696,7 @@ yyreduce: case 158: /* Line 1455 of yacc.c */ -#line 1398 "program_parse.y" +#line 1399 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3704,7 +3705,7 @@ yyreduce: case 159: /* Line 1455 of yacc.c */ -#line 1402 "program_parse.y" +#line 1403 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} @@ -3713,7 +3714,7 @@ yyreduce: case 160: /* Line 1455 of yacc.c */ -#line 1406 "program_parse.y" +#line 1407 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3727,7 +3728,7 @@ yyreduce: case 161: /* Line 1455 of yacc.c */ -#line 1415 "program_parse.y" +#line 1416 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -3736,7 +3737,7 @@ yyreduce: case 162: /* Line 1455 of yacc.c */ -#line 1419 "program_parse.y" +#line 1420 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} @@ -3745,7 +3746,7 @@ yyreduce: case 163: /* Line 1455 of yacc.c */ -#line 1425 "program_parse.y" +#line 1426 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} @@ -3754,7 +3755,7 @@ yyreduce: case 164: /* Line 1455 of yacc.c */ -#line 1431 "program_parse.y" +#line 1432 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; @@ -3764,7 +3765,7 @@ yyreduce: case 165: /* Line 1455 of yacc.c */ -#line 1438 "program_parse.y" +#line 1439 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; @@ -3774,7 +3775,7 @@ yyreduce: case 166: /* Line 1455 of yacc.c */ -#line 1443 "program_parse.y" +#line 1444 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3785,7 +3786,7 @@ yyreduce: case 167: /* Line 1455 of yacc.c */ -#line 1451 "program_parse.y" +#line 1452 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3798,7 +3799,7 @@ yyreduce: case 169: /* Line 1455 of yacc.c */ -#line 1463 "program_parse.y" +#line 1464 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3809,7 +3810,7 @@ yyreduce: case 170: /* Line 1455 of yacc.c */ -#line 1471 "program_parse.y" +#line 1472 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} @@ -3818,7 +3819,7 @@ yyreduce: case 171: /* Line 1455 of yacc.c */ -#line 1477 "program_parse.y" +#line 1478 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} @@ -3827,7 +3828,7 @@ yyreduce: case 172: /* Line 1455 of yacc.c */ -#line 1481 "program_parse.y" +#line 1482 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} @@ -3836,7 +3837,7 @@ yyreduce: case 173: /* Line 1455 of yacc.c */ -#line 1485 "program_parse.y" +#line 1486 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} @@ -3845,7 +3846,7 @@ yyreduce: case 174: /* Line 1455 of yacc.c */ -#line 1491 "program_parse.y" +#line 1492 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3859,7 +3860,7 @@ yyreduce: case 175: /* Line 1455 of yacc.c */ -#line 1502 "program_parse.y" +#line 1503 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3871,7 +3872,7 @@ yyreduce: case 176: /* Line 1455 of yacc.c */ -#line 1511 "program_parse.y" +#line 1512 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} @@ -3880,7 +3881,7 @@ yyreduce: case 177: /* Line 1455 of yacc.c */ -#line 1515 "program_parse.y" +#line 1516 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} @@ -3889,7 +3890,7 @@ yyreduce: case 178: /* Line 1455 of yacc.c */ -#line 1520 "program_parse.y" +#line 1521 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} @@ -3898,7 +3899,7 @@ yyreduce: case 179: /* Line 1455 of yacc.c */ -#line 1524 "program_parse.y" +#line 1525 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} @@ -3907,7 +3908,7 @@ yyreduce: case 180: /* Line 1455 of yacc.c */ -#line 1528 "program_parse.y" +#line 1529 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} @@ -3916,7 +3917,7 @@ yyreduce: case 181: /* Line 1455 of yacc.c */ -#line 1532 "program_parse.y" +#line 1533 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} @@ -3925,7 +3926,7 @@ yyreduce: case 182: /* Line 1455 of yacc.c */ -#line 1538 "program_parse.y" +#line 1539 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3935,7 +3936,7 @@ yyreduce: case 183: /* Line 1455 of yacc.c */ -#line 1545 "program_parse.y" +#line 1546 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} @@ -3944,7 +3945,7 @@ yyreduce: case 184: /* Line 1455 of yacc.c */ -#line 1549 "program_parse.y" +#line 1550 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} @@ -3953,7 +3954,7 @@ yyreduce: case 185: /* Line 1455 of yacc.c */ -#line 1555 "program_parse.y" +#line 1556 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3964,7 +3965,7 @@ yyreduce: case 186: /* Line 1455 of yacc.c */ -#line 1563 "program_parse.y" +#line 1564 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3978,7 +3979,7 @@ yyreduce: case 187: /* Line 1455 of yacc.c */ -#line 1574 "program_parse.y" +#line 1575 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3988,7 +3989,7 @@ yyreduce: case 188: /* Line 1455 of yacc.c */ -#line 1581 "program_parse.y" +#line 1582 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} @@ -3997,7 +3998,7 @@ yyreduce: case 189: /* Line 1455 of yacc.c */ -#line 1585 "program_parse.y" +#line 1586 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} @@ -4006,7 +4007,7 @@ yyreduce: case 190: /* Line 1455 of yacc.c */ -#line 1591 "program_parse.y" +#line 1592 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -4019,7 +4020,7 @@ yyreduce: case 191: /* Line 1455 of yacc.c */ -#line 1601 "program_parse.y" +#line 1602 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -4032,7 +4033,7 @@ yyreduce: case 192: /* Line 1455 of yacc.c */ -#line 1611 "program_parse.y" +#line 1612 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; @@ -4042,7 +4043,7 @@ yyreduce: case 193: /* Line 1455 of yacc.c */ -#line 1616 "program_parse.y" +#line 1617 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -4063,7 +4064,7 @@ yyreduce: case 194: /* Line 1455 of yacc.c */ -#line 1634 "program_parse.y" +#line 1635 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -4074,7 +4075,7 @@ yyreduce: case 195: /* Line 1455 of yacc.c */ -#line 1642 "program_parse.y" +#line 1643 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4083,7 +4084,7 @@ yyreduce: case 196: /* Line 1455 of yacc.c */ -#line 1646 "program_parse.y" +#line 1647 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -4092,7 +4093,7 @@ yyreduce: case 197: /* Line 1455 of yacc.c */ -#line 1652 "program_parse.y" +#line 1653 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} @@ -4101,7 +4102,7 @@ yyreduce: case 198: /* Line 1455 of yacc.c */ -#line 1656 "program_parse.y" +#line 1657 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} @@ -4110,7 +4111,7 @@ yyreduce: case 199: /* Line 1455 of yacc.c */ -#line 1660 "program_parse.y" +#line 1661 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} @@ -4119,7 +4120,7 @@ yyreduce: case 200: /* Line 1455 of yacc.c */ -#line 1666 "program_parse.y" +#line 1667 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -4133,7 +4134,7 @@ yyreduce: case 201: /* Line 1455 of yacc.c */ -#line 1677 "program_parse.y" +#line 1678 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4143,7 +4144,7 @@ yyreduce: case 202: /* Line 1455 of yacc.c */ -#line 1682 "program_parse.y" +#line 1683 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; @@ -4153,7 +4154,7 @@ yyreduce: case 203: /* Line 1455 of yacc.c */ -#line 1687 "program_parse.y" +#line 1688 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; @@ -4163,7 +4164,7 @@ yyreduce: case 204: /* Line 1455 of yacc.c */ -#line 1692 "program_parse.y" +#line 1693 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4173,7 +4174,7 @@ yyreduce: case 205: /* Line 1455 of yacc.c */ -#line 1697 "program_parse.y" +#line 1698 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -4183,7 +4184,7 @@ yyreduce: case 206: /* Line 1455 of yacc.c */ -#line 1702 "program_parse.y" +#line 1703 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); @@ -4193,7 +4194,7 @@ yyreduce: case 207: /* Line 1455 of yacc.c */ -#line 1709 "program_parse.y" +#line 1710 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4202,7 +4203,7 @@ yyreduce: case 208: /* Line 1455 of yacc.c */ -#line 1713 "program_parse.y" +#line 1714 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} @@ -4211,7 +4212,7 @@ yyreduce: case 209: /* Line 1455 of yacc.c */ -#line 1718 "program_parse.y" +#line 1719 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -4228,7 +4229,7 @@ yyreduce: case 210: /* Line 1455 of yacc.c */ -#line 1731 "program_parse.y" +#line 1732 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -4240,7 +4241,7 @@ yyreduce: case 211: /* Line 1455 of yacc.c */ -#line 1739 "program_parse.y" +#line 1740 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -4254,7 +4255,7 @@ yyreduce: case 212: /* Line 1455 of yacc.c */ -#line 1750 "program_parse.y" +#line 1751 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; @@ -4264,7 +4265,7 @@ yyreduce: case 217: /* Line 1455 of yacc.c */ -#line 1762 "program_parse.y" +#line 1763 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4277,7 +4278,7 @@ yyreduce: case 218: /* Line 1455 of yacc.c */ -#line 1772 "program_parse.y" +#line 1773 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4287,7 +4288,7 @@ yyreduce: case 219: /* Line 1455 of yacc.c */ -#line 1777 "program_parse.y" +#line 1778 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4297,7 +4298,7 @@ yyreduce: case 220: /* Line 1455 of yacc.c */ -#line 1784 "program_parse.y" +#line 1785 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4310,7 +4311,7 @@ yyreduce: case 221: /* Line 1455 of yacc.c */ -#line 1794 "program_parse.y" +#line 1795 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4323,7 +4324,7 @@ yyreduce: case 222: /* Line 1455 of yacc.c */ -#line 1803 "program_parse.y" +#line 1804 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4333,7 +4334,7 @@ yyreduce: case 223: /* Line 1455 of yacc.c */ -#line 1808 "program_parse.y" +#line 1809 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4343,7 +4344,7 @@ yyreduce: case 224: /* Line 1455 of yacc.c */ -#line 1815 "program_parse.y" +#line 1816 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4356,7 +4357,7 @@ yyreduce: case 225: /* Line 1455 of yacc.c */ -#line 1825 "program_parse.y" +#line 1826 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4369,7 +4370,7 @@ yyreduce: case 226: /* Line 1455 of yacc.c */ -#line 1835 "program_parse.y" +#line 1836 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4382,7 +4383,7 @@ yyreduce: case 231: /* Line 1455 of yacc.c */ -#line 1850 "program_parse.y" +#line 1851 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4395,7 +4396,7 @@ yyreduce: case 232: /* Line 1455 of yacc.c */ -#line 1860 "program_parse.y" +#line 1861 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4408,7 +4409,7 @@ yyreduce: case 233: /* Line 1455 of yacc.c */ -#line 1868 "program_parse.y" +#line 1869 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4421,7 +4422,7 @@ yyreduce: case 234: /* Line 1455 of yacc.c */ -#line 1878 "program_parse.y" +#line 1879 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4434,7 +4435,7 @@ yyreduce: case 235: /* Line 1455 of yacc.c */ -#line 1886 "program_parse.y" +#line 1887 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4447,7 +4448,7 @@ yyreduce: case 236: /* Line 1455 of yacc.c */ -#line 1895 "program_parse.y" +#line 1896 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4460,7 +4461,7 @@ yyreduce: case 237: /* Line 1455 of yacc.c */ -#line 1904 "program_parse.y" +#line 1905 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4473,7 +4474,7 @@ yyreduce: case 238: /* Line 1455 of yacc.c */ -#line 1914 "program_parse.y" +#line 1915 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} @@ -4482,7 +4483,7 @@ yyreduce: case 239: /* Line 1455 of yacc.c */ -#line 1918 "program_parse.y" +#line 1919 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} @@ -4491,35 +4492,35 @@ yyreduce: case 240: /* Line 1455 of yacc.c */ -#line 1923 "program_parse.y" +#line 1924 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 241: /* Line 1455 of yacc.c */ -#line 1924 "program_parse.y" +#line 1925 "program_parse.y" { (yyval.negate) = TRUE; ;} break; case 242: /* Line 1455 of yacc.c */ -#line 1925 "program_parse.y" +#line 1926 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 243: /* Line 1455 of yacc.c */ -#line 1928 "program_parse.y" +#line 1929 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 245: /* Line 1455 of yacc.c */ -#line 1932 "program_parse.y" +#line 1933 "program_parse.y" { /* NV_fragment_program_option defines the size qualifiers in a * fairly broken way. "SHORT" or "LONG" can optionally be used @@ -4558,7 +4559,7 @@ yyreduce: case 246: /* Line 1455 of yacc.c */ -#line 1966 "program_parse.y" +#line 1967 "program_parse.y" { ;} break; @@ -4566,14 +4567,14 @@ yyreduce: case 247: /* Line 1455 of yacc.c */ -#line 1970 "program_parse.y" +#line 1971 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 249: /* Line 1455 of yacc.c */ -#line 1974 "program_parse.y" +#line 1975 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { free((yyvsp[(3) - (3)].string)); @@ -4585,7 +4586,7 @@ yyreduce: case 250: /* Line 1455 of yacc.c */ -#line 1981 "program_parse.y" +#line 1982 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { free((yyvsp[(1) - (1)].string)); @@ -4597,7 +4598,7 @@ yyreduce: case 251: /* Line 1455 of yacc.c */ -#line 1990 "program_parse.y" +#line 1991 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)])); @@ -4614,7 +4615,7 @@ yyreduce: case 252: /* Line 1455 of yacc.c */ -#line 2004 "program_parse.y" +#line 2005 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4628,7 +4629,7 @@ yyreduce: case 253: /* Line 1455 of yacc.c */ -#line 2013 "program_parse.y" +#line 2014 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4642,7 +4643,7 @@ yyreduce: case 254: /* Line 1455 of yacc.c */ -#line 2022 "program_parse.y" +#line 2023 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} @@ -4651,7 +4652,7 @@ yyreduce: case 255: /* Line 1455 of yacc.c */ -#line 2026 "program_parse.y" +#line 2027 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4665,7 +4666,7 @@ yyreduce: case 256: /* Line 1455 of yacc.c */ -#line 2035 "program_parse.y" +#line 2036 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4679,7 +4680,7 @@ yyreduce: case 257: /* Line 1455 of yacc.c */ -#line 2044 "program_parse.y" +#line 2045 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4693,7 +4694,7 @@ yyreduce: case 258: /* Line 1455 of yacc.c */ -#line 2055 "program_parse.y" +#line 2056 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} @@ -4702,7 +4703,7 @@ yyreduce: case 259: /* Line 1455 of yacc.c */ -#line 2061 "program_parse.y" +#line 2062 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4713,7 +4714,7 @@ yyreduce: case 260: /* Line 1455 of yacc.c */ -#line 2067 "program_parse.y" +#line 2068 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4727,7 +4728,7 @@ yyreduce: case 261: /* Line 1455 of yacc.c */ -#line 2076 "program_parse.y" +#line 2077 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4741,7 +4742,7 @@ yyreduce: case 262: /* Line 1455 of yacc.c */ -#line 2087 "program_parse.y" +#line 2088 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4750,7 +4751,7 @@ yyreduce: case 263: /* Line 1455 of yacc.c */ -#line 2091 "program_parse.y" +#line 2092 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4764,7 +4765,7 @@ yyreduce: case 264: /* Line 1455 of yacc.c */ -#line 2100 "program_parse.y" +#line 2101 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4778,91 +4779,91 @@ yyreduce: case 265: /* Line 1455 of yacc.c */ -#line 2110 "program_parse.y" +#line 2111 "program_parse.y" { (yyval.integer) = 0; ;} break; case 266: /* Line 1455 of yacc.c */ -#line 2111 "program_parse.y" +#line 2112 "program_parse.y" { (yyval.integer) = 0; ;} break; case 267: /* Line 1455 of yacc.c */ -#line 2112 "program_parse.y" +#line 2113 "program_parse.y" { (yyval.integer) = 1; ;} break; case 268: /* Line 1455 of yacc.c */ -#line 2115 "program_parse.y" +#line 2116 "program_parse.y" { (yyval.integer) = 0; ;} break; case 269: /* Line 1455 of yacc.c */ -#line 2116 "program_parse.y" +#line 2117 "program_parse.y" { (yyval.integer) = 0; ;} break; case 270: /* Line 1455 of yacc.c */ -#line 2117 "program_parse.y" +#line 2118 "program_parse.y" { (yyval.integer) = 1; ;} break; case 271: /* Line 1455 of yacc.c */ -#line 2120 "program_parse.y" +#line 2121 "program_parse.y" { (yyval.integer) = 0; ;} break; case 272: /* Line 1455 of yacc.c */ -#line 2121 "program_parse.y" +#line 2122 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 273: /* Line 1455 of yacc.c */ -#line 2124 "program_parse.y" +#line 2125 "program_parse.y" { (yyval.integer) = 0; ;} break; case 274: /* Line 1455 of yacc.c */ -#line 2125 "program_parse.y" +#line 2126 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 275: /* Line 1455 of yacc.c */ -#line 2128 "program_parse.y" +#line 2129 "program_parse.y" { (yyval.integer) = 0; ;} break; case 276: /* Line 1455 of yacc.c */ -#line 2129 "program_parse.y" +#line 2130 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 277: /* Line 1455 of yacc.c */ -#line 2133 "program_parse.y" +#line 2134 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4876,7 +4877,7 @@ yyreduce: case 278: /* Line 1455 of yacc.c */ -#line 2144 "program_parse.y" +#line 2145 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4890,7 +4891,7 @@ yyreduce: case 279: /* Line 1455 of yacc.c */ -#line 2155 "program_parse.y" +#line 2156 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4904,7 +4905,7 @@ yyreduce: case 280: /* Line 1455 of yacc.c */ -#line 2166 "program_parse.y" +#line 2167 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4933,7 +4934,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4937 "program_parse.tab.c" +#line 4938 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5152,7 +5153,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 2195 "program_parse.y" +#line 2196 "program_parse.y" void @@ -5557,24 +5558,25 @@ make_error_string(const char *fmt, ...) char *str; va_list args; - va_start(args, fmt); /* Call vsnprintf once to determine how large the final string is. Call it - * again to do the actual formatting. from the v_mesa_snprintf manual page: + * again to do the actual formatting. from the vsnprintf manual page: * * Upon successful return, these functions return the number of * characters printed (not including the trailing '\0' used to end * output to strings). */ + va_start(args, fmt); length = 1 + vsnprintf(NULL, 0, fmt, args); + va_end(args); str = malloc(length); if (str) { + va_start(args, fmt); vsnprintf(str, length, fmt, args); + va_end(args); } - va_end(args); - return str; } @@ -5587,7 +5589,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s) err_str = make_error_string("glProgramStringARB(%s)\n", s); if (err_str) { - _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str); + _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str); free(err_str); } diff --git a/mesalib/src/mesa/shader/program_parse.tab.h b/mesalib/src/mesa/program/program_parse.tab.h index 045241d9e..045241d9e 100644 --- a/mesalib/src/mesa/shader/program_parse.tab.h +++ b/mesalib/src/mesa/program/program_parse.tab.h diff --git a/mesalib/src/mesa/shader/program_parse.y b/mesalib/src/mesa/program/program_parse.y index d5fb0fac3..cf621ae42 100644 --- a/mesalib/src/mesa/shader/program_parse.y +++ b/mesalib/src/mesa/program/program_parse.y @@ -27,14 +27,14 @@ #include "main/mtypes.h" #include "main/imports.h" -#include "shader/program.h" -#include "shader/prog_parameter.h" -#include "shader/prog_parameter_layout.h" -#include "shader/prog_statevars.h" -#include "shader/prog_instruction.h" +#include "program/program.h" +#include "program/prog_parameter.h" +#include "program/prog_parameter_layout.h" +#include "program/prog_statevars.h" +#include "program/prog_instruction.h" -#include "shader/symbol_table.h" -#include "shader/program_parser.h" +#include "program/symbol_table.h" +#include "program/program_parser.h" extern void *yy_scan_string(char *); extern void yy_delete_buffer(void *); @@ -835,6 +835,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ $$.Base.File = $1->param_binding_type; if ($3.Base.RelAddr) { + state->prog->IndirectRegisterFiles |= (1 << $$.Base.File); $1->param_accessed_indirectly = 1; $$.Base.RelAddr = 1; @@ -934,7 +935,7 @@ addrRegRelOffset: { $$ = 0; } addrRegPosOffset: INTEGER { - if (($1 < 0) || ($1 > 63)) { + if (($1 < 0) || ($1 > 4095)) { char s[100]; _mesa_snprintf(s, sizeof(s), "relative address offset too large (%d)", $1); @@ -948,7 +949,7 @@ addrRegPosOffset: INTEGER addrRegNegOffset: INTEGER { - if (($1 < 0) || ($1 > 64)) { + if (($1 < 0) || ($1 > 4096)) { char s[100]; _mesa_snprintf(s, sizeof(s), "relative address offset too large (%d)", $1); @@ -1219,7 +1220,7 @@ PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit s->param_binding_type = $3.param_binding_type; s->param_binding_begin = $3.param_binding_begin; s->param_binding_length = $3.param_binding_length; - s->param_binding_swizzle = SWIZZLE_XYZW; + s->param_binding_swizzle = $3.param_binding_swizzle; s->param_is_array = 0; } } @@ -2596,24 +2597,25 @@ make_error_string(const char *fmt, ...) char *str; va_list args; - va_start(args, fmt); /* Call vsnprintf once to determine how large the final string is. Call it - * again to do the actual formatting. from the v_mesa_snprintf manual page: + * again to do the actual formatting. from the vsnprintf manual page: * * Upon successful return, these functions return the number of * characters printed (not including the trailing '\0' used to end * output to strings). */ + va_start(args, fmt); length = 1 + vsnprintf(NULL, 0, fmt, args); + va_end(args); str = malloc(length); if (str) { + va_start(args, fmt); vsnprintf(str, length, fmt, args); + va_end(args); } - va_end(args); - return str; } @@ -2626,7 +2628,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s) err_str = make_error_string("glProgramStringARB(%s)\n", s); if (err_str) { - _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str); + _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str); free(err_str); } diff --git a/mesalib/src/mesa/shader/program_parse_extra.c b/mesalib/src/mesa/program/program_parse_extra.c index ae98b782b..ae98b782b 100644 --- a/mesalib/src/mesa/shader/program_parse_extra.c +++ b/mesalib/src/mesa/program/program_parse_extra.c diff --git a/mesalib/src/mesa/shader/program_parser.h b/mesalib/src/mesa/program/program_parser.h index be952d4b9..be952d4b9 100644 --- a/mesalib/src/mesa/shader/program_parser.h +++ b/mesalib/src/mesa/program/program_parser.h diff --git a/mesalib/src/mesa/shader/programopt.c b/mesalib/src/mesa/program/programopt.c index fb2ebe633..fb2ebe633 100644 --- a/mesalib/src/mesa/shader/programopt.c +++ b/mesalib/src/mesa/program/programopt.c diff --git a/mesalib/src/mesa/shader/programopt.h b/mesalib/src/mesa/program/programopt.h index 21fac0784..4af6357f9 100644 --- a/mesalib/src/mesa/shader/programopt.h +++ b/mesalib/src/mesa/program/programopt.h @@ -26,6 +26,7 @@ #ifndef PROGRAMOPT_H #define PROGRAMOPT_H 1 +#include "main/mtypes.h" extern void _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog); diff --git a/mesalib/src/mesa/shader/symbol_table.c b/mesalib/src/mesa/program/symbol_table.c index 6a5d68689..09e7cb44e 100644 --- a/mesalib/src/mesa/shader/symbol_table.c +++ b/mesalib/src/mesa/program/symbol_table.c @@ -58,7 +58,9 @@ struct symbol { */ int name_space; - + /** Scope depth where this symbol was defined. */ + unsigned depth; + /** * Arbitrary user supplied data. */ @@ -73,7 +75,7 @@ struct symbol_header { struct symbol_header *next; /** Symbol name. */ - const char *name; + char *name; /** Linked list of symbols with the same name. */ struct symbol *symbols; @@ -104,6 +106,9 @@ struct _mesa_symbol_table { /** List of all symbol headers in the table. */ struct symbol_header *hdr; + + /** Current scope depth. */ + unsigned depth; }; @@ -157,6 +162,7 @@ _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table) struct symbol *sym = scope->symbols; table->current_scope = scope->next; + table->depth--; free(scope); @@ -184,6 +190,7 @@ _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table) scope->next = table->current_scope; table->current_scope = scope; + table->depth++; } @@ -261,6 +268,36 @@ _mesa_symbol_table_iterator_next(struct _mesa_symbol_table_iterator *iter) } +/** + * Determine the scope "distance" of a symbol from the current scope + * + * \return + * A non-negative number for the number of scopes between the current scope + * and the scope where a symbol was defined. A value of zero means the current + * scope. A negative number if the symbol does not exist. + */ +int +_mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table, + int name_space, const char *name) +{ + struct symbol_header *const hdr = find_symbol(table, name); + struct symbol *sym; + + if (hdr != NULL) { + for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) { + assert(sym->hdr == hdr); + + if ((name_space == -1) || (sym->name_space == name_space)) { + assert(sym->depth <= table->depth); + return sym->depth - table->depth; + } + } + } + + return -1; +} + + void * _mesa_symbol_table_find_symbol(struct _mesa_symbol_table *table, int name_space, const char *name) @@ -300,21 +337,34 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, if (hdr == NULL) { hdr = calloc(1, sizeof(*hdr)); - hdr->name = name; + hdr->name = strdup(name); - hash_table_insert(table->ht, hdr, name); + hash_table_insert(table->ht, hdr, hdr->name); hdr->next = table->hdr; table->hdr = hdr; } check_symbol_table(table); + /* If the symbol already exists in this namespace at this scope, it cannot + * be added to the table. + */ + for (sym = hdr->symbols + ; (sym != NULL) && (sym->name_space != name_space) + ; sym = sym->next_with_same_name) { + /* empty */ + } + + if (sym && (sym->depth == table->depth)) + return -1; + sym = calloc(1, sizeof(*sym)); sym->next_with_same_name = hdr->symbols; sym->next_with_same_scope = table->current_scope->symbols; sym->hdr = hdr; sym->name_space = name_space; sym->data = declaration; + sym->depth = table->depth; assert(sym->hdr == hdr); @@ -354,6 +404,7 @@ _mesa_symbol_table_dtor(struct _mesa_symbol_table *table) for (hdr = table->hdr; hdr != NULL; hdr = next) { next = hdr->next; + free(hdr->name); free(hdr); } diff --git a/mesalib/src/mesa/shader/symbol_table.h b/mesalib/src/mesa/program/symbol_table.h index 0c054ef13..1d570fc1a 100644 --- a/mesalib/src/mesa/shader/symbol_table.h +++ b/mesalib/src/mesa/program/symbol_table.h @@ -33,6 +33,9 @@ extern void _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table); extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *symtab, int name_space, const char *name, void *declaration); +extern int _mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table, + int name_space, const char *name); + extern void *_mesa_symbol_table_find_symbol( struct _mesa_symbol_table *symtab, int name_space, const char *name); diff --git a/mesalib/src/mesa/shader/shader_api.c b/mesalib/src/mesa/shader/shader_api.c deleted file mode 100644 index 5e87bb405..000000000 --- a/mesalib/src/mesa/shader/shader_api.c +++ /dev/null @@ -1,2233 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.6 - * - * Copyright (C) 2004-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file shader_api.c - * Implementation of GLSL-related API functions - * \author Brian Paul - */ - -/** - * XXX things to do: - * 1. Check that the right error code is generated for all _mesa_error() calls. - * 2. Insert FLUSH_VERTICES calls in various places - */ - - -#include "main/glheader.h" -#include "main/context.h" -#include "main/hash.h" -#include "shader/program.h" -#include "shader/prog_parameter.h" -#include "shader/prog_statevars.h" -#include "shader/prog_uniform.h" -#include "shader/shader_api.h" -#include "shader/slang/slang_compile.h" -#include "shader/slang/slang_link.h" -#include "main/dispatch.h" - - -/** - * Allocate a new gl_shader_program object, initialize it. - */ -static struct gl_shader_program * -_mesa_new_shader_program(GLcontext *ctx, GLuint name) -{ - struct gl_shader_program *shProg; - shProg = CALLOC_STRUCT(gl_shader_program); - if (shProg) { - shProg->Type = GL_SHADER_PROGRAM_MESA; - shProg->Name = name; - shProg->RefCount = 1; - shProg->Attributes = _mesa_new_parameter_list(); - } - return shProg; -} - - -/** - * Clear (free) the shader program state that gets produced by linking. - */ -void -_mesa_clear_shader_program_data(GLcontext *ctx, - struct gl_shader_program *shProg) -{ - _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); - _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL); - - if (shProg->Uniforms) { - _mesa_free_uniform_list(shProg->Uniforms); - shProg->Uniforms = NULL; - } - - if (shProg->Varying) { - _mesa_free_parameter_list(shProg->Varying); - shProg->Varying = NULL; - } -} - - -/** - * Free all the data that hangs off a shader program object, but not the - * object itself. - */ -void -_mesa_free_shader_program_data(GLcontext *ctx, - struct gl_shader_program *shProg) -{ - GLuint i; - - assert(shProg->Type == GL_SHADER_PROGRAM_MESA); - - _mesa_clear_shader_program_data(ctx, shProg); - - if (shProg->Attributes) { - _mesa_free_parameter_list(shProg->Attributes); - shProg->Attributes = NULL; - } - - /* detach shaders */ - for (i = 0; i < shProg->NumShaders; i++) { - _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL); - } - shProg->NumShaders = 0; - - if (shProg->Shaders) { - free(shProg->Shaders); - shProg->Shaders = NULL; - } - - if (shProg->InfoLog) { - free(shProg->InfoLog); - shProg->InfoLog = NULL; - } -} - - -/** - * Free/delete a shader program object. - */ -void -_mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg) -{ - _mesa_free_shader_program_data(ctx, shProg); - - free(shProg); -} - - -/** - * Set ptr to point to shProg. - * If ptr is pointing to another object, decrement its refcount (and delete - * if refcount hits zero). - * Then set ptr to point to shProg, incrementing its refcount. - */ -/* XXX this could be static */ -void -_mesa_reference_shader_program(GLcontext *ctx, - struct gl_shader_program **ptr, - struct gl_shader_program *shProg) -{ - assert(ptr); - if (*ptr == shProg) { - /* no-op */ - return; - } - if (*ptr) { - /* Unreference the old shader program */ - GLboolean deleteFlag = GL_FALSE; - struct gl_shader_program *old = *ptr; - - ASSERT(old->RefCount > 0); - old->RefCount--; -#if 0 - printf("ShaderProgram %p ID=%u RefCount-- to %d\n", - (void *) old, old->Name, old->RefCount); -#endif - deleteFlag = (old->RefCount == 0); - - if (deleteFlag) { - _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name); - _mesa_free_shader_program(ctx, old); - } - - *ptr = NULL; - } - assert(!*ptr); - - if (shProg) { - shProg->RefCount++; -#if 0 - printf("ShaderProgram %p ID=%u RefCount++ to %d\n", - (void *) shProg, shProg->Name, shProg->RefCount); -#endif - *ptr = shProg; - } -} - - -/** - * Lookup a GLSL program object. - */ -struct gl_shader_program * -_mesa_lookup_shader_program(GLcontext *ctx, GLuint name) -{ - struct gl_shader_program *shProg; - if (name) { - shProg = (struct gl_shader_program *) - _mesa_HashLookup(ctx->Shared->ShaderObjects, name); - /* Note that both gl_shader and gl_shader_program objects are kept - * in the same hash table. Check the object's type to be sure it's - * what we're expecting. - */ - if (shProg && shProg->Type != GL_SHADER_PROGRAM_MESA) { - return NULL; - } - return shProg; - } - return NULL; -} - - -/** - * As above, but record an error if program is not found. - */ -static struct gl_shader_program * -_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name, - const char *caller) -{ - if (!name) { - _mesa_error(ctx, GL_INVALID_VALUE, caller); - return NULL; - } - else { - struct gl_shader_program *shProg = (struct gl_shader_program *) - _mesa_HashLookup(ctx->Shared->ShaderObjects, name); - if (!shProg) { - _mesa_error(ctx, GL_INVALID_VALUE, caller); - return NULL; - } - if (shProg->Type != GL_SHADER_PROGRAM_MESA) { - _mesa_error(ctx, GL_INVALID_OPERATION, caller); - return NULL; - } - return shProg; - } -} - - - - -/** - * Allocate a new gl_shader object, initialize it. - */ -struct gl_shader * -_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) -{ - struct gl_shader *shader; - assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER); - shader = CALLOC_STRUCT(gl_shader); - if (shader) { - shader->Type = type; - shader->Name = name; - shader->RefCount = 1; - } - return shader; -} - - -void -_mesa_free_shader(GLcontext *ctx, struct gl_shader *sh) -{ - if (sh->Source) - free((void *) sh->Source); - if (sh->InfoLog) - free(sh->InfoLog); - _mesa_reference_program(ctx, &sh->Program, NULL); - free(sh); -} - - -/** - * Set ptr to point to sh. - * If ptr is pointing to another shader, decrement its refcount (and delete - * if refcount hits zero). - * Then set ptr to point to sh, incrementing its refcount. - */ -/* XXX this could be static */ -void -_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr, - struct gl_shader *sh) -{ - assert(ptr); - if (*ptr == sh) { - /* no-op */ - return; - } - if (*ptr) { - /* Unreference the old shader */ - GLboolean deleteFlag = GL_FALSE; - struct gl_shader *old = *ptr; - - ASSERT(old->RefCount > 0); - old->RefCount--; - /*printf("SHADER DECR %p (%d) to %d\n", - (void*) old, old->Name, old->RefCount);*/ - deleteFlag = (old->RefCount == 0); - - if (deleteFlag) { - _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name); - _mesa_free_shader(ctx, old); - } - - *ptr = NULL; - } - assert(!*ptr); - - if (sh) { - /* reference new */ - sh->RefCount++; - /*printf("SHADER INCR %p (%d) to %d\n", - (void*) sh, sh->Name, sh->RefCount);*/ - *ptr = sh; - } -} - - -/** - * Lookup a GLSL shader object. - */ -struct gl_shader * -_mesa_lookup_shader(GLcontext *ctx, GLuint name) -{ - if (name) { - struct gl_shader *sh = (struct gl_shader *) - _mesa_HashLookup(ctx->Shared->ShaderObjects, name); - /* Note that both gl_shader and gl_shader_program objects are kept - * in the same hash table. Check the object's type to be sure it's - * what we're expecting. - */ - if (sh && sh->Type == GL_SHADER_PROGRAM_MESA) { - return NULL; - } - return sh; - } - return NULL; -} - - -/** - * As above, but record an error if shader is not found. - */ -static struct gl_shader * -_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller) -{ - if (!name) { - _mesa_error(ctx, GL_INVALID_VALUE, caller); - return NULL; - } - else { - struct gl_shader *sh = (struct gl_shader *) - _mesa_HashLookup(ctx->Shared->ShaderObjects, name); - if (!sh) { - _mesa_error(ctx, GL_INVALID_VALUE, caller); - return NULL; - } - if (sh->Type == GL_SHADER_PROGRAM_MESA) { - _mesa_error(ctx, GL_INVALID_OPERATION, caller); - return NULL; - } - return sh; - } -} - - -/** - * Return mask of GLSL_x flags by examining the MESA_GLSL env var. - */ -static GLbitfield -get_shader_flags(void) -{ - GLbitfield flags = 0x0; - const char *env = _mesa_getenv("MESA_GLSL"); - - if (env) { - if (strstr(env, "dump")) - flags |= GLSL_DUMP; - if (strstr(env, "log")) - flags |= GLSL_LOG; - if (strstr(env, "nopvert")) - flags |= GLSL_NOP_VERT; - if (strstr(env, "nopfrag")) - flags |= GLSL_NOP_FRAG; - if (strstr(env, "nopt")) - flags |= GLSL_NO_OPT; - else if (strstr(env, "opt")) - flags |= GLSL_OPT; - if (strstr(env, "uniform")) - flags |= GLSL_UNIFORMS; - if (strstr(env, "useprog")) - flags |= GLSL_USE_PROG; - } - - return flags; -} - - -/** - * Initialize context's shader state. - */ -void -_mesa_init_shader_state(GLcontext * ctx) -{ - /* Device drivers may override these to control what kind of instructions - * are generated by the GLSL compiler. - */ - ctx->Shader.EmitHighLevelInstructions = GL_TRUE; - ctx->Shader.EmitContReturn = GL_TRUE; - ctx->Shader.EmitCondCodes = GL_FALSE; - ctx->Shader.EmitComments = GL_FALSE; - ctx->Shader.Flags = get_shader_flags(); - - /* Default pragma settings */ - ctx->Shader.DefaultPragmas.IgnoreOptimize = GL_FALSE; - ctx->Shader.DefaultPragmas.IgnoreDebug = GL_FALSE; - ctx->Shader.DefaultPragmas.Optimize = GL_TRUE; - ctx->Shader.DefaultPragmas.Debug = GL_FALSE; -} - - -/** - * Free the per-context shader-related state. - */ -void -_mesa_free_shader_state(GLcontext *ctx) -{ - _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, NULL); -} - - -/** - * Copy string from <src> to <dst>, up to maxLength characters, returning - * length of <dst> in <length>. - * \param src the strings source - * \param maxLength max chars to copy - * \param length returns number of chars copied - * \param dst the string destination - */ -static void -copy_string(GLchar *dst, GLsizei maxLength, GLsizei *length, const GLchar *src) -{ - GLsizei len; - for (len = 0; len < maxLength - 1 && src && src[len]; len++) - dst[len] = src[len]; - if (maxLength > 0) - dst[len] = 0; - if (length) - *length = len; -} - - -static GLboolean -_mesa_is_program(GLcontext *ctx, GLuint name) -{ - struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name); - return shProg ? GL_TRUE : GL_FALSE; -} - - -static GLboolean -_mesa_is_shader(GLcontext *ctx, GLuint name) -{ - struct gl_shader *shader = _mesa_lookup_shader(ctx, name); - return shader ? GL_TRUE : GL_FALSE; -} - - -/** - * Called via ctx->Driver.AttachShader() - */ -static void -_mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader) -{ - struct gl_shader_program *shProg; - struct gl_shader *sh; - GLuint i, n; - - shProg = _mesa_lookup_shader_program_err(ctx, program, "glAttachShader"); - if (!shProg) - return; - - sh = _mesa_lookup_shader_err(ctx, shader, "glAttachShader"); - if (!sh) { - return; - } - - n = shProg->NumShaders; - for (i = 0; i < n; i++) { - if (shProg->Shaders[i] == sh) { - /* The shader is already attched to this program. The - * GL_ARB_shader_objects spec says: - * - * "The error INVALID_OPERATION is generated by AttachObjectARB - * if <obj> is already attached to <containerObj>." - */ - _mesa_error(ctx, GL_INVALID_OPERATION, "glAttachShader"); - return; - } - } - - /* grow list */ - shProg->Shaders = (struct gl_shader **) - _mesa_realloc(shProg->Shaders, - n * sizeof(struct gl_shader *), - (n + 1) * sizeof(struct gl_shader *)); - if (!shProg->Shaders) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader"); - return; - } - - /* append */ - shProg->Shaders[n] = NULL; /* since realloc() didn't zero the new space */ - _mesa_reference_shader(ctx, &shProg->Shaders[n], sh); - shProg->NumShaders++; -} - - -static GLint -_mesa_get_attrib_location(GLcontext *ctx, GLuint program, - const GLchar *name) -{ - struct gl_shader_program *shProg - = _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation"); - - if (!shProg) { - return -1; - } - - if (!shProg->LinkStatus) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetAttribLocation(program not linked)"); - return -1; - } - - if (!name) - return -1; - - if (shProg->VertexProgram) { - const struct gl_program_parameter_list *attribs = - shProg->VertexProgram->Base.Attributes; - if (attribs) { - GLint i = _mesa_lookup_parameter_index(attribs, -1, name); - if (i >= 0) { - return attribs->Parameters[i].StateIndexes[0]; - } - } - } - return -1; -} - - -static void -_mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index, - const GLchar *name) -{ - struct gl_shader_program *shProg; - const GLint size = -1; /* unknown size */ - GLint i, oldIndex; - GLenum datatype = GL_FLOAT_VEC4; - - shProg = _mesa_lookup_shader_program_err(ctx, program, - "glBindAttribLocation"); - if (!shProg) { - return; - } - - if (!name) - return; - - if (strncmp(name, "gl_", 3) == 0) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBindAttribLocation(illegal name)"); - return; - } - - if (index >= ctx->Const.VertexProgram.MaxAttribs) { - _mesa_error(ctx, GL_INVALID_VALUE, "glBindAttribLocation(index)"); - return; - } - - if (shProg->LinkStatus) { - /* get current index/location for the attribute */ - oldIndex = _mesa_get_attrib_location(ctx, program, name); - } - else { - oldIndex = -1; - } - - /* this will replace the current value if it's already in the list */ - i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index); - if (i < 0) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindAttribLocation"); - return; - } - - /* - * Note that this attribute binding won't go into effect until - * glLinkProgram is called again. - */ -} - - -static GLuint -_mesa_create_shader(GLcontext *ctx, GLenum type) -{ - struct gl_shader *sh; - GLuint name; - - name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1); - - switch (type) { - case GL_FRAGMENT_SHADER: - case GL_VERTEX_SHADER: - sh = _mesa_new_shader(ctx, name, type); - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "CreateShader(type)"); - return 0; - } - - _mesa_HashInsert(ctx->Shared->ShaderObjects, name, sh); - - return name; -} - - -static GLuint -_mesa_create_program(GLcontext *ctx) -{ - GLuint name; - struct gl_shader_program *shProg; - - name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1); - shProg = _mesa_new_shader_program(ctx, name); - - _mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg); - - assert(shProg->RefCount == 1); - - return name; -} - - -/** - * Named w/ "2" to indicate OpenGL 2.x vs GL_ARB_fragment_programs's - * DeleteProgramARB. - */ -static void -_mesa_delete_program2(GLcontext *ctx, GLuint name) -{ - /* - * NOTE: deleting shaders/programs works a bit differently than - * texture objects (and buffer objects, etc). Shader/program - * handles/IDs exist in the hash table until the object is really - * deleted (refcount==0). With texture objects, the handle/ID is - * removed from the hash table in glDeleteTextures() while the tex - * object itself might linger until its refcount goes to zero. - */ - struct gl_shader_program *shProg; - - shProg = _mesa_lookup_shader_program_err(ctx, name, "glDeleteProgram"); - if (!shProg) - return; - - shProg->DeletePending = GL_TRUE; - - /* effectively, decr shProg's refcount */ - _mesa_reference_shader_program(ctx, &shProg, NULL); -} - - -static void -_mesa_delete_shader(GLcontext *ctx, GLuint shader) -{ - struct gl_shader *sh; - - sh = _mesa_lookup_shader_err(ctx, shader, "glDeleteShader"); - if (!sh) - return; - - sh->DeletePending = GL_TRUE; - - /* effectively, decr sh's refcount */ - _mesa_reference_shader(ctx, &sh, NULL); -} - - -static void -_mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader) -{ - struct gl_shader_program *shProg; - GLuint n; - GLuint i, j; - - shProg = _mesa_lookup_shader_program_err(ctx, program, "glDetachShader"); - if (!shProg) - return; - - n = shProg->NumShaders; - - for (i = 0; i < n; i++) { - if (shProg->Shaders[i]->Name == shader) { - /* found it */ - struct gl_shader **newList; - - /* release */ - _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL); - - /* alloc new, smaller array */ - newList = (struct gl_shader **) - malloc((n - 1) * sizeof(struct gl_shader *)); - if (!newList) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader"); - return; - } - for (j = 0; j < i; j++) { - newList[j] = shProg->Shaders[j]; - } - while (++i < n) - newList[j++] = shProg->Shaders[i]; - free(shProg->Shaders); - - shProg->Shaders = newList; - shProg->NumShaders = n - 1; - -#ifdef DEBUG - /* sanity check */ - { - for (j = 0; j < shProg->NumShaders; j++) { - assert(shProg->Shaders[j]->Type == GL_VERTEX_SHADER || - shProg->Shaders[j]->Type == GL_FRAGMENT_SHADER); - assert(shProg->Shaders[j]->RefCount > 0); - } - } -#endif - - return; - } - } - - /* not found */ - { - GLenum err; - if (_mesa_is_shader(ctx, shader)) - err = GL_INVALID_OPERATION; - else if (_mesa_is_program(ctx, shader)) - err = GL_INVALID_OPERATION; - else - err = GL_INVALID_VALUE; - _mesa_error(ctx, err, "glDetachProgram(shader)"); - return; - } -} - - -static GLint -sizeof_glsl_type(GLenum type) -{ - switch (type) { - case GL_FLOAT: - case GL_INT: - case GL_BOOL: - case GL_SAMPLER_1D: - case GL_SAMPLER_2D: - case GL_SAMPLER_3D: - case GL_SAMPLER_CUBE: - case GL_SAMPLER_1D_SHADOW: - case GL_SAMPLER_2D_SHADOW: - case GL_SAMPLER_2D_RECT_ARB: - case GL_SAMPLER_2D_RECT_SHADOW_ARB: - case GL_SAMPLER_1D_ARRAY_EXT: - case GL_SAMPLER_2D_ARRAY_EXT: - case GL_SAMPLER_1D_ARRAY_SHADOW_EXT: - case GL_SAMPLER_2D_ARRAY_SHADOW_EXT: - case GL_SAMPLER_CUBE_SHADOW_EXT: - return 1; - case GL_FLOAT_VEC2: - case GL_INT_VEC2: - case GL_BOOL_VEC2: - return 2; - case GL_FLOAT_VEC3: - case GL_INT_VEC3: - case GL_BOOL_VEC3: - return 3; - case GL_FLOAT_VEC4: - case GL_INT_VEC4: - case GL_BOOL_VEC4: - return 4; - case GL_FLOAT_MAT2: - case GL_FLOAT_MAT2x3: - case GL_FLOAT_MAT2x4: - return 8; /* two float[4] vectors */ - case GL_FLOAT_MAT3: - case GL_FLOAT_MAT3x2: - case GL_FLOAT_MAT3x4: - return 12; /* three float[4] vectors */ - case GL_FLOAT_MAT4: - case GL_FLOAT_MAT4x2: - case GL_FLOAT_MAT4x3: - return 16; /* four float[4] vectors */ - default: - _mesa_problem(NULL, "Invalid type in sizeof_glsl_type()"); - return 1; - } -} - - -static GLboolean -is_boolean_type(GLenum type) -{ - switch (type) { - case GL_BOOL: - case GL_BOOL_VEC2: - case GL_BOOL_VEC3: - case GL_BOOL_VEC4: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -static GLboolean -is_integer_type(GLenum type) -{ - switch (type) { - case GL_INT: - case GL_INT_VEC2: - case GL_INT_VEC3: - case GL_INT_VEC4: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -static GLboolean -is_sampler_type(GLenum type) -{ - switch (type) { - case GL_SAMPLER_1D: - case GL_SAMPLER_2D: - case GL_SAMPLER_3D: - case GL_SAMPLER_CUBE: - case GL_SAMPLER_1D_SHADOW: - case GL_SAMPLER_2D_SHADOW: - case GL_SAMPLER_2D_RECT_ARB: - case GL_SAMPLER_2D_RECT_SHADOW_ARB: - case GL_SAMPLER_1D_ARRAY_EXT: - case GL_SAMPLER_2D_ARRAY_EXT: - case GL_SAMPLER_1D_ARRAY_SHADOW_EXT: - case GL_SAMPLER_2D_ARRAY_SHADOW_EXT: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -static void -_mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index, - GLsizei maxLength, GLsizei *length, GLint *size, - GLenum *type, GLchar *nameOut) -{ - const struct gl_program_parameter_list *attribs = NULL; - struct gl_shader_program *shProg; - - shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib"); - if (!shProg) - return; - - if (shProg->VertexProgram) - attribs = shProg->VertexProgram->Base.Attributes; - - if (!attribs || index >= attribs->NumParameters) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveAttrib(index)"); - return; - } - - copy_string(nameOut, maxLength, length, attribs->Parameters[index].Name); - - if (size) - *size = attribs->Parameters[index].Size - / sizeof_glsl_type(attribs->Parameters[index].DataType); - - if (type) - *type = attribs->Parameters[index].DataType; -} - - -static struct gl_program_parameter * -get_uniform_parameter(const struct gl_shader_program *shProg, GLuint index) -{ - const struct gl_program *prog = NULL; - GLint progPos; - - progPos = shProg->Uniforms->Uniforms[index].VertPos; - if (progPos >= 0) { - prog = &shProg->VertexProgram->Base; - } - else { - progPos = shProg->Uniforms->Uniforms[index].FragPos; - if (progPos >= 0) { - prog = &shProg->FragmentProgram->Base; - } - } - - if (!prog || progPos < 0) - return NULL; /* should never happen */ - - return &prog->Parameters->Parameters[progPos]; -} - - -/** - * Called via ctx->Driver.GetActiveUniform(). - */ -static void -_mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index, - GLsizei maxLength, GLsizei *length, GLint *size, - GLenum *type, GLchar *nameOut) -{ - const struct gl_shader_program *shProg; - const struct gl_program *prog = NULL; - const struct gl_program_parameter *param; - GLint progPos; - - shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveUniform"); - if (!shProg) - return; - - if (!shProg->Uniforms || index >= shProg->Uniforms->NumUniforms) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)"); - return; - } - - progPos = shProg->Uniforms->Uniforms[index].VertPos; - if (progPos >= 0) { - prog = &shProg->VertexProgram->Base; - } - else { - progPos = shProg->Uniforms->Uniforms[index].FragPos; - if (progPos >= 0) { - prog = &shProg->FragmentProgram->Base; - } - } - - if (!prog || progPos < 0) - return; /* should never happen */ - - ASSERT(progPos < prog->Parameters->NumParameters); - param = &prog->Parameters->Parameters[progPos]; - - if (nameOut) { - copy_string(nameOut, maxLength, length, param->Name); - } - - if (size) { - GLint typeSize = sizeof_glsl_type(param->DataType); - if ((GLint) param->Size > typeSize) { - /* This is an array. - * Array elements are placed on vector[4] boundaries so they're - * a multiple of four floats. We round typeSize up to next multiple - * of four to get the right size below. - */ - typeSize = (typeSize + 3) & ~3; - } - /* Note that the returned size is in units of the <type>, not bytes */ - *size = param->Size / typeSize; - } - - if (type) { - *type = param->DataType; - } -} - - -/** - * Called via ctx->Driver.GetAttachedShaders(). - */ -static void -_mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, - GLsizei *count, GLuint *obj) -{ - struct gl_shader_program *shProg = - _mesa_lookup_shader_program_err(ctx, program, "glGetAttachedShaders"); - if (shProg) { - GLuint i; - for (i = 0; i < (GLuint) maxCount && i < shProg->NumShaders; i++) { - obj[i] = shProg->Shaders[i]->Name; - } - if (count) - *count = i; - } -} - - -static GLuint -_mesa_get_handle(GLcontext *ctx, GLenum pname) -{ - GLint handle = 0; - - if (pname == GL_PROGRAM_OBJECT_ARB) { - CALL_GetIntegerv(ctx->Exec, (GL_CURRENT_PROGRAM, &handle)); - } else { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetHandleARB"); - } - - return handle; -} - - -static void -_mesa_get_programiv(GLcontext *ctx, GLuint program, - GLenum pname, GLint *params) -{ - const struct gl_program_parameter_list *attribs; - struct gl_shader_program *shProg - = _mesa_lookup_shader_program(ctx, program); - - if (!shProg) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramiv(program)"); - return; - } - - if (shProg->VertexProgram) - attribs = shProg->VertexProgram->Base.Attributes; - else - attribs = NULL; - - switch (pname) { - case GL_DELETE_STATUS: - *params = shProg->DeletePending; - break; - case GL_LINK_STATUS: - *params = shProg->LinkStatus; - break; - case GL_VALIDATE_STATUS: - *params = shProg->Validated; - break; - case GL_INFO_LOG_LENGTH: - *params = shProg->InfoLog ? strlen(shProg->InfoLog) + 1 : 0; - break; - case GL_ATTACHED_SHADERS: - *params = shProg->NumShaders; - break; - case GL_ACTIVE_ATTRIBUTES: - *params = attribs ? attribs->NumParameters : 0; - break; - case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: - *params = _mesa_longest_parameter_name(attribs, PROGRAM_INPUT) + 1; - break; - case GL_ACTIVE_UNIFORMS: - *params = shProg->Uniforms ? shProg->Uniforms->NumUniforms : 0; - break; - case GL_ACTIVE_UNIFORM_MAX_LENGTH: - *params = _mesa_longest_uniform_name(shProg->Uniforms); - if (*params > 0) - (*params)++; /* add one for terminating zero */ - break; - case GL_PROGRAM_BINARY_LENGTH_OES: - *params = 0; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)"); - return; - } -} - - -static void -_mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params) -{ - struct gl_shader *shader = _mesa_lookup_shader_err(ctx, name, "glGetShaderiv"); - - if (!shader) { - return; - } - - switch (pname) { - case GL_SHADER_TYPE: - *params = shader->Type; - break; - case GL_DELETE_STATUS: - *params = shader->DeletePending; - break; - case GL_COMPILE_STATUS: - *params = shader->CompileStatus; - break; - case GL_INFO_LOG_LENGTH: - *params = shader->InfoLog ? strlen(shader->InfoLog) + 1 : 0; - break; - case GL_SHADER_SOURCE_LENGTH: - *params = shader->Source ? strlen((char *) shader->Source) + 1 : 0; - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glGetShaderiv(pname)"); - return; - } -} - - -static void -_mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize, - GLsizei *length, GLchar *infoLog) -{ - struct gl_shader_program *shProg - = _mesa_lookup_shader_program(ctx, program); - if (!shProg) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramInfoLog(program)"); - return; - } - copy_string(infoLog, bufSize, length, shProg->InfoLog); -} - - -static void -_mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize, - GLsizei *length, GLchar *infoLog) -{ - struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); - if (!sh) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderInfoLog(shader)"); - return; - } - copy_string(infoLog, bufSize, length, sh->InfoLog); -} - - -/** - * Called via ctx->Driver.GetShaderSource(). - */ -static void -_mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength, - GLsizei *length, GLchar *sourceOut) -{ - struct gl_shader *sh; - sh = _mesa_lookup_shader_err(ctx, shader, "glGetShaderSource"); - if (!sh) { - return; - } - copy_string(sourceOut, maxLength, length, sh->Source); -} - - -static void -get_matrix_dims(GLenum type, GLint *rows, GLint *cols) -{ - switch (type) { - case GL_FLOAT_MAT2: - *rows = *cols = 2; - break; - case GL_FLOAT_MAT2x3: - *rows = 3; - *cols = 2; - break; - case GL_FLOAT_MAT2x4: - *rows = 4; - *cols = 2; - break; - case GL_FLOAT_MAT3: - *rows = 3; - *cols = 3; - break; - case GL_FLOAT_MAT3x2: - *rows = 2; - *cols = 3; - break; - case GL_FLOAT_MAT3x4: - *rows = 4; - *cols = 3; - break; - case GL_FLOAT_MAT4: - *rows = 4; - *cols = 4; - break; - case GL_FLOAT_MAT4x2: - *rows = 2; - *cols = 4; - break; - case GL_FLOAT_MAT4x3: - *rows = 3; - *cols = 4; - break; - default: - *rows = *cols = 0; - } -} - - -/** - * Determine the number of rows and columns occupied by a uniform - * according to its datatype. For non-matrix types (such as GL_FLOAT_VEC4), - * the number of rows = 1 and cols = number of elements in the vector. - */ -static void -get_uniform_rows_cols(const struct gl_program_parameter *p, - GLint *rows, GLint *cols) -{ - get_matrix_dims(p->DataType, rows, cols); - if (*rows == 0 && *cols == 0) { - /* not a matrix type, probably a float or vector */ - if (p->Size <= 4) { - *rows = 1; - *cols = p->Size; - } - else { - *rows = p->Size / 4 + 1; - if (p->Size % 4 == 0) - *cols = 4; - else - *cols = p->Size % 4; - } - } -} - - -/** - * Helper for get_uniform[fi]v() functions. - * Given a shader program name and uniform location, return a pointer - * to the shader program and return the program parameter position. - */ -static void -lookup_uniform_parameter(GLcontext *ctx, GLuint program, GLint location, - struct gl_program **progOut, GLint *paramPosOut) -{ - struct gl_shader_program *shProg - = _mesa_lookup_shader_program_err(ctx, program, "glGetUniform[if]v"); - struct gl_program *prog = NULL; - GLint progPos = -1; - - /* if shProg is NULL, we'll have already recorded an error */ - - if (shProg) { - if (!shProg->Uniforms || - location < 0 || - location >= (GLint) shProg->Uniforms->NumUniforms) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformfv(location)"); - } - else { - /* OK, find the gl_program and program parameter location */ - progPos = shProg->Uniforms->Uniforms[location].VertPos; - if (progPos >= 0) { - prog = &shProg->VertexProgram->Base; - } - else { - progPos = shProg->Uniforms->Uniforms[location].FragPos; - if (progPos >= 0) { - prog = &shProg->FragmentProgram->Base; - } - } - } - } - - *progOut = prog; - *paramPosOut = progPos; -} - - -/** - * GLGL uniform arrays and structs require special handling. - * - * The GL_ARB_shader_objects spec says that if you use - * glGetUniformLocation to get the location of an array, you CANNOT - * access other elements of the array by adding an offset to the - * returned location. For example, you must call - * glGetUniformLocation("foo[16]") if you want to set the 16th element - * of the array with glUniform(). - * - * HOWEVER, some other OpenGL drivers allow accessing array elements - * by adding an offset to the returned array location. And some apps - * seem to depend on that behaviour. - * - * Mesa's gl_uniform_list doesn't directly support this since each - * entry in the list describes one uniform variable, not one uniform - * element. We could insert dummy entries in the list for each array - * element after [0] but that causes complications elsewhere. - * - * We solve this problem by encoding two values in the location that's - * returned by glGetUniformLocation(): - * a) index into gl_uniform_list::Uniforms[] for the uniform - * b) an array/field offset (0 for simple types) - * - * These two values are encoded in the high and low halves of a GLint. - * By putting the uniform number in the high part and the offset in the - * low part, we can support the unofficial ability to index into arrays - * by adding offsets to the location value. - */ -static void -merge_location_offset(GLint *location, GLint offset) -{ - *location = (*location << 16) | offset; -} - - -/** - * Seperate the uniform location and parameter offset. See above. - */ -static void -split_location_offset(GLint *location, GLint *offset) -{ - *offset = *location & 0xffff; - *location = *location >> 16; -} - - - -/** - * Called via ctx->Driver.GetUniformfv(). - */ -static void -_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location, - GLfloat *params) -{ - struct gl_program *prog; - GLint paramPos; - GLint offset; - - split_location_offset(&location, &offset); - - lookup_uniform_parameter(ctx, program, location, &prog, ¶mPos); - - if (prog) { - const struct gl_program_parameter *p = - &prog->Parameters->Parameters[paramPos]; - GLint rows, cols, i, j, k; - - get_uniform_rows_cols(p, &rows, &cols); - - k = 0; - for (i = 0; i < rows; i++) { - for (j = 0; j < cols; j++ ) { - params[k++] = prog->Parameters->ParameterValues[paramPos+i][j]; - } - } - } -} - - -/** - * Called via ctx->Driver.GetUniformiv(). - * \sa _mesa_get_uniformfv, only difference is a cast. - */ -static void -_mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location, - GLint *params) -{ - struct gl_program *prog; - GLint paramPos; - GLint offset; - - split_location_offset(&location, &offset); - - lookup_uniform_parameter(ctx, program, location, &prog, ¶mPos); - - if (prog) { - const struct gl_program_parameter *p = - &prog->Parameters->Parameters[paramPos]; - GLint rows, cols, i, j, k; - - get_uniform_rows_cols(p, &rows, &cols); - - k = 0; - for (i = 0; i < rows; i++) { - for (j = 0; j < cols; j++ ) { - params[k++] = (GLint) prog->Parameters->ParameterValues[paramPos+i][j]; - } - } - } -} - - -/** - * Called via ctx->Driver.GetUniformLocation(). - * - * The return value will encode two values, the uniform location and an - * offset (used for arrays, structs). - */ -static GLint -_mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) -{ - GLint offset = 0, location = -1; - - struct gl_shader_program *shProg = - _mesa_lookup_shader_program_err(ctx, program, "glGetUniformLocation"); - - if (!shProg) - return -1; - - if (shProg->LinkStatus == GL_FALSE) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformfv(program)"); - return -1; - } - - /* XXX we should return -1 if the uniform was declared, but not - * actually used. - */ - - /* XXX we need to be able to parse uniform names for structs and arrays - * such as: - * mymatrix[1] - * mystruct.field1 - */ - - { - /* handle 1-dimension arrays here... */ - char *c = strchr(name, '['); - if (c) { - /* truncate name at [ */ - const GLint len = c - name; - GLchar *newName = malloc(len + 1); - if (!newName) - return -1; /* out of mem */ - memcpy(newName, name, len); - newName[len] = 0; - - location = _mesa_lookup_uniform(shProg->Uniforms, newName); - if (location >= 0) { - const GLint element = atoi(c + 1); - if (element > 0) { - /* get type of the uniform array element */ - struct gl_program_parameter *p; - p = get_uniform_parameter(shProg, location); - if (p) { - GLint rows, cols; - get_matrix_dims(p->DataType, &rows, &cols); - if (rows < 1) - rows = 1; - offset = element * rows; - } - } - } - - free(newName); - } - } - - if (location < 0) { - location = _mesa_lookup_uniform(shProg->Uniforms, name); - } - - if (location >= 0) { - merge_location_offset(&location, offset); - } - - return location; -} - - - -/** - * Called via ctx->Driver.ShaderSource() - */ -static void -_mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source) -{ - struct gl_shader *sh; - - sh = _mesa_lookup_shader_err(ctx, shader, "glShaderSource"); - if (!sh) - return; - - /* free old shader source string and install new one */ - if (sh->Source) { - free((void *) sh->Source); - } - sh->Source = source; - sh->CompileStatus = GL_FALSE; -#ifdef DEBUG - sh->SourceChecksum = _mesa_str_checksum(sh->Source); -#endif -} - - -/** - * Called via ctx->Driver.CompileShader() - */ -static void -_mesa_compile_shader(GLcontext *ctx, GLuint shaderObj) -{ - struct gl_shader *sh; - - sh = _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader"); - if (!sh) - return; - - /* set default pragma state for shader */ - sh->Pragmas = ctx->Shader.DefaultPragmas; - - /* this call will set the sh->CompileStatus field to indicate if - * compilation was successful. - */ - (void) _slang_compile(ctx, sh); -} - - -/** - * Called via ctx->Driver.LinkProgram() - */ -static void -_mesa_link_program(GLcontext *ctx, GLuint program) -{ - struct gl_shader_program *shProg; - - shProg = _mesa_lookup_shader_program_err(ctx, program, "glLinkProgram"); - if (!shProg) - return; - - FLUSH_VERTICES(ctx, _NEW_PROGRAM); - - _slang_link(ctx, program, shProg); - - /* debug code */ - if (0) { - GLuint i; - - printf("Link %u shaders in program %u: %s\n", - shProg->NumShaders, shProg->Name, - shProg->LinkStatus ? "Success" : "Failed"); - - for (i = 0; i < shProg->NumShaders; i++) { - printf(" shader %u, type 0x%x\n", - shProg->Shaders[i]->Name, - shProg->Shaders[i]->Type); - } - } -} - - -/** - * Print basic shader info (for debug). - */ -static void -print_shader_info(const struct gl_shader_program *shProg) -{ - GLuint i; - - printf("Mesa: glUseProgram(%u)\n", shProg->Name); - for (i = 0; i < shProg->NumShaders; i++) { - const char *s; - switch (shProg->Shaders[i]->Type) { - case GL_VERTEX_SHADER: - s = "vertex"; - break; - case GL_FRAGMENT_SHADER: - s = "fragment"; - break; - case GL_GEOMETRY_SHADER: - s = "geometry"; - break; - default: - s = ""; - } - printf(" %s shader %u, checksum %u\n", s, - shProg->Shaders[i]->Name, - shProg->Shaders[i]->SourceChecksum); - } - if (shProg->VertexProgram) - printf(" vert prog %u\n", shProg->VertexProgram->Base.Id); - if (shProg->FragmentProgram) - printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id); -} - - -/** - * Called via ctx->Driver.UseProgram() - */ -void -_mesa_use_program(GLcontext *ctx, GLuint program) -{ - struct gl_shader_program *shProg; - - if (ctx->Shader.CurrentProgram && - ctx->Shader.CurrentProgram->Name == program) { - /* no-op */ - return; - } - - if (program) { - shProg = _mesa_lookup_shader_program_err(ctx, program, "glUseProgram"); - if (!shProg) { - return; - } - if (!shProg->LinkStatus) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glUseProgram(program %u not linked)", program); - return; - } - - /* debug code */ - if (ctx->Shader.Flags & GLSL_USE_PROG) { - print_shader_info(shProg); - } - } - else { - shProg = NULL; - } - - if (ctx->Shader.CurrentProgram != shProg) { - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); - _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, shProg); - } -} - - - -/** - * Update the vertex/fragment program's TexturesUsed array. - * - * This needs to be called after glUniform(set sampler var) is called. - * A call to glUniform(samplerVar, value) causes a sampler to point to a - * particular texture unit. We know the sampler's texture target - * (1D/2D/3D/etc) from compile time but the sampler's texture unit is - * set by glUniform() calls. - * - * So, scan the program->SamplerUnits[] and program->SamplerTargets[] - * information to update the prog->TexturesUsed[] values. - * Each value of TexturesUsed[unit] is one of zero, TEXTURE_1D_INDEX, - * TEXTURE_2D_INDEX, TEXTURE_3D_INDEX, etc. - * We'll use that info for state validation before rendering. - */ -void -_mesa_update_shader_textures_used(struct gl_program *prog) -{ - GLuint s; - - memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed)); - - for (s = 0; s < MAX_SAMPLERS; s++) { - if (prog->SamplersUsed & (1 << s)) { - GLuint unit = prog->SamplerUnits[s]; - GLuint tgt = prog->SamplerTargets[s]; - assert(unit < MAX_TEXTURE_IMAGE_UNITS); - assert(tgt < NUM_TEXTURE_TARGETS); - prog->TexturesUsed[unit] |= (1 << tgt); - } - } -} - - -/** - * Check if the type given by userType is allowed to set a uniform of the - * target type. Generally, equivalence is required, but setting Boolean - * uniforms can be done with glUniformiv or glUniformfv. - */ -static GLboolean -compatible_types(GLenum userType, GLenum targetType) -{ - if (userType == targetType) - return GL_TRUE; - - if (targetType == GL_BOOL && (userType == GL_FLOAT || userType == GL_INT)) - return GL_TRUE; - - if (targetType == GL_BOOL_VEC2 && (userType == GL_FLOAT_VEC2 || - userType == GL_INT_VEC2)) - return GL_TRUE; - - if (targetType == GL_BOOL_VEC3 && (userType == GL_FLOAT_VEC3 || - userType == GL_INT_VEC3)) - return GL_TRUE; - - if (targetType == GL_BOOL_VEC4 && (userType == GL_FLOAT_VEC4 || - userType == GL_INT_VEC4)) - return GL_TRUE; - - if (is_sampler_type(targetType) && userType == GL_INT) - return GL_TRUE; - - return GL_FALSE; -} - - -/** - * Set the value of a program's uniform variable. - * \param program the program whose uniform to update - * \param index the index of the program parameter for the uniform - * \param offset additional parameter slot offset (for arrays) - * \param type the incoming datatype of 'values' - * \param count the number of uniforms to set - * \param elems number of elements per uniform (1, 2, 3 or 4) - * \param values the new values, of datatype 'type' - */ -static void -set_program_uniform(GLcontext *ctx, struct gl_program *program, - GLint index, GLint offset, - GLenum type, GLsizei count, GLint elems, - const void *values) -{ - const struct gl_program_parameter *param = - &program->Parameters->Parameters[index]; - - assert(offset >= 0); - assert(elems >= 1); - assert(elems <= 4); - - if (!compatible_types(type, param->DataType)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(type mismatch)"); - return; - } - - if (index + offset > (GLint) program->Parameters->Size) { - /* out of bounds! */ - return; - } - - if (param->Type == PROGRAM_SAMPLER) { - /* This controls which texture unit which is used by a sampler */ - GLboolean changed = GL_FALSE; - GLint i; - - /* this should have been caught by the compatible_types() check */ - ASSERT(type == GL_INT); - - /* loop over number of samplers to change */ - for (i = 0; i < count; i++) { - GLuint sampler = - (GLuint) program->Parameters->ParameterValues[index + offset + i][0]; - GLuint texUnit = ((GLuint *) values)[i]; - - /* check that the sampler (tex unit index) is legal */ - if (texUnit >= ctx->Const.MaxTextureImageUnits) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glUniform1(invalid sampler/tex unit index)"); - return; - } - - /* This maps a sampler to a texture unit: */ - if (sampler < MAX_SAMPLERS) { -#if 0 - printf("Set program %p sampler %d '%s' to unit %u\n", - program, sampler, param->Name, texUnit); -#endif - if (program->SamplerUnits[sampler] != texUnit) { - program->SamplerUnits[sampler] = texUnit; - changed = GL_TRUE; - } - } - } - - if (changed) { - /* When a sampler's value changes it usually requires rewriting - * a GPU program's TEX instructions since there may not be a - * sampler->texture lookup table. We signal this with the - * ProgramStringNotify() callback. - */ - FLUSH_VERTICES(ctx, _NEW_TEXTURE | _NEW_PROGRAM); - _mesa_update_shader_textures_used(program); - /* Do we need to care about the return value here? - * This should not be the first time the driver was notified of - * this program. - */ - (void) ctx->Driver.ProgramStringNotify(ctx, program->Target, program); - } - } - else { - /* ordinary uniform variable */ - const GLboolean isUniformBool = is_boolean_type(param->DataType); - const GLboolean areIntValues = is_integer_type(type); - const GLint slots = (param->Size + 3) / 4; - const GLint typeSize = sizeof_glsl_type(param->DataType); - GLsizei k, i; - - if ((GLint) param->Size > typeSize) { - /* an array */ - /* we'll ignore extra data below */ - } - else { - /* non-array: count must be at most one; count == 0 is handled by the loop below */ - if (count > 1) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glUniform(uniform is not an array)"); - return; - } - } - - /* loop over number of array elements */ - for (k = 0; k < count; k++) { - GLfloat *uniformVal; - - if (offset + k >= slots) { - /* Extra array data is ignored */ - break; - } - - /* uniformVal (the destination) is always float[4] */ - uniformVal = program->Parameters->ParameterValues[index + offset + k]; - - if (areIntValues) { - /* convert user's ints to floats */ - const GLint *iValues = ((const GLint *) values) + k * elems; - for (i = 0; i < elems; i++) { - uniformVal[i] = (GLfloat) iValues[i]; - } - } - else { - const GLfloat *fValues = ((const GLfloat *) values) + k * elems; - for (i = 0; i < elems; i++) { - uniformVal[i] = fValues[i]; - } - } - - /* if the uniform is bool-valued, convert to 1.0 or 0.0 */ - if (isUniformBool) { - for (i = 0; i < elems; i++) { - uniformVal[i] = uniformVal[i] ? 1.0f : 0.0f; - } - } - } - } -} - - -/** - * Called via ctx->Driver.Uniform(). - */ -static void -_mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, - const GLvoid *values, GLenum type) -{ - struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; - struct gl_uniform *uniform; - GLint elems, offset; - GLenum basicType; - - if (!shProg || !shProg->LinkStatus) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(program not linked)"); - return; - } - - if (location == -1) - return; /* The standard specifies this as a no-op */ - - if (location < -1) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(location)"); - return; - } - - split_location_offset(&location, &offset); - - if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) { - _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(location)"); - return; - } - - if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glUniform(count < 0)"); - return; - } - - switch (type) { - case GL_FLOAT: - basicType = GL_FLOAT; - elems = 1; - break; - case GL_INT: - basicType = GL_INT; - elems = 1; - break; - case GL_FLOAT_VEC2: - basicType = GL_FLOAT; - elems = 2; - break; - case GL_INT_VEC2: - basicType = GL_INT; - elems = 2; - break; - case GL_FLOAT_VEC3: - basicType = GL_FLOAT; - elems = 3; - break; - case GL_INT_VEC3: - basicType = GL_INT; - elems = 3; - break; - case GL_FLOAT_VEC4: - basicType = GL_FLOAT; - elems = 4; - break; - case GL_INT_VEC4: - basicType = GL_INT; - elems = 4; - break; - default: - _mesa_problem(ctx, "Invalid type in _mesa_uniform"); - return; - } - - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); - - uniform = &shProg->Uniforms->Uniforms[location]; - - if (ctx->Shader.Flags & GLSL_UNIFORMS) { - GLint i; - printf("Mesa: set program %u uniform %s (loc %d) to: ", - shProg->Name, uniform->Name, location); - if (basicType == GL_INT) { - const GLint *v = (const GLint *) values; - for (i = 0; i < count * elems; i++) { - printf("%d ", v[i]); - } - } - else { - const GLfloat *v = (const GLfloat *) values; - for (i = 0; i < count * elems; i++) { - printf("%g ", v[i]); - } - } - printf("\n"); - } - - /* A uniform var may be used by both a vertex shader and a fragment - * shader. We may need to update one or both shader's uniform here: - */ - if (shProg->VertexProgram) { - /* convert uniform location to program parameter index */ - GLint index = uniform->VertPos; - if (index >= 0) { - set_program_uniform(ctx, &shProg->VertexProgram->Base, - index, offset, type, count, elems, values); - } - } - - if (shProg->FragmentProgram) { - /* convert uniform location to program parameter index */ - GLint index = uniform->FragPos; - if (index >= 0) { - set_program_uniform(ctx, &shProg->FragmentProgram->Base, - index, offset, type, count, elems, values); - } - } - - uniform->Initialized = GL_TRUE; -} - - -/** - * Set a matrix-valued program parameter. - */ -static void -set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, - GLuint index, GLuint offset, - GLuint count, GLuint rows, GLuint cols, - GLboolean transpose, const GLfloat *values) -{ - GLuint mat, row, col; - GLuint src = 0; - const struct gl_program_parameter * param = &program->Parameters->Parameters[index]; - const GLuint slots = (param->Size + 3) / 4; - const GLint typeSize = sizeof_glsl_type(param->DataType); - GLint nr, nc; - - /* check that the number of rows, columns is correct */ - get_matrix_dims(param->DataType, &nr, &nc); - if (rows != nr || cols != nc) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glUniformMatrix(matrix size mismatch)"); - return; - } - - if ((GLint) param->Size <= typeSize) { - /* non-array: count must be at most one; count == 0 is handled by the loop below */ - if (count > 1) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glUniformMatrix(uniform is not an array)"); - return; - } - } - - /* - * Note: the _columns_ of a matrix are stored in program registers, not - * the rows. So, the loops below look a little funny. - * XXX could optimize this a bit... - */ - - /* loop over matrices */ - for (mat = 0; mat < count; mat++) { - - /* each matrix: */ - for (col = 0; col < cols; col++) { - GLfloat *v; - if (offset >= slots) { - /* Ignore writes beyond the end of (the used part of) an array */ - return; - } - v = program->Parameters->ParameterValues[index + offset]; - for (row = 0; row < rows; row++) { - if (transpose) { - v[row] = values[src + row * cols + col]; - } - else { - v[row] = values[src + col * rows + row]; - } - } - - offset++; - } - - src += rows * cols; /* next matrix */ - } -} - - -/** - * Called by ctx->Driver.UniformMatrix(). - * Note: cols=2, rows=4 ==> array[2] of vec4 - */ -static void -_mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows, - GLint location, GLsizei count, - GLboolean transpose, const GLfloat *values) -{ - struct gl_shader_program *shProg = ctx->Shader.CurrentProgram; - struct gl_uniform *uniform; - GLint offset; - - if (!shProg || !shProg->LinkStatus) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glUniformMatrix(program not linked)"); - return; - } - - if (location == -1) - return; /* The standard specifies this as a no-op */ - - if (location < -1) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(location)"); - return; - } - - split_location_offset(&location, &offset); - - if (location < 0 || location >= (GLint) shProg->Uniforms->NumUniforms) { - _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(location)"); - return; - } - if (values == NULL) { - _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix"); - return; - } - - FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS); - - uniform = &shProg->Uniforms->Uniforms[location]; - - if (shProg->VertexProgram) { - /* convert uniform location to program parameter index */ - GLint index = uniform->VertPos; - if (index >= 0) { - set_program_uniform_matrix(ctx, &shProg->VertexProgram->Base, - index, offset, - count, rows, cols, transpose, values); - } - } - - if (shProg->FragmentProgram) { - /* convert uniform location to program parameter index */ - GLint index = uniform->FragPos; - if (index >= 0) { - set_program_uniform_matrix(ctx, &shProg->FragmentProgram->Base, - index, offset, - count, rows, cols, transpose, values); - } - } - - uniform->Initialized = GL_TRUE; -} - - -/** - * Validate a program's samplers. - * Specifically, check that there aren't two samplers of different types - * pointing to the same texture unit. - * \return GL_TRUE if valid, GL_FALSE if invalid - */ -static GLboolean -validate_samplers(GLcontext *ctx, const struct gl_program *prog, char *errMsg) -{ - static const char *targetName[] = { - "TEXTURE_2D_ARRAY", - "TEXTURE_1D_ARRAY", - "TEXTURE_CUBE", - "TEXTURE_3D", - "TEXTURE_RECT", - "TEXTURE_2D", - "TEXTURE_1D", - }; - GLint targetUsed[MAX_TEXTURE_IMAGE_UNITS]; - GLbitfield samplersUsed = prog->SamplersUsed; - GLuint i; - - assert(Elements(targetName) == NUM_TEXTURE_TARGETS); - - if (samplersUsed == 0x0) - return GL_TRUE; - - for (i = 0; i < Elements(targetUsed); i++) - targetUsed[i] = -1; - - /* walk over bits which are set in 'samplers' */ - while (samplersUsed) { - GLuint unit; - gl_texture_index target; - GLint sampler = _mesa_ffs(samplersUsed) - 1; - assert(sampler >= 0); - assert(sampler < MAX_TEXTURE_IMAGE_UNITS); - unit = prog->SamplerUnits[sampler]; - target = prog->SamplerTargets[sampler]; - if (targetUsed[unit] != -1 && targetUsed[unit] != target) { - _mesa_snprintf(errMsg, 100, - "Texture unit %d is accessed both as %s and %s", - unit, targetName[targetUsed[unit]], targetName[target]); - return GL_FALSE; - } - targetUsed[unit] = target; - samplersUsed ^= (1 << sampler); - } - - return GL_TRUE; -} - - -/** - * Do validation of the given shader program. - * \param errMsg returns error message if validation fails. - * \return GL_TRUE if valid, GL_FALSE if invalid (and set errMsg) - */ -GLboolean -_mesa_validate_shader_program(GLcontext *ctx, - const struct gl_shader_program *shProg, - char *errMsg) -{ - const struct gl_vertex_program *vp = shProg->VertexProgram; - const struct gl_fragment_program *fp = shProg->FragmentProgram; - - if (!shProg->LinkStatus) { - return GL_FALSE; - } - - /* From the GL spec, a program is invalid if any of these are true: - - any two active samplers in the current program object are of - different types, but refer to the same texture image unit, - - any active sampler in the current program object refers to a texture - image unit where fixed-function fragment processing accesses a - texture target that does not match the sampler type, or - - the sum of the number of active samplers in the program and the - number of texture image units enabled for fixed-function fragment - processing exceeds the combined limit on the total number of texture - image units allowed. - */ - - - /* - * Check: any two active samplers in the current program object are of - * different types, but refer to the same texture image unit, - */ - if (vp && !validate_samplers(ctx, &vp->Base, errMsg)) { - return GL_FALSE; - } - if (fp && !validate_samplers(ctx, &fp->Base, errMsg)) { - return GL_FALSE; - } - - return GL_TRUE; -} - - -/** - * Called via glValidateProgram() - */ -static void -_mesa_validate_program(GLcontext *ctx, GLuint program) -{ - struct gl_shader_program *shProg; - char errMsg[100]; - - shProg = _mesa_lookup_shader_program_err(ctx, program, "glValidateProgram"); - if (!shProg) { - return; - } - - shProg->Validated = _mesa_validate_shader_program(ctx, shProg, errMsg); - if (!shProg->Validated) { - /* update info log */ - if (shProg->InfoLog) { - free(shProg->InfoLog); - } - shProg->InfoLog = _mesa_strdup(errMsg); - } -} - - -/** - * Plug in Mesa's GLSL functions into the device driver function table. - */ -void -_mesa_init_glsl_driver_functions(struct dd_function_table *driver) -{ - driver->AttachShader = _mesa_attach_shader; - driver->BindAttribLocation = _mesa_bind_attrib_location; - driver->CompileShader = _mesa_compile_shader; - driver->CreateProgram = _mesa_create_program; - driver->CreateShader = _mesa_create_shader; - driver->DeleteProgram2 = _mesa_delete_program2; - driver->DeleteShader = _mesa_delete_shader; - driver->DetachShader = _mesa_detach_shader; - driver->GetActiveAttrib = _mesa_get_active_attrib; - driver->GetActiveUniform = _mesa_get_active_uniform; - driver->GetAttachedShaders = _mesa_get_attached_shaders; - driver->GetAttribLocation = _mesa_get_attrib_location; - driver->GetHandle = _mesa_get_handle; - driver->GetProgramiv = _mesa_get_programiv; - driver->GetProgramInfoLog = _mesa_get_program_info_log; - driver->GetShaderiv = _mesa_get_shaderiv; - driver->GetShaderInfoLog = _mesa_get_shader_info_log; - driver->GetShaderSource = _mesa_get_shader_source; - driver->GetUniformfv = _mesa_get_uniformfv; - driver->GetUniformiv = _mesa_get_uniformiv; - driver->GetUniformLocation = _mesa_get_uniform_location; - driver->IsProgram = _mesa_is_program; - driver->IsShader = _mesa_is_shader; - driver->LinkProgram = _mesa_link_program; - driver->ShaderSource = _mesa_shader_source; - driver->Uniform = _mesa_uniform; - driver->UniformMatrix = _mesa_uniform_matrix; - driver->UseProgram = _mesa_use_program; - driver->ValidateProgram = _mesa_validate_program; -} diff --git a/mesalib/src/mesa/shader/slang/descrip.mms b/mesalib/src/mesa/shader/slang/descrip.mms deleted file mode 100644 index 674b786ac..000000000 --- a/mesalib/src/mesa/shader/slang/descrip.mms +++ /dev/null @@ -1,67 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl -# Last revision : 3 October 2007 - -.first - define gl [----.include.gl] - define math [--.math] - define swrast [--.swrast] - define array_cache [--.array_cache] - define main [--.main] - define glapi [--.glapi] - define shader [--.shader] - -.include [----]mms-config. - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [----.include],[--.main],[--.glapi],[-.slang],[-] -LIBDIR = [----.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm - -SOURCES = \ - slang_compile.c - -OBJECTS = slang_builtin.obj,slang_codegen.obj,slang_compile.obj,\ - slang_compile_function.obj,slang_compile_operation.obj,\ - slang_compile_struct.obj,slang_compile_variable.obj,slang_emit.obj,\ - slang_ir.obj,slang_label.obj,slang_library_noise.obj,slang_link.obj,\ - slang_log.obj,slang_mem.obj,slang_preprocess.obj,slang_print.obj,\ - slang_simplify.obj,slang_storage.obj,slang_typeinfo.obj,\ - slang_utility.obj,slang_vartable.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) - -clean : - purge - delete *.obj;* - -slang_builtin.obj : slang_builtin.c -slang_codegen.obj : slang_codegen.c -slang_compile.obj : slang_compile.c -slang_compile_function.obj : slang_compile_function.c -slang_compile_operation.obj : slang_compile_operation.c -slang_compile_struct.obj : slang_compile_struct.c -slang_compile_variable.obj : slang_compile_variable.c -slang_emit.obj : slang_emit.c -slang_ir.obj : slang_ir.c -slang_label.obj : slang_label.c -slang_library_noise.obj : slang_library_noise.c -slang_link.obj : slang_link.c -slang_log.obj : slang_log.c -slang_mem.obj : slang_mem.c -slang_print.obj : slang_print.c -slang_simplify.obj : slang_simplify.c -slang_storage.obj : slang_storage.c -slang_typeinfo.obj : slang_typeinfo.c -slang_utility.obj : slang_utility.c -slang_vartable.obj : slang_vartable.c diff --git a/mesalib/src/mesa/shader/slang/library/Makefile b/mesalib/src/mesa/shader/slang/library/Makefile deleted file mode 100644 index c6964512b..000000000 --- a/mesalib/src/mesa/shader/slang/library/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# src/mesa/shader/slang/library/Makefile - -TOP = ../../../../.. - -include $(TOP)/configs/current - -GLSL_CL = $(TOP)/src/glsl/apps/compile - -# -# targets -# - -.PHONY: default clean - -default: builtin - -clean: - -rm -f *_gc.h - -builtin: builtin_110 builtin_120 - -# -# builtin library sources -# - -builtin_110: slang_common_builtin_gc.h slang_core_gc.h slang_fragment_builtin_gc.h slang_vertex_builtin_gc.h - -builtin_120: slang_120_core_gc.h slang_builtin_120_common_gc.h slang_builtin_120_fragment_gc.h - - -slang_120_core_gc.h: slang_120_core.gc - $(GLSL_CL) fragment slang_120_core.gc slang_120_core_gc.h - -slang_builtin_120_common_gc.h: slang_builtin_120_common.gc - $(GLSL_CL) fragment slang_builtin_120_common.gc slang_builtin_120_common_gc.h - -slang_builtin_120_fragment_gc.h: slang_builtin_120_fragment.gc - $(GLSL_CL) fragment slang_builtin_120_fragment.gc slang_builtin_120_fragment_gc.h - -slang_common_builtin_gc.h: slang_common_builtin.gc - $(GLSL_CL) fragment slang_common_builtin.gc slang_common_builtin_gc.h - -slang_core_gc.h: slang_core.gc - $(GLSL_CL) fragment slang_core.gc slang_core_gc.h - -slang_fragment_builtin_gc.h: slang_fragment_builtin.gc - $(GLSL_CL) fragment slang_fragment_builtin.gc slang_fragment_builtin_gc.h - -slang_vertex_builtin_gc.h: slang_vertex_builtin.gc - $(GLSL_CL) vertex slang_vertex_builtin.gc slang_vertex_builtin_gc.h - diff --git a/mesalib/src/mesa/shader/slang/library/slang_120_core.gc b/mesalib/src/mesa/shader/slang/library/slang_120_core.gc deleted file mode 100644 index 04c5ec2ec..000000000 --- a/mesalib/src/mesa/shader/slang/library/slang_120_core.gc +++ /dev/null @@ -1,1978 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -// -// Constructors and operators introduced in GLSL 1.20 - mostly on new -// (non-square) types of matrices. -// -// One important change in the language is that when a matrix is used -// as an argument to a matrix constructor, it must be the only argument -// for the constructor. The compiler takes care of it by itself and -// here we only care to re-introduce constructors for old (square) -// types of matrices. -// - -// -// From Shader Spec, ver. 1.20, rev. 6 -// - -//// mat2x3: 2 columns of vec3 - -mat2x3 __constructor(const float f00, const float f10, const float f20, - const float f01, const float f11, const float f21) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[0].z = f20; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[1].z = f21; -} - -mat2x3 __constructor(const float f) -{ - __retVal = mat2x3( f, 0.0, 0.0, - 0.0, f, 0.0); -} - -mat2x3 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat2x3(f); -} - -mat2x3 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat2x3(f); -} - -mat2x3 __constructor(const vec3 c0, const vec3 c1) -{ - __retVal[0] = c0; - __retVal[1] = c1; -} - - - -//// mat2x4: 2 columns of vec4 - -mat2x4 __constructor(const float f00, const float f10, const float f20, const float f30, - const float f01, const float f11, const float f21, const float f31) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[0].z = f20; - __retVal[0].w = f30; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[1].z = f21; - __retVal[1].w = f31; -} - -mat2x4 __constructor(const float f) -{ - __retVal = mat2x4( f, 0.0, 0.0, 0.0, - 0.0, f, 0.0, 0.0); -} - -mat2x4 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat2x4(f); -} - -mat2x4 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat2x4(f); -} - -mat2x4 __constructor(const vec4 c0, const vec4 c1) -{ - __retVal[0] = c0; - __retVal[1] = c1; -} - - - -//// mat3x2: 3 columns of vec2 - -mat3x2 __constructor(const float f00, const float f10, - const float f01, const float f11, - const float f02, const float f12) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[2].x = f02; - __retVal[2].y = f12; -} - -mat3x2 __constructor(const float f) -{ - __retVal = mat3x2( f, 0.0, - 0.0, f, - 0.0, 0.0); -} - -mat3x2 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat3x2(f); -} - -mat3x2 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat3x2(f); -} - -mat3x2 __constructor(const vec2 c0, const vec2 c1, const vec2 c2) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; -} - - - -//// mat3x4: 3 columns of vec4 - -mat3x4 __constructor(const float f00, const float f10, const float f20, const float f30, - const float f01, const float f11, const float f21, const float f31, - const float f02, const float f12, const float f22, const float f32) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[0].z = f20; - __retVal[0].w = f30; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[1].z = f21; - __retVal[1].w = f31; - __retVal[2].x = f02; - __retVal[2].y = f12; - __retVal[2].z = f22; - __retVal[2].w = f32; -} - -mat3x4 __constructor(const float f) -{ - __retVal = mat3x4( f, 0.0, 0.0, 0.0, - 0.0, f, 0.0, 0.0, - 0.0, 0.0, f, 0.0); -} - -mat3x4 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat3x4(f); -} - -mat3x4 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat3x4(f); -} - -mat3x4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; -} - - - -//// mat4x2: 4 columns of vec2 - -mat4x2 __constructor(const float f00, const float f10, - const float f01, const float f11, - const float f02, const float f12, - const float f03, const float f13) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[2].x = f02; - __retVal[2].y = f12; - __retVal[3].x = f03; - __retVal[3].y = f13; -} - -mat4x2 __constructor(const float f) -{ - __retVal = mat4x2( f, 0.0, - 0.0, 4, - 0.0, 0.0, - 0.0, 0.0); -} - -mat4x2 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat4x2(f); -} - -mat4x2 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat4x2(f); -} - -mat4x2 __constructor(const vec2 c0, const vec2 c1, const vec2 c2, const vec2 c3) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; - __retVal[3] = c3; -} - - - -//// mat4x3: 4 columns of vec3 - -mat4x3 __constructor(const float f00, const float f10, const float f20, - const float f01, const float f11, const float f21, - const float f02, const float f12, const float f22, - const float f03, const float f13, const float f23) -{ - __retVal[0].x = f00; - __retVal[0].y = f10; - __retVal[0].z = f20; - __retVal[1].x = f01; - __retVal[1].y = f11; - __retVal[1].z = f21; - __retVal[2].x = f02; - __retVal[2].y = f12; - __retVal[2].z = f22; - __retVal[3].x = f03; - __retVal[3].y = f13; - __retVal[3].z = f23; -} - -mat4x3 __constructor(const float f) -{ - __retVal = mat4x3( f, 0.0, 0.0, - 0.0, f, 0.0, - 0.0, 0.0, f, - 0.0, 0.0, 0.0); -} - -mat4x3 __constructor(const int i) -{ - const float f = float(i); - __retVal = mat4x3(f); -} - -mat4x3 __constructor(const bool b) -{ - const float f = float(b); - __retVal = mat4x3(f); -} - -mat4x3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2, const vec3 c3) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; - __retVal[3] = c3; -} - - - -//// misc assorted matrix constructors - -mat2 __constructor(const mat2 m) -{ - __retVal = m; -} - -mat2 __constructor(const mat3x2 m) -{ - __retVal = mat2(m[0], m[1]); -} - -mat2 __constructor(const mat4x2 m) -{ - __retVal = mat2(m[0], m[1]); -} - -mat2 __constructor(const mat2x3 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat2x4 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat3 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat3x4 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat4x3 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - -mat2 __constructor(const mat4 m) -{ - __retVal = mat2(m[0].xy, m[1].xy); -} - - - -mat2x3 __constructor(const mat2x3 m) -{ - __retVal = m; -} - -mat2x3 __constructor(const mat3 m) -{ - __retVal = mat2x3(m[0], m[1]); -} - -mat2x3 __constructor(const mat4x3 m) -{ - __retVal = mat2x3(m[0], m[1]); -} - -mat2x3 __constructor(const mat2x4 m) -{ - __retVal = mat2x3(m[0].xyz, m[1].xyz); -} - -mat2x3 __constructor(const mat3x4 m) -{ - __retVal = mat2x3(m[0].xyz, m[1].xyz); -} - -mat2x3 __constructor(const mat4 m) -{ - __retVal = mat2x3(m[0].xyz, m[1].xyz); -} - -mat2x3 __constructor(const mat2 m) -{ - __retVal = mat2x3(m[0].x, m[0].y, 0.0, - m[1].x, m[1].y, 0.0); -} - -mat2x3 __constructor(const mat3x2 m) -{ - __retVal = mat2x3(m[0].x, m[0].y, 0.0, - m[1].x, m[1].y, 0.0); -} - -mat2x3 __constructor(const mat4x2 m) -{ - __retVal = mat2x3(m[0].x, m[0].y, 0.0, - m[1].x, m[1].y, 0.0); -} - - - -mat2x4 __constructor(const mat2x4 m) -{ - __retVal = m; -} - -mat2x4 __constructor(const mat3x4 m) -{ - __retVal = mat2x4(m[0], m[1]); -} - -mat2x4 __constructor(const mat4 m) -{ - __retVal = mat2x4(m[0], m[1]); -} - -mat2x4 __constructor(const mat2x3 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0, - m[1].x, m[1].y, m[1].z, 0.0); -} - -mat2x4 __constructor(const mat3 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0, - m[1].x, m[1].y, m[1].z, 0.0); -} - -mat2x4 __constructor(const mat4x3 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0, - m[1].x, m[1].y, m[1].z, 0.0); -} - -mat2x4 __constructor(const mat2 m) -{ - __retVal = mat2x4(m[0].x, m[1].y, 0.0, 0.0, - m[1].x, m[1].y, 0.0, 0.0); -} - -mat2x4 __constructor(const mat3x2 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, 0.0, 0.0, - m[1].x, m[1].y, 0.0, 0.0); -} - -mat2x4 __constructor(const mat4x2 m) -{ - __retVal = mat2x4(m[0].x, m[0].y, 0.0, 0.0, - m[1].x, m[1].y, 0.0, 0.0); -} - - - -mat3x2 __constructor(const mat3x2 m) -{ - __retVal = m; -} - -mat3x2 __constructor(const mat4x2 m) -{ - __retVal = mat3x2(m[0], m[1], m[2]); -} - -mat3x2 __constructor(const mat3 m) -{ - __retVal = mat3x2(m[0], m[1], m[2]); -} - -mat3x2 __constructor(const mat3x4 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - m[2].x, m[2].y); -} - -mat3x2 __constructor(const mat4x3 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - m[2].x, m[2].y); -} - -mat3x2 __constructor(const mat4 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - 0.0, 0.0); -} - -mat3x2 __constructor(const mat2 m) -{ - __retVal = mat3x2(m[0], m[1], vec2(0.0)); -} - -mat3x2 __constructor(const mat2x3 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - 0.0, 0.0); -} - -mat3x2 __constructor(const mat2x4 m) -{ - __retVal = mat3x2(m[0].x, m[0].y, - m[1].x, m[1].y, - 0.0, 0.0); -} - - - - -mat3 __constructor(const mat3 m) -{ - __retVal = m; -} - -mat3 __constructor(const mat4x3 m) -{ - __retVal = mat3 ( - m[0], - m[1], - m[2] - ); -} - -mat3 __constructor(const mat3x4 m) -{ - __retVal = mat3 ( - m[0].xyz, - m[1].xyz, - m[2].xyz - ); -} - -mat3 __constructor(const mat4 m) -{ - __retVal = mat3 ( - m[0].xyz, - m[1].xyz, - m[2].xyz - ); -} - -mat3 __constructor(const mat2x3 m) -{ - __retVal = mat3 ( - m[0], - m[1], - 0., 0., 1. - ); -} - -mat3 __constructor(const mat2x4 m) -{ - __retVal = mat3 ( - m[0].xyz, - m[1].xyz, - 0., 0., 1. - ); -} - -mat3 __constructor(const mat3x2 m) -{ - __retVal = mat3 ( - m[0], 0., - m[1], 0., - m[2], 1. - ); -} - -mat3 __constructor(const mat4x2 m) -{ - __retVal = mat3 ( - m[0], 0., - m[1], 0., - m[2], 1. - ); -} - -mat3 __constructor(const mat2 m) -{ - __retVal = mat3 ( - m[0], 0., - m[1], 0., - 0., 0., 1. - ); -} - - -mat3x4 __constructor(const mat3x4 m) -{ - __retVal = m; -} - -mat3x4 __constructor(const mat4 m) -{ - __retVal = mat3x4 ( - m[0], - m[1], - m[2] - ); -} - -mat3x4 __constructor(const mat3 m) -{ - __retVal = mat3x4 ( - m[0], 0., - m[1], 0., - m[2], 0. - ); -} - -mat3x4 __constructor(const mat4x3 m) -{ - __retVal = mat3x4 ( - m[0], 0., - m[1], 0., - m[2], 0. - ); -} - -mat3x4 __constructor(const mat2x4 m) -{ - __retVal = mat3x4 ( - m[0], - m[1], - 0., 0., 1., 0. - ); -} - -mat3x4 __constructor(const mat2x3 m) -{ - __retVal = mat3x4 ( - m[0], 0., - m[1], 0., - 0., 0., 1., 0. - ); -} - -mat3x4 __constructor(const mat3x2 m) -{ - __retVal = mat3x4 ( - m[0], 0., 0., - m[1], 0., 0., - m[2], 1., 0. - ); -} - -mat3x4 __constructor(const mat4x2 m) -{ - __retVal = mat3x4 ( - m[0], 0., 0., - m[1], 0., 0., - m[2], 1., 0. - ); -} - -mat3x4 __constructor(const mat2 m) -{ - __retVal = mat3x4 ( - m[0], 0., 0., - m[1], 0., 0., - 0., 0., 1., 0. - ); -} - - -mat4x2 __constructor(const mat4x2 m) -{ - __retVal = m; -} - -mat4x2 __constructor(const mat4x3 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - m[2].xy, - m[3].xy - ); -} - -mat4x2 __constructor(const mat4 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - m[2].xy, - m[3].xy - ); -} - -mat4x2 __constructor(const mat3x2 m) -{ - __retVal = mat4x2 ( - m[0], - m[1], - 0., 0. - ); -} - -mat4x2 __constructor(const mat3 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - m[2].xy, - 0., 0. - ); -} - -mat4x2 __constructor(const mat3x4 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - m[2].xy, - 0., 0. - ); -} - -mat4x2 __constructor(const mat2 m) -{ - __retVal = mat4x2 ( - m[0], - m[1], - 0., 0., - 0., 0. - ); -} - -mat4x2 __constructor(const mat2x3 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - 0., 0., - 0., 0. - ); -} - -mat4x2 __constructor(const mat2x4 m) -{ - __retVal = mat4x2 ( - m[0].xy, - m[1].xy, - 0., 0., - 0., 0. - ); -} - - -mat4x3 __constructor(const mat4x3 m) -{ - __retVal = m; -} - -mat4x3 __constructor(const mat4 m) -{ - __retVal = mat4x3 ( - m[0].xyz, - m[1].xyz, - m[2].xyz, - m[3].xyz - ); -} - -mat4x3 __constructor(const mat3 m) -{ - __retVal = mat4x3 ( - m[0], - m[1], - m[2], - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat3x4 m) -{ - __retVal = mat4x3 ( - m[0].xyz, - m[1].xyz, - m[2].xyz, - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat4x2 m) -{ - __retVal = mat4x3 ( - m[0], 0., - m[1], 0., - m[2], 1., - m[3], 0. - ); -} - -mat4x3 __constructor(const mat2x3 m) -{ - __retVal = mat4x3 ( - m[0], - m[1], - 0., 0., 1., - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat3x2 m) -{ - __retVal = mat4x3 ( - m[0], 0., - m[1], 0., - m[2], 1., - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat2x4 m) -{ - __retVal = mat4x3 ( - m[0].xyz, - m[1].xyz, - 0., 0., 1., - 0., 0., 0. - ); -} - -mat4x3 __constructor(const mat2 m) -{ - __retVal = mat4x3 ( - m[0], 0., - m[1], 0., - 0., 0., 1., - 0., 0., 0. - ); -} - - -mat4 __constructor(const mat4 m) -{ - __retVal = m; -} - -mat4 __constructor(const mat3x4 m) -{ - __retVal = mat4 ( - m[0], - m[1], - m[2], - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat4x3 m) -{ - __retVal = mat4 ( - m[0], 0., - m[1], 0., - m[2], 0., - m[3], 1. - ); -} - -mat4 __constructor(const mat2x4 m) -{ - __retVal = mat4 ( - m[0], - m[1], - 0., 0., 1., 0., - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat4x2 m) -{ - __retVal = mat4 ( - m[0], 0., 0., - m[1], 0., 0., - m[2], 1., 0., - m[3], 0., 1. - ); -} - -mat4 __constructor(const mat3 m) -{ - __retVal = mat4 ( - m[0], 0., - m[1], 0., - m[2], 0., - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat2x3 m) -{ - __retVal = mat4 ( - m[0], 0., - m[1], 0., - 0., 0., 1., 0., - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat3x2 m) -{ - __retVal = mat4 ( - m[0], 0., 0., - m[1], 0., 0., - m[2], 1., 0., - 0., 0., 0., 1. - ); -} - -mat4 __constructor(const mat2 m) -{ - __retVal = mat4 ( - m[0], 0., 0., - m[1], 0., 0., - 0., 0., 1., 0., - 0., 0., 0., 1. - ); -} - - -void __operator += (inout mat2x3 m, const mat2x3 n) { - m[0] += n[0]; - m[1] += n[1]; -} - -void __operator += (inout mat2x4 m, const mat2x4 n) { - m[0] += n[0]; - m[1] += n[1]; -} - -void __operator += (inout mat3x2 m, const mat3x2 n) { - m[0] += n[0]; - m[1] += n[1]; - m[2] += n[2]; -} - -void __operator += (inout mat3x4 m, const mat3x4 n) { - m[0] += n[0]; - m[1] += n[1]; - m[2] += n[2]; -} - -void __operator += (inout mat4x2 m, const mat4x2 n) { - m[0] += n[0]; - m[1] += n[1]; - m[2] += n[2]; - m[3] += n[3]; -} - -void __operator += (inout mat4x3 m, const mat4x3 n) { - m[0] += n[0]; - m[1] += n[1]; - m[2] += n[2]; - m[3] += n[3]; -} - - -void __operator -= (inout mat2x3 m, const mat2x3 n) { - m[0] -= n[0]; - m[1] -= n[1]; -} - -void __operator -= (inout mat2x4 m, const mat2x4 n) { - m[0] -= n[0]; - m[1] -= n[1]; -} - -void __operator -= (inout mat3x2 m, const mat3x2 n) { - m[0] -= n[0]; - m[1] -= n[1]; - m[2] -= n[2]; -} - -void __operator -= (inout mat3x4 m, const mat3x4 n) { - m[0] -= n[0]; - m[1] -= n[1]; - m[2] -= n[2]; -} - -void __operator -= (inout mat4x2 m, const mat4x2 n) { - m[0] -= n[0]; - m[1] -= n[1]; - m[2] -= n[2]; - m[3] -= n[3]; -} - -void __operator -= (inout mat4x3 m, const mat4x3 n) { - m[0] -= n[0]; - m[1] -= n[1]; - m[2] -= n[2]; - m[3] -= n[3]; -} - - -void __operator /= (inout mat2x3 m, const mat2x3 n) { - m[0] /= n[0]; - m[1] /= n[1]; -} - -void __operator /= (inout mat2x4 m, const mat2x4 n) { - m[0] /= n[0]; - m[1] /= n[1]; -} - -void __operator /= (inout mat3x2 m, const mat3x2 n) { - m[0] /= n[0]; - m[1] /= n[1]; - m[2] /= n[2]; -} - -void __operator /= (inout mat3x4 m, const mat3x4 n) { - m[0] /= n[0]; - m[1] /= n[1]; - m[2] /= n[2]; -} - -void __operator /= (inout mat4x2 m, const mat4x2 n) { - m[0] /= n[0]; - m[1] /= n[1]; - m[2] /= n[2]; - m[3] /= n[3]; -} - -void __operator /= (inout mat4x3 m, const mat4x3 n) { - m[0] /= n[0]; - m[1] /= n[1]; - m[2] /= n[2]; - m[3] /= n[3]; -} - - -vec3 __operator * (const mat2x3 m, const vec2 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y; - __retVal.z = v.x * m[0].z + v.y * m[1].z; -} - -vec4 __operator * (const mat2x4 m, const vec2 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y; - __retVal.z = v.x * m[0].z + v.y * m[1].z; - __retVal.w = v.x * m[0].w + v.y * m[1].w; -} - -vec2 __operator * (const mat3x2 m, const vec3 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y; -} - -vec4 __operator * (const mat3x4 m, const vec3 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y; - __retVal.z = v.x * m[0].z + v.y * m[1].z + v.z * m[2].z; - __retVal.w = v.x * m[0].w + v.y * m[1].w + v.z * m[2].w; -} - -vec2 __operator * (const mat4x2 m, const vec4 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y; -} - -vec3 __operator * (const mat4x3 m, const vec4 v) -{ - __retVal.x = v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x; - __retVal.y = v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y; - __retVal.z = v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z; -} - - -mat3x2 __operator * (const mat2 m, const mat3x2 n) -{ - //return mat3x2 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x2 __operator * (const mat2 m, const mat4x2 n) -{ - //return mat4x2 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x3 __operator * (const mat2x3 m, const mat2 n) -{ - //return mat2x3 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3 __operator * (const mat2x3 m, const mat3x2 n) -{ - //return mat3 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x3 __operator * (const mat2x3 m, const mat4x2 n) -{ - //return mat4x3 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x4 __operator * (const mat2x4 m, const mat2 n) -{ - //return mat2x4 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x4 __operator * (const mat2x4 m, const mat3x2 n) -{ - //return mat3x4 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4 __operator * (const mat2x4 m, const mat4x2 n) -{ - //return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2 __operator * (const mat3x2 m, const mat2x3 n) -{ - //return mat2 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x2 __operator * (const mat3x2 m, const mat3 n) -{ - //return mat3x2 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x2 __operator * (const mat3x2 m, const mat4x3 n) -{ - //return mat4x2 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x3 __operator * (const mat3 m, const mat2x3 n) -{ - //return mat2x3 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat4x3 __operator * (const mat3 m, const mat4x3 n) -{ - //return mat4x3 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x4 __operator * (const mat3x4 m, const mat2x3 n) -{ - //return mat2x4 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x4 __operator * (const mat3x4 m, const mat3 n) -{ - //return mat3x4 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4 __operator * (const mat3x4 m, const mat4x3 n) -{ - //return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2 __operator * (const mat4x2 m, const mat2x4 n) -{ - //return = mat2 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x2 __operator * (const mat4x2 m, const mat3x4 n) -{ - //return mat3x2 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x2 __operator * (const mat4x2 m, const mat4 n) -{ - //return mat4x2 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x3 __operator * (const mat4x3 m, const mat2x4 n) -{ - //return mat2x3 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3 __operator * (const mat4x3 m, const mat3x4 n) -{ - //return mat3 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - -mat4x3 __operator * (const mat4x3 m, const mat4 n) -{ - //return mat4x3 (m * n[0], m * n[1], m * n[2], m * n[3]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; - __retVal[3] = m * n[3]; -} - - -mat2x4 __operator * (const mat4 m, const mat2x4 n) -{ - //return mat2x4 (m * n[0], m * n[1]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; -} - -mat3x4 __operator * (const mat4 m, const mat3x4 n) -{ - //return mat3x4 (m * n[0], m * n[1], m * n[2]); - __retVal[0] = m * n[0]; - __retVal[1] = m * n[1]; - __retVal[2] = m * n[2]; -} - - -void __operator *= (inout mat2x3 m, const mat2 n) { - m = m * n; -} - -void __operator *= (inout mat2x4 m, const mat2 n) { - m = m * n; -} - -void __operator *= (inout mat3x2 m, const mat3 n) { - m = m * n; -} - -void __operator *= (inout mat3x4 m, const mat3 n) { - m = m * n; -} - -void __operator *= (inout mat4x2 m, const mat4 n) { - m = m * n; -} - -void __operator *= (inout mat4x3 m, const mat4 n) { - m = m * n; -} - - -vec3 __operator * (const vec2 v, const mat3x2 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); -} - -vec4 __operator * (const vec2 v, const mat4x2 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); - __retVal.w = dot(v, m[3]); -} - -vec2 __operator * (const vec3 v, const mat2x3 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); -} - -vec4 __operator * (const vec3 v, const mat4x3 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); - __retVal.w = dot(v, m[3]); -} - -vec2 __operator * (const vec4 v, const mat2x4 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); -} - -vec3 __operator * (const vec4 v, const mat3x4 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); -} - - -void __operator += (inout mat2x3 m, const float a) { - m[0] += a; - m[1] += a; -} - -void __operator += (inout mat2x4 m, const float a) { - m[0] += a; - m[1] += a; -} - -void __operator += (inout mat3x2 m, const float a) { - m[0] += a; - m[1] += a; - m[2] += a; -} - -void __operator += (inout mat3x4 m, const float a) { - m[0] += a; - m[1] += a; - m[2] += a; -} - -void __operator += (inout mat4x2 m, const float a) { - m[0] += a; - m[1] += a; - m[2] += a; - m[3] += a; -} - -void __operator += (inout mat4x3 m, const float a) { - m[0] += a; - m[1] += a; - m[2] += a; - m[3] += a; -} - - -void __operator -= (inout mat2x3 m, const float a) { - m[0] -= a; - m[1] -= a; -} - -void __operator -= (inout mat2x4 m, const float a) { - m[0] -= a; - m[1] -= a; -} - -void __operator -= (inout mat3x2 m, const float a) { - m[0] -= a; - m[1] -= a; - m[2] -= a; -} - -void __operator -= (inout mat3x4 m, const float a) { - m[0] -= a; - m[1] -= a; - m[2] -= a; -} - -void __operator -= (inout mat4x2 m, const float a) { - m[0] -= a; - m[1] -= a; - m[2] -= a; - m[3] -= a; -} - -void __operator -= (inout mat4x3 m, const float a) { - m[0] -= a; - m[1] -= a; - m[2] -= a; - m[3] -= a; -} - - -void __operator *= (inout mat2x3 m, const float a) { - m[0] *= a; - m[1] *= a; -} - -void __operator *= (inout mat2x4 m, const float a) { - m[0] *= a; - m[1] *= a; -} - -void __operator *= (inout mat3x2 m, const float a) { - m[0] *= a; - m[1] *= a; - m[2] *= a; -} - -void __operator *= (inout mat3x4 m, const float a) { - m[0] *= a; - m[1] *= a; - m[2] *= a; -} - -void __operator *= (inout mat4x2 m, const float a) { - m[0] *= a; - m[1] *= a; - m[2] *= a; - m[3] *= a; -} - -void __operator *= (inout mat4x3 m, const float a) { - m[0] *= a; - m[1] *= a; - m[2] *= a; - m[3] *= a; -} - - -void __operator /= (inout mat2x3 m, const float a) { - m[0] /= a; - m[1] /= a; -} - -void __operator /= (inout mat2x4 m, const float a) { - m[0] /= a; - m[1] /= a; -} - -void __operator /= (inout mat3x2 m, const float a) { - m[0] /= a; - m[1] /= a; - m[2] /= a; -} - -void __operator /= (inout mat3x4 m, const float a) { - m[0] /= a; - m[1] /= a; - m[2] /= a; -} - -void __operator /= (inout mat4x2 m, const float a) { - m[0] /= a; - m[1] /= a; - m[2] /= a; - m[3] /= a; -} - -void __operator /= (inout mat4x3 m, const float a) { - m[0] /= a; - m[1] /= a; - m[2] /= a; - m[3] /= a; -} - - -mat2x3 __operator + (const mat2x3 m, const mat2x3 n) { - return mat2x3 (m[0] + n[0], m[1] + n[1]); -} - -mat2x4 __operator + (const mat2x4 m, const mat2x4 n) { - return mat2x4 (m[0] + n[0], m[1] + n[1]); -} - -mat3x2 __operator + (const mat3x2 m, const mat3x2 n) { - return mat3x2 (m[0] + n[0], m[1] + n[1], m[2] + n[2]); -} - -mat3x4 __operator + (const mat3x4 m, const mat3x4 n) { - return mat3x4 (m[0] + n[0], m[1] + n[1], m[2] + n[2]); -} - -mat4x2 __operator + (const mat4x2 m, const mat4x2 n) { - return mat4x2 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]); -} - -mat4x3 __operator + (const mat4x3 m, const mat4x3 n) { - return mat4x3 (m[0] + n[0], m[1] + n[1], m[2] + n[2], m[3] + n[3]); -} - - -mat2x3 __operator - (const mat2x3 m, const mat2x3 n) { - return mat2x3 (m[0] - n[0], m[1] - n[1]); -} - -mat2x4 __operator - (const mat2x4 m, const mat2x4 n) { - return mat2x4 (m[0] - n[0], m[1] - n[1]); -} - -mat3x2 __operator - (const mat3x2 m, const mat3x2 n) { - return mat3x2 (m[0] - n[0], m[1] - n[1], m[2] - n[2]); -} - -mat3x4 __operator - (const mat3x4 m, const mat3x4 n) { - return mat3x4 (m[0] - n[0], m[1] - n[1], m[2] - n[2]); -} - -mat4x2 __operator - (const mat4x2 m, const mat4x2 n) { - return mat4x2 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]); -} - -mat4x3 __operator - (const mat4x3 m, const mat4x3 n) { - return mat4x3 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]); -} - - -mat2x3 __operator / (const mat2x3 m, const mat2x3 n) { - return mat2x3 (m[0] / n[0], m[1] / n[1]); -} - -mat2x4 __operator / (const mat2x4 m, const mat2x4 n) { - return mat2x4 (m[0] / n[0], m[1] / n[1]); -} - -mat3x2 __operator / (const mat3x2 m, const mat3x2 n) { - return mat3x2 (m[0] / n[0], m[1] / n[1], m[2] / n[2]); -} - -mat3x4 __operator / (const mat3x4 m, const mat3x4 n) { - return mat3x4 (m[0] / n[0], m[1] / n[1], m[2] / n[2]); -} - -mat4x2 __operator / (const mat4x2 m, const mat4x2 n) { - return mat4x2 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]); -} - -mat4x3 __operator / (const mat4x3 m, const mat4x3 n) { - return mat4x3 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]); -} - - -mat2x3 __operator + (const float a, const mat2x3 n) { - return mat2x3 (a + n[0], a + n[1]); -} - -mat2x3 __operator + (const mat2x3 m, const float b) { - return mat2x3 (m[0] + b, m[1] + b); -} - -mat2x4 __operator + (const float a, const mat2x4 n) { - return mat2x4 (a + n[0], a + n[1]); -} - -mat2x4 __operator + (const mat2x4 m, const float b) { - return mat2x4 (m[0] + b, m[1] + b); -} - -mat3x2 __operator + (const float a, const mat3x2 n) { - return mat3x2 (a + n[0], a + n[1], a + n[2]); -} - -mat3x2 __operator + (const mat3x2 m, const float b) { - return mat3x2 (m[0] + b, m[1] + b, m[2] + b); -} - -mat3x4 __operator + (const float a, const mat3x4 n) { - return mat3x4 (a + n[0], a + n[1], a + n[2]); -} - -mat3x4 __operator + (const mat3x4 m, const float b) { - return mat3x4 (m[0] + b, m[1] + b, m[2] + b); -} - -mat4x2 __operator + (const mat4x2 m, const float b) { - return mat4x2 (m[0] + b, m[1] + b, m[2] + b, m[3] + b); -} - -mat4x2 __operator + (const float a, const mat4x2 n) { - return mat4x2 (a + n[0], a + n[1], a + n[2], a + n[3]); -} - -mat4x3 __operator + (const mat4x3 m, const float b) { - return mat4x3 (m[0] + b, m[1] + b, m[2] + b, m[3] + b); -} - -mat4x3 __operator + (const float a, const mat4x3 n) { - return mat4x3 (a + n[0], a + n[1], a + n[2], a + n[3]); -} - - -mat2x3 __operator - (const float a, const mat2x3 n) { - return mat2x3 (a - n[0], a - n[1]); -} - -mat2x3 __operator - (const mat2x3 m, const float b) { - return mat2x3 (m[0] - b, m[1] - b); -} - -mat2x4 __operator - (const float a, const mat2x4 n) { - return mat2x4 (a - n[0], a - n[1]); -} - -mat2x4 __operator - (const mat2x4 m, const float b) { - return mat2x4 (m[0] - b, m[1] - b); -} - -mat3x2 __operator - (const float a, const mat3x2 n) { - return mat3x2 (a - n[0], a - n[1], a - n[2]); -} - -mat3x2 __operator - (const mat3x2 m, const float b) { - return mat3x2 (m[0] - b, m[1] - b, m[2] - b); -} - -mat3x4 __operator - (const float a, const mat3x4 n) { - return mat3x4 (a - n[0], a - n[1], a - n[2]); -} - -mat3x4 __operator - (const mat3x4 m, const float b) { - return mat3x4 (m[0] - b, m[1] - b, m[2] - b); -} - -mat4x2 __operator - (const mat4x2 m, const float b) { - return mat4x2 (m[0] - b, m[1] - b, m[2] - b, m[3] - b); -} - -mat4x2 __operator - (const float a, const mat4x2 n) { - return mat4x2 (a - n[0], a - n[1], a - n[2], a - n[3]); -} - -mat4x3 __operator - (const mat4x3 m, const float b) { - return mat4x3 (m[0] - b, m[1] - b, m[2] - b, m[3] - b); -} - -mat4x3 __operator - (const float a, const mat4x3 n) { - return mat4x3 (a - n[0], a - n[1], a - n[2], a - n[3]); -} - - -mat2x3 __operator * (const float a, const mat2x3 n) -{ - //return mat2x3 (a * n[0], a * n[1]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; -} - -mat2x3 __operator * (const mat2x3 m, const float b) -{ - //return mat2x3 (m[0] * b, m[1] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; -} - -mat2x4 __operator * (const float a, const mat2x4 n) -{ - //return mat2x4 (a * n[0], a * n[1]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; -} - -mat2x4 __operator * (const mat2x4 m, const float b) -{ - //return mat2x4 (m[0] * b, m[1] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; -} - -mat3x2 __operator * (const float a, const mat3x2 n) -{ - //return mat3x2 (a * n[0], a * n[1], a * n[2]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; -} - -mat3x2 __operator * (const mat3x2 m, const float b) -{ - //return mat3x2 (m[0] * b, m[1] * b, m[2] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; -} - -mat3x4 __operator * (const float a, const mat3x4 n) -{ - //return mat3x4 (a * n[0], a * n[1], a * n[2]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; -} - -mat3x4 __operator * (const mat3x4 m, const float b) -{ - //return mat3x4 (m[0] * b, m[1] * b, m[2] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; -} - -mat4x2 __operator * (const mat4x2 m, const float b) -{ - //return mat4x2 (m[0] * b, m[1] * b, m[2] * b, m[3] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; - __retVal[3] = m[3] * b; -} - -mat4x2 __operator * (const float a, const mat4x2 n) -{ - //return mat4x2 (a * n[0], a * n[1], a * n[2], a * n[3]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; - __retVal[3] = a * n[3]; -} - -mat4x3 __operator * (const mat4x3 m, const float b) -{ - //return mat4x3 (m[0] * b, m[1] * b, m[2] * b, m[3] * b); - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; - __retVal[3] = m[3] * b; -} - -mat4x3 __operator * (const float a, const mat4x3 n) -{ - //return mat4x3 (a * n[0], a * n[1], a * n[2], a * n[3]); - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; - __retVal[3] = a * n[3]; -} - - -mat2x3 __operator / (const float a, const mat2x3 n) -{ - //return mat2x3 (a / n[0], a / n[1]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; -} - -mat2x3 __operator / (const mat2x3 m, const float b) -{ - //return mat2x3 (m[0] / b, m[1] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; -} - -mat2x4 __operator / (const float a, const mat2x4 n) -{ - //return mat2x4 (a / n[0], a / n[1]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; -} - -mat2x4 __operator / (const mat2x4 m, const float b) -{ - //return mat2x4 (m[0] / b, m[1] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; -} - -mat3x2 __operator / (const float a, const mat3x2 n) -{ - //return mat3x2 (a / n[0], a / n[1], a / n[2]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; - __retVal[2] = inv * n[2]; -} - -mat3x2 __operator / (const mat3x2 m, const float b) -{ - //return mat3x2 (m[0] / b, m[1] / b, m[2] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; - __retVal[2] = m[2] * inv; -} - -mat3x4 __operator / (const float a, const mat3x4 n) -{ - //return mat3x4 (a / n[0], a / n[1], a / n[2]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; - __retVal[2] = inv * n[2]; -} - -mat3x4 __operator / (const mat3x4 m, const float b) -{ - //return mat3x4 (m[0] / b, m[1] / b, m[2] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; - __retVal[2] = m[2] * inv; -} - -mat4x2 __operator / (const mat4x2 m, const float b) -{ - //return mat4x2 (m[0] / b, m[1] / b, m[2] / b, m[3] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; - __retVal[2] = m[2] * inv; - __retVal[3] = m[3] * inv; -} - -mat4x2 __operator / (const float a, const mat4x2 n) -{ - //return mat4x2 (a / n[0], a / n[1], a / n[2], a / n[3]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; - __retVal[2] = inv * n[2]; - __retVal[3] = inv * n[3]; -} - -mat4x3 __operator / (const mat4x3 m, const float b) -{ - //return mat4x3 (m[0] / b, m[1] / b, m[2] / b, m[3] / b); - const float inv = 1.0 / b; - __retVal[0] = m[0] * inv; - __retVal[1] = m[1] * inv; - __retVal[2] = m[2] * inv; - __retVal[3] = m[3] * inv; -} - -mat4x3 __operator / (const float a, const mat4x3 n) -{ - //return mat4x3 (a / n[0], a / n[1], a / n[2], a / n[3]); - const float inv = 1.0 / a; - __retVal[0] = inv * n[0]; - __retVal[1] = inv * n[1]; - __retVal[2] = inv * n[2]; - __retVal[3] = inv * n[3]; -} - - -mat2x3 __operator - (const mat2x3 m) { - return mat2x3 (-m[0], -m[1]); -} - -mat2x4 __operator - (const mat2x4 m) { - return mat2x4 (-m[0], -m[1]); -} - -mat3x2 __operator - (const mat3x2 m) { - return mat3x2 (-m[0], -m[1], -m[2]); -} - -mat3x4 __operator - (const mat3x4 m) { - return mat3x4 (-m[0], -m[1], -m[2]); -} - -mat4x2 __operator - (const mat4x2 m) { - return mat4x2 (-m[0], -m[1], -m[2], -m[3]); -} - -mat4x3 __operator - (const mat4x3 m) { - return mat4x3 (-m[0], -m[1], -m[2], -m[3]); -} - - -void __operator -- (inout mat2x3 m) { - --m[0]; - --m[1]; -} - -void __operator -- (inout mat2x4 m) { - --m[0]; - --m[1]; -} - -void __operator -- (inout mat3x2 m) { - --m[0]; - --m[1]; - --m[2]; -} - -void __operator -- (inout mat3x4 m) { - --m[0]; - --m[1]; - --m[2]; -} - -void __operator -- (inout mat4x2 m) { - --m[0]; - --m[1]; - --m[2]; - --m[3]; -} - -void __operator -- (inout mat4x3 m) { - --m[0]; - --m[1]; - --m[2]; - --m[3]; -} - - -void __operator ++ (inout mat2x3 m) { - ++m[0]; - ++m[1]; -} - -void __operator ++ (inout mat2x4 m) { - ++m[0]; - ++m[1]; -} - -void __operator ++ (inout mat3x2 m) { - ++m[0]; - ++m[1]; - ++m[2]; -} - -void __operator ++ (inout mat3x4 m) { - ++m[0]; - ++m[1]; - ++m[2]; -} - -void __operator ++ (inout mat4x2 m) { - ++m[0]; - ++m[1]; - ++m[2]; - ++m[3]; -} - -void __operator ++ (inout mat4x3 m) { - ++m[0]; - ++m[1]; - ++m[2]; - ++m[3]; -} - diff --git a/mesalib/src/mesa/shader/slang/library/slang_builtin_120_common.gc b/mesalib/src/mesa/shader/slang/library/slang_builtin_120_common.gc deleted file mode 100644 index c6264c3b4..000000000 --- a/mesalib/src/mesa/shader/slang/library/slang_builtin_120_common.gc +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.6 - * - * Copyright (C) 2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -// -// From Shader Spec, ver. 1.20, rev. 6 -// - -// -// 8.5 Matrix Functions -// - -mat2x3 matrixCompMult (mat2x3 m, mat2x3 n) { - return mat2x3 (m[0] * n[0], m[1] * n[1]); -} - -mat2x4 matrixCompMult (mat2x4 m, mat2x4 n) { - return mat2x4 (m[0] * n[0], m[1] * n[1]); -} - -mat3x2 matrixCompMult (mat3x2 m, mat3x2 n) { - return mat3x2 (m[0] * n[0], m[1] * n[1], m[2] * n[2]); -} - -mat3x4 matrixCompMult (mat3x4 m, mat3x4 n) { - return mat3x4 (m[0] * n[0], m[1] * n[1], m[2] * n[2]); -} - -mat4x2 matrixCompMult (mat4x2 m, mat4x2 n) { - return mat4x2 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]); -} - -mat4x3 matrixCompMult (mat4x3 m, mat4x3 n) { - return mat4x3 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]); -} - -mat2 outerProduct (vec2 c, vec2 r) { - return mat2 ( - c.x * r.x, c.y * r.x, - c.x * r.y, c.y * r.y - ); -} - -mat3 outerProduct (vec3 c, vec3 r) { - return mat3 ( - c.x * r.x, c.y * r.x, c.z * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, - c.x * r.z, c.y * r.z, c.z * r.z - ); -} - -mat4 outerProduct (vec4 c, vec4 r) { - return mat4 ( - c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y, - c.x * r.z, c.y * r.z, c.z * r.z, c.w * r.z, - c.x * r.w, c.y * r.w, c.z * r.w, c.w * r.w - ); -} - -mat2x3 outerProduct (vec3 c, vec2 r) { - return mat2x3 ( - c.x * r.x, c.y * r.x, c.z * r.x, - c.x * r.y, c.y * r.y, c.z * r.y - ); -} - -mat3x2 outerProduct (vec2 c, vec3 r) { - return mat3x2 ( - c.x * r.x, c.y * r.x, - c.x * r.y, c.y * r.y, - c.x * r.z, c.y * r.z - ); -} - -mat2x4 outerProduct (vec4 c, vec2 r) { - return mat2x4 ( - c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y - ); -} - -mat4x2 outerProduct (vec2 c, vec4 r) { - return mat4x2 ( - c.x * r.x, c.y * r.x, - c.x * r.y, c.y * r.y, - c.x * r.z, c.y * r.z, - c.x * r.w, c.y * r.w - ); -} - -mat3x4 outerProduct (vec4 c, vec3 r) { - return mat3x4 ( - c.x * r.x, c.y * r.x, c.z * r.x, c.w * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, c.w * r.y, - c.x * r.z, c.y * r.z, c.z * r.z, c.w * r.z - ); -} - -mat4x3 outerProduct (vec3 c, vec4 r) { - return mat4x3 ( - c.x * r.x, c.y * r.x, c.z * r.x, - c.x * r.y, c.y * r.y, c.z * r.y, - c.x * r.z, c.y * r.z, c.z * r.z, - c.x * r.w, c.y * r.w, c.z * r.w - ); -} - -mat2 transpose (mat2 m) { - return mat2 ( - m[0].x, m[1].x, - m[0].y, m[1].y - ); -} - -mat3 transpose (mat3 m) { - return mat3 ( - m[0].x, m[1].x, m[2].x, - m[0].y, m[1].y, m[2].y, - m[0].z, m[1].z, m[2].z - ); -} - -mat4 transpose (mat4 m) { - return mat4 ( - m[0].x, m[1].x, m[2].x, m[3].x, - m[0].y, m[1].y, m[2].y, m[3].y, - m[0].z, m[1].z, m[2].z, m[3].z, - m[0].w, m[1].w, m[2].w, m[3].w - ); -} - -mat2x3 transpose (mat3x2 m) { - return mat2x3 ( - m[0].x, m[1].x, m[2].x, - m[0].y, m[1].y, m[2].y - ); -} - -mat3x2 transpose (mat2x3 m) { - return mat3x2 ( - m[0].x, m[1].x, - m[0].y, m[1].y, - m[0].z, m[1].z - ); -} - -mat2x4 transpose (mat4x2 m) { - return mat2x4 ( - m[0].x, m[1].x, m[2].x, m[3].x, - m[0].y, m[1].y, m[2].y, m[3].y - ); -} - -mat4x2 transpose (mat2x4 m) { - return mat4x2 ( - m[0].x, m[1].x, - m[0].y, m[1].y, - m[0].z, m[1].z, - m[0].w, m[1].w - ); -} - -mat3x4 transpose (mat4x3 m) { - return mat3x4 ( - m[0].x, m[1].x, m[2].x, m[3].x, - m[0].y, m[1].y, m[2].y, m[3].y, - m[0].z, m[1].z, m[2].z, m[3].z - ); -} - -mat4x3 transpose (mat3x4 m) { - return mat4x3 ( - m[0].x, m[1].x, m[2].x, - m[0].y, m[1].y, m[2].y, - m[0].z, m[1].z, m[2].z, - m[0].w, m[1].w, m[2].w - ); -} - diff --git a/mesalib/src/mesa/shader/slang/library/slang_common_builtin.gc b/mesalib/src/mesa/shader/slang/library/slang_common_builtin.gc deleted file mode 100644 index a25ca55bc..000000000 --- a/mesalib/src/mesa/shader/slang/library/slang_common_builtin.gc +++ /dev/null @@ -1,1893 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 2006 Brian Paul All Rights Reserved. - * Copyright (C) 2008 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -// -// From Shader Spec, ver. 1.10, rev. 59 -// - -// Note: the values assigned to these constants here aren't actually used. -// They're set by the compiler according to the GL context limits. -// See slang_simplify.c -const int gl_MaxLights = 8; -const int gl_MaxClipPlanes = 6; -const int gl_MaxTextureUnits = 8; -const int gl_MaxTextureCoords = 8; -const int gl_MaxVertexAttribs = 16; -const int gl_MaxVertexUniformComponents = 512; -const int gl_MaxVaryingFloats = 32; -const int gl_MaxVertexTextureImageUnits = 0; -const int gl_MaxCombinedTextureImageUnits = 2; -const int gl_MaxTextureImageUnits = 2; -const int gl_MaxFragmentUniformComponents = 64; -const int gl_MaxDrawBuffers = 1; - -uniform mat4 gl_ModelViewMatrix; -uniform mat4 gl_ProjectionMatrix; -uniform mat4 gl_ModelViewProjectionMatrix; -uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords]; - -uniform mat3 gl_NormalMatrix; - -uniform mat4 gl_ModelViewMatrixInverse; -uniform mat4 gl_ProjectionMatrixInverse; -uniform mat4 gl_ModelViewProjectionMatrixInverse; -uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords]; - -uniform mat4 gl_ModelViewMatrixTranspose; -uniform mat4 gl_ProjectionMatrixTranspose; -uniform mat4 gl_ModelViewProjectionMatrixTranspose; -uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords]; - -uniform mat4 gl_ModelViewMatrixInverseTranspose; -uniform mat4 gl_ProjectionMatrixInverseTranspose; -uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose; -uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords]; - -uniform float gl_NormalScale; - -struct gl_DepthRangeParameters { - float near; - float far; - float diff; -}; - -uniform gl_DepthRangeParameters gl_DepthRange; - -uniform vec4 gl_ClipPlane[gl_MaxClipPlanes]; - -struct gl_PointParameters { - float size; - float sizeMin; - float sizeMax; - float fadeThresholdSize; - float distanceConstantAttenuation; - float distanceLinearAttenuation; - float distanceQuadraticAttenuation; -}; - -uniform gl_PointParameters gl_Point; - -struct gl_MaterialParameters { - vec4 emission; - vec4 ambient; - vec4 diffuse; - vec4 specular; - float shininess; -}; - -uniform gl_MaterialParameters gl_FrontMaterial; -uniform gl_MaterialParameters gl_BackMaterial; - -/* NOTE: the order of these fields is significant! - * See the definition of the lighting state vars such as STATE_SPOT_DIRECTION. - */ -struct gl_LightSourceParameters { - vec4 ambient; - vec4 diffuse; - vec4 specular; - vec4 position; - vec4 halfVector; - vec3 spotDirection; - float spotCosCutoff; - - float constantAttenuation; - float linearAttenuation; - float quadraticAttenuation; - float spotExponent; - - float spotCutoff; -}; - -uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights]; - -struct gl_LightModelParameters { - vec4 ambient; -}; - -uniform gl_LightModelParameters gl_LightModel; - -struct gl_LightModelProducts { - vec4 sceneColor; -}; - -uniform gl_LightModelProducts gl_FrontLightModelProduct; -uniform gl_LightModelProducts gl_BackLightModelProduct; - -struct gl_LightProducts { - vec4 ambient; - vec4 diffuse; - vec4 specular; -}; - -uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights]; -uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights]; - -uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits]; -uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords]; -uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords]; -uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords]; -uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords]; -uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords]; -uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords]; -uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords]; -uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords]; - -struct gl_FogParameters { - vec4 color; - float density; - float start; - float end; - float scale; -}; - -uniform gl_FogParameters gl_Fog; - - - - - -// -// 8.1 Angle and Trigonometry Functions -// - -//// radians - -float radians(const float deg) -{ - const float c = 3.1415926 / 180.0; - __asm vec4_multiply __retVal, deg, c; -} - -vec2 radians(const vec2 deg) -{ - const float c = 3.1415926 / 180.0; - __asm vec4_multiply __retVal.xy, deg.xy, c.xx; -} - -vec3 radians(const vec3 deg) -{ - const float c = 3.1415926 / 180.0; - __asm vec4_multiply __retVal.xyz, deg.xyz, c.xxx; -} - -vec4 radians(const vec4 deg) -{ - const float c = 3.1415926 / 180.0; - __asm vec4_multiply __retVal, deg, c.xxxx; -} - - -//// degrees - -float degrees(const float rad) -{ - const float c = 180.0 / 3.1415926; - __asm vec4_multiply __retVal, rad, c; -} - -vec2 degrees(const vec2 rad) -{ - const float c = 180.0 / 3.1415926; - __asm vec4_multiply __retVal.xy, rad.xy, c.xx; -} - -vec3 degrees(const vec3 rad) -{ - const float c = 180.0 / 3.1415926; - __asm vec4_multiply __retVal.xyz, rad.xyz, c.xxx; -} - -vec4 degrees(const vec4 rad) -{ - const float c = 180.0 / 3.1415926; - __asm vec4_multiply __retVal, rad, c.xxxx; -} - - -//// sin - -float sin(const float radians) -{ - __asm float_sine __retVal, radians; -} - -vec2 sin(const vec2 radians) -{ - __asm float_sine __retVal.x, radians.x; - __asm float_sine __retVal.y, radians.y; -} - -vec3 sin(const vec3 radians) -{ - __asm float_sine __retVal.x, radians.x; - __asm float_sine __retVal.y, radians.y; - __asm float_sine __retVal.z, radians.z; -} - -vec4 sin(const vec4 radians) -{ - __asm float_sine __retVal.x, radians.x; - __asm float_sine __retVal.y, radians.y; - __asm float_sine __retVal.z, radians.z; - __asm float_sine __retVal.w, radians.w; -} - - -//// cos - -float cos(const float radians) -{ - __asm float_cosine __retVal, radians; -} - -vec2 cos(const vec2 radians) -{ - __asm float_cosine __retVal.x, radians.x; - __asm float_cosine __retVal.y, radians.y; -} - -vec3 cos(const vec3 radians) -{ - __asm float_cosine __retVal.x, radians.x; - __asm float_cosine __retVal.y, radians.y; - __asm float_cosine __retVal.z, radians.z; -} - -vec4 cos(const vec4 radians) -{ - __asm float_cosine __retVal.x, radians.x; - __asm float_cosine __retVal.y, radians.y; - __asm float_cosine __retVal.z, radians.z; - __asm float_cosine __retVal.w, radians.w; -} - - - -//// tan - -float tan(const float angle) -{ - const float s = sin(angle); - const float c = cos(angle); - return s / c; -} - -vec2 tan(const vec2 angle) -{ - const vec2 s = sin(angle); - const vec2 c = cos(angle); - return s / c; -} - -vec3 tan(const vec3 angle) -{ - const vec3 s = sin(angle); - const vec3 c = cos(angle); - return s / c; -} - -vec4 tan(const vec4 angle) -{ - const vec4 s = sin(angle); - const vec4 c = cos(angle); - return s / c; -} - - - -float asin(const float x) -{ - const float a0 = 1.5707288; // PI/2? - const float a1 = -0.2121144; - const float a2 = 0.0742610; - //const float a3 = -0.0187293; - const float halfPi = 3.1415926 * 0.5; - const float y = abs(x); - // three terms seem to be enough: - __retVal = (halfPi - sqrt(1.0 - y) * (a0 + y * (a1 + a2 * y))) * sign(x); - // otherwise, try four: - //__retVal = (halfPi - sqrt(1.0 - y) * (a0 + y * (a1 + y * (a2 + y * a3)))) * sign(x); -} - -vec2 asin(const vec2 v) -{ - __retVal.x = asin(v.x); - __retVal.y = asin(v.y); -} - -vec3 asin(const vec3 v) -{ - __retVal.x = asin(v.x); - __retVal.y = asin(v.y); - __retVal.z = asin(v.z); -} - -vec4 asin(const vec4 v) -{ - __retVal.x = asin(v.x); - __retVal.y = asin(v.y); - __retVal.z = asin(v.z); - __retVal.w = asin(v.w); -} - -float acos(const float x) -{ - const float halfPi = 3.1415926 * 0.5; - __retVal = halfPi - asin(x); -} - -vec2 acos(const vec2 v) -{ - __retVal.x = acos(v.x); - __retVal.y = acos(v.y); -} - -vec3 acos(const vec3 v) -{ - __retVal.x = acos(v.x); - __retVal.y = acos(v.y); - __retVal.z = acos(v.z); -} - -vec4 acos(const vec4 v) -{ - __retVal.x = acos(v.x); - __retVal.y = acos(v.y); - __retVal.z = acos(v.z); - __retVal.w = acos(v.w); -} - -float atan(const float x) -{ - __retVal = asin(x * inversesqrt(x * x + 1.0)); -} - -vec2 atan(const vec2 y_over_x) -{ - __retVal.x = atan(y_over_x.x); - __retVal.y = atan(y_over_x.y); -} - -vec3 atan(const vec3 y_over_x) -{ - __retVal.x = atan(y_over_x.x); - __retVal.y = atan(y_over_x.y); - __retVal.z = atan(y_over_x.z); -} - -vec4 atan(const vec4 y_over_x) -{ - __retVal.x = atan(y_over_x.x); - __retVal.y = atan(y_over_x.y); - __retVal.z = atan(y_over_x.z); - __retVal.w = atan(y_over_x.w); -} - -float atan(const float y, const float x) -{ - float r; - if (abs(x) > 1.0e-4) { - r = atan(y / x); - if (x < 0.0) { - r = r + sign(y) * 3.141593; - } - } - else { - r = sign(y) * 1.5707965; // pi/2 - } - return r; -} - -vec2 atan(const vec2 u, const vec2 v) -{ - __retVal.x = atan(u.x, v.x); - __retVal.y = atan(u.y, v.y); -} - -vec3 atan(const vec3 u, const vec3 v) -{ - __retVal.x = atan(u.x, v.x); - __retVal.y = atan(u.y, v.y); - __retVal.z = atan(u.z, v.z); -} - -vec4 atan(const vec4 u, const vec4 v) -{ - __retVal.x = atan(u.x, v.x); - __retVal.y = atan(u.y, v.y); - __retVal.z = atan(u.z, v.z); - __retVal.w = atan(u.w, v.w); -} - - -// -// 8.2 Exponential Functions -// - -//// pow - -float pow(const float a, const float b) -{ - __asm float_power __retVal, a, b; -} - -vec2 pow(const vec2 a, const vec2 b) -{ - __asm float_power __retVal.x, a.x, b.x; - __asm float_power __retVal.y, a.y, b.y; -} - -vec3 pow(const vec3 a, const vec3 b) -{ - __asm float_power __retVal.x, a.x, b.x; - __asm float_power __retVal.y, a.y, b.y; - __asm float_power __retVal.z, a.z, b.z; -} - -vec4 pow(const vec4 a, const vec4 b) -{ - __asm float_power __retVal.x, a.x, b.x; - __asm float_power __retVal.y, a.y, b.y; - __asm float_power __retVal.z, a.z, b.z; - __asm float_power __retVal.w, a.w, b.w; -} - - -//// exp - -float exp(const float a) -{ - // NOTE: log2(e) = 1.44269502 - float t = a * 1.44269502; - __asm float_exp2 __retVal, t; -} - -vec2 exp(const vec2 a) -{ - vec2 t = a * 1.44269502; - __asm float_exp2 __retVal.x, t.x; - __asm float_exp2 __retVal.y, t.y; -} - -vec3 exp(const vec3 a) -{ - vec3 t = a * 1.44269502; - __asm float_exp2 __retVal.x, t.x; - __asm float_exp2 __retVal.y, t.y; - __asm float_exp2 __retVal.z, t.z; -} - -vec4 exp(const vec4 a) -{ - vec4 t = a * 1.44269502; - __asm float_exp2 __retVal.x, t.x; - __asm float_exp2 __retVal.y, t.y; - __asm float_exp2 __retVal.z, t.z; - __asm float_exp2 __retVal.w, t.w; -} - - - -//// log2 - -float log2(const float x) -{ - __asm float_log2 __retVal, x; -} - -vec2 log2(const vec2 v) -{ - __asm float_log2 __retVal.x, v.x; - __asm float_log2 __retVal.y, v.y; -} - -vec3 log2(const vec3 v) -{ - __asm float_log2 __retVal.x, v.x; - __asm float_log2 __retVal.y, v.y; - __asm float_log2 __retVal.z, v.z; -} - -vec4 log2(const vec4 v) -{ - __asm float_log2 __retVal.x, v.x; - __asm float_log2 __retVal.y, v.y; - __asm float_log2 __retVal.z, v.z; - __asm float_log2 __retVal.w, v.w; -} - - -//// log (natural log) - -float log(const float x) -{ - // note: logBaseB(x) = logBaseN(x) / logBaseN(B) - // compute log(x) = log2(x) / log2(e) - // c = 1.0 / log2(e) = 0.693147181 - const float c = 0.693147181; - return log2(x) * c; -} - -vec2 log(const vec2 v) -{ - const float c = 0.693147181; - return log2(v) * c; -} - -vec3 log(const vec3 v) -{ - const float c = 0.693147181; - return log2(v) * c; -} - -vec4 log(const vec4 v) -{ - const float c = 0.693147181; - return log2(v) * c; -} - - -//// exp2 - -float exp2(const float a) -{ - __asm float_exp2 __retVal, a; -} - -vec2 exp2(const vec2 a) -{ - __asm float_exp2 __retVal.x, a.x; - __asm float_exp2 __retVal.y, a.y; -} - -vec3 exp2(const vec3 a) -{ - __asm float_exp2 __retVal.x, a.x; - __asm float_exp2 __retVal.y, a.y; - __asm float_exp2 __retVal.z, a.z; -} - -vec4 exp2(const vec4 a) -{ - __asm float_exp2 __retVal.x, a.x; - __asm float_exp2 __retVal.y, a.y; - __asm float_exp2 __retVal.z, a.z; - __asm float_exp2 __retVal.w, a.w; -} - - -//// sqrt - -float sqrt(const float x) -{ - const float nx = -x; - float r; - __asm float_rsq r, x; - __asm float_rcp r, r; - __asm vec4_cmp __retVal, nx, r, 0.0; -} - -vec2 sqrt(const vec2 x) -{ - const vec2 nx = -x, zero = vec2(0.0); - vec2 r; - __asm float_rsq r.x, x.x; - __asm float_rsq r.y, x.y; - __asm float_rcp r.x, r.x; - __asm float_rcp r.y, r.y; - __asm vec4_cmp __retVal, nx, r, zero; -} - -vec3 sqrt(const vec3 x) -{ - const vec3 nx = -x, zero = vec3(0.0); - vec3 r; - __asm float_rsq r.x, x.x; - __asm float_rsq r.y, x.y; - __asm float_rsq r.z, x.z; - __asm float_rcp r.x, r.x; - __asm float_rcp r.y, r.y; - __asm float_rcp r.z, r.z; - __asm vec4_cmp __retVal, nx, r, zero; -} - -vec4 sqrt(const vec4 x) -{ - const vec4 nx = -x, zero = vec4(0.0); - vec4 r; - __asm float_rsq r.x, x.x; - __asm float_rsq r.y, x.y; - __asm float_rsq r.z, x.z; - __asm float_rsq r.w, x.w; - __asm float_rcp r.x, r.x; - __asm float_rcp r.y, r.y; - __asm float_rcp r.z, r.z; - __asm float_rcp r.w, r.w; - __asm vec4_cmp __retVal, nx, r, zero; -} - - -//// inversesqrt - -float inversesqrt(const float x) -{ - __asm float_rsq __retVal.x, x; -} - -vec2 inversesqrt(const vec2 v) -{ - __asm float_rsq __retVal.x, v.x; - __asm float_rsq __retVal.y, v.y; -} - -vec3 inversesqrt(const vec3 v) -{ - __asm float_rsq __retVal.x, v.x; - __asm float_rsq __retVal.y, v.y; - __asm float_rsq __retVal.z, v.z; -} - -vec4 inversesqrt(const vec4 v) -{ - __asm float_rsq __retVal.x, v.x; - __asm float_rsq __retVal.y, v.y; - __asm float_rsq __retVal.z, v.z; - __asm float_rsq __retVal.w, v.w; -} - - -//// normalize - -float normalize(const float x) -{ - __retVal = 1.0; -} - -vec2 normalize(const vec2 v) -{ - const float s = inversesqrt(dot(v, v)); - __asm vec4_multiply __retVal.xy, v, s; -} - -vec3 normalize(const vec3 v) -{ -// const float s = inversesqrt(dot(v, v)); -// __retVal = v * s; -// XXX note, we _could_ use __retVal.w instead of tmp and save a -// register, but that's actually a compilation error because v is a vec3 -// and the .w suffix is illegal. Oh well. - float tmp; - __asm vec3_dot tmp, v, v; - __asm float_rsq tmp, tmp; - __asm vec4_multiply __retVal.xyz, v, tmp; -} - -vec4 normalize(const vec4 v) -{ - float tmp; - __asm vec4_dot tmp, v, v; - __asm float_rsq tmp, tmp; - __asm vec4_multiply __retVal.xyz, v, tmp; -} - - - -// -// 8.3 Common Functions -// - - -//// abs - -float abs(const float a) -{ - __asm vec4_abs __retVal, a; -} - -vec2 abs(const vec2 a) -{ - __asm vec4_abs __retVal.xy, a; -} - -vec3 abs(const vec3 a) -{ - __asm vec4_abs __retVal.xyz, a; -} - -vec4 abs(const vec4 a) -{ - __asm vec4_abs __retVal, a; -} - - -//// sign - -float sign(const float x) -{ - float p, n; - __asm vec4_sgt p, x, 0.0; // p = (x > 0) - __asm vec4_sgt n, 0.0, x; // n = (x < 0) - __asm vec4_subtract __retVal, p, n; // sign = p - n -} - -vec2 sign(const vec2 v) -{ - vec2 p, n; - __asm vec4_sgt p.xy, v, 0.0; - __asm vec4_sgt n.xy, 0.0, v; - __asm vec4_subtract __retVal.xy, p, n; -} - -vec3 sign(const vec3 v) -{ - vec3 p, n; - __asm vec4_sgt p.xyz, v, 0.0; - __asm vec4_sgt n.xyz, 0.0, v; - __asm vec4_subtract __retVal.xyz, p, n; -} - -vec4 sign(const vec4 v) -{ - vec4 p, n; - __asm vec4_sgt p, v, 0.0; - __asm vec4_sgt n, 0.0, v; - __asm vec4_subtract __retVal, p, n; -} - - -//// floor - -float floor(const float a) -{ - __asm vec4_floor __retVal, a; -} - -vec2 floor(const vec2 a) -{ - __asm vec4_floor __retVal.xy, a; -} - -vec3 floor(const vec3 a) -{ - __asm vec4_floor __retVal.xyz, a; -} - -vec4 floor(const vec4 a) -{ - __asm vec4_floor __retVal, a; -} - - -//// ceil - -float ceil(const float a) -{ - // XXX this could be improved - float b = -a; - __asm vec4_floor b, b; - __retVal = -b; -} - -vec2 ceil(const vec2 a) -{ - vec2 b = -a; - __asm vec4_floor b, b; - __retVal.xy = -b; -} - -vec3 ceil(const vec3 a) -{ - vec3 b = -a; - __asm vec4_floor b, b; - __retVal.xyz = -b; -} - -vec4 ceil(const vec4 a) -{ - vec4 b = -a; - __asm vec4_floor b, b; - __retVal = -b; -} - - -//// fract - -float fract(const float a) -{ - __asm vec4_frac __retVal, a; -} - -vec2 fract(const vec2 a) -{ - __asm vec4_frac __retVal.xy, a; -} - -vec3 fract(const vec3 a) -{ - __asm vec4_frac __retVal.xyz, a; -} - -vec4 fract(const vec4 a) -{ - __asm vec4_frac __retVal, a; -} - - -//// mod (very untested!) - -float mod(const float a, const float b) -{ - float oneOverB; - __asm float_rcp oneOverB, b; - __retVal = a - b * floor(a * oneOverB); -} - -vec2 mod(const vec2 a, const float b) -{ - float oneOverB; - __asm float_rcp oneOverB, b; - __retVal.xy = a - b * floor(a * oneOverB); -} - -vec3 mod(const vec3 a, const float b) -{ - float oneOverB; - __asm float_rcp oneOverB, b; - __retVal.xyz = a - b * floor(a * oneOverB); -} - -vec4 mod(const vec4 a, const float b) -{ - float oneOverB; - __asm float_rcp oneOverB, b; - __retVal = a - b * floor(a * oneOverB); -} - -vec2 mod(const vec2 a, const vec2 b) -{ - vec2 oneOverB; - __asm float_rcp oneOverB.x, b.x; - __asm float_rcp oneOverB.y, b.y; - __retVal = a - b * floor(a * oneOverB); -} - -vec3 mod(const vec3 a, const vec3 b) -{ - vec3 oneOverB; - __asm float_rcp oneOverB.x, b.x; - __asm float_rcp oneOverB.y, b.y; - __asm float_rcp oneOverB.z, b.z; - __retVal = a - b * floor(a * oneOverB); -} - -vec4 mod(const vec4 a, const vec4 b) -{ - vec4 oneOverB; - __asm float_rcp oneOverB.x, b.x; - __asm float_rcp oneOverB.y, b.y; - __asm float_rcp oneOverB.z, b.z; - __asm float_rcp oneOverB.w, b.w; - __retVal = a - b * floor(a * oneOverB); -} - - -//// min - -float min(const float a, const float b) -{ - __asm vec4_min __retVal, a, b; -} - -vec2 min(const vec2 a, const vec2 b) -{ - __asm vec4_min __retVal.xy, a.xy, b.xy; -} - -vec3 min(const vec3 a, const vec3 b) -{ - __asm vec4_min __retVal.xyz, a.xyz, b.xyz; -} - -vec4 min(const vec4 a, const vec4 b) -{ - __asm vec4_min __retVal, a, b; -} - -vec2 min(const vec2 a, const float b) -{ - __asm vec4_min __retVal, a.xy, b; -} - -vec3 min(const vec3 a, const float b) -{ - __asm vec4_min __retVal, a.xyz, b; -} - -vec4 min(const vec4 a, const float b) -{ - __asm vec4_min __retVal, a, b; -} - - -//// max - -float max(const float a, const float b) -{ - __asm vec4_max __retVal, a, b; -} - -vec2 max(const vec2 a, const vec2 b) -{ - __asm vec4_max __retVal.xy, a.xy, b.xy; -} - -vec3 max(const vec3 a, const vec3 b) -{ - __asm vec4_max __retVal.xyz, a.xyz, b.xyz; -} - -vec4 max(const vec4 a, const vec4 b) -{ - __asm vec4_max __retVal, a, b; -} - -vec2 max(const vec2 a, const float b) -{ - __asm vec4_max __retVal, a.xy, b; -} - -vec3 max(const vec3 a, const float b) -{ - __asm vec4_max __retVal, a.xyz, b; -} - -vec4 max(const vec4 a, const float b) -{ - __asm vec4_max __retVal, a, b; -} - - -//// clamp - -float clamp(const float val, const float minVal, const float maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec2 clamp(const vec2 val, const float minVal, const float maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec3 clamp(const vec3 val, const float minVal, const float maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec4 clamp(const vec4 val, const float minVal, const float maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec2 clamp(const vec2 val, const vec2 minVal, const vec2 maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec3 clamp(const vec3 val, const vec3 minVal, const vec3 maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - -vec4 clamp(const vec4 val, const vec4 minVal, const vec4 maxVal) -{ - __asm vec4_clamp __retVal, val, minVal, maxVal; -} - - -//// mix - -float mix(const float x, const float y, const float a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec2 mix(const vec2 x, const vec2 y, const float a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec3 mix(const vec3 x, const vec3 y, const float a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec4 mix(const vec4 x, const vec4 y, const float a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec2 mix(const vec2 x, const vec2 y, const vec2 a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec3 mix(const vec3 x, const vec3 y, const vec3 a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - -vec4 mix(const vec4 x, const vec4 y, const vec4 a) -{ - __asm vec4_lrp __retVal, a, y, x; -} - - -//// step - -float step(const float edge, const float x) -{ - __asm vec4_sge __retVal, x, edge; -} - -vec2 step(const vec2 edge, const vec2 x) -{ - __asm vec4_sge __retVal.xy, x, edge; -} - -vec3 step(const vec3 edge, const vec3 x) -{ - __asm vec4_sge __retVal.xyz, x, edge; -} - -vec4 step(const vec4 edge, const vec4 x) -{ - __asm vec4_sge __retVal, x, edge; -} - -vec2 step(const float edge, const vec2 v) -{ - __asm vec4_sge __retVal.xy, v, edge; -} - -vec3 step(const float edge, const vec3 v) -{ - __asm vec4_sge __retVal.xyz, v, edge; -} - -vec4 step(const float edge, const vec4 v) -{ - __asm vec4_sge __retVal, v, edge; -} - - -//// smoothstep - -float smoothstep(const float edge0, const float edge1, const float x) -{ - float t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec2 smoothstep(const vec2 edge0, const vec2 edge1, const vec2 v) -{ - vec2 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec3 smoothstep(const vec3 edge0, const vec3 edge1, const vec3 v) -{ - vec3 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec4 smoothstep(const vec4 edge0, const vec4 edge1, const vec4 v) -{ - vec4 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec2 smoothstep(const float edge0, const float edge1, const vec2 v) -{ - vec2 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec3 smoothstep(const float edge0, const float edge1, const vec3 v) -{ - vec3 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - -vec4 smoothstep(const float edge0, const float edge1, const vec4 v) -{ - vec4 t = clamp((v - edge0) / (edge1 - edge0), 0.0, 1.0); - return t * t * (3.0 - 2.0 * t); -} - - - -// -// 8.4 Geometric Functions -// - - -//// length - -float length(const float x) -{ - return abs(x); -} - -float length(const vec2 v) -{ - float r; - const float p = dot(v, v); // p = v.x * v.x + v.y * v.y - __asm float_rsq r, p; // r = 1 / sqrt(p) - __asm float_rcp __retVal.x, r; // retVal = 1 / r -} - -float length(const vec3 v) -{ - float r; - const float p = dot(v, v); // p = v.x * v.x + v.y * v.y + v.z * v.z - __asm float_rsq r, p; // r = 1 / sqrt(p) - __asm float_rcp __retVal, r; // retVal = 1 / r -} - -float length(const vec4 v) -{ - float r; - const float p = dot(v, v); // p = v.x * v.x + v.y * v.y + ... - __asm float_rsq r, p; // r = 1 / sqrt(p) - __asm float_rcp __retVal, r; // retVal = 1 / r -} - - -//// distance - -float distance(const float x, const float y) -{ - const float d = x - y; - __retVal = length(d); -} - -float distance(const vec2 v, const vec2 u) -{ - const vec2 d2 = v - u; - __retVal = length(d2); -} - -float distance(const vec3 v, const vec3 u) -{ - const vec3 d3 = v - u; - __retVal = length(d3); -} - -float distance(const vec4 v, const vec4 u) -{ - const vec4 d4 = v - u; - __retVal = length(d4); -} - - -//// cross - -vec3 cross(const vec3 v, const vec3 u) -{ - __asm vec3_cross __retVal.xyz, v, u; -} - - -//// faceforward - -float faceforward(const float N, const float I, const float Nref) -{ - // this could probably be done better - const float d = dot(Nref, I); - float s; - __asm vec4_sgt s, 0.0, d; // s = (0.0 > d) ? 1 : 0 - return mix(-N, N, s); -} - -vec2 faceforward(const vec2 N, const vec2 I, const vec2 Nref) -{ - // this could probably be done better - const float d = dot(Nref, I); - float s; - __asm vec4_sgt s, 0.0, d; // s = (0.0 > d) ? 1 : 0 - return mix(-N, N, s); -} - -vec3 faceforward(const vec3 N, const vec3 I, const vec3 Nref) -{ - // this could probably be done better - const float d = dot(Nref, I); - float s; - __asm vec4_sgt s, 0.0, d; // s = (0.0 > d) ? 1 : 0 - return mix(-N, N, s); -} - -vec4 faceforward(const vec4 N, const vec4 I, const vec4 Nref) -{ - // this could probably be done better - const float d = dot(Nref, I); - float s; - __asm vec4_sgt s, 0.0, d; // s = (0.0 > d) ? 1 : 0 - return mix(-N, N, s); -} - - -//// reflect - -float reflect(const float I, const float N) -{ - return I - 2.0 * dot(N, I) * N; -} - -vec2 reflect(const vec2 I, const vec2 N) -{ - return I - 2.0 * dot(N, I) * N; -} - -vec3 reflect(const vec3 I, const vec3 N) -{ - return I - 2.0 * dot(N, I) * N; -} - -vec4 reflect(const vec4 I, const vec4 N) -{ - return I - 2.0 * dot(N, I) * N; -} - -//// refract - -float refract(const float I, const float N, const float eta) -{ - float n_dot_i = dot(N, I); - float k = 1.0 - eta * eta * (1.0 - n_dot_i * n_dot_i); - float retval; - if (k < 0.0) - retval = 0.0; - else - retval = eta * I - (eta * n_dot_i + sqrt(k)) * N; - return retval; -} - -vec2 refract(const vec2 I, const vec2 N, const float eta) -{ - float n_dot_i = dot(N, I); - float k = 1.0 - eta * eta * (1.0 - n_dot_i * n_dot_i); - vec2 retval; - if (k < 0.0) - retval = vec2(0.0); - else - retval = eta * I - (eta * n_dot_i + sqrt(k)) * N; - return retval; -} - -vec3 refract(const vec3 I, const vec3 N, const float eta) -{ - float n_dot_i = dot(N, I); - float k = 1.0 - eta * eta * (1.0 - n_dot_i * n_dot_i); - vec3 retval; - if (k < 0.0) - retval = vec3(0.0); - else - retval = eta * I - (eta * n_dot_i + sqrt(k)) * N; - return retval; -} - -vec4 refract(const vec4 I, const vec4 N, const float eta) -{ - float n_dot_i = dot(N, I); - float k = 1.0 - eta * eta * (1.0 - n_dot_i * n_dot_i); - vec4 retval; - if (k < 0.0) - retval = vec4(0.0); - else - retval = eta * I - (eta * n_dot_i + sqrt(k)) * N; - return retval; -} - - - - -// -// 8.5 Matrix Functions -// - -mat2 matrixCompMult (mat2 m, mat2 n) { - return mat2 (m[0] * n[0], m[1] * n[1]); -} - -mat3 matrixCompMult (mat3 m, mat3 n) { - return mat3 (m[0] * n[0], m[1] * n[1], m[2] * n[2]); -} - -mat4 matrixCompMult (mat4 m, mat4 n) { - return mat4 (m[0] * n[0], m[1] * n[1], m[2] * n[2], m[3] * n[3]); -} - - - - -// -// 8.6 Vector Relational Functions -// - -//// lessThan - -bvec2 lessThan(const vec2 u, const vec2 v) -{ - __asm vec4_slt __retVal.xy, u, v; -} - -bvec3 lessThan(const vec3 u, const vec3 v) -{ - __asm vec4_slt __retVal.xyz, u, v; -} - -bvec4 lessThan(const vec4 u, const vec4 v) -{ - __asm vec4_slt __retVal, u, v; -} - -bvec2 lessThan(const ivec2 u, const ivec2 v) -{ - __asm vec4_slt __retVal.xy, u, v; -} - -bvec3 lessThan(const ivec3 u, const ivec3 v) -{ - __asm vec4_slt __retVal.xyz, u, v; -} - -bvec4 lessThan(const ivec4 u, const ivec4 v) -{ - __asm vec4_slt __retVal, u, v; -} - - -//// lessThanEqual - -bvec2 lessThanEqual(const vec2 u, const vec2 v) -{ - __asm vec4_sle __retVal.xy, u, v; -} - -bvec3 lessThanEqual(const vec3 u, const vec3 v) -{ - __asm vec4_sle __retVal.xyz, u, v; -} - -bvec4 lessThanEqual(const vec4 u, const vec4 v) -{ - __asm vec4_sle __retVal, u, v; -} - -bvec2 lessThanEqual(const ivec2 u, const ivec2 v) -{ - __asm vec4_sle __retVal.xy, u, v; -} - -bvec3 lessThanEqual(const ivec3 u, const ivec3 v) -{ - __asm vec4_sle __retVal.xyz, u, v; -} - -bvec4 lessThanEqual(const ivec4 u, const ivec4 v) -{ - __asm vec4_sle __retVal, u, v; -} - - -//// greaterThan - -bvec2 greaterThan(const vec2 u, const vec2 v) -{ - __asm vec4_sgt __retVal.xy, u, v; -} - -bvec3 greaterThan(const vec3 u, const vec3 v) -{ - __asm vec4_sgt __retVal.xyz, u, v; -} - -bvec4 greaterThan(const vec4 u, const vec4 v) -{ - __asm vec4_sgt __retVal, u, v; -} - -bvec2 greaterThan(const ivec2 u, const ivec2 v) -{ - __asm vec4_sgt __retVal.xy, u.xy, v.xy; -} - -bvec3 greaterThan(const ivec3 u, const ivec3 v) -{ - __asm vec4_sgt __retVal.xyz, u, v; -} - -bvec4 greaterThan(const ivec4 u, const ivec4 v) -{ - __asm vec4_sgt __retVal, u, v; -} - - -//// greaterThanEqual - -bvec2 greaterThanEqual(const vec2 u, const vec2 v) -{ - __asm vec4_sge __retVal.xy, u, v; -} - -bvec3 greaterThanEqual(const vec3 u, const vec3 v) -{ - __asm vec4_sge __retVal.xyz, u, v; -} - -bvec4 greaterThanEqual(const vec4 u, const vec4 v) -{ - __asm vec4_sge __retVal, u, v; -} - -bvec2 greaterThanEqual(const ivec2 u, const ivec2 v) -{ - __asm vec4_sge __retVal.xy, u, v; -} - -bvec3 greaterThanEqual(const ivec3 u, const ivec3 v) -{ - __asm vec4_sge __retVal.xyz, u, v; -} - -bvec4 greaterThanEqual(const ivec4 u, const ivec4 v) -{ - __asm vec4_sge __retVal, u, v; -} - - -//// equal - -bvec2 equal(const vec2 u, const vec2 v) -{ - __asm vec4_seq __retVal.xy, u, v; -} - -bvec3 equal(const vec3 u, const vec3 v) -{ - __asm vec4_seq __retVal.xyz, u, v; -} - -bvec4 equal(const vec4 u, const vec4 v) -{ - __asm vec4_seq __retVal, u, v; -} - -bvec2 equal(const ivec2 u, const ivec2 v) -{ - __asm vec4_seq __retVal.xy, u, v; -} - -bvec3 equal(const ivec3 u, const ivec3 v) -{ - __asm vec4_seq __retVal.xyz, u, v; -} - -bvec4 equal(const ivec4 u, const ivec4 v) -{ - __asm vec4_seq __retVal, u, v; -} - -bvec2 equal(const bvec2 u, const bvec2 v) -{ - __asm vec4_seq __retVal.xy, u, v; -} - -bvec3 equal(const bvec3 u, const bvec3 v) -{ - __asm vec4_seq __retVal.xyz, u, v; -} - -bvec4 equal(const bvec4 u, const bvec4 v) -{ - __asm vec4_seq __retVal, u, v; -} - - - - -//// notEqual - -bvec2 notEqual(const vec2 u, const vec2 v) -{ - __asm vec4_sne __retVal.xy, u, v; -} - -bvec3 notEqual(const vec3 u, const vec3 v) -{ - __asm vec4_sne __retVal.xyz, u, v; -} - -bvec4 notEqual(const vec4 u, const vec4 v) -{ - __asm vec4_sne __retVal, u, v; -} - -bvec2 notEqual(const ivec2 u, const ivec2 v) -{ - __asm vec4_sne __retVal.xy, u, v; -} - -bvec3 notEqual(const ivec3 u, const ivec3 v) -{ - __asm vec4_sne __retVal.xyz, u, v; -} - -bvec4 notEqual(const ivec4 u, const ivec4 v) -{ - __asm vec4_sne __retVal, u, v; -} - -bvec2 notEqual(const bvec2 u, const bvec2 v) -{ - __asm vec4_sne __retVal.xy, u, v; -} - -bvec3 notEqual(const bvec3 u, const bvec3 v) -{ - __asm vec4_sne __retVal.xyz, u, v; -} - -bvec4 notEqual(const bvec4 u, const bvec4 v) -{ - __asm vec4_sne __retVal, u, v; -} - - - -//// any - -bool any(const bvec2 v) -{ - float sum; - __asm vec4_add sum.x, v.x, v.y; - __asm vec4_sne __retVal.x, sum.x, 0.0; -} - -bool any(const bvec3 v) -{ - float sum; - __asm vec4_add sum.x, v.x, v.y; - __asm vec4_add sum.x, sum.x, v.z; - __asm vec4_sne __retVal.x, sum.x, 0.0; -} - -bool any(const bvec4 v) -{ - float sum; - __asm vec4_add sum.x, v.x, v.y; - __asm vec4_add sum.x, sum.x, v.z; - __asm vec4_add sum.x, sum.x, v.w; - __asm vec4_sne __retVal.x, sum.x, 0.0; -} - - -//// all - -bool all (const bvec2 v) -{ - float prod; - __asm vec4_multiply prod, v.x, v.y; - __asm vec4_sne __retVal, prod, 0.0; -} - -bool all (const bvec3 v) -{ - float prod; - __asm vec4_multiply prod, v.x, v.y; - __asm vec4_multiply prod, prod, v.z; - __asm vec4_sne __retVal, prod, 0.0; -} - -bool all (const bvec4 v) -{ - float prod; - __asm vec4_multiply prod, v.x, v.y; - __asm vec4_multiply prod, prod, v.z; - __asm vec4_multiply prod, prod, v.w; - __asm vec4_sne __retVal, prod, 0.0; -} - - - -//// not - -bvec2 not (const bvec2 v) -{ - __asm vec4_seq __retVal.xy, v, 0.0; -} - -bvec3 not (const bvec3 v) -{ - __asm vec4_seq __retVal.xyz, v, 0.0; -} - -bvec4 not (const bvec4 v) -{ - __asm vec4_seq __retVal, v, 0.0; -} - - - -//// Texture Lookup Functions (for both fragment and vertex shaders) - -vec4 texture1D(const sampler1D sampler, const float coord) -{ - __asm vec4_tex_1d __retVal, sampler, coord; -} - -vec4 texture1DProj(const sampler1D sampler, const vec2 coord) -{ - // need to swizzle .y into .w - __asm vec4_tex_1d_proj __retVal, sampler, coord.xyyy; -} - -vec4 texture1DProj(const sampler1D sampler, const vec4 coord) -{ - __asm vec4_tex_1d_proj __retVal, sampler, coord; -} - - -vec4 texture2D(const sampler2D sampler, const vec2 coord) -{ - __asm vec4_tex_2d __retVal, sampler, coord; -} - -vec4 texture2DProj(const sampler2D sampler, const vec3 coord) -{ - // need to swizzle 'z' into 'w'. - __asm vec4_tex_2d_proj __retVal, sampler, coord.xyzz; -} - -vec4 texture2DProj(const sampler2D sampler, const vec4 coord) -{ - __asm vec4_tex_2d_proj __retVal, sampler, coord; -} - - -vec4 texture3D(const sampler3D sampler, const vec3 coord) -{ - __asm vec4_tex_3d __retVal, sampler, coord; -} - -vec4 texture3DProj(const sampler3D sampler, const vec4 coord) -{ - __asm vec4_tex_3d_proj __retVal, sampler, coord; -} - - -vec4 textureCube(const samplerCube sampler, const vec3 coord) -{ - __asm vec4_tex_cube __retVal, sampler, coord; -} - - - -vec4 shadow1D(const sampler1DShadow sampler, const vec3 coord) -{ - __asm vec4_tex_1d_shadow __retVal, sampler, coord; -} - -vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord) -{ - // .s and .p will be divided by .q - __asm vec4_tex_1d_proj_shadow __retVal, sampler, coord; -} - -vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord) -{ - __asm vec4_tex_2d_shadow __retVal, sampler, coord; -} - -vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord) -{ - // .s, .t and .p will be divided by .q - __asm vec4_tex_2d_proj_shadow __retVal, sampler, coord; -} - - -//// GL_ARB_texture_rectangle: -vec4 texture2DRect(const sampler2DRect sampler, const vec2 coord) -{ - __asm vec4_tex_rect __retVal, sampler, coord; -} - -vec4 texture2DRectProj(const sampler2DRect sampler, const vec3 coord) -{ - // need to swizzle .y into .w - __asm vec4_tex_rect_proj __retVal, sampler, coord.xyzz; -} - -vec4 texture2DRectProj(const sampler2DRect sampler, const vec4 coord) -{ - __asm vec4_tex_rect_proj __retVal, sampler, ccoord; -} - -vec4 shadow2DRect(const sampler2DRectShadow sampler, const vec3 coord) -{ - __asm vec4_tex_rect_shadow __retVal, sampler, coord; -} - -vec4 shadow2DRectProj(const sampler2DRectShadow sampler, const vec4 coord) -{ - __asm vec4_tex_rect_proj_shadow __retVal, sampler, coord; -} - - - -//// GL_EXT_texture_array -vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord) -{ - __asm vec4_tex_1d_array __retVal, sampler, coord; -} - -vec4 texture2DArray(const sampler2DArray sampler, const vec3 coord) -{ - __asm vec4_tex_2d_array __retVal, sampler, coord; -} - - -// -// 8.9 Noise Functions -// -// AUTHOR: Stefan Gustavson (stegu@itn.liu.se), Nov 26, 2005 -// - -float noise1(const float x) -{ - __asm float_noise1 __retVal, x; -} - - -float noise1(const vec2 x) -{ - __asm float_noise2 __retVal, x; -} - -float noise1(const vec3 x) -{ - __asm float_noise3 __retVal, x; -} - -float noise1(const vec4 x) -{ - __asm float_noise4 __retVal, x; -} - -vec2 noise2(const float x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + 19.34); -} - -vec2 noise2(const vec2 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec2(19.34, 7.66)); -} - -vec2 noise2(const vec3 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec3(19.34, 7.66, 3.23)); -} - -vec2 noise2(const vec4 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec4(19.34, 7.66, 3.23, 2.77)); -} - -vec3 noise3(const float x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + 19.34); - __retVal.z = noise1(x + 5.47); -} - -vec3 noise3(const vec2 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec2(19.34, 7.66)); - __retVal.z = noise1(x + vec2(5.47, 17.85)); -} - -vec3 noise3(const vec3 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec3(19.34, 7.66, 3.23)); - __retVal.z = noise1(x + vec3(5.47, 17.85, 11.04)); -} - -vec3 noise3(const vec4 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec4(19.34, 7.66, 3.23, 2.77)); - __retVal.z = noise1(x + vec4(5.47, 17.85, 11.04, 13.19)); -} - -vec4 noise4(const float x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + 19.34); - __retVal.z = noise1(x + 5.47); - __retVal.w = noise1(x + 23.54); -} - -vec4 noise4(const vec2 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec2 (19.34, 7.66)); - __retVal.z = noise1(x + vec2 (5.47, 17.85)); - __retVal.w = noise1(x + vec2 (23.54, 29.11)); -} - -vec4 noise4(const vec3 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec3(19.34, 7.66, 3.23)); - __retVal.z = noise1(x + vec3(5.47, 17.85, 11.04)); - __retVal.w = noise1(x + vec3(23.54, 29.11, 31.91)); -} - -vec4 noise4(const vec4 x) -{ - __retVal.x = noise1(x); - __retVal.y = noise1(x + vec4(19.34, 7.66, 3.23, 2.77)); - __retVal.z = noise1(x + vec4(5.47, 17.85, 11.04, 13.19)); - __retVal.w = noise1(x + vec4(23.54, 29.11, 31.91, 37.48)); -} diff --git a/mesalib/src/mesa/shader/slang/library/slang_core.gc b/mesalib/src/mesa/shader/slang/library/slang_core.gc deleted file mode 100644 index 0a0d15903..000000000 --- a/mesalib/src/mesa/shader/slang/library/slang_core.gc +++ /dev/null @@ -1,2619 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -// -// This file defines nearly all constructors and operators for built-in data -// types, using extended language syntax. In general, compiler treats -// constructors and operators as ordinary functions with some exceptions. -// For example, the language does not allow functions to be called in -// constant expressions - here the exception is made to allow it. -// -// Each implementation provides its own version of this file. Each -// implementation can define the required set of operators and constructors -// in its own fashion. -// -// The extended language syntax is only present when compiling this file. -// It is implicitly included at the very beginning of the compiled shader, -// so no built-in functions can be used. -// -// To communicate with the implementation, a special extended "__asm" keyword -// is used, followed by an instruction name (any valid identifier), a -// destination variable identifier and a list of zero or more source -// variable identifiers. -// -// A variable identifier is a variable name declared earlier in the code -// (as a function parameter, local or global variable). -// -// An instruction name designates an instruction that must be exported -// by the implementation. Each instruction receives data from source -// variable identifiers and returns data in the destination variable -// identifier. -// -// It is up to the implementation how to define a particular operator -// or constructor. If it is expected to being used rarely, it can be -// defined in terms of other operators and constructors, -// for example: -// -// ivec2 __operator + (const ivec2 x, const ivec2 y) { -// return ivec2 (x[0] + y[0], x[1] + y[1]); -// } -// -// If a particular operator or constructor is expected to be used very -// often or is an atomic operation (that is, an operation that cannot be -// expressed in terms of other operations or would create a dependency -// cycle) it must be defined using one or more __asm constructs. -// -// Each implementation must define constructors for all scalar types -// (bool, float, int). There are 9 scalar-to-scalar constructors -// (including identity constructors). However, since the language -// introduces special constructors (like matrix constructor with a single -// scalar value), implementations must also implement these cases. -// The compiler provides the following algorithm when resolving a constructor: -// - try to find a constructor with a prototype matching ours, -// - if no constructor is found and this is a scalar-to-scalar constructor, -// raise an error, -// - if a constructor is found, execute it and return, -// - count the size of the constructor parameter list - if it is less than -// the size of our constructor's type, raise an error, -// - for each parameter in the list do a recursive constructor matching for -// appropriate scalar fields in the constructed variable, -// -// Each implementation must also define a set of operators that deal with -// built-in data types. -// There are four kinds of operators: -// 1) Operators that are implemented only by the compiler: "()" (function -// call), "," (sequence) and "?:" (selection). -// 2) Operators that are implemented by the compiler by expressing it in -// terms of other operators: -// - "." (field selection) - translated to subscript access, -// - "&&" (logical and) - translated to "<left_expr> ? <right_expr> : -// false", -// - "||" (logical or) - translated to "<left_expr> ? true : <right_expr>", -// 3) Operators that can be defined by the implementation and if the required -// prototype is not found, standard behaviour is used: -// - "==", "!=", "=" (equality, assignment) - compare or assign -// matching fields one-by-one; -// note that at least operators for scalar data types must be defined -// by the implementation to get it work, -// 4) All other operators not mentioned above. If no required prototype is -// found, an error is raised. An implementation must follow the language -// specification to provide all valid operator prototypes. -// - - - -//// Basic, scalar constructors/casts - -int __constructor(const float f) -{ - __asm vec4_to_ivec4 __retVal, f; -} - -int __constructor(const bool b) -{ - __retVal = b; -} - -int __constructor(const int i) -{ - __retVal = i; -} - -bool __constructor(const int i) -{ - __asm vec4_sne __retVal, i, 0.0; -} - -bool __constructor(const float f) -{ - __asm vec4_sne __retVal, f, 0.0; -} - -bool __constructor(const bool b) -{ - __retVal = b; -} - -float __constructor(const int i) -{ - __asm ivec4_to_vec4 __retVal, i; -} - -float __constructor(const bool b) -{ - __asm ivec4_to_vec4 __retVal, b; -} - -float __constructor(const float f) -{ - __retVal = f; -} - - -//// vec2 constructors - -vec2 __constructor(const float x, const float y) -{ - __retVal.x = x; - __retVal.y = y; -} - -vec2 __constructor(const float f) -{ - __asm vec4_move __retVal.xy, f; -} - -vec2 __constructor(const int i) -{ - __asm ivec4_to_vec4 __retVal.xy, i; -} - -vec2 __constructor(const bool b) -{ - __asm ivec4_to_vec4 __retVal.xy, b; -} - -vec2 __constructor(const bvec2 b) -{ -// __retVal = b; - __asm ivec4_to_vec4 __retVal.xy, b; -} - -vec2 __constructor(const vec3 v) -{ - __asm vec4_move __retVal.xy, v.xy; -} - -vec2 __constructor(const vec4 v) -{ - __asm vec4_move __retVal.xy, v.xy; -} - - -//// vec3 constructors - -vec3 __constructor(const float x, const float y, const float z) -{ - __retVal.x = x; - __retVal.y = y; - __retVal.z = z; -} - -vec3 __constructor(const float f) -{ - // Note: this could be "__retVal.xyz = f" but that's an illegal assignment - __asm vec4_move __retVal.xyz, f; -} - -vec3 __constructor(const int i) -{ - __asm ivec4_to_vec4 __retVal.xyz, i; -} - -vec3 __constructor(const bool b) -{ - __asm ivec4_to_vec4 __retVal.xyz, b; -} - -vec3 __constructor(const bvec3 b) -{ - __asm ivec4_to_vec4 __retVal.xyz, b; -} - -vec3 __constructor(const vec4 v) -{ - __asm vec4_move __retVal.xyz, v; -} - - -//// vec4 constructors - -vec4 __constructor(const float x, const float y, const float z, const float w) -{ - __retVal.x = x; - __retVal.y = y; - __retVal.z = z; - __retVal.w = w; -} - -vec4 __constructor(const float f) -{ - // Note: this could be "__retVal = f" but that's an illegal assignment - __asm vec4_move __retVal, f; -} - -vec4 __constructor(const int i) -{ - __asm ivec4_to_vec4 __retVal, i; -} - -vec4 __constructor(const bool b) -{ - __asm ivec4_to_vec4 __retVal, b; -} - -vec4 __constructor(const bvec4 b) -{ - __asm ivec4_to_vec4 __retVal, b; -} - -vec4 __constructor(const ivec4 i) -{ - __asm ivec4_to_vec4 __retVal, i; -} - -vec4 __constructor(const vec3 v3, const float f) -{ - // XXX this constructor shouldn't be needed anymore - __retVal.xyz = v3; - __retVal.w = f; -} - -vec4 __constructor(const vec2 v2, const float f1, const float f2) -{ - // XXX this constructor shouldn't be needed anymore - __retVal.xy = v2; - __retVal.z = f1; - __retVal.w = f2; -} - - -//// ivec2 constructors - -ivec2 __constructor(const int i, const int j) -{ - __retVal.x = i; - __retVal.y = j; -} - -ivec2 __constructor(const int i) -{ - __asm vec4_move __retVal.xy, i; -} - -ivec2 __constructor(const float f) -{ - __asm vec4_to_ivec4 __retVal.xy, f; -} - -ivec2 __constructor(const bool b) -{ - __asm vec4_to_ivec4 __retVal.xy, b; -} - - -//// ivec3 constructors - -ivec3 __constructor(const int i, const int j, const int k) -{ - __retVal.x = i; - __retVal.y = j; - __retVal.z = k; -} - -ivec3 __constructor(const int i) -{ - __asm vec4_move __retVal.xyz, i; -} - -ivec3 __constructor(const float f) -{ - __asm vec4_to_ivec4 __retVal.xyz, f; -} - -ivec3 __constructor(const bool b) -{ - __asm vec4_move __retVal.xyz, b; -} - - -//// ivec4 constructors - -ivec4 __constructor(const int x, const int y, const int z, const int w) -{ - __retVal.x = x; - __retVal.y = y; - __retVal.z = z; - __retVal.w = w; -} - -ivec4 __constructor(const int i) -{ - __asm vec4_move __retVal, i; -} - -ivec4 __constructor(const float f) -{ - __asm vec4_to_ivec4 __retVal, f; -} - -ivec4 __constructor(const bool b) -{ - __asm vec4_to_ivec4 __retVal, b; -} - - -//// bvec2 constructors - -bvec2 __constructor(const bool b1, const bool b2) -{ - __retVal.x = b1; - __retVal.y = b2; -} - -bvec2 __constructor(const int i1, const int i2) -{ - __asm vec4_sne __retVal.x, i1, 0.0; - __asm vec4_sne __retVal.y, i2, 0.0; -} - - -bvec2 __constructor(const bool b) -{ - __asm vec4_move __retVal.xy, b; -} - -bvec2 __constructor(const float f) -{ - __asm vec4_sne __retVal.xy, f, 0.0; -} - -bvec2 __constructor(const int i) -{ - __asm vec4_sne __retVal.xy, i, 0.0; -} - -bvec2 __constructor(const vec2 v) -{ - __asm vec4_sne __retVal.xy, v, 0.0; -} - -bvec2 __constructor(const ivec2 v) -{ - __asm vec4_sne __retVal.xy, v, 0.0; -} - - - -//// bvec3 constructors - -bvec3 __constructor(const bool b1, const bool b2, const bool b3) -{ - __retVal.x = b1; - __retVal.y = b2; - __retVal.z = b3; -} - -bvec3 __constructor(const float f1, const float f2, const float f3) -{ - __asm vec4_sne __retVal.x, f1, 0.0; - __asm vec4_sne __retVal.y, f2, 0.0; - __asm vec4_sne __retVal.z, f3, 0.0; -} - -bvec3 __constructor(const bool b) -{ - __asm vec4_move __retVal.xyz, b; -} - -bvec3 __constructor(const float f) -{ - __asm vec4_sne __retVal.xyz, f, 0.0; -} - -bvec3 __constructor(const int i) -{ - __asm vec4_sne __retVal.xyz, i, 0.0; -} - -bvec3 __constructor(const vec3 v) -{ - __asm vec4_sne __retVal.xyz, v, 0.0; -} - -bvec3 __constructor(const ivec3 v) -{ - __asm vec4_sne __retVal.xyz, v, 0.0; -} - - - -//// bvec4 constructors - -bvec4 __constructor(const bool b1, const bool b2, const bool b3, const bool b4) -{ - __retVal.x = b1; - __retVal.y = b2; - __retVal.z = b3; - __retVal.w = b4; -} - -bvec4 __constructor(const float f1, const float f2, const float f3, const float f4) -{ - const float zero = 0.0; - __asm vec4_sne __retVal.x, f1, zero; - __asm vec4_sne __retVal.y, f2, zero; - __asm vec4_sne __retVal.z, f3, zero; - __asm vec4_sne __retVal.w, f4, zero; -} - -bvec4 __constructor(const bool b) -{ - __asm vec4_move __retVal.xyzw, b; -} - -bvec4 __constructor(const float f) -{ - __asm vec4_sne __retVal.xyzw, f, 0.0; -} - -bvec4 __constructor(const int i) -{ - __asm vec4_sne __retVal.xyzw, i, 0.0; -} - -bvec4 __constructor(const vec4 v) -{ - __asm vec4_sne __retVal.xyzw, v, 0.0; -} - -bvec4 __constructor(const ivec4 v) -{ - __asm vec4_sne __retVal.xyzw, v, 0.0; -} - - - -//// mat2 constructors - -mat2 __constructor(const float m00, const float m10, - const float m01, const float m11) -{ - __retVal[0].x = m00; - __retVal[0].y = m10; - __retVal[1].x = m01; - __retVal[1].y = m11; -} - -mat2 __constructor(const float f) -{ - __retVal[0].x = f; - __retVal[0].y = 0.0; - __retVal[1].x = 0.0; - __retVal[1].y = f; -} - -mat2 __constructor(const int i) -{ - return mat2(float(i)); -} - -mat2 __constructor(const bool b) -{ - return mat2(float(b)); -} - -mat2 __constructor(const vec2 c0, const vec2 c1) -{ - __retVal[0] = c0; - __retVal[1] = c1; -} - - -//// mat3 constructors - -mat3 __constructor(const float m00, const float m10, const float m20, - const float m01, const float m11, const float m21, - const float m02, const float m12, const float m22) -{ - __retVal[0].x = m00; - __retVal[0].y = m10; - __retVal[0].z = m20; - __retVal[1].x = m01; - __retVal[1].y = m11; - __retVal[1].z = m21; - __retVal[2].x = m02; - __retVal[2].y = m12; - __retVal[2].z = m22; -} - -mat3 __constructor(const float f) -{ - vec2 v = vec2(f, 0.0); - __retVal[0] = v.xyy; - __retVal[1] = v.yxy; - __retVal[2] = v.yyx; -} - -mat3 __constructor(const int i) -{ - return mat3(float(i)); -} - -mat3 __constructor(const bool b) -{ - return mat3(float(b)); -} - -mat3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; -} - - -//// mat4 constructors - -mat4 __constructor(const float m00, const float m10, const float m20, const float m30, - const float m01, const float m11, const float m21, const float m31, - const float m02, const float m12, const float m22, const float m32, - const float m03, const float m13, const float m23, const float m33) -{ - __retVal[0].x = m00; - __retVal[0].y = m10; - __retVal[0].z = m20; - __retVal[0].w = m30; - __retVal[1].x = m01; - __retVal[1].y = m11; - __retVal[1].z = m21; - __retVal[1].w = m31; - __retVal[2].x = m02; - __retVal[2].y = m12; - __retVal[2].z = m22; - __retVal[2].w = m32; - __retVal[3].x = m03; - __retVal[3].y = m13; - __retVal[3].z = m23; - __retVal[3].w = m33; -} - - -mat4 __constructor(const float f) -{ - vec2 v = vec2(f, 0.0); - __retVal[0] = v.xyyy; - __retVal[1] = v.yxyy; - __retVal[2] = v.yyxy; - __retVal[3] = v.yyyx; -} - -mat4 __constructor(const int i) -{ - return mat4(float(i)); -} - -mat4 __constructor(const bool b) -{ - return mat4(float(b)); -} - -mat4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2, const vec4 c3) -{ - __retVal[0] = c0; - __retVal[1] = c1; - __retVal[2] = c2; - __retVal[3] = c3; -} - - - -//// Basic int operators - -int __operator + (const int a, const int b) -{ - __asm vec4_add __retVal, a, b; -} - -int __operator - (const int a, const int b) -{ - __asm vec4_subtract __retVal, a, b; -} - -int __operator * (const int a, const int b) -{ - __asm vec4_multiply __retVal, a, b; -} - -int __operator / (const int a, const int b) -{ - float bInv, x; - __asm float_rcp bInv, b; - __asm vec4_multiply x, a, bInv; - __asm vec4_to_ivec4 __retVal, x; -} - - -//// Basic ivec2 operators - -ivec2 __operator + (const ivec2 a, const ivec2 b) -{ - __asm vec4_add __retVal, a, b; -} - -ivec2 __operator - (const ivec2 a, const ivec2 b) -{ - __asm vec4_subtract __retVal, a, b; -} - -ivec2 __operator * (const ivec2 a, const ivec2 b) -{ - __asm vec4_multiply __retVal, a, b; -} - -ivec2 __operator / (const ivec2 a, const ivec2 b) -{ - vec2 bInv, x; - __asm float_rcp bInv.x, b.x; - __asm float_rcp bInv.y, b.y; - __asm vec4_multiply x, a, bInv; - __asm vec4_to_ivec4 __retVal, x; -} - - -//// Basic ivec3 operators - -ivec3 __operator + (const ivec3 a, const ivec3 b) -{ - __asm vec4_add __retVal, a, b; -} - -ivec3 __operator - (const ivec3 a, const ivec3 b) -{ - __asm vec4_subtract __retVal, a, b; -} - -ivec3 __operator * (const ivec3 a, const ivec3 b) -{ - __asm vec4_multiply __retVal, a, b; -} - -ivec3 __operator / (const ivec3 a, const ivec3 b) -{ - vec3 bInv, x; - __asm float_rcp bInv.x, b.x; - __asm float_rcp bInv.y, b.y; - __asm float_rcp bInv.z, b.z; - __asm vec4_multiply x, a, bInv; - __asm vec4_to_ivec4 __retVal, x; -} - - -//// Basic ivec4 operators - -ivec4 __operator + (const ivec4 a, const ivec4 b) -{ - __asm vec4_add __retVal, a, b; -} - -ivec4 __operator - (const ivec4 a, const ivec4 b) -{ - __asm vec4_subtract __retVal, a, b; -} - -ivec4 __operator * (const ivec4 a, const ivec4 b) -{ - __asm vec4_multiply __retVal, a, b; -} - -ivec4 __operator / (const ivec4 a, const ivec4 b) -{ - vec4 bInv, x; - __asm float_rcp bInv.x, b.x; - __asm float_rcp bInv.y, b.y; - __asm float_rcp bInv.z, b.z; - __asm float_rcp bInv.w, b.w; - __asm vec4_multiply x, a, bInv; - __asm vec4_to_ivec4 __retVal, x; -} - - -//// Basic float operators - -float __operator + (const float a, const float b) -{ - __asm vec4_add __retVal, a, b; -} - -float __operator - (const float a, const float b) -{ - __asm vec4_subtract __retVal, a, b; -} - -float __operator * (const float a, const float b) -{ - __asm vec4_multiply __retVal, a, b; -} - -float __operator / (const float a, const float b) -{ - float bInv; - __asm float_rcp bInv.x, b; - __asm vec4_multiply __retVal, a, bInv; -} - - -//// Basic vec2 operators - -vec2 __operator + (const vec2 v, const vec2 u) -{ - __asm vec4_add __retVal.xy, v, u; -} - -vec2 __operator - (const vec2 v, const vec2 u) -{ - __asm vec4_subtract __retVal.xy, v, u; -} - -vec2 __operator * (const vec2 v, const vec2 u) -{ - __asm vec4_multiply __retVal.xy, v, u; -} - -vec2 __operator / (const vec2 v, const vec2 u) -{ - vec2 w; // = 1 / u - __asm float_rcp w.x, u.x; - __asm float_rcp w.y, u.y; - __asm vec4_multiply __retVal.xy, v, w; -} - - -//// Basic vec3 operators - -vec3 __operator + (const vec3 v, const vec3 u) -{ - __asm vec4_add __retVal.xyz, v, u; -} - -vec3 __operator - (const vec3 v, const vec3 u) -{ - __asm vec4_subtract __retVal.xyz, v, u; -} - -vec3 __operator * (const vec3 v, const vec3 u) -{ - __asm vec4_multiply __retVal.xyz, v, u; -} - -vec3 __operator / (const vec3 v, const vec3 u) -{ - vec3 w; // = 1 / u - __asm float_rcp w.x, u.x; - __asm float_rcp w.y, u.y; - __asm float_rcp w.z, u.z; - __asm vec4_multiply __retVal.xyz, v, w; -} - - -//// Basic vec4 operators - -vec4 __operator + (const vec4 v, const vec4 u) -{ - __asm vec4_add __retVal, v, u; -} - -vec4 __operator - (const vec4 v, const vec4 u) -{ - __asm vec4_subtract __retVal, v, u; -} - -vec4 __operator * (const vec4 v, const vec4 u) -{ - __asm vec4_multiply __retVal, v, u; -} - -vec4 __operator / (const vec4 v, const vec4 u) -{ - vec4 w; // = 1 / u - __asm float_rcp w.x, u.x; - __asm float_rcp w.y, u.y; - __asm float_rcp w.z, u.z; - __asm float_rcp w.w, u.w; - __asm vec4_multiply __retVal, v, w; -} - - - - -//// Basic vec2/float operators - -vec2 __operator + (const float a, const vec2 u) -{ - __asm vec4_add __retVal.xy, a, u.xy; -} - -vec2 __operator + (const vec2 v, const float b) -{ - __asm vec4_add __retVal.xy, v.xy, b; -} - -vec2 __operator - (const float a, const vec2 u) -{ - __asm vec4_subtract __retVal.xy, a, u.xy; -} - -vec2 __operator - (const vec2 v, const float b) -{ - __asm vec4_subtract __retVal.xy, v.xy, b; -} - -vec2 __operator * (const float a, const vec2 u) -{ - __asm vec4_multiply __retVal.xy, a, u.xy; -} - -vec2 __operator * (const vec2 v, const float b) -{ - __asm vec4_multiply __retVal.xy, v.xy, b; -} - -vec2 __operator / (const float a, const vec2 u) -{ - vec2 invU; - __asm float_rcp invU.x, u.x; - __asm float_rcp invU.y, u.y; - __asm vec4_multiply __retVal.xy, a, invU.xy; -} - -vec2 __operator / (const vec2 v, const float b) -{ - float invB; - __asm float_rcp invB, b; - __asm vec4_multiply __retVal.xy, v.xy, invB; -} - - -//// Basic vec3/float operators - -vec3 __operator + (const float a, const vec3 u) -{ - __asm vec4_add __retVal.xyz, a, u.xyz; -} - -vec3 __operator + (const vec3 v, const float b) -{ - __asm vec4_add __retVal.xyz, v.xyz, b; -} - -vec3 __operator - (const float a, const vec3 u) -{ - __asm vec4_subtract __retVal.xyz, a, u.xyz; -} - -vec3 __operator - (const vec3 v, const float b) -{ - __asm vec4_subtract __retVal.xyz, v.xyz, b; -} - -vec3 __operator * (const float a, const vec3 u) -{ - __asm vec4_multiply __retVal.xyz, a, u.xyz; -} - -vec3 __operator * (const vec3 v, const float b) -{ - __asm vec4_multiply __retVal.xyz, v.xyz, b; -} - -vec3 __operator / (const float a, const vec3 u) -{ - vec3 invU; - __asm float_rcp invU.x, u.x; - __asm float_rcp invU.y, u.y; - __asm float_rcp invU.z, u.z; - __asm vec4_multiply __retVal.xyz, a, invU.xyz; -} - -vec3 __operator / (const vec3 v, const float b) -{ - float invB; - __asm float_rcp invB, b; - __asm vec4_multiply __retVal.xyz, v.xyz, invB; -} - - -//// Basic vec4/float operators - -vec4 __operator + (const float a, const vec4 u) -{ - __asm vec4_add __retVal, a, u; -} - -vec4 __operator + (const vec4 v, const float b) -{ - __asm vec4_add __retVal, v, b; -} - -vec4 __operator - (const float a, const vec4 u) -{ - __asm vec4_subtract __retVal, a, u; -} - -vec4 __operator - (const vec4 v, const float b) -{ - __asm vec4_subtract __retVal, v, b; -} - -vec4 __operator * (const float a, const vec4 u) -{ - __asm vec4_multiply __retVal, a, u; -} - -vec4 __operator * (const vec4 v, const float b) -{ - __asm vec4_multiply __retVal, v, b; -} - -vec4 __operator / (const float a, const vec4 u) -{ - vec4 invU; - __asm float_rcp invU.x, u.x; - __asm float_rcp invU.y, u.y; - __asm float_rcp invU.z, u.z; - __asm float_rcp invU.w, u.w; - __asm vec4_multiply __retVal, a, invU; -} - -vec4 __operator / (const vec4 v, const float b) -{ - float invB; - __asm float_rcp invB, b; - __asm vec4_multiply __retVal, v, invB; -} - - - -//// Basic ivec2/int operators - -ivec2 __operator + (const int a, const ivec2 u) -{ - __retVal = ivec2(a) + u; -} - -ivec2 __operator + (const ivec2 v, const int b) -{ - __retVal = v + ivec2(b); -} - -ivec2 __operator - (const int a, const ivec2 u) -{ - __retVal = ivec2(a) - u; -} - -ivec2 __operator - (const ivec2 v, const int b) -{ - __retVal = v - ivec2(b); -} - -ivec2 __operator * (const int a, const ivec2 u) -{ - __retVal = ivec2(a) * u; -} - -ivec2 __operator * (const ivec2 v, const int b) -{ - __retVal = v * ivec2(b); -} - -ivec2 __operator / (const int a, const ivec2 u) -{ - __retVal = ivec2(a) / u; -} - -ivec2 __operator / (const ivec2 v, const int b) -{ - __retVal = v / ivec2(b); -} - - -//// Basic ivec3/int operators - -ivec3 __operator + (const int a, const ivec3 u) -{ - __retVal = ivec3(a) + u; -} - -ivec3 __operator + (const ivec3 v, const int b) -{ - __retVal = v + ivec3(b); -} - -ivec3 __operator - (const int a, const ivec3 u) -{ - __retVal = ivec3(a) - u; -} - -ivec3 __operator - (const ivec3 v, const int b) -{ - __retVal = v - ivec3(b); -} - -ivec3 __operator * (const int a, const ivec3 u) -{ - __retVal = ivec3(a) * u; -} - -ivec3 __operator * (const ivec3 v, const int b) -{ - __retVal = v * ivec3(b); -} - -ivec3 __operator / (const int a, const ivec3 u) -{ - __retVal = ivec3(a) / u; -} - -ivec3 __operator / (const ivec3 v, const int b) -{ - __retVal = v / ivec3(b); -} - - -//// Basic ivec4/int operators - -ivec4 __operator + (const int a, const ivec4 u) -{ - __retVal = ivec4(a) + u; -} - -ivec4 __operator + (const ivec4 v, const int b) -{ - __retVal = v + ivec4(b); -} - -ivec4 __operator - (const int a, const ivec4 u) -{ - __retVal = ivec4(a) - u; -} - -ivec4 __operator - (const ivec4 v, const int b) -{ - __retVal = v - ivec4(b); -} - -ivec4 __operator * (const int a, const ivec4 u) -{ - __retVal = ivec4(a) * u; -} - -ivec4 __operator * (const ivec4 v, const int b) -{ - __retVal = v * ivec4(b); -} - -ivec4 __operator / (const int a, const ivec4 u) -{ - __retVal = ivec4(a) / u; -} - -ivec4 __operator / (const ivec4 v, const int b) -{ - __retVal = v / ivec4(b); -} - - - - -//// Unary negation operator - -int __operator - (const int a) -{ - __asm vec4_negate __retVal.x, a; -} - -ivec2 __operator - (const ivec2 v) -{ - __asm vec4_negate __retVal, v; -} - -ivec3 __operator - (const ivec3 v) -{ - __asm vec4_negate __retVal, v; -} - -ivec4 __operator - (const ivec4 v) -{ - __asm vec4_negate __retVal, v; -} - -float __operator - (const float a) -{ - __asm vec4_negate __retVal.x, a; -} - -vec2 __operator - (const vec2 v) -{ - __asm vec4_negate __retVal.xy, v.xy; -} - -vec3 __operator - (const vec3 v) -{ - __asm vec4_negate __retVal.xyz, v.xyz; -} - -vec4 __operator - (const vec4 v) -{ - __asm vec4_negate __retVal, v; -} - -mat2 __operator - (const mat2 m) -{ - __retVal[0] = -m[0]; - __retVal[1] = -m[1]; -} - -mat3 __operator - (const mat3 m) -{ - __retVal[0] = -m[0]; - __retVal[1] = -m[1]; - __retVal[2] = -m[2]; -} - -mat4 __operator - (const mat4 m) -{ - __retVal[0] = -m[0]; - __retVal[1] = -m[1]; - __retVal[2] = -m[2]; - __retVal[3] = -m[3]; -} - - - -//// dot product - -float dot(const float a, const float b) -{ - __retVal = a * b; -} - -float dot(const vec2 a, const vec2 b) -{ - __retVal = a.x * b.x + a.y * b.y; -} - -float dot(const vec3 a, const vec3 b) -{ - __asm vec3_dot __retVal, a, b; -} - -float dot(const vec4 a, const vec4 b) -{ - __asm vec4_dot __retVal, a, b; -} - - - -//// int assignment operators - -int __operator += (inout int a, const int b) -{ - a = a + b; - return a; -} - -int __operator -= (inout int a, const int b) -{ - a = a - b; - return a; -} - -int __operator *= (inout int a, const int b) -{ - a = a * b; - return a; -} - -int __operator /= (inout int a, const int b) -{ - a = a / b; - return a; -} - - -//// ivec2 assignment operators - -ivec2 __operator += (inout ivec2 v, const ivec2 u) -{ - v = v + u; - return v; -} - -ivec2 __operator -= (inout ivec2 v, const ivec2 u) -{ - v = v - u; - return v; -} - -ivec2 __operator *= (inout ivec2 v, const ivec2 u) -{ - v = v * u; - return v; -} - -ivec2 __operator /= (inout ivec2 v, const ivec2 u) -{ - v = v / u; - return v; -} - - -//// ivec3 assignment operators - -ivec3 __operator += (inout ivec3 v, const ivec3 u) -{ - v = v + u; - return v; -} - -ivec3 __operator -= (inout ivec3 v, const ivec3 u) -{ - v = v - u; - return v; -} - -ivec3 __operator *= (inout ivec3 v, const ivec3 u) -{ - v = v * u; - return v; -} - -ivec3 __operator /= (inout ivec3 v, const ivec3 u) -{ - v = v / u; - return v; -} - - -//// ivec4 assignment operators - -ivec4 __operator += (inout ivec4 v, const ivec4 u) -{ - v = v + u; - return v; -} - -ivec4 __operator -= (inout ivec4 v, const ivec4 u) -{ - v = v - u; - return v; -} - -ivec4 __operator *= (inout ivec4 v, const ivec4 u) -{ - v = v * u; - return v; -} - -ivec4 __operator /= (inout ivec4 v, const ivec4 u) -{ - v = v / u; - return v; -} - - -//// float assignment operators - -float __operator += (inout float a, const float b) -{ - a = a + b; - return a; -} - -float __operator -= (inout float a, const float b) -{ - a = a - b; - return a; -} - -float __operator *= (inout float a, const float b) -{ - a = a * b; - return a; -} - -float __operator /= (inout float a, const float b) -{ - a = a / b; - return a; -} - - -//// vec2 assignment operators - -vec2 __operator += (inout vec2 v, const vec2 u) -{ - v = v + u; - return v; -} - -vec2 __operator -= (inout vec2 v, const vec2 u) -{ - v = v - u; - return v; -} - -vec2 __operator *= (inout vec2 v, const vec2 u) -{ - v = v * u; - return v; -} - -vec2 __operator /= (inout vec2 v, const vec2 u) -{ - v = v / u; - return v; -} - - -//// vec3 assignment operators - -vec3 __operator += (inout vec3 v, const vec3 u) -{ - v = v + u; - return v; -} - -vec3 __operator -= (inout vec3 v, const vec3 u) -{ - v = v - u; - return v; -} - -vec3 __operator *= (inout vec3 v, const vec3 u) -{ - v = v * u; - return v; -} - -vec3 __operator /= (inout vec3 v, const vec3 u) -{ - v = v / u; - return v; -} - - -//// vec4 assignment operators - -vec4 __operator += (inout vec4 v, const vec4 u) -{ - v = v + u; - return v; -} - -vec4 __operator -= (inout vec4 v, const vec4 u) -{ - v = v - u; - return v; -} - -vec4 __operator *= (inout vec4 v, const vec4 u) -{ - v = v * u; - return v; -} - -vec4 __operator /= (inout vec4 v, const vec4 u) -{ - v = v / u; - return v; -} - - - -//// ivec2/int assignment operators - -ivec2 __operator += (inout ivec2 v, const int a) -{ - v = v + ivec2(a); - return v; -} - -ivec2 __operator -= (inout ivec2 v, const int a) -{ - v = v - ivec2(a); - return v; -} - -ivec2 __operator *= (inout ivec2 v, const int a) -{ - v = v * ivec2(a); - return v; -} - -ivec2 __operator /= (inout ivec2 v, const int a) -{ - v = v / ivec2(a); - return v; -} - - -//// ivec3/int assignment operators - -ivec3 __operator += (inout ivec3 v, const int a) -{ - v = v + ivec3(a); - return v; -} - -ivec3 __operator -= (inout ivec3 v, const int a) -{ - v = v - ivec3(a); - return v; -} - -ivec3 __operator *= (inout ivec3 v, const int a) -{ - v = v * ivec3(a); - return v; -} - -ivec4 __operator /= (inout ivec3 v, const int a) -{ - v = v / ivec3(a); - return v; -} - - -//// ivec4/int assignment operators - -ivec4 __operator += (inout ivec4 v, const int a) -{ - v = v + ivec4(a); - return v; -} - -ivec4 __operator -= (inout ivec4 v, const int a) -{ - v = v - ivec4(a); - return v; -} - -ivec4 __operator *= (inout ivec4 v, const int a) -{ - v = v * ivec4(a); - return v; -} - -ivec4 __operator /= (inout ivec4 v, const int a) -{ - v = v / ivec4(a); - return v; -} - - - -//// vec2/float assignment operators - -vec2 __operator += (inout vec2 v, const float a) -{ - v = v + vec2(a); - return v; -} - -vec2 __operator -= (inout vec2 v, const float a) -{ - v = v - vec2(a); - return v; -} - -vec2 __operator *= (inout vec2 v, const float a) -{ - v = v * vec2(a); - return v; -} - -vec2 __operator /= (inout vec2 v, const float a) -{ - v = v / vec2(a); - return v; -} - - -//// vec3/float assignment operators - -vec3 __operator += (inout vec3 v, const float a) -{ - v = v + vec3(a); - return v; -} - -vec3 __operator -= (inout vec3 v, const float a) -{ - v = v - vec3(a); - return v; -} - -vec3 __operator *= (inout vec3 v, const float a) -{ - v = v * vec3(a); - return v; -} - -vec3 __operator /= (inout vec3 v, const float a) -{ - v = v / vec3(a); - return v; -} - - -//// vec4/float assignment operators - -vec4 __operator += (inout vec4 v, const float a) -{ - v = v + vec4(a); - return v; -} - -vec4 __operator -= (inout vec4 v, const float a) -{ - v = v - vec4(a); - return v; -} - -vec4 __operator *= (inout vec4 v, const float a) -{ - v = v * vec4(a); - return v; -} - -vec4 __operator /= (inout vec4 v, const float a) -{ - v = v / vec4(a); - return v; -} - - - - - -//// Basic mat2 operations - -mat2 __operator + (const mat2 m, const mat2 n) -{ - __retVal[0] = m[0] + n[0]; - __retVal[1] = m[1] + n[1]; -} - -mat2 __operator - (const mat2 m, const mat2 n) -{ - __retVal[0] = m[0] - n[0]; - __retVal[1] = m[1] - n[1]; -} - -mat2 __operator * (const mat2 m, const mat2 n) -{ - __retVal[0] = m[0] * n[0].xx + m[1] * n[0].yy; - __retVal[1] = m[0] * n[1].xx + m[1] * n[1].yy; -} - -mat2 __operator / (const mat2 m, const mat2 n) -{ - __retVal[0] = m[0] / n[0]; - __retVal[1] = m[1] / n[1]; -} - - -//// Basic mat3 operations - -mat3 __operator + (const mat3 m, const mat3 n) -{ - __retVal[0] = m[0] + n[0]; - __retVal[1] = m[1] + n[1]; - __retVal[2] = m[2] + n[2]; -} - -mat3 __operator - (const mat3 m, const mat3 n) -{ - __retVal[0] = m[0] - n[0]; - __retVal[1] = m[1] - n[1]; - __retVal[2] = m[2] - n[2]; -} - -mat3 __operator * (const mat3 m, const mat3 n) -{ - __retVal[0] = m[0] * n[0].xxx + m[1] * n[0].yyy + m[2] * n[0].zzz; - __retVal[1] = m[0] * n[1].xxx + m[1] * n[1].yyy + m[2] * n[1].zzz; - __retVal[2] = m[0] * n[2].xxx + m[1] * n[2].yyy + m[2] * n[2].zzz; -} - -mat3 __operator / (const mat3 m, const mat3 n) -{ - __retVal[0] = m[0] / n[0]; - __retVal[1] = m[1] / n[1]; - __retVal[2] = m[2] / n[2]; -} - - -//// Basic mat4 operations - -mat4 __operator + (const mat4 m, const mat4 n) -{ - __retVal[0] = m[0] + n[0]; - __retVal[1] = m[1] + n[1]; - __retVal[2] = m[2] + n[2]; - __retVal[3] = m[3] + n[3]; -} - -mat4 __operator - (const mat4 m, const mat4 n) -{ - __retVal[0] = m[0] - n[0]; - __retVal[1] = m[1] - n[1]; - __retVal[2] = m[2] - n[2]; - __retVal[3] = m[3] - n[3]; -} - -mat4 __operator * (const mat4 m, const mat4 n) -{ - __retVal[0] = m[0] * n[0].xxxx + m[1] * n[0].yyyy + m[2] * n[0].zzzz + m[3] * n[0].wwww; - __retVal[1] = m[0] * n[1].xxxx + m[1] * n[1].yyyy + m[2] * n[1].zzzz + m[3] * n[1].wwww; - __retVal[2] = m[0] * n[2].xxxx + m[1] * n[2].yyyy + m[2] * n[2].zzzz + m[3] * n[2].wwww; - __retVal[3] = m[0] * n[3].xxxx + m[1] * n[3].yyyy + m[2] * n[3].zzzz + m[3] * n[3].wwww; -} - -mat4 __operator / (const mat4 m, const mat4 n) -{ - __retVal[0] = m[0] / n[0]; - __retVal[1] = m[1] / n[1]; - __retVal[2] = m[2] / n[2]; - __retVal[3] = m[3] / n[3]; -} - - -//// mat2/float operations - -mat2 __operator + (const float a, const mat2 n) -{ - __retVal[0] = a + n[0]; - __retVal[1] = a + n[1]; -} - -mat2 __operator + (const mat2 m, const float b) -{ - __retVal[0] = m[0] + b; - __retVal[1] = m[1] + b; -} - -mat2 __operator - (const float a, const mat2 n) -{ - __retVal[0] = a - n[0]; - __retVal[1] = a - n[1]; -} - -mat2 __operator - (const mat2 m, const float b) -{ - __retVal[0] = m[0] - b; - __retVal[1] = m[1] - b; -} - -mat2 __operator * (const float a, const mat2 n) -{ - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; -} - -mat2 __operator * (const mat2 m, const float b) -{ - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; -} - -mat2 __operator / (const float a, const mat2 n) -{ - __retVal[0] = a / n[0]; - __retVal[1] = a / n[1]; -} - -mat2 __operator / (const mat2 m, const float b) -{ - __retVal[0] = m[0] / b; - __retVal[1] = m[1] / b; -} - - -//// mat3/float operations - -mat3 __operator + (const float a, const mat3 n) -{ - __retVal[0] = a + n[0]; - __retVal[1] = a + n[1]; - __retVal[2] = a + n[2]; -} - -mat3 __operator + (const mat3 m, const float b) -{ - __retVal[0] = m[0] + b; - __retVal[1] = m[1] + b; - __retVal[2] = m[2] + b; -} - -mat3 __operator - (const float a, const mat3 n) -{ - __retVal[0] = a - n[0]; - __retVal[1] = a - n[1]; - __retVal[2] = a - n[2]; -} - -mat3 __operator - (const mat3 m, const float b) -{ - __retVal[0] = m[0] - b; - __retVal[1] = m[1] - b; - __retVal[2] = m[2] - b; -} - -mat3 __operator * (const float a, const mat3 n) -{ - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; -} - -mat3 __operator * (const mat3 m, const float b) -{ - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; -} - -mat3 __operator / (const float a, const mat3 n) -{ - __retVal[0] = a / n[0]; - __retVal[1] = a / n[1]; - __retVal[2] = a / n[2]; -} - -mat3 __operator / (const mat3 m, const float b) -{ - __retVal[0] = m[0] / b; - __retVal[1] = m[1] / b; - __retVal[2] = m[2] / b; -} - - -//// mat4/float operations - -mat4 __operator + (const float a, const mat4 n) -{ - __retVal[0] = a + n[0]; - __retVal[1] = a + n[1]; - __retVal[2] = a + n[2]; - __retVal[3] = a + n[3]; -} - -mat4 __operator + (const mat4 m, const float b) -{ - __retVal[0] = m[0] + b; - __retVal[1] = m[1] + b; - __retVal[2] = m[2] + b; - __retVal[3] = m[3] + b; -} - -mat4 __operator - (const float a, const mat4 n) -{ - __retVal[0] = a - n[0]; - __retVal[1] = a - n[1]; - __retVal[2] = a - n[2]; - __retVal[3] = a - n[3]; -} - -mat4 __operator - (const mat4 m, const float b) -{ - __retVal[0] = m[0] - b; - __retVal[1] = m[1] - b; - __retVal[2] = m[2] - b; - __retVal[3] = m[3] - b; -} - -mat4 __operator * (const float a, const mat4 n) -{ - __retVal[0] = a * n[0]; - __retVal[1] = a * n[1]; - __retVal[2] = a * n[2]; - __retVal[3] = a * n[3]; -} - -mat4 __operator * (const mat4 m, const float b) -{ - __retVal[0] = m[0] * b; - __retVal[1] = m[1] * b; - __retVal[2] = m[2] * b; - __retVal[3] = m[3] * b; -} - -mat4 __operator / (const float a, const mat4 n) -{ - __retVal[0] = a / n[0]; - __retVal[1] = a / n[1]; - __retVal[2] = a / n[2]; - __retVal[3] = a / n[3]; -} - -mat4 __operator / (const mat4 m, const float b) -{ - __retVal[0] = m[0] / b; - __retVal[1] = m[1] / b; - __retVal[2] = m[2] / b; - __retVal[3] = m[3] / b; -} - - - -//// matrix / vector products - -vec2 __operator * (const mat2 m, const vec2 v) -{ - __retVal = m[0] * v.xx - + m[1] * v.yy; -} - -vec2 __operator * (const vec2 v, const mat2 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); -} - -vec3 __operator * (const mat3 m, const vec3 v) -{ - __retVal = m[0] * v.xxx - + m[1] * v.yyy - + m[2] * v.zzz; -} - -vec3 __operator * (const vec3 v, const mat3 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); -} - -vec4 __operator * (const mat4 m, const vec4 v) -{ - __retVal = m[0] * v.xxxx - + m[1] * v.yyyy - + m[2] * v.zzzz - + m[3] * v.wwww; -} - -vec4 __operator * (const vec4 v, const mat4 m) -{ - __retVal.x = dot(v, m[0]); - __retVal.y = dot(v, m[1]); - __retVal.z = dot(v, m[2]); - __retVal.w = dot(v, m[3]); -} - - - -//// mat2 assignment operators - -mat2 __operator += (inout mat2 m, const mat2 n) -{ - m[0] = m[0] + n[0]; - m[1] = m[1] + n[1]; - return m; -} - -mat2 __operator -= (inout mat2 m, const mat2 n) -{ - m[0] = m[0] - n[0]; - m[1] = m[1] - n[1]; - return m; -} - -mat2 __operator *= (inout mat2 m, const mat2 n) -{ - m = m * n; - return m; -} - -mat2 __operator /= (inout mat2 m, const mat2 n) -{ - m[0] = m[0] / n[0]; - m[1] = m[1] / n[1]; - return m; -} - - -//// mat3 assignment operators - -mat3 __operator += (inout mat3 m, const mat3 n) -{ - m[0] = m[0] + n[0]; - m[1] = m[1] + n[1]; - m[2] = m[2] + n[2]; - return m; -} - -mat3 __operator -= (inout mat3 m, const mat3 n) -{ - m[0] = m[0] - n[0]; - m[1] = m[1] - n[1]; - m[2] = m[2] - n[2]; - return m; -} - -mat3 __operator *= (inout mat3 m, const mat3 n) -{ - m = m * n; - return m; -} - -mat3 __operator /= (inout mat3 m, const mat3 n) -{ - m[0] = m[0] / n[0]; - m[1] = m[1] / n[1]; - m[2] = m[2] / n[2]; - return m; -} - - -// mat4 assignment operators - -mat4 __operator += (inout mat4 m, const mat4 n) -{ - m[0] = m[0] + n[0]; - m[1] = m[1] + n[1]; - m[2] = m[2] + n[2]; - m[3] = m[3] + n[3]; - return m; -} - -mat4 __operator -= (inout mat4 m, const mat4 n) -{ - m[0] = m[0] - n[0]; - m[1] = m[1] - n[1]; - m[2] = m[2] - n[2]; - m[3] = m[3] - n[3]; - return m; -} - -mat4 __operator *= (inout mat4 m, const mat4 n) -{ - m = m * n; - return m; -} - -mat4 __operator /= (inout mat4 m, const mat4 n) -{ - m[0] = m[0] / n[0]; - m[1] = m[1] / n[1]; - m[2] = m[2] / n[2]; - m[3] = m[3] / n[3]; - return m; -} - - -//// mat2/float assignment operators - -mat2 __operator += (inout mat2 m, const float a) -{ - vec2 v = vec2(a); - m[0] = m[0] + v; - m[1] = m[1] + v; - return m; -} - -mat2 __operator -= (inout mat2 m, const float a) -{ - vec2 v = vec2(a); - m[0] = m[0] - v; - m[1] = m[1] - v; - return m; -} - -mat2 __operator *= (inout mat2 m, const float a) -{ - vec2 v = vec2(a); - m[0] = m[0] * v; - m[1] = m[1] * v; - return m; -} - -mat2 __operator /= (inout mat2 m, const float a) -{ - vec2 v = vec2(1.0 / a); - m[0] = m[0] * v; - m[1] = m[1] * v; - return m; -} - - -//// mat3/float assignment operators - -mat3 __operator += (inout mat3 m, const float a) -{ - vec3 v = vec3(a); - m[0] = m[0] + v; - m[1] = m[1] + v; - m[2] = m[2] + v; - return m; -} - -mat3 __operator -= (inout mat3 m, const float a) -{ - vec3 v = vec3(a); - m[0] = m[0] - v; - m[1] = m[1] - v; - m[2] = m[2] - v; - return m; -} - -mat3 __operator *= (inout mat3 m, const float a) -{ - vec3 v = vec3(a); - m[0] = m[0] * v; - m[1] = m[1] * v; - m[2] = m[2] * v; - return m; -} - -mat3 __operator /= (inout mat3 m, const float a) -{ - vec3 v = vec3(1.0 / a); - m[0] = m[0] * v; - m[1] = m[1] * v; - m[2] = m[2] * v; - return m; -} - - -//// mat4/float assignment operators - -mat4 __operator += (inout mat4 m, const float a) -{ - vec4 v = vec4(a); - m[0] = m[0] + v; - m[1] = m[1] + v; - m[2] = m[2] + v; - m[3] = m[3] + v; - return m; -} - -mat4 __operator -= (inout mat4 m, const float a) -{ - vec4 v = vec4(a); - m[0] = m[0] - v; - m[1] = m[1] - v; - m[2] = m[2] - v; - m[3] = m[3] - v; - return m; -} - -mat4 __operator *= (inout mat4 m, const float a) -{ - vec4 v = vec4(a); - m[0] = m[0] * v; - m[1] = m[1] * v; - m[2] = m[2] * v; - m[3] = m[3] * v; - return m; -} - -mat4 __operator /= (inout mat4 m, const float a) -{ - vec4 v = vec4(1.0 / a); - m[0] = m[0] * v; - m[1] = m[1] * v; - m[2] = m[2] * v; - m[3] = m[3] * v; - return m; -} - - - -//// vec/mat assignment operators - -vec2 __operator *= (inout vec2 v, const mat2 m) -{ - v = v * m; - return v; -} - -vec3 __operator *= (inout vec3 v, const mat3 m) -{ - v = v * m; - return v; -} - -vec4 __operator *= (inout vec4 v, const mat4 m) -{ - v = v * m; - return v; -} - - - -//// pre-decrement operators - -int __operator --(inout int a) -{ - a = a - 1; - __retVal = a; -} - -ivec2 __operator --(inout ivec2 v) -{ - v = v - ivec2(1); - __retVal = v; -} - -ivec3 __operator --(inout ivec3 v) -{ - v = v - ivec3(1); - __retVal = v; -} - -ivec4 __operator --(inout ivec4 v) -{ - v = v - ivec4(1); - __retVal = v; -} - - -float __operator --(inout float a) -{ - a = a - 1.0; - __retVal = a; -} - -vec2 __operator --(inout vec2 v) -{ - v = v - vec2(1.0); - __retVal = v; -} - -vec3 __operator --(inout vec3 v) -{ - v = v - vec3(1.0); - __retVal = v; -} - -vec4 __operator --(inout vec4 v) -{ - v = v - vec4(1.0); - __retVal = v; -} - - -mat2 __operator --(inout mat2 m) -{ - m[0] = m[0] - vec2(1.0); - m[1] = m[1] - vec2(1.0); - __retVal = m; -} - -mat3 __operator --(inout mat3 m) -{ - m[0] = m[0] - vec3(1.0); - m[1] = m[1] - vec3(1.0); - m[2] = m[2] - vec3(1.0); - __retVal = m; -} - -mat4 __operator --(inout mat4 m) -{ - m[0] = m[0] - vec4(1.0); - m[1] = m[1] - vec4(1.0); - m[2] = m[2] - vec4(1.0); - m[3] = m[3] - vec4(1.0); - __retVal = m; -} - - -//// pre-increment operators - -int __operator ++(inout int a) -{ - a = a + 1; - __retVal = a; -} - -ivec2 __operator ++(inout ivec2 v) -{ - v = v + ivec2(1); - __retVal = v; -} - -ivec3 __operator ++(inout ivec3 v) -{ - v = v + ivec3(1); - __retVal = v; -} - -ivec4 __operator ++(inout ivec4 v) -{ - v = v + ivec4(1); - __retVal = v; -} - - -float __operator ++(inout float a) -{ - a = a + 1.0; - __retVal = a; -} - -vec2 __operator ++(inout vec2 v) -{ - v = v + vec2(1.0); - __retVal = v; -} - -vec3 __operator ++(inout vec3 v) -{ - v = v + vec3(1.0); - __retVal = v; -} - -vec4 __operator ++(inout vec4 v) -{ - v = v + vec4(1.0); - __retVal = v; -} - - -mat2 __operator ++(inout mat2 m) -{ - m[0] = m[0] + vec2(1.0); - m[1] = m[1] + vec2(1.0); - __retVal = m; -} - -mat3 __operator ++(inout mat3 m) -{ - m[0] = m[0] + vec3(1.0); - m[1] = m[1] + vec3(1.0); - m[2] = m[2] + vec3(1.0); - __retVal = m; -} - -mat4 __operator ++(inout mat4 m) -{ - m[0] = m[0] + vec4(1.0); - m[1] = m[1] + vec4(1.0); - m[2] = m[2] + vec4(1.0); - m[3] = m[3] + vec4(1.0); - __retVal = m; -} - - - -//// post-decrement - -int __postDecr(inout int a) -{ - __retVal = a; - a = a - 1; -} - -ivec2 __postDecr(inout ivec2 v) -{ - __retVal = v; - v = v - ivec2(1); -} - -ivec3 __postDecr(inout ivec3 v) -{ - __retVal = v; - v = v - ivec3(1); -} - -ivec4 __postDecr(inout ivec4 v) -{ - __retVal = v; - v = v - ivec4(1); -} - - -float __postDecr(inout float a) -{ - __retVal = a; - a = a - 1.0; -} - -vec2 __postDecr(inout vec2 v) -{ - __retVal = v; - v = v - vec2(1.0); -} - -vec3 __postDecr(inout vec3 v) -{ - __retVal = v; - v = v - vec3(1.0); -} - -vec4 __postDecr(inout vec4 v) -{ - __retVal = v; - v = v - vec4(1.0); -} - - -mat2 __postDecr(inout mat2 m) -{ - __retVal = m; - m[0] = m[0] - vec2(1.0); - m[1] = m[1] - vec2(1.0); -} - -mat3 __postDecr(inout mat3 m) -{ - __retVal = m; - m[0] = m[0] - vec3(1.0); - m[1] = m[1] - vec3(1.0); - m[2] = m[2] - vec3(1.0); -} - -mat4 __postDecr(inout mat4 m) -{ - __retVal = m; - m[0] = m[0] - vec4(1.0); - m[1] = m[1] - vec4(1.0); - m[2] = m[2] - vec4(1.0); - m[3] = m[3] - vec4(1.0); -} - - -//// post-increment - -float __postIncr(inout float a) -{ - __retVal = a; - a = a + 1; -} - -vec2 __postIncr(inout vec2 v) -{ - __retVal = v; - v = v + vec2(1.0); -} - -vec3 __postIncr(inout vec3 v) -{ - __retVal = v; - v = v + vec3(1.0); -} - -vec4 __postIncr(inout vec4 v) -{ - __retVal = v; - v = v + vec4(1.0); -} - - -int __postIncr(inout int a) -{ - __retVal = a; - a = a + 1; -} - -ivec2 __postIncr(inout ivec2 v) -{ - __retVal = v; - v = v + ivec2(1); -} - -ivec3 __postIncr(inout ivec3 v) -{ - __retVal = v; - v = v + ivec3(1); -} - -ivec4 __postIncr(inout ivec4 v) -{ - __retVal = v; - v = v + ivec3(1); -} - - -mat2 __postIncr(inout mat2 m) -{ - mat2 n = m; - m[0] = m[0] + vec2(1.0); - m[1] = m[1] + vec2(1.0); - return n; -} - -mat3 __postIncr(inout mat3 m) -{ - mat3 n = m; - m[0] = m[0] + vec3(1.0); - m[1] = m[1] + vec3(1.0); - m[2] = m[2] + vec3(1.0); - return n; -} - -mat4 __postIncr(inout mat4 m) -{ - mat4 n = m; - m[0] = m[0] + vec4(1.0); - m[1] = m[1] + vec4(1.0); - m[2] = m[2] + vec4(1.0); - m[3] = m[3] + vec4(1.0); - return n; -} - - - -//// inequality operators - - -// XXX are the inequality operators for floats/ints really needed???? -bool __operator < (const float a, const float b) -{ - __asm vec4_sgt __retVal.x, b, a; -} - - -bool __operator < (const int a, const int b) { - return float (a) < float (b); -} - -bool __operator > (const float a, const float b) { - bool c; - __asm float_less c, b, a; - return c; -} - -bool __operator > (const int a, const int b) { - return float (a) > float (b); -} - -bool __operator >= (const float a, const float b) { - bool g, e; - __asm float_less g, b, a; - __asm float_equal e, a, b; - return g || e; -} - -bool __operator >= (const int a, const int b) { - return float (a) >= float (b); -} - -bool __operator <= (const float a, const float b) { - bool g, e; - __asm float_less g, a, b; - __asm float_equal e, a, b; - return g || e; -} - -bool __operator <= (const int a, const int b) { - return float (a) <= float (b); -} - - - -// -// MESA-specific extension functions. -// - -void printMESA (const float f) { - __asm float_print f; -} - -void printMESA (const int i) { - __asm int_print i; -} - -void printMESA (const bool b) { - __asm bool_print b; -} - -void printMESA (const vec2 v) { - printMESA (v.x); - printMESA (v.y); -} - -void printMESA (const vec3 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); -} - -void printMESA (const vec4 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); - printMESA (v.w); -} - -void printMESA (const ivec2 v) { - printMESA (v.x); - printMESA (v.y); -} - -void printMESA (const ivec3 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); -} - -void printMESA (const ivec4 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); - printMESA (v.w); -} - -void printMESA (const bvec2 v) { - printMESA (v.x); - printMESA (v.y); -} - -void printMESA (const bvec3 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); -} - -void printMESA (const bvec4 v) { - printMESA (v.x); - printMESA (v.y); - printMESA (v.z); - printMESA (v.w); -} - -void printMESA (const mat2 m) { - printMESA (m[0]); - printMESA (m[1]); -} - -void printMESA (const mat3 m) { - printMESA (m[0]); - printMESA (m[1]); - printMESA (m[2]); -} - -void printMESA (const mat4 m) { - printMESA (m[0]); - printMESA (m[1]); - printMESA (m[2]); - printMESA (m[3]); -} - -void printMESA (const sampler1D e) { - __asm int_print e; -} - -void printMESA (const sampler2D e) { - __asm int_print e; -} - -void printMESA (const sampler3D e) { - __asm int_print e; -} - -void printMESA (const samplerCube e) { - __asm int_print e; -} - -void printMESA (const sampler1DShadow e) { - __asm int_print e; -} - -void printMESA (const sampler2DShadow e) { - __asm int_print e; -} - diff --git a/mesalib/src/mesa/shader/slang/library/slang_fragment_builtin.gc b/mesalib/src/mesa/shader/slang/library/slang_fragment_builtin.gc deleted file mode 100644 index 54a80ea0e..000000000 --- a/mesalib/src/mesa/shader/slang/library/slang_fragment_builtin.gc +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -// -// From Shader Spec, ver. 1.10, rev. 59 -// - -__fixed_input vec4 gl_FragCoord; -__fixed_input bool gl_FrontFacing; -__fixed_output vec4 gl_FragColor; -__fixed_output vec4 gl_FragData[gl_MaxDrawBuffers]; -__fixed_output float gl_FragDepth; - -varying vec4 gl_Color; -varying vec4 gl_SecondaryColor; -varying vec4 gl_TexCoord[gl_MaxTextureCoords]; -varying float gl_FogFragCoord; - - - -//// 8.7 Texture Lookup Functions (with bias) - -vec4 texture1D(const sampler1D sampler, const float coord, const float bias) -{ - vec4 coord4; - coord4.x = coord; - coord4.w = bias; - __asm vec4_tex_1d_bias __retVal, sampler, coord4; -} - -vec4 texture1DProj(const sampler1D sampler, const vec2 coord, const float bias) -{ - // do projection here (there's no vec4_texbp1d instruction) - vec4 pcoord; - pcoord.x = coord.x / coord.y; - pcoord.w = bias; - __asm vec4_tex_1d_bias __retVal, sampler, pcoord; -} - -vec4 texture1DProj(const sampler1D sampler, const vec4 coord, const float bias) -{ - // do projection here (there's no vec4_texbp1d instruction) - vec4 pcoord; - pcoord.x = coord.x / coord.z; - pcoord.w = bias; - __asm vec4_tex_1d_bias __retVal, sampler, pcoord; -} - - - - -vec4 texture2D(const sampler2D sampler, const vec2 coord, const float bias) -{ - vec4 coord4; - coord4.xy = coord.xy; - coord4.w = bias; - __asm vec4_tex_2d_bias __retVal, sampler, coord4; -} - -vec4 texture2DProj(const sampler2D sampler, const vec3 coord, const float bias) -{ - // do projection here (there's no vec4_texbp2d instruction) - vec4 pcoord; - pcoord.xy = coord.xy / coord.z; - pcoord.w = bias; - __asm vec4_tex_2d_bias __retVal, sampler, pcoord; -} - -vec4 texture2DProj(const sampler2D sampler, const vec4 coord, const float bias) -{ - // do projection here (there's no vec4_texbp2d instruction) - vec4 pcoord; - pcoord.xy = coord.xy / coord.w; - pcoord.w = bias; - __asm vec4_tex_2d_bias __retVal, sampler, pcoord; -} - - - - -vec4 texture3D(const sampler3D sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord.xyz; - coord4.w = bias; - __asm vec4_tex_3d_bias __retVal, sampler, coord4; -} - -vec4 texture3DProj(const sampler3D sampler, const vec4 coord, const float bias) -{ - // do projection here (there's no vec4_texbp3d instruction) - vec4 pcoord; - pcoord.xyz = coord.xyz / coord.w; - pcoord.w = bias; - __asm vec4_tex_3d_bias __retVal, sampler, pcoord; -} - - - - -vec4 textureCube(const samplerCube sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_cube __retVal, sampler, coord4; -} - - - -vec4 shadow1D(const sampler1DShadow sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_1d_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow1DProj(const sampler1DShadow sampler, const vec4 coord, const float bias) -{ - vec4 pcoord; - pcoord.x = coord.x / coord.w; - pcoord.z = coord.z; - pcoord.w = bias; - __asm vec4_tex_1d_bias_shadow __retVal, sampler, pcoord; -} - -vec4 shadow2D(const sampler2DShadow sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_2d_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow2DProj(const sampler2DShadow sampler, const vec4 coord, const float bias) -{ - vec4 pcoord; - pcoord.xy = coord.xy / coord.w; - pcoord.z = coord.z; - pcoord.w = bias; - __asm vec4_tex_2d_bias_shadow __retVal, sampler, pcoord; -} - - - -//// GL_EXT_texture_array - -vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord) -{ - vec4 coord4; - coord4.xy = coord; - __asm vec4_tex_1d_array __retVal, sampler, coord4; -} - -vec4 texture1DArray(const sampler1DArray sampler, const vec2 coord, const float bias) -{ - vec4 coord4; - coord4.xy = coord; - coord4.w = bias; - __asm vec4_tex_1d_array_bias __retVal, sampler, coord4; -} - -vec4 texure2DArray(const sampler2DArray sampler, const vec3 coord) -{ - vec4 coord4; - coord4.xyz = coord; - __asm vec4_tex_2d_array __retVal, sampler, coord4; -} - -vec4 texture2DArray(const sampler2DArray sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_2d_array_bias __retVal, sampler, coord4; -} - -vec4 shadow1DArray(const sampler1DArrayShadow sampler, const vec2 coord) -{ - vec4 coord4; - coord4.xy = coord; - __asm vec4_tex_1d_array_shadow __retVal, sampler, coord4; -} - -vec4 shadow1DArray(const sampler1DArrayShadow sampler, const vec2 coord, const float bias) -{ - vec4 coord4; - coord4.xy = coord; - coord4.w = bias; - __asm vec4_tex_1d_array_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow2DArray(const sampler2DArrayShadow sampler, const vec3 coord) -{ - vec4 coord4; - coord4.xyz = coord; - __asm vec4_tex_2d_array_shadow __retVal, sampler, coord4; -} - -vec4 shadow2DArray(const sampler2DArrayShadow sampler, const vec3 coord, const float bias) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = bias; - __asm vec4_tex_2d_array_bias_shadow __retVal, sampler, coord4; -} - - - -// -// 8.8 Fragment Processing Functions -// - -float dFdx(const float p) -{ - __asm vec4_ddx __retVal.x, p.xxxx; -} - -vec2 dFdx(const vec2 p) -{ - __asm vec4_ddx __retVal.xy, p.xyyy; -} - -vec3 dFdx(const vec3 p) -{ - __asm vec4_ddx __retVal.xyz, p.xyzz; -} - -vec4 dFdx(const vec4 p) -{ - __asm vec4_ddx __retVal, p; -} - -float dFdy(const float p) -{ - __asm vec4_ddy __retVal.x, p.xxxx; -} - -vec2 dFdy(const vec2 p) -{ - __asm vec4_ddy __retVal.xy, p.xyyy; -} - -vec3 dFdy(const vec3 p) -{ - __asm vec4_ddy __retVal.xyz, p.xyzz; -} - -vec4 dFdy(const vec4 p) -{ - __asm vec4_ddy __retVal, p; -} - -float fwidth (const float p) -{ - // XXX hand-write with __asm - return abs(dFdx(p)) + abs(dFdy(p)); -} - -vec2 fwidth(const vec2 p) -{ - // XXX hand-write with __asm - return abs(dFdx(p)) + abs(dFdy(p)); -} - -vec3 fwidth(const vec3 p) -{ - // XXX hand-write with __asm - return abs(dFdx(p)) + abs(dFdy(p)); -} - -vec4 fwidth(const vec4 p) -{ - // XXX hand-write with __asm - return abs(dFdx(p)) + abs(dFdy(p)); -} - diff --git a/mesalib/src/mesa/shader/slang/library/slang_vertex_builtin.gc b/mesalib/src/mesa/shader/slang/library/slang_vertex_builtin.gc deleted file mode 100644 index 0c67c2ef2..000000000 --- a/mesalib/src/mesa/shader/slang/library/slang_vertex_builtin.gc +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -// -// From Shader Spec, ver. 1.10, rev. 59 -// - -__fixed_output vec4 gl_Position; -__fixed_output float gl_PointSize; -__fixed_output vec4 gl_ClipVertex; - -attribute vec4 gl_Color; -attribute vec4 gl_SecondaryColor; -attribute vec3 gl_Normal; -attribute vec4 gl_Vertex; -attribute vec4 gl_MultiTexCoord0; -attribute vec4 gl_MultiTexCoord1; -attribute vec4 gl_MultiTexCoord2; -attribute vec4 gl_MultiTexCoord3; -attribute vec4 gl_MultiTexCoord4; -attribute vec4 gl_MultiTexCoord5; -attribute vec4 gl_MultiTexCoord6; -attribute vec4 gl_MultiTexCoord7; -attribute float gl_FogCoord; - -varying vec4 gl_FrontColor; -varying vec4 gl_BackColor; -varying vec4 gl_FrontSecondaryColor; -varying vec4 gl_BackSecondaryColor; -varying vec4 gl_TexCoord[gl_MaxTextureCoords]; -varying float gl_FogFragCoord; - -// -// Geometric Functions -// - -vec4 ftransform() -{ - __retVal = gl_ModelViewProjectionMatrix[0] * gl_Vertex.xxxx - + gl_ModelViewProjectionMatrix[1] * gl_Vertex.yyyy - + gl_ModelViewProjectionMatrix[2] * gl_Vertex.zzzz - + gl_ModelViewProjectionMatrix[3] * gl_Vertex.wwww; -} - - - -// -// 8.7 Texture Lookup Functions -// These are pretty much identical to the ones in slang_fragment_builtin.gc -// When used in a vertex program, the texture sample instructions should not -// be using a LOD term so it's effectively zero. Adding 'lod' to that does -// what we want. -// - -vec4 texture1DLod(const sampler1D sampler, const float coord, const float lod) -{ - vec4 coord4; - coord4.x = coord; - coord4.w = lod; - __asm vec4_tex_1d_bias __retVal, sampler, coord4; -} - -vec4 texture1DProjLod(const sampler1D sampler, const vec2 coord, const float lod) -{ - vec4 pcoord; - pcoord.x = coord.x / coord.y; - pcoord.w = lod; - __asm vec4_tex_1d_bias __retVal, sampler, pcoord; -} - -vec4 texture1DProjLod(const sampler1D sampler, const vec4 coord, const float lod) -{ - vec4 pcoord; - pcoord.x = coord.x / coord.z; - pcoord.w = lod; - __asm vec4_tex_1d_bias __retVal, sampler, pcoord; -} - - - -vec4 texture2DLod(const sampler2D sampler, const vec2 coord, const float lod) -{ - vec4 coord4; - coord4.xy = coord.xy; - coord4.w = lod; - __asm vec4_tex_2d_bias __retVal, sampler, coord4; -} - -vec4 texture2DProjLod(const sampler2D sampler, const vec3 coord, const float lod) -{ - vec4 pcoord; - pcoord.xy = coord.xy / coord.z; - pcoord.w = lod; - __asm vec4_tex_2d_bias __retVal, sampler, pcoord; -} - -vec4 texture2DProjLod(const sampler2D sampler, const vec4 coord, const float lod) -{ - vec4 pcoord; - pcoord.xy = coord.xy / coord.z; - pcoord.w = lod; - __asm vec4_tex_2d_bias __retVal, sampler, pcoord; -} - - -vec4 texture3DLod(const sampler3D sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord.xyz; - coord4.w = lod; - __asm vec4_tex_3d_bias __retVal, sampler, coord4; -} - -vec4 texture3DProjLod(const sampler3D sampler, const vec4 coord, const float lod) -{ - // do projection here (there's no vec4_tex_3d_bias_proj instruction) - vec4 pcoord; - pcoord.xyz = coord.xyz / coord.w; - pcoord.w = lod; - __asm vec4_tex_3d_bias __retVal, sampler, pcoord; -} - - -vec4 textureCubeLod(const samplerCube sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = lod; - __asm vec4_tex_cube __retVal, sampler, coord4; -} - - -vec4 shadow1DLod(const sampler1DShadow sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = lod; - __asm vec4_tex_1d_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow1DProjLod(const sampler1DShadow sampler, const vec4 coord, - const float lod) -{ - vec4 pcoord; - pcoord.x = coord.x / coord.w; - pcoord.z = coord.z; - pcoord.w = lod; - __asm vec4_tex_1d_bias_shadow __retVal, sampler, pcoord; -} - - -vec4 shadow2DLod(const sampler2DShadow sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = lod; - __asm vec4_tex_2d_bias_shadow __retVal, sampler, coord4; -} - -vec4 shadow2DProjLod(const sampler2DShadow sampler, const vec4 coord, - const float lod) -{ - vec4 pcoord; - pcoord.xy = coord.xy / coord.w; - pcoord.z = coord.z; - pcoord.w = lod; - __asm vec4_tex_2d_bias_shadow __retVal, sampler, pcoord; -} - - -//// GL_EXT_texture_array - -vec4 texture1DArrayLod(const sampler1DArray sampler, const vec2 coord, const float lod) -{ - vec4 coord4; - coord4.xy = coord; - coord4.w = lod; - __asm vec4_tex_1d_array_bias __retVal, sampler, coord4; -} - - -vec4 texture2DArrayLod(const sampler2DArray sampler, const vec3 coord, const float lod) -{ - vec4 coord4; - coord4.xyz = coord; - coord4.w = lod; - __asm vec4_tex_2d_array_bias __retVal, sampler, coord4; -} - diff --git a/mesalib/src/mesa/shader/slang/slang_builtin.c b/mesalib/src/mesa/shader/slang/slang_builtin.c deleted file mode 100644 index 791e75152..000000000 --- a/mesalib/src/mesa/shader/slang/slang_builtin.c +++ /dev/null @@ -1,897 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * Copyright (C) 2008 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_builtin.c - * Resolve built-in uniform vars. - * \author Brian Paul - */ - -#include "main/imports.h" -#include "main/mtypes.h" -#include "shader/program.h" -#include "shader/prog_instruction.h" -#include "shader/prog_parameter.h" -#include "shader/prog_statevars.h" -#include "shader/slang/slang_ir.h" -#include "shader/slang/slang_builtin.h" - - -/** special state token (see below) */ -#define STATE_ARRAY ((gl_state_index) 0xfffff) - - -/** - * Lookup GL state given a variable name, 0, 1 or 2 indexes and a field. - * Allocate room for the state in the given param list and return position - * in the list. - * Yes, this is kind of ugly, but it works. - */ -static GLint -lookup_statevar(const char *var, GLint index1, GLint index2, const char *field, - GLuint *swizzleOut, - struct gl_program_parameter_list *paramList) -{ - /* - * NOTE: The ARB_vertex_program extension specified that matrices get - * loaded in registers in row-major order. With GLSL, we want column- - * major order. So, we need to transpose all matrices here... - */ - static const struct { - const char *name; - gl_state_index matrix; - gl_state_index modifier; - } matrices[] = { - { "gl_ModelViewMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_ModelViewMatrixInverse", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_ModelViewMatrixTranspose", STATE_MODELVIEW_MATRIX, 0 }, - { "gl_ModelViewMatrixInverseTranspose", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_ProjectionMatrix", STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_ProjectionMatrixInverse", STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_ProjectionMatrixTranspose", STATE_PROJECTION_MATRIX, 0 }, - { "gl_ProjectionMatrixInverseTranspose", STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_ModelViewProjectionMatrix", STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_ModelViewProjectionMatrixInverse", STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_ModelViewProjectionMatrixTranspose", STATE_MVP_MATRIX, 0 }, - { "gl_ModelViewProjectionMatrixInverseTranspose", STATE_MVP_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_TextureMatrix", STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE }, - { "gl_TextureMatrixInverse", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS }, - { "gl_TextureMatrixTranspose", STATE_TEXTURE_MATRIX, 0 }, - { "gl_TextureMatrixInverseTranspose", STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE }, - - { "gl_NormalMatrix", STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE }, - - { NULL, 0, 0 } - }; - gl_state_index tokens[STATE_LENGTH]; - GLuint i; - GLboolean isMatrix = GL_FALSE; - - for (i = 0; i < STATE_LENGTH; i++) { - tokens[i] = 0; - } - *swizzleOut = SWIZZLE_NOOP; - - /* first, look if var is a pre-defined matrix */ - for (i = 0; matrices[i].name; i++) { - if (strcmp(var, matrices[i].name) == 0) { - tokens[0] = matrices[i].matrix; - /* tokens[1], [2] and [3] filled below */ - tokens[4] = matrices[i].modifier; - isMatrix = GL_TRUE; - break; - } - } - - if (isMatrix) { - if (tokens[0] == STATE_TEXTURE_MATRIX) { - /* texture_matrix[index1][index2] */ - tokens[1] = index1 >= 0 ? index1 : 0; /* which texture matrix */ - index1 = index2; /* move matrix row value to index1 */ - } - if (index1 < 0) { - /* index1 is unused: prevent extra addition at end of function */ - index1 = 0; - } - } - else if (strcmp(var, "gl_DepthRange") == 0) { - tokens[0] = STATE_DEPTH_RANGE; - assert(field); - if (strcmp(field, "near") == 0) { - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "far") == 0) { - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "diff") == 0) { - *swizzleOut = SWIZZLE_ZZZZ; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_ClipPlane") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_CLIPPLANE; - tokens[1] = index1; - } - else if (strcmp(var, "gl_Point") == 0) { - assert(field); - if (strcmp(field, "size") == 0) { - tokens[0] = STATE_POINT_SIZE; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "sizeMin") == 0) { - tokens[0] = STATE_POINT_SIZE; - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "sizeMax") == 0) { - tokens[0] = STATE_POINT_SIZE; - *swizzleOut = SWIZZLE_ZZZZ; - } - else if (strcmp(field, "fadeThresholdSize") == 0) { - tokens[0] = STATE_POINT_SIZE; - *swizzleOut = SWIZZLE_WWWW; - } - else if (strcmp(field, "distanceConstantAttenuation") == 0) { - tokens[0] = STATE_POINT_ATTENUATION; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "distanceLinearAttenuation") == 0) { - tokens[0] = STATE_POINT_ATTENUATION; - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "distanceQuadraticAttenuation") == 0) { - tokens[0] = STATE_POINT_ATTENUATION; - *swizzleOut = SWIZZLE_ZZZZ; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_FrontMaterial") == 0 || - strcmp(var, "gl_BackMaterial") == 0) { - tokens[0] = STATE_MATERIAL; - if (strcmp(var, "gl_FrontMaterial") == 0) - tokens[1] = 0; - else - tokens[1] = 1; - assert(field); - if (strcmp(field, "emission") == 0) { - tokens[2] = STATE_EMISSION; - } - else if (strcmp(field, "ambient") == 0) { - tokens[2] = STATE_AMBIENT; - } - else if (strcmp(field, "diffuse") == 0) { - tokens[2] = STATE_DIFFUSE; - } - else if (strcmp(field, "specular") == 0) { - tokens[2] = STATE_SPECULAR; - } - else if (strcmp(field, "shininess") == 0) { - tokens[2] = STATE_SHININESS; - *swizzleOut = SWIZZLE_XXXX; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_LightSource") == 0) { - if (!field || index1 < 0) - return -1; - - tokens[0] = STATE_LIGHT; - tokens[1] = index1; - - if (strcmp(field, "ambient") == 0) { - tokens[2] = STATE_AMBIENT; - } - else if (strcmp(field, "diffuse") == 0) { - tokens[2] = STATE_DIFFUSE; - } - else if (strcmp(field, "specular") == 0) { - tokens[2] = STATE_SPECULAR; - } - else if (strcmp(field, "position") == 0) { - tokens[2] = STATE_POSITION; - } - else if (strcmp(field, "halfVector") == 0) { - tokens[2] = STATE_HALF_VECTOR; - } - else if (strcmp(field, "spotDirection") == 0) { - tokens[2] = STATE_SPOT_DIRECTION; - } - else if (strcmp(field, "spotCosCutoff") == 0) { - tokens[2] = STATE_SPOT_DIRECTION; - *swizzleOut = SWIZZLE_WWWW; - } - else if (strcmp(field, "spotCutoff") == 0) { - tokens[2] = STATE_SPOT_CUTOFF; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "spotExponent") == 0) { - tokens[2] = STATE_ATTENUATION; - *swizzleOut = SWIZZLE_WWWW; - } - else if (strcmp(field, "constantAttenuation") == 0) { - tokens[2] = STATE_ATTENUATION; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "linearAttenuation") == 0) { - tokens[2] = STATE_ATTENUATION; - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "quadraticAttenuation") == 0) { - tokens[2] = STATE_ATTENUATION; - *swizzleOut = SWIZZLE_ZZZZ; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_LightModel") == 0) { - if (strcmp(field, "ambient") == 0) { - tokens[0] = STATE_LIGHTMODEL_AMBIENT; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_FrontLightModelProduct") == 0) { - if (strcmp(field, "sceneColor") == 0) { - tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; - tokens[1] = 0; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_BackLightModelProduct") == 0) { - if (strcmp(field, "sceneColor") == 0) { - tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; - tokens[1] = 1; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_FrontLightProduct") == 0 || - strcmp(var, "gl_BackLightProduct") == 0) { - if (index1 < 0 || !field) - return -1; - - tokens[0] = STATE_LIGHTPROD; - tokens[1] = index1; /* light number */ - if (strcmp(var, "gl_FrontLightProduct") == 0) { - tokens[2] = 0; /* front */ - } - else { - tokens[2] = 1; /* back */ - } - if (strcmp(field, "ambient") == 0) { - tokens[3] = STATE_AMBIENT; - } - else if (strcmp(field, "diffuse") == 0) { - tokens[3] = STATE_DIFFUSE; - } - else if (strcmp(field, "specular") == 0) { - tokens[3] = STATE_SPECULAR; - } - else { - return -1; - } - } - else if (strcmp(var, "gl_TextureEnvColor") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXENV_COLOR; - tokens[1] = index1; - } - else if (strcmp(var, "gl_EyePlaneS") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_EYE_S; - } - else if (strcmp(var, "gl_EyePlaneT") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_EYE_T; - } - else if (strcmp(var, "gl_EyePlaneR") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_EYE_R; - } - else if (strcmp(var, "gl_EyePlaneQ") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_EYE_Q; - } - else if (strcmp(var, "gl_ObjectPlaneS") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_OBJECT_S; - } - else if (strcmp(var, "gl_ObjectPlaneT") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_OBJECT_T; - } - else if (strcmp(var, "gl_ObjectPlaneR") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_OBJECT_R; - } - else if (strcmp(var, "gl_ObjectPlaneQ") == 0) { - if (index1 < 0) - return -1; - tokens[0] = STATE_TEXGEN; - tokens[1] = index1; /* tex unit */ - tokens[2] = STATE_TEXGEN_OBJECT_Q; - } - else if (strcmp(var, "gl_Fog") == 0) { - if (strcmp(field, "color") == 0) { - tokens[0] = STATE_FOG_COLOR; - } - else if (strcmp(field, "density") == 0) { - tokens[0] = STATE_FOG_PARAMS; - *swizzleOut = SWIZZLE_XXXX; - } - else if (strcmp(field, "start") == 0) { - tokens[0] = STATE_FOG_PARAMS; - *swizzleOut = SWIZZLE_YYYY; - } - else if (strcmp(field, "end") == 0) { - tokens[0] = STATE_FOG_PARAMS; - *swizzleOut = SWIZZLE_ZZZZ; - } - else if (strcmp(field, "scale") == 0) { - tokens[0] = STATE_FOG_PARAMS; - *swizzleOut = SWIZZLE_WWWW; - } - else { - return -1; - } - } - else { - return -1; - } - - if (isMatrix) { - /* load all four columns of matrix */ - GLint pos[4]; - GLuint j; - for (j = 0; j < 4; j++) { - tokens[2] = tokens[3] = j; /* jth row of matrix */ - pos[j] = _mesa_add_state_reference(paramList, tokens); - assert(pos[j] >= 0); - ASSERT(pos[j] >= 0); - } - return pos[0] + index1; - } - else { - /* allocate a single register */ - GLint pos = _mesa_add_state_reference(paramList, tokens); - ASSERT(pos >= 0); - return pos; - } -} - - - -/** - * Given a variable name and datatype, emit uniform/constant buffer - * entries which will store that state variable. - * For example, if name="gl_LightSource" we'll emit 64 state variable - * vectors/references and return position where that data starts. This will - * allow run-time array indexing into the light source array. - * - * Note that this is a recursive function. - * - * \return -1 if error, else index of start of data in the program parameter list - */ -static GLint -emit_statevars(const char *name, int array_len, - const slang_type_specifier *type, - gl_state_index tokens[STATE_LENGTH], - struct gl_program_parameter_list *paramList) -{ - if (type->type == SLANG_SPEC_ARRAY) { - GLint i, pos = -1; - assert(array_len > 0); - if (strcmp(name, "gl_ClipPlane") == 0) { - tokens[0] = STATE_CLIPPLANE; - } - else if (strcmp(name, "gl_LightSource") == 0) { - tokens[0] = STATE_LIGHT; - } - else if (strcmp(name, "gl_FrontLightProduct") == 0) { - tokens[0] = STATE_LIGHTPROD; - tokens[2] = 0; /* front */ - } - else if (strcmp(name, "gl_BackLightProduct") == 0) { - tokens[0] = STATE_LIGHTPROD; - tokens[2] = 1; /* back */ - } - else if (strcmp(name, "gl_TextureEnvColor") == 0) { - tokens[0] = STATE_TEXENV_COLOR; - } - else if (strcmp(name, "gl_EyePlaneS") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_EYE_S; - } - else if (strcmp(name, "gl_EyePlaneT") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_EYE_T; - } - else if (strcmp(name, "gl_EyePlaneR") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_EYE_R; - } - else if (strcmp(name, "gl_EyePlaneQ") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_EYE_Q; - } - else if (strcmp(name, "gl_ObjectPlaneS") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_OBJECT_S; - } - else if (strcmp(name, "gl_ObjectPlaneT") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_OBJECT_T; - } - else if (strcmp(name, "gl_ObjectPlaneR") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_OBJECT_R; - } - else if (strcmp(name, "gl_ObjectPlaneQ") == 0) { - tokens[0] = STATE_TEXGEN; - tokens[2] = STATE_TEXGEN_OBJECT_Q; - } - else { - return -1; /* invalid array name */ - } - for (i = 0; i < array_len; i++) { - GLint p; - tokens[1] = i; - p = emit_statevars(NULL, 0, type->_array, tokens, paramList); - if (i == 0) - pos = p; - } - return pos; - } - else if (type->type == SLANG_SPEC_STRUCT) { - const slang_variable_scope *fields = type->_struct->fields; - GLuint i, pos = 0; - for (i = 0; i < fields->num_variables; i++) { - const slang_variable *var = fields->variables[i]; - GLint p = emit_statevars(var->a_name, 0, &var->type.specifier, - tokens, paramList); - if (i == 0) - pos = p; - } - return pos; - } - else { - GLint pos; - assert(type->type == SLANG_SPEC_VEC4 || - type->type == SLANG_SPEC_VEC3 || - type->type == SLANG_SPEC_VEC2 || - type->type == SLANG_SPEC_FLOAT || - type->type == SLANG_SPEC_IVEC4 || - type->type == SLANG_SPEC_IVEC3 || - type->type == SLANG_SPEC_IVEC2 || - type->type == SLANG_SPEC_INT); - if (name) { - GLint t; - - if (tokens[0] == STATE_LIGHT) - t = 2; - else if (tokens[0] == STATE_LIGHTPROD) - t = 3; - else - return -1; /* invalid array name */ - - if (strcmp(name, "ambient") == 0) { - tokens[t] = STATE_AMBIENT; - } - else if (strcmp(name, "diffuse") == 0) { - tokens[t] = STATE_DIFFUSE; - } - else if (strcmp(name, "specular") == 0) { - tokens[t] = STATE_SPECULAR; - } - else if (strcmp(name, "position") == 0) { - tokens[t] = STATE_POSITION; - } - else if (strcmp(name, "halfVector") == 0) { - tokens[t] = STATE_HALF_VECTOR; - } - else if (strcmp(name, "spotDirection") == 0) { - tokens[t] = STATE_SPOT_DIRECTION; /* xyz components */ - } - else if (strcmp(name, "spotCosCutoff") == 0) { - tokens[t] = STATE_SPOT_DIRECTION; /* w component */ - } - - else if (strcmp(name, "constantAttenuation") == 0) { - tokens[t] = STATE_ATTENUATION; /* x component */ - } - else if (strcmp(name, "linearAttenuation") == 0) { - tokens[t] = STATE_ATTENUATION; /* y component */ - } - else if (strcmp(name, "quadraticAttenuation") == 0) { - tokens[t] = STATE_ATTENUATION; /* z component */ - } - else if (strcmp(name, "spotExponent") == 0) { - tokens[t] = STATE_ATTENUATION; /* w = spot exponent */ - } - - else if (strcmp(name, "spotCutoff") == 0) { - tokens[t] = STATE_SPOT_CUTOFF; /* x component */ - } - - else { - return -1; /* invalid field name */ - } - } - - pos = _mesa_add_state_reference(paramList, tokens); - return pos; - } - - return 1; -} - - -/** - * Unroll the named built-in uniform variable into a sequence of state - * vars in the given parameter list. - */ -static GLint -alloc_state_var_array(const slang_variable *var, - struct gl_program_parameter_list *paramList) -{ - gl_state_index tokens[STATE_LENGTH]; - GLuint i; - GLint pos; - - /* Initialize the state tokens array. This is very important. - * When we call _mesa_add_state_reference() it'll searches the parameter - * list to see if the given statevar token sequence is already present. - * This is normally a good thing since it prevents redundant values in the - * constant buffer. - * - * But when we're building arrays of state this can be bad. For example, - * consider this fragment of GLSL code: - * foo = gl_LightSource[3].diffuse; - * ... - * bar = gl_LightSource[i].diffuse; - * - * When we unroll the gl_LightSource array (for "bar") we want to re-emit - * gl_LightSource[3].diffuse and not re-use the first instance (from "foo") - * since that would upset the array layout. We handle this situation by - * setting the last token in the state var token array to the special - * value STATE_ARRAY. - * This token will only be set for array state. We can hijack the last - * element in the array for this since it's never used for light, clipplane - * or texture env array state. - */ - for (i = 0; i < STATE_LENGTH; i++) - tokens[i] = 0; - tokens[STATE_LENGTH - 1] = STATE_ARRAY; - - pos = emit_statevars(var->a_name, var->array_len, &var->type.specifier, - tokens, paramList); - - return pos; -} - - - -/** - * Allocate storage for a pre-defined uniform (a GL state variable). - * As a memory-saving optimization, we try to only allocate storage for - * state vars that are actually used. - * - * Arrays such as gl_LightSource are handled specially. For an expression - * like "gl_LightSource[2].diffuse", we can allocate a single uniform/constant - * slot and return the index. In this case, we return direct=TRUE. - * - * Buf for something like "gl_LightSource[i].diffuse" we don't know the value - * of 'i' at compile time so we need to "unroll" the gl_LightSource array - * into a consecutive sequence of uniform/constant slots so it can be indexed - * at runtime. In this case, we return direct=FALSE. - * - * Currently, all pre-defined uniforms are in one of these forms: - * var - * var[i] - * var.field - * var[i].field - * var[i][j] - * - * \return -1 upon error, else position in paramList of the state variable/data - */ -GLint -_slang_alloc_statevar(slang_ir_node *n, - struct gl_program_parameter_list *paramList, - GLboolean *direct) -{ - slang_ir_node *n0 = n; - const char *field = NULL; - GLint index1 = -1, index2 = -1; - GLuint swizzle; - - *direct = GL_TRUE; - - if (n->Opcode == IR_FIELD) { - field = n->Field; - n = n->Children[0]; - } - - if (n->Opcode == IR_ELEMENT) { - if (n->Children[1]->Opcode == IR_FLOAT) { - index1 = (GLint) n->Children[1]->Value[0]; - } - else { - *direct = GL_FALSE; - } - n = n->Children[0]; - } - - if (n->Opcode == IR_ELEMENT) { - /* XXX can only handle constant indexes for now */ - if (n->Children[1]->Opcode == IR_FLOAT) { - /* two-dimensional array index: mat[i][j] */ - index2 = index1; - index1 = (GLint) n->Children[1]->Value[0]; - } - else { - *direct = GL_FALSE; - } - n = n->Children[0]; - } - - assert(n->Opcode == IR_VAR); - - if (*direct) { - const char *var = (const char *) n->Var->a_name; - GLint pos = - lookup_statevar(var, index1, index2, field, &swizzle, paramList); - if (pos >= 0) { - /* newly resolved storage for the statevar/constant/uniform */ - n0->Store->File = PROGRAM_STATE_VAR; - n0->Store->Index = pos; - n0->Store->Swizzle = swizzle; - n0->Store->Parent = NULL; - return pos; - } - } - - *direct = GL_FALSE; - return alloc_state_var_array(n->Var, paramList); -} - - - - -#define SWIZZLE_ZWWW MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W) - - -/** Predefined shader inputs */ -struct input_info -{ - const char *Name; - GLuint Attrib; - GLenum Type; - GLuint Swizzle; -}; - -/** Predefined vertex shader inputs/attributes */ -static const struct input_info vertInputs[] = { - { "gl_Vertex", VERT_ATTRIB_POS, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_Normal", VERT_ATTRIB_NORMAL, GL_FLOAT_VEC3, SWIZZLE_NOOP }, - { "gl_Color", VERT_ATTRIB_COLOR0, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_SecondaryColor", VERT_ATTRIB_COLOR1, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_FogCoord", VERT_ATTRIB_FOG, GL_FLOAT, SWIZZLE_XXXX }, - { "gl_MultiTexCoord0", VERT_ATTRIB_TEX0, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_MultiTexCoord1", VERT_ATTRIB_TEX1, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_MultiTexCoord2", VERT_ATTRIB_TEX2, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_MultiTexCoord3", VERT_ATTRIB_TEX3, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_MultiTexCoord4", VERT_ATTRIB_TEX4, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_MultiTexCoord5", VERT_ATTRIB_TEX5, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_MultiTexCoord6", VERT_ATTRIB_TEX6, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_MultiTexCoord7", VERT_ATTRIB_TEX7, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { NULL, 0, GL_NONE, SWIZZLE_NOOP } -}; - -/** Predefined fragment shader inputs */ -static const struct input_info fragInputs[] = { - { "gl_FragCoord", FRAG_ATTRIB_WPOS, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_Color", FRAG_ATTRIB_COL0, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_SecondaryColor", FRAG_ATTRIB_COL1, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { "gl_TexCoord", FRAG_ATTRIB_TEX0, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - /* note: we're packing several quantities into the fogcoord vector */ - { "gl_FogFragCoord", FRAG_ATTRIB_FOGC, GL_FLOAT, SWIZZLE_XXXX }, - { "gl_FrontFacing", FRAG_ATTRIB_FACE, GL_FLOAT, SWIZZLE_XXXX }, - { "gl_PointCoord", FRAG_ATTRIB_PNTC, GL_FLOAT_VEC2, SWIZZLE_XYZW }, - { NULL, 0, GL_NONE, SWIZZLE_NOOP } -}; - - -/** - * Return the VERT_ATTRIB_* or FRAG_ATTRIB_* value that corresponds to - * a vertex or fragment program input variable. Return -1 if the input - * name is invalid. - * XXX return size too - */ -GLint -_slang_input_index(const char *name, GLenum target, GLuint *swizzleOut) -{ - const struct input_info *inputs; - GLuint i; - - switch (target) { - case GL_VERTEX_PROGRAM_ARB: - inputs = vertInputs; - break; - case GL_FRAGMENT_PROGRAM_ARB: - inputs = fragInputs; - break; - /* XXX geom program */ - default: - _mesa_problem(NULL, "bad target in _slang_input_index"); - return -1; - } - - ASSERT(MAX_TEXTURE_COORD_UNITS == 8); /* if this fails, fix vertInputs above */ - - for (i = 0; inputs[i].Name; i++) { - if (strcmp(inputs[i].Name, name) == 0) { - /* found */ - *swizzleOut = inputs[i].Swizzle; - return inputs[i].Attrib; - } - } - return -1; -} - - -/** - * Return name of the given vertex attribute (VERT_ATTRIB_x). - */ -const char * -_slang_vert_attrib_name(GLuint attrib) -{ - GLuint i; - assert(attrib < VERT_ATTRIB_GENERIC0); - for (i = 0; vertInputs[i].Name; i++) { - if (vertInputs[i].Attrib == attrib) - return vertInputs[i].Name; - } - return NULL; -} - - -/** - * Return type (GL_FLOAT, GL_FLOAT_VEC2, etc) of the given vertex - * attribute (VERT_ATTRIB_x). - */ -GLenum -_slang_vert_attrib_type(GLuint attrib) -{ - GLuint i; - assert(attrib < VERT_ATTRIB_GENERIC0); - for (i = 0; vertInputs[i].Name; i++) { - if (vertInputs[i].Attrib == attrib) - return vertInputs[i].Type; - } - return GL_NONE; -} - - - - - -/** Predefined shader output info */ -struct output_info -{ - const char *Name; - GLuint Attrib; -}; - -/** Predefined vertex shader outputs */ -static const struct output_info vertOutputs[] = { - { "gl_Position", VERT_RESULT_HPOS }, - { "gl_FrontColor", VERT_RESULT_COL0 }, - { "gl_BackColor", VERT_RESULT_BFC0 }, - { "gl_FrontSecondaryColor", VERT_RESULT_COL1 }, - { "gl_BackSecondaryColor", VERT_RESULT_BFC1 }, - { "gl_TexCoord", VERT_RESULT_TEX0 }, - { "gl_FogFragCoord", VERT_RESULT_FOGC }, - { "gl_PointSize", VERT_RESULT_PSIZ }, - { NULL, 0 } -}; - -/** Predefined fragment shader outputs */ -static const struct output_info fragOutputs[] = { - { "gl_FragColor", FRAG_RESULT_COLOR }, - { "gl_FragDepth", FRAG_RESULT_DEPTH }, - { "gl_FragData", FRAG_RESULT_DATA0 }, - { NULL, 0 } -}; - - -/** - * Return the VERT_RESULT_* or FRAG_RESULT_* value that corresponds to - * a vertex or fragment program output variable. Return -1 for an invalid - * output name. - */ -GLint -_slang_output_index(const char *name, GLenum target) -{ - const struct output_info *outputs; - GLuint i; - - switch (target) { - case GL_VERTEX_PROGRAM_ARB: - outputs = vertOutputs; - break; - case GL_FRAGMENT_PROGRAM_ARB: - outputs = fragOutputs; - break; - /* XXX geom program */ - default: - _mesa_problem(NULL, "bad target in _slang_output_index"); - return -1; - } - - for (i = 0; outputs[i].Name; i++) { - if (strcmp(outputs[i].Name, name) == 0) { - /* found */ - return outputs[i].Attrib; - } - } - return -1; -} diff --git a/mesalib/src/mesa/shader/slang/slang_builtin.h b/mesalib/src/mesa/shader/slang/slang_builtin.h deleted file mode 100644 index f814d11ac..000000000 --- a/mesalib/src/mesa/shader/slang/slang_builtin.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef SLANG_BUILTIN_H -#define SLANG_BUILTIN_H - -#include "shader/prog_parameter.h" -#include "slang_utility.h" -#include "slang_ir.h" - - -extern GLint -_slang_alloc_statevar(slang_ir_node *n, - struct gl_program_parameter_list *paramList, - GLboolean *direct); - - -extern GLint -_slang_input_index(const char *name, GLenum target, GLuint *swizzleOut); - -extern GLint -_slang_output_index(const char *name, GLenum target); - - -extern const char * -_slang_vert_attrib_name(GLuint attrib); - -extern GLenum -_slang_vert_attrib_type(GLuint attrib); - - -#endif /* SLANG_BUILTIN_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_codegen.c b/mesalib/src/mesa/shader/slang/slang_codegen.c deleted file mode 100644 index 7d5e5eb29..000000000 --- a/mesalib/src/mesa/shader/slang/slang_codegen.c +++ /dev/null @@ -1,5354 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * Copyright (C) 2008 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_codegen.c - * Generate IR tree from AST. - * \author Brian Paul - */ - - -/*** - *** NOTES: - *** The new_() functions return a new instance of a simple IR node. - *** The gen_() functions generate larger IR trees from the simple nodes. - ***/ - - - -#include "main/imports.h" -#include "main/macros.h" -#include "main/mtypes.h" -#include "shader/program.h" -#include "shader/prog_instruction.h" -#include "shader/prog_parameter.h" -#include "shader/prog_print.h" -#include "shader/prog_statevars.h" -#include "slang_typeinfo.h" -#include "slang_builtin.h" -#include "slang_codegen.h" -#include "slang_compile.h" -#include "slang_label.h" -#include "slang_mem.h" -#include "slang_simplify.h" -#include "slang_emit.h" -#include "slang_vartable.h" -#include "slang_ir.h" -#include "slang_print.h" - - -/** Max iterations to unroll */ -const GLuint MAX_FOR_LOOP_UNROLL_ITERATIONS = 32; - -/** Max for-loop body size (in slang operations) to unroll */ -const GLuint MAX_FOR_LOOP_UNROLL_BODY_SIZE = 50; - -/** Max for-loop body complexity to unroll. - * We'll compute complexity as the product of the number of iterations - * and the size of the body. So long-ish loops with very simple bodies - * can be unrolled, as well as short loops with larger bodies. - */ -const GLuint MAX_FOR_LOOP_UNROLL_COMPLEXITY = 256; - - - -static slang_ir_node * -_slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper); - -static void -slang_substitute(slang_assemble_ctx *A, slang_operation *oper, - GLuint substCount, slang_variable **substOld, - slang_operation **substNew, GLboolean isLHS); - - -/** - * Retrieves type information about an operation. - * Returns GL_TRUE on success. - * Returns GL_FALSE otherwise. - */ -static GLboolean -typeof_operation(const struct slang_assemble_ctx_ *A, - slang_operation *op, - slang_typeinfo *ti) -{ - return _slang_typeof_operation(op, &A->space, ti, A->atoms, A->log); -} - - -static GLboolean -is_sampler_type(const slang_fully_specified_type *t) -{ - switch (t->specifier.type) { - case SLANG_SPEC_SAMPLER_1D: - case SLANG_SPEC_SAMPLER_2D: - case SLANG_SPEC_SAMPLER_3D: - case SLANG_SPEC_SAMPLER_CUBE: - case SLANG_SPEC_SAMPLER_1D_SHADOW: - case SLANG_SPEC_SAMPLER_2D_SHADOW: - case SLANG_SPEC_SAMPLER_RECT: - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - case SLANG_SPEC_SAMPLER_1D_ARRAY: - case SLANG_SPEC_SAMPLER_2D_ARRAY: - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * Return the offset (in floats or ints) of the named field within - * the given struct. Return -1 if field not found. - * If field is NULL, return the size of the struct instead. - */ -static GLint -_slang_field_offset(const slang_type_specifier *spec, slang_atom field) -{ - GLint offset = 0; - GLuint i; - for (i = 0; i < spec->_struct->fields->num_variables; i++) { - const slang_variable *v = spec->_struct->fields->variables[i]; - const GLuint sz = _slang_sizeof_type_specifier(&v->type.specifier); - if (sz > 1) { - /* types larger than 1 float are register (4-float) aligned */ - offset = (offset + 3) & ~3; - } - if (field && v->a_name == field) { - return offset; - } - offset += sz; - } - if (field) - return -1; /* field not found */ - else - return offset; /* struct size */ -} - - -/** - * Return the size (in floats) of the given type specifier. - * If the size is greater than 4, the size should be a multiple of 4 - * so that the correct number of 4-float registers are allocated. - * For example, a mat3x2 is size 12 because we want to store the - * 3 columns in 3 float[4] registers. - */ -GLuint -_slang_sizeof_type_specifier(const slang_type_specifier *spec) -{ - GLuint sz; - switch (spec->type) { - case SLANG_SPEC_VOID: - sz = 0; - break; - case SLANG_SPEC_BOOL: - sz = 1; - break; - case SLANG_SPEC_BVEC2: - sz = 2; - break; - case SLANG_SPEC_BVEC3: - sz = 3; - break; - case SLANG_SPEC_BVEC4: - sz = 4; - break; - case SLANG_SPEC_INT: - sz = 1; - break; - case SLANG_SPEC_IVEC2: - sz = 2; - break; - case SLANG_SPEC_IVEC3: - sz = 3; - break; - case SLANG_SPEC_IVEC4: - sz = 4; - break; - case SLANG_SPEC_FLOAT: - sz = 1; - break; - case SLANG_SPEC_VEC2: - sz = 2; - break; - case SLANG_SPEC_VEC3: - sz = 3; - break; - case SLANG_SPEC_VEC4: - sz = 4; - break; - case SLANG_SPEC_MAT2: - sz = 2 * 4; /* 2 columns (regs) */ - break; - case SLANG_SPEC_MAT3: - sz = 3 * 4; - break; - case SLANG_SPEC_MAT4: - sz = 4 * 4; - break; - case SLANG_SPEC_MAT23: - sz = 2 * 4; /* 2 columns (regs) */ - break; - case SLANG_SPEC_MAT32: - sz = 3 * 4; /* 3 columns (regs) */ - break; - case SLANG_SPEC_MAT24: - sz = 2 * 4; - break; - case SLANG_SPEC_MAT42: - sz = 4 * 4; /* 4 columns (regs) */ - break; - case SLANG_SPEC_MAT34: - sz = 3 * 4; - break; - case SLANG_SPEC_MAT43: - sz = 4 * 4; /* 4 columns (regs) */ - break; - case SLANG_SPEC_SAMPLER_1D: - case SLANG_SPEC_SAMPLER_2D: - case SLANG_SPEC_SAMPLER_3D: - case SLANG_SPEC_SAMPLER_CUBE: - case SLANG_SPEC_SAMPLER_1D_SHADOW: - case SLANG_SPEC_SAMPLER_2D_SHADOW: - case SLANG_SPEC_SAMPLER_RECT: - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - case SLANG_SPEC_SAMPLER_1D_ARRAY: - case SLANG_SPEC_SAMPLER_2D_ARRAY: - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - sz = 1; /* a sampler is basically just an integer index */ - break; - case SLANG_SPEC_STRUCT: - sz = _slang_field_offset(spec, 0); /* special use */ - if (sz == 1) { - /* 1-float structs are actually troublesome to deal with since they - * might get placed at R.x, R.y, R.z or R.z. Return size=2 to - * ensure the object is placed at R.x - */ - sz = 2; - } - else if (sz > 4) { - sz = (sz + 3) & ~0x3; /* round up to multiple of four */ - } - break; - case SLANG_SPEC_ARRAY: - sz = _slang_sizeof_type_specifier(spec->_array); - break; - default: - _mesa_problem(NULL, "Unexpected type in _slang_sizeof_type_specifier()"); - sz = 0; - } - - if (sz > 4) { - /* if size is > 4, it should be a multiple of four */ - assert((sz & 0x3) == 0); - } - return sz; -} - - -/** - * Query variable/array length (number of elements). - * This is slightly non-trivial because there are two ways to express - * arrays: "float x[3]" vs. "float[3] x". - * \return the length of the array for the given variable, or 0 if not an array - */ -static GLint -_slang_array_length(const slang_variable *var) -{ - if (var->type.array_len > 0) { - /* Ex: float[4] x; */ - return var->type.array_len; - } - if (var->array_len > 0) { - /* Ex: float x[4]; */ - return var->array_len; - } - return 0; -} - - -/** - * Compute total size of array give size of element, number of elements. - * \return size in floats - */ -static GLint -_slang_array_size(GLint elemSize, GLint arrayLen) -{ - GLint total; - assert(elemSize > 0); - if (arrayLen > 1) { - /* round up base type to multiple of 4 */ - total = ((elemSize + 3) & ~0x3) * MAX2(arrayLen, 1); - } - else { - total = elemSize; - } - return total; -} - - -/** - * Return the TEXTURE_*_INDEX value that corresponds to a sampler type, - * or -1 if the type is not a sampler. - */ -static GLint -sampler_to_texture_index(const slang_type_specifier_type type) -{ - switch (type) { - case SLANG_SPEC_SAMPLER_1D: - return TEXTURE_1D_INDEX; - case SLANG_SPEC_SAMPLER_2D: - return TEXTURE_2D_INDEX; - case SLANG_SPEC_SAMPLER_3D: - return TEXTURE_3D_INDEX; - case SLANG_SPEC_SAMPLER_CUBE: - return TEXTURE_CUBE_INDEX; - case SLANG_SPEC_SAMPLER_1D_SHADOW: - return TEXTURE_1D_INDEX; /* XXX fix */ - case SLANG_SPEC_SAMPLER_2D_SHADOW: - return TEXTURE_2D_INDEX; /* XXX fix */ - case SLANG_SPEC_SAMPLER_RECT: - return TEXTURE_RECT_INDEX; - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - return TEXTURE_RECT_INDEX; /* XXX fix */ - case SLANG_SPEC_SAMPLER_1D_ARRAY: - return TEXTURE_1D_ARRAY_INDEX; - case SLANG_SPEC_SAMPLER_2D_ARRAY: - return TEXTURE_2D_ARRAY_INDEX; - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - return TEXTURE_1D_ARRAY_INDEX; - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - return TEXTURE_2D_ARRAY_INDEX; - default: - return -1; - } -} - - -/** helper to build a SLANG_OPER_IDENTIFIER node */ -static void -slang_operation_identifier(slang_operation *oper, - slang_assemble_ctx *A, - const char *name) -{ - oper->type = SLANG_OPER_IDENTIFIER; - oper->a_id = slang_atom_pool_atom(A->atoms, name); -} - - -/** - * Called when we begin code/IR generation for a new while/do/for loop. - */ -static void -push_loop(slang_assemble_ctx *A, slang_operation *loopOper, slang_ir_node *loopIR) -{ - A->LoopOperStack[A->LoopDepth] = loopOper; - A->LoopIRStack[A->LoopDepth] = loopIR; - A->LoopDepth++; -} - - -/** - * Called when we end code/IR generation for a new while/do/for loop. - */ -static void -pop_loop(slang_assemble_ctx *A) -{ - assert(A->LoopDepth > 0); - A->LoopDepth--; -} - - -/** - * Return pointer to slang_operation for the loop we're currently inside, - * or NULL if not in a loop. - */ -static const slang_operation * -current_loop_oper(const slang_assemble_ctx *A) -{ - if (A->LoopDepth > 0) - return A->LoopOperStack[A->LoopDepth - 1]; - else - return NULL; -} - - -/** - * Return pointer to slang_ir_node for the loop we're currently inside, - * or NULL if not in a loop. - */ -static slang_ir_node * -current_loop_ir(const slang_assemble_ctx *A) -{ - if (A->LoopDepth > 0) - return A->LoopIRStack[A->LoopDepth - 1]; - else - return NULL; -} - - -/**********************************************************************/ - - -/** - * Map "_asm foo" to IR_FOO, etc. - */ -typedef struct -{ - const char *Name; - slang_ir_opcode Opcode; - GLuint HaveRetValue, NumParams; -} slang_asm_info; - - -static slang_asm_info AsmInfo[] = { - /* vec4 binary op */ - { "vec4_add", IR_ADD, 1, 2 }, - { "vec4_subtract", IR_SUB, 1, 2 }, - { "vec4_multiply", IR_MUL, 1, 2 }, - { "vec4_dot", IR_DOT4, 1, 2 }, - { "vec3_dot", IR_DOT3, 1, 2 }, - { "vec2_dot", IR_DOT2, 1, 2 }, - { "vec3_nrm", IR_NRM3, 1, 1 }, - { "vec4_nrm", IR_NRM4, 1, 1 }, - { "vec3_cross", IR_CROSS, 1, 2 }, - { "vec4_lrp", IR_LRP, 1, 3 }, - { "vec4_min", IR_MIN, 1, 2 }, - { "vec4_max", IR_MAX, 1, 2 }, - { "vec4_cmp", IR_CMP, 1, 3 }, - { "vec4_clamp", IR_CLAMP, 1, 3 }, - { "vec4_seq", IR_SEQUAL, 1, 2 }, - { "vec4_sne", IR_SNEQUAL, 1, 2 }, - { "vec4_sge", IR_SGE, 1, 2 }, - { "vec4_sgt", IR_SGT, 1, 2 }, - { "vec4_sle", IR_SLE, 1, 2 }, - { "vec4_slt", IR_SLT, 1, 2 }, - /* vec4 unary */ - { "vec4_move", IR_MOVE, 1, 1 }, - { "vec4_floor", IR_FLOOR, 1, 1 }, - { "vec4_frac", IR_FRAC, 1, 1 }, - { "vec4_abs", IR_ABS, 1, 1 }, - { "vec4_negate", IR_NEG, 1, 1 }, - { "vec4_ddx", IR_DDX, 1, 1 }, - { "vec4_ddy", IR_DDY, 1, 1 }, - /* float binary op */ - { "float_power", IR_POW, 1, 2 }, - /* texture / sampler */ - { "vec4_tex_1d", IR_TEX, 1, 2 }, - { "vec4_tex_1d_bias", IR_TEXB, 1, 2 }, /* 1d w/ bias */ - { "vec4_tex_1d_proj", IR_TEXP, 1, 2 }, /* 1d w/ projection */ - { "vec4_tex_2d", IR_TEX, 1, 2 }, - { "vec4_tex_2d_bias", IR_TEXB, 1, 2 }, /* 2d w/ bias */ - { "vec4_tex_2d_proj", IR_TEXP, 1, 2 }, /* 2d w/ projection */ - { "vec4_tex_3d", IR_TEX, 1, 2 }, - { "vec4_tex_3d_bias", IR_TEXB, 1, 2 }, /* 3d w/ bias */ - { "vec4_tex_3d_proj", IR_TEXP, 1, 2 }, /* 3d w/ projection */ - { "vec4_tex_cube", IR_TEX, 1, 2 }, /* cubemap */ - { "vec4_tex_rect", IR_TEX, 1, 2 }, /* rectangle */ - { "vec4_tex_rect_bias", IR_TEX, 1, 2 }, /* rectangle w/ projection */ - { "vec4_tex_1d_array", IR_TEX, 1, 2 }, - { "vec4_tex_1d_array_bias", IR_TEXB, 1, 2 }, - { "vec4_tex_1d_array_shadow", IR_TEX, 1, 2 }, - { "vec4_tex_1d_array_bias_shadow", IR_TEXB, 1, 2 }, - { "vec4_tex_2d_array", IR_TEX, 1, 2 }, - { "vec4_tex_2d_array_bias", IR_TEXB, 1, 2 }, - { "vec4_tex_2d_array_shadow", IR_TEX, 1, 2 }, - { "vec4_tex_2d_array_bias_shadow", IR_TEXB, 1, 2 }, - - /* texture / sampler but with shadow comparison */ - { "vec4_tex_1d_shadow", IR_TEX_SH, 1, 2 }, - { "vec4_tex_1d_bias_shadow", IR_TEXB_SH, 1, 2 }, - { "vec4_tex_1d_proj_shadow", IR_TEXP_SH, 1, 2 }, - { "vec4_tex_2d_shadow", IR_TEX_SH, 1, 2 }, - { "vec4_tex_2d_bias_shadow", IR_TEXB_SH, 1, 2 }, - { "vec4_tex_2d_proj_shadow", IR_TEXP_SH, 1, 2 }, - { "vec4_tex_rect_shadow", IR_TEX_SH, 1, 2 }, - { "vec4_tex_rect_proj_shadow", IR_TEXP_SH, 1, 2 }, - - /* unary op */ - { "ivec4_to_vec4", IR_I_TO_F, 1, 1 }, /* int[4] to float[4] */ - { "vec4_to_ivec4", IR_F_TO_I, 1, 1 }, /* float[4] to int[4] */ - { "float_exp", IR_EXP, 1, 1 }, - { "float_exp2", IR_EXP2, 1, 1 }, - { "float_log2", IR_LOG2, 1, 1 }, - { "float_rsq", IR_RSQ, 1, 1 }, - { "float_rcp", IR_RCP, 1, 1 }, - { "float_sine", IR_SIN, 1, 1 }, - { "float_cosine", IR_COS, 1, 1 }, - { "float_noise1", IR_NOISE1, 1, 1}, - { "float_noise2", IR_NOISE2, 1, 1}, - { "float_noise3", IR_NOISE3, 1, 1}, - { "float_noise4", IR_NOISE4, 1, 1}, - - { NULL, IR_NOP, 0, 0 } -}; - - -static slang_ir_node * -new_node3(slang_ir_opcode op, - slang_ir_node *c0, slang_ir_node *c1, slang_ir_node *c2) -{ - slang_ir_node *n = (slang_ir_node *) _slang_alloc(sizeof(slang_ir_node)); - if (n) { - n->Opcode = op; - n->Children[0] = c0; - n->Children[1] = c1; - n->Children[2] = c2; - n->InstLocation = -1; - } - return n; -} - -static slang_ir_node * -new_node2(slang_ir_opcode op, slang_ir_node *c0, slang_ir_node *c1) -{ - return new_node3(op, c0, c1, NULL); -} - -static slang_ir_node * -new_node1(slang_ir_opcode op, slang_ir_node *c0) -{ - return new_node3(op, c0, NULL, NULL); -} - -static slang_ir_node * -new_node0(slang_ir_opcode op) -{ - return new_node3(op, NULL, NULL, NULL); -} - - -/** - * Create sequence of two nodes. - */ -static slang_ir_node * -new_seq(slang_ir_node *left, slang_ir_node *right) -{ - if (!left) - return right; - if (!right) - return left; - return new_node2(IR_SEQ, left, right); -} - -static slang_ir_node * -new_label(slang_label *label) -{ - slang_ir_node *n = new_node0(IR_LABEL); - assert(label); - if (n) - n->Label = label; - return n; -} - -static slang_ir_node * -new_float_literal(const float v[4], GLuint size) -{ - slang_ir_node *n = new_node0(IR_FLOAT); - assert(size <= 4); - COPY_4V(n->Value, v); - /* allocate a storage object, but compute actual location (Index) later */ - n->Store = _slang_new_ir_storage(PROGRAM_CONSTANT, -1, size); - return n; -} - - -static slang_ir_node * -new_not(slang_ir_node *n) -{ - return new_node1(IR_NOT, n); -} - - -/** - * Non-inlined function call. - */ -static slang_ir_node * -new_function_call(slang_ir_node *code, slang_label *name) -{ - slang_ir_node *n = new_node1(IR_CALL, code); - assert(name); - if (n) - n->Label = name; - return n; -} - - -/** - * Unconditional jump. - */ -static slang_ir_node * -new_return(slang_label *dest) -{ - slang_ir_node *n = new_node0(IR_RETURN); - assert(dest); - if (n) - n->Label = dest; - return n; -} - - -static slang_ir_node * -new_loop(slang_ir_node *body) -{ - return new_node1(IR_LOOP, body); -} - - -static slang_ir_node * -new_break(slang_ir_node *loopNode) -{ - slang_ir_node *n = new_node0(IR_BREAK); - assert(loopNode); - assert(loopNode->Opcode == IR_LOOP); - if (n) { - /* insert this node at head of linked list of cont/break instructions */ - n->List = loopNode->List; - loopNode->List = n; - } - return n; -} - - -/** - * Make new IR_BREAK_IF_TRUE. - */ -static slang_ir_node * -new_break_if_true(slang_assemble_ctx *A, slang_ir_node *cond) -{ - slang_ir_node *loopNode = current_loop_ir(A); - slang_ir_node *n; - assert(loopNode); - assert(loopNode->Opcode == IR_LOOP); - n = new_node1(IR_BREAK_IF_TRUE, cond); - if (n) { - /* insert this node at head of linked list of cont/break instructions */ - n->List = loopNode->List; - loopNode->List = n; - } - return n; -} - - -/** - * Make new IR_CONT_IF_TRUE node. - */ -static slang_ir_node * -new_cont_if_true(slang_assemble_ctx *A, slang_ir_node *cond) -{ - slang_ir_node *loopNode = current_loop_ir(A); - slang_ir_node *n; - assert(loopNode); - assert(loopNode->Opcode == IR_LOOP); - n = new_node1(IR_CONT_IF_TRUE, cond); - if (n) { - n->Parent = loopNode; /* pointer to containing loop */ - /* insert this node at head of linked list of cont/break instructions */ - n->List = loopNode->List; - loopNode->List = n; - } - return n; -} - - -static slang_ir_node * -new_cond(slang_ir_node *n) -{ - slang_ir_node *c = new_node1(IR_COND, n); - return c; -} - - -static slang_ir_node * -new_if(slang_ir_node *cond, slang_ir_node *ifPart, slang_ir_node *elsePart) -{ - return new_node3(IR_IF, cond, ifPart, elsePart); -} - - -/** - * New IR_VAR node - a reference to a previously declared variable. - */ -static slang_ir_node * -new_var(slang_assemble_ctx *A, slang_variable *var) -{ - slang_ir_node *n = new_node0(IR_VAR); - if (n) { - ASSERT(var); - ASSERT(var->store); - ASSERT(!n->Store); - ASSERT(!n->Var); - - /* Set IR node's Var and Store pointers */ - n->Var = var; - n->Store = var->store; - } - return n; -} - - -/** - * Check if the given function is really just a wrapper for a - * basic assembly instruction. - */ -static GLboolean -slang_is_asm_function(const slang_function *fun) -{ - if (fun->body->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE && - fun->body->num_children == 1 && - fun->body->children[0].type == SLANG_OPER_ASM) { - return GL_TRUE; - } - return GL_FALSE; -} - - -static GLboolean -_slang_is_noop(const slang_operation *oper) -{ - if (!oper || - oper->type == SLANG_OPER_VOID || - (oper->num_children == 1 && oper->children[0].type == SLANG_OPER_VOID)) - return GL_TRUE; - else - return GL_FALSE; -} - - -/** - * Recursively search tree for a node of the given type. - */ -#if 0 -static slang_operation * -_slang_find_node_type(slang_operation *oper, slang_operation_type type) -{ - GLuint i; - if (oper->type == type) - return oper; - for (i = 0; i < oper->num_children; i++) { - slang_operation *p = _slang_find_node_type(&oper->children[i], type); - if (p) - return p; - } - return NULL; -} -#endif - - -/** - * Count the number of operations of the given time rooted at 'oper'. - */ -static GLuint -_slang_count_node_type(const slang_operation *oper, slang_operation_type type) -{ - GLuint i, count = 0; - if (oper->type == type) { - return 1; - } - for (i = 0; i < oper->num_children; i++) { - count += _slang_count_node_type(&oper->children[i], type); - } - return count; -} - - -/** - * Check if the 'return' statement found under 'oper' is a "tail return" - * that can be no-op'd. For example: - * - * void func(void) - * { - * .. do something .. - * return; // this is a no-op - * } - * - * This is used when determining if a function can be inlined. If the - * 'return' is not the last statement, we can't inline the function since - * we still need the semantic behaviour of the 'return' but we don't want - * to accidentally return from the _calling_ function. We'd need to use an - * unconditional branch, but we don't have such a GPU instruction (not - * always, at least). - */ -static GLboolean -_slang_is_tail_return(const slang_operation *oper) -{ - GLuint k = oper->num_children; - - while (k > 0) { - const slang_operation *last = &oper->children[k - 1]; - if (last->type == SLANG_OPER_RETURN) - return GL_TRUE; - else if (last->type == SLANG_OPER_IDENTIFIER || - last->type == SLANG_OPER_LABEL) - k--; /* try prev child */ - else if (last->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE || - last->type == SLANG_OPER_BLOCK_NEW_SCOPE) - /* try sub-children */ - return _slang_is_tail_return(last); - else - break; - } - - return GL_FALSE; -} - - -/** - * Generate a variable declaration opeartion. - * I.e.: generate AST code for "bool flag = false;" - */ -static void -slang_generate_declaration(slang_assemble_ctx *A, - slang_variable_scope *scope, - slang_operation *decl, - slang_type_specifier_type type, - const char *name, - GLint initValue) -{ - slang_variable *var; - - assert(type == SLANG_SPEC_BOOL || - type == SLANG_SPEC_INT); - - decl->type = SLANG_OPER_VARIABLE_DECL; - - var = slang_variable_scope_grow(scope); - - slang_fully_specified_type_construct(&var->type); - - var->type.specifier.type = type; - var->a_name = slang_atom_pool_atom(A->atoms, name); - decl->a_id = var->a_name; - var->initializer = slang_operation_new(1); - slang_operation_literal_bool(var->initializer, initValue); -} - - -static void -slang_resolve_variable(slang_operation *oper) -{ - if (oper->type == SLANG_OPER_IDENTIFIER && !oper->var) { - oper->var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - } -} - - -/** - * Rewrite AST code for "return expression;". - * - * We return values from functions by assinging the returned value to - * the hidden __retVal variable which is an extra 'out' parameter we add - * to the function signature. - * This code basically converts "return expr;" into "__retVal = expr; return;" - * - * \return the new AST code. - */ -static slang_operation * -gen_return_with_expression(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *blockOper, *assignOper; - - assert(oper->type == SLANG_OPER_RETURN); - - if (A->CurFunction->header.type.specifier.type == SLANG_SPEC_VOID) { - slang_info_log_error(A->log, "illegal return expression"); - return NULL; - } - - blockOper = slang_operation_new(1); - blockOper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; - blockOper->locals->outer_scope = oper->locals->outer_scope; - slang_operation_add_children(blockOper, 2); - - if (A->UseReturnFlag) { - /* Emit: - * { - * if (__notRetFlag) - * __retVal = expr; - * __notRetFlag = 0; - * } - */ - { - slang_operation *ifOper = slang_oper_child(blockOper, 0); - ifOper->type = SLANG_OPER_IF; - slang_operation_add_children(ifOper, 3); - { - slang_operation *cond = slang_oper_child(ifOper, 0); - cond->type = SLANG_OPER_IDENTIFIER; - cond->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); - } - { - slang_operation *elseOper = slang_oper_child(ifOper, 2); - elseOper->type = SLANG_OPER_VOID; - } - assignOper = slang_oper_child(ifOper, 1); - } - { - slang_operation *setOper = slang_oper_child(blockOper, 1); - setOper->type = SLANG_OPER_ASSIGN; - slang_operation_add_children(setOper, 2); - { - slang_operation *lhs = slang_oper_child(setOper, 0); - lhs->type = SLANG_OPER_IDENTIFIER; - lhs->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); - } - { - slang_operation *rhs = slang_oper_child(setOper, 1); - slang_operation_literal_bool(rhs, GL_FALSE); - } - } - } - else { - /* Emit: - * { - * __retVal = expr; - * return_inlined; - * } - */ - assignOper = slang_oper_child(blockOper, 0); - { - slang_operation *returnOper = slang_oper_child(blockOper, 1); - returnOper->type = SLANG_OPER_RETURN_INLINED; - assert(returnOper->num_children == 0); - } - } - - /* __retVal = expression; */ - assignOper->type = SLANG_OPER_ASSIGN; - slang_operation_add_children(assignOper, 2); - { - slang_operation *lhs = slang_oper_child(assignOper, 0); - lhs->type = SLANG_OPER_IDENTIFIER; - lhs->a_id = slang_atom_pool_atom(A->atoms, "__retVal"); - } - { - slang_operation *rhs = slang_oper_child(assignOper, 1); - slang_operation_copy(rhs, &oper->children[0]); - } - - /*blockOper->locals->outer_scope = oper->locals->outer_scope;*/ - - /*slang_print_tree(blockOper, 0);*/ - - return blockOper; -} - - -/** - * Rewrite AST code for "return;" (no expression). - */ -static slang_operation * -gen_return_without_expression(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *newRet; - - assert(oper->type == SLANG_OPER_RETURN); - - if (A->CurFunction->header.type.specifier.type != SLANG_SPEC_VOID) { - slang_info_log_error(A->log, "return statement requires an expression"); - return NULL; - } - - if (A->UseReturnFlag) { - /* Emit: - * __notRetFlag = 0; - */ - { - newRet = slang_operation_new(1); - newRet->locals->outer_scope = oper->locals->outer_scope; - newRet->type = SLANG_OPER_ASSIGN; - slang_operation_add_children(newRet, 2); - { - slang_operation *lhs = slang_oper_child(newRet, 0); - lhs->type = SLANG_OPER_IDENTIFIER; - lhs->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); - } - { - slang_operation *rhs = slang_oper_child(newRet, 1); - slang_operation_literal_bool(rhs, GL_FALSE); - } - } - } - else { - /* Emit: - * return_inlined; - */ - newRet = slang_operation_new(1); - newRet->locals->outer_scope = oper->locals->outer_scope; - newRet->type = SLANG_OPER_RETURN_INLINED; - } - - /*slang_print_tree(newRet, 0);*/ - - return newRet; -} - - - - -/** - * Replace particular variables (SLANG_OPER_IDENTIFIER) with new expressions. - */ -static void -slang_substitute(slang_assemble_ctx *A, slang_operation *oper, - GLuint substCount, slang_variable **substOld, - slang_operation **substNew, GLboolean isLHS) -{ - switch (oper->type) { - case SLANG_OPER_VARIABLE_DECL: - { - slang_variable *v = _slang_variable_locate(oper->locals, - oper->a_id, GL_TRUE); - assert(v); - if (v->initializer && oper->num_children == 0) { - /* set child of oper to copy of initializer */ - oper->num_children = 1; - oper->children = slang_operation_new(1); - slang_operation_copy(&oper->children[0], v->initializer); - } - if (oper->num_children == 1) { - /* the initializer */ - slang_substitute(A, &oper->children[0], substCount, - substOld, substNew, GL_FALSE); - } - } - break; - case SLANG_OPER_IDENTIFIER: - assert(oper->num_children == 0); - if (1/**!isLHS XXX FIX */) { - slang_atom id = oper->a_id; - slang_variable *v; - GLuint i; - v = _slang_variable_locate(oper->locals, id, GL_TRUE); - if (!v) { - if (strcmp((char *) oper->a_id, "__notRetFlag")) - _mesa_problem(NULL, "var %s not found!\n", (char *) oper->a_id); - return; - } - - /* look for a substitution */ - for (i = 0; i < substCount; i++) { - if (v == substOld[i]) { - /* OK, replace this SLANG_OPER_IDENTIFIER with a new expr */ -#if 0 /* DEBUG only */ - if (substNew[i]->type == SLANG_OPER_IDENTIFIER) { - assert(substNew[i]->var); - assert(substNew[i]->var->a_name); - printf("Substitute %s with %s in id node %p\n", - (char*)v->a_name, (char*) substNew[i]->var->a_name, - (void*) oper); - } - else { - printf("Substitute %s with %f in id node %p\n", - (char*)v->a_name, substNew[i]->literal[0], - (void*) oper); - } -#endif - slang_operation_copy(oper, substNew[i]); - break; - } - } - } - break; - - case SLANG_OPER_RETURN: - { - slang_operation *newReturn; - /* generate new 'return' code' */ - if (slang_oper_child(oper, 0)->type == SLANG_OPER_VOID) - newReturn = gen_return_without_expression(A, oper); - else - newReturn = gen_return_with_expression(A, oper); - - if (!newReturn) - return; - - /* do substitutions on the new 'return' code */ - slang_substitute(A, newReturn, - substCount, substOld, substNew, GL_FALSE); - - /* install new 'return' code */ - slang_operation_copy(oper, newReturn); - slang_operation_destruct(newReturn); - } - break; - - case SLANG_OPER_ASSIGN: - case SLANG_OPER_SUBSCRIPT: - /* special case: - * child[0] can't have substitutions but child[1] can. - */ - slang_substitute(A, &oper->children[0], - substCount, substOld, substNew, GL_TRUE); - slang_substitute(A, &oper->children[1], - substCount, substOld, substNew, GL_FALSE); - break; - case SLANG_OPER_FIELD: - /* XXX NEW - test */ - slang_substitute(A, &oper->children[0], - substCount, substOld, substNew, GL_TRUE); - break; - default: - { - GLuint i; - for (i = 0; i < oper->num_children; i++) - slang_substitute(A, &oper->children[i], - substCount, substOld, substNew, GL_FALSE); - } - } -} - - -/** - * Produce inline code for a call to an assembly instruction. - * This is typically used to compile a call to a built-in function like this: - * - * vec4 mix(const vec4 x, const vec4 y, const vec4 a) - * { - * __asm vec4_lrp __retVal, a, y, x; - * } - * - * - * A call to - * r = mix(p1, p2, p3); - * - * Becomes: - * - * mov - * / \ - * r vec4_lrp - * / | \ - * p3 p2 p1 - * - * We basically translate a SLANG_OPER_CALL into a SLANG_OPER_ASM. - */ -static slang_operation * -slang_inline_asm_function(slang_assemble_ctx *A, - slang_function *fun, slang_operation *oper) -{ - const GLuint numArgs = oper->num_children; - GLuint i; - slang_operation *inlined; - const GLboolean haveRetValue = _slang_function_has_return_value(fun); - slang_variable **substOld; - slang_operation **substNew; - - ASSERT(slang_is_asm_function(fun)); - ASSERT(fun->param_count == numArgs + haveRetValue); - - /* - printf("Inline %s as %s\n", - (char*) fun->header.a_name, - (char*) fun->body->children[0].a_id); - */ - - /* - * We'll substitute formal params with actual args in the asm call. - */ - substOld = (slang_variable **) - _slang_alloc(numArgs * sizeof(slang_variable *)); - substNew = (slang_operation **) - _slang_alloc(numArgs * sizeof(slang_operation *)); - for (i = 0; i < numArgs; i++) { - substOld[i] = fun->parameters->variables[i]; - substNew[i] = oper->children + i; - } - - /* make a copy of the code to inline */ - inlined = slang_operation_new(1); - slang_operation_copy(inlined, &fun->body->children[0]); - if (haveRetValue) { - /* get rid of the __retVal child */ - inlined->num_children--; - for (i = 0; i < inlined->num_children; i++) { - inlined->children[i] = inlined->children[i + 1]; - } - } - - /* now do formal->actual substitutions */ - slang_substitute(A, inlined, numArgs, substOld, substNew, GL_FALSE); - - _slang_free(substOld); - _slang_free(substNew); - -#if 0 - printf("+++++++++++++ inlined asm function %s +++++++++++++\n", - (char *) fun->header.a_name); - slang_print_tree(inlined, 3); - printf("+++++++++++++++++++++++++++++++++++++++++++++++++++\n"); -#endif - - return inlined; -} - - -/** - * Inline the given function call operation. - * Return a new slang_operation that corresponds to the inlined code. - */ -static slang_operation * -slang_inline_function_call(slang_assemble_ctx * A, slang_function *fun, - slang_operation *oper, slang_operation *returnOper) -{ - typedef enum { - SUBST = 1, - COPY_IN, - COPY_OUT - } ParamMode; - ParamMode *paramMode; - const GLboolean haveRetValue = _slang_function_has_return_value(fun); - const GLuint numArgs = oper->num_children; - const GLuint totalArgs = numArgs + haveRetValue; - slang_operation *args = oper->children; - slang_operation *inlined, *top; - slang_variable **substOld; - slang_operation **substNew; - GLuint substCount, numCopyIn, i; - slang_function *prevFunction; - slang_variable_scope *newScope = NULL; - - /* save / push */ - prevFunction = A->CurFunction; - A->CurFunction = fun; - - /*assert(oper->type == SLANG_OPER_CALL); (or (matrix) multiply, etc) */ - assert(fun->param_count == totalArgs); - - /* allocate temporary arrays */ - paramMode = (ParamMode *) - _slang_alloc(totalArgs * sizeof(ParamMode)); - substOld = (slang_variable **) - _slang_alloc(totalArgs * sizeof(slang_variable *)); - substNew = (slang_operation **) - _slang_alloc(totalArgs * sizeof(slang_operation *)); - -#if 0 - printf("\nInline call to %s (total vars=%d nparams=%d)\n", - (char *) fun->header.a_name, - fun->parameters->num_variables, numArgs); -#endif - - if (haveRetValue && !returnOper) { - /* Create 3-child comma sequence for inlined code: - * child[0]: declare __resultTmp - * child[1]: inlined function body - * child[2]: __resultTmp - */ - slang_operation *commaSeq; - slang_operation *declOper = NULL; - slang_variable *resultVar; - - commaSeq = slang_operation_new(1); - commaSeq->type = SLANG_OPER_SEQUENCE; - assert(commaSeq->locals); - commaSeq->locals->outer_scope = oper->locals->outer_scope; - commaSeq->num_children = 3; - commaSeq->children = slang_operation_new(3); - /* allocate the return var */ - resultVar = slang_variable_scope_grow(commaSeq->locals); - /* - printf("Alloc __resultTmp in scope %p for retval of calling %s\n", - (void*)commaSeq->locals, (char *) fun->header.a_name); - */ - - resultVar->a_name = slang_atom_pool_atom(A->atoms, "__resultTmp"); - resultVar->type = fun->header.type; /* XXX copy? */ - resultVar->isTemp = GL_TRUE; - - /* child[0] = __resultTmp declaration */ - declOper = &commaSeq->children[0]; - declOper->type = SLANG_OPER_VARIABLE_DECL; - declOper->a_id = resultVar->a_name; - declOper->locals->outer_scope = commaSeq->locals; - - /* child[1] = function body */ - inlined = &commaSeq->children[1]; - inlined->locals->outer_scope = commaSeq->locals; - - /* child[2] = __resultTmp reference */ - returnOper = &commaSeq->children[2]; - returnOper->type = SLANG_OPER_IDENTIFIER; - returnOper->a_id = resultVar->a_name; - returnOper->locals->outer_scope = commaSeq->locals; - - top = commaSeq; - } - else { - top = inlined = slang_operation_new(1); - /* XXXX this may be inappropriate!!!! */ - inlined->locals->outer_scope = oper->locals->outer_scope; - } - - - assert(inlined->locals); - - /* Examine the parameters, look for inout/out params, look for possible - * substitutions, etc: - * param type behaviour - * in copy actual to local - * const in substitute param with actual - * out copy out - */ - substCount = 0; - for (i = 0; i < totalArgs; i++) { - slang_variable *p = fun->parameters->variables[i]; - /* - printf("Param %d: %s %s \n", i, - slang_type_qual_string(p->type.qualifier), - (char *) p->a_name); - */ - if (p->type.qualifier == SLANG_QUAL_INOUT || - p->type.qualifier == SLANG_QUAL_OUT) { - /* an output param */ - slang_operation *arg; - if (i < numArgs) - arg = &args[i]; - else - arg = returnOper; - paramMode[i] = SUBST; - - if (arg->type == SLANG_OPER_IDENTIFIER) - slang_resolve_variable(arg); - - /* replace parameter 'p' with argument 'arg' */ - substOld[substCount] = p; - substNew[substCount] = arg; /* will get copied */ - substCount++; - } - else if (p->type.qualifier == SLANG_QUAL_CONST) { - /* a constant input param */ - if (args[i].type == SLANG_OPER_IDENTIFIER || - args[i].type == SLANG_OPER_LITERAL_FLOAT || - args[i].type == SLANG_OPER_SUBSCRIPT) { - /* replace all occurances of this parameter variable with the - * actual argument variable or a literal. - */ - paramMode[i] = SUBST; - slang_resolve_variable(&args[i]); - substOld[substCount] = p; - substNew[substCount] = &args[i]; /* will get copied */ - substCount++; - } - else { - paramMode[i] = COPY_IN; - } - } - else { - paramMode[i] = COPY_IN; - } - assert(paramMode[i]); - } - - /* actual code inlining: */ - slang_operation_copy(inlined, fun->body); - - /*** XXX review this */ - assert(inlined->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE || - inlined->type == SLANG_OPER_BLOCK_NEW_SCOPE); - inlined->type = SLANG_OPER_BLOCK_NEW_SCOPE; - -#if 0 - printf("======================= orig body code ======================\n"); - printf("=== params scope = %p\n", (void*) fun->parameters); - slang_print_tree(fun->body, 8); - printf("======================= copied code =========================\n"); - slang_print_tree(inlined, 8); -#endif - - /* do parameter substitution in inlined code: */ - slang_substitute(A, inlined, substCount, substOld, substNew, GL_FALSE); - -#if 0 - printf("======================= subst code ==========================\n"); - slang_print_tree(inlined, 8); - printf("=============================================================\n"); -#endif - - /* New prolog statements: (inserted before the inlined code) - * Copy the 'in' arguments. - */ - numCopyIn = 0; - for (i = 0; i < numArgs; i++) { - if (paramMode[i] == COPY_IN) { - slang_variable *p = fun->parameters->variables[i]; - /* declare parameter 'p' */ - slang_operation *decl = slang_operation_insert(&inlined->num_children, - &inlined->children, - numCopyIn); - - decl->type = SLANG_OPER_VARIABLE_DECL; - assert(decl->locals); - decl->locals->outer_scope = inlined->locals; - decl->a_id = p->a_name; - decl->num_children = 1; - decl->children = slang_operation_new(1); - - /* child[0] is the var's initializer */ - slang_operation_copy(&decl->children[0], args + i); - - /* add parameter 'p' to the local variable scope here */ - { - slang_variable *pCopy = slang_variable_scope_grow(inlined->locals); - pCopy->type = p->type; - pCopy->a_name = p->a_name; - pCopy->array_len = p->array_len; - } - - newScope = inlined->locals; - numCopyIn++; - } - } - - /* Now add copies of the function's local vars to the new variable scope */ - for (i = totalArgs; i < fun->parameters->num_variables; i++) { - slang_variable *p = fun->parameters->variables[i]; - slang_variable *pCopy = slang_variable_scope_grow(inlined->locals); - pCopy->type = p->type; - pCopy->a_name = p->a_name; - pCopy->array_len = p->array_len; - } - - - /* New epilog statements: - * 1. Create end of function label to jump to from return statements. - * 2. Copy the 'out' parameter vars - */ - { - slang_operation *lab = slang_operation_insert(&inlined->num_children, - &inlined->children, - inlined->num_children); - lab->type = SLANG_OPER_LABEL; - lab->label = A->curFuncEndLabel; - } - - for (i = 0; i < totalArgs; i++) { - if (paramMode[i] == COPY_OUT) { - const slang_variable *p = fun->parameters->variables[i]; - /* actualCallVar = outParam */ - /*if (i > 0 || !haveRetValue)*/ - slang_operation *ass = slang_operation_insert(&inlined->num_children, - &inlined->children, - inlined->num_children); - ass->type = SLANG_OPER_ASSIGN; - ass->num_children = 2; - ass->locals->outer_scope = inlined->locals; - ass->children = slang_operation_new(2); - ass->children[0] = args[i]; /*XXX copy */ - ass->children[1].type = SLANG_OPER_IDENTIFIER; - ass->children[1].a_id = p->a_name; - ass->children[1].locals->outer_scope = ass->locals; - } - } - - _slang_free(paramMode); - _slang_free(substOld); - _slang_free(substNew); - - /* Update scoping to use the new local vars instead of the - * original function's vars. This is especially important - * for nested inlining. - */ - if (newScope) - slang_replace_scope(inlined, fun->parameters, newScope); - -#if 0 - printf("Done Inline call to %s (total vars=%d nparams=%d)\n\n", - (char *) fun->header.a_name, - fun->parameters->num_variables, numArgs); - slang_print_tree(top, 0); -#endif - - /* pop */ - A->CurFunction = prevFunction; - - return top; -} - - -/** - * Insert declaration for "bool __notRetFlag" in given block operation. - * This is used when we can't emit "early" return statements in subroutines. - */ -static void -declare_return_flag(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *decl; - - assert(oper->type == SLANG_OPER_BLOCK_NEW_SCOPE || - oper->type == SLANG_OPER_SEQUENCE); - - decl = slang_operation_insert_child(oper, 1); - - slang_generate_declaration(A, oper->locals, decl, - SLANG_SPEC_BOOL, "__notRetFlag", GL_TRUE); - - /*slang_print_tree(oper, 0);*/ -} - - -/** - * Recursively replace instances of the old node type with the new type. - */ -static void -replace_node_type(slang_operation *oper, slang_operation_type oldType, - slang_operation_type newType) -{ - GLuint i; - - if (oper->type == oldType) - oper->type = newType; - - for (i = 0; i < slang_oper_num_children(oper); i++) { - replace_node_type(slang_oper_child(oper, i), oldType, newType); - } -} - - - -/** - * Test if the given function body has an "early return". That is, there's - * a 'return' statement that's not the very last instruction in the body. - */ -static GLboolean -has_early_return(const slang_operation *funcBody) -{ - GLuint retCount = _slang_count_node_type(funcBody, SLANG_OPER_RETURN); - if (retCount == 0) - return GL_FALSE; - else if (retCount == 1 && _slang_is_tail_return(funcBody)) - return GL_FALSE; - else - return GL_TRUE; -} - - -/** - * Emit IR code for a function call. This does one of two things: - * 1. Inline the function's code - * 2. Create an IR for the function's body and create a real call to it. - */ -static slang_ir_node * -_slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun, - slang_operation *oper, slang_operation *dest) -{ - slang_ir_node *n; - slang_operation *instance; - slang_label *prevFuncEndLabel; - char name[200]; - - prevFuncEndLabel = A->curFuncEndLabel; - sprintf(name, "__endOfFunc_%s_", (char *) fun->header.a_name); - A->curFuncEndLabel = _slang_label_new(name); - assert(A->curFuncEndLabel); - - /* - * 'instance' is basically a copy of the function's body with various - * transformations. - */ - - if (slang_is_asm_function(fun) && !dest) { - /* assemble assembly function - tree style */ - instance = slang_inline_asm_function(A, fun, oper); - } - else { - /* non-assembly function */ - /* We always generate an "inline-able" block of code here. - * We may either: - * 1. insert the inline code - * 2. Generate a call to the "inline" code as a subroutine - */ - const GLboolean earlyReturn = has_early_return(fun->body); - - if (earlyReturn && !A->EmitContReturn) { - A->UseReturnFlag = GL_TRUE; - } - - instance = slang_inline_function_call(A, fun, oper, dest); - if (!instance) - return NULL; - - if (earlyReturn) { - /* The function we're calling has one or more 'return' statements - * that prevent us from inlining the function's code. - * - * In this case, change the function's body type from - * SLANG_OPER_BLOCK_NEW_SCOPE to SLANG_OPER_NON_INLINED_CALL. - * During code emit this will result in a true subroutine call. - * - * Also, convert SLANG_OPER_RETURN_INLINED nodes to SLANG_OPER_RETURN. - */ - slang_operation *callOper; - - assert(instance->type == SLANG_OPER_BLOCK_NEW_SCOPE || - instance->type == SLANG_OPER_SEQUENCE); - - if (_slang_function_has_return_value(fun) && !dest) { - assert(instance->children[0].type == SLANG_OPER_VARIABLE_DECL); - assert(instance->children[2].type == SLANG_OPER_IDENTIFIER); - callOper = &instance->children[1]; - } - else { - callOper = instance; - } - - if (A->UseReturnFlag) { - /* Early returns not supported. Create a _returnFlag variable - * that's set upon 'return' and tested elsewhere to no-op any - * remaining instructions in the subroutine. - */ - assert(callOper->type == SLANG_OPER_BLOCK_NEW_SCOPE || - callOper->type == SLANG_OPER_SEQUENCE); - declare_return_flag(A, callOper); - } - else { - /* We can emit real 'return' statements. If we generated any - * 'inline return' statements during function instantiation, - * change them back to regular 'return' statements. - */ - replace_node_type(instance, SLANG_OPER_RETURN_INLINED, - SLANG_OPER_RETURN); - } - - callOper->type = SLANG_OPER_NON_INLINED_CALL; - callOper->fun = fun; - callOper->label = _slang_label_new_unique((char*) fun->header.a_name); - } - else { - /* If there are any 'return' statements remaining, they're at the - * very end of the function and can effectively become no-ops. - */ - replace_node_type(instance, SLANG_OPER_RETURN_INLINED, - SLANG_OPER_VOID); - } - } - - if (!instance) - return NULL; - - /* Replace the function call with the instance block (or new CALL stmt) */ - slang_operation_destruct(oper); - *oper = *instance; - _slang_free(instance); - -#if 0 - assert(instance->locals); - printf("*** Inlined code for call to %s:\n", (char*) fun->header.a_name); - slang_print_tree(oper, 10); - printf("\n"); -#endif - - n = _slang_gen_operation(A, oper); - - /*_slang_label_delete(A->curFuncEndLabel);*/ - A->curFuncEndLabel = prevFuncEndLabel; - - if (A->pragmas->Debug) { - char s[1000]; - _mesa_snprintf(s, sizeof(s), "Call/inline %s()", (char *) fun->header.a_name); - n->Comment = _slang_strdup(s); - } - - A->UseReturnFlag = GL_FALSE; - - return n; -} - - -static slang_asm_info * -slang_find_asm_info(const char *name) -{ - GLuint i; - for (i = 0; AsmInfo[i].Name; i++) { - if (strcmp(AsmInfo[i].Name, name) == 0) { - return AsmInfo + i; - } - } - return NULL; -} - - -/** - * Some write-masked assignments are simple, but others are hard. - * Simple example: - * vec3 v; - * v.xy = vec2(a, b); - * Hard example: - * vec3 v; - * v.zy = vec2(a, b); - * this gets transformed/swizzled into: - * v.zy = vec2(a, b).*yx* (* = don't care) - * This function helps to determine simple vs. non-simple. - */ -static GLboolean -_slang_simple_writemask(GLuint writemask, GLuint swizzle) -{ - switch (writemask) { - case WRITEMASK_X: - return GET_SWZ(swizzle, 0) == SWIZZLE_X; - case WRITEMASK_Y: - return GET_SWZ(swizzle, 1) == SWIZZLE_Y; - case WRITEMASK_Z: - return GET_SWZ(swizzle, 2) == SWIZZLE_Z; - case WRITEMASK_W: - return GET_SWZ(swizzle, 3) == SWIZZLE_W; - case WRITEMASK_XY: - return (GET_SWZ(swizzle, 0) == SWIZZLE_X) - && (GET_SWZ(swizzle, 1) == SWIZZLE_Y); - case WRITEMASK_XYZ: - return (GET_SWZ(swizzle, 0) == SWIZZLE_X) - && (GET_SWZ(swizzle, 1) == SWIZZLE_Y) - && (GET_SWZ(swizzle, 2) == SWIZZLE_Z); - case WRITEMASK_XYZW: - return swizzle == SWIZZLE_NOOP; - default: - return GL_FALSE; - } -} - - -/** - * Convert the given swizzle into a writemask. In some cases this - * is trivial, in other cases, we'll need to also swizzle the right - * hand side to put components in the right places. - * See comment above for more info. - * XXX this function could be simplified and should probably be renamed. - * \param swizzle the incoming swizzle - * \param writemaskOut returns the writemask - * \param swizzleOut swizzle to apply to the right-hand-side - * \return GL_FALSE for simple writemasks, GL_TRUE for non-simple - */ -static GLboolean -swizzle_to_writemask(slang_assemble_ctx *A, GLuint swizzle, - GLuint *writemaskOut, GLuint *swizzleOut) -{ - GLuint mask = 0x0, newSwizzle[4]; - GLint i, size; - - /* make new dst writemask, compute size */ - for (i = 0; i < 4; i++) { - const GLuint swz = GET_SWZ(swizzle, i); - if (swz == SWIZZLE_NIL) { - /* end */ - break; - } - assert(swz <= 3); - - if (swizzle != SWIZZLE_XXXX && - swizzle != SWIZZLE_YYYY && - swizzle != SWIZZLE_ZZZZ && - swizzle != SWIZZLE_WWWW && - (mask & (1 << swz))) { - /* a channel can't be specified twice (ex: ".xyyz") */ - slang_info_log_error(A->log, "Invalid writemask '%s'", - _mesa_swizzle_string(swizzle, 0, 0)); - return GL_FALSE; - } - - mask |= (1 << swz); - } - assert(mask <= 0xf); - size = i; /* number of components in mask/swizzle */ - - *writemaskOut = mask; - - /* make new src swizzle, by inversion */ - for (i = 0; i < 4; i++) { - newSwizzle[i] = i; /*identity*/ - } - for (i = 0; i < size; i++) { - const GLuint swz = GET_SWZ(swizzle, i); - newSwizzle[swz] = i; - } - *swizzleOut = MAKE_SWIZZLE4(newSwizzle[0], - newSwizzle[1], - newSwizzle[2], - newSwizzle[3]); - - if (_slang_simple_writemask(mask, *swizzleOut)) { - if (size >= 1) - assert(GET_SWZ(*swizzleOut, 0) == SWIZZLE_X); - if (size >= 2) - assert(GET_SWZ(*swizzleOut, 1) == SWIZZLE_Y); - if (size >= 3) - assert(GET_SWZ(*swizzleOut, 2) == SWIZZLE_Z); - if (size >= 4) - assert(GET_SWZ(*swizzleOut, 3) == SWIZZLE_W); - return GL_TRUE; - } - else - return GL_FALSE; -} - - -#if 0 /* not used, but don't remove just yet */ -/** - * Recursively traverse 'oper' to produce a swizzle mask in the event - * of any vector subscripts and swizzle suffixes. - * Ex: for "vec4 v", "v[2].x" resolves to v.z - */ -static GLuint -resolve_swizzle(const slang_operation *oper) -{ - if (oper->type == SLANG_OPER_FIELD) { - /* writemask from .xyzw suffix */ - slang_swizzle swz; - if (_slang_is_swizzle((char*) oper->a_id, 4, &swz)) { - GLuint swizzle = MAKE_SWIZZLE4(swz.swizzle[0], - swz.swizzle[1], - swz.swizzle[2], - swz.swizzle[3]); - GLuint child_swizzle = resolve_swizzle(&oper->children[0]); - GLuint s = _slang_swizzle_swizzle(child_swizzle, swizzle); - return s; - } - else - return SWIZZLE_XYZW; - } - else if (oper->type == SLANG_OPER_SUBSCRIPT && - oper->children[1].type == SLANG_OPER_LITERAL_INT) { - /* writemask from [index] */ - GLuint child_swizzle = resolve_swizzle(&oper->children[0]); - GLuint i = (GLuint) oper->children[1].literal[0]; - GLuint swizzle; - GLuint s; - switch (i) { - case 0: - swizzle = SWIZZLE_XXXX; - break; - case 1: - swizzle = SWIZZLE_YYYY; - break; - case 2: - swizzle = SWIZZLE_ZZZZ; - break; - case 3: - swizzle = SWIZZLE_WWWW; - break; - default: - swizzle = SWIZZLE_XYZW; - } - s = _slang_swizzle_swizzle(child_swizzle, swizzle); - return s; - } - else { - return SWIZZLE_XYZW; - } -} -#endif - - -#if 0 -/** - * Recursively descend through swizzle nodes to find the node's storage info. - */ -static slang_ir_storage * -get_store(const slang_ir_node *n) -{ - if (n->Opcode == IR_SWIZZLE) { - return get_store(n->Children[0]); - } - return n->Store; -} -#endif - - -/** - * Generate IR tree for an asm instruction/operation such as: - * __asm vec4_dot __retVal.x, v1, v2; - */ -static slang_ir_node * -_slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper, - slang_operation *dest) -{ - const slang_asm_info *info; - slang_ir_node *kids[3], *n; - GLuint j, firstOperand; - - assert(oper->type == SLANG_OPER_ASM); - - info = slang_find_asm_info((char *) oper->a_id); - if (!info) { - _mesa_problem(NULL, "undefined __asm function %s\n", - (char *) oper->a_id); - assert(info); - return NULL; - } - assert(info->NumParams <= 3); - - if (info->NumParams == oper->num_children) { - /* Storage for result is not specified. - * Children[0], [1], [2] are the operands. - */ - firstOperand = 0; - } - else { - /* Storage for result (child[0]) is specified. - * Children[1], [2], [3] are the operands. - */ - firstOperand = 1; - } - - /* assemble child(ren) */ - kids[0] = kids[1] = kids[2] = NULL; - for (j = 0; j < info->NumParams; j++) { - kids[j] = _slang_gen_operation(A, &oper->children[firstOperand + j]); - if (!kids[j]) - return NULL; - } - - n = new_node3(info->Opcode, kids[0], kids[1], kids[2]); - - if (firstOperand) { - /* Setup n->Store to be a particular location. Otherwise, storage - * for the result (a temporary) will be allocated later. - */ - slang_operation *dest_oper; - slang_ir_node *n0; - - dest_oper = &oper->children[0]; - - n0 = _slang_gen_operation(A, dest_oper); - if (!n0) - return NULL; - - assert(!n->Store); - n->Store = n0->Store; - - assert(n->Store->File != PROGRAM_UNDEFINED || n->Store->Parent); - - _slang_free(n0); - } - - return n; -} - - -#if 0 -static void -print_funcs(struct slang_function_scope_ *scope, const char *name) -{ - GLuint i; - for (i = 0; i < scope->num_functions; i++) { - slang_function *f = &scope->functions[i]; - if (!name || strcmp(name, (char*) f->header.a_name) == 0) - printf(" %s (%d args)\n", name, f->param_count); - - } - if (scope->outer_scope) - print_funcs(scope->outer_scope, name); -} -#endif - - -/** - * Find a function of the given name, taking 'numArgs' arguments. - * This is the function we'll try to call when there is no exact match - * between function parameters and call arguments. - * - * XXX we should really create a list of candidate functions and try - * all of them... - */ -static slang_function * -_slang_find_function_by_argc(slang_function_scope *scope, - const char *name, int numArgs) -{ - while (scope) { - GLuint i; - for (i = 0; i < scope->num_functions; i++) { - slang_function *f = &scope->functions[i]; - if (strcmp(name, (char*) f->header.a_name) == 0) { - int haveRetValue = _slang_function_has_return_value(f); - if (numArgs == f->param_count - haveRetValue) - return f; - } - } - scope = scope->outer_scope; - } - - return NULL; -} - - -static slang_function * -_slang_find_function_by_max_argc(slang_function_scope *scope, - const char *name) -{ - slang_function *maxFunc = NULL; - GLuint maxArgs = 0; - - while (scope) { - GLuint i; - for (i = 0; i < scope->num_functions; i++) { - slang_function *f = &scope->functions[i]; - if (strcmp(name, (char*) f->header.a_name) == 0) { - if (f->param_count > maxArgs) { - maxArgs = f->param_count; - maxFunc = f; - } - } - } - scope = scope->outer_scope; - } - - return maxFunc; -} - - -/** - * Generate a new slang_function which is a constructor for a user-defined - * struct type. - */ -static slang_function * -_slang_make_struct_constructor(slang_assemble_ctx *A, slang_struct *str) -{ - const GLint numFields = str->fields->num_variables; - slang_function *fun = slang_function_new(SLANG_FUNC_CONSTRUCTOR); - - /* function header (name, return type) */ - fun->header.a_name = str->a_name; - fun->header.type.qualifier = SLANG_QUAL_NONE; - fun->header.type.specifier.type = SLANG_SPEC_STRUCT; - fun->header.type.specifier._struct = str; - - /* function parameters (= struct's fields) */ - { - GLint i; - for (i = 0; i < numFields; i++) { - /* - printf("Field %d: %s\n", i, (char*) str->fields->variables[i]->a_name); - */ - slang_variable *p = slang_variable_scope_grow(fun->parameters); - *p = *str->fields->variables[i]; /* copy the variable and type */ - p->type.qualifier = SLANG_QUAL_CONST; - } - fun->param_count = fun->parameters->num_variables; - } - - /* Add __retVal to params */ - { - slang_variable *p = slang_variable_scope_grow(fun->parameters); - slang_atom a_retVal = slang_atom_pool_atom(A->atoms, "__retVal"); - assert(a_retVal); - p->a_name = a_retVal; - p->type = fun->header.type; - p->type.qualifier = SLANG_QUAL_OUT; - fun->param_count++; - } - - /* function body is: - * block: - * declare T; - * T.f1 = p1; - * T.f2 = p2; - * ... - * T.fn = pn; - * return T; - */ - { - slang_variable_scope *scope; - slang_variable *var; - GLint i; - - fun->body = slang_operation_new(1); - fun->body->type = SLANG_OPER_BLOCK_NEW_SCOPE; - fun->body->num_children = numFields + 2; - fun->body->children = slang_operation_new(numFields + 2); - - scope = fun->body->locals; - scope->outer_scope = fun->parameters; - - /* create local var 't' */ - var = slang_variable_scope_grow(scope); - var->a_name = slang_atom_pool_atom(A->atoms, "t"); - var->type = fun->header.type; - - /* declare t */ - { - slang_operation *decl; - - decl = &fun->body->children[0]; - decl->type = SLANG_OPER_VARIABLE_DECL; - decl->locals = _slang_variable_scope_new(scope); - decl->a_id = var->a_name; - } - - /* assign params to fields of t */ - for (i = 0; i < numFields; i++) { - slang_operation *assign = &fun->body->children[1 + i]; - - assign->type = SLANG_OPER_ASSIGN; - assign->locals = _slang_variable_scope_new(scope); - assign->num_children = 2; - assign->children = slang_operation_new(2); - - { - slang_operation *lhs = &assign->children[0]; - - lhs->type = SLANG_OPER_FIELD; - lhs->locals = _slang_variable_scope_new(scope); - lhs->num_children = 1; - lhs->children = slang_operation_new(1); - lhs->a_id = str->fields->variables[i]->a_name; - - lhs->children[0].type = SLANG_OPER_IDENTIFIER; - lhs->children[0].a_id = var->a_name; - lhs->children[0].locals = _slang_variable_scope_new(scope); - -#if 0 - lhs->children[1].num_children = 1; - lhs->children[1].children = slang_operation_new(1); - lhs->children[1].children[0].type = SLANG_OPER_IDENTIFIER; - lhs->children[1].children[0].a_id = str->fields->variables[i]->a_name; - lhs->children[1].children->locals = _slang_variable_scope_new(scope); -#endif - } - - { - slang_operation *rhs = &assign->children[1]; - - rhs->type = SLANG_OPER_IDENTIFIER; - rhs->locals = _slang_variable_scope_new(scope); - rhs->a_id = str->fields->variables[i]->a_name; - } - } - - /* return t; */ - { - slang_operation *ret = &fun->body->children[numFields + 1]; - - ret->type = SLANG_OPER_RETURN; - ret->locals = _slang_variable_scope_new(scope); - ret->num_children = 1; - ret->children = slang_operation_new(1); - ret->children[0].type = SLANG_OPER_IDENTIFIER; - ret->children[0].a_id = var->a_name; - ret->children[0].locals = _slang_variable_scope_new(scope); - } - } - /* - slang_print_function(fun, 1); - */ - return fun; -} - - -/** - * Find/create a function (constructor) for the given structure name. - */ -static slang_function * -_slang_locate_struct_constructor(slang_assemble_ctx *A, const char *name) -{ - unsigned int i; - for (i = 0; i < A->space.structs->num_structs; i++) { - slang_struct *str = &A->space.structs->structs[i]; - if (strcmp(name, (const char *) str->a_name) == 0) { - /* found a structure type that matches the function name */ - if (!str->constructor) { - /* create the constructor function now */ - str->constructor = _slang_make_struct_constructor(A, str); - } - return str->constructor; - } - } - return NULL; -} - - -/** - * Generate a new slang_function to satisfy a call to an array constructor. - * Ex: float[3](1., 2., 3.) - */ -static slang_function * -_slang_make_array_constructor(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_type_specifier_type baseType; - slang_function *fun; - int num_elements; - - fun = slang_function_new(SLANG_FUNC_CONSTRUCTOR); - if (!fun) - return NULL; - - baseType = slang_type_specifier_type_from_string((char *) oper->a_id); - - num_elements = oper->num_children; - - /* function header, return type */ - { - fun->header.a_name = oper->a_id; - fun->header.type.qualifier = SLANG_QUAL_NONE; - fun->header.type.specifier.type = SLANG_SPEC_ARRAY; - fun->header.type.specifier._array = - slang_type_specifier_new(baseType, NULL, NULL); - fun->header.type.array_len = num_elements; - } - - /* function parameters (= number of elements) */ - { - GLint i; - for (i = 0; i < num_elements; i++) { - /* - printf("Field %d: %s\n", i, (char*) str->fields->variables[i]->a_name); - */ - slang_variable *p = slang_variable_scope_grow(fun->parameters); - char name[10]; - _mesa_snprintf(name, sizeof(name), "p%d", i); - p->a_name = slang_atom_pool_atom(A->atoms, name); - p->type.qualifier = SLANG_QUAL_CONST; - p->type.specifier.type = baseType; - } - fun->param_count = fun->parameters->num_variables; - } - - /* Add __retVal to params */ - { - slang_variable *p = slang_variable_scope_grow(fun->parameters); - slang_atom a_retVal = slang_atom_pool_atom(A->atoms, "__retVal"); - assert(a_retVal); - p->a_name = a_retVal; - p->type = fun->header.type; - p->type.qualifier = SLANG_QUAL_OUT; - p->type.specifier.type = baseType; - fun->param_count++; - } - - /* function body is: - * block: - * declare T; - * T[0] = p0; - * T[1] = p1; - * ... - * T[n] = pn; - * return T; - */ - { - slang_variable_scope *scope; - slang_variable *var; - GLint i; - - fun->body = slang_operation_new(1); - fun->body->type = SLANG_OPER_BLOCK_NEW_SCOPE; - fun->body->num_children = num_elements + 2; - fun->body->children = slang_operation_new(num_elements + 2); - - scope = fun->body->locals; - scope->outer_scope = fun->parameters; - - /* create local var 't' */ - var = slang_variable_scope_grow(scope); - var->a_name = slang_atom_pool_atom(A->atoms, "ttt"); - var->type = fun->header.type;/*XXX copy*/ - - /* declare t */ - { - slang_operation *decl; - - decl = &fun->body->children[0]; - decl->type = SLANG_OPER_VARIABLE_DECL; - decl->locals = _slang_variable_scope_new(scope); - decl->a_id = var->a_name; - } - - /* assign params to elements of t */ - for (i = 0; i < num_elements; i++) { - slang_operation *assign = &fun->body->children[1 + i]; - - assign->type = SLANG_OPER_ASSIGN; - assign->locals = _slang_variable_scope_new(scope); - assign->num_children = 2; - assign->children = slang_operation_new(2); - - { - slang_operation *lhs = &assign->children[0]; - - lhs->type = SLANG_OPER_SUBSCRIPT; - lhs->locals = _slang_variable_scope_new(scope); - lhs->num_children = 2; - lhs->children = slang_operation_new(2); - - lhs->children[0].type = SLANG_OPER_IDENTIFIER; - lhs->children[0].a_id = var->a_name; - lhs->children[0].locals = _slang_variable_scope_new(scope); - - lhs->children[1].type = SLANG_OPER_LITERAL_INT; - lhs->children[1].literal[0] = (GLfloat) i; - } - - { - slang_operation *rhs = &assign->children[1]; - - rhs->type = SLANG_OPER_IDENTIFIER; - rhs->locals = _slang_variable_scope_new(scope); - rhs->a_id = fun->parameters->variables[i]->a_name; - } - } - - /* return t; */ - { - slang_operation *ret = &fun->body->children[num_elements + 1]; - - ret->type = SLANG_OPER_RETURN; - ret->locals = _slang_variable_scope_new(scope); - ret->num_children = 1; - ret->children = slang_operation_new(1); - ret->children[0].type = SLANG_OPER_IDENTIFIER; - ret->children[0].a_id = var->a_name; - ret->children[0].locals = _slang_variable_scope_new(scope); - } - } - - /* - slang_print_function(fun, 1); - */ - - return fun; -} - - -static GLboolean -_slang_is_vec_mat_type(const char *name) -{ - static const char *vecmat_types[] = { - "float", "int", "bool", - "vec2", "vec3", "vec4", - "ivec2", "ivec3", "ivec4", - "bvec2", "bvec3", "bvec4", - "mat2", "mat3", "mat4", - "mat2x3", "mat2x4", "mat3x2", "mat3x4", "mat4x2", "mat4x3", - NULL - }; - int i; - for (i = 0; vecmat_types[i]; i++) - if (strcmp(name, vecmat_types[i]) == 0) - return GL_TRUE; - return GL_FALSE; -} - - -/** - * Assemble a function call, given a particular function name. - * \param name the function's name (operators like '*' are possible). - */ -static slang_ir_node * -_slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, - slang_operation *oper, slang_operation *dest) -{ - slang_operation *params = oper->children; - const GLuint param_count = oper->num_children; - slang_atom atom; - slang_function *fun; - slang_ir_node *n; - - atom = slang_atom_pool_atom(A->atoms, name); - if (atom == SLANG_ATOM_NULL) - return NULL; - - if (oper->array_constructor) { - /* this needs special handling */ - fun = _slang_make_array_constructor(A, oper); - } - else { - /* Try to find function by name and exact argument type matching */ - GLboolean error = GL_FALSE; - fun = _slang_function_locate(A->space.funcs, atom, params, param_count, - &A->space, A->atoms, A->log, &error); - if (error) { - slang_info_log_error(A->log, - "Function '%s' not found (check argument types)", - name); - return NULL; - } - } - - if (!fun) { - /* Next, try locating a constructor function for a user-defined type */ - fun = _slang_locate_struct_constructor(A, name); - } - - /* - * At this point, some heuristics are used to try to find a function - * that matches the calling signature by means of casting or "unrolling" - * of constructors. - */ - - if (!fun && _slang_is_vec_mat_type(name)) { - /* Next, if this call looks like a vec() or mat() constructor call, - * try "unwinding" the args to satisfy a constructor. - */ - fun = _slang_find_function_by_max_argc(A->space.funcs, name); - if (fun) { - if (!_slang_adapt_call(oper, fun, &A->space, A->atoms, A->log)) { - slang_info_log_error(A->log, - "Function '%s' not found (check argument types)", - name); - return NULL; - } - } - } - - if (!fun && _slang_is_vec_mat_type(name)) { - /* Next, try casting args to the types of the formal parameters */ - int numArgs = oper->num_children; - fun = _slang_find_function_by_argc(A->space.funcs, name, numArgs); - if (!fun || !_slang_cast_func_params(oper, fun, &A->space, A->atoms, A->log)) { - slang_info_log_error(A->log, - "Function '%s' not found (check argument types)", - name); - return NULL; - } - assert(fun); - } - - if (!fun) { - slang_info_log_error(A->log, - "Function '%s' not found (check argument types)", - name); - return NULL; - } - - if (!fun->body) { - /* The function body may be in another compilation unit. - * We'll try concatenating the shaders and recompile at link time. - */ - A->UnresolvedRefs = GL_TRUE; - return new_node1(IR_NOP, NULL); - } - - /* type checking to be sure function's return type matches 'dest' type */ - if (dest) { - slang_typeinfo t0; - - slang_typeinfo_construct(&t0); - typeof_operation(A, dest, &t0); - - if (!slang_type_specifier_equal(&t0.spec, &fun->header.type.specifier)) { - slang_info_log_error(A->log, - "Incompatible type returned by call to '%s'", - name); - return NULL; - } - } - - n = _slang_gen_function_call(A, fun, oper, dest); - - if (n && !n->Store && !dest - && fun->header.type.specifier.type != SLANG_SPEC_VOID) { - /* setup n->Store for the result of the function call */ - GLint size = _slang_sizeof_type_specifier(&fun->header.type.specifier); - n->Store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, size); - /*printf("Alloc storage for function result, size %d \n", size);*/ - } - - if (oper->array_constructor) { - /* free the temporary array constructor function now */ - slang_function_destruct(fun); - } - - return n; -} - - -static slang_ir_node * -_slang_gen_method_call(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_atom *a_length = slang_atom_pool_atom(A->atoms, "length"); - slang_ir_node *n; - slang_variable *var; - - /* NOTE: In GLSL 1.20, there's only one kind of method - * call: array.length(). Anything else is an error. - */ - if (oper->a_id != a_length) { - slang_info_log_error(A->log, - "Undefined method call '%s'", (char *) oper->a_id); - return NULL; - } - - /* length() takes no arguments */ - if (oper->num_children > 0) { - slang_info_log_error(A->log, "Invalid arguments to length() method"); - return NULL; - } - - /* lookup the object/variable */ - var = _slang_variable_locate(oper->locals, oper->a_obj, GL_TRUE); - if (!var || var->type.specifier.type != SLANG_SPEC_ARRAY) { - slang_info_log_error(A->log, - "Undefined object '%s'", (char *) oper->a_obj); - return NULL; - } - - /* Create a float/literal IR node encoding the array length */ - n = new_node0(IR_FLOAT); - if (n) { - n->Value[0] = (float) _slang_array_length(var); - n->Store = _slang_new_ir_storage(PROGRAM_CONSTANT, -1, 1); - } - return n; -} - - -static GLboolean -_slang_is_constant_cond(const slang_operation *oper, GLboolean *value) -{ - if (oper->type == SLANG_OPER_LITERAL_FLOAT || - oper->type == SLANG_OPER_LITERAL_INT || - oper->type == SLANG_OPER_LITERAL_BOOL) { - if (oper->literal[0]) - *value = GL_TRUE; - else - *value = GL_FALSE; - return GL_TRUE; - } - else if (oper->type == SLANG_OPER_EXPRESSION && - oper->num_children == 1) { - return _slang_is_constant_cond(&oper->children[0], value); - } - return GL_FALSE; -} - - -/** - * Test if an operation is a scalar or boolean. - */ -static GLboolean -_slang_is_scalar_or_boolean(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_typeinfo type; - GLint size; - - slang_typeinfo_construct(&type); - typeof_operation(A, oper, &type); - size = _slang_sizeof_type_specifier(&type.spec); - slang_typeinfo_destruct(&type); - return size == 1; -} - - -/** - * Test if an operation is boolean. - */ -static GLboolean -_slang_is_boolean(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_typeinfo type; - GLboolean isBool; - - slang_typeinfo_construct(&type); - typeof_operation(A, oper, &type); - isBool = (type.spec.type == SLANG_SPEC_BOOL); - slang_typeinfo_destruct(&type); - return isBool; -} - - -/** - * Check if a loop contains a 'continue' statement. - * Stop looking if we find a nested loop. - */ -static GLboolean -_slang_loop_contains_continue(const slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_CONTINUE: - return GL_TRUE; - case SLANG_OPER_FOR: - case SLANG_OPER_DO: - case SLANG_OPER_WHILE: - /* stop upon finding a nested loop */ - return GL_FALSE; - default: - /* recurse */ - { - GLuint i; - for (i = 0; i < oper->num_children; i++) { - const slang_operation *child = slang_oper_child_const(oper, i); - if (_slang_loop_contains_continue(child)) - return GL_TRUE; - } - } - return GL_FALSE; - } -} - - -/** - * Check if a loop contains a 'continue' or 'break' statement. - * Stop looking if we find a nested loop. - */ -static GLboolean -_slang_loop_contains_continue_or_break(const slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_CONTINUE: - case SLANG_OPER_BREAK: - return GL_TRUE; - case SLANG_OPER_FOR: - case SLANG_OPER_DO: - case SLANG_OPER_WHILE: - /* stop upon finding a nested loop */ - return GL_FALSE; - default: - /* recurse */ - { - GLuint i; - for (i = 0; i < oper->num_children; i++) { - const slang_operation *child = slang_oper_child_const(oper, i); - if (_slang_loop_contains_continue_or_break(child)) - return GL_TRUE; - } - } - return GL_FALSE; - } -} - - -/** - * Replace 'break' and 'continue' statements inside a do and while loops. - * This is a recursive helper function used by - * _slang_gen_do/while_without_continue(). - */ -static void -replace_break_and_cont(slang_assemble_ctx *A, slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_BREAK: - /* replace 'break' with "_notBreakFlag = false; break" */ - { - slang_operation *block = oper; - block->type = SLANG_OPER_BLOCK_NEW_SCOPE; - slang_operation_add_children(block, 2); - { - slang_operation *assign = slang_oper_child(block, 0); - assign->type = SLANG_OPER_ASSIGN; - slang_operation_add_children(assign, 2); - { - slang_operation *lhs = slang_oper_child(assign, 0); - slang_operation_identifier(lhs, A, "_notBreakFlag"); - } - { - slang_operation *rhs = slang_oper_child(assign, 1); - slang_operation_literal_bool(rhs, GL_FALSE); - } - } - { - slang_operation *brk = slang_oper_child(block, 1); - brk->type = SLANG_OPER_BREAK; - assert(!brk->children); - } - } - break; - case SLANG_OPER_CONTINUE: - /* convert continue into a break */ - oper->type = SLANG_OPER_BREAK; - break; - case SLANG_OPER_FOR: - case SLANG_OPER_DO: - case SLANG_OPER_WHILE: - /* stop upon finding a nested loop */ - break; - default: - /* recurse */ - { - GLuint i; - for (i = 0; i < oper->num_children; i++) { - replace_break_and_cont(A, slang_oper_child(oper, i)); - } - } - } -} - - -/** - * Transform a while-loop so that continue statements are converted to breaks. - * Then do normal IR code generation. - * - * Before: - * - * while (LOOPCOND) { - * A; - * if (IFCOND) - * continue; - * B; - * break; - * C; - * } - * - * After: - * - * { - * bool _notBreakFlag = 1; - * while (_notBreakFlag && LOOPCOND) { - * do { - * A; - * if (IFCOND) { - * break; // was continue - * } - * B; - * _notBreakFlag = 0; // was - * break; // break - * C; - * } while (0) - * } - * } - */ -static slang_ir_node * -_slang_gen_while_without_continue(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *top; - slang_operation *innerBody; - - assert(oper->type == SLANG_OPER_WHILE); - - top = slang_operation_new(1); - top->type = SLANG_OPER_BLOCK_NEW_SCOPE; - top->locals->outer_scope = oper->locals->outer_scope; - slang_operation_add_children(top, 2); - - /* declare: bool _notBreakFlag = true */ - { - slang_operation *condDecl = slang_oper_child(top, 0); - slang_generate_declaration(A, top->locals, condDecl, - SLANG_SPEC_BOOL, "_notBreakFlag", GL_TRUE); - } - - /* build outer while-loop: while (_notBreakFlag && LOOPCOND) { ... } */ - { - slang_operation *outerWhile = slang_oper_child(top, 1); - outerWhile->type = SLANG_OPER_WHILE; - slang_operation_add_children(outerWhile, 2); - - /* _notBreakFlag && LOOPCOND */ - { - slang_operation *cond = slang_oper_child(outerWhile, 0); - cond->type = SLANG_OPER_LOGICALAND; - slang_operation_add_children(cond, 2); - { - slang_operation *notBreak = slang_oper_child(cond, 0); - slang_operation_identifier(notBreak, A, "_notBreakFlag"); - } - { - slang_operation *origCond = slang_oper_child(cond, 1); - slang_operation_copy(origCond, slang_oper_child(oper, 0)); - } - } - - /* inner loop */ - { - slang_operation *innerDo = slang_oper_child(outerWhile, 1); - innerDo->type = SLANG_OPER_DO; - slang_operation_add_children(innerDo, 2); - - /* copy original do-loop body into inner do-loop's body */ - innerBody = slang_oper_child(innerDo, 0); - slang_operation_copy(innerBody, slang_oper_child(oper, 1)); - innerBody->locals->outer_scope = innerDo->locals; - - /* inner do-loop's condition is constant/false */ - { - slang_operation *constFalse = slang_oper_child(innerDo, 1); - slang_operation_literal_bool(constFalse, GL_FALSE); - } - } - } - - /* Finally, in innerBody, - * replace "break" with "_notBreakFlag = 0; break" - * replace "continue" with "break" - */ - replace_break_and_cont(A, innerBody); - - /*slang_print_tree(top, 0);*/ - - return _slang_gen_operation(A, top); - - return NULL; -} - - -/** - * Generate loop code using high-level IR_LOOP instruction - */ -static slang_ir_node * -_slang_gen_while(slang_assemble_ctx * A, slang_operation *oper) -{ - /* - * LOOP: - * BREAK if !expr (child[0]) - * body code (child[1]) - */ - slang_ir_node *loop, *breakIf, *body; - GLboolean isConst, constTrue = GL_FALSE; - - if (!A->EmitContReturn) { - /* We don't want to emit CONT instructions. If this while-loop has - * a continue, translate it away. - */ - if (_slang_loop_contains_continue(slang_oper_child(oper, 1))) { - return _slang_gen_while_without_continue(A, oper); - } - } - - /* type-check expression */ - if (!_slang_is_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, "scalar/boolean expression expected for 'while'"); - return NULL; - } - - /* Check if loop condition is a constant */ - isConst = _slang_is_constant_cond(&oper->children[0], &constTrue); - - if (isConst && !constTrue) { - /* loop is never executed! */ - return new_node0(IR_NOP); - } - - /* Begin new loop */ - loop = new_loop(NULL); - - /* save loop state */ - push_loop(A, oper, loop); - - if (isConst && constTrue) { - /* while(nonzero constant), no conditional break */ - breakIf = NULL; - } - else { - slang_ir_node *cond - = new_cond(new_not(_slang_gen_operation(A, &oper->children[0]))); - breakIf = new_break_if_true(A, cond); - } - body = _slang_gen_operation(A, &oper->children[1]); - loop->Children[0] = new_seq(breakIf, body); - - /* Do infinite loop detection */ - /* loop->List is head of linked list of break/continue nodes */ - if (!loop->List && isConst && constTrue) { - /* infinite loop detected */ - pop_loop(A); - slang_info_log_error(A->log, "Infinite loop detected!"); - return NULL; - } - - /* restore loop state */ - pop_loop(A); - - return loop; -} - - -/** - * Transform a do-while-loop so that continue statements are converted to breaks. - * Then do normal IR code generation. - * - * Before: - * - * do { - * A; - * if (IFCOND) - * continue; - * B; - * break; - * C; - * } while (LOOPCOND); - * - * After: - * - * { - * bool _notBreakFlag = 1; - * do { - * do { - * A; - * if (IFCOND) { - * break; // was continue - * } - * B; - * _notBreakFlag = 0; // was - * break; // break - * C; - * } while (0) - * } while (_notBreakFlag && LOOPCOND); - * } - */ -static slang_ir_node * -_slang_gen_do_without_continue(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *top; - slang_operation *innerBody; - - assert(oper->type == SLANG_OPER_DO); - - top = slang_operation_new(1); - top->type = SLANG_OPER_BLOCK_NEW_SCOPE; - top->locals->outer_scope = oper->locals->outer_scope; - slang_operation_add_children(top, 2); - - /* declare: bool _notBreakFlag = true */ - { - slang_operation *condDecl = slang_oper_child(top, 0); - slang_generate_declaration(A, top->locals, condDecl, - SLANG_SPEC_BOOL, "_notBreakFlag", GL_TRUE); - } - - /* build outer do-loop: do { ... } while (_notBreakFlag && LOOPCOND) */ - { - slang_operation *outerDo = slang_oper_child(top, 1); - outerDo->type = SLANG_OPER_DO; - slang_operation_add_children(outerDo, 2); - - /* inner do-loop */ - { - slang_operation *innerDo = slang_oper_child(outerDo, 0); - innerDo->type = SLANG_OPER_DO; - slang_operation_add_children(innerDo, 2); - - /* copy original do-loop body into inner do-loop's body */ - innerBody = slang_oper_child(innerDo, 0); - slang_operation_copy(innerBody, slang_oper_child(oper, 0)); - innerBody->locals->outer_scope = innerDo->locals; - - /* inner do-loop's condition is constant/false */ - { - slang_operation *constFalse = slang_oper_child(innerDo, 1); - slang_operation_literal_bool(constFalse, GL_FALSE); - } - } - - /* _notBreakFlag && LOOPCOND */ - { - slang_operation *cond = slang_oper_child(outerDo, 1); - cond->type = SLANG_OPER_LOGICALAND; - slang_operation_add_children(cond, 2); - { - slang_operation *notBreak = slang_oper_child(cond, 0); - slang_operation_identifier(notBreak, A, "_notBreakFlag"); - } - { - slang_operation *origCond = slang_oper_child(cond, 1); - slang_operation_copy(origCond, slang_oper_child(oper, 1)); - } - } - } - - /* Finally, in innerBody, - * replace "break" with "_notBreakFlag = 0; break" - * replace "continue" with "break" - */ - replace_break_and_cont(A, innerBody); - - /*slang_print_tree(top, 0);*/ - - return _slang_gen_operation(A, top); -} - - -/** - * Generate IR tree for a do-while loop using high-level LOOP, IF instructions. - */ -static slang_ir_node * -_slang_gen_do(slang_assemble_ctx * A, slang_operation *oper) -{ - /* - * LOOP: - * body code (child[0]) - * tail code: - * BREAK if !expr (child[1]) - */ - slang_ir_node *loop; - GLboolean isConst, constTrue; - - if (!A->EmitContReturn) { - /* We don't want to emit CONT instructions. If this do-loop has - * a continue, translate it away. - */ - if (_slang_loop_contains_continue(slang_oper_child(oper, 0))) { - return _slang_gen_do_without_continue(A, oper); - } - } - - /* type-check expression */ - if (!_slang_is_boolean(A, &oper->children[1])) { - slang_info_log_error(A->log, "scalar/boolean expression expected for 'do/while'"); - return NULL; - } - - loop = new_loop(NULL); - - /* save loop state */ - push_loop(A, oper, loop); - - /* loop body: */ - loop->Children[0] = _slang_gen_operation(A, &oper->children[0]); - - /* Check if loop condition is a constant */ - isConst = _slang_is_constant_cond(&oper->children[1], &constTrue); - if (isConst && constTrue) { - /* do { } while(1) ==> no conditional break */ - loop->Children[1] = NULL; /* no tail code */ - } - else { - slang_ir_node *cond - = new_cond(new_not(_slang_gen_operation(A, &oper->children[1]))); - loop->Children[1] = new_break_if_true(A, cond); - } - - /* XXX we should do infinite loop detection, as above */ - - /* restore loop state */ - pop_loop(A); - - return loop; -} - - -/** - * Recursively count the number of operations rooted at 'oper'. - * This gives some kind of indication of the size/complexity of an operation. - */ -static GLuint -sizeof_operation(const slang_operation *oper) -{ - if (oper) { - GLuint count = 1; /* me */ - GLuint i; - for (i = 0; i < oper->num_children; i++) { - count += sizeof_operation(&oper->children[i]); - } - return count; - } - else { - return 0; - } -} - - -/** - * Determine if a for-loop can be unrolled. - * At this time, only a rather narrow class of for loops can be unrolled. - * See code for details. - * When a loop can't be unrolled because it's too large we'll emit a - * message to the log. - */ -static GLboolean -_slang_can_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) -{ - GLuint bodySize; - GLint start, end; - const char *varName; - slang_atom varId; - - if (oper->type != SLANG_OPER_FOR) - return GL_FALSE; - - assert(oper->num_children == 4); - - if (_slang_loop_contains_continue_or_break(slang_oper_child_const(oper, 3))) - return GL_FALSE; - - /* children[0] must be either "int i=constant" or "i=constant" */ - if (oper->children[0].type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) { - slang_variable *var; - - if (oper->children[0].children[0].type != SLANG_OPER_VARIABLE_DECL) - return GL_FALSE; - - varId = oper->children[0].children[0].a_id; - - var = _slang_variable_locate(oper->children[0].children[0].locals, - varId, GL_TRUE); - if (!var) - return GL_FALSE; - if (!var->initializer) - return GL_FALSE; - if (var->initializer->type != SLANG_OPER_LITERAL_INT) - return GL_FALSE; - start = (GLint) var->initializer->literal[0]; - } - else if (oper->children[0].type == SLANG_OPER_EXPRESSION) { - if (oper->children[0].children[0].type != SLANG_OPER_ASSIGN) - return GL_FALSE; - if (oper->children[0].children[0].children[0].type != SLANG_OPER_IDENTIFIER) - return GL_FALSE; - if (oper->children[0].children[0].children[1].type != SLANG_OPER_LITERAL_INT) - return GL_FALSE; - - varId = oper->children[0].children[0].children[0].a_id; - - start = (GLint) oper->children[0].children[0].children[1].literal[0]; - } - else { - return GL_FALSE; - } - - /* children[1] must be "i<constant" */ - if (oper->children[1].type != SLANG_OPER_EXPRESSION) - return GL_FALSE; - if (oper->children[1].children[0].type != SLANG_OPER_LESS) - return GL_FALSE; - if (oper->children[1].children[0].children[0].type != SLANG_OPER_IDENTIFIER) - return GL_FALSE; - if (oper->children[1].children[0].children[1].type != SLANG_OPER_LITERAL_INT) - return GL_FALSE; - - end = (GLint) oper->children[1].children[0].children[1].literal[0]; - - /* children[2] must be "i++" or "++i" */ - if (oper->children[2].type != SLANG_OPER_POSTINCREMENT && - oper->children[2].type != SLANG_OPER_PREINCREMENT) - return GL_FALSE; - if (oper->children[2].children[0].type != SLANG_OPER_IDENTIFIER) - return GL_FALSE; - - /* make sure the same variable name is used in all places */ - if ((oper->children[1].children[0].children[0].a_id != varId) || - (oper->children[2].children[0].a_id != varId)) - return GL_FALSE; - - varName = (const char *) varId; - - /* children[3], the loop body, can't be too large */ - bodySize = sizeof_operation(&oper->children[3]); - if (bodySize > MAX_FOR_LOOP_UNROLL_BODY_SIZE) { - slang_info_log_print(A->log, - "Note: 'for (%s ... )' body is too large/complex" - " to unroll", - varName); - return GL_FALSE; - } - - if (start >= end) - return GL_FALSE; /* degenerate case */ - - if ((GLuint)(end - start) > MAX_FOR_LOOP_UNROLL_ITERATIONS) { - slang_info_log_print(A->log, - "Note: 'for (%s=%d; %s<%d; ++%s)' is too" - " many iterations to unroll", - varName, start, varName, end, varName); - return GL_FALSE; - } - - if ((end - start) * bodySize > MAX_FOR_LOOP_UNROLL_COMPLEXITY) { - slang_info_log_print(A->log, - "Note: 'for (%s=%d; %s<%d; ++%s)' will generate" - " too much code to unroll", - varName, start, varName, end, varName); - return GL_FALSE; - } - - return GL_TRUE; /* we can unroll the loop */ -} - - -/** - * Unroll a for-loop. - * First we determine the number of iterations to unroll. - * Then for each iteration: - * make a copy of the loop body - * replace instances of the loop variable with the current iteration value - * generate IR code for the body - * \return pointer to generated IR code or NULL if error, out of memory, etc. - */ -static slang_ir_node * -_slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper) -{ - GLint start, end, iter; - slang_ir_node *n, *root = NULL; - slang_atom varId; - - if (oper->children[0].type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) { - /* for (int i=0; ... */ - slang_variable *var; - - varId = oper->children[0].children[0].a_id; - var = _slang_variable_locate(oper->children[0].children[0].locals, - varId, GL_TRUE); - assert(var); - start = (GLint) var->initializer->literal[0]; - } - else { - /* for (i=0; ... */ - varId = oper->children[0].children[0].children[0].a_id; - start = (GLint) oper->children[0].children[0].children[1].literal[0]; - } - - end = (GLint) oper->children[1].children[0].children[1].literal[0]; - - for (iter = start; iter < end; iter++) { - slang_operation *body; - - /* make a copy of the loop body */ - body = slang_operation_new(1); - if (!body) - return NULL; - - if (!slang_operation_copy(body, &oper->children[3])) - return NULL; - - /* in body, replace instances of 'varId' with literal 'iter' */ - { - slang_variable *oldVar; - slang_operation *newOper; - - oldVar = _slang_variable_locate(oper->locals, varId, GL_TRUE); - if (!oldVar) { - /* undeclared loop variable */ - slang_operation_delete(body); - return NULL; - } - - newOper = slang_operation_new(1); - newOper->type = SLANG_OPER_LITERAL_INT; - newOper->literal_size = 1; - newOper->literal[0] = (GLfloat) iter; - - /* replace instances of the loop variable with newOper */ - slang_substitute(A, body, 1, &oldVar, &newOper, GL_FALSE); - } - - /* do IR codegen for body */ - n = _slang_gen_operation(A, body); - if (!n) - return NULL; - - root = new_seq(root, n); - - slang_operation_delete(body); - } - - return root; -} - - -/** - * Replace 'continue' statement with 'break' inside a for-loop. - * This is a recursive helper function used by _slang_gen_for_without_continue(). - */ -static void -replace_continue_with_break(slang_assemble_ctx *A, slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_CONTINUE: - oper->type = SLANG_OPER_BREAK; - break; - case SLANG_OPER_FOR: - case SLANG_OPER_DO: - case SLANG_OPER_WHILE: - /* stop upon finding a nested loop */ - break; - default: - /* recurse */ - { - GLuint i; - for (i = 0; i < oper->num_children; i++) { - replace_continue_with_break(A, slang_oper_child(oper, i)); - } - } - } -} - - -/** - * Transform a for-loop so that continue statements are converted to breaks. - * Then do normal IR code generation. - * - * Before: - * - * for (INIT; LOOPCOND; INCR) { - * A; - * if (IFCOND) { - * continue; - * } - * B; - * } - * - * After: - * - * { - * bool _condFlag = 1; - * for (INIT; _condFlag; ) { - * for ( ; _condFlag = LOOPCOND; INCR) { - * A; - * if (IFCOND) { - * break; - * } - * B; - * } - * if (_condFlag) - * INCR; - * } - * } - */ -static slang_ir_node * -_slang_gen_for_without_continue(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_operation *top; - slang_operation *outerFor, *innerFor, *init, *cond, *incr; - slang_operation *lhs, *rhs; - - assert(oper->type == SLANG_OPER_FOR); - - top = slang_operation_new(1); - top->type = SLANG_OPER_BLOCK_NEW_SCOPE; - top->locals->outer_scope = oper->locals->outer_scope; - slang_operation_add_children(top, 2); - - /* declare: bool _condFlag = true */ - { - slang_operation *condDecl = slang_oper_child(top, 0); - slang_generate_declaration(A, top->locals, condDecl, - SLANG_SPEC_BOOL, "_condFlag", GL_TRUE); - } - - /* build outer loop: for (INIT; _condFlag; ) { */ - outerFor = slang_oper_child(top, 1); - outerFor->type = SLANG_OPER_FOR; - slang_operation_add_children(outerFor, 4); - - init = slang_oper_child(outerFor, 0); - slang_operation_copy(init, slang_oper_child(oper, 0)); - - cond = slang_oper_child(outerFor, 1); - cond->type = SLANG_OPER_IDENTIFIER; - cond->a_id = slang_atom_pool_atom(A->atoms, "_condFlag"); - - incr = slang_oper_child(outerFor, 2); - incr->type = SLANG_OPER_VOID; - - /* body of the outer loop */ - { - slang_operation *block = slang_oper_child(outerFor, 3); - - slang_operation_add_children(block, 2); - block->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; - - /* build inner loop: for ( ; _condFlag = LOOPCOND; INCR) { */ - { - innerFor = slang_oper_child(block, 0); - - /* make copy of orig loop */ - slang_operation_copy(innerFor, oper); - assert(innerFor->type == SLANG_OPER_FOR); - innerFor->locals->outer_scope = block->locals; - - init = slang_oper_child(innerFor, 0); - init->type = SLANG_OPER_VOID; /* leak? */ - - cond = slang_oper_child(innerFor, 1); - slang_operation_destruct(cond); - cond->type = SLANG_OPER_ASSIGN; - cond->locals = _slang_variable_scope_new(innerFor->locals); - slang_operation_add_children(cond, 2); - - lhs = slang_oper_child(cond, 0); - lhs->type = SLANG_OPER_IDENTIFIER; - lhs->a_id = slang_atom_pool_atom(A->atoms, "_condFlag"); - - rhs = slang_oper_child(cond, 1); - slang_operation_copy(rhs, slang_oper_child(oper, 1)); - } - - /* if (_condFlag) INCR; */ - { - slang_operation *ifop = slang_oper_child(block, 1); - ifop->type = SLANG_OPER_IF; - slang_operation_add_children(ifop, 2); - - /* re-use cond node build above */ - slang_operation_copy(slang_oper_child(ifop, 0), cond); - - /* incr node from original for-loop operation */ - slang_operation_copy(slang_oper_child(ifop, 1), - slang_oper_child(oper, 2)); - } - - /* finally, replace "continue" with "break" in the inner for-loop */ - replace_continue_with_break(A, slang_oper_child(innerFor, 3)); - } - - return _slang_gen_operation(A, top); -} - - - -/** - * Generate IR for a for-loop. Unrolling will be done when possible. - */ -static slang_ir_node * -_slang_gen_for(slang_assemble_ctx * A, slang_operation *oper) -{ - GLboolean unroll; - - if (!A->EmitContReturn) { - /* We don't want to emit CONT instructions. If this for-loop has - * a continue, translate it away. - */ - if (_slang_loop_contains_continue(slang_oper_child(oper, 3))) { - return _slang_gen_for_without_continue(A, oper); - } - } - - unroll = _slang_can_unroll_for_loop(A, oper); - if (unroll) { - slang_ir_node *code = _slang_unroll_for_loop(A, oper); - if (code) - return code; - } - - assert(oper->type == SLANG_OPER_FOR); - - /* conventional for-loop code generation */ - { - /* - * init code (child[0]) - * LOOP: - * BREAK if !expr (child[1]) - * body code (child[3]) - * tail code: - * incr code (child[2]) // XXX continue here - */ - slang_ir_node *loop, *cond, *breakIf, *body, *init, *incr; - init = _slang_gen_operation(A, &oper->children[0]); - loop = new_loop(NULL); - - /* save loop state */ - push_loop(A, oper, loop); - - cond = new_cond(new_not(_slang_gen_operation(A, &oper->children[1]))); - breakIf = new_break_if_true(A, cond); - body = _slang_gen_operation(A, &oper->children[3]); - incr = _slang_gen_operation(A, &oper->children[2]); - - loop->Children[0] = new_seq(breakIf, body); - loop->Children[1] = incr; /* tail code */ - - /* restore loop state */ - pop_loop(A); - - return new_seq(init, loop); - } -} - - -static slang_ir_node * -_slang_gen_continue(slang_assemble_ctx * A, const slang_operation *oper) -{ - slang_ir_node *n, *cont, *incr = NULL, *loopNode; - - assert(oper->type == SLANG_OPER_CONTINUE); - loopNode = current_loop_ir(A); - assert(loopNode); - assert(loopNode->Opcode == IR_LOOP); - - cont = new_node0(IR_CONT); - if (cont) { - cont->Parent = loopNode; - /* insert this node at head of linked list of cont/break instructions */ - cont->List = loopNode->List; - loopNode->List = cont; - } - - n = new_seq(incr, cont); - return n; -} - - -/** - * Determine if the given operation is of a specific type. - */ -static GLboolean -is_operation_type(const slang_operation *oper, slang_operation_type type) -{ - if (oper->type == type) - return GL_TRUE; - else if ((oper->type == SLANG_OPER_BLOCK_NEW_SCOPE || - oper->type == SLANG_OPER_BLOCK_NO_NEW_SCOPE) && - oper->num_children == 1) - return is_operation_type(&oper->children[0], type); - else - return GL_FALSE; -} - - -/** - * Generate IR tree for an if/then/else conditional using high-level - * IR_IF instruction. - */ -static slang_ir_node * -_slang_gen_if(slang_assemble_ctx * A, const slang_operation *oper) -{ - /* - * eval expr (child[0]) - * IF expr THEN - * if-body code - * ELSE - * else-body code - * ENDIF - */ - const GLboolean haveElseClause = !_slang_is_noop(&oper->children[2]); - slang_ir_node *ifNode, *cond, *ifBody, *elseBody; - GLboolean isConst, constTrue; - - /* type-check expression */ - if (!_slang_is_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, "boolean expression expected for 'if'"); - return NULL; - } - - if (!_slang_is_scalar_or_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, "scalar/boolean expression expected for 'if'"); - return NULL; - } - - isConst = _slang_is_constant_cond(&oper->children[0], &constTrue); - if (isConst) { - if (constTrue) { - /* if (true) ... */ - return _slang_gen_operation(A, &oper->children[1]); - } - else { - /* if (false) ... */ - return _slang_gen_operation(A, &oper->children[2]); - } - } - - cond = _slang_gen_operation(A, &oper->children[0]); - cond = new_cond(cond); - - if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK) - && !haveElseClause) { - /* Special case: generate a conditional break */ - ifBody = new_break_if_true(A, cond); - return ifBody; - } - else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE) - && !haveElseClause - && current_loop_oper(A) - && current_loop_oper(A)->type != SLANG_OPER_FOR) { - /* Special case: generate a conditional continue */ - ifBody = new_cont_if_true(A, cond); - return ifBody; - } - else { - /* general case */ - ifBody = _slang_gen_operation(A, &oper->children[1]); - if (haveElseClause) - elseBody = _slang_gen_operation(A, &oper->children[2]); - else - elseBody = NULL; - ifNode = new_if(cond, ifBody, elseBody); - return ifNode; - } -} - - - -static slang_ir_node * -_slang_gen_not(slang_assemble_ctx * A, const slang_operation *oper) -{ - slang_ir_node *n; - - assert(oper->type == SLANG_OPER_NOT); - - /* type-check expression */ - if (!_slang_is_scalar_or_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, - "scalar/boolean expression expected for '!'"); - return NULL; - } - - n = _slang_gen_operation(A, &oper->children[0]); - if (n) - return new_not(n); - else - return NULL; -} - - -static slang_ir_node * -_slang_gen_xor(slang_assemble_ctx * A, const slang_operation *oper) -{ - slang_ir_node *n1, *n2; - - assert(oper->type == SLANG_OPER_LOGICALXOR); - - if (!_slang_is_scalar_or_boolean(A, &oper->children[0]) || - !_slang_is_scalar_or_boolean(A, &oper->children[0])) { - slang_info_log_error(A->log, - "scalar/boolean expressions expected for '^^'"); - return NULL; - } - - n1 = _slang_gen_operation(A, &oper->children[0]); - if (!n1) - return NULL; - n2 = _slang_gen_operation(A, &oper->children[1]); - if (!n2) - return NULL; - return new_node2(IR_NOTEQUAL, n1, n2); -} - - -/** - * Generate IR node for storage of a temporary of given size. - */ -static slang_ir_node * -_slang_gen_temporary(GLint size) -{ - slang_ir_storage *store; - slang_ir_node *n = NULL; - - store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -2, size); - if (store) { - n = new_node0(IR_VAR_DECL); - if (n) { - n->Store = store; - } - else { - _slang_free(store); - } - } - return n; -} - - -/** - * Generate program constants for an array. - * Ex: const vec2[3] v = vec2[3](vec2(1,1), vec2(2,2), vec2(3,3)); - * This will allocate and initialize three vector constants, storing - * the array in constant memory, not temporaries like a non-const array. - * This can also be used for uniform array initializers. - * \return GL_TRUE for success, GL_FALSE if failure (semantic error, etc). - */ -static GLboolean -make_constant_array(slang_assemble_ctx *A, - slang_variable *var, - slang_operation *initializer) -{ - struct gl_program *prog = A->program; - const GLenum datatype = _slang_gltype_from_specifier(&var->type.specifier); - const char *varName = (char *) var->a_name; - const GLuint numElements = initializer->num_children; - GLint size; - GLuint i, j; - GLfloat *values; - - if (!var->store) { - var->store = _slang_new_ir_storage(PROGRAM_UNDEFINED, -6, -6); - } - size = var->store->Size; - - assert(var->type.qualifier == SLANG_QUAL_CONST || - var->type.qualifier == SLANG_QUAL_UNIFORM); - assert(initializer->type == SLANG_OPER_CALL); - assert(initializer->array_constructor); - - values = (GLfloat *) malloc(numElements * 4 * sizeof(GLfloat)); - - /* convert constructor params into ordinary floats */ - for (i = 0; i < numElements; i++) { - const slang_operation *op = &initializer->children[i]; - if (op->type != SLANG_OPER_LITERAL_FLOAT) { - /* unsupported type for this optimization */ - free(values); - return GL_FALSE; - } - for (j = 0; j < op->literal_size; j++) { - values[i * 4 + j] = op->literal[j]; - } - for ( ; j < 4; j++) { - values[i * 4 + j] = 0.0f; - } - } - - /* slightly different paths for constants vs. uniforms */ - if (var->type.qualifier == SLANG_QUAL_UNIFORM) { - var->store->File = PROGRAM_UNIFORM; - var->store->Index = _mesa_add_uniform(prog->Parameters, varName, - size, datatype, values); - } - else { - var->store->File = PROGRAM_CONSTANT; - var->store->Index = _mesa_add_named_constant(prog->Parameters, varName, - values, size); - } - assert(var->store->Size == size); - - free(values); - - return GL_TRUE; -} - - - -/** - * Generate IR node for allocating/declaring a variable (either a local or - * a global). - * Generally, this involves allocating an slang_ir_storage instance for the - * variable, choosing a register file (temporary, constant, etc). - * For ordinary variables we do not yet allocate storage though. We do that - * when we find the first actual use of the variable to avoid allocating temp - * regs that will never get used. - * At this time, uniforms are always allocated space in this function. - * - * \param initializer Optional initializer expression for the variable. - */ -static slang_ir_node * -_slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var, - slang_operation *initializer) -{ - const char *varName = (const char *) var->a_name; - const GLenum datatype = _slang_gltype_from_specifier(&var->type.specifier); - slang_ir_node *varDecl, *n; - slang_ir_storage *store; - GLint arrayLen, size, totalSize; /* if array then totalSize > size */ - gl_register_file file; - - /*assert(!var->declared);*/ - var->declared = GL_TRUE; - - /* determine GPU register file for simple cases */ - if (is_sampler_type(&var->type)) { - file = PROGRAM_SAMPLER; - } - else if (var->type.qualifier == SLANG_QUAL_UNIFORM) { - file = PROGRAM_UNIFORM; - } - else { - file = PROGRAM_TEMPORARY; - } - - size = _slang_sizeof_type_specifier(&var->type.specifier); - if (size <= 0) { - slang_info_log_error(A->log, "invalid declaration for '%s'", varName); - return NULL; - } - - arrayLen = _slang_array_length(var); - totalSize = _slang_array_size(size, arrayLen); - - /* Allocate IR node for the declaration */ - varDecl = new_node0(IR_VAR_DECL); - if (!varDecl) - return NULL; - - /* Allocate slang_ir_storage for this variable if needed. - * Note that we may not actually allocate a constant or temporary register - * until later. - */ - if (!var->store) { - GLint index = -7; /* TBD / unknown */ - var->store = _slang_new_ir_storage(file, index, totalSize); - if (!var->store) - return NULL; /* out of memory */ - } - - /* set the IR node's Var and Store pointers */ - varDecl->Var = var; - varDecl->Store = var->store; - - - store = var->store; - - /* if there's an initializer, generate IR for the expression */ - if (initializer) { - slang_ir_node *varRef, *init; - - if (var->type.qualifier == SLANG_QUAL_CONST) { - /* if the variable is const, the initializer must be a const - * expression as well. - */ -#if 0 - if (!_slang_is_constant_expr(initializer)) { - slang_info_log_error(A->log, - "initializer for %s not constant", varName); - return NULL; - } -#endif - } - - if (var->type.qualifier == SLANG_QUAL_UNIFORM && - !A->allow_uniform_initializers) { - slang_info_log_error(A->log, - "initializer for uniform %s not allowed", - varName); - return NULL; - } - - /* IR for the variable we're initializing */ - varRef = new_var(A, var); - if (!varRef) { - slang_info_log_error(A->log, "out of memory"); - return NULL; - } - - /* constant-folding, etc here */ - _slang_simplify(initializer, &A->space, A->atoms); - - /* look for simple constant-valued variables and uniforms */ - if (var->type.qualifier == SLANG_QUAL_CONST || - var->type.qualifier == SLANG_QUAL_UNIFORM) { - - if (initializer->type == SLANG_OPER_CALL && - initializer->array_constructor) { - /* array initializer */ - if (make_constant_array(A, var, initializer)) - return varRef; - } - else if (initializer->type == SLANG_OPER_LITERAL_FLOAT || - initializer->type == SLANG_OPER_LITERAL_INT) { - /* simple float/vector initializer */ - if (store->File == PROGRAM_UNIFORM) { - store->Index = _mesa_add_uniform(A->program->Parameters, - varName, - totalSize, datatype, - initializer->literal); - store->Swizzle = _slang_var_swizzle(size, 0); - return varRef; - } -#if 0 - else { - store->File = PROGRAM_CONSTANT; - store->Index = _mesa_add_named_constant(A->program->Parameters, - varName, - initializer->literal, - totalSize); - store->Swizzle = _slang_var_swizzle(size, 0); - return varRef; - } -#endif - } - } - - /* IR for initializer */ - init = _slang_gen_operation(A, initializer); - if (!init) - return NULL; - - /* XXX remove this when type checking is added above */ - if (init->Store && init->Store->Size != totalSize) { - slang_info_log_error(A->log, "invalid assignment (wrong types)"); - return NULL; - } - - /* assign RHS to LHS */ - n = new_node2(IR_COPY, varRef, init); - n = new_seq(varDecl, n); - } - else { - /* no initializer */ - n = varDecl; - } - - if (store->File == PROGRAM_UNIFORM && store->Index < 0) { - /* always need to allocate storage for uniforms at this point */ - store->Index = _mesa_add_uniform(A->program->Parameters, varName, - totalSize, datatype, NULL); - store->Swizzle = _slang_var_swizzle(size, 0); - } - -#if 0 - printf("%s var %p %s store=%p index=%d size=%d\n", - __FUNCTION__, (void *) var, (char *) varName, - (void *) store, store->Index, store->Size); -#endif - - return n; -} - - -/** - * Generate code for a selection expression: b ? x : y - * XXX In some cases we could implement a selection expression - * with an LRP instruction (use the boolean as the interpolant). - * Otherwise, we use an IF/ELSE/ENDIF construct. - */ -static slang_ir_node * -_slang_gen_select(slang_assemble_ctx *A, slang_operation *oper) -{ - slang_ir_node *cond, *ifNode, *trueExpr, *falseExpr, *trueNode, *falseNode; - slang_ir_node *tmpDecl, *tmpVar, *tree; - slang_typeinfo type0, type1, type2; - int size, isBool, isEqual; - - assert(oper->type == SLANG_OPER_SELECT); - assert(oper->num_children == 3); - - /* type of children[0] must be boolean */ - slang_typeinfo_construct(&type0); - typeof_operation(A, &oper->children[0], &type0); - isBool = (type0.spec.type == SLANG_SPEC_BOOL); - slang_typeinfo_destruct(&type0); - if (!isBool) { - slang_info_log_error(A->log, "selector type is not boolean"); - return NULL; - } - - slang_typeinfo_construct(&type1); - slang_typeinfo_construct(&type2); - typeof_operation(A, &oper->children[1], &type1); - typeof_operation(A, &oper->children[2], &type2); - isEqual = slang_type_specifier_equal(&type1.spec, &type2.spec); - slang_typeinfo_destruct(&type1); - slang_typeinfo_destruct(&type2); - if (!isEqual) { - slang_info_log_error(A->log, "incompatible types for ?: operator"); - return NULL; - } - - /* size of x or y's type */ - size = _slang_sizeof_type_specifier(&type1.spec); - assert(size > 0); - - /* temporary var */ - tmpDecl = _slang_gen_temporary(size); - - /* the condition (child 0) */ - cond = _slang_gen_operation(A, &oper->children[0]); - cond = new_cond(cond); - - /* if-true body (child 1) */ - tmpVar = new_node0(IR_VAR); - tmpVar->Store = tmpDecl->Store; - trueExpr = _slang_gen_operation(A, &oper->children[1]); - trueNode = new_node2(IR_COPY, tmpVar, trueExpr); - - /* if-false body (child 2) */ - tmpVar = new_node0(IR_VAR); - tmpVar->Store = tmpDecl->Store; - falseExpr = _slang_gen_operation(A, &oper->children[2]); - falseNode = new_node2(IR_COPY, tmpVar, falseExpr); - - ifNode = new_if(cond, trueNode, falseNode); - - /* tmp var value */ - tmpVar = new_node0(IR_VAR); - tmpVar->Store = tmpDecl->Store; - - tree = new_seq(ifNode, tmpVar); - tree = new_seq(tmpDecl, tree); - - /*_slang_print_ir_tree(tree, 10);*/ - return tree; -} - - -/** - * Generate code for &&. - */ -static slang_ir_node * -_slang_gen_logical_and(slang_assemble_ctx *A, slang_operation *oper) -{ - /* rewrite "a && b" as "a ? b : false" */ - slang_operation *select; - slang_ir_node *n; - - select = slang_operation_new(1); - select->type = SLANG_OPER_SELECT; - slang_operation_add_children(select, 3); - - slang_operation_copy(slang_oper_child(select, 0), &oper->children[0]); - slang_operation_copy(slang_oper_child(select, 1), &oper->children[1]); - slang_operation_literal_bool(slang_oper_child(select, 2), GL_FALSE); - - n = _slang_gen_select(A, select); - return n; -} - - -/** - * Generate code for ||. - */ -static slang_ir_node * -_slang_gen_logical_or(slang_assemble_ctx *A, slang_operation *oper) -{ - /* rewrite "a || b" as "a ? true : b" */ - slang_operation *select; - slang_ir_node *n; - - select = slang_operation_new(1); - select->type = SLANG_OPER_SELECT; - slang_operation_add_children(select, 3); - - slang_operation_copy(slang_oper_child(select, 0), &oper->children[0]); - slang_operation_literal_bool(slang_oper_child(select, 1), GL_TRUE); - slang_operation_copy(slang_oper_child(select, 2), &oper->children[1]); - - n = _slang_gen_select(A, select); - return n; -} - - -/** - * Generate IR tree for a return statement. - */ -static slang_ir_node * -_slang_gen_return(slang_assemble_ctx * A, slang_operation *oper) -{ - assert(oper->type == SLANG_OPER_RETURN); - return new_return(A->curFuncEndLabel); -} - - -#if 0 -/** - * Determine if the given operation/expression is const-valued. - */ -static GLboolean -_slang_is_constant_expr(const slang_operation *oper) -{ - slang_variable *var; - GLuint i; - - switch (oper->type) { - case SLANG_OPER_IDENTIFIER: - var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - if (var && var->type.qualifier == SLANG_QUAL_CONST) - return GL_TRUE; - return GL_FALSE; - default: - for (i = 0; i < oper->num_children; i++) { - if (!_slang_is_constant_expr(&oper->children[i])) - return GL_FALSE; - } - return GL_TRUE; - } -} -#endif - - -/** - * Check if an assignment of type t1 to t0 is legal. - * XXX more cases needed. - */ -static GLboolean -_slang_assignment_compatible(slang_assemble_ctx *A, - slang_operation *op0, - slang_operation *op1) -{ - slang_typeinfo t0, t1; - GLuint sz0, sz1; - - if (op0->type == SLANG_OPER_POSTINCREMENT || - op0->type == SLANG_OPER_POSTDECREMENT) { - return GL_FALSE; - } - - slang_typeinfo_construct(&t0); - typeof_operation(A, op0, &t0); - - slang_typeinfo_construct(&t1); - typeof_operation(A, op1, &t1); - - sz0 = _slang_sizeof_type_specifier(&t0.spec); - sz1 = _slang_sizeof_type_specifier(&t1.spec); - -#if 1 - if (sz0 != sz1) { - /*printf("assignment size mismatch %u vs %u\n", sz0, sz1);*/ - return GL_FALSE; - } -#endif - - if (t0.spec.type == SLANG_SPEC_STRUCT && - t1.spec.type == SLANG_SPEC_STRUCT && - t0.spec._struct->a_name != t1.spec._struct->a_name) - return GL_FALSE; - - if (t0.spec.type == SLANG_SPEC_FLOAT && - t1.spec.type == SLANG_SPEC_BOOL) - return GL_FALSE; - -#if 0 /* not used just yet - causes problems elsewhere */ - if (t0.spec.type == SLANG_SPEC_INT && - t1.spec.type == SLANG_SPEC_FLOAT) - return GL_FALSE; -#endif - - if (t0.spec.type == SLANG_SPEC_BOOL && - t1.spec.type == SLANG_SPEC_FLOAT) - return GL_FALSE; - - if (t0.spec.type == SLANG_SPEC_BOOL && - t1.spec.type == SLANG_SPEC_INT) - return GL_FALSE; - - return GL_TRUE; -} - - -/** - * Generate IR tree for a local variable declaration. - * Basically do some error checking and call _slang_gen_var_decl(). - */ -static slang_ir_node * -_slang_gen_declaration(slang_assemble_ctx *A, slang_operation *oper) -{ - const char *varName = (char *) oper->a_id; - slang_variable *var; - slang_ir_node *varDecl; - slang_operation *initializer; - - assert(oper->type == SLANG_OPER_VARIABLE_DECL); - assert(oper->num_children <= 1); - - - /* lookup the variable by name */ - var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - if (!var) - return NULL; /* "shouldn't happen" */ - - if (var->type.qualifier == SLANG_QUAL_ATTRIBUTE || - var->type.qualifier == SLANG_QUAL_VARYING || - var->type.qualifier == SLANG_QUAL_UNIFORM) { - /* can't declare attribute/uniform vars inside functions */ - slang_info_log_error(A->log, - "local variable '%s' cannot be an attribute/uniform/varying", - varName); - return NULL; - } - -#if 0 - if (v->declared) { - slang_info_log_error(A->log, "variable '%s' redeclared", varName); - return NULL; - } -#endif - - /* check if the var has an initializer */ - if (oper->num_children > 0) { - assert(oper->num_children == 1); - initializer = &oper->children[0]; - } - else if (var->initializer) { - initializer = var->initializer; - } - else { - initializer = NULL; - } - - if (initializer) { - /* check/compare var type and initializer type */ - if (!_slang_assignment_compatible(A, oper, initializer)) { - slang_info_log_error(A->log, "incompatible types in assignment"); - return NULL; - } - } - else { - if (var->type.qualifier == SLANG_QUAL_CONST) { - slang_info_log_error(A->log, - "const-qualified variable '%s' requires initializer", - varName); - return NULL; - } - } - - /* Generate IR node */ - varDecl = _slang_gen_var_decl(A, var, initializer); - if (!varDecl) - return NULL; - - return varDecl; -} - - -/** - * Generate IR tree for a reference to a variable (such as in an expression). - * This is different from a variable declaration. - */ -static slang_ir_node * -_slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper) -{ - /* If there's a variable associated with this oper (from inlining) - * use it. Otherwise, use the oper's var id. - */ - slang_atom name = oper->var ? oper->var->a_name : oper->a_id; - slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE); - slang_ir_node *n; - if (!var || !var->declared) { - slang_info_log_error(A->log, "undefined variable '%s'", (char *) name); - return NULL; - } - n = new_var(A, var); - return n; -} - - - -/** - * Return the number of components actually named by the swizzle. - * Recall that swizzles may have undefined/don't-care values. - */ -static GLuint -swizzle_size(GLuint swizzle) -{ - GLuint size = 0, i; - for (i = 0; i < 4; i++) { - GLuint swz = GET_SWZ(swizzle, i); - size += (swz <= 3); - } - return size; -} - - -static slang_ir_node * -_slang_gen_swizzle(slang_ir_node *child, GLuint swizzle) -{ - slang_ir_node *n = new_node1(IR_SWIZZLE, child); - assert(child); - if (n) { - assert(!n->Store); - n->Store = _slang_new_ir_storage_relative(0, - swizzle_size(swizzle), - child->Store); - assert(n->Store); - n->Store->Swizzle = swizzle; - } - return n; -} - - -static GLboolean -is_store_writable(const slang_assemble_ctx *A, const slang_ir_storage *store) -{ - while (store->Parent) - store = store->Parent; - - if (!(store->File == PROGRAM_OUTPUT || - store->File == PROGRAM_TEMPORARY || - (store->File == PROGRAM_VARYING && - A->program->Target == GL_VERTEX_PROGRAM_ARB))) { - return GL_FALSE; - } - else { - return GL_TRUE; - } -} - - -/** - * Walk up an IR storage path to compute the final swizzle. - * This is used when we find an expression such as "foo.xz.yx". - */ -static GLuint -root_swizzle(const slang_ir_storage *st) -{ - GLuint swizzle = st->Swizzle; - while (st->Parent) { - st = st->Parent; - swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle); - } - return swizzle; -} - - -/** - * Generate IR tree for an assignment (=). - */ -static slang_ir_node * -_slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper) -{ - slang_operation *pred = NULL; - slang_ir_node *n = NULL; - - if (oper->children[0].type == SLANG_OPER_IDENTIFIER) { - /* Check that var is writeable */ - const char *varName = (char *) oper->children[0].a_id; - slang_variable *var - = _slang_variable_locate(oper->children[0].locals, - oper->children[0].a_id, GL_TRUE); - if (!var) { - slang_info_log_error(A->log, "undefined variable '%s'", varName); - return NULL; - } - - if (var->type.qualifier == SLANG_QUAL_CONST || - var->type.qualifier == SLANG_QUAL_ATTRIBUTE || - var->type.qualifier == SLANG_QUAL_UNIFORM || - (var->type.qualifier == SLANG_QUAL_VARYING && - A->program->Target == GL_FRAGMENT_PROGRAM_ARB)) { - slang_info_log_error(A->log, - "illegal assignment to read-only variable '%s'", - varName); - return NULL; - } - - /* check if we need to predicate this assignment based on __notRetFlag */ - if ((var->is_global || - var->type.qualifier == SLANG_QUAL_OUT || - var->type.qualifier == SLANG_QUAL_INOUT) && A->UseReturnFlag) { - /* create predicate, used below */ - pred = slang_operation_new(1); - pred->type = SLANG_OPER_IDENTIFIER; - pred->a_id = slang_atom_pool_atom(A->atoms, "__notRetFlag"); - pred->locals->outer_scope = oper->locals->outer_scope; - } - } - - if (oper->children[0].type == SLANG_OPER_IDENTIFIER && - oper->children[1].type == SLANG_OPER_CALL) { - /* Special case of: x = f(a, b) - * Replace with f(a, b, x) (where x == hidden __retVal out param) - * - * XXX this could be even more effective if we could accomodate - * cases such as "v.x = f();" - would help with typical vertex - * transformation. - */ - n = _slang_gen_function_call_name(A, - (const char *) oper->children[1].a_id, - &oper->children[1], &oper->children[0]); - } - else { - slang_ir_node *lhs, *rhs; - - /* lhs and rhs type checking */ - if (!_slang_assignment_compatible(A, - &oper->children[0], - &oper->children[1])) { - slang_info_log_error(A->log, "incompatible types in assignment"); - return NULL; - } - - lhs = _slang_gen_operation(A, &oper->children[0]); - if (!lhs) { - return NULL; - } - - if (!lhs->Store) { - slang_info_log_error(A->log, - "invalid left hand side for assignment"); - return NULL; - } - - /* check that lhs is writable */ - if (!is_store_writable(A, lhs->Store)) { - slang_info_log_error(A->log, - "illegal assignment to read-only l-value"); - return NULL; - } - - rhs = _slang_gen_operation(A, &oper->children[1]); - if (lhs && rhs) { - /* convert lhs swizzle into writemask */ - const GLuint swizzle = root_swizzle(lhs->Store); - GLuint writemask, newSwizzle = 0x0; - if (!swizzle_to_writemask(A, swizzle, &writemask, &newSwizzle)) { - /* Non-simple writemask, need to swizzle right hand side in - * order to put components into the right place. - */ - rhs = _slang_gen_swizzle(rhs, newSwizzle); - } - n = new_node2(IR_COPY, lhs, rhs); - } - else { - return NULL; - } - } - - if (n && pred) { - /* predicate the assignment code on __notRetFlag */ - slang_ir_node *top, *cond; - - cond = _slang_gen_operation(A, pred); - top = new_if(cond, n, NULL); - return top; - } - return n; -} - - -/** - * Generate IR tree for referencing a field in a struct (or basic vector type) - */ -static slang_ir_node * -_slang_gen_struct_field(slang_assemble_ctx * A, slang_operation *oper) -{ - slang_typeinfo ti; - - /* type of struct */ - slang_typeinfo_construct(&ti); - typeof_operation(A, &oper->children[0], &ti); - - if (_slang_type_is_vector(ti.spec.type)) { - /* the field should be a swizzle */ - const GLuint rows = _slang_type_dim(ti.spec.type); - slang_swizzle swz; - slang_ir_node *n; - GLuint swizzle; - if (!_slang_is_swizzle((char *) oper->a_id, rows, &swz)) { - slang_info_log_error(A->log, "Bad swizzle"); - return NULL; - } - swizzle = MAKE_SWIZZLE4(swz.swizzle[0], - swz.swizzle[1], - swz.swizzle[2], - swz.swizzle[3]); - - n = _slang_gen_operation(A, &oper->children[0]); - /* create new parent node with swizzle */ - if (n) - n = _slang_gen_swizzle(n, swizzle); - return n; - } - else if ( ti.spec.type == SLANG_SPEC_FLOAT - || ti.spec.type == SLANG_SPEC_INT - || ti.spec.type == SLANG_SPEC_BOOL) { - const GLuint rows = 1; - slang_swizzle swz; - slang_ir_node *n; - GLuint swizzle; - if (!_slang_is_swizzle((char *) oper->a_id, rows, &swz)) { - slang_info_log_error(A->log, "Bad swizzle"); - } - swizzle = MAKE_SWIZZLE4(swz.swizzle[0], - swz.swizzle[1], - swz.swizzle[2], - swz.swizzle[3]); - n = _slang_gen_operation(A, &oper->children[0]); - /* create new parent node with swizzle */ - n = _slang_gen_swizzle(n, swizzle); - return n; - } - else { - /* the field is a structure member (base.field) */ - /* oper->children[0] is the base */ - /* oper->a_id is the field name */ - slang_ir_node *base, *n; - slang_typeinfo field_ti; - GLint fieldSize, fieldOffset = -1; - - /* type of field */ - slang_typeinfo_construct(&field_ti); - typeof_operation(A, oper, &field_ti); - - fieldSize = _slang_sizeof_type_specifier(&field_ti.spec); - if (fieldSize > 0) - fieldOffset = _slang_field_offset(&ti.spec, oper->a_id); - - if (fieldSize == 0 || fieldOffset < 0) { - const char *structName; - if (ti.spec._struct) - structName = (char *) ti.spec._struct->a_name; - else - structName = "unknown"; - slang_info_log_error(A->log, - "\"%s\" is not a member of struct \"%s\"", - (char *) oper->a_id, structName); - return NULL; - } - assert(fieldSize >= 0); - - base = _slang_gen_operation(A, &oper->children[0]); - if (!base) { - /* error msg should have already been logged */ - return NULL; - } - - n = new_node1(IR_FIELD, base); - if (!n) - return NULL; - - n->Field = (char *) oper->a_id; - - /* Store the field's offset in storage->Index */ - n->Store = _slang_new_ir_storage(base->Store->File, - fieldOffset, - fieldSize); - - return n; - } -} - - -/** - * Gen code for array indexing. - */ -static slang_ir_node * -_slang_gen_array_element(slang_assemble_ctx * A, slang_operation *oper) -{ - slang_typeinfo array_ti; - - /* get array's type info */ - slang_typeinfo_construct(&array_ti); - typeof_operation(A, &oper->children[0], &array_ti); - - if (_slang_type_is_vector(array_ti.spec.type)) { - /* indexing a simple vector type: "vec4 v; v[0]=p;" */ - /* translate the index into a swizzle/writemask: "v.x=p" */ - const GLuint max = _slang_type_dim(array_ti.spec.type); - GLint index; - slang_ir_node *n; - - index = (GLint) oper->children[1].literal[0]; - if (oper->children[1].type != SLANG_OPER_LITERAL_INT || - index >= (GLint) max) { -#if 0 - slang_info_log_error(A->log, "Invalid array index for vector type"); - printf("type = %d\n", oper->children[1].type); - printf("index = %d, max = %d\n", index, max); - printf("array = %s\n", (char*)oper->children[0].a_id); - printf("index = %s\n", (char*)oper->children[1].a_id); - return NULL; -#else - index = 0; -#endif - } - - n = _slang_gen_operation(A, &oper->children[0]); - if (n) { - /* use swizzle to access the element */ - GLuint swizzle = MAKE_SWIZZLE4(SWIZZLE_X + index, - SWIZZLE_NIL, - SWIZZLE_NIL, - SWIZZLE_NIL); - n = _slang_gen_swizzle(n, swizzle); - } - return n; - } - else { - /* conventional array */ - slang_typeinfo elem_ti; - slang_ir_node *elem, *array, *index; - GLint elemSize, arrayLen; - - /* size of array element */ - slang_typeinfo_construct(&elem_ti); - typeof_operation(A, oper, &elem_ti); - elemSize = _slang_sizeof_type_specifier(&elem_ti.spec); - - if (_slang_type_is_matrix(array_ti.spec.type)) - arrayLen = _slang_type_dim(array_ti.spec.type); - else - arrayLen = array_ti.array_len; - - slang_typeinfo_destruct(&array_ti); - slang_typeinfo_destruct(&elem_ti); - - if (elemSize <= 0) { - /* unknown var or type */ - slang_info_log_error(A->log, "Undefined variable or type"); - return NULL; - } - - array = _slang_gen_operation(A, &oper->children[0]); - index = _slang_gen_operation(A, &oper->children[1]); - if (array && index) { - /* bounds check */ - GLint constIndex = -1; - if (index->Opcode == IR_FLOAT) { - constIndex = (int) index->Value[0]; - if (constIndex < 0 || constIndex >= arrayLen) { - slang_info_log_error(A->log, - "Array index out of bounds (index=%d size=%d)", - constIndex, arrayLen); - _slang_free_ir_tree(array); - _slang_free_ir_tree(index); - return NULL; - } - } - - if (!array->Store) { - slang_info_log_error(A->log, "Invalid array"); - return NULL; - } - - elem = new_node2(IR_ELEMENT, array, index); - - /* The storage info here will be updated during code emit */ - elem->Store = _slang_new_ir_storage(array->Store->File, - array->Store->Index, - elemSize); - elem->Store->Swizzle = _slang_var_swizzle(elemSize, 0); - return elem; - } - else { - _slang_free_ir_tree(array); - _slang_free_ir_tree(index); - return NULL; - } - } -} - - -static slang_ir_node * -_slang_gen_compare(slang_assemble_ctx *A, slang_operation *oper, - slang_ir_opcode opcode) -{ - slang_typeinfo t0, t1; - slang_ir_node *n; - - slang_typeinfo_construct(&t0); - typeof_operation(A, &oper->children[0], &t0); - - slang_typeinfo_construct(&t1); - typeof_operation(A, &oper->children[0], &t1); - - if (t0.spec.type == SLANG_SPEC_ARRAY || - t1.spec.type == SLANG_SPEC_ARRAY) { - slang_info_log_error(A->log, "Illegal array comparison"); - return NULL; - } - - if (oper->type != SLANG_OPER_EQUAL && - oper->type != SLANG_OPER_NOTEQUAL) { - /* <, <=, >, >= can only be used with scalars */ - if ((t0.spec.type != SLANG_SPEC_INT && - t0.spec.type != SLANG_SPEC_FLOAT) || - (t1.spec.type != SLANG_SPEC_INT && - t1.spec.type != SLANG_SPEC_FLOAT)) { - slang_info_log_error(A->log, "Incompatible type(s) for inequality operator"); - return NULL; - } - } - - n = new_node2(opcode, - _slang_gen_operation(A, &oper->children[0]), - _slang_gen_operation(A, &oper->children[1])); - - /* result is a bool (size 1) */ - n->Store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, 1); - - return n; -} - - -#if 0 -static void -print_vars(slang_variable_scope *s) -{ - int i; - printf("vars: "); - for (i = 0; i < s->num_variables; i++) { - printf("%s %d, \n", - (char*) s->variables[i]->a_name, - s->variables[i]->declared); - } - - printf("\n"); -} -#endif - - -#if 0 -static void -_slang_undeclare_vars(slang_variable_scope *locals) -{ - if (locals->num_variables > 0) { - int i; - for (i = 0; i < locals->num_variables; i++) { - slang_variable *v = locals->variables[i]; - printf("undeclare %s at %p\n", (char*) v->a_name, v); - v->declared = GL_FALSE; - } - } -} -#endif - - -/** - * Generate IR tree for a slang_operation (AST node) - */ -static slang_ir_node * -_slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper) -{ - switch (oper->type) { - case SLANG_OPER_BLOCK_NEW_SCOPE: - { - slang_ir_node *n; - - _slang_push_var_table(A->vartable); - - oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; /* temp change */ - n = _slang_gen_operation(A, oper); - oper->type = SLANG_OPER_BLOCK_NEW_SCOPE; /* restore */ - - _slang_pop_var_table(A->vartable); - - /*_slang_undeclare_vars(oper->locals);*/ - /*print_vars(oper->locals);*/ - - if (n) - n = new_node1(IR_SCOPE, n); - return n; - } - break; - - case SLANG_OPER_BLOCK_NO_NEW_SCOPE: - /* list of operations */ - if (oper->num_children > 0) - { - slang_ir_node *n, *tree = NULL; - GLuint i; - - for (i = 0; i < oper->num_children; i++) { - n = _slang_gen_operation(A, &oper->children[i]); - if (!n) { - _slang_free_ir_tree(tree); - return NULL; /* error must have occured */ - } - tree = new_seq(tree, n); - } - - return tree; - } - else { - return new_node0(IR_NOP); - } - - case SLANG_OPER_EXPRESSION: - return _slang_gen_operation(A, &oper->children[0]); - - case SLANG_OPER_FOR: - return _slang_gen_for(A, oper); - case SLANG_OPER_DO: - return _slang_gen_do(A, oper); - case SLANG_OPER_WHILE: - return _slang_gen_while(A, oper); - case SLANG_OPER_BREAK: - if (!current_loop_oper(A)) { - slang_info_log_error(A->log, "'break' not in loop"); - return NULL; - } - return new_break(current_loop_ir(A)); - case SLANG_OPER_CONTINUE: - if (!current_loop_oper(A)) { - slang_info_log_error(A->log, "'continue' not in loop"); - return NULL; - } - return _slang_gen_continue(A, oper); - case SLANG_OPER_DISCARD: - return new_node0(IR_KILL); - - case SLANG_OPER_EQUAL: - return _slang_gen_compare(A, oper, IR_EQUAL); - case SLANG_OPER_NOTEQUAL: - return _slang_gen_compare(A, oper, IR_NOTEQUAL); - case SLANG_OPER_GREATER: - return _slang_gen_compare(A, oper, IR_SGT); - case SLANG_OPER_LESS: - return _slang_gen_compare(A, oper, IR_SLT); - case SLANG_OPER_GREATEREQUAL: - return _slang_gen_compare(A, oper, IR_SGE); - case SLANG_OPER_LESSEQUAL: - return _slang_gen_compare(A, oper, IR_SLE); - case SLANG_OPER_ADD: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "+", oper, NULL); - return n; - } - case SLANG_OPER_SUBTRACT: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "-", oper, NULL); - return n; - } - case SLANG_OPER_MULTIPLY: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "*", oper, NULL); - return n; - } - case SLANG_OPER_DIVIDE: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "/", oper, NULL); - return n; - } - case SLANG_OPER_MINUS: - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "-", oper, NULL); - return n; - } - case SLANG_OPER_PLUS: - /* +expr --> do nothing */ - return _slang_gen_operation(A, &oper->children[0]); - case SLANG_OPER_VARIABLE_DECL: - return _slang_gen_declaration(A, oper); - case SLANG_OPER_ASSIGN: - return _slang_gen_assignment(A, oper); - case SLANG_OPER_ADDASSIGN: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "+=", oper, NULL); - return n; - } - case SLANG_OPER_SUBASSIGN: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "-=", oper, NULL); - return n; - } - break; - case SLANG_OPER_MULASSIGN: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "*=", oper, NULL); - return n; - } - case SLANG_OPER_DIVASSIGN: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_function_call_name(A, "/=", oper, NULL); - return n; - } - case SLANG_OPER_LOGICALAND: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_logical_and(A, oper); - return n; - } - case SLANG_OPER_LOGICALOR: - { - slang_ir_node *n; - assert(oper->num_children == 2); - n = _slang_gen_logical_or(A, oper); - return n; - } - case SLANG_OPER_LOGICALXOR: - return _slang_gen_xor(A, oper); - case SLANG_OPER_NOT: - return _slang_gen_not(A, oper); - case SLANG_OPER_SELECT: /* b ? x : y */ - { - slang_ir_node *n; - assert(oper->num_children == 3); - n = _slang_gen_select(A, oper); - return n; - } - - case SLANG_OPER_ASM: - return _slang_gen_asm(A, oper, NULL); - case SLANG_OPER_CALL: - return _slang_gen_function_call_name(A, (const char *) oper->a_id, - oper, NULL); - case SLANG_OPER_METHOD: - return _slang_gen_method_call(A, oper); - case SLANG_OPER_RETURN: - return _slang_gen_return(A, oper); - case SLANG_OPER_RETURN_INLINED: - return _slang_gen_return(A, oper); - case SLANG_OPER_LABEL: - return new_label(oper->label); - case SLANG_OPER_IDENTIFIER: - return _slang_gen_variable(A, oper); - case SLANG_OPER_IF: - return _slang_gen_if(A, oper); - case SLANG_OPER_FIELD: - return _slang_gen_struct_field(A, oper); - case SLANG_OPER_SUBSCRIPT: - return _slang_gen_array_element(A, oper); - case SLANG_OPER_LITERAL_FLOAT: - /* fall-through */ - case SLANG_OPER_LITERAL_INT: - /* fall-through */ - case SLANG_OPER_LITERAL_BOOL: - return new_float_literal(oper->literal, oper->literal_size); - - case SLANG_OPER_POSTINCREMENT: /* var++ */ - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "__postIncr", oper, NULL); - return n; - } - case SLANG_OPER_POSTDECREMENT: /* var-- */ - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "__postDecr", oper, NULL); - return n; - } - case SLANG_OPER_PREINCREMENT: /* ++var */ - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "++", oper, NULL); - return n; - } - case SLANG_OPER_PREDECREMENT: /* --var */ - { - slang_ir_node *n; - assert(oper->num_children == 1); - n = _slang_gen_function_call_name(A, "--", oper, NULL); - return n; - } - - case SLANG_OPER_NON_INLINED_CALL: - case SLANG_OPER_SEQUENCE: - { - slang_ir_node *tree = NULL; - GLuint i; - for (i = 0; i < oper->num_children; i++) { - slang_ir_node *n = _slang_gen_operation(A, &oper->children[i]); - tree = new_seq(tree, n); - if (n) - tree->Store = n->Store; - } - if (oper->type == SLANG_OPER_NON_INLINED_CALL) { - tree = new_function_call(tree, oper->label); - } - return tree; - } - - case SLANG_OPER_NONE: - case SLANG_OPER_VOID: - /* returning NULL here would generate an error */ - return new_node0(IR_NOP); - - default: - _mesa_problem(NULL, "bad node type %d in _slang_gen_operation", - oper->type); - return new_node0(IR_NOP); - } - - return NULL; -} - - -/** - * Check if the given type specifier is a rectangular texture sampler. - */ -static GLboolean -is_rect_sampler_spec(const slang_type_specifier *spec) -{ - while (spec->_array) { - spec = spec->_array; - } - return spec->type == SLANG_SPEC_SAMPLER_RECT || - spec->type == SLANG_SPEC_SAMPLER_RECT_SHADOW; -} - - - -/** - * Called by compiler when a global variable has been parsed/compiled. - * Here we examine the variable's type to determine what kind of register - * storage will be used. - * - * A uniform such as "gl_Position" will become the register specification - * (PROGRAM_OUTPUT, VERT_RESULT_HPOS). Or, uniform "gl_FogFragCoord" - * will be (PROGRAM_INPUT, FRAG_ATTRIB_FOGC). - * - * Samplers are interesting. For "uniform sampler2D tex;" we'll specify - * (PROGRAM_SAMPLER, index) where index is resolved at link-time to an - * actual texture unit (as specified by the user calling glUniform1i()). - */ -GLboolean -_slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, - slang_unit_type type) -{ - struct gl_program *prog = A->program; - const char *varName = (char *) var->a_name; - GLboolean success = GL_TRUE; - slang_ir_storage *store = NULL; - int dbg = 0; - const GLenum datatype = _slang_gltype_from_specifier(&var->type.specifier); - const GLint size = _slang_sizeof_type_specifier(&var->type.specifier); - const GLint arrayLen = _slang_array_length(var); - const GLint totalSize = _slang_array_size(size, arrayLen); - GLint texIndex = sampler_to_texture_index(var->type.specifier.type); - - var->is_global = GL_TRUE; - - /* check for sampler2D arrays */ - if (texIndex == -1 && var->type.specifier._array) - texIndex = sampler_to_texture_index(var->type.specifier._array->type); - - if (texIndex != -1) { - /* This is a texture sampler variable... - * store->File = PROGRAM_SAMPLER - * store->Index = sampler number (0..7, typically) - * store->Size = texture type index (1D, 2D, 3D, cube, etc) - */ - if (var->initializer) { - slang_info_log_error(A->log, "illegal assignment to '%s'", varName); - return GL_FALSE; - } -#if FEATURE_es2_glsl /* XXX should use FEATURE_texture_rect */ - /* disallow rect samplers */ - if (is_rect_sampler_spec(&var->type.specifier)) { - slang_info_log_error(A->log, "invalid sampler type for '%s'", varName); - return GL_FALSE; - } -#else - (void) is_rect_sampler_spec; /* silence warning */ -#endif - { - GLint sampNum = _mesa_add_sampler(prog->Parameters, varName, datatype); - store = _slang_new_ir_storage_sampler(sampNum, texIndex, totalSize); - - /* If we have a sampler array, then we need to allocate the - * additional samplers to ensure we don't allocate them elsewhere. - * We can't directly use _mesa_add_sampler() as that checks the - * varName and gets a match, so we call _mesa_add_parameter() - * directly and use the last sampler number from the call above. - */ - if (arrayLen > 0) { - GLint a = arrayLen - 1; - GLint i; - for (i = 0; i < a; i++) { - GLfloat value = (GLfloat)(i + sampNum + 1); - (void) _mesa_add_parameter(prog->Parameters, PROGRAM_SAMPLER, - varName, 1, datatype, &value, NULL, 0x0); - } - } - } - if (dbg) printf("SAMPLER "); - } - else if (var->type.qualifier == SLANG_QUAL_UNIFORM) { - /* Uniform variable */ - const GLuint swizzle = _slang_var_swizzle(totalSize, 0); - - if (prog) { - /* user-defined uniform */ - if (datatype == GL_NONE) { - if ((var->type.specifier.type == SLANG_SPEC_ARRAY && - var->type.specifier._array->type == SLANG_SPEC_STRUCT) || - (var->type.specifier.type == SLANG_SPEC_STRUCT)) { - /* temporary work-around */ - GLenum datatype = GL_FLOAT; - GLint uniformLoc = _mesa_add_uniform(prog->Parameters, varName, - totalSize, datatype, NULL); - store = _slang_new_ir_storage_swz(PROGRAM_UNIFORM, uniformLoc, - totalSize, swizzle); - - if (arrayLen > 0) { - GLint a = arrayLen - 1; - GLint i; - for (i = 0; i < a; i++) { - GLfloat value = (GLfloat)(i + uniformLoc + 1); - (void) _mesa_add_parameter(prog->Parameters, PROGRAM_UNIFORM, - varName, 1, datatype, &value, NULL, 0x0); - } - } - - /* XXX what we need to do is unroll the struct into its - * basic types, creating a uniform variable for each. - * For example: - * struct foo { - * vec3 a; - * vec4 b; - * }; - * uniform foo f; - * - * Should produce uniforms: - * "f.a" (GL_FLOAT_VEC3) - * "f.b" (GL_FLOAT_VEC4) - */ - - if (var->initializer) { - slang_info_log_error(A->log, - "unsupported initializer for uniform '%s'", varName); - return GL_FALSE; - } - } - else { - slang_info_log_error(A->log, - "invalid datatype for uniform variable %s", - varName); - return GL_FALSE; - } - } - else { - /* non-struct uniform */ - if (!_slang_gen_var_decl(A, var, var->initializer)) - return GL_FALSE; - store = var->store; - } - } - else { - /* pre-defined uniform, like gl_ModelviewMatrix */ - /* We know it's a uniform, but don't allocate storage unless - * it's really used. - */ - store = _slang_new_ir_storage_swz(PROGRAM_STATE_VAR, -1, - totalSize, swizzle); - } - if (dbg) printf("UNIFORM (sz %d) ", totalSize); - } - else if (var->type.qualifier == SLANG_QUAL_VARYING) { - /* varyings must be float, vec or mat */ - if (!_slang_type_is_float_vec_mat(var->type.specifier.type) && - var->type.specifier.type != SLANG_SPEC_ARRAY) { - slang_info_log_error(A->log, - "varying '%s' must be float/vector/matrix", - varName); - return GL_FALSE; - } - - if (var->initializer) { - slang_info_log_error(A->log, "illegal initializer for varying '%s'", - varName); - return GL_FALSE; - } - - if (prog) { - /* user-defined varying */ - GLbitfield flags; - GLint varyingLoc; - GLuint swizzle; - - flags = 0x0; - if (var->type.centroid == SLANG_CENTROID) - flags |= PROG_PARAM_BIT_CENTROID; - if (var->type.variant == SLANG_INVARIANT) - flags |= PROG_PARAM_BIT_INVARIANT; - - varyingLoc = _mesa_add_varying(prog->Varying, varName, - totalSize, flags); - swizzle = _slang_var_swizzle(size, 0); - store = _slang_new_ir_storage_swz(PROGRAM_VARYING, varyingLoc, - totalSize, swizzle); - } - else { - /* pre-defined varying, like gl_Color or gl_TexCoord */ - if (type == SLANG_UNIT_FRAGMENT_BUILTIN) { - /* fragment program input */ - GLuint swizzle; - GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB, - &swizzle); - assert(index >= 0); - assert(index < FRAG_ATTRIB_MAX); - store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, - size, swizzle); - } - else { - /* vertex program output */ - GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB); - GLuint swizzle = _slang_var_swizzle(size, 0); - assert(index >= 0); - assert(index < VERT_RESULT_MAX); - assert(type == SLANG_UNIT_VERTEX_BUILTIN); - store = _slang_new_ir_storage_swz(PROGRAM_OUTPUT, index, - size, swizzle); - } - if (dbg) printf("V/F "); - } - if (dbg) printf("VARYING "); - } - else if (var->type.qualifier == SLANG_QUAL_ATTRIBUTE) { - GLuint swizzle; - GLint index; - /* attributes must be float, vec or mat */ - if (!_slang_type_is_float_vec_mat(var->type.specifier.type)) { - slang_info_log_error(A->log, - "attribute '%s' must be float/vector/matrix", - varName); - return GL_FALSE; - } - - if (prog) { - /* user-defined vertex attribute */ - const GLint attr = -1; /* unknown */ - swizzle = _slang_var_swizzle(size, 0); - index = _mesa_add_attribute(prog->Attributes, varName, - size, datatype, attr); - assert(index >= 0); - index = VERT_ATTRIB_GENERIC0 + index; - } - else { - /* pre-defined vertex attrib */ - index = _slang_input_index(varName, GL_VERTEX_PROGRAM_ARB, &swizzle); - assert(index >= 0); - } - store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle); - if (dbg) printf("ATTRIB "); - } - else if (var->type.qualifier == SLANG_QUAL_FIXEDINPUT) { - GLuint swizzle = SWIZZLE_XYZW; /* silence compiler warning */ - GLint index = _slang_input_index(varName, GL_FRAGMENT_PROGRAM_ARB, - &swizzle); - store = _slang_new_ir_storage_swz(PROGRAM_INPUT, index, size, swizzle); - if (dbg) printf("INPUT "); - } - else if (var->type.qualifier == SLANG_QUAL_FIXEDOUTPUT) { - if (type == SLANG_UNIT_VERTEX_BUILTIN) { - GLint index = _slang_output_index(varName, GL_VERTEX_PROGRAM_ARB); - store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, size); - } - else { - GLint index = _slang_output_index(varName, GL_FRAGMENT_PROGRAM_ARB); - GLint specialSize = 4; /* treat all fragment outputs as float[4] */ - assert(type == SLANG_UNIT_FRAGMENT_BUILTIN); - store = _slang_new_ir_storage(PROGRAM_OUTPUT, index, specialSize); - } - if (dbg) printf("OUTPUT "); - } - else if (var->type.qualifier == SLANG_QUAL_CONST && !prog) { - /* pre-defined global constant, like gl_MaxLights */ - store = _slang_new_ir_storage(PROGRAM_CONSTANT, -1, size); - if (dbg) printf("CONST "); - } - else { - /* ordinary variable (may be const) */ - slang_ir_node *n; - - /* IR node to declare the variable */ - n = _slang_gen_var_decl(A, var, var->initializer); - - /* emit GPU instructions */ - success = _slang_emit_code(n, A->vartable, A->program, A->pragmas, GL_FALSE, A->log); - - _slang_free_ir_tree(n); - } - - if (dbg) printf("GLOBAL VAR %s idx %d\n", (char*) var->a_name, - store ? store->Index : -2); - - if (store) - var->store = store; /* save var's storage info */ - - var->declared = GL_TRUE; - - return success; -} - - -/** - * Produce an IR tree from a function AST (fun->body). - * Then call the code emitter to convert the IR tree into gl_program - * instructions. - */ -GLboolean -_slang_codegen_function(slang_assemble_ctx * A, slang_function * fun) -{ - slang_ir_node *n; - GLboolean success = GL_TRUE; - - if (strcmp((char *) fun->header.a_name, "main") != 0) { - /* we only really generate code for main, all other functions get - * inlined or codegen'd upon an actual call. - */ -#if 0 - /* do some basic error checking though */ - if (fun->header.type.specifier.type != SLANG_SPEC_VOID) { - /* check that non-void functions actually return something */ - slang_operation *op - = _slang_find_node_type(fun->body, SLANG_OPER_RETURN); - if (!op) { - slang_info_log_error(A->log, - "function \"%s\" has no return statement", - (char *) fun->header.a_name); - printf( - "function \"%s\" has no return statement\n", - (char *) fun->header.a_name); - return GL_FALSE; - } - } -#endif - return GL_TRUE; /* not an error */ - } - -#if 0 - printf("\n*********** codegen_function %s\n", (char *) fun->header.a_name); - slang_print_function(fun, 1); -#endif - - /* should have been allocated earlier: */ - assert(A->program->Parameters ); - assert(A->program->Varying); - assert(A->vartable); - - A->LoopDepth = 0; - A->UseReturnFlag = GL_FALSE; - A->CurFunction = fun; - - /* fold constant expressions, etc. */ - _slang_simplify(fun->body, &A->space, A->atoms); - -#if 0 - printf("\n*********** simplified %s\n", (char *) fun->header.a_name); - slang_print_function(fun, 1); -#endif - - /* Create an end-of-function label */ - A->curFuncEndLabel = _slang_label_new("__endOfFunc__main"); - - /* push new vartable scope */ - _slang_push_var_table(A->vartable); - - /* Generate IR tree for the function body code */ - n = _slang_gen_operation(A, fun->body); - if (n) - n = new_node1(IR_SCOPE, n); - - /* pop vartable, restore previous */ - _slang_pop_var_table(A->vartable); - - if (!n) { - /* XXX record error */ - return GL_FALSE; - } - - /* append an end-of-function-label to IR tree */ - n = new_seq(n, new_label(A->curFuncEndLabel)); - - /*_slang_label_delete(A->curFuncEndLabel);*/ - A->curFuncEndLabel = NULL; - -#if 0 - printf("************* New AST for %s *****\n", (char*)fun->header.a_name); - slang_print_function(fun, 1); -#endif -#if 0 - printf("************* IR for %s *******\n", (char*)fun->header.a_name); - _slang_print_ir_tree(n, 0); -#endif -#if 0 - printf("************* End codegen function ************\n\n"); -#endif - - if (A->UnresolvedRefs) { - /* Can't codegen at this time. - * At link time we'll concatenate all the vertex shaders and/or all - * the fragment shaders and try recompiling. - */ - return GL_TRUE; - } - - /* Emit program instructions */ - success = _slang_emit_code(n, A->vartable, A->program, A->pragmas, GL_TRUE, A->log); - _slang_free_ir_tree(n); - - /* free codegen context */ - /* - free(A->codegen); - */ - - return success; -} - diff --git a/mesalib/src/mesa/shader/slang/slang_codegen.h b/mesalib/src/mesa/shader/slang/slang_codegen.h deleted file mode 100644 index 461633fe3..000000000 --- a/mesalib/src/mesa/shader/slang/slang_codegen.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef SLANG_CODEGEN_H -#define SLANG_CODEGEN_H - - -#include "main/imports.h" -#include "slang_compile.h" - - -#define MAX_LOOP_DEPTH 30 - - -typedef struct slang_assemble_ctx_ -{ - slang_atom_pool *atoms; - slang_name_space space; - struct gl_program *program; - struct gl_sl_pragmas *pragmas; - slang_var_table *vartable; - slang_info_log *log; - GLboolean allow_uniform_initializers; - - /* current loop stack */ - const slang_operation *LoopOperStack[MAX_LOOP_DEPTH]; - struct slang_ir_node_ *LoopIRStack[MAX_LOOP_DEPTH]; - GLuint LoopDepth; - - /* current function */ - struct slang_function_ *CurFunction; - struct slang_label_ *curFuncEndLabel; - GLboolean UseReturnFlag; - - GLboolean UnresolvedRefs; - GLboolean EmitContReturn; -} slang_assemble_ctx; - - -extern GLuint -_slang_sizeof_type_specifier(const slang_type_specifier *spec); - -extern GLboolean -_slang_codegen_function(slang_assemble_ctx *A , struct slang_function_ *fun); - -extern GLboolean -_slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var, - slang_unit_type type); - - -#endif /* SLANG_CODEGEN_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_compile.c b/mesalib/src/mesa/shader/slang/slang_compile.c deleted file mode 100644 index ad8667615..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile.c +++ /dev/null @@ -1,3032 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * Copyright (C) 2008 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_compile.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "main/context.h" -#include "shader/program.h" -#include "shader/programopt.h" -#include "shader/prog_optimize.h" -#include "shader/prog_print.h" -#include "shader/prog_parameter.h" -#include "../../glsl/pp/sl_pp_public.h" -#include "../../glsl/cl/sl_cl_parse.h" -#include "slang_codegen.h" -#include "slang_compile.h" -#include "slang_storage.h" -#include "slang_log.h" -#include "slang_mem.h" -#include "slang_vartable.h" -#include "slang_simplify.h" - -/* - * This is a straightforward implementation of the slang front-end - * compiler. Lots of error-checking functionality is missing but - * every well-formed shader source should compile successfully and - * execute as expected. However, some semantically ill-formed shaders - * may be accepted resulting in undefined behaviour. - */ - - -/** re-defined below, should be the same though */ -#define TYPE_SPECIFIER_COUNT 36 - - -/** - * Check if the given identifier is legal. - */ -static GLboolean -legal_identifier(slang_atom name) -{ - /* "gl_" is a reserved prefix */ - if (strncmp((char *) name, "gl_", 3) == 0) { - return GL_FALSE; - } - return GL_TRUE; -} - - -/* - * slang_code_unit - */ - -GLvoid -_slang_code_unit_ctr(slang_code_unit * self, - struct slang_code_object_ * object) -{ - _slang_variable_scope_ctr(&self->vars); - _slang_function_scope_ctr(&self->funs); - _slang_struct_scope_ctr(&self->structs); - self->object = object; -} - -GLvoid -_slang_code_unit_dtr(slang_code_unit * self) -{ - slang_variable_scope_destruct(&self->vars); - slang_function_scope_destruct(&self->funs); - slang_struct_scope_destruct(&self->structs); -} - -/* - * slang_code_object - */ - -GLvoid -_slang_code_object_ctr(slang_code_object * self) -{ - GLuint i; - - for (i = 0; i < SLANG_BUILTIN_TOTAL; i++) - _slang_code_unit_ctr(&self->builtin[i], self); - _slang_code_unit_ctr(&self->unit, self); - slang_atom_pool_construct(&self->atompool); -} - -GLvoid -_slang_code_object_dtr(slang_code_object * self) -{ - GLuint i; - - for (i = 0; i < SLANG_BUILTIN_TOTAL; i++) - _slang_code_unit_dtr(&self->builtin[i]); - _slang_code_unit_dtr(&self->unit); - slang_atom_pool_destruct(&self->atompool); -} - - -/* slang_parse_ctx */ - -typedef struct slang_parse_ctx_ -{ - const unsigned char *I; - slang_info_log *L; - int parsing_builtin; - GLboolean global_scope; /**< Is object being declared a global? */ - slang_atom_pool *atoms; - slang_unit_type type; /**< Vertex vs. Fragment */ - GLuint version; /**< user-specified (or default) #version */ -} slang_parse_ctx; - -/* slang_output_ctx */ - -typedef struct slang_output_ctx_ -{ - slang_variable_scope *vars; - slang_function_scope *funs; - slang_struct_scope *structs; - struct gl_program *program; - struct gl_sl_pragmas *pragmas; - slang_var_table *vartable; - GLuint default_precision[TYPE_SPECIFIER_COUNT]; - GLboolean allow_precision; - GLboolean allow_invariant; - GLboolean allow_centroid; - GLboolean allow_array_types; /* float[] syntax */ -} slang_output_ctx; - -/* _slang_compile() */ - - -/* Debugging aid, print file/line where parsing error is detected */ -#define RETURN0 \ - do { \ - if (0) \ - printf("slang error at %s:%d\n", __FILE__, __LINE__); \ - return 0; \ - } while (0) - - -static void -parse_identifier_str(slang_parse_ctx * C, char **id) -{ - *id = (char *) C->I; - C->I += strlen(*id) + 1; -} - -static slang_atom -parse_identifier(slang_parse_ctx * C) -{ - const char *id; - - id = (const char *) C->I; - C->I += strlen(id) + 1; - return slang_atom_pool_atom(C->atoms, id); -} - -static int -is_hex_digit(char c) -{ - return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); -} - -static int -parse_general_number(slang_parse_ctx *ctx, float *number) -{ - char *flt = NULL; - - if (*ctx->I == '0') { - int value = 0; - const unsigned char *pi; - - if (ctx->I[1] == 'x' || ctx->I[1] == 'X') { - ctx->I += 2; - if (!is_hex_digit(*ctx->I)) { - return 0; - } - do { - int digit; - - if (*ctx->I >= '0' && *ctx->I <= '9') { - digit = (int)(*ctx->I - '0'); - } else if (*ctx->I >= 'a' && *ctx->I <= 'f') { - digit = (int)(*ctx->I - 'a') + 10; - } else { - digit = (int)(*ctx->I - 'A') + 10; - } - value = value * 0x10 + digit; - ctx->I++; - } while (is_hex_digit(*ctx->I)); - if (*ctx->I != '\0') { - return 0; - } - ctx->I++; - *number = (float)value; - return 1; - } - - pi = ctx->I; - pi++; - while (*pi >= '0' && *pi <= '7') { - int digit; - - digit = (int)(*pi - '0'); - value = value * 010 + digit; - pi++; - } - if (*pi == '\0') { - pi++; - ctx->I = pi; - *number = (float)value; - return 1; - } - } - - parse_identifier_str(ctx, &flt); - flt = _mesa_strdup(flt); - if (!flt) { - return 0; - } - if (flt[strlen(flt) - 1] == 'f' || flt[strlen(flt) - 1] == 'F') { - flt[strlen(flt) - 1] = '\0'; - } - *number = _mesa_strtof(flt, (char **)NULL); - free(flt); - - return 1; -} - -static int -parse_number(slang_parse_ctx * C, int *number) -{ - const int radix = (int) (*C->I++); - - if (radix == 1) { - float f = 0.0f; - - parse_general_number(C, &f); - *number = (int)f; - } else { - *number = 0; - while (*C->I != '\0') { - int digit; - if (*C->I >= '0' && *C->I <= '9') - digit = (int) (*C->I - '0'); - else if (*C->I >= 'A' && *C->I <= 'Z') - digit = (int) (*C->I - 'A') + 10; - else - digit = (int) (*C->I - 'a') + 10; - *number = *number * radix + digit; - C->I++; - } - C->I++; - } - if (*number > 65535) - slang_info_log_warning(C->L, "%d: literal integer overflow.", *number); - return 1; -} - -static int -parse_float(slang_parse_ctx * C, float *number) -{ - if (*C->I == 1) { - C->I++; - parse_general_number(C, number); - } else { - char *integral = NULL; - char *fractional = NULL; - char *exponent = NULL; - char *whole = NULL; - - parse_identifier_str(C, &integral); - parse_identifier_str(C, &fractional); - parse_identifier_str(C, &exponent); - - whole = (char *) _slang_alloc((strlen(integral) + - strlen(fractional) + - strlen(exponent) + 3) * sizeof(char)); - if (whole == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - - slang_string_copy(whole, integral); - slang_string_concat(whole, "."); - slang_string_concat(whole, fractional); - slang_string_concat(whole, "E"); - slang_string_concat(whole, exponent); - - *number = _mesa_strtof(whole, (char **) NULL); - - _slang_free(whole); - } - - return 1; -} - -/* revision number - increment after each change affecting emitted output */ -#define REVISION 5 - -static int -check_revision(slang_parse_ctx * C) -{ - if (*C->I != REVISION) { - slang_info_log_error(C->L, "Internal compiler error."); - RETURN0; - } - C->I++; - return 1; -} - -static int parse_statement(slang_parse_ctx *, slang_output_ctx *, - slang_operation *); -static int parse_expression(slang_parse_ctx *, slang_output_ctx *, - slang_operation *); -static int parse_type_specifier(slang_parse_ctx *, slang_output_ctx *, - slang_type_specifier *); -static int -parse_type_array_size(slang_parse_ctx *C, - slang_output_ctx *O, - GLint *array_len); - -static GLboolean -parse_array_len(slang_parse_ctx * C, slang_output_ctx * O, GLuint * len) -{ - slang_operation array_size; - slang_name_space space; - GLboolean result; - - if (!slang_operation_construct(&array_size)) - return GL_FALSE; - if (!parse_expression(C, O, &array_size)) { - slang_operation_destruct(&array_size); - return GL_FALSE; - } - - space.funcs = O->funs; - space.structs = O->structs; - space.vars = O->vars; - - /* evaluate compile-time expression which is array size */ - _slang_simplify(&array_size, &space, C->atoms); - - if (array_size.type == SLANG_OPER_LITERAL_INT) { - result = GL_TRUE; - *len = (GLint) array_size.literal[0]; - } else if (array_size.type == SLANG_OPER_IDENTIFIER) { - slang_variable *var = _slang_variable_locate(array_size.locals, array_size.a_id, GL_TRUE); - if (!var) { - slang_info_log_error(C->L, "undefined variable '%s'", - (char *) array_size.a_id); - result = GL_FALSE; - } else if (var->type.qualifier == SLANG_QUAL_CONST && - var->type.specifier.type == SLANG_SPEC_INT) { - if (var->initializer && - var->initializer->type == SLANG_OPER_LITERAL_INT) { - *len = (GLint) var->initializer->literal[0]; - result = GL_TRUE; - } else { - slang_info_log_error(C->L, "unable to parse array size declaration"); - result = GL_FALSE; - } - } else { - slang_info_log_error(C->L, "unable to parse array size declaration"); - result = GL_FALSE; - } - } else { - result = GL_FALSE; - } - - slang_operation_destruct(&array_size); - return result; -} - -static GLboolean -calculate_var_size(slang_parse_ctx * C, slang_output_ctx * O, - slang_variable * var) -{ - slang_storage_aggregate agg; - - if (!slang_storage_aggregate_construct(&agg)) - return GL_FALSE; - if (!_slang_aggregate_variable(&agg, &var->type.specifier, var->array_len, - O->funs, O->structs, O->vars, C->atoms)) { - slang_storage_aggregate_destruct(&agg); - return GL_FALSE; - } - var->size = _slang_sizeof_aggregate(&agg); - slang_storage_aggregate_destruct(&agg); - return GL_TRUE; -} - -static void -promote_type_to_array(slang_parse_ctx *C, - slang_fully_specified_type *type, - GLint array_len) -{ - slang_type_specifier *baseType = - slang_type_specifier_new(type->specifier.type, NULL, NULL); - - type->specifier.type = SLANG_SPEC_ARRAY; - type->specifier._array = baseType; - type->array_len = array_len; -} - - -static GLboolean -convert_to_array(slang_parse_ctx * C, slang_variable * var, - const slang_type_specifier * sp) -{ - /* sized array - mark it as array, copy the specifier to the array element - * and parse the expression */ - var->type.specifier.type = SLANG_SPEC_ARRAY; - var->type.specifier._array = (slang_type_specifier *) - _slang_alloc(sizeof(slang_type_specifier)); - if (var->type.specifier._array == NULL) { - slang_info_log_memory(C->L); - return GL_FALSE; - } - slang_type_specifier_ctr(var->type.specifier._array); - return slang_type_specifier_copy(var->type.specifier._array, sp); -} - -/* structure field */ -#define FIELD_NONE 0 -#define FIELD_NEXT 1 -#define FIELD_ARRAY 2 - -static GLboolean -parse_struct_field_var(slang_parse_ctx * C, slang_output_ctx * O, - slang_variable * var, slang_atom a_name, - const slang_type_specifier * sp, - GLuint array_len) -{ - var->a_name = a_name; - if (var->a_name == SLANG_ATOM_NULL) - return GL_FALSE; - - switch (*C->I++) { - case FIELD_NONE: - if (array_len != -1) { - if (!convert_to_array(C, var, sp)) - return GL_FALSE; - var->array_len = array_len; - } - else { - if (!slang_type_specifier_copy(&var->type.specifier, sp)) - return GL_FALSE; - } - break; - case FIELD_ARRAY: - if (array_len != -1) - return GL_FALSE; - if (!convert_to_array(C, var, sp)) - return GL_FALSE; - if (!parse_array_len(C, O, &var->array_len)) - return GL_FALSE; - break; - default: - return GL_FALSE; - } - - return calculate_var_size(C, O, var); -} - -static int -parse_struct_field(slang_parse_ctx * C, slang_output_ctx * O, - slang_struct * st, slang_type_specifier * sp) -{ - slang_output_ctx o = *O; - GLint array_len; - - o.structs = st->structs; - if (!parse_type_specifier(C, &o, sp)) - RETURN0; - if (!parse_type_array_size(C, &o, &array_len)) - RETURN0; - - do { - slang_atom a_name; - slang_variable *var = slang_variable_scope_grow(st->fields); - if (!var) { - slang_info_log_memory(C->L); - RETURN0; - } - a_name = parse_identifier(C); - if (_slang_variable_locate(st->fields, a_name, GL_FALSE)) { - slang_info_log_error(C->L, "duplicate field '%s'", (char *) a_name); - RETURN0; - } - - if (!parse_struct_field_var(C, &o, var, a_name, sp, array_len)) - RETURN0; - } - while (*C->I++ != FIELD_NONE); - - return 1; -} - -static int -parse_struct(slang_parse_ctx * C, slang_output_ctx * O, slang_struct ** st) -{ - slang_atom a_name; - const char *name; - - /* parse struct name (if any) and make sure it is unique in current scope */ - a_name = parse_identifier(C); - if (a_name == SLANG_ATOM_NULL) - RETURN0; - - name = slang_atom_pool_id(C->atoms, a_name); - if (name[0] != '\0' - && slang_struct_scope_find(O->structs, a_name, 0) != NULL) { - slang_info_log_error(C->L, "%s: duplicate type name.", name); - RETURN0; - } - - /* set-up a new struct */ - *st = (slang_struct *) _slang_alloc(sizeof(slang_struct)); - if (*st == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!slang_struct_construct(*st)) { - _slang_free(*st); - *st = NULL; - slang_info_log_memory(C->L); - RETURN0; - } - (**st).a_name = a_name; - (**st).structs->outer_scope = O->structs; - - /* parse individual struct fields */ - do { - slang_type_specifier sp; - - slang_type_specifier_ctr(&sp); - if (!parse_struct_field(C, O, *st, &sp)) { - slang_type_specifier_dtr(&sp); - RETURN0; - } - slang_type_specifier_dtr(&sp); - } - while (*C->I++ != FIELD_NONE); - - /* if named struct, copy it to current scope */ - if (name[0] != '\0') { - slang_struct *s; - - O->structs->structs = - (slang_struct *) _slang_realloc(O->structs->structs, - O->structs->num_structs - * sizeof(slang_struct), - (O->structs->num_structs + 1) - * sizeof(slang_struct)); - if (O->structs->structs == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - s = &O->structs->structs[O->structs->num_structs]; - if (!slang_struct_construct(s)) - RETURN0; - O->structs->num_structs++; - if (!slang_struct_copy(s, *st)) - RETURN0; - } - - return 1; -} - - -/* invariant qualifer */ -#define TYPE_VARIANT 90 -#define TYPE_INVARIANT 91 - -static int -parse_type_variant(slang_parse_ctx * C, slang_type_variant *variant) -{ - GLuint invariant = *C->I++; - switch (invariant) { - case TYPE_VARIANT: - *variant = SLANG_VARIANT; - return 1; - case TYPE_INVARIANT: - *variant = SLANG_INVARIANT; - return 1; - default: - RETURN0; - } -} - - -/* centroid qualifer */ -#define TYPE_CENTER 95 -#define TYPE_CENTROID 96 - -static int -parse_type_centroid(slang_parse_ctx * C, slang_type_centroid *centroid) -{ - GLuint c = *C->I++; - switch (c) { - case TYPE_CENTER: - *centroid = SLANG_CENTER; - return 1; - case TYPE_CENTROID: - *centroid = SLANG_CENTROID; - return 1; - default: - RETURN0; - } -} - - -/* Layout qualifiers */ -#define LAYOUT_QUALIFIER_NONE 0 -#define LAYOUT_QUALIFIER_UPPER_LEFT 1 -#define LAYOUT_QUALIFIER_PIXEL_CENTER_INTEGER 2 - -static int -parse_layout_qualifiers(slang_parse_ctx * C, slang_layout_qualifier *layout) -{ - *layout = 0x0; - - /* the layout qualifiers come as a list of LAYOUT_QUALIFER_x tokens, - * terminated by LAYOUT_QUALIFIER_NONE. - */ - while (1) { - GLuint c = *C->I++; - switch (c) { - case LAYOUT_QUALIFIER_NONE: - /* end of list of qualifiers */ - return 1; - case LAYOUT_QUALIFIER_UPPER_LEFT: - *layout |= SLANG_LAYOUT_UPPER_LEFT_BIT; - break; - case LAYOUT_QUALIFIER_PIXEL_CENTER_INTEGER: - *layout |= SLANG_LAYOUT_PIXEL_CENTER_INTEGER_BIT; - break; - default: - assert(0 && "Bad layout qualifier"); - } - } -} - - -/* type qualifier */ -#define TYPE_QUALIFIER_NONE 0 -#define TYPE_QUALIFIER_CONST 1 -#define TYPE_QUALIFIER_ATTRIBUTE 2 -#define TYPE_QUALIFIER_VARYING 3 -#define TYPE_QUALIFIER_UNIFORM 4 -#define TYPE_QUALIFIER_FIXEDOUTPUT 5 -#define TYPE_QUALIFIER_FIXEDINPUT 6 - -static int -parse_type_qualifier(slang_parse_ctx * C, slang_type_qualifier * qual) -{ - GLuint qualifier = *C->I++; - switch (qualifier) { - case TYPE_QUALIFIER_NONE: - *qual = SLANG_QUAL_NONE; - break; - case TYPE_QUALIFIER_CONST: - *qual = SLANG_QUAL_CONST; - break; - case TYPE_QUALIFIER_ATTRIBUTE: - *qual = SLANG_QUAL_ATTRIBUTE; - break; - case TYPE_QUALIFIER_VARYING: - *qual = SLANG_QUAL_VARYING; - break; - case TYPE_QUALIFIER_UNIFORM: - *qual = SLANG_QUAL_UNIFORM; - break; - case TYPE_QUALIFIER_FIXEDOUTPUT: - *qual = SLANG_QUAL_FIXEDOUTPUT; - break; - case TYPE_QUALIFIER_FIXEDINPUT: - *qual = SLANG_QUAL_FIXEDINPUT; - break; - default: - RETURN0; - } - return 1; -} - -/* type specifier */ -#define TYPE_SPECIFIER_VOID 0 -#define TYPE_SPECIFIER_BOOL 1 -#define TYPE_SPECIFIER_BVEC2 2 -#define TYPE_SPECIFIER_BVEC3 3 -#define TYPE_SPECIFIER_BVEC4 4 -#define TYPE_SPECIFIER_INT 5 -#define TYPE_SPECIFIER_IVEC2 6 -#define TYPE_SPECIFIER_IVEC3 7 -#define TYPE_SPECIFIER_IVEC4 8 -#define TYPE_SPECIFIER_FLOAT 9 -#define TYPE_SPECIFIER_VEC2 10 -#define TYPE_SPECIFIER_VEC3 11 -#define TYPE_SPECIFIER_VEC4 12 -#define TYPE_SPECIFIER_MAT2 13 -#define TYPE_SPECIFIER_MAT3 14 -#define TYPE_SPECIFIER_MAT4 15 -#define TYPE_SPECIFIER_SAMPLER1D 16 -#define TYPE_SPECIFIER_SAMPLER2D 17 -#define TYPE_SPECIFIER_SAMPLER3D 18 -#define TYPE_SPECIFIER_SAMPLERCUBE 19 -#define TYPE_SPECIFIER_SAMPLER1DSHADOW 20 -#define TYPE_SPECIFIER_SAMPLER2DSHADOW 21 -#define TYPE_SPECIFIER_SAMPLER2DRECT 22 -#define TYPE_SPECIFIER_SAMPLER2DRECTSHADOW 23 -#define TYPE_SPECIFIER_STRUCT 24 -#define TYPE_SPECIFIER_TYPENAME 25 -#define TYPE_SPECIFIER_MAT23 26 -#define TYPE_SPECIFIER_MAT32 27 -#define TYPE_SPECIFIER_MAT24 28 -#define TYPE_SPECIFIER_MAT42 29 -#define TYPE_SPECIFIER_MAT34 30 -#define TYPE_SPECIFIER_MAT43 31 -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY 32 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY 33 -#define TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW 34 -#define TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW 35 -#define TYPE_SPECIFIER_COUNT 36 - -static int -parse_type_specifier(slang_parse_ctx * C, slang_output_ctx * O, - slang_type_specifier * spec) -{ - int type = *C->I++; - switch (type) { - case TYPE_SPECIFIER_VOID: - spec->type = SLANG_SPEC_VOID; - break; - case TYPE_SPECIFIER_BOOL: - spec->type = SLANG_SPEC_BOOL; - break; - case TYPE_SPECIFIER_BVEC2: - spec->type = SLANG_SPEC_BVEC2; - break; - case TYPE_SPECIFIER_BVEC3: - spec->type = SLANG_SPEC_BVEC3; - break; - case TYPE_SPECIFIER_BVEC4: - spec->type = SLANG_SPEC_BVEC4; - break; - case TYPE_SPECIFIER_INT: - spec->type = SLANG_SPEC_INT; - break; - case TYPE_SPECIFIER_IVEC2: - spec->type = SLANG_SPEC_IVEC2; - break; - case TYPE_SPECIFIER_IVEC3: - spec->type = SLANG_SPEC_IVEC3; - break; - case TYPE_SPECIFIER_IVEC4: - spec->type = SLANG_SPEC_IVEC4; - break; - case TYPE_SPECIFIER_FLOAT: - spec->type = SLANG_SPEC_FLOAT; - break; - case TYPE_SPECIFIER_VEC2: - spec->type = SLANG_SPEC_VEC2; - break; - case TYPE_SPECIFIER_VEC3: - spec->type = SLANG_SPEC_VEC3; - break; - case TYPE_SPECIFIER_VEC4: - spec->type = SLANG_SPEC_VEC4; - break; - case TYPE_SPECIFIER_MAT2: - spec->type = SLANG_SPEC_MAT2; - break; - case TYPE_SPECIFIER_MAT3: - spec->type = SLANG_SPEC_MAT3; - break; - case TYPE_SPECIFIER_MAT4: - spec->type = SLANG_SPEC_MAT4; - break; - case TYPE_SPECIFIER_MAT23: - spec->type = SLANG_SPEC_MAT23; - break; - case TYPE_SPECIFIER_MAT32: - spec->type = SLANG_SPEC_MAT32; - break; - case TYPE_SPECIFIER_MAT24: - spec->type = SLANG_SPEC_MAT24; - break; - case TYPE_SPECIFIER_MAT42: - spec->type = SLANG_SPEC_MAT42; - break; - case TYPE_SPECIFIER_MAT34: - spec->type = SLANG_SPEC_MAT34; - break; - case TYPE_SPECIFIER_MAT43: - spec->type = SLANG_SPEC_MAT43; - break; - case TYPE_SPECIFIER_SAMPLER1D: - spec->type = SLANG_SPEC_SAMPLER_1D; - break; - case TYPE_SPECIFIER_SAMPLER2D: - spec->type = SLANG_SPEC_SAMPLER_2D; - break; - case TYPE_SPECIFIER_SAMPLER3D: - spec->type = SLANG_SPEC_SAMPLER_3D; - break; - case TYPE_SPECIFIER_SAMPLERCUBE: - spec->type = SLANG_SPEC_SAMPLER_CUBE; - break; - case TYPE_SPECIFIER_SAMPLER2DRECT: - spec->type = SLANG_SPEC_SAMPLER_RECT; - break; - case TYPE_SPECIFIER_SAMPLER1DSHADOW: - spec->type = SLANG_SPEC_SAMPLER_1D_SHADOW; - break; - case TYPE_SPECIFIER_SAMPLER2DSHADOW: - spec->type = SLANG_SPEC_SAMPLER_2D_SHADOW; - break; - case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW: - spec->type = SLANG_SPEC_SAMPLER_RECT_SHADOW; - break; - case TYPE_SPECIFIER_SAMPLER_1D_ARRAY: - spec->type = SLANG_SPEC_SAMPLER_1D_ARRAY; - break; - case TYPE_SPECIFIER_SAMPLER_2D_ARRAY: - spec->type = SLANG_SPEC_SAMPLER_2D_ARRAY; - break; - case TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW: - spec->type = SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW; - break; - case TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW: - spec->type = SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW; - break; - case TYPE_SPECIFIER_STRUCT: - spec->type = SLANG_SPEC_STRUCT; - if (!parse_struct(C, O, &spec->_struct)) - RETURN0; - break; - case TYPE_SPECIFIER_TYPENAME: - spec->type = SLANG_SPEC_STRUCT; - { - slang_atom a_name; - slang_struct *stru; - - a_name = parse_identifier(C); - if (a_name == NULL) - RETURN0; - - stru = slang_struct_scope_find(O->structs, a_name, 1); - if (stru == NULL) { - slang_info_log_error(C->L, "undeclared type name '%s'", - slang_atom_pool_id(C->atoms, a_name)); - RETURN0; - } - - spec->_struct = (slang_struct *) _slang_alloc(sizeof(slang_struct)); - if (spec->_struct == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!slang_struct_construct(spec->_struct)) { - _slang_free(spec->_struct); - spec->_struct = NULL; - RETURN0; - } - if (!slang_struct_copy(spec->_struct, stru)) - RETURN0; - } - break; - default: - RETURN0; - } - return 1; -} - -#define TYPE_SPECIFIER_NONARRAY 0 -#define TYPE_SPECIFIER_ARRAY 1 - -static int -parse_type_array_size(slang_parse_ctx *C, - slang_output_ctx *O, - GLint *array_len) -{ - GLuint size; - - switch (*C->I++) { - case TYPE_SPECIFIER_NONARRAY: - *array_len = -1; /* -1 = not an array */ - break; - case TYPE_SPECIFIER_ARRAY: - if (!parse_array_len(C, O, &size)) - RETURN0; - *array_len = (GLint) size; - break; - default: - assert(0); - RETURN0; - } - return 1; -} - -#define PRECISION_DEFAULT 0 -#define PRECISION_LOW 1 -#define PRECISION_MEDIUM 2 -#define PRECISION_HIGH 3 - -static int -parse_type_precision(slang_parse_ctx *C, - slang_type_precision *precision) -{ - GLint prec = *C->I++; - switch (prec) { - case PRECISION_DEFAULT: - *precision = SLANG_PREC_DEFAULT; - return 1; - case PRECISION_LOW: - *precision = SLANG_PREC_LOW; - return 1; - case PRECISION_MEDIUM: - *precision = SLANG_PREC_MEDIUM; - return 1; - case PRECISION_HIGH: - *precision = SLANG_PREC_HIGH; - return 1; - default: - RETURN0; - } -} - -static int -parse_fully_specified_type(slang_parse_ctx * C, slang_output_ctx * O, - slang_fully_specified_type * type) -{ - if (!parse_layout_qualifiers(C, &type->layout)) - RETURN0; - - if (!parse_type_variant(C, &type->variant)) - RETURN0; - - if (!parse_type_centroid(C, &type->centroid)) - RETURN0; - - if (!parse_type_qualifier(C, &type->qualifier)) - RETURN0; - - if (!parse_type_precision(C, &type->precision)) - RETURN0; - - if (!parse_type_specifier(C, O, &type->specifier)) - RETURN0; - - if (!parse_type_array_size(C, O, &type->array_len)) - RETURN0; - - if (!O->allow_invariant && type->variant == SLANG_INVARIANT) { - slang_info_log_error(C->L, - "'invariant' keyword not allowed (perhaps set #version 120)"); - RETURN0; - } - - if (!O->allow_centroid && type->centroid == SLANG_CENTROID) { - slang_info_log_error(C->L, - "'centroid' keyword not allowed (perhaps set #version 120)"); - RETURN0; - } - else if (type->centroid == SLANG_CENTROID && - type->qualifier != SLANG_QUAL_VARYING) { - slang_info_log_error(C->L, - "'centroid' keyword only allowed for varying vars"); - RETURN0; - } - - - /* need this? - if (type->qualifier != SLANG_QUAL_VARYING && - type->variant == SLANG_INVARIANT) { - slang_info_log_error(C->L, - "invariant qualifer only allowed for varying vars"); - RETURN0; - } - */ - - if (O->allow_precision) { - if (type->precision == SLANG_PREC_DEFAULT) { - assert(type->specifier.type < TYPE_SPECIFIER_COUNT); - /* use the default precision for this datatype */ - type->precision = O->default_precision[type->specifier.type]; - } - } - else { - /* only default is allowed */ - if (type->precision != SLANG_PREC_DEFAULT) { - slang_info_log_error(C->L, "precision qualifiers not allowed"); - RETURN0; - } - } - - if (!O->allow_array_types && type->array_len >= 0) { - slang_info_log_error(C->L, "first-class array types not allowed"); - RETURN0; - } - - if (type->array_len >= 0) { - /* convert type to array type (ex: convert "int" to "array of int" */ - promote_type_to_array(C, type, type->array_len); - } - - return 1; -} - -/* operation */ -#define OP_END 0 -#define OP_BLOCK_BEGIN_NO_NEW_SCOPE 1 -#define OP_BLOCK_BEGIN_NEW_SCOPE 2 -#define OP_DECLARE 3 -#define OP_ASM 4 -#define OP_BREAK 5 -#define OP_CONTINUE 6 -#define OP_DISCARD 7 -#define OP_RETURN 8 -#define OP_EXPRESSION 9 -#define OP_IF 10 -#define OP_WHILE 11 -#define OP_DO 12 -#define OP_FOR 13 -#define OP_PUSH_VOID 14 -#define OP_PUSH_BOOL 15 -#define OP_PUSH_INT 16 -#define OP_PUSH_FLOAT 17 -#define OP_PUSH_IDENTIFIER 18 -#define OP_SEQUENCE 19 -#define OP_ASSIGN 20 -#define OP_ADDASSIGN 21 -#define OP_SUBASSIGN 22 -#define OP_MULASSIGN 23 -#define OP_DIVASSIGN 24 -/*#define OP_MODASSIGN 25*/ -/*#define OP_LSHASSIGN 26*/ -/*#define OP_RSHASSIGN 27*/ -/*#define OP_ORASSIGN 28*/ -/*#define OP_XORASSIGN 29*/ -/*#define OP_ANDASSIGN 30*/ -#define OP_SELECT 31 -#define OP_LOGICALOR 32 -#define OP_LOGICALXOR 33 -#define OP_LOGICALAND 34 -/*#define OP_BITOR 35*/ -/*#define OP_BITXOR 36*/ -/*#define OP_BITAND 37*/ -#define OP_EQUAL 38 -#define OP_NOTEQUAL 39 -#define OP_LESS 40 -#define OP_GREATER 41 -#define OP_LESSEQUAL 42 -#define OP_GREATEREQUAL 43 -/*#define OP_LSHIFT 44*/ -/*#define OP_RSHIFT 45*/ -#define OP_ADD 46 -#define OP_SUBTRACT 47 -#define OP_MULTIPLY 48 -#define OP_DIVIDE 49 -/*#define OP_MODULUS 50*/ -#define OP_PREINCREMENT 51 -#define OP_PREDECREMENT 52 -#define OP_PLUS 53 -#define OP_MINUS 54 -/*#define OP_COMPLEMENT 55*/ -#define OP_NOT 56 -#define OP_SUBSCRIPT 57 -#define OP_CALL 58 -#define OP_FIELD 59 -#define OP_POSTINCREMENT 60 -#define OP_POSTDECREMENT 61 -#define OP_PRECISION 62 -#define OP_METHOD 63 - - -/** - * When parsing a compound production, this function is used to parse the - * children. - * For example, a while-loop compound will have two children, the - * while condition expression and the loop body. So, this function will - * be called twice to parse those two sub-expressions. - * \param C the parsing context - * \param O the output context - * \param oper the operation we're parsing - * \param statement indicates whether parsing a statement, or expression - * \return 1 if success, 0 if error - */ -static int -parse_child_operation(slang_parse_ctx * C, slang_output_ctx * O, - slang_operation * oper, GLboolean statement) -{ - slang_operation *ch; - - /* grow child array */ - ch = slang_operation_grow(&oper->num_children, &oper->children); - if (statement) - return parse_statement(C, O, ch); - return parse_expression(C, O, ch); -} - -static int parse_declaration(slang_parse_ctx * C, slang_output_ctx * O); - -static int -parse_statement(slang_parse_ctx * C, slang_output_ctx * O, - slang_operation * oper) -{ - int op; - - oper->locals->outer_scope = O->vars; - - op = *C->I++; - switch (op) { - case OP_BLOCK_BEGIN_NO_NEW_SCOPE: - /* parse child statements, do not create new variable scope */ - oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; - while (*C->I != OP_END) - if (!parse_child_operation(C, O, oper, GL_TRUE)) - RETURN0; - C->I++; - break; - case OP_BLOCK_BEGIN_NEW_SCOPE: - /* parse child statements, create new variable scope */ - { - slang_output_ctx o = *O; - - oper->type = SLANG_OPER_BLOCK_NEW_SCOPE; - o.vars = oper->locals; - while (*C->I != OP_END) - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - C->I++; - } - break; - case OP_DECLARE: - /* local variable declaration, individual declarators are stored as - * children identifiers - */ - oper->type = SLANG_OPER_BLOCK_NO_NEW_SCOPE; - { - const unsigned int first_var = O->vars->num_variables; - - /* parse the declaration, note that there can be zero or more - * than one declarators - */ - if (!parse_declaration(C, O)) - RETURN0; - if (first_var < O->vars->num_variables) { - const unsigned int num_vars = O->vars->num_variables - first_var; - unsigned int i; - assert(oper->num_children == 0); - oper->num_children = num_vars; - oper->children = slang_operation_new(num_vars); - if (oper->children == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - for (i = first_var; i < O->vars->num_variables; i++) { - slang_operation *o = &oper->children[i - first_var]; - slang_variable *var = O->vars->variables[i]; - o->type = SLANG_OPER_VARIABLE_DECL; - o->locals->outer_scope = O->vars; - o->a_id = var->a_name; - - /* new/someday... - calculate_var_size(C, O, var); - */ - - if (!legal_identifier(o->a_id)) { - slang_info_log_error(C->L, "illegal variable name '%s'", - (char *) o->a_id); - RETURN0; - } - } - } - } - break; - case OP_ASM: - /* the __asm statement, parse the mnemonic and all its arguments - * as expressions - */ - oper->type = SLANG_OPER_ASM; - oper->a_id = parse_identifier(C); - if (oper->a_id == SLANG_ATOM_NULL) - RETURN0; - while (*C->I != OP_END) { - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - } - C->I++; - break; - case OP_BREAK: - oper->type = SLANG_OPER_BREAK; - break; - case OP_CONTINUE: - oper->type = SLANG_OPER_CONTINUE; - break; - case OP_DISCARD: - oper->type = SLANG_OPER_DISCARD; - break; - case OP_RETURN: - oper->type = SLANG_OPER_RETURN; - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - break; - case OP_EXPRESSION: - oper->type = SLANG_OPER_EXPRESSION; - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - break; - case OP_IF: - oper->type = SLANG_OPER_IF; - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - if (!parse_child_operation(C, O, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, O, oper, GL_TRUE)) - RETURN0; - break; - case OP_WHILE: - { - slang_output_ctx o = *O; - - oper->type = SLANG_OPER_WHILE; - o.vars = oper->locals; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - } - break; - case OP_DO: - oper->type = SLANG_OPER_DO; - if (!parse_child_operation(C, O, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, O, oper, GL_FALSE)) - RETURN0; - break; - case OP_FOR: - { - slang_output_ctx o = *O; - - oper->type = SLANG_OPER_FOR; - o.vars = oper->locals; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - if (!parse_child_operation(C, &o, oper, GL_FALSE)) - RETURN0; - if (!parse_child_operation(C, &o, oper, GL_TRUE)) - RETURN0; - } - break; - case OP_PRECISION: - { - /* set default precision for a type in this scope */ - /* ignored at this time */ - int prec_qual = *C->I++; - int datatype = *C->I++; - (void) prec_qual; - (void) datatype; - } - break; - default: - /*printf("Unexpected operation %d\n", op);*/ - RETURN0; - } - return 1; -} - -static int -handle_nary_expression(slang_parse_ctx * C, slang_operation * op, - slang_operation ** ops, unsigned int *total_ops, - unsigned int n) -{ - unsigned int i; - - op->children = slang_operation_new(n); - if (op->children == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - op->num_children = n; - - for (i = 0; i < n; i++) { - slang_operation_destruct(&op->children[i]); - op->children[i] = (*ops)[*total_ops - (n + 1 - i)]; - } - - (*ops)[*total_ops - (n + 1)] = (*ops)[*total_ops - 1]; - *total_ops -= n; - - *ops = (slang_operation *) - _slang_realloc(*ops, - (*total_ops + n) * sizeof(slang_operation), - *total_ops * sizeof(slang_operation)); - if (*ops == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - return 1; -} - -static int -is_constructor_name(const char *name, slang_atom a_name, - slang_struct_scope * structs) -{ - if (slang_type_specifier_type_from_string(name) != SLANG_SPEC_VOID) - return 1; - return slang_struct_scope_find(structs, a_name, 1) != NULL; -} - -#define FUNCTION_CALL_NONARRAY 0 -#define FUNCTION_CALL_ARRAY 1 - -static int -parse_expression(slang_parse_ctx * C, slang_output_ctx * O, - slang_operation * oper) -{ - slang_operation *ops = NULL; - unsigned int num_ops = 0; - int number; - - while (*C->I != OP_END) { - slang_operation *op; - const unsigned int op_code = *C->I++; - - /* allocate default operation, becomes a no-op if not used */ - ops = (slang_operation *) - _slang_realloc(ops, - num_ops * sizeof(slang_operation), - (num_ops + 1) * sizeof(slang_operation)); - if (ops == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - op = &ops[num_ops]; - if (!slang_operation_construct(op)) { - slang_info_log_memory(C->L); - RETURN0; - } - num_ops++; - op->locals->outer_scope = O->vars; - - switch (op_code) { - case OP_PUSH_VOID: - op->type = SLANG_OPER_VOID; - break; - case OP_PUSH_BOOL: - op->type = SLANG_OPER_LITERAL_BOOL; - if (!parse_number(C, &number)) - RETURN0; - op->literal[0] = - op->literal[1] = - op->literal[2] = - op->literal[3] = (GLfloat) number; - op->literal_size = 1; - break; - case OP_PUSH_INT: - op->type = SLANG_OPER_LITERAL_INT; - if (!parse_number(C, &number)) - RETURN0; - op->literal[0] = - op->literal[1] = - op->literal[2] = - op->literal[3] = (GLfloat) number; - op->literal_size = 1; - break; - case OP_PUSH_FLOAT: - op->type = SLANG_OPER_LITERAL_FLOAT; - if (!parse_float(C, &op->literal[0])) - RETURN0; - op->literal[1] = - op->literal[2] = - op->literal[3] = op->literal[0]; - op->literal_size = 1; - break; - case OP_PUSH_IDENTIFIER: - op->type = SLANG_OPER_IDENTIFIER; - op->a_id = parse_identifier(C); - if (op->a_id == SLANG_ATOM_NULL) - RETURN0; - break; - case OP_SEQUENCE: - op->type = SLANG_OPER_SEQUENCE; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_ASSIGN: - op->type = SLANG_OPER_ASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_ADDASSIGN: - op->type = SLANG_OPER_ADDASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_SUBASSIGN: - op->type = SLANG_OPER_SUBASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_MULASSIGN: - op->type = SLANG_OPER_MULASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_DIVASSIGN: - op->type = SLANG_OPER_DIVASSIGN; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - /*case OP_MODASSIGN: */ - /*case OP_LSHASSIGN: */ - /*case OP_RSHASSIGN: */ - /*case OP_ORASSIGN: */ - /*case OP_XORASSIGN: */ - /*case OP_ANDASSIGN: */ - case OP_SELECT: - op->type = SLANG_OPER_SELECT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 3)) - RETURN0; - break; - case OP_LOGICALOR: - op->type = SLANG_OPER_LOGICALOR; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_LOGICALXOR: - op->type = SLANG_OPER_LOGICALXOR; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_LOGICALAND: - op->type = SLANG_OPER_LOGICALAND; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - /*case OP_BITOR: */ - /*case OP_BITXOR: */ - /*case OP_BITAND: */ - case OP_EQUAL: - op->type = SLANG_OPER_EQUAL; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_NOTEQUAL: - op->type = SLANG_OPER_NOTEQUAL; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_LESS: - op->type = SLANG_OPER_LESS; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_GREATER: - op->type = SLANG_OPER_GREATER; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_LESSEQUAL: - op->type = SLANG_OPER_LESSEQUAL; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_GREATEREQUAL: - op->type = SLANG_OPER_GREATEREQUAL; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - /*case OP_LSHIFT: */ - /*case OP_RSHIFT: */ - case OP_ADD: - op->type = SLANG_OPER_ADD; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_SUBTRACT: - op->type = SLANG_OPER_SUBTRACT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_MULTIPLY: - op->type = SLANG_OPER_MULTIPLY; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_DIVIDE: - op->type = SLANG_OPER_DIVIDE; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - /*case OP_MODULUS: */ - case OP_PREINCREMENT: - op->type = SLANG_OPER_PREINCREMENT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_PREDECREMENT: - op->type = SLANG_OPER_PREDECREMENT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_PLUS: - op->type = SLANG_OPER_PLUS; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_MINUS: - op->type = SLANG_OPER_MINUS; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_NOT: - op->type = SLANG_OPER_NOT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - /*case OP_COMPLEMENT: */ - case OP_SUBSCRIPT: - op->type = SLANG_OPER_SUBSCRIPT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 2)) - RETURN0; - break; - case OP_METHOD: - op->type = SLANG_OPER_METHOD; - op->a_obj = parse_identifier(C); - if (op->a_obj == SLANG_ATOM_NULL) - RETURN0; - - op->a_id = parse_identifier(C); - if (op->a_id == SLANG_ATOM_NULL) - RETURN0; - - assert(*C->I == OP_END); - C->I++; - - while (*C->I != OP_END) - if (!parse_child_operation(C, O, op, GL_FALSE)) - RETURN0; - C->I++; -#if 0 - /* don't lookup the method (not yet anyway) */ - if (!C->parsing_builtin - && !slang_function_scope_find_by_name(O->funs, op->a_id, 1)) { - const char *id; - - id = slang_atom_pool_id(C->atoms, op->a_id); - if (!is_constructor_name(id, op->a_id, O->structs)) { - slang_info_log_error(C->L, "%s: undeclared function name.", id); - RETURN0; - } - } -#endif - break; - case OP_CALL: - { - GLboolean array_constructor = GL_FALSE; - GLint array_constructor_size = 0; - - op->type = SLANG_OPER_CALL; - op->a_id = parse_identifier(C); - if (op->a_id == SLANG_ATOM_NULL) - RETURN0; - switch (*C->I++) { - case FUNCTION_CALL_NONARRAY: - /* Nothing to do. */ - break; - case FUNCTION_CALL_ARRAY: - /* Calling an array constructor. For example: - * float[3](1.1, 2.2, 3.3); - */ - if (!O->allow_array_types) { - slang_info_log_error(C->L, - "array constructors not allowed " - "in this GLSL version"); - RETURN0; - } - else { - /* parse the array constructor size */ - slang_operation array_size; - array_constructor = GL_TRUE; - slang_operation_construct(&array_size); - if (!parse_expression(C, O, &array_size)) { - slang_operation_destruct(&array_size); - return GL_FALSE; - } - if (array_size.type != SLANG_OPER_LITERAL_INT) { - slang_info_log_error(C->L, - "constructor array size is not an integer"); - slang_operation_destruct(&array_size); - RETURN0; - } - array_constructor_size = (int) array_size.literal[0]; - op->array_constructor = GL_TRUE; - slang_operation_destruct(&array_size); - } - break; - default: - assert(0); - RETURN0; - } - while (*C->I != OP_END) - if (!parse_child_operation(C, O, op, GL_FALSE)) - RETURN0; - C->I++; - - if (array_constructor && - array_constructor_size != op->num_children) { - slang_info_log_error(C->L, "number of parameters to array" - " constructor does not match array size"); - RETURN0; - } - - if (!C->parsing_builtin - && !slang_function_scope_find_by_name(O->funs, op->a_id, 1)) { - const char *id; - - id = slang_atom_pool_id(C->atoms, op->a_id); - if (!is_constructor_name(id, op->a_id, O->structs)) { - slang_info_log_error(C->L, "%s: undeclared function name.", id); - RETURN0; - } - } - } - break; - case OP_FIELD: - op->type = SLANG_OPER_FIELD; - op->a_id = parse_identifier(C); - if (op->a_id == SLANG_ATOM_NULL) - RETURN0; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_POSTINCREMENT: - op->type = SLANG_OPER_POSTINCREMENT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - case OP_POSTDECREMENT: - op->type = SLANG_OPER_POSTDECREMENT; - if (!handle_nary_expression(C, op, &ops, &num_ops, 1)) - RETURN0; - break; - default: - RETURN0; - } - } - C->I++; - - slang_operation_destruct(oper); - *oper = *ops; /* struct copy */ - _slang_free(ops); - - return 1; -} - -/* parameter qualifier */ -#define PARAM_QUALIFIER_IN 0 -#define PARAM_QUALIFIER_OUT 1 -#define PARAM_QUALIFIER_INOUT 2 - -/* function parameter array presence */ -#define PARAMETER_ARRAY_NOT_PRESENT 0 -#define PARAMETER_ARRAY_PRESENT 1 - -static int -parse_parameter_declaration(slang_parse_ctx * C, slang_output_ctx * O, - slang_variable * param) -{ - int param_qual, precision_qual; - - /* parse and validate the parameter's type qualifiers (there can be - * two at most) because not all combinations are valid - */ - if (!parse_type_qualifier(C, ¶m->type.qualifier)) - RETURN0; - - param_qual = *C->I++; - switch (param_qual) { - case PARAM_QUALIFIER_IN: - if (param->type.qualifier != SLANG_QUAL_CONST - && param->type.qualifier != SLANG_QUAL_NONE) { - slang_info_log_error(C->L, "Invalid type qualifier."); - RETURN0; - } - break; - case PARAM_QUALIFIER_OUT: - if (param->type.qualifier == SLANG_QUAL_NONE) - param->type.qualifier = SLANG_QUAL_OUT; - else { - slang_info_log_error(C->L, "Invalid type qualifier."); - RETURN0; - } - break; - case PARAM_QUALIFIER_INOUT: - if (param->type.qualifier == SLANG_QUAL_NONE) - param->type.qualifier = SLANG_QUAL_INOUT; - else { - slang_info_log_error(C->L, "Invalid type qualifier."); - RETURN0; - } - break; - default: - RETURN0; - } - - /* parse precision qualifier (lowp, mediump, highp */ - precision_qual = *C->I++; - /* ignored at this time */ - (void) precision_qual; - - /* parse parameter's type specifier and name */ - if (!parse_type_specifier(C, O, ¶m->type.specifier)) - RETURN0; - if (!parse_type_array_size(C, O, ¶m->type.array_len)) - RETURN0; - param->a_name = parse_identifier(C); - if (param->a_name == SLANG_ATOM_NULL) - RETURN0; - - /* first-class array - */ - if (param->type.array_len >= 0) { - slang_type_specifier p; - - slang_type_specifier_ctr(&p); - if (!slang_type_specifier_copy(&p, ¶m->type.specifier)) { - slang_type_specifier_dtr(&p); - RETURN0; - } - if (!convert_to_array(C, param, &p)) { - slang_type_specifier_dtr(&p); - RETURN0; - } - slang_type_specifier_dtr(&p); - param->array_len = param->type.array_len; - } - - /* if the parameter is an array, parse its size (the size must be - * explicitly defined - */ - if (*C->I++ == PARAMETER_ARRAY_PRESENT) { - slang_type_specifier p; - - if (param->type.array_len >= 0) { - slang_info_log_error(C->L, "multi-dimensional arrays not allowed"); - RETURN0; - } - slang_type_specifier_ctr(&p); - if (!slang_type_specifier_copy(&p, ¶m->type.specifier)) { - slang_type_specifier_dtr(&p); - RETURN0; - } - if (!convert_to_array(C, param, &p)) { - slang_type_specifier_dtr(&p); - RETURN0; - } - slang_type_specifier_dtr(&p); - if (!parse_array_len(C, O, ¶m->array_len)) - RETURN0; - } - -#if 0 - /* calculate the parameter size */ - if (!calculate_var_size(C, O, param)) - RETURN0; -#endif - /* TODO: allocate the local address here? */ - return 1; -} - -/* function type */ -#define FUNCTION_ORDINARY 0 -#define FUNCTION_CONSTRUCTOR 1 -#define FUNCTION_OPERATOR 2 - -/* function parameter */ -#define PARAMETER_NONE 0 -#define PARAMETER_NEXT 1 - -/* operator type */ -#define OPERATOR_ADDASSIGN 1 -#define OPERATOR_SUBASSIGN 2 -#define OPERATOR_MULASSIGN 3 -#define OPERATOR_DIVASSIGN 4 -/*#define OPERATOR_MODASSIGN 5*/ -/*#define OPERATOR_LSHASSIGN 6*/ -/*#define OPERATOR_RSHASSIGN 7*/ -/*#define OPERATOR_ANDASSIGN 8*/ -/*#define OPERATOR_XORASSIGN 9*/ -/*#define OPERATOR_ORASSIGN 10*/ -#define OPERATOR_LOGICALXOR 11 -/*#define OPERATOR_BITOR 12*/ -/*#define OPERATOR_BITXOR 13*/ -/*#define OPERATOR_BITAND 14*/ -#define OPERATOR_LESS 15 -#define OPERATOR_GREATER 16 -#define OPERATOR_LESSEQUAL 17 -#define OPERATOR_GREATEREQUAL 18 -/*#define OPERATOR_LSHIFT 19*/ -/*#define OPERATOR_RSHIFT 20*/ -#define OPERATOR_MULTIPLY 21 -#define OPERATOR_DIVIDE 22 -/*#define OPERATOR_MODULUS 23*/ -#define OPERATOR_INCREMENT 24 -#define OPERATOR_DECREMENT 25 -#define OPERATOR_PLUS 26 -#define OPERATOR_MINUS 27 -/*#define OPERATOR_COMPLEMENT 28*/ -#define OPERATOR_NOT 29 - -static const struct -{ - unsigned int o_code; - const char *o_name; -} operator_names[] = { - {OPERATOR_INCREMENT, "++"}, - {OPERATOR_ADDASSIGN, "+="}, - {OPERATOR_PLUS, "+"}, - {OPERATOR_DECREMENT, "--"}, - {OPERATOR_SUBASSIGN, "-="}, - {OPERATOR_MINUS, "-"}, - {OPERATOR_NOT, "!"}, - {OPERATOR_MULASSIGN, "*="}, - {OPERATOR_MULTIPLY, "*"}, - {OPERATOR_DIVASSIGN, "/="}, - {OPERATOR_DIVIDE, "/"}, - {OPERATOR_LESSEQUAL, "<="}, - /*{ OPERATOR_LSHASSIGN, "<<=" }, */ - /*{ OPERATOR_LSHIFT, "<<" }, */ - {OPERATOR_LESS, "<"}, - {OPERATOR_GREATEREQUAL, ">="}, - /*{ OPERATOR_RSHASSIGN, ">>=" }, */ - /*{ OPERATOR_RSHIFT, ">>" }, */ - {OPERATOR_GREATER, ">"}, - /*{ OPERATOR_MODASSIGN, "%=" }, */ - /*{ OPERATOR_MODULUS, "%" }, */ - /*{ OPERATOR_ANDASSIGN, "&=" }, */ - /*{ OPERATOR_BITAND, "&" }, */ - /*{ OPERATOR_ORASSIGN, "|=" }, */ - /*{ OPERATOR_BITOR, "|" }, */ - /*{ OPERATOR_COMPLEMENT, "~" }, */ - /*{ OPERATOR_XORASSIGN, "^=" }, */ - {OPERATOR_LOGICALXOR, "^^"}, - /*{ OPERATOR_BITXOR, "^" } */ -}; - -static slang_atom -parse_operator_name(slang_parse_ctx * C) -{ - unsigned int i; - - for (i = 0; i < sizeof(operator_names) / sizeof(*operator_names); i++) { - if (operator_names[i].o_code == (unsigned int) (*C->I)) { - slang_atom atom = - slang_atom_pool_atom(C->atoms, operator_names[i].o_name); - if (atom == SLANG_ATOM_NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - C->I++; - return atom; - } - } - RETURN0; -} - - -static int -parse_function_prototype(slang_parse_ctx * C, slang_output_ctx * O, - slang_function * func) -{ - GLuint functype; - /* parse function type and name */ - if (!parse_fully_specified_type(C, O, &func->header.type)) - RETURN0; - - functype = *C->I++; - switch (functype) { - case FUNCTION_ORDINARY: - func->kind = SLANG_FUNC_ORDINARY; - func->header.a_name = parse_identifier(C); - if (func->header.a_name == SLANG_ATOM_NULL) - RETURN0; - break; - case FUNCTION_CONSTRUCTOR: - func->kind = SLANG_FUNC_CONSTRUCTOR; - if (func->header.type.specifier.type == SLANG_SPEC_STRUCT) - RETURN0; - func->header.a_name = - slang_atom_pool_atom(C->atoms, - slang_type_specifier_type_to_string - (func->header.type.specifier.type)); - if (func->header.a_name == SLANG_ATOM_NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - break; - case FUNCTION_OPERATOR: - func->kind = SLANG_FUNC_OPERATOR; - func->header.a_name = parse_operator_name(C); - if (func->header.a_name == SLANG_ATOM_NULL) - RETURN0; - break; - default: - RETURN0; - } - - if (!legal_identifier(func->header.a_name)) { - slang_info_log_error(C->L, "illegal function name '%s'", - (char *) func->header.a_name); - RETURN0; - } - - /* parse function parameters */ - while (*C->I++ == PARAMETER_NEXT) { - slang_variable *p = slang_variable_scope_grow(func->parameters); - if (!p) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!parse_parameter_declaration(C, O, p)) - RETURN0; - } - - /* if the function returns a value, append a hidden __retVal 'out' - * parameter that corresponds to the return value. - */ - if (_slang_function_has_return_value(func)) { - slang_variable *p = slang_variable_scope_grow(func->parameters); - slang_atom a_retVal = slang_atom_pool_atom(C->atoms, "__retVal"); - assert(a_retVal); - p->a_name = a_retVal; - p->type = func->header.type; - p->type.qualifier = SLANG_QUAL_OUT; - } - - /* function formal parameters and local variables share the same - * scope, so save the information about param count in a seperate - * place also link the scope to the global variable scope so when a - * given identifier is not found here, the search process continues - * in the global space - */ - func->param_count = func->parameters->num_variables; - func->parameters->outer_scope = O->vars; - - return 1; -} - -static int -parse_function_definition(slang_parse_ctx * C, slang_output_ctx * O, - slang_function * func) -{ - slang_output_ctx o = *O; - - if (!parse_function_prototype(C, O, func)) - RETURN0; - - /* create function's body operation */ - func->body = (slang_operation *) _slang_alloc(sizeof(slang_operation)); - if (func->body == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!slang_operation_construct(func->body)) { - _slang_free(func->body); - func->body = NULL; - slang_info_log_memory(C->L); - RETURN0; - } - - /* to parse the body the parse context is modified in order to - * capture parsed variables into function's local variable scope - */ - C->global_scope = GL_FALSE; - o.vars = func->parameters; - if (!parse_statement(C, &o, func->body)) - RETURN0; - - C->global_scope = GL_TRUE; - return 1; -} - -static GLboolean -initialize_global(slang_assemble_ctx * A, slang_variable * var) -{ - slang_operation op_id, op_assign; - GLboolean result; - - /* construct the left side of assignment */ - if (!slang_operation_construct(&op_id)) - return GL_FALSE; - op_id.type = SLANG_OPER_IDENTIFIER; - op_id.a_id = var->a_name; - - /* put the variable into operation's scope */ - op_id.locals->variables = - (slang_variable **) _slang_alloc(sizeof(slang_variable *)); - if (op_id.locals->variables == NULL) { - slang_operation_destruct(&op_id); - return GL_FALSE; - } - op_id.locals->num_variables = 1; - op_id.locals->variables[0] = var; - - /* construct the assignment expression */ - if (!slang_operation_construct(&op_assign)) { - op_id.locals->num_variables = 0; - slang_operation_destruct(&op_id); - return GL_FALSE; - } - op_assign.type = SLANG_OPER_ASSIGN; - op_assign.children = - (slang_operation *) _slang_alloc(2 * sizeof(slang_operation)); - if (op_assign.children == NULL) { - slang_operation_destruct(&op_assign); - op_id.locals->num_variables = 0; - slang_operation_destruct(&op_id); - return GL_FALSE; - } - op_assign.num_children = 2; - op_assign.children[0] = op_id; - op_assign.children[1] = *var->initializer; - - result = 1; - - /* carefully destroy the operations */ - op_assign.num_children = 0; - _slang_free(op_assign.children); - op_assign.children = NULL; - slang_operation_destruct(&op_assign); - op_id.locals->num_variables = 0; - slang_operation_destruct(&op_id); - - if (!result) - return GL_FALSE; - - return GL_TRUE; -} - -/* init declarator list */ -#define DECLARATOR_NONE 0 -#define DECLARATOR_NEXT 1 - -/* variable declaration */ -#define VARIABLE_NONE 0 -#define VARIABLE_IDENTIFIER 1 -#define VARIABLE_INITIALIZER 2 -#define VARIABLE_ARRAY_EXPLICIT 3 -#define VARIABLE_ARRAY_UNKNOWN 4 - - -/** - * Check if it's OK to re-declare a variable with the given new type. - * This happens when applying layout qualifiers to gl_FragCoord or - * (re)setting an array size. - * If redeclaration is OK, return a pointer to the incoming variable - * updated with new type info. Else return NULL; - */ -static slang_variable * -redeclare_variable(slang_variable *var, - const slang_fully_specified_type *type) -{ - if (slang_fully_specified_types_compatible(&var->type, type)) { - /* replace orig var layout with new layout */ - var->type.layout = type->layout; - - /* XXX there may be other type updates in the future here */ - - return var; - } - else - return NULL; -} - - -/** - * Parse the initializer for a variable declaration. - */ -static int -parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O, - const slang_fully_specified_type * type) -{ - GET_CURRENT_CONTEXT(ctx); /* a hack */ - slang_variable *var = NULL, *prevDecl; - slang_atom a_name; - - /* empty init declatator (without name, e.g. "float ;") */ - if (*C->I++ == VARIABLE_NONE) - return 1; - - a_name = parse_identifier(C); - - /* check if name is already in this scope */ - prevDecl = _slang_variable_locate(O->vars, a_name, C->global_scope); - if (prevDecl) { - /* A var with this name has already been declared. - * Check if redeclaring the var with a different type/layout is legal. - */ - if (C->global_scope) { - var = redeclare_variable(prevDecl, type); - } - if (!var) { - slang_info_log_error(C->L, - "declaration of '%s' conflicts with previous declaration", - (char *) a_name); - RETURN0; - } - } - - if (!var) { - /* make room for a new variable and initialize it */ - var = slang_variable_scope_grow(O->vars); - if (!var) { - slang_info_log_memory(C->L); - RETURN0; - } - - /* copy the declarator type qualifier/etc info, parse the identifier */ - var->type.qualifier = type->qualifier; - var->type.centroid = type->centroid; - var->type.precision = type->precision; - var->type.specifier = type->specifier;/*new*/ - var->type.variant = type->variant; - var->type.layout = type->layout; - var->type.array_len = type->array_len; - var->a_name = a_name; - if (var->a_name == SLANG_ATOM_NULL) - RETURN0; - } - - switch (*C->I++) { - case VARIABLE_NONE: - /* simple variable declarator - just copy the specifier */ - if (!slang_type_specifier_copy(&var->type.specifier, &type->specifier)) - RETURN0; - break; - case VARIABLE_INITIALIZER: - /* initialized variable - copy the specifier and parse the expression */ - if (0 && type->array_len >= 0) { - /* The type was something like "float[4]" */ - convert_to_array(C, var, &type->specifier); - var->array_len = type->array_len; - } - else { - if (!slang_type_specifier_copy(&var->type.specifier, &type->specifier)) - RETURN0; - } - var->initializer = - (slang_operation *) _slang_alloc(sizeof(slang_operation)); - if (var->initializer == NULL) { - slang_info_log_memory(C->L); - RETURN0; - } - if (!slang_operation_construct(var->initializer)) { - _slang_free(var->initializer); - var->initializer = NULL; - slang_info_log_memory(C->L); - RETURN0; - } - if (!parse_expression(C, O, var->initializer)) - RETURN0; - break; - case VARIABLE_ARRAY_UNKNOWN: - /* unsized array - mark it as array and copy the specifier to - * the array element - */ - if (type->array_len >= 0) { - slang_info_log_error(C->L, "multi-dimensional arrays not allowed"); - RETURN0; - } - if (!convert_to_array(C, var, &type->specifier)) - return GL_FALSE; - break; - case VARIABLE_ARRAY_EXPLICIT: - if (type->array_len >= 0) { - /* the user is trying to do something like: float[2] x[3]; */ - slang_info_log_error(C->L, "multi-dimensional arrays not allowed"); - RETURN0; - } - if (!convert_to_array(C, var, &type->specifier)) - return GL_FALSE; - if (!parse_array_len(C, O, &var->array_len)) - return GL_FALSE; - break; - default: - RETURN0; - } - - /* allocate global address space for a variable with a known size */ - if (C->global_scope - && !(var->type.specifier.type == SLANG_SPEC_ARRAY - && var->array_len == 0)) { - if (!calculate_var_size(C, O, var)) - return GL_FALSE; - } - - /* emit code for global var decl */ - if (C->global_scope) { - slang_assemble_ctx A; - memset(&A, 0, sizeof(slang_assemble_ctx)); - A.allow_uniform_initializers = C->version > 110; - A.atoms = C->atoms; - A.space.funcs = O->funs; - A.space.structs = O->structs; - A.space.vars = O->vars; - A.program = O->program; - A.pragmas = O->pragmas; - A.vartable = O->vartable; - A.log = C->L; - A.curFuncEndLabel = NULL; - A.EmitContReturn = ctx->Shader.EmitContReturn; - if (!_slang_codegen_global_variable(&A, var, C->type)) - RETURN0; - } - - /* initialize global variable */ - if (C->global_scope) { - if (var->initializer != NULL) { - slang_assemble_ctx A; - memset(&A, 0, sizeof(slang_assemble_ctx)); - A.allow_uniform_initializers = C->version > 110; - A.atoms = C->atoms; - A.space.funcs = O->funs; - A.space.structs = O->structs; - A.space.vars = O->vars; - if (!initialize_global(&A, var)) - RETURN0; - } - } - - if (var->type.qualifier == SLANG_QUAL_FIXEDINPUT && - var->a_name == slang_atom_pool_atom(C->atoms, "gl_FragCoord")) { - /* set the program's PixelCenterInteger, OriginUpperLeft fields */ - struct gl_fragment_program *fragProg = - (struct gl_fragment_program *) O->program; - - if (var->type.layout & SLANG_LAYOUT_UPPER_LEFT_BIT) { - fragProg->OriginUpperLeft = GL_TRUE; - } - if (var->type.layout & SLANG_LAYOUT_PIXEL_CENTER_INTEGER_BIT) { - fragProg->PixelCenterInteger = GL_TRUE; - } - } - - return 1; -} - -/** - * Parse a list of variable declarations. Each variable may have an - * initializer. - */ -static int -parse_init_declarator_list(slang_parse_ctx * C, slang_output_ctx * O) -{ - slang_fully_specified_type type; - - /* parse the fully specified type, common to all declarators */ - if (!slang_fully_specified_type_construct(&type)) - RETURN0; - if (!parse_fully_specified_type(C, O, &type)) { - slang_fully_specified_type_destruct(&type); - RETURN0; - } - - /* parse declarators, pass-in the parsed type */ - do { - if (!parse_init_declarator(C, O, &type)) { - slang_fully_specified_type_destruct(&type); - RETURN0; - } - } - while (*C->I++ == DECLARATOR_NEXT); - - slang_fully_specified_type_destruct(&type); - return 1; -} - - -/** - * Parse a function definition or declaration. - * \param C parsing context - * \param O output context - * \param definition if non-zero expect a definition, else a declaration - * \param parsed_func_ret returns the parsed function - * \return GL_TRUE if success, GL_FALSE if failure - */ -static GLboolean -parse_function(slang_parse_ctx * C, slang_output_ctx * O, int definition, - slang_function ** parsed_func_ret) -{ - slang_function parsed_func, *found_func; - - /* parse function definition/declaration */ - if (!slang_function_construct(&parsed_func)) - return GL_FALSE; - if (definition) { - if (!parse_function_definition(C, O, &parsed_func)) { - slang_function_destruct(&parsed_func); - return GL_FALSE; - } - } - else { - if (!parse_function_prototype(C, O, &parsed_func)) { - slang_function_destruct(&parsed_func); - return GL_FALSE; - } - } - - /* find a function with a prototype matching the parsed one - only - * the current scope is being searched to allow built-in function - * overriding - */ - found_func = slang_function_scope_find(O->funs, &parsed_func, 0); - if (found_func == NULL) { - /* New function, add it to the function list */ - O->funs->functions = - (slang_function *) _slang_realloc(O->funs->functions, - O->funs->num_functions - * sizeof(slang_function), - (O->funs->num_functions + 1) - * sizeof(slang_function)); - if (O->funs->functions == NULL) { - /* Make sure that there are no functions marked, as the - * allocation is currently NULL, in order to avoid - * a potental segfault as we clean up later. - */ - O->funs->num_functions = 0; - - slang_info_log_memory(C->L); - slang_function_destruct(&parsed_func); - return GL_FALSE; - } - O->funs->functions[O->funs->num_functions] = parsed_func; - O->funs->num_functions++; - - /* return the newly parsed function */ - *parsed_func_ret = &O->funs->functions[O->funs->num_functions - 1]; - } - else { - /* previously defined or declared */ - /* TODO: check function return type qualifiers and specifiers */ - if (definition) { - if (found_func->body != NULL) { - slang_info_log_error(C->L, "%s: function already has a body.", - slang_atom_pool_id(C->atoms, - parsed_func.header. - a_name)); - slang_function_destruct(&parsed_func); - return GL_FALSE; - } - - /* destroy the existing function declaration and replace it - * with the new one - */ - slang_function_destruct(found_func); - *found_func = parsed_func; - } - else { - /* another declaration of the same function prototype - ignore it */ - slang_function_destruct(&parsed_func); - } - - /* return the found function */ - *parsed_func_ret = found_func; - } - - return GL_TRUE; -} - -/* declaration */ -#define DECLARATION_FUNCTION_PROTOTYPE 1 -#define DECLARATION_INIT_DECLARATOR_LIST 2 - -static int -parse_declaration(slang_parse_ctx * C, slang_output_ctx * O) -{ - switch (*C->I++) { - case DECLARATION_INIT_DECLARATOR_LIST: - if (!parse_init_declarator_list(C, O)) - RETURN0; - break; - case DECLARATION_FUNCTION_PROTOTYPE: - { - slang_function *dummy_func; - - if (!parse_function(C, O, 0, &dummy_func)) - RETURN0; - } - break; - default: - RETURN0; - } - return 1; -} - -static int -parse_default_precision(slang_parse_ctx * C, slang_output_ctx * O) -{ - int precision, type; - - if (!O->allow_precision) { - slang_info_log_error(C->L, "syntax error at \"precision\""); - RETURN0; - } - - precision = *C->I++; - switch (precision) { - case PRECISION_LOW: - case PRECISION_MEDIUM: - case PRECISION_HIGH: - /* OK */ - break; - default: - _mesa_problem(NULL, "unexpected precision %d at %s:%d\n", - precision, __FILE__, __LINE__); - RETURN0; - } - - type = *C->I++; - switch (type) { - case TYPE_SPECIFIER_FLOAT: - case TYPE_SPECIFIER_INT: - case TYPE_SPECIFIER_SAMPLER1D: - case TYPE_SPECIFIER_SAMPLER2D: - case TYPE_SPECIFIER_SAMPLER3D: - case TYPE_SPECIFIER_SAMPLERCUBE: - case TYPE_SPECIFIER_SAMPLER1DSHADOW: - case TYPE_SPECIFIER_SAMPLER2DSHADOW: - case TYPE_SPECIFIER_SAMPLER2DRECT: - case TYPE_SPECIFIER_SAMPLER2DRECTSHADOW: - case TYPE_SPECIFIER_SAMPLER_1D_ARRAY: - case TYPE_SPECIFIER_SAMPLER_2D_ARRAY: - case TYPE_SPECIFIER_SAMPLER_1D_ARRAY_SHADOW: - case TYPE_SPECIFIER_SAMPLER_2D_ARRAY_SHADOW: - /* OK */ - break; - default: - _mesa_problem(NULL, "unexpected type %d at %s:%d\n", - type, __FILE__, __LINE__); - RETURN0; - } - - assert(type < TYPE_SPECIFIER_COUNT); - O->default_precision[type] = precision; - - return 1; -} - - -/** - * Initialize the default precision for all types. - * XXX this info isn't used yet. - */ -static void -init_default_precision(slang_output_ctx *O, slang_unit_type type) -{ - GLuint i; - for (i = 0; i < TYPE_SPECIFIER_COUNT; i++) { -#if FEATURE_es2_glsl - O->default_precision[i] = PRECISION_LOW; -#else - O->default_precision[i] = PRECISION_HIGH; -#endif - } - - if (type == SLANG_UNIT_VERTEX_SHADER) { - O->default_precision[TYPE_SPECIFIER_FLOAT] = PRECISION_HIGH; - O->default_precision[TYPE_SPECIFIER_INT] = PRECISION_HIGH; - } - else { - O->default_precision[TYPE_SPECIFIER_INT] = PRECISION_MEDIUM; - } -} - - -static int -parse_invariant(slang_parse_ctx * C, slang_output_ctx * O) -{ - if (O->allow_invariant) { - slang_atom *a = parse_identifier(C); - /* XXX not doing anything with this var yet */ - /*printf("ID: %s\n", (char*) a);*/ - return a ? 1 : 0; - } - else { - slang_info_log_error(C->L, "syntax error at \"invariant\""); - RETURN0; - } -} - - -/* external declaration or default precision specifier */ -#define EXTERNAL_NULL 0 -#define EXTERNAL_FUNCTION_DEFINITION 1 -#define EXTERNAL_DECLARATION 2 -#define DEFAULT_PRECISION 3 -#define INVARIANT_STMT 4 - - -static GLboolean -parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit, - struct gl_shader *shader) -{ - GET_CURRENT_CONTEXT(ctx); - slang_output_ctx o; - GLboolean success; - GLuint maxRegs; - slang_function *mainFunc = NULL; - - if (unit->type == SLANG_UNIT_FRAGMENT_BUILTIN || - unit->type == SLANG_UNIT_FRAGMENT_SHADER) { - maxRegs = ctx->Const.FragmentProgram.MaxTemps; - } - else { - assert(unit->type == SLANG_UNIT_VERTEX_BUILTIN || - unit->type == SLANG_UNIT_VERTEX_SHADER); - maxRegs = ctx->Const.VertexProgram.MaxTemps; - } - - /* setup output context */ - o.funs = &unit->funs; - o.structs = &unit->structs; - o.vars = &unit->vars; - o.program = shader ? shader->Program : NULL; - o.pragmas = shader ? &shader->Pragmas : NULL; - o.vartable = _slang_new_var_table(maxRegs); - _slang_push_var_table(o.vartable); - - /* allow 'invariant' keyword? */ -#if FEATURE_es2_glsl - o.allow_invariant = GL_TRUE; -#else - o.allow_invariant = (C->version >= 120) ? GL_TRUE : GL_FALSE; -#endif - - /* allow 'centroid' keyword? */ - o.allow_centroid = (C->version >= 120) ? GL_TRUE : GL_FALSE; - - /* allow 'lowp/mediump/highp' keywords? */ -#if FEATURE_es2_glsl - o.allow_precision = GL_TRUE; -#else - o.allow_precision = (C->version >= 120) ? GL_TRUE : GL_FALSE; -#endif - init_default_precision(&o, unit->type); - - /* allow 'float[]' keyword? */ - o.allow_array_types = (C->version >= 120) ? GL_TRUE : GL_FALSE; - - /* parse individual functions and declarations */ - while (*C->I != EXTERNAL_NULL) { - switch (*C->I++) { - case EXTERNAL_FUNCTION_DEFINITION: - { - slang_function *func; - success = parse_function(C, &o, 1, &func); - if (success && strcmp((char *) func->header.a_name, "main") == 0) { - /* found main() */ - mainFunc = func; - } - } - break; - case EXTERNAL_DECLARATION: - success = parse_declaration(C, &o); - break; - case DEFAULT_PRECISION: - success = parse_default_precision(C, &o); - break; - case INVARIANT_STMT: - success = parse_invariant(C, &o); - break; - default: - success = GL_FALSE; - } - - if (!success) { - /* xxx free codegen */ - _slang_pop_var_table(o.vartable); - return GL_FALSE; - } - } - C->I++; - - if (mainFunc) { - /* assemble (generate code) for main() */ - slang_assemble_ctx A; - memset(&A, 0, sizeof(slang_assemble_ctx)); - A.atoms = C->atoms; - A.space.funcs = o.funs; - A.space.structs = o.structs; - A.space.vars = o.vars; - A.program = o.program; - A.pragmas = &shader->Pragmas; - A.vartable = o.vartable; - A.EmitContReturn = ctx->Shader.EmitContReturn; - A.log = C->L; - A.allow_uniform_initializers = C->version > 110; - - /* main() takes no parameters */ - if (mainFunc->param_count > 0) { - slang_info_log_error(A.log, "main() takes no arguments"); - return GL_FALSE; - } - - _slang_codegen_function(&A, mainFunc); - - shader->Main = GL_TRUE; /* this shader defines main() */ - - shader->UnresolvedRefs = A.UnresolvedRefs; - } - - _slang_pop_var_table(o.vartable); - _slang_delete_var_table(o.vartable); - - return GL_TRUE; -} - -static GLboolean -compile_binary(const unsigned char * prod, slang_code_unit * unit, - GLuint version, - slang_unit_type type, slang_info_log * infolog, - slang_code_unit * builtin, slang_code_unit * downlink, - struct gl_shader *shader) -{ - slang_parse_ctx C; - - unit->type = type; - - /* setup parse context */ - C.I = prod; - C.L = infolog; - C.parsing_builtin = (builtin == NULL); - C.global_scope = GL_TRUE; - C.atoms = &unit->object->atompool; - C.type = type; - C.version = version; - - if (!check_revision(&C)) - return GL_FALSE; - - if (downlink != NULL) { - unit->vars.outer_scope = &downlink->vars; - unit->funs.outer_scope = &downlink->funs; - unit->structs.outer_scope = &downlink->structs; - } - - /* parse translation unit */ - return parse_code_unit(&C, unit, shader); -} - -static GLboolean -compile_with_grammar(const char *source, - slang_code_unit *unit, - slang_unit_type type, - slang_info_log *infolog, - slang_code_unit *builtin, - struct gl_shader *shader, - struct gl_sl_pragmas *pragmas, - unsigned int shader_type, - unsigned int parsing_builtin) -{ - struct sl_pp_purify_options options; - struct sl_pp_context *context; - unsigned char *prod; - GLuint size; - unsigned int version; - unsigned int maxVersion; - int result; - char errmsg[200] = ""; - - assert(shader_type == 1 || shader_type == 2); - - memset(&options, 0, sizeof(options)); - - context = sl_pp_context_create(source, &options); - if (!context) { - slang_info_log_error(infolog, "out of memory"); - return GL_FALSE; - } - - if (sl_pp_version(context, &version)) { - slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - return GL_FALSE; - } - - if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") || - sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) { - slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - return GL_FALSE; - } - - if (type == SLANG_UNIT_FRAGMENT_SHADER) { - sl_pp_context_add_extension(context, "GL_ARB_fragment_coord_conventions"); - } - - -#if FEATURE_es2_glsl - if (sl_pp_context_add_predefined(context, "GL_ES", "1") || - sl_pp_context_add_predefined(context, "GL_FRAGMENT_PRECISION_HIGH", "1")) { - slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context)); - sl_pp_context_destroy(context); - return GL_FALSE; - } -#endif - -#if FEATURE_ARB_shading_language_120 - maxVersion = 120; -#elif FEATURE_es2_glsl - maxVersion = 100; -#else - maxVersion = 110; -#endif - - if (version > maxVersion || - (version != 100 && version != 110 && version != 120)) { - slang_info_log_error(infolog, - "language version %.2f is not supported.", - version * 0.01); - sl_pp_context_destroy(context); - return GL_FALSE; - } - - /* Finally check the syntax and generate its binary representation. */ - result = sl_cl_compile(context, - shader_type, - parsing_builtin, - &prod, - &size, - errmsg, - sizeof(errmsg)); - - sl_pp_context_destroy(context); - - if (result) { - /*GLint pos;*/ - - slang_info_log_error(infolog, errmsg); - /* syntax error (possibly in library code) */ -#if 0 - { - int line, col; - char *s; - s = (char *) _mesa_find_line_column((const GLubyte *) source, - (const GLubyte *) source + pos, - &line, &col); - printf("Error on line %d, col %d: %s\n", line, col, s); - } -#endif - return GL_FALSE; - } - - /* Syntax is okay - translate it to internal representation. */ - if (!compile_binary(prod, unit, version, type, infolog, builtin, - &builtin[SLANG_BUILTIN_TOTAL - 1], - shader)) { - free(prod); - return GL_FALSE; - } - free(prod); - return GL_TRUE; -} - -static const unsigned char slang_core_gc[] = { -#include "library/slang_core_gc.h" -}; - -static const unsigned char slang_120_core_gc[] = { -#include "library/slang_120_core_gc.h" -}; - -static const unsigned char slang_120_fragment_gc[] = { -#include "library/slang_builtin_120_fragment_gc.h" -}; - -static const unsigned char slang_common_builtin_gc[] = { -#include "library/slang_common_builtin_gc.h" -}; - -static const unsigned char slang_fragment_builtin_gc[] = { -#include "library/slang_fragment_builtin_gc.h" -}; - -static const unsigned char slang_vertex_builtin_gc[] = { -#include "library/slang_vertex_builtin_gc.h" -}; - -static GLboolean -compile_object(const char *source, - slang_code_object *object, - slang_unit_type type, - slang_info_log *infolog, - struct gl_shader *shader, - struct gl_sl_pragmas *pragmas) -{ - slang_code_unit *builtins = NULL; - GLuint base_version = 110; - unsigned int shader_type; - unsigned int parsing_builtin; - - /* set shader type - the syntax is slightly different for different shaders */ - if (type == SLANG_UNIT_FRAGMENT_SHADER || type == SLANG_UNIT_FRAGMENT_BUILTIN) { - shader_type = 1; - } else { - shader_type = 2; - } - - /* enable language extensions */ - parsing_builtin = 1; - - /* if parsing user-specified shader, load built-in library */ - if (type == SLANG_UNIT_FRAGMENT_SHADER || type == SLANG_UNIT_VERTEX_SHADER) { - /* compile core functionality first */ - if (!compile_binary(slang_core_gc, - &object->builtin[SLANG_BUILTIN_CORE], - base_version, - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, - NULL, NULL, NULL)) - return GL_FALSE; - -#if FEATURE_ARB_shading_language_120 - if (!compile_binary(slang_120_core_gc, - &object->builtin[SLANG_BUILTIN_120_CORE], - 120, - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, - NULL, &object->builtin[SLANG_BUILTIN_CORE], NULL)) - return GL_FALSE; -#endif - - /* compile common functions and variables, link to core */ - if (!compile_binary(slang_common_builtin_gc, - &object->builtin[SLANG_BUILTIN_COMMON], -#if FEATURE_ARB_shading_language_120 - 120, -#else - base_version, -#endif - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL, -#if FEATURE_ARB_shading_language_120 - &object->builtin[SLANG_BUILTIN_120_CORE], -#else - &object->builtin[SLANG_BUILTIN_CORE], -#endif - NULL)) - return GL_FALSE; - - /* compile target-specific functions and variables, link to common */ - if (type == SLANG_UNIT_FRAGMENT_SHADER) { - if (!compile_binary(slang_fragment_builtin_gc, - &object->builtin[SLANG_BUILTIN_TARGET], - base_version, - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL, - &object->builtin[SLANG_BUILTIN_COMMON], NULL)) - return GL_FALSE; -#if FEATURE_ARB_shading_language_120 - if (!compile_binary(slang_120_fragment_gc, - &object->builtin[SLANG_BUILTIN_TARGET], - 120, - SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL, - &object->builtin[SLANG_BUILTIN_COMMON], NULL)) - return GL_FALSE; -#endif - } - else if (type == SLANG_UNIT_VERTEX_SHADER) { - if (!compile_binary(slang_vertex_builtin_gc, - &object->builtin[SLANG_BUILTIN_TARGET], - base_version, - SLANG_UNIT_VERTEX_BUILTIN, infolog, NULL, - &object->builtin[SLANG_BUILTIN_COMMON], NULL)) - return GL_FALSE; - } - - /* disable language extensions */ - parsing_builtin = 0; - - builtins = object->builtin; - } - - /* compile the actual shader - pass-in built-in library for external shader */ - return compile_with_grammar(source, - &object->unit, - type, - infolog, - builtins, - shader, - pragmas, - shader_type, - parsing_builtin); -} - - -GLboolean -_slang_compile(GLcontext *ctx, struct gl_shader *shader) -{ - GLboolean success; - slang_info_log info_log; - slang_code_object obj; - slang_unit_type type; - GLenum progTarget; - - if (shader->Type == GL_VERTEX_SHADER) { - type = SLANG_UNIT_VERTEX_SHADER; - } - else { - assert(shader->Type == GL_FRAGMENT_SHADER); - type = SLANG_UNIT_FRAGMENT_SHADER; - } - - if (!shader->Source) - return GL_FALSE; - - ctx->Shader.MemPool = _slang_new_mempool(1024*1024); - - shader->Main = GL_FALSE; - - /* free the shader's old instructions, etc */ - _mesa_reference_program(ctx, &shader->Program, NULL); - - /* allocate new GPU program, parameter lists, etc. */ - if (shader->Type == GL_VERTEX_SHADER) - progTarget = GL_VERTEX_PROGRAM_ARB; - else - progTarget = GL_FRAGMENT_PROGRAM_ARB; - shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1); - shader->Program->Parameters = _mesa_new_parameter_list(); - shader->Program->Varying = _mesa_new_parameter_list(); - shader->Program->Attributes = _mesa_new_parameter_list(); - - slang_info_log_construct(&info_log); - _slang_code_object_ctr(&obj); - - success = compile_object(shader->Source, - &obj, - type, - &info_log, - shader, - &shader->Pragmas); - - /* free shader's prev info log */ - if (shader->InfoLog) { - free(shader->InfoLog); - shader->InfoLog = NULL; - } - - if (info_log.text) { - /* copy info-log string to shader object */ - shader->InfoLog = _mesa_strdup(info_log.text); - } - - if (info_log.error_flag) { - success = GL_FALSE; - } - - slang_info_log_destruct(&info_log); - _slang_code_object_dtr(&obj); - - _slang_delete_mempool((slang_mempool *) ctx->Shader.MemPool); - ctx->Shader.MemPool = NULL; - - /* remove any reads of output registers */ -#if 0 - printf("Pre-remove output reads:\n"); - _mesa_print_program(shader->Program); -#endif - _mesa_remove_output_reads(shader->Program, PROGRAM_OUTPUT); - if (shader->Type == GL_VERTEX_SHADER) { - /* and remove writes to varying vars in vertex programs */ - _mesa_remove_output_reads(shader->Program, PROGRAM_VARYING); - } -#if 0 - printf("Post-remove output reads:\n"); - _mesa_print_program(shader->Program); -#endif - - shader->CompileStatus = success; - - if (success) { - if (shader->Pragmas.Optimize && - (ctx->Shader.Flags & GLSL_NO_OPT) == 0) { - _mesa_optimize_program(ctx, shader->Program); - } - if ((ctx->Shader.Flags & GLSL_NOP_VERT) && - shader->Program->Target == GL_VERTEX_PROGRAM_ARB) { - _mesa_nop_vertex_program(ctx, - (struct gl_vertex_program *) shader->Program); - } - if ((ctx->Shader.Flags & GLSL_NOP_FRAG) && - shader->Program->Target == GL_FRAGMENT_PROGRAM_ARB) { - _mesa_nop_fragment_program(ctx, - (struct gl_fragment_program *) shader->Program); - } - } - - if (ctx->Shader.Flags & GLSL_LOG) { - _mesa_write_shader_to_file(shader); - } - - return success; -} - diff --git a/mesalib/src/mesa/shader/slang/slang_compile.h b/mesalib/src/mesa/shader/slang/slang_compile.h deleted file mode 100644 index 7fb549d33..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#if !defined SLANG_COMPILE_H -#define SLANG_COMPILE_H - -#include "main/imports.h" -#include "main/mtypes.h" -#include "slang_typeinfo.h" -#include "slang_compile_variable.h" -#include "slang_compile_struct.h" -#include "slang_compile_operation.h" -#include "slang_compile_function.h" - -#if defined __cplusplus -extern "C" { -#endif - -typedef struct slang_name_space_ -{ - struct slang_function_scope_ *funcs; - struct slang_struct_scope_ *structs; - struct slang_variable_scope_ *vars; -} slang_name_space; - -typedef enum slang_unit_type_ -{ - SLANG_UNIT_FRAGMENT_SHADER, - SLANG_UNIT_VERTEX_SHADER, - SLANG_UNIT_FRAGMENT_BUILTIN, - SLANG_UNIT_VERTEX_BUILTIN -} slang_unit_type; - - -typedef struct slang_code_unit_ -{ - slang_variable_scope vars; - slang_function_scope funs; - slang_struct_scope structs; - slang_unit_type type; - struct slang_code_object_ *object; -} slang_code_unit; - - -extern GLvoid -_slang_code_unit_ctr (slang_code_unit *, struct slang_code_object_ *); - -extern GLvoid -_slang_code_unit_dtr (slang_code_unit *); - -#define SLANG_BUILTIN_CORE 0 -#define SLANG_BUILTIN_120_CORE 1 -#define SLANG_BUILTIN_COMMON 2 -#define SLANG_BUILTIN_TARGET 3 - -#define SLANG_BUILTIN_TOTAL 4 - -typedef struct slang_code_object_ -{ - slang_code_unit builtin[SLANG_BUILTIN_TOTAL]; - slang_code_unit unit; - slang_atom_pool atompool; -} slang_code_object; - -extern GLvoid -_slang_code_object_ctr (slang_code_object *); - -extern GLvoid -_slang_code_object_dtr (slang_code_object *); - -extern GLboolean -_slang_compile (GLcontext *ctx, struct gl_shader *shader); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/mesalib/src/mesa/shader/slang/slang_compile_function.c b/mesalib/src/mesa/shader/slang/slang_compile_function.c deleted file mode 100644 index 4dd885176..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile_function.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_compile_function.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_mem.h" - - -int -slang_function_construct(slang_function * func) -{ - func->kind = SLANG_FUNC_ORDINARY; - if (!slang_variable_construct(&func->header)) - return 0; - - func->parameters = (slang_variable_scope *) - _slang_alloc(sizeof(slang_variable_scope)); - if (func->parameters == NULL) { - slang_variable_destruct(&func->header); - return 0; - } - - _slang_variable_scope_ctr(func->parameters); - func->param_count = 0; - func->body = NULL; - return 1; -} - -void -slang_function_destruct(slang_function * func) -{ - slang_variable_destruct(&func->header); - slang_variable_scope_destruct(func->parameters); - _slang_free(func->parameters); - if (func->body != NULL) { - slang_operation_destruct(func->body); - _slang_free(func->body); - } -} - - -slang_function * -slang_function_new(slang_function_kind kind) -{ - slang_function *fun = (slang_function *) - _slang_alloc(sizeof(slang_function)); - if (fun) { - slang_function_construct(fun); - fun->kind = kind; - } - return fun; -} - - -/* - * slang_function_scope - */ - -GLvoid -_slang_function_scope_ctr(slang_function_scope * self) -{ - self->functions = NULL; - self->num_functions = 0; - self->outer_scope = NULL; -} - -void -slang_function_scope_destruct(slang_function_scope * scope) -{ - unsigned int i; - - for (i = 0; i < scope->num_functions; i++) - slang_function_destruct(scope->functions + i); - _slang_free(scope->functions); -} - - -/** - * Does this function have a non-void return value? - */ -GLboolean -_slang_function_has_return_value(const slang_function *fun) -{ - return fun->header.type.specifier.type != SLANG_SPEC_VOID; -} - - -/** - * Search a list of functions for a particular function by name. - * \param funcs the list of functions to search - * \param a_name the name to search for - * \param all_scopes if non-zero, search containing scopes too. - * \return pointer to found function, or NULL. - */ -int -slang_function_scope_find_by_name(slang_function_scope * funcs, - slang_atom a_name, int all_scopes) -{ - unsigned int i; - - for (i = 0; i < funcs->num_functions; i++) - if (a_name == funcs->functions[i].header.a_name) - return 1; - if (all_scopes && funcs->outer_scope != NULL) - return slang_function_scope_find_by_name(funcs->outer_scope, a_name, 1); - return 0; -} - - -/** - * Search a list of functions for a particular function (for implementing - * function calls. Matching is done by first comparing the function's name, - * then the function's parameter list. - * - * \param funcs the list of functions to search - * \param fun the function to search for - * \param all_scopes if non-zero, search containing scopes too. - * \return pointer to found function, or NULL. - */ -slang_function * -slang_function_scope_find(slang_function_scope * funcs, slang_function * fun, - int all_scopes) -{ - unsigned int i; - - for (i = 0; i < funcs->num_functions; i++) { - slang_function *f = &funcs->functions[i]; - const GLuint haveRetValue = 0; -#if 0 - = (f->header.type.specifier.type != SLANG_SPEC_VOID); -#endif - unsigned int j; - - /* - printf("Compare name %s to %s (ret %u, %d, %d)\n", - (char *) fun->header.a_name, (char *) f->header.a_name, - haveRetValue, - fun->param_count, f->param_count); - */ - - if (fun->header.a_name != f->header.a_name) - continue; - if (fun->param_count != f->param_count) - continue; - for (j = haveRetValue; j < fun->param_count; j++) { - if (!slang_type_specifier_equal - (&fun->parameters->variables[j]->type.specifier, - &f->parameters->variables[j]->type.specifier)) - break; - } - if (j == fun->param_count) { - /* - printf("Found match\n"); - */ - return f; - } - } - /* - printf("Not found\n"); - */ - if (all_scopes && funcs->outer_scope != NULL) - return slang_function_scope_find(funcs->outer_scope, fun, 1); - return NULL; -} - - -/** - * Lookup a function according to name and parameter count/types. - */ -slang_function * -_slang_function_locate(const slang_function_scope * funcs, slang_atom a_name, - slang_operation * args, GLuint num_args, - const slang_name_space * space, slang_atom_pool * atoms, - slang_info_log *log, GLboolean *error) -{ - slang_typeinfo arg_ti[100]; - GLuint i; - - *error = GL_FALSE; - - /* determine type of each argument */ - assert(num_args < 100); - for (i = 0; i < num_args; i++) { - if (!slang_typeinfo_construct(&arg_ti[i])) - return NULL; - if (!_slang_typeof_operation(&args[i], space, &arg_ti[i], atoms, log)) { - return NULL; - } - } - - /* loop over function scopes */ - while (funcs) { - - /* look for function with matching name and argument/param types */ - for (i = 0; i < funcs->num_functions; i++) { - slang_function *f = &funcs->functions[i]; - const GLuint haveRetValue = _slang_function_has_return_value(f); - GLuint j; - - if (a_name != f->header.a_name) - continue; - if (f->param_count - haveRetValue != num_args) - continue; - - /* compare parameter / argument types */ - for (j = 0; j < num_args; j++) { - if (!slang_type_specifier_compatible(&arg_ti[j].spec, - &f->parameters->variables[j]->type.specifier)) { - /* param/arg types don't match */ - break; - } - - /* "out" and "inout" formal parameter requires the actual - * argument to be an l-value. - */ - if (!arg_ti[j].can_be_referenced && - (f->parameters->variables[j]->type.qualifier == SLANG_QUAL_OUT || - f->parameters->variables[j]->type.qualifier == SLANG_QUAL_INOUT)) { - /* param is not an lvalue! */ - *error = GL_TRUE; - return NULL; - } - } - - if (j == num_args) { - /* name and args match! */ - return f; - } - } - - funcs = funcs->outer_scope; - } - - return NULL; -} diff --git a/mesalib/src/mesa/shader/slang/slang_compile_function.h b/mesalib/src/mesa/shader/slang/slang_compile_function.h deleted file mode 100644 index a5445ec25..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile_function.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SLANG_COMPILE_FUNCTION_H -#define SLANG_COMPILE_FUNCTION_H - - -/** - * Types of functions. - */ -typedef enum slang_function_kind_ -{ - SLANG_FUNC_ORDINARY, - SLANG_FUNC_CONSTRUCTOR, - SLANG_FUNC_OPERATOR -} slang_function_kind; - - -/** - * Description of a compiled shader function. - */ -typedef struct slang_function_ -{ - slang_function_kind kind; - slang_variable header; /**< The function's name and return type */ - slang_variable_scope *parameters; /**< formal parameters AND local vars */ - unsigned int param_count; /**< number of formal params (no locals) */ - slang_operation *body; /**< The instruction tree */ -} slang_function; - -extern int slang_function_construct(slang_function *); -extern void slang_function_destruct(slang_function *); -extern slang_function *slang_function_new(slang_function_kind kind); - -extern GLboolean -_slang_function_has_return_value(const slang_function *fun); - - -/** - * Basically, a list of compiled functions. - */ -typedef struct slang_function_scope_ -{ - slang_function *functions; - GLuint num_functions; - struct slang_function_scope_ *outer_scope; -} slang_function_scope; - - -extern GLvoid -_slang_function_scope_ctr(slang_function_scope *); - -extern void -slang_function_scope_destruct(slang_function_scope *); - -extern int -slang_function_scope_find_by_name(slang_function_scope *, slang_atom, int); - -extern slang_function * -slang_function_scope_find(slang_function_scope *, slang_function *, int); - -extern struct slang_function_ * -_slang_function_locate(const struct slang_function_scope_ *funcs, - slang_atom name, struct slang_operation_ *params, - GLuint num_params, - const struct slang_name_space_ *space, - slang_atom_pool *atoms, slang_info_log *log, - GLboolean *error); - - -#endif /* SLANG_COMPILE_FUNCTION_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_compile_operation.c b/mesalib/src/mesa/shader/slang/slang_compile_operation.c deleted file mode 100644 index 5441d60df..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile_operation.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_compile_operation.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_mem.h" - - -/** - * Init a slang_operation object - */ -GLboolean -slang_operation_construct(slang_operation * oper) -{ - oper->type = SLANG_OPER_NONE; - oper->children = NULL; - oper->num_children = 0; - oper->literal[0] = 0.0; - oper->literal_size = 1; - oper->array_constructor = GL_FALSE; - oper->a_id = SLANG_ATOM_NULL; - oper->a_obj = SLANG_ATOM_NULL; - oper->locals = _slang_variable_scope_new(NULL); - if (oper->locals == NULL) - return GL_FALSE; - _slang_variable_scope_ctr(oper->locals); - oper->fun = NULL; - oper->var = NULL; - oper->label = NULL; - return GL_TRUE; -} - -void -slang_operation_destruct(slang_operation * oper) -{ - GLuint i; - - for (i = 0; i < oper->num_children; i++) - slang_operation_destruct(oper->children + i); - _slang_free(oper->children); - slang_variable_scope_destruct(oper->locals); - _slang_free(oper->locals); - oper->children = NULL; - oper->num_children = 0; - oper->locals = NULL; -} - - -/** - * Recursively traverse 'oper', replacing occurances of 'oldScope' with - * 'newScope' in the oper->locals->outer_scope field. - */ -void -slang_replace_scope(slang_operation *oper, - slang_variable_scope *oldScope, - slang_variable_scope *newScope) -{ - GLuint i; - - if (oper->locals != newScope && - oper->locals->outer_scope == oldScope) { - /* found. replace old w/ new */ - oper->locals->outer_scope = newScope; - } - - if (oper->type == SLANG_OPER_VARIABLE_DECL) { - /* search/replace in the initializer */ - slang_variable *var; - var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - if (var && var->initializer) { - slang_replace_scope(var->initializer, oldScope, newScope); - } - } - - /* search/replace in children */ - for (i = 0; i < oper->num_children; i++) { - slang_replace_scope(&oper->children[i], oldScope, newScope); - } -} - - -/** - * Recursively copy a slang_operation node. - * \param x copy target - * \param y copy source - * \return GL_TRUE for success, GL_FALSE if failure - */ -GLboolean -slang_operation_copy(slang_operation * x, const slang_operation * y) -{ - slang_operation z; - GLuint i; - - if (!slang_operation_construct(&z)) - return GL_FALSE; - z.type = y->type; - if (y->num_children > 0) { - z.children = (slang_operation *) - _slang_alloc(y->num_children * sizeof(slang_operation)); - if (z.children == NULL) { - slang_operation_destruct(&z); - return GL_FALSE; - } - } - for (z.num_children = 0; z.num_children < y->num_children; - z.num_children++) { - if (!slang_operation_construct(&z.children[z.num_children])) { - slang_operation_destruct(&z); - return GL_FALSE; - } - } - for (i = 0; i < z.num_children; i++) { - if (!slang_operation_copy(&z.children[i], &y->children[i])) { - slang_operation_destruct(&z); - return GL_FALSE; - } - } - z.literal[0] = y->literal[0]; - z.literal[1] = y->literal[1]; - z.literal[2] = y->literal[2]; - z.literal[3] = y->literal[3]; - z.literal_size = y->literal_size; - assert(y->literal_size >= 1); - assert(y->literal_size <= 4); - z.a_id = y->a_id; - if (y->locals) { - if (!slang_variable_scope_copy(z.locals, y->locals)) { - slang_operation_destruct(&z); - return GL_FALSE; - } - } - - /* update scoping for children */ - for (i = 0; i < y->num_children; i++) { - if (y->children[i].locals && - y->children[i].locals->outer_scope == y->locals) { - z.children[i].locals->outer_scope = z.locals; - } - } - -#if 0 - z.var = y->var; - z.fun = y->fun; -#endif - slang_operation_destruct(x); - *x = z; - - /* If this operation declares a new scope, we need to make sure - * all children point to it, not the original operation's scope! - */ - if (x->type == SLANG_OPER_BLOCK_NEW_SCOPE || - x->type == SLANG_OPER_WHILE || - x->type == SLANG_OPER_FOR) { - slang_replace_scope(x, y->locals, x->locals); - } - - return GL_TRUE; -} - - -slang_operation * -slang_operation_new(GLuint count) -{ - slang_operation *ops - = (slang_operation *) _slang_alloc(count * sizeof(slang_operation)); - assert(count > 0); - if (ops) { - GLuint i; - for (i = 0; i < count; i++) - slang_operation_construct(ops + i); - } - return ops; -} - - -/** - * Delete operation and all children - */ -void -slang_operation_delete(slang_operation *oper) -{ - slang_operation_destruct(oper); - _slang_free(oper); -} - - -void -slang_operation_free_children(slang_operation *oper) -{ - GLuint i; - for (i = 0; i < slang_oper_num_children(oper); i++) { - slang_operation *child = slang_oper_child(oper, i); - slang_operation_destruct(child); - } - _slang_free(oper->children); - oper->children = NULL; - oper->num_children = 0; -} - - -slang_operation * -slang_operation_grow(GLuint *numChildren, slang_operation **children) -{ - slang_operation *ops; - - ops = (slang_operation *) - _slang_realloc(*children, - *numChildren * sizeof(slang_operation), - (*numChildren + 1) * sizeof(slang_operation)); - if (ops) { - slang_operation *newOp = ops + *numChildren; - if (!slang_operation_construct(newOp)) { - _slang_free(ops); - *children = NULL; - return NULL; - } - *children = ops; - (*numChildren)++; - return newOp; - } - return NULL; -} - -/** - * Insert a new slang_operation into an array. - * \param numElements pointer to current array size (in/out) - * \param array address of the array (in/out) - * \param pos position to insert new element - * \return pointer to the new operation/element - */ -slang_operation * -slang_operation_insert(GLuint *numElements, slang_operation **array, - GLuint pos) -{ - slang_operation *ops; - - assert(pos <= *numElements); - - ops = (slang_operation *) - _slang_alloc((*numElements + 1) * sizeof(slang_operation)); - if (ops) { - slang_operation *newOp; - newOp = ops + pos; - if (pos > 0) - memcpy(ops, *array, pos * sizeof(slang_operation)); - if (pos < *numElements) - memcpy(newOp + 1, (*array) + pos, - (*numElements - pos) * sizeof(slang_operation)); - - if (!slang_operation_construct(newOp)) { - _slang_free(ops); - *numElements = 0; - *array = NULL; - return NULL; - } - if (*array) - _slang_free(*array); - *array = ops; - (*numElements)++; - return newOp; - } - return NULL; -} - - -/** - * Add/insert new child into given node at given position. - * \return pointer to the new child node - */ -slang_operation * -slang_operation_insert_child(slang_operation *oper, GLuint pos) -{ - slang_operation *newOp; - - newOp = slang_operation_insert(&oper->num_children, - &oper->children, - pos); - if (newOp) { - newOp->locals->outer_scope = oper->locals; - } - - return newOp; -} - - -void -_slang_operation_swap(slang_operation *oper0, slang_operation *oper1) -{ - slang_operation tmp = *oper0; - *oper0 = *oper1; - *oper1 = tmp; -} - - -void -slang_operation_add_children(slang_operation *oper, GLuint num_children) -{ - GLuint i; - assert(oper->num_children == 0); - assert(oper->children == NULL); - oper->num_children = num_children; - oper->children = slang_operation_new(num_children); - for (i = 0; i < num_children; i++) { - oper->children[i].locals = _slang_variable_scope_new(oper->locals); - } -} - diff --git a/mesalib/src/mesa/shader/slang/slang_compile_operation.h b/mesalib/src/mesa/shader/slang/slang_compile_operation.h deleted file mode 100644 index 1f15c1989..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile_operation.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SLANG_COMPILE_OPERATION_H -#define SLANG_COMPILE_OPERATION_H - - -/** - * Types of slang operations. - * These are the types of the AST (abstract syntax tree) nodes. - * [foo] indicates a sub-tree or reference to another type of node - */ -typedef enum slang_operation_type_ -{ - SLANG_OPER_NONE, - SLANG_OPER_BLOCK_NO_NEW_SCOPE, /* "{" sequence "}" */ - SLANG_OPER_BLOCK_NEW_SCOPE, /* "{" sequence "}" */ - SLANG_OPER_VARIABLE_DECL, /* [type] [var] or [var] = [expr] */ - SLANG_OPER_ASM, - SLANG_OPER_BREAK, /* "break" statement */ - SLANG_OPER_CONTINUE, /* "continue" statement */ - SLANG_OPER_DISCARD, /* "discard" (kill fragment) statement */ - SLANG_OPER_RETURN, /* "return" [expr] */ - SLANG_OPER_RETURN_INLINED, /* "return" [expr] from inlined function */ - SLANG_OPER_LABEL, /* a jump target */ - SLANG_OPER_EXPRESSION, /* [expr] */ - SLANG_OPER_IF, /* "if" [0] then [1] else [2] */ - SLANG_OPER_WHILE, /* "while" [cond] [body] */ - SLANG_OPER_DO, /* "do" [body] "while" [cond] */ - SLANG_OPER_FOR, /* "for" [init] [while] [incr] [body] */ - SLANG_OPER_VOID, /* nop */ - SLANG_OPER_LITERAL_BOOL, /* "true" or "false" */ - SLANG_OPER_LITERAL_INT, /* integer literal */ - SLANG_OPER_LITERAL_FLOAT, /* float literal */ - SLANG_OPER_IDENTIFIER, /* var name, func name, etc */ - SLANG_OPER_SEQUENCE, /* [expr] "," [expr] "," etc */ - SLANG_OPER_ASSIGN, /* [var] "=" [expr] */ - SLANG_OPER_ADDASSIGN, /* [var] "+=" [expr] */ - SLANG_OPER_SUBASSIGN, /* [var] "-=" [expr] */ - SLANG_OPER_MULASSIGN, /* [var] "*=" [expr] */ - SLANG_OPER_DIVASSIGN, /* [var] "/=" [expr] */ - /*SLANG_OPER_MODASSIGN, */ - /*SLANG_OPER_LSHASSIGN, */ - /*SLANG_OPER_RSHASSIGN, */ - /*SLANG_OPER_ORASSIGN, */ - /*SLANG_OPER_XORASSIGN, */ - /*SLANG_OPER_ANDASSIGN, */ - SLANG_OPER_SELECT, /* [expr] "?" [expr] ":" [expr] */ - SLANG_OPER_LOGICALOR, /* [expr] "||" [expr] */ - SLANG_OPER_LOGICALXOR, /* [expr] "^^" [expr] */ - SLANG_OPER_LOGICALAND, /* [expr] "&&" [expr] */ - /*SLANG_OPER_BITOR, */ - /*SLANG_OPER_BITXOR, */ - /*SLANG_OPER_BITAND, */ - SLANG_OPER_EQUAL, /* [expr] "==" [expr] */ - SLANG_OPER_NOTEQUAL, /* [expr] "!=" [expr] */ - SLANG_OPER_LESS, /* [expr] "<" [expr] */ - SLANG_OPER_GREATER, /* [expr] ">" [expr] */ - SLANG_OPER_LESSEQUAL, /* [expr] "<=" [expr] */ - SLANG_OPER_GREATEREQUAL, /* [expr] ">=" [expr] */ - /*SLANG_OPER_LSHIFT, */ - /*SLANG_OPER_RSHIFT, */ - SLANG_OPER_ADD, /* [expr] "+" [expr] */ - SLANG_OPER_SUBTRACT, /* [expr] "-" [expr] */ - SLANG_OPER_MULTIPLY, /* [expr] "*" [expr] */ - SLANG_OPER_DIVIDE, /* [expr] "/" [expr] */ - /*SLANG_OPER_MODULUS, */ - SLANG_OPER_PREINCREMENT, /* "++" [var] */ - SLANG_OPER_PREDECREMENT, /* "--" [var] */ - SLANG_OPER_PLUS, /* "-" [expr] */ - SLANG_OPER_MINUS, /* "+" [expr] */ - /*SLANG_OPER_COMPLEMENT, */ - SLANG_OPER_NOT, /* "!" [expr] */ - SLANG_OPER_SUBSCRIPT, /* [expr] "[" [expr] "]" */ - SLANG_OPER_CALL, /* [func name] [param] [param] [...] */ - SLANG_OPER_NON_INLINED_CALL, /* a real function call */ - SLANG_OPER_METHOD, /* method call, such as v.length() */ - SLANG_OPER_FIELD, /* i.e.: ".next" or ".xzy" or ".xxx" etc */ - SLANG_OPER_POSTINCREMENT, /* [var] "++" */ - SLANG_OPER_POSTDECREMENT /* [var] "--" */ -} slang_operation_type; - - -/** - * A slang_operation is basically a compiled instruction (such as assignment, - * a while-loop, a conditional, a multiply, a function call, etc). - * The AST (abstract syntax tree) is built from these nodes. - * NOTE: This structure could have been implemented as a union of simpler - * structs which would correspond to the operation types above. - */ -typedef struct slang_operation_ -{ - slang_operation_type type; - struct slang_operation_ *children; - GLuint num_children; - GLfloat literal[4]; /**< Used for float, int and bool values */ - GLuint literal_size; /**< 1, 2, 3, or 4 */ - slang_atom a_id; /**< type: asm, identifier, call, field */ - slang_atom a_obj; /**< object in a method call */ - slang_variable_scope *locals; /**< local vars for scope */ - struct slang_function_ *fun; /**< If type == SLANG_OPER_CALL */ - struct slang_variable_ *var; /**< If type == slang_oper_identier */ - struct slang_label_ *label; /**< If type == SLANG_OPER_LABEL */ - /** If type==SLANG_OPER_CALL and we're calling an array constructor, - * for which there's no real function, we need to have a flag to - * indicate such. num_children indicates number of elements. - */ - GLboolean array_constructor; -} slang_operation; - - -extern GLboolean -slang_operation_construct(slang_operation *); - -extern void -slang_operation_destruct(slang_operation *); - -extern void -slang_replace_scope(slang_operation *oper, - slang_variable_scope *oldScope, - slang_variable_scope *newScope); - -extern GLboolean -slang_operation_copy(slang_operation *, const slang_operation *); - -extern slang_operation * -slang_operation_new(GLuint count); - -extern void -slang_operation_delete(slang_operation *oper); - -extern void -slang_operation_free_children(slang_operation *oper); - -extern slang_operation * -slang_operation_grow(GLuint *numChildren, slang_operation **children); - -extern slang_operation * -slang_operation_insert(GLuint *numChildren, slang_operation **children, - GLuint pos); - -extern slang_operation * -slang_operation_insert_child(slang_operation *oper, GLuint pos); - -extern void -_slang_operation_swap(slang_operation *oper0, slang_operation *oper1); - - -extern void -slang_operation_add_children(slang_operation *oper, GLuint num_children); - - -/** Return number of children of given node */ -static INLINE GLuint -slang_oper_num_children(const slang_operation *oper) -{ - return oper->num_children; -} - -/** Return child of given operation node */ -static INLINE slang_operation * -slang_oper_child(slang_operation *oper, GLuint child) -{ - assert(child < oper->num_children); - return &oper->children[child]; -} - - -/** Return child of given operation node, const version */ -static INLINE const slang_operation * -slang_oper_child_const(const slang_operation *oper, GLuint child) -{ - assert(child < oper->num_children); - return &oper->children[child]; -} - - -/** Init oper to a boolean literal. */ -static INLINE void -slang_operation_literal_bool(slang_operation *oper, GLboolean value) -{ - oper->type = SLANG_OPER_LITERAL_BOOL; - oper->literal[0] = - oper->literal[1] = - oper->literal[2] = - oper->literal[3] = (float) value; - oper->literal_size = 1; -} - - -/** Init oper to an int literal. */ -static INLINE void -slang_operation_literal_int(slang_operation *oper, GLint value) -{ - oper->type = SLANG_OPER_LITERAL_INT; - oper->literal[0] = - oper->literal[1] = - oper->literal[2] = - oper->literal[3] = (float) value; - oper->literal_size = 1; -} - - -#endif /* SLANG_COMPILE_OPERATION_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_compile_struct.c b/mesalib/src/mesa/shader/slang/slang_compile_struct.c deleted file mode 100644 index e6c38730d..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile_struct.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_compile_struct.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_mem.h" -#include "slang_compile.h" - - -GLvoid -_slang_struct_scope_ctr(slang_struct_scope * self) -{ - self->structs = NULL; - self->num_structs = 0; - self->outer_scope = NULL; -} - -void -slang_struct_scope_destruct(slang_struct_scope * scope) -{ - GLuint i; - - for (i = 0; i < scope->num_structs; i++) - slang_struct_destruct(scope->structs + i); - _slang_free(scope->structs); - /* do not free scope->outer_scope */ -} - -int -slang_struct_scope_copy(slang_struct_scope * x, const slang_struct_scope * y) -{ - slang_struct_scope z; - GLuint i; - - _slang_struct_scope_ctr(&z); - z.structs = (slang_struct *) - _slang_alloc(y->num_structs * sizeof(slang_struct)); - if (z.structs == NULL) { - slang_struct_scope_destruct(&z); - return 0; - } - for (z.num_structs = 0; z.num_structs < y->num_structs; z.num_structs++) - if (!slang_struct_construct(&z.structs[z.num_structs])) { - slang_struct_scope_destruct(&z); - return 0; - } - for (i = 0; i < z.num_structs; i++) - if (!slang_struct_copy(&z.structs[i], &y->structs[i])) { - slang_struct_scope_destruct(&z); - return 0; - } - z.outer_scope = y->outer_scope; - slang_struct_scope_destruct(x); - *x = z; - return 1; -} - -slang_struct * -slang_struct_scope_find(slang_struct_scope * stru, slang_atom a_name, - int all_scopes) -{ - GLuint i; - - for (i = 0; i < stru->num_structs; i++) - if (a_name == stru->structs[i].a_name) - return &stru->structs[i]; - if (all_scopes && stru->outer_scope != NULL) - return slang_struct_scope_find(stru->outer_scope, a_name, 1); - return NULL; -} - -/* slang_struct */ - -int -slang_struct_construct(slang_struct * stru) -{ - stru->a_name = SLANG_ATOM_NULL; - stru->fields = (slang_variable_scope *) - _slang_alloc(sizeof(slang_variable_scope)); - if (stru->fields == NULL) - return 0; - _slang_variable_scope_ctr(stru->fields); - - stru->structs = - (slang_struct_scope *) _slang_alloc(sizeof(slang_struct_scope)); - if (stru->structs == NULL) { - slang_variable_scope_destruct(stru->fields); - _slang_free(stru->fields); - return 0; - } - _slang_struct_scope_ctr(stru->structs); - stru->constructor = NULL; - return 1; -} - -void -slang_struct_destruct(slang_struct * stru) -{ - slang_variable_scope_destruct(stru->fields); - _slang_free(stru->fields); - slang_struct_scope_destruct(stru->structs); - _slang_free(stru->structs); -} - -int -slang_struct_copy(slang_struct * x, const slang_struct * y) -{ - slang_struct z; - - if (!slang_struct_construct(&z)) - return 0; - z.a_name = y->a_name; - if (!slang_variable_scope_copy(z.fields, y->fields)) { - slang_struct_destruct(&z); - return 0; - } - if (!slang_struct_scope_copy(z.structs, y->structs)) { - slang_struct_destruct(&z); - return 0; - } - slang_struct_destruct(x); - *x = z; - return 1; -} - -int -slang_struct_equal(const slang_struct * x, const slang_struct * y) -{ - GLuint i; - - if (x->fields->num_variables != y->fields->num_variables) - return 0; - - for (i = 0; i < x->fields->num_variables; i++) { - const slang_variable *varx = x->fields->variables[i]; - const slang_variable *vary = y->fields->variables[i]; - - if (varx->a_name != vary->a_name) - return 0; - if (!slang_type_specifier_equal(&varx->type.specifier, - &vary->type.specifier)) - return 0; - if (varx->type.specifier.type == SLANG_SPEC_ARRAY) - if (varx->array_len != vary->array_len) - return GL_FALSE; - } - return 1; -} diff --git a/mesalib/src/mesa/shader/slang/slang_compile_struct.h b/mesalib/src/mesa/shader/slang/slang_compile_struct.h deleted file mode 100644 index 90c5512f4..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile_struct.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#if !defined SLANG_COMPILE_STRUCT_H -#define SLANG_COMPILE_STRUCT_H - -#if defined __cplusplus -extern "C" { -#endif - -struct slang_function_; - -typedef struct slang_struct_scope_ -{ - struct slang_struct_ *structs; - GLuint num_structs; - struct slang_struct_scope_ *outer_scope; -} slang_struct_scope; - -extern GLvoid -_slang_struct_scope_ctr (slang_struct_scope *); - -void slang_struct_scope_destruct (slang_struct_scope *); -int slang_struct_scope_copy (slang_struct_scope *, const slang_struct_scope *); -struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, slang_atom, int); - -typedef struct slang_struct_ -{ - slang_atom a_name; - struct slang_variable_scope_ *fields; - slang_struct_scope *structs; - struct slang_function_ *constructor; -} slang_struct; - -int slang_struct_construct (slang_struct *); -void slang_struct_destruct (slang_struct *); -int slang_struct_copy (slang_struct *, const slang_struct *); -int slang_struct_equal (const slang_struct *, const slang_struct *); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/mesalib/src/mesa/shader/slang/slang_compile_variable.c b/mesalib/src/mesa/shader/slang/slang_compile_variable.c deleted file mode 100644 index 23c08a903..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile_variable.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_compile_variable.c - * slang front-end compiler - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_mem.h" - - -static slang_variable * -slang_variable_new(void) -{ - slang_variable *v = (slang_variable *) _slang_alloc(sizeof(slang_variable)); - if (v) { - if (!slang_variable_construct(v)) { - _slang_free(v); - v = NULL; - } - } - return v; -} - - -static void -slang_variable_delete(slang_variable * var) -{ - slang_variable_destruct(var); - _slang_free(var); -} - - -/* - * slang_variable_scope - */ - -slang_variable_scope * -_slang_variable_scope_new(slang_variable_scope *parent) -{ - slang_variable_scope *s; - s = (slang_variable_scope *) _slang_alloc(sizeof(slang_variable_scope)); - if (s) - s->outer_scope = parent; - return s; -} - - -GLvoid -_slang_variable_scope_ctr(slang_variable_scope * self) -{ - self->variables = NULL; - self->num_variables = 0; - self->outer_scope = NULL; -} - -void -slang_variable_scope_destruct(slang_variable_scope * scope) -{ - unsigned int i; - - if (!scope) - return; - for (i = 0; i < scope->num_variables; i++) { - if (scope->variables[i]) - slang_variable_delete(scope->variables[i]); - } - _slang_free(scope->variables); - /* do not free scope->outer_scope */ -} - -int -slang_variable_scope_copy(slang_variable_scope * x, - const slang_variable_scope * y) -{ - slang_variable_scope z; - unsigned int i; - - _slang_variable_scope_ctr(&z); - z.variables = (slang_variable **) - _slang_alloc(y->num_variables * sizeof(slang_variable *)); - if (z.variables == NULL) { - slang_variable_scope_destruct(&z); - return 0; - } - for (z.num_variables = 0; z.num_variables < y->num_variables; - z.num_variables++) { - z.variables[z.num_variables] = slang_variable_new(); - if (!z.variables[z.num_variables]) { - slang_variable_scope_destruct(&z); - return 0; - } - } - for (i = 0; i < z.num_variables; i++) { - if (!slang_variable_copy(z.variables[i], y->variables[i])) { - slang_variable_scope_destruct(&z); - return 0; - } - } - z.outer_scope = y->outer_scope; - slang_variable_scope_destruct(x); - *x = z; - return 1; -} - - -/** - * Grow the variable list by one. - * \return pointer to space for the new variable (will be initialized) - */ -slang_variable * -slang_variable_scope_grow(slang_variable_scope *scope) -{ - const int n = scope->num_variables; - scope->variables = (slang_variable **) - _slang_realloc(scope->variables, - n * sizeof(slang_variable *), - (n + 1) * sizeof(slang_variable *)); - if (!scope->variables) - return NULL; - - scope->num_variables++; - - scope->variables[n] = slang_variable_new(); - if (!scope->variables[n]) - return NULL; - - return scope->variables[n]; -} - - - -/* slang_variable */ - -int -slang_variable_construct(slang_variable * var) -{ - if (!slang_fully_specified_type_construct(&var->type)) - return 0; - var->a_name = SLANG_ATOM_NULL; - var->array_len = 0; - var->initializer = NULL; - var->size = 0; - var->isTemp = GL_FALSE; - var->store = NULL; - var->declared = 0; - return 1; -} - - -void -slang_variable_destruct(slang_variable * var) -{ - slang_fully_specified_type_destruct(&var->type); - if (var->initializer != NULL) { - slang_operation_destruct(var->initializer); - _slang_free(var->initializer); - } -#if 0 - if (var->aux) { - free(var->aux); - } -#endif -} - - -int -slang_variable_copy(slang_variable * x, const slang_variable * y) -{ - slang_variable z; - - if (!slang_variable_construct(&z)) - return 0; - if (!slang_fully_specified_type_copy(&z.type, &y->type)) { - slang_variable_destruct(&z); - return 0; - } - z.a_name = y->a_name; - z.array_len = y->array_len; - if (y->initializer != NULL) { - z.initializer - = (slang_operation *) _slang_alloc(sizeof(slang_operation)); - if (z.initializer == NULL) { - slang_variable_destruct(&z); - return 0; - } - if (!slang_operation_construct(z.initializer)) { - _slang_free(z.initializer); - slang_variable_destruct(&z); - return 0; - } - if (!slang_operation_copy(z.initializer, y->initializer)) { - slang_variable_destruct(&z); - return 0; - } - } - z.size = y->size; - slang_variable_destruct(x); - *x = z; - return 1; -} - - -/** - * Search for named variable in given scope. - * \param all if true, search parent scopes too. - */ -slang_variable * -_slang_variable_locate(const slang_variable_scope * scope, - const slang_atom a_name, GLboolean all) -{ - while (scope) { - GLuint i; - for (i = 0; i < scope->num_variables; i++) - if (a_name == scope->variables[i]->a_name) - return scope->variables[i]; - if (all) - scope = scope->outer_scope; - else - scope = NULL; - } - return NULL; -} diff --git a/mesalib/src/mesa/shader/slang/slang_compile_variable.h b/mesalib/src/mesa/shader/slang/slang_compile_variable.h deleted file mode 100644 index 5c9d248b3..000000000 --- a/mesalib/src/mesa/shader/slang/slang_compile_variable.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SLANG_COMPILE_VARIABLE_H -#define SLANG_COMPILE_VARIABLE_H - - -struct slang_ir_storage_; - - -/** - * A shading language program variable. - */ -typedef struct slang_variable_ -{ - slang_fully_specified_type type; /**< Variable's data type */ - slang_atom a_name; /**< The variable's name (char *) */ - GLuint array_len; /**< only if type == SLANG_SPEC_ARRAy */ - struct slang_operation_ *initializer; /**< Optional initializer code */ - GLuint size; /**< Variable's size in bytes */ - GLboolean is_global; - GLboolean isTemp; /**< a named temporary (__resultTmp) */ - GLboolean declared; /**< has the var been declared? */ - struct slang_ir_storage_ *store; /**< Storage for this var */ -} slang_variable; - - -/** - * Basically a list of variables, with a pointer to the parent scope. - */ -typedef struct slang_variable_scope_ -{ - slang_variable **variables; /**< Array [num_variables] of ptrs to vars */ - GLuint num_variables; - struct slang_variable_scope_ *outer_scope; -} slang_variable_scope; - - -extern slang_variable_scope * -_slang_variable_scope_new(slang_variable_scope *parent); - -extern GLvoid -_slang_variable_scope_ctr(slang_variable_scope *); - -extern void -slang_variable_scope_destruct(slang_variable_scope *); - -extern int -slang_variable_scope_copy(slang_variable_scope *, - const slang_variable_scope *); - -extern slang_variable * -slang_variable_scope_grow(slang_variable_scope *); - -extern int -slang_variable_construct(slang_variable *); - -extern void -slang_variable_destruct(slang_variable *); - -extern int -slang_variable_copy(slang_variable *, const slang_variable *); - -extern slang_variable * -_slang_variable_locate(const slang_variable_scope *, const slang_atom a_name, - GLboolean all); - - -#endif /* SLANG_COMPILE_VARIABLE_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_emit.c b/mesalib/src/mesa/shader/slang/slang_emit.c deleted file mode 100644 index 7c0ea0c11..000000000 --- a/mesalib/src/mesa/shader/slang/slang_emit.c +++ /dev/null @@ -1,2667 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2008 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_emit.c - * Emit program instructions (PI code) from IR trees. - * \author Brian Paul - */ - -/*** - *** NOTES - *** - *** To emit GPU instructions, we basically just do an in-order traversal - *** of the IR tree. - ***/ - - -#include "main/imports.h" -#include "main/context.h" -#include "shader/program.h" -#include "shader/prog_instruction.h" -#include "shader/prog_parameter.h" -#include "shader/prog_print.h" -#include "slang_builtin.h" -#include "slang_emit.h" -#include "slang_mem.h" - - -#define PEEPHOLE_OPTIMIZATIONS 1 -#define ANNOTATE 0 - - -typedef struct -{ - slang_info_log *log; - slang_var_table *vt; - struct gl_program *prog; - struct gl_program **Subroutines; - GLuint NumSubroutines; - - GLuint MaxInstructions; /**< size of prog->Instructions[] buffer */ - - GLboolean UnresolvedFunctions; - - /* code-gen options */ - GLboolean EmitHighLevelInstructions; - GLboolean EmitCondCodes; - GLboolean EmitComments; - GLboolean EmitBeginEndSub; /* XXX TEMPORARY */ -} slang_emit_info; - - - -static struct gl_program * -new_subroutine(slang_emit_info *emitInfo, GLuint *id) -{ - GET_CURRENT_CONTEXT(ctx); - const GLuint n = emitInfo->NumSubroutines; - - emitInfo->Subroutines = (struct gl_program **) - _mesa_realloc(emitInfo->Subroutines, - n * sizeof(struct gl_program *), - (n + 1) * sizeof(struct gl_program *)); - emitInfo->Subroutines[n] = ctx->Driver.NewProgram(ctx, emitInfo->prog->Target, 0); - emitInfo->Subroutines[n]->Parameters = emitInfo->prog->Parameters; - emitInfo->NumSubroutines++; - *id = n; - return emitInfo->Subroutines[n]; -} - - -/** - * Convert a writemask to a swizzle. Used for testing cond codes because - * we only want to test the cond code component(s) that was set by the - * previous instruction. - */ -static GLuint -writemask_to_swizzle(GLuint writemask) -{ - if (writemask == WRITEMASK_X) - return SWIZZLE_XXXX; - if (writemask == WRITEMASK_Y) - return SWIZZLE_YYYY; - if (writemask == WRITEMASK_Z) - return SWIZZLE_ZZZZ; - if (writemask == WRITEMASK_W) - return SWIZZLE_WWWW; - return SWIZZLE_XYZW; /* shouldn't be hit */ -} - - -/** - * Convert a swizzle mask to a writemask. - * Note that the slang_ir_storage->Swizzle field can represent either a - * swizzle mask or a writemask, depending on how it's used. For example, - * when we parse "direction.yz" alone, we don't know whether .yz is a - * writemask or a swizzle. In this case, we encode ".yz" in store->Swizzle - * as a swizzle mask (.yz?? actually). Later, if direction.yz is used as - * an R-value, we use store->Swizzle as-is. Otherwise, if direction.yz is - * used as an L-value, we convert it to a writemask. - */ -static GLuint -swizzle_to_writemask(GLuint swizzle) -{ - GLuint i, writemask = 0x0; - for (i = 0; i < 4; i++) { - GLuint swz = GET_SWZ(swizzle, i); - if (swz <= SWIZZLE_W) { - writemask |= (1 << swz); - } - } - return writemask; -} - - -/** - * Swizzle a swizzle (function composition). - * That is, return swz2(swz1), or said another way: swz1.szw2 - * Example: swizzle_swizzle(".zwxx", ".xxyw") yields ".zzwx" - */ -GLuint -_slang_swizzle_swizzle(GLuint swz1, GLuint swz2) -{ - GLuint i, swz, s[4]; - for (i = 0; i < 4; i++) { - GLuint c = GET_SWZ(swz2, i); - if (c <= SWIZZLE_W) - s[i] = GET_SWZ(swz1, c); - else - s[i] = c; - } - swz = MAKE_SWIZZLE4(s[0], s[1], s[2], s[3]); - return swz; -} - - -/** - * Return the default swizzle mask for accessing a variable of the - * given size (in floats). If size = 1, comp is used to identify - * which component [0..3] of the register holds the variable. - */ -GLuint -_slang_var_swizzle(GLint size, GLint comp) -{ - switch (size) { - case 1: - return MAKE_SWIZZLE4(comp, SWIZZLE_NIL, SWIZZLE_NIL, SWIZZLE_NIL); - case 2: - return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_NIL, SWIZZLE_NIL); - case 3: - return MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_NIL); - default: - return SWIZZLE_XYZW; - } -} - - - -/** - * Allocate storage for the given node (if it hasn't already been allocated). - * - * Typically this is temporary storage for an intermediate result (such as - * for a multiply or add, etc). - * - * If n->Store does not exist it will be created and will be of the size - * specified by defaultSize. - */ -static GLboolean -alloc_node_storage(slang_emit_info *emitInfo, slang_ir_node *n, - GLint defaultSize) -{ - assert(!n->Var); - if (!n->Store) { - assert(defaultSize > 0); - n->Store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, defaultSize); - if (!n->Store) { - return GL_FALSE; - } - } - - /* now allocate actual register(s). I.e. set n->Store->Index >= 0 */ - if (n->Store->Index < 0) { - if (!_slang_alloc_temp(emitInfo->vt, n->Store)) { - slang_info_log_error(emitInfo->log, - "Ran out of registers, too many temporaries"); - _slang_free(n->Store); - n->Store = NULL; - return GL_FALSE; - } - } - return GL_TRUE; -} - - -/** - * Free temporary storage, if n->Store is, in fact, temp storage. - * Otherwise, no-op. - */ -static void -free_node_storage(slang_var_table *vt, slang_ir_node *n) -{ - if (n->Store->File == PROGRAM_TEMPORARY && - n->Store->Index >= 0 && - n->Opcode != IR_SWIZZLE) { - if (_slang_is_temp(vt, n->Store)) { - _slang_free_temp(vt, n->Store); - n->Store->Index = -1; - n->Store = NULL; /* XXX this may not be needed */ - } - } -} - - -/** - * Helper function to allocate a short-term temporary. - * Free it with _slang_free_temp(). - */ -static GLboolean -alloc_local_temp(slang_emit_info *emitInfo, slang_ir_storage *temp, GLint size) -{ - assert(size >= 1); - assert(size <= 4); - memset(temp, 0, sizeof(*temp)); - temp->Size = size; - temp->File = PROGRAM_TEMPORARY; - temp->Index = -1; - return _slang_alloc_temp(emitInfo->vt, temp); -} - - -/** - * Remove any SWIZZLE_NIL terms from given swizzle mask. - * For a swizzle like .z??? generate .zzzz (replicate single component). - * Else, for .wx?? generate .wxzw (insert default component for the position). - */ -static GLuint -fix_swizzle(GLuint swizzle) -{ - GLuint c0 = GET_SWZ(swizzle, 0), - c1 = GET_SWZ(swizzle, 1), - c2 = GET_SWZ(swizzle, 2), - c3 = GET_SWZ(swizzle, 3); - if (c1 == SWIZZLE_NIL && c2 == SWIZZLE_NIL && c3 == SWIZZLE_NIL) { - /* smear first component across all positions */ - c1 = c2 = c3 = c0; - } - else { - /* insert default swizzle components */ - if (c0 == SWIZZLE_NIL) - c0 = SWIZZLE_X; - if (c1 == SWIZZLE_NIL) - c1 = SWIZZLE_Y; - if (c2 == SWIZZLE_NIL) - c2 = SWIZZLE_Z; - if (c3 == SWIZZLE_NIL) - c3 = SWIZZLE_W; - } - return MAKE_SWIZZLE4(c0, c1, c2, c3); -} - - - -/** - * Convert IR storage to an instruction dst register. - */ -static void -storage_to_dst_reg(struct prog_dst_register *dst, const slang_ir_storage *st) -{ - const GLboolean relAddr = st->RelAddr; - const GLint size = st->Size; - GLint index = st->Index; - GLuint swizzle = st->Swizzle; - - assert(index >= 0); - /* if this is storage relative to some parent storage, walk up the tree */ - while (st->Parent) { - st = st->Parent; - assert(st->Index >= 0); - index += st->Index; - swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle); - } - - assert(st->File != PROGRAM_UNDEFINED); - dst->File = st->File; - - assert(index >= 0); - dst->Index = index; - - assert(size >= 1); - assert(size <= 4); - - if (swizzle != SWIZZLE_XYZW) { - dst->WriteMask = swizzle_to_writemask(swizzle); - } - else { - switch (size) { - case 1: - dst->WriteMask = WRITEMASK_X << GET_SWZ(st->Swizzle, 0); - break; - case 2: - dst->WriteMask = WRITEMASK_XY; - break; - case 3: - dst->WriteMask = WRITEMASK_XYZ; - break; - case 4: - dst->WriteMask = WRITEMASK_XYZW; - break; - default: - ; /* error would have been caught above */ - } - } - - dst->RelAddr = relAddr; -} - - -/** - * Convert IR storage to an instruction src register. - */ -static void -storage_to_src_reg(struct prog_src_register *src, const slang_ir_storage *st) -{ - const GLboolean relAddr = st->RelAddr; - GLint index = st->Index; - GLuint swizzle = st->Swizzle; - - /* if this is storage relative to some parent storage, walk up the tree */ - assert(index >= 0); - while (st->Parent) { - st = st->Parent; - if (st->Index < 0) { - /* an error should have been reported already */ - return; - } - assert(st->Index >= 0); - index += st->Index; - swizzle = _slang_swizzle_swizzle(fix_swizzle(st->Swizzle), swizzle); - } - - assert(st->File >= 0); -#if 1 /* XXX temporary */ - if (st->File == PROGRAM_UNDEFINED) { - slang_ir_storage *st0 = (slang_ir_storage *) st; - st0->File = PROGRAM_TEMPORARY; - } -#endif - assert(st->File < PROGRAM_UNDEFINED); - src->File = st->File; - - assert(index >= 0); - src->Index = index; - - swizzle = fix_swizzle(swizzle); - assert(GET_SWZ(swizzle, 0) <= SWIZZLE_W); - assert(GET_SWZ(swizzle, 1) <= SWIZZLE_W); - assert(GET_SWZ(swizzle, 2) <= SWIZZLE_W); - assert(GET_SWZ(swizzle, 3) <= SWIZZLE_W); - src->Swizzle = swizzle; - - src->RelAddr = relAddr; -} - - -/* - * Setup storage pointing to a scalar constant/literal. - */ -static void -constant_to_storage(slang_emit_info *emitInfo, - GLfloat val, - slang_ir_storage *store) -{ - GLuint swizzle; - GLint reg; - GLfloat value[4]; - - value[0] = val; - reg = _mesa_add_unnamed_constant(emitInfo->prog->Parameters, - value, 1, &swizzle); - - memset(store, 0, sizeof(*store)); - store->File = PROGRAM_CONSTANT; - store->Index = reg; - store->Swizzle = swizzle; -} - - -/** - * Add new instruction at end of given program. - * \param prog the program to append instruction onto - * \param opcode opcode for the new instruction - * \return pointer to the new instruction - */ -static struct prog_instruction * -new_instruction(slang_emit_info *emitInfo, gl_inst_opcode opcode) -{ - struct gl_program *prog = emitInfo->prog; - struct prog_instruction *inst; - -#if 0 - /* print prev inst */ - if (prog->NumInstructions > 0) { - _mesa_print_instruction(prog->Instructions + prog->NumInstructions - 1); - } -#endif - assert(prog->NumInstructions <= emitInfo->MaxInstructions); - - if (prog->NumInstructions == emitInfo->MaxInstructions) { - /* grow the instruction buffer */ - emitInfo->MaxInstructions += 20; - prog->Instructions = - _mesa_realloc_instructions(prog->Instructions, - prog->NumInstructions, - emitInfo->MaxInstructions); - if (!prog->Instructions) { - return NULL; - } - } - - inst = prog->Instructions + prog->NumInstructions; - prog->NumInstructions++; - _mesa_init_instructions(inst, 1); - inst->Opcode = opcode; - inst->BranchTarget = -1; /* invalid */ - /* - printf("New inst %d: %p %s\n", prog->NumInstructions-1,(void*)inst, - _mesa_opcode_string(inst->Opcode)); - */ - return inst; -} - - -static struct prog_instruction * -emit_arl_load(slang_emit_info *emitInfo, - gl_register_file file, GLint index, GLuint swizzle) -{ - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ARL); - if (inst) { - inst->SrcReg[0].File = file; - inst->SrcReg[0].Index = index; - inst->SrcReg[0].Swizzle = fix_swizzle(swizzle); - inst->DstReg.File = PROGRAM_ADDRESS; - inst->DstReg.Index = 0; - inst->DstReg.WriteMask = WRITEMASK_X; - } - return inst; -} - - -/** - * Emit a new instruction with given opcode, operands. - * At this point the instruction may have multiple indirect register - * loads/stores. We convert those into ARL loads and address-relative - * operands. See comments inside. - * At some point in the future we could directly emit indirectly addressed - * registers in Mesa GPU instructions. - */ -static struct prog_instruction * -emit_instruction(slang_emit_info *emitInfo, - gl_inst_opcode opcode, - const slang_ir_storage *dst, - const slang_ir_storage *src0, - const slang_ir_storage *src1, - const slang_ir_storage *src2) -{ - struct prog_instruction *inst; - GLuint numIndirect = 0; - const slang_ir_storage *src[3]; - slang_ir_storage newSrc[3], newDst; - GLuint i; - GLboolean isTemp[3]; - - isTemp[0] = isTemp[1] = isTemp[2] = GL_FALSE; - - src[0] = src0; - src[1] = src1; - src[2] = src2; - - /* count up how many operands are indirect loads */ - for (i = 0; i < 3; i++) { - if (src[i] && src[i]->IsIndirect) - numIndirect++; - } - if (dst && dst->IsIndirect) - numIndirect++; - - /* Take special steps for indirect register loads. - * If we had multiple address registers this would be simpler. - * For example, this GLSL code: - * x[i] = y[j] + z[k]; - * would translate into something like: - * ARL ADDR.x, i; - * ARL ADDR.y, j; - * ARL ADDR.z, k; - * ADD TEMP[ADDR.x+5], TEMP[ADDR.y+9], TEMP[ADDR.z+4]; - * But since we currently only have one address register we have to do this: - * ARL ADDR.x, i; - * MOV t1, TEMP[ADDR.x+9]; - * ARL ADDR.x, j; - * MOV t2, TEMP[ADDR.x+4]; - * ARL ADDR.x, k; - * ADD TEMP[ADDR.x+5], t1, t2; - * The code here figures this out... - */ - if (numIndirect > 0) { - for (i = 0; i < 3; i++) { - if (src[i] && src[i]->IsIndirect) { - /* load the ARL register with the indirect register */ - emit_arl_load(emitInfo, - src[i]->IndirectFile, - src[i]->IndirectIndex, - src[i]->IndirectSwizzle); - - if (numIndirect > 1) { - /* Need to load src[i] into a temporary register */ - slang_ir_storage srcRelAddr; - alloc_local_temp(emitInfo, &newSrc[i], src[i]->Size); - isTemp[i] = GL_TRUE; - - /* set RelAddr flag on src register */ - srcRelAddr = *src[i]; - srcRelAddr.RelAddr = GL_TRUE; - srcRelAddr.IsIndirect = GL_FALSE; /* not really needed */ - - /* MOV newSrc, srcRelAddr; */ - inst = emit_instruction(emitInfo, - OPCODE_MOV, - &newSrc[i], - &srcRelAddr, - NULL, - NULL); - if (!inst) { - return NULL; - } - - src[i] = &newSrc[i]; - } - else { - /* just rewrite the src[i] storage to be ARL-relative */ - newSrc[i] = *src[i]; - newSrc[i].RelAddr = GL_TRUE; - newSrc[i].IsIndirect = GL_FALSE; /* not really needed */ - src[i] = &newSrc[i]; - } - } - } - } - - /* Take special steps for indirect dest register write */ - if (dst && dst->IsIndirect) { - /* load the ARL register with the indirect register */ - emit_arl_load(emitInfo, - dst->IndirectFile, - dst->IndirectIndex, - dst->IndirectSwizzle); - newDst = *dst; - newDst.RelAddr = GL_TRUE; - newDst.IsIndirect = GL_FALSE; - dst = &newDst; - } - - /* OK, emit the instruction and its dst, src regs */ - inst = new_instruction(emitInfo, opcode); - if (!inst) - return NULL; - - if (dst) - storage_to_dst_reg(&inst->DstReg, dst); - - for (i = 0; i < 3; i++) { - if (src[i]) - storage_to_src_reg(&inst->SrcReg[i], src[i]); - } - - /* Free any temp registers that we allocated above */ - for (i = 0; i < 3; i++) { - if (isTemp[i]) - _slang_free_temp(emitInfo->vt, &newSrc[i]); - } - - return inst; -} - - - -/** - * Put a comment on the given instruction. - */ -static void -inst_comment(struct prog_instruction *inst, const char *comment) -{ - if (inst) - inst->Comment = _mesa_strdup(comment); -} - - - -/** - * Return pointer to last instruction in program. - */ -static struct prog_instruction * -prev_instruction(slang_emit_info *emitInfo) -{ - struct gl_program *prog = emitInfo->prog; - if (prog->NumInstructions == 0) - return NULL; - else - return prog->Instructions + prog->NumInstructions - 1; -} - - -static struct prog_instruction * -emit(slang_emit_info *emitInfo, slang_ir_node *n); - - -/** - * Return an annotation string for given node's storage. - */ -static char * -storage_annotation(const slang_ir_node *n, const struct gl_program *prog) -{ -#if ANNOTATE - const slang_ir_storage *st = n->Store; - static char s[100] = ""; - - if (!st) - return _mesa_strdup(""); - - switch (st->File) { - case PROGRAM_CONSTANT: - if (st->Index >= 0) { - const GLfloat *val = prog->Parameters->ParameterValues[st->Index]; - if (st->Swizzle == SWIZZLE_NOOP) - sprintf(s, "{%g, %g, %g, %g}", val[0], val[1], val[2], val[3]); - else { - sprintf(s, "%g", val[GET_SWZ(st->Swizzle, 0)]); - } - } - break; - case PROGRAM_TEMPORARY: - if (n->Var) - sprintf(s, "%s", (char *) n->Var->a_name); - else - sprintf(s, "t[%d]", st->Index); - break; - case PROGRAM_STATE_VAR: - case PROGRAM_UNIFORM: - sprintf(s, "%s", prog->Parameters->Parameters[st->Index].Name); - break; - case PROGRAM_VARYING: - sprintf(s, "%s", prog->Varying->Parameters[st->Index].Name); - break; - case PROGRAM_INPUT: - sprintf(s, "input[%d]", st->Index); - break; - case PROGRAM_OUTPUT: - sprintf(s, "output[%d]", st->Index); - break; - default: - s[0] = 0; - } - return _mesa_strdup(s); -#else - return NULL; -#endif -} - - -/** - * Return an annotation string for an instruction. - */ -static char * -instruction_annotation(gl_inst_opcode opcode, char *dstAnnot, - char *srcAnnot0, char *srcAnnot1, char *srcAnnot2) -{ -#if ANNOTATE - const char *operator; - char *s; - int len = 50; - - if (dstAnnot) - len += strlen(dstAnnot); - else - dstAnnot = _mesa_strdup(""); - - if (srcAnnot0) - len += strlen(srcAnnot0); - else - srcAnnot0 = _mesa_strdup(""); - - if (srcAnnot1) - len += strlen(srcAnnot1); - else - srcAnnot1 = _mesa_strdup(""); - - if (srcAnnot2) - len += strlen(srcAnnot2); - else - srcAnnot2 = _mesa_strdup(""); - - switch (opcode) { - case OPCODE_ADD: - operator = "+"; - break; - case OPCODE_SUB: - operator = "-"; - break; - case OPCODE_MUL: - operator = "*"; - break; - case OPCODE_DP2: - operator = "DP2"; - break; - case OPCODE_DP3: - operator = "DP3"; - break; - case OPCODE_DP4: - operator = "DP4"; - break; - case OPCODE_XPD: - operator = "XPD"; - break; - case OPCODE_RSQ: - operator = "RSQ"; - break; - case OPCODE_SGT: - operator = ">"; - break; - default: - operator = ","; - } - - s = (char *) malloc(len); - sprintf(s, "%s = %s %s %s %s", dstAnnot, - srcAnnot0, operator, srcAnnot1, srcAnnot2); - assert(strlen(s) < len); - - free(dstAnnot); - free(srcAnnot0); - free(srcAnnot1); - free(srcAnnot2); - - return s; -#else - return NULL; -#endif -} - - -/** - * Emit an instruction that's just a comment. - */ -static struct prog_instruction * -emit_comment(slang_emit_info *emitInfo, const char *comment) -{ - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_NOP); - if (inst) { - inst_comment(inst, comment); - } - return inst; -} - - -/** - * Generate code for a simple arithmetic instruction. - * Either 1, 2 or 3 operands. - */ -static struct prog_instruction * -emit_arith(slang_emit_info *emitInfo, slang_ir_node *n) -{ - const slang_ir_info *info = _slang_ir_info(n->Opcode); - struct prog_instruction *inst; - GLuint i; - - assert(info); - assert(info->InstOpcode != OPCODE_NOP); - -#if PEEPHOLE_OPTIMIZATIONS - /* Look for MAD opportunity */ - if (info->NumParams == 2 && - n->Opcode == IR_ADD && n->Children[0]->Opcode == IR_MUL) { - /* found pattern IR_ADD(IR_MUL(A, B), C) */ - emit(emitInfo, n->Children[0]->Children[0]); /* A */ - emit(emitInfo, n->Children[0]->Children[1]); /* B */ - emit(emitInfo, n->Children[1]); /* C */ - if (!alloc_node_storage(emitInfo, n, -1)) { /* dest */ - return NULL; - } - - inst = emit_instruction(emitInfo, - OPCODE_MAD, - n->Store, - n->Children[0]->Children[0]->Store, - n->Children[0]->Children[1]->Store, - n->Children[1]->Store); - - free_node_storage(emitInfo->vt, n->Children[0]->Children[0]); - free_node_storage(emitInfo->vt, n->Children[0]->Children[1]); - free_node_storage(emitInfo->vt, n->Children[1]); - return inst; - } - - if (info->NumParams == 2 && - n->Opcode == IR_ADD && n->Children[1]->Opcode == IR_MUL) { - /* found pattern IR_ADD(A, IR_MUL(B, C)) */ - emit(emitInfo, n->Children[0]); /* A */ - emit(emitInfo, n->Children[1]->Children[0]); /* B */ - emit(emitInfo, n->Children[1]->Children[1]); /* C */ - if (!alloc_node_storage(emitInfo, n, -1)) { /* dest */ - return NULL; - } - - inst = emit_instruction(emitInfo, - OPCODE_MAD, - n->Store, - n->Children[1]->Children[0]->Store, - n->Children[1]->Children[1]->Store, - n->Children[0]->Store); - - free_node_storage(emitInfo->vt, n->Children[1]->Children[0]); - free_node_storage(emitInfo->vt, n->Children[1]->Children[1]); - free_node_storage(emitInfo->vt, n->Children[0]); - return inst; - } -#endif - - /* gen code for children, may involve temp allocation */ - for (i = 0; i < info->NumParams; i++) { - emit(emitInfo, n->Children[i]); - if (!n->Children[i] || !n->Children[i]->Store) { - /* error recovery */ - return NULL; - } - } - - /* result storage */ - if (!alloc_node_storage(emitInfo, n, -1)) { - return NULL; - } - - inst = emit_instruction(emitInfo, - info->InstOpcode, - n->Store, /* dest */ - (info->NumParams > 0 ? n->Children[0]->Store : NULL), - (info->NumParams > 1 ? n->Children[1]->Store : NULL), - (info->NumParams > 2 ? n->Children[2]->Store : NULL) - ); - - /* free temps */ - for (i = 0; i < info->NumParams; i++) - free_node_storage(emitInfo->vt, n->Children[i]); - - return inst; -} - - -/** - * Emit code for == and != operators. These could normally be handled - * by emit_arith() except we need to be able to handle structure comparisons. - */ -static struct prog_instruction * -emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst = NULL; - GLint size; - - assert(n->Opcode == IR_EQUAL || n->Opcode == IR_NOTEQUAL); - - /* gen code for children */ - emit(emitInfo, n->Children[0]); - emit(emitInfo, n->Children[1]); - - if (n->Children[0]->Store->Size != n->Children[1]->Store->Size) { - /* XXX this error should have been caught in slang_codegen.c */ - slang_info_log_error(emitInfo->log, "invalid operands to == or !="); - n->Store = NULL; - return NULL; - } - - /* final result is 1 bool */ - if (!alloc_node_storage(emitInfo, n, 1)) - return NULL; - - size = n->Children[0]->Store->Size; - - if (size == 1) { - gl_inst_opcode opcode = n->Opcode == IR_EQUAL ? OPCODE_SEQ : OPCODE_SNE; - inst = emit_instruction(emitInfo, - opcode, - n->Store, /* dest */ - n->Children[0]->Store, - n->Children[1]->Store, - NULL); - } - else if (size <= 4) { - /* compare two vectors. - * Unfortunately, there's no instruction to compare vectors and - * return a scalar result. Do it with some compare and dot product - * instructions... - */ - GLuint swizzle; - gl_inst_opcode dotOp; - slang_ir_storage tempStore; - - if (!alloc_local_temp(emitInfo, &tempStore, 4)) { - n->Store = NULL; - return NULL; - /* out of temps */ - } - - if (size == 4) { - dotOp = OPCODE_DP4; - swizzle = SWIZZLE_XYZW; - } - else if (size == 3) { - dotOp = OPCODE_DP3; - swizzle = SWIZZLE_XYZW; - } - else { - assert(size == 2); - dotOp = OPCODE_DP3; /* XXX use OPCODE_DP2 eventually */ - swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y); - } - - /* Compute inequality (temp = (A != B)) */ - inst = emit_instruction(emitInfo, - OPCODE_SNE, - &tempStore, - n->Children[0]->Store, - n->Children[1]->Store, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "Compare values"); - - /* Compute val = DOT(temp, temp) (reduction) */ - inst = emit_instruction(emitInfo, - dotOp, - n->Store, - &tempStore, - &tempStore, - NULL); - if (!inst) { - return NULL; - } - inst->SrcReg[0].Swizzle = inst->SrcReg[1].Swizzle = swizzle; /*override*/ - inst_comment(inst, "Reduce vec to bool"); - - _slang_free_temp(emitInfo->vt, &tempStore); /* free temp */ - - if (n->Opcode == IR_EQUAL) { - /* compute val = !val.x with SEQ val, val, 0; */ - slang_ir_storage zero; - constant_to_storage(emitInfo, 0.0, &zero); - inst = emit_instruction(emitInfo, - OPCODE_SEQ, - n->Store, /* dest */ - n->Store, - &zero, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "Invert true/false"); - } - } - else { - /* size > 4, struct or array compare. - * XXX this won't work reliably for structs with padding!! - */ - GLint i, num = (n->Children[0]->Store->Size + 3) / 4; - slang_ir_storage accTemp, sneTemp; - - if (!alloc_local_temp(emitInfo, &accTemp, 4)) - return NULL; - - if (!alloc_local_temp(emitInfo, &sneTemp, 4)) - return NULL; - - for (i = 0; i < num; i++) { - slang_ir_storage srcStore0 = *n->Children[0]->Store; - slang_ir_storage srcStore1 = *n->Children[1]->Store; - srcStore0.Index += i; - srcStore1.Index += i; - - if (i == 0) { - /* SNE accTemp, left[i], right[i] */ - inst = emit_instruction(emitInfo, OPCODE_SNE, - &accTemp, /* dest */ - &srcStore0, - &srcStore1, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "Begin struct/array comparison"); - } - else { - /* SNE sneTemp, left[i], right[i] */ - inst = emit_instruction(emitInfo, OPCODE_SNE, - &sneTemp, /* dest */ - &srcStore0, - &srcStore1, - NULL); - if (!inst) { - return NULL; - } - /* ADD accTemp, accTemp, sneTemp; # like logical-OR */ - inst = emit_instruction(emitInfo, OPCODE_ADD, - &accTemp, /* dest */ - &accTemp, - &sneTemp, - NULL); - if (!inst) { - return NULL; - } - } - } - - /* compute accTemp.x || accTemp.y || accTemp.z || accTemp.w with DOT4 */ - inst = emit_instruction(emitInfo, OPCODE_DP4, - n->Store, - &accTemp, - &accTemp, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "End struct/array comparison"); - - if (n->Opcode == IR_EQUAL) { - /* compute tmp.x = !tmp.x via tmp.x = (tmp.x == 0) */ - slang_ir_storage zero; - constant_to_storage(emitInfo, 0.0, &zero); - inst = emit_instruction(emitInfo, OPCODE_SEQ, - n->Store, /* dest */ - n->Store, - &zero, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "Invert true/false"); - } - - _slang_free_temp(emitInfo->vt, &accTemp); - _slang_free_temp(emitInfo->vt, &sneTemp); - } - - /* free temps */ - free_node_storage(emitInfo->vt, n->Children[0]); - free_node_storage(emitInfo->vt, n->Children[1]); - - return inst; -} - - - -/** - * Generate code for an IR_CLAMP instruction. - */ -static struct prog_instruction * -emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - slang_ir_node tmpNode; - - assert(n->Opcode == IR_CLAMP); - /* ch[0] = value - * ch[1] = min limit - * ch[2] = max limit - */ - - inst = emit(emitInfo, n->Children[0]); - - /* If lower limit == 0.0 and upper limit == 1.0, - * set prev instruction's SaturateMode field to SATURATE_ZERO_ONE. - * Else, - * emit OPCODE_MIN, OPCODE_MAX sequence. - */ -#if 0 - /* XXX this isn't quite finished yet */ - if (n->Children[1]->Opcode == IR_FLOAT && - n->Children[1]->Value[0] == 0.0 && - n->Children[1]->Value[1] == 0.0 && - n->Children[1]->Value[2] == 0.0 && - n->Children[1]->Value[3] == 0.0 && - n->Children[2]->Opcode == IR_FLOAT && - n->Children[2]->Value[0] == 1.0 && - n->Children[2]->Value[1] == 1.0 && - n->Children[2]->Value[2] == 1.0 && - n->Children[2]->Value[3] == 1.0) { - if (!inst) { - inst = prev_instruction(prog); - } - if (inst && inst->Opcode != OPCODE_NOP) { - /* and prev instruction's DstReg matches n->Children[0]->Store */ - inst->SaturateMode = SATURATE_ZERO_ONE; - n->Store = n->Children[0]->Store; - return inst; - } - } -#else - (void) inst; -#endif - - if (!alloc_node_storage(emitInfo, n, n->Children[0]->Store->Size)) - return NULL; - - emit(emitInfo, n->Children[1]); - emit(emitInfo, n->Children[2]); - - /* Some GPUs don't allow reading from output registers. So if the - * dest for this clamp() is an output reg, we can't use that reg for - * the intermediate result. Use a temp register instead. - */ - memset(&tmpNode, 0, sizeof(tmpNode)); - if (!alloc_node_storage(emitInfo, &tmpNode, n->Store->Size)) { - return NULL; - } - - /* tmp = max(ch[0], ch[1]) */ - inst = emit_instruction(emitInfo, OPCODE_MAX, - tmpNode.Store, /* dest */ - n->Children[0]->Store, - n->Children[1]->Store, - NULL); - if (!inst) { - return NULL; - } - - /* n->dest = min(tmp, ch[2]) */ - inst = emit_instruction(emitInfo, OPCODE_MIN, - n->Store, /* dest */ - tmpNode.Store, - n->Children[2]->Store, - NULL); - - free_node_storage(emitInfo->vt, &tmpNode); - - return inst; -} - - -static struct prog_instruction * -emit_negation(slang_emit_info *emitInfo, slang_ir_node *n) -{ - /* Implement as MOV dst, -src; */ - /* XXX we could look at the previous instruction and in some circumstances - * modify it to accomplish the negation. - */ - struct prog_instruction *inst; - - emit(emitInfo, n->Children[0]); - - if (!alloc_node_storage(emitInfo, n, n->Children[0]->Store->Size)) - return NULL; - - inst = emit_instruction(emitInfo, - OPCODE_MOV, - n->Store, /* dest */ - n->Children[0]->Store, - NULL, - NULL); - if (inst) { - inst->SrcReg[0].Negate = NEGATE_XYZW; - } - return inst; -} - - -static struct prog_instruction * -emit_label(slang_emit_info *emitInfo, const slang_ir_node *n) -{ - assert(n->Label); -#if 0 - /* XXX this fails in loop tail code - investigate someday */ - assert(_slang_label_get_location(n->Label) < 0); - _slang_label_set_location(n->Label, emitInfo->prog->NumInstructions, - emitInfo->prog); -#else - if (_slang_label_get_location(n->Label) < 0) - _slang_label_set_location(n->Label, emitInfo->prog->NumInstructions, - emitInfo->prog); -#endif - return NULL; -} - - -/** - * Emit code for a function call. - * Note that for each time a function is called, we emit the function's - * body code again because the set of available registers may be different. - */ -static struct prog_instruction * -emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct gl_program *progSave; - struct prog_instruction *inst; - GLuint subroutineId; - GLuint maxInstSave; - - assert(n->Opcode == IR_CALL); - assert(n->Label); - - /* save/push cur program */ - maxInstSave = emitInfo->MaxInstructions; - progSave = emitInfo->prog; - - emitInfo->prog = new_subroutine(emitInfo, &subroutineId); - emitInfo->MaxInstructions = emitInfo->prog->NumInstructions; - - _slang_label_set_location(n->Label, emitInfo->prog->NumInstructions, - emitInfo->prog); - - if (emitInfo->EmitBeginEndSub) { - /* BGNSUB isn't a real instruction. - * We require a label (i.e. "foobar:") though, if we're going to - * print the program in the NV format. The BNGSUB instruction is - * really just a NOP to attach the label to. - */ - inst = new_instruction(emitInfo, OPCODE_BGNSUB); - if (!inst) { - return NULL; - } - inst_comment(inst, n->Label->Name); - } - - /* body of function: */ - emit(emitInfo, n->Children[0]); - n->Store = n->Children[0]->Store; - - /* add RET instruction now, if needed */ - inst = prev_instruction(emitInfo); - if (inst && inst->Opcode != OPCODE_RET) { - inst = new_instruction(emitInfo, OPCODE_RET); - if (!inst) { - return NULL; - } - } - - if (emitInfo->EmitBeginEndSub) { - inst = new_instruction(emitInfo, OPCODE_ENDSUB); - if (!inst) { - return NULL; - } - inst_comment(inst, n->Label->Name); - } - - /* pop/restore cur program */ - emitInfo->prog = progSave; - emitInfo->MaxInstructions = maxInstSave; - - /* emit the function call */ - inst = new_instruction(emitInfo, OPCODE_CAL); - if (!inst) { - return NULL; - } - /* The branch target is just the subroutine number (changed later) */ - inst->BranchTarget = subroutineId; - inst_comment(inst, n->Label->Name); - assert(inst->BranchTarget >= 0); - - return inst; -} - - -/** - * Emit code for a 'return' statement. - */ -static struct prog_instruction * -emit_return(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - assert(n); - assert(n->Opcode == IR_RETURN); - assert(n->Label); - inst = new_instruction(emitInfo, OPCODE_RET); - if (inst) { - inst->DstReg.CondMask = COND_TR; /* always return */ - } - return inst; -} - - -static struct prog_instruction * -emit_kill(slang_emit_info *emitInfo) -{ - struct gl_fragment_program *fp; - struct prog_instruction *inst; - /* NV-KILL - discard fragment depending on condition code. - * Note that ARB-KILL depends on sign of vector operand. - */ - inst = new_instruction(emitInfo, OPCODE_KIL_NV); - if (!inst) { - return NULL; - } - inst->DstReg.CondMask = COND_TR; /* always kill */ - - assert(emitInfo->prog->Target == GL_FRAGMENT_PROGRAM_ARB); - fp = (struct gl_fragment_program *) emitInfo->prog; - fp->UsesKill = GL_TRUE; - - return inst; -} - - -static struct prog_instruction * -emit_tex(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - gl_inst_opcode opcode; - GLboolean shadow = GL_FALSE; - - switch (n->Opcode) { - case IR_TEX: - opcode = OPCODE_TEX; - break; - case IR_TEX_SH: - opcode = OPCODE_TEX; - shadow = GL_TRUE; - break; - case IR_TEXB: - opcode = OPCODE_TXB; - break; - case IR_TEXB_SH: - opcode = OPCODE_TXB; - shadow = GL_TRUE; - break; - case IR_TEXP: - opcode = OPCODE_TXP; - break; - case IR_TEXP_SH: - opcode = OPCODE_TXP; - shadow = GL_TRUE; - break; - default: - _mesa_problem(NULL, "Bad IR TEX code"); - return NULL; - } - - if (n->Children[0]->Opcode == IR_ELEMENT) { - /* array is the sampler (a uniform which'll indicate the texture unit) */ - assert(n->Children[0]->Children[0]->Store); - assert(n->Children[0]->Children[0]->Store->File == PROGRAM_SAMPLER); - - emit(emitInfo, n->Children[0]); - - n->Children[0]->Var = n->Children[0]->Children[0]->Var; - } else { - /* this is the sampler (a uniform which'll indicate the texture unit) */ - assert(n->Children[0]->Store); - assert(n->Children[0]->Store->File == PROGRAM_SAMPLER); - } - - /* emit code for the texcoord operand */ - (void) emit(emitInfo, n->Children[1]); - - /* alloc storage for result of texture fetch */ - if (!alloc_node_storage(emitInfo, n, 4)) - return NULL; - - /* emit TEX instruction; Child[1] is the texcoord */ - inst = emit_instruction(emitInfo, - opcode, - n->Store, - n->Children[1]->Store, - NULL, - NULL); - if (!inst) { - return NULL; - } - - inst->TexShadow = shadow; - - /* Store->Index is the uniform/sampler index */ - assert(n->Children[0]->Store->Index >= 0); - inst->TexSrcUnit = n->Children[0]->Store->Index; - inst->TexSrcTarget = n->Children[0]->Store->TexTarget; - - /* mark the sampler as being used */ - _mesa_use_uniform(emitInfo->prog->Parameters, - (char *) n->Children[0]->Var->a_name); - - return inst; -} - - -/** - * Assignment/copy - */ -static struct prog_instruction * -emit_copy(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - - assert(n->Opcode == IR_COPY); - - /* lhs */ - emit(emitInfo, n->Children[0]); - if (!n->Children[0]->Store || n->Children[0]->Store->Index < 0) { - /* an error should have been already recorded */ - return NULL; - } - - /* rhs */ - assert(n->Children[1]); - inst = emit(emitInfo, n->Children[1]); - - if (!n->Children[1]->Store || n->Children[1]->Store->Index < 0) { - if (!emitInfo->log->text && !emitInfo->UnresolvedFunctions) { - /* XXX this error should have been caught in slang_codegen.c */ - slang_info_log_error(emitInfo->log, "invalid assignment"); - } - return NULL; - } - - assert(n->Children[1]->Store->Index >= 0); - - /*assert(n->Children[0]->Store->Size == n->Children[1]->Store->Size);*/ - - n->Store = n->Children[0]->Store; - - if (n->Store->File == PROGRAM_SAMPLER) { - /* no code generated for sampler assignments, - * just copy the sampler index/target at compile time. - */ - n->Store->Index = n->Children[1]->Store->Index; - n->Store->TexTarget = n->Children[1]->Store->TexTarget; - return NULL; - } - -#if PEEPHOLE_OPTIMIZATIONS - if (inst && - (n->Children[1]->Opcode != IR_SWIZZLE) && - _slang_is_temp(emitInfo->vt, n->Children[1]->Store) && - (inst->DstReg.File == n->Children[1]->Store->File) && - (inst->DstReg.Index == n->Children[1]->Store->Index) && - !n->Children[0]->Store->IsIndirect && - n->Children[0]->Store->Size <= 4) { - /* Peephole optimization: - * The Right-Hand-Side has its results in a temporary place. - * Modify the RHS (and the prev instruction) to store its results - * in the destination specified by n->Children[0]. - * Then, this MOVE is a no-op. - * Ex: - * MUL tmp, x, y; - * MOV a, tmp; - * becomes: - * MUL a, x, y; - */ - - /* fixup the previous instruction (which stored the RHS result) */ - assert(n->Children[0]->Store->Index >= 0); - storage_to_dst_reg(&inst->DstReg, n->Children[0]->Store); - return inst; - } - else -#endif - { - if (n->Children[0]->Store->Size > 4) { - /* move matrix/struct etc (block of registers) */ - slang_ir_storage dstStore = *n->Children[0]->Store; - slang_ir_storage srcStore = *n->Children[1]->Store; - GLint size = srcStore.Size; - ASSERT(n->Children[1]->Store->Swizzle == SWIZZLE_NOOP); - dstStore.Size = 4; - srcStore.Size = 4; - while (size >= 4) { - inst = emit_instruction(emitInfo, OPCODE_MOV, - &dstStore, - &srcStore, - NULL, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "IR_COPY block"); - srcStore.Index++; - dstStore.Index++; - size -= 4; - } - } - else { - /* single register move */ - char *srcAnnot, *dstAnnot; - assert(n->Children[0]->Store->Index >= 0); - inst = emit_instruction(emitInfo, OPCODE_MOV, - n->Children[0]->Store, /* dest */ - n->Children[1]->Store, - NULL, - NULL); - if (!inst) { - return NULL; - } - dstAnnot = storage_annotation(n->Children[0], emitInfo->prog); - srcAnnot = storage_annotation(n->Children[1], emitInfo->prog); - inst->Comment = instruction_annotation(inst->Opcode, dstAnnot, - srcAnnot, NULL, NULL); - } - free_node_storage(emitInfo->vt, n->Children[1]); - return inst; - } -} - - -/** - * An IR_COND node wraps a boolean expression which is used by an - * IF or WHILE test. This is where we'll set condition codes, if needed. - */ -static struct prog_instruction * -emit_cond(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - - assert(n->Opcode == IR_COND); - - if (!n->Children[0]) - return NULL; - - /* emit code for the expression */ - inst = emit(emitInfo, n->Children[0]); - - if (!n->Children[0]->Store) { - /* error recovery */ - return NULL; - } - - assert(n->Children[0]->Store); - /*assert(n->Children[0]->Store->Size == 1);*/ - - if (emitInfo->EmitCondCodes) { - if (inst && - n->Children[0]->Store && - inst->DstReg.File == n->Children[0]->Store->File && - inst->DstReg.Index == n->Children[0]->Store->Index) { - /* The previous instruction wrote to the register who's value - * we're testing. Just fix that instruction so that the - * condition codes are computed. - */ - inst->CondUpdate = GL_TRUE; - n->Store = n->Children[0]->Store; - return inst; - } - else { - /* This'll happen for things like "if (i) ..." where no code - * is normally generated for the expression "i". - * Generate a move instruction just to set condition codes. - */ - if (!alloc_node_storage(emitInfo, n, 1)) - return NULL; - inst = emit_instruction(emitInfo, OPCODE_MOV, - n->Store, /* dest */ - n->Children[0]->Store, - NULL, - NULL); - if (!inst) { - return NULL; - } - inst->CondUpdate = GL_TRUE; - inst_comment(inst, "COND expr"); - _slang_free_temp(emitInfo->vt, n->Store); - return inst; - } - } - else { - /* No-op: the boolean result of the expression is in a regular reg */ - n->Store = n->Children[0]->Store; - return inst; - } -} - - -/** - * Logical-NOT - */ -static struct prog_instruction * -emit_not(slang_emit_info *emitInfo, slang_ir_node *n) -{ - static const struct { - gl_inst_opcode op, opNot; - } operators[] = { - { OPCODE_SLT, OPCODE_SGE }, - { OPCODE_SLE, OPCODE_SGT }, - { OPCODE_SGT, OPCODE_SLE }, - { OPCODE_SGE, OPCODE_SLT }, - { OPCODE_SEQ, OPCODE_SNE }, - { OPCODE_SNE, OPCODE_SEQ }, - { 0, 0 } - }; - struct prog_instruction *inst; - slang_ir_storage zero; - GLuint i; - - /* child expr */ - inst = emit(emitInfo, n->Children[0]); - -#if PEEPHOLE_OPTIMIZATIONS - if (inst) { - /* if the prev instruction was a comparison instruction, invert it */ - for (i = 0; operators[i].op; i++) { - if (inst->Opcode == operators[i].op) { - inst->Opcode = operators[i].opNot; - n->Store = n->Children[0]->Store; - return inst; - } - } - } -#endif - - /* else, invert using SEQ (v = v == 0) */ - if (!alloc_node_storage(emitInfo, n, n->Children[0]->Store->Size)) - return NULL; - - constant_to_storage(emitInfo, 0.0, &zero); - inst = emit_instruction(emitInfo, - OPCODE_SEQ, - n->Store, - n->Children[0]->Store, - &zero, - NULL); - if (!inst) { - return NULL; - } - inst_comment(inst, "NOT"); - - free_node_storage(emitInfo->vt, n->Children[0]); - - return inst; -} - - -static struct prog_instruction * -emit_if(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct gl_program *prog = emitInfo->prog; - GLuint ifInstLoc, elseInstLoc = 0; - GLuint condWritemask = 0; - - /* emit condition expression code */ - { - struct prog_instruction *inst; - inst = emit(emitInfo, n->Children[0]); - if (emitInfo->EmitCondCodes) { - if (!inst) { - /* error recovery */ - return NULL; - } - condWritemask = inst->DstReg.WriteMask; - } - } - - if (!n->Children[0]->Store) - return NULL; - -#if 0 - assert(n->Children[0]->Store->Size == 1); /* a bool! */ -#endif - - ifInstLoc = prog->NumInstructions; - if (emitInfo->EmitHighLevelInstructions) { - if (emitInfo->EmitCondCodes) { - /* IF condcode THEN ... */ - struct prog_instruction *ifInst = new_instruction(emitInfo, OPCODE_IF); - if (!ifInst) { - return NULL; - } - ifInst->DstReg.CondMask = COND_NE; /* if cond is non-zero */ - /* only test the cond code (1 of 4) that was updated by the - * previous instruction. - */ - ifInst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); - } - else { - struct prog_instruction *inst; - - /* IF src[0] THEN ... */ - inst = emit_instruction(emitInfo, OPCODE_IF, - NULL, /* dst */ - n->Children[0]->Store, /* op0 */ - NULL, - NULL); - if (!inst) { - return NULL; - } - } - } - else { - /* conditional jump to else, or endif */ - struct prog_instruction *ifInst = new_instruction(emitInfo, OPCODE_BRA); - if (!ifInst) { - return NULL; - } - ifInst->DstReg.CondMask = COND_EQ; /* BRA if cond is zero */ - inst_comment(ifInst, "if zero"); - ifInst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); - } - - /* if body */ - emit(emitInfo, n->Children[1]); - - if (n->Children[2]) { - /* have else body */ - elseInstLoc = prog->NumInstructions; - if (emitInfo->EmitHighLevelInstructions) { - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ELSE); - if (!inst) { - return NULL; - } - prog->Instructions[ifInstLoc].BranchTarget = prog->NumInstructions - 1; - } - else { - /* jump to endif instruction */ - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_BRA); - if (!inst) { - return NULL; - } - inst_comment(inst, "else"); - inst->DstReg.CondMask = COND_TR; /* always branch */ - prog->Instructions[ifInstLoc].BranchTarget = prog->NumInstructions; - } - emit(emitInfo, n->Children[2]); - } - else { - /* no else body */ - prog->Instructions[ifInstLoc].BranchTarget = prog->NumInstructions; - } - - if (emitInfo->EmitHighLevelInstructions) { - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ENDIF); - if (!inst) { - return NULL; - } - } - - if (elseInstLoc) { - /* point ELSE instruction BranchTarget at ENDIF */ - if (emitInfo->EmitHighLevelInstructions) { - prog->Instructions[elseInstLoc].BranchTarget = prog->NumInstructions - 1; - } - else { - prog->Instructions[elseInstLoc].BranchTarget = prog->NumInstructions; - } - } - return NULL; -} - - -static struct prog_instruction * -emit_loop(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct gl_program *prog = emitInfo->prog; - struct prog_instruction *endInst; - GLuint beginInstLoc, tailInstLoc, endInstLoc; - slang_ir_node *ir; - - /* emit OPCODE_BGNLOOP */ - beginInstLoc = prog->NumInstructions; - if (emitInfo->EmitHighLevelInstructions) { - struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_BGNLOOP); - if (!inst) { - return NULL; - } - } - - /* body */ - emit(emitInfo, n->Children[0]); - - /* tail */ - tailInstLoc = prog->NumInstructions; - if (n->Children[1]) { - if (emitInfo->EmitComments) - emit_comment(emitInfo, "Loop tail code:"); - emit(emitInfo, n->Children[1]); - } - - endInstLoc = prog->NumInstructions; - if (emitInfo->EmitHighLevelInstructions) { - /* emit OPCODE_ENDLOOP */ - endInst = new_instruction(emitInfo, OPCODE_ENDLOOP); - if (!endInst) { - return NULL; - } - } - else { - /* emit unconditional BRA-nch */ - endInst = new_instruction(emitInfo, OPCODE_BRA); - if (!endInst) { - return NULL; - } - endInst->DstReg.CondMask = COND_TR; /* always true */ - } - /* ENDLOOP's BranchTarget points to the BGNLOOP inst */ - endInst->BranchTarget = beginInstLoc; - - if (emitInfo->EmitHighLevelInstructions) { - /* BGNLOOP's BranchTarget points to the ENDLOOP inst */ - prog->Instructions[beginInstLoc].BranchTarget = prog->NumInstructions -1; - } - - /* Done emitting loop code. Now walk over the loop's linked list of - * BREAK and CONT nodes, filling in their BranchTarget fields (which - * will point to the corresponding ENDLOOP instruction. - */ - for (ir = n->List; ir; ir = ir->List) { - struct prog_instruction *inst = prog->Instructions + ir->InstLocation; - assert(inst->BranchTarget < 0); - if (ir->Opcode == IR_BREAK || - ir->Opcode == IR_BREAK_IF_TRUE) { - assert(inst->Opcode == OPCODE_BRK || - inst->Opcode == OPCODE_BRA); - /* go to instruction at end of loop */ - if (emitInfo->EmitHighLevelInstructions) { - inst->BranchTarget = endInstLoc; - } - else { - inst->BranchTarget = endInstLoc + 1; - } - } - else { - assert(ir->Opcode == IR_CONT || - ir->Opcode == IR_CONT_IF_TRUE); - assert(inst->Opcode == OPCODE_CONT || - inst->Opcode == OPCODE_BRA); - /* go to instruction at tail of loop */ - inst->BranchTarget = endInstLoc; - } - } - return NULL; -} - - -/** - * Unconditional "continue" or "break" statement. - * Either OPCODE_CONT, OPCODE_BRK or OPCODE_BRA will be emitted. - */ -static struct prog_instruction * -emit_cont_break(slang_emit_info *emitInfo, slang_ir_node *n) -{ - gl_inst_opcode opcode; - struct prog_instruction *inst; - - if (n->Opcode == IR_CONT) { - /* we need to execute the loop's tail code before doing CONT */ - assert(n->Parent); - assert(n->Parent->Opcode == IR_LOOP); - if (n->Parent->Children[1]) { - /* emit tail code */ - if (emitInfo->EmitComments) { - emit_comment(emitInfo, "continue - tail code:"); - } - emit(emitInfo, n->Parent->Children[1]); - } - } - - /* opcode selection */ - if (emitInfo->EmitHighLevelInstructions) { - opcode = (n->Opcode == IR_CONT) ? OPCODE_CONT : OPCODE_BRK; - } - else { - opcode = OPCODE_BRA; - } - n->InstLocation = emitInfo->prog->NumInstructions; - inst = new_instruction(emitInfo, opcode); - if (inst) { - inst->DstReg.CondMask = COND_TR; /* always true */ - } - return inst; -} - - -/** - * Conditional "continue" or "break" statement. - * Either OPCODE_CONT, OPCODE_BRK or OPCODE_BRA will be emitted. - */ -static struct prog_instruction * -emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - - assert(n->Opcode == IR_CONT_IF_TRUE || - n->Opcode == IR_BREAK_IF_TRUE); - - /* evaluate condition expr, setting cond codes */ - inst = emit(emitInfo, n->Children[0]); - if (emitInfo->EmitCondCodes) { - assert(inst); - inst->CondUpdate = GL_TRUE; - } - - n->InstLocation = emitInfo->prog->NumInstructions; - - /* opcode selection */ - if (emitInfo->EmitHighLevelInstructions) { - const gl_inst_opcode opcode - = (n->Opcode == IR_CONT_IF_TRUE) ? OPCODE_CONT : OPCODE_BRK; - if (emitInfo->EmitCondCodes) { - /* Get the writemask from the previous instruction which set - * the condcodes. Use that writemask as the CondSwizzle. - */ - const GLuint condWritemask = inst->DstReg.WriteMask; - inst = new_instruction(emitInfo, opcode); - if (inst) { - inst->DstReg.CondMask = COND_NE; - inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); - } - return inst; - } - else { - /* IF reg - * BRK/CONT; - * ENDIF - */ - GLint ifInstLoc; - ifInstLoc = emitInfo->prog->NumInstructions; - inst = emit_instruction(emitInfo, OPCODE_IF, - NULL, /* dest */ - n->Children[0]->Store, - NULL, - NULL); - if (!inst) { - return NULL; - } - n->InstLocation = emitInfo->prog->NumInstructions; - - inst = new_instruction(emitInfo, opcode); - if (!inst) { - return NULL; - } - inst = new_instruction(emitInfo, OPCODE_ENDIF); - if (!inst) { - return NULL; - } - - emitInfo->prog->Instructions[ifInstLoc].BranchTarget - = emitInfo->prog->NumInstructions - 1; - return inst; - } - } - else { - const GLuint condWritemask = inst->DstReg.WriteMask; - assert(emitInfo->EmitCondCodes); - inst = new_instruction(emitInfo, OPCODE_BRA); - if (inst) { - inst->DstReg.CondMask = COND_NE; - inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); - } - return inst; - } -} - - -/** - * Return the size of a swizzle mask given that some swizzle components - * may be NIL/undefined. For example: - * swizzle_size(".zzxx") = 4 - * swizzle_size(".xy??") = 2 - * swizzle_size(".w???") = 1 - */ -static GLuint -swizzle_size(GLuint swizzle) -{ - GLuint i; - for (i = 0; i < 4; i++) { - if (GET_SWZ(swizzle, i) == SWIZZLE_NIL) - return i; - } - return 4; -} - - -static struct prog_instruction * -emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - - inst = emit(emitInfo, n->Children[0]); - - if (!n->Store->Parent) { - /* this covers a case such as "(b ? p : q).x" */ - n->Store->Parent = n->Children[0]->Store; - assert(n->Store->Parent); - } - - { - const GLuint swizzle = n->Store->Swizzle; - /* new storage is parent storage with updated Swizzle + Size fields */ - _slang_copy_ir_storage(n->Store, n->Store->Parent); - /* Apply this node's swizzle to parent's storage */ - n->Store->Swizzle = _slang_swizzle_swizzle(n->Store->Swizzle, swizzle); - /* Update size */ - n->Store->Size = swizzle_size(n->Store->Swizzle); - } - - assert(!n->Store->Parent); - assert(n->Store->Index >= 0); - - return inst; -} - - -/** - * Dereference array element: element == array[index] - * This basically involves emitting code for computing the array index - * and updating the node/element's storage info. - */ -static struct prog_instruction * -emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n) -{ - slang_ir_storage *arrayStore, *indexStore; - const int elemSize = n->Store->Size; /* number of floats */ - const GLint elemSizeVec = (elemSize + 3) / 4; /* number of vec4 */ - struct prog_instruction *inst; - - assert(n->Opcode == IR_ELEMENT); - assert(elemSize > 0); - - /* special case for built-in state variables, like light state */ - { - slang_ir_storage *root = n->Store; - assert(!root->Parent); - while (root->Parent) - root = root->Parent; - - if (root->File == PROGRAM_STATE_VAR) { - GLboolean direct; - GLint index = - _slang_alloc_statevar(n, emitInfo->prog->Parameters, &direct); - if (index < 0) { - /* error */ - return NULL; - } - if (direct) { - n->Store->Index = index; - return NULL; /* all done */ - } - } - } - - /* do codegen for array itself */ - emit(emitInfo, n->Children[0]); - arrayStore = n->Children[0]->Store; - - /* The initial array element storage is the array's storage, - * then modified below. - */ - _slang_copy_ir_storage(n->Store, arrayStore); - - - if (n->Children[1]->Opcode == IR_FLOAT) { - /* Constant array index */ - const GLint element = (GLint) n->Children[1]->Value[0]; - - /* this element's storage is the array's storage, plus constant offset */ - n->Store->Index += elemSizeVec * element; - } - else { - /* Variable array index */ - - /* do codegen for array index expression */ - emit(emitInfo, n->Children[1]); - indexStore = n->Children[1]->Store; - - if (indexStore->IsIndirect) { - /* need to put the array index into a temporary since we can't - * directly support a[b[i]] constructs. - */ - - - /*indexStore = tempstore();*/ - } - - - if (elemSize > 4) { - /* need to multiply array index by array element size */ - struct prog_instruction *inst; - slang_ir_storage *indexTemp; - slang_ir_storage elemSizeStore; - - /* allocate 1 float indexTemp */ - indexTemp = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, 1); - _slang_alloc_temp(emitInfo->vt, indexTemp); - - /* allocate a constant containing the element size */ - constant_to_storage(emitInfo, (float) elemSizeVec, &elemSizeStore); - - /* multiply array index by element size */ - inst = emit_instruction(emitInfo, - OPCODE_MUL, - indexTemp, /* dest */ - indexStore, /* the index */ - &elemSizeStore, - NULL); - if (!inst) { - return NULL; - } - - indexStore = indexTemp; - } - - if (arrayStore->IsIndirect) { - /* ex: in a[i][j], a[i] (the arrayStore) is indirect */ - /* Need to add indexStore to arrayStore->Indirect store */ - slang_ir_storage indirectArray; - slang_ir_storage *indexTemp; - - _slang_init_ir_storage(&indirectArray, - arrayStore->IndirectFile, - arrayStore->IndirectIndex, - 1, - arrayStore->IndirectSwizzle); - - /* allocate 1 float indexTemp */ - indexTemp = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, 1); - _slang_alloc_temp(emitInfo->vt, indexTemp); - - inst = emit_instruction(emitInfo, - OPCODE_ADD, - indexTemp, /* dest */ - indexStore, /* the index */ - &indirectArray, /* indirect array base */ - NULL); - if (!inst) { - return NULL; - } - - indexStore = indexTemp; - } - - /* update the array element storage info */ - n->Store->IsIndirect = GL_TRUE; - n->Store->IndirectFile = indexStore->File; - n->Store->IndirectIndex = indexStore->Index; - n->Store->IndirectSwizzle = indexStore->Swizzle; - } - - n->Store->Size = elemSize; - n->Store->Swizzle = _slang_var_swizzle(elemSize, 0); - - return NULL; /* no instruction */ -} - - -/** - * Resolve storage for accessing a structure field. - */ -static struct prog_instruction * -emit_struct_field(slang_emit_info *emitInfo, slang_ir_node *n) -{ - slang_ir_storage *root = n->Store; - GLint fieldOffset, fieldSize; - - assert(n->Opcode == IR_FIELD); - - assert(!root->Parent); - while (root->Parent) - root = root->Parent; - - /* If this is the field of a state var, allocate constant/uniform - * storage for it now if we haven't already. - * Note that we allocate storage (uniform/constant slots) for state - * variables here rather than at declaration time so we only allocate - * space for the ones that we actually use! - */ - if (root->File == PROGRAM_STATE_VAR) { - GLboolean direct; - GLint index = _slang_alloc_statevar(n, emitInfo->prog->Parameters, &direct); - if (index < 0) { - slang_info_log_error(emitInfo->log, "Error parsing state variable"); - return NULL; - } - if (direct) { - root->Index = index; - return NULL; /* all done */ - } - } - - /* do codegen for struct */ - emit(emitInfo, n->Children[0]); - assert(n->Children[0]->Store->Index >= 0); - - - fieldOffset = n->Store->Index; - fieldSize = n->Store->Size; - - _slang_copy_ir_storage(n->Store, n->Children[0]->Store); - - n->Store->Index = n->Children[0]->Store->Index + fieldOffset / 4; - n->Store->Size = fieldSize; - - switch (fieldSize) { - case 1: - { - GLint swz = fieldOffset % 4; - n->Store->Swizzle = MAKE_SWIZZLE4(swz, swz, swz, swz); - } - break; - case 2: - n->Store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, - SWIZZLE_NIL, SWIZZLE_NIL); - break; - case 3: - n->Store->Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, - SWIZZLE_Z, SWIZZLE_NIL); - break; - default: - n->Store->Swizzle = SWIZZLE_XYZW; - } - - assert(n->Store->Index >= 0); - - return NULL; /* no instruction */ -} - - -/** - * Emit code for a variable declaration. - * This usually doesn't result in any code generation, but just - * memory allocation. - */ -static struct prog_instruction * -emit_var_decl(slang_emit_info *emitInfo, slang_ir_node *n) -{ - assert(n->Store); - assert(n->Store->File != PROGRAM_UNDEFINED); - assert(n->Store->Size > 0); - /*assert(n->Store->Index < 0);*/ - - if (!n->Var || n->Var->isTemp) { - /* a nameless/temporary variable, will be freed after first use */ - /*NEW*/ - if (n->Store->Index < 0 && !_slang_alloc_temp(emitInfo->vt, n->Store)) { - slang_info_log_error(emitInfo->log, - "Ran out of registers, too many temporaries"); - return NULL; - } - } - else { - /* a regular variable */ - _slang_add_variable(emitInfo->vt, n->Var); - if (!_slang_alloc_var(emitInfo->vt, n->Store)) { - slang_info_log_error(emitInfo->log, - "Ran out of registers, too many variables"); - return NULL; - } - /* - printf("IR_VAR_DECL %s %d store %p\n", - (char*) n->Var->a_name, n->Store->Index, (void*) n->Store); - */ - assert(n->Var->store == n->Store); - } - if (emitInfo->EmitComments) { - /* emit NOP with comment describing the variable's storage location */ - char s[1000]; - sprintf(s, "TEMP[%d]%s = variable %s (size %d)", - n->Store->Index, - _mesa_swizzle_string(n->Store->Swizzle, 0, GL_FALSE), - (n->Var ? (char *) n->Var->a_name : "anonymous"), - n->Store->Size); - emit_comment(emitInfo, s); - } - return NULL; -} - - -/** - * Emit code for a reference to a variable. - * Actually, no code is generated but we may do some memory allocation. - * In particular, state vars (uniforms) are allocated on an as-needed basis. - */ -static struct prog_instruction * -emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n) -{ - assert(n->Store); - assert(n->Store->File != PROGRAM_UNDEFINED); - - if (n->Store->File == PROGRAM_STATE_VAR && n->Store->Index < 0) { - GLboolean direct; - GLint index = _slang_alloc_statevar(n, emitInfo->prog->Parameters, &direct); - if (index < 0) { - /* error */ - char s[100]; - /* XXX isn't this really an out of memory/resources error? */ - _mesa_snprintf(s, sizeof(s), "Undefined variable '%s'", - (char *) n->Var->a_name); - slang_info_log_error(emitInfo->log, s); - return NULL; - } - - n->Store->Index = index; - } - else if (n->Store->File == PROGRAM_UNIFORM || - n->Store->File == PROGRAM_SAMPLER) { - /* mark var as used */ - _mesa_use_uniform(emitInfo->prog->Parameters, (char *) n->Var->a_name); - } - else if (n->Store->File == PROGRAM_INPUT) { - assert(n->Store->Index >= 0); - emitInfo->prog->InputsRead |= (1 << n->Store->Index); - } - - if (n->Store->Index < 0) { - /* probably ran out of registers */ - return NULL; - } - assert(n->Store->Size > 0); - - return NULL; -} - - -static struct prog_instruction * -emit(slang_emit_info *emitInfo, slang_ir_node *n) -{ - struct prog_instruction *inst; - if (!n) - return NULL; - - if (emitInfo->log->error_flag) { - return NULL; - } - - if (n->Comment) { - inst = new_instruction(emitInfo, OPCODE_NOP); - if (inst) { - inst->Comment = _mesa_strdup(n->Comment); - } - inst = NULL; - } - - switch (n->Opcode) { - case IR_SEQ: - /* sequence of two sub-trees */ - assert(n->Children[0]); - assert(n->Children[1]); - emit(emitInfo, n->Children[0]); - if (emitInfo->log->error_flag) - return NULL; - inst = emit(emitInfo, n->Children[1]); -#if 0 - assert(!n->Store); -#endif - n->Store = n->Children[1]->Store; - return inst; - - case IR_SCOPE: - /* new variable scope */ - _slang_push_var_table(emitInfo->vt); - inst = emit(emitInfo, n->Children[0]); - _slang_pop_var_table(emitInfo->vt); - return inst; - - case IR_VAR_DECL: - /* Variable declaration - allocate a register for it */ - inst = emit_var_decl(emitInfo, n); - return inst; - - case IR_VAR: - /* Reference to a variable - * Storage should have already been resolved/allocated. - */ - return emit_var_ref(emitInfo, n); - - case IR_ELEMENT: - return emit_array_element(emitInfo, n); - case IR_FIELD: - return emit_struct_field(emitInfo, n); - case IR_SWIZZLE: - return emit_swizzle(emitInfo, n); - - /* Simple arithmetic */ - /* unary */ - case IR_MOVE: - case IR_RSQ: - case IR_RCP: - case IR_FLOOR: - case IR_FRAC: - case IR_F_TO_I: - case IR_I_TO_F: - case IR_ABS: - case IR_SIN: - case IR_COS: - case IR_DDX: - case IR_DDY: - case IR_EXP: - case IR_EXP2: - case IR_LOG2: - case IR_NOISE1: - case IR_NOISE2: - case IR_NOISE3: - case IR_NOISE4: - case IR_NRM4: - case IR_NRM3: - /* binary */ - case IR_ADD: - case IR_SUB: - case IR_MUL: - case IR_DOT4: - case IR_DOT3: - case IR_DOT2: - case IR_CROSS: - case IR_MIN: - case IR_MAX: - case IR_SEQUAL: - case IR_SNEQUAL: - case IR_SGE: - case IR_SGT: - case IR_SLE: - case IR_SLT: - case IR_POW: - /* trinary operators */ - case IR_LRP: - case IR_CMP: - return emit_arith(emitInfo, n); - - case IR_EQUAL: - case IR_NOTEQUAL: - return emit_compare(emitInfo, n); - - case IR_CLAMP: - return emit_clamp(emitInfo, n); - case IR_TEX: - case IR_TEXB: - case IR_TEXP: - case IR_TEX_SH: - case IR_TEXB_SH: - case IR_TEXP_SH: - return emit_tex(emitInfo, n); - case IR_NEG: - return emit_negation(emitInfo, n); - case IR_FLOAT: - /* find storage location for this float constant */ - n->Store->Index = _mesa_add_unnamed_constant(emitInfo->prog->Parameters, - n->Value, - n->Store->Size, - &n->Store->Swizzle); - if (n->Store->Index < 0) { - slang_info_log_error(emitInfo->log, "Ran out of space for constants"); - return NULL; - } - return NULL; - - case IR_COPY: - return emit_copy(emitInfo, n); - - case IR_COND: - return emit_cond(emitInfo, n); - - case IR_NOT: - return emit_not(emitInfo, n); - - case IR_LABEL: - return emit_label(emitInfo, n); - - case IR_KILL: - return emit_kill(emitInfo); - - case IR_CALL: - /* new variable scope for subroutines/function calls */ - _slang_push_var_table(emitInfo->vt); - inst = emit_fcall(emitInfo, n); - _slang_pop_var_table(emitInfo->vt); - return inst; - - case IR_IF: - return emit_if(emitInfo, n); - - case IR_LOOP: - return emit_loop(emitInfo, n); - case IR_BREAK_IF_TRUE: - case IR_CONT_IF_TRUE: - return emit_cont_break_if_true(emitInfo, n); - case IR_BREAK: - /* fall-through */ - case IR_CONT: - return emit_cont_break(emitInfo, n); - - case IR_BEGIN_SUB: - return new_instruction(emitInfo, OPCODE_BGNSUB); - case IR_END_SUB: - return new_instruction(emitInfo, OPCODE_ENDSUB); - case IR_RETURN: - return emit_return(emitInfo, n); - - case IR_NOP: - return NULL; - - default: - _mesa_problem(NULL, "Unexpected IR opcode in emit()\n"); - } - return NULL; -} - - -/** - * After code generation, any subroutines will be in separate program - * objects. This function appends all the subroutines onto the main - * program and resolves the linking of all the branch/call instructions. - * XXX this logic should really be part of the linking process... - */ -static void -_slang_resolve_subroutines(slang_emit_info *emitInfo) -{ - GET_CURRENT_CONTEXT(ctx); - struct gl_program *mainP = emitInfo->prog; - GLuint *subroutineLoc, i, total; - - subroutineLoc - = (GLuint *) malloc(emitInfo->NumSubroutines * sizeof(GLuint)); - - /* total number of instructions */ - total = mainP->NumInstructions; - for (i = 0; i < emitInfo->NumSubroutines; i++) { - subroutineLoc[i] = total; - total += emitInfo->Subroutines[i]->NumInstructions; - } - - /* adjust BranchTargets within the functions */ - for (i = 0; i < emitInfo->NumSubroutines; i++) { - struct gl_program *sub = emitInfo->Subroutines[i]; - GLuint j; - for (j = 0; j < sub->NumInstructions; j++) { - struct prog_instruction *inst = sub->Instructions + j; - if (inst->Opcode != OPCODE_CAL && inst->BranchTarget >= 0) { - inst->BranchTarget += subroutineLoc[i]; - } - } - } - - /* append subroutines' instructions after main's instructions */ - mainP->Instructions = _mesa_realloc_instructions(mainP->Instructions, - mainP->NumInstructions, - total); - mainP->NumInstructions = total; - for (i = 0; i < emitInfo->NumSubroutines; i++) { - struct gl_program *sub = emitInfo->Subroutines[i]; - _mesa_copy_instructions(mainP->Instructions + subroutineLoc[i], - sub->Instructions, - sub->NumInstructions); - /* delete subroutine code */ - sub->Parameters = NULL; /* prevent double-free */ - _mesa_reference_program(ctx, &emitInfo->Subroutines[i], NULL); - } - - /* free subroutine list */ - if (emitInfo->Subroutines) { - free(emitInfo->Subroutines); - emitInfo->Subroutines = NULL; - } - emitInfo->NumSubroutines = 0; - - /* Examine CAL instructions. - * At this point, the BranchTarget field of the CAL instruction is - * the number/id of the subroutine to call (an index into the - * emitInfo->Subroutines list). - * Translate that into an actual instruction location now. - */ - for (i = 0; i < mainP->NumInstructions; i++) { - struct prog_instruction *inst = mainP->Instructions + i; - if (inst->Opcode == OPCODE_CAL) { - const GLuint f = inst->BranchTarget; - inst->BranchTarget = subroutineLoc[f]; - } - } - - free(subroutineLoc); -} - - - -/** - * Convert the IR tree into GPU instructions. - * \param n root of IR tree - * \param vt variable table - * \param prog program to put GPU instructions into - * \param pragmas controls codegen options - * \param withEnd if true, emit END opcode at end - * \param log log for emitting errors/warnings/info - */ -GLboolean -_slang_emit_code(slang_ir_node *n, slang_var_table *vt, - struct gl_program *prog, - const struct gl_sl_pragmas *pragmas, - GLboolean withEnd, - slang_info_log *log) -{ - GET_CURRENT_CONTEXT(ctx); - GLboolean success; - slang_emit_info emitInfo; - GLuint maxUniforms; - - emitInfo.log = log; - emitInfo.vt = vt; - emitInfo.prog = prog; - emitInfo.Subroutines = NULL; - emitInfo.NumSubroutines = 0; - emitInfo.MaxInstructions = prog->NumInstructions; - - emitInfo.EmitHighLevelInstructions = ctx->Shader.EmitHighLevelInstructions; - emitInfo.EmitCondCodes = ctx->Shader.EmitCondCodes; - emitInfo.EmitComments = ctx->Shader.EmitComments || pragmas->Debug; - emitInfo.EmitBeginEndSub = GL_TRUE; - - if (!emitInfo.EmitCondCodes) { - emitInfo.EmitHighLevelInstructions = GL_TRUE; - } - - /* Check uniform/constant limits */ - if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) { - maxUniforms = ctx->Const.FragmentProgram.MaxUniformComponents / 4; - } - else { - assert(prog->Target == GL_VERTEX_PROGRAM_ARB); - maxUniforms = ctx->Const.VertexProgram.MaxUniformComponents / 4; - } - if (prog->Parameters->NumParameters > maxUniforms) { - slang_info_log_error(log, "Constant/uniform register limit exceeded " - "(max=%u vec4)", maxUniforms); - - return GL_FALSE; - } - - (void) emit(&emitInfo, n); - - /* finish up by adding the END opcode to program */ - if (withEnd) { - struct prog_instruction *inst; - inst = new_instruction(&emitInfo, OPCODE_END); - if (!inst) { - return GL_FALSE; - } - } - - _slang_resolve_subroutines(&emitInfo); - - success = GL_TRUE; - -#if 0 - printf("*********** End emit code (%u inst):\n", prog->NumInstructions); - _mesa_print_program(prog); - _mesa_print_program_parameters(ctx,prog); -#endif - - return success; -} diff --git a/mesalib/src/mesa/shader/slang/slang_emit.h b/mesalib/src/mesa/shader/slang/slang_emit.h deleted file mode 100644 index ab4c202d6..000000000 --- a/mesalib/src/mesa/shader/slang/slang_emit.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 2005-2008 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SLANG_EMIT_H -#define SLANG_EMIT_H - - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_ir.h" -#include "main/mtypes.h" - - -extern GLuint -_slang_swizzle_swizzle(GLuint swz1, GLuint swz2); - - -extern GLuint -_slang_var_swizzle(GLint size, GLint comp); - - -extern GLboolean -_slang_emit_code(slang_ir_node *n, slang_var_table *vartable, - struct gl_program *prog, - const struct gl_sl_pragmas *pragmas, - GLboolean withEnd, - slang_info_log *log); - - -#endif /* SLANG_EMIT_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_ir.c b/mesalib/src/mesa/shader/slang/slang_ir.c deleted file mode 100644 index 62603503d..000000000 --- a/mesalib/src/mesa/shader/slang/slang_ir.c +++ /dev/null @@ -1,498 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#include "main/imports.h" -#include "main/context.h" -#include "slang_ir.h" -#include "slang_mem.h" -#include "shader/prog_instruction.h" -#include "shader/prog_print.h" - - -static const slang_ir_info IrInfo[] = { - /* binary ops */ - { IR_ADD, "IR_ADD", OPCODE_ADD, 4, 2 }, - { IR_SUB, "IR_SUB", OPCODE_SUB, 4, 2 }, - { IR_MUL, "IR_MUL", OPCODE_MUL, 4, 2 }, - { IR_DIV, "IR_DIV", OPCODE_NOP, 0, 2 }, /* XXX broke */ - { IR_DOT4, "IR_DOT4", OPCODE_DP4, 1, 2 }, - { IR_DOT3, "IR_DOT3", OPCODE_DP3, 1, 2 }, - { IR_DOT2, "IR_DOT2", OPCODE_DP2, 1, 2 }, - { IR_NRM4, "IR_NRM4", OPCODE_NRM4, 1, 1 }, - { IR_NRM3, "IR_NRM3", OPCODE_NRM3, 1, 1 }, - { IR_CROSS, "IR_CROSS", OPCODE_XPD, 3, 2 }, - { IR_LRP, "IR_LRP", OPCODE_LRP, 4, 3 }, - { IR_MIN, "IR_MIN", OPCODE_MIN, 4, 2 }, - { IR_MAX, "IR_MAX", OPCODE_MAX, 4, 2 }, - { IR_CLAMP, "IR_CLAMP", OPCODE_NOP, 4, 3 }, /* special case: emit_clamp() */ - { IR_SEQUAL, "IR_SEQUAL", OPCODE_SEQ, 4, 2 }, - { IR_SNEQUAL, "IR_SNEQUAL", OPCODE_SNE, 4, 2 }, - { IR_SGE, "IR_SGE", OPCODE_SGE, 4, 2 }, - { IR_SGT, "IR_SGT", OPCODE_SGT, 4, 2 }, - { IR_SLE, "IR_SLE", OPCODE_SLE, 4, 2 }, - { IR_SLT, "IR_SLT", OPCODE_SLT, 4, 2 }, - { IR_POW, "IR_POW", OPCODE_POW, 1, 2 }, - { IR_EQUAL, "IR_EQUAL", OPCODE_NOP, 1, 2 }, - { IR_NOTEQUAL, "IR_NOTEQUAL", OPCODE_NOP, 1, 2 }, - - /* unary ops */ - { IR_MOVE, "IR_MOVE", OPCODE_MOV, 4, 1 }, - { IR_I_TO_F, "IR_I_TO_F", OPCODE_MOV, 4, 1 }, /* int[4] to float[4] */ - { IR_F_TO_I, "IR_F_TO_I", OPCODE_TRUNC, 4, 1 }, - { IR_EXP, "IR_EXP", OPCODE_EXP, 1, 1 }, - { IR_EXP2, "IR_EXP2", OPCODE_EX2, 1, 1 }, - { IR_LOG2, "IR_LOG2", OPCODE_LG2, 1, 1 }, - { IR_RSQ, "IR_RSQ", OPCODE_RSQ, 1, 1 }, - { IR_RCP, "IR_RCP", OPCODE_RCP, 1, 1 }, - { IR_FLOOR, "IR_FLOOR", OPCODE_FLR, 4, 1 }, - { IR_FRAC, "IR_FRAC", OPCODE_FRC, 4, 1 }, - { IR_ABS, "IR_ABS", OPCODE_ABS, 4, 1 }, - { IR_NEG, "IR_NEG", OPCODE_NOP, 4, 1 }, /* special case: emit_negation() */ - { IR_DDX, "IR_DDX", OPCODE_DDX, 4, 1 }, - { IR_DDY, "IR_DDY", OPCODE_DDY, 4, 1 }, - { IR_SIN, "IR_SIN", OPCODE_SIN, 1, 1 }, - { IR_COS, "IR_COS", OPCODE_COS, 1, 1 }, - { IR_NOISE1, "IR_NOISE1", OPCODE_NOISE1, 1, 1 }, - { IR_NOISE2, "IR_NOISE2", OPCODE_NOISE2, 1, 1 }, - { IR_NOISE3, "IR_NOISE3", OPCODE_NOISE3, 1, 1 }, - { IR_NOISE4, "IR_NOISE4", OPCODE_NOISE4, 1, 1 }, - - /* other */ - { IR_CMP, "IR_CMP", OPCODE_CMP, 4, 3 }, /* compare/select */ - { IR_SEQ, "IR_SEQ", OPCODE_NOP, 0, 0 }, - { IR_SCOPE, "IR_SCOPE", OPCODE_NOP, 0, 0 }, - { IR_LABEL, "IR_LABEL", OPCODE_NOP, 0, 0 }, - { IR_IF, "IR_IF", OPCODE_NOP, 0, 0 }, - { IR_KILL, "IR_KILL", OPCODE_NOP, 0, 0 }, - { IR_COND, "IR_COND", OPCODE_NOP, 0, 0 }, - { IR_CALL, "IR_CALL", OPCODE_NOP, 0, 0 }, - { IR_COPY, "IR_COPY", OPCODE_NOP, 0, 1 }, - { IR_NOT, "IR_NOT", OPCODE_NOP, 1, 1 }, - { IR_VAR, "IR_VAR", OPCODE_NOP, 0, 0 }, - { IR_VAR_DECL, "IR_VAR_DECL", OPCODE_NOP, 0, 0 }, - { IR_TEX, "IR_TEX", OPCODE_TEX, 4, 1 }, - { IR_TEXB, "IR_TEXB", OPCODE_TXB, 4, 1 }, - { IR_TEXP, "IR_TEXP", OPCODE_TXP, 4, 1 }, - { IR_TEX_SH, "IR_TEX_SH", OPCODE_TEX, 4, 1 }, - { IR_TEXB_SH, "IR_TEXB_SH", OPCODE_TXB, 4, 1 }, - { IR_TEXP_SH, "IR_TEXP_SH", OPCODE_TXP, 4, 1 }, - { IR_FLOAT, "IR_FLOAT", OPCODE_NOP, 0, 0 }, /* float literal */ - { IR_FIELD, "IR_FIELD", OPCODE_NOP, 0, 0 }, - { IR_ELEMENT, "IR_ELEMENT", OPCODE_NOP, 0, 0 }, - { IR_SWIZZLE, "IR_SWIZZLE", OPCODE_NOP, 0, 0 }, - { IR_NOP, "IR_NOP", OPCODE_NOP, 0, 0 }, - { 0, NULL, 0, 0, 0 } -}; - - -const slang_ir_info * -_slang_ir_info(slang_ir_opcode opcode) -{ - GLuint i; - for (i = 0; IrInfo[i].IrName; i++) { - if (IrInfo[i].IrOpcode == opcode) { - return IrInfo + i; - } - } - return NULL; -} - - -void -_slang_init_ir_storage(slang_ir_storage *st, - gl_register_file file, GLint index, GLint size, - GLuint swizzle) -{ - st->File = file; - st->Index = index; - st->Size = size; - st->Swizzle = swizzle; - st->Parent = NULL; - st->IsIndirect = GL_FALSE; -} - - -/** - * Return a new slang_ir_storage object. - */ -slang_ir_storage * -_slang_new_ir_storage(gl_register_file file, GLint index, GLint size) -{ - slang_ir_storage *st; - st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); - if (st) { - st->File = file; - st->Index = index; - st->Size = size; - st->Swizzle = SWIZZLE_NOOP; - st->Parent = NULL; - st->IsIndirect = GL_FALSE; - } - return st; -} - - -/** - * Return a new slang_ir_storage object. - */ -slang_ir_storage * -_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, - GLuint swizzle) -{ - slang_ir_storage *st; - st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); - if (st) { - st->File = file; - st->Index = index; - st->Size = size; - st->Swizzle = swizzle; - st->Parent = NULL; - st->IsIndirect = GL_FALSE; - } - return st; -} - - -/** - * Return a new slang_ir_storage object. - */ -slang_ir_storage * -_slang_new_ir_storage_relative(GLint index, GLint size, - slang_ir_storage *parent) -{ - slang_ir_storage *st; - st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); - if (st) { - st->File = PROGRAM_UNDEFINED; - st->Index = index; - st->Size = size; - st->Swizzle = SWIZZLE_NOOP; - st->Parent = parent; - st->IsIndirect = GL_FALSE; - } - return st; -} - - -slang_ir_storage * -_slang_new_ir_storage_indirect(gl_register_file file, - GLint index, - GLint size, - gl_register_file indirectFile, - GLint indirectIndex, - GLuint indirectSwizzle) -{ - slang_ir_storage *st; - st = (slang_ir_storage *) _slang_alloc(sizeof(slang_ir_storage)); - if (st) { - st->File = file; - st->Index = index; - st->Size = size; - st->Swizzle = SWIZZLE_NOOP; - st->IsIndirect = GL_TRUE; - st->IndirectFile = indirectFile; - st->IndirectIndex = indirectIndex; - st->IndirectSwizzle = indirectSwizzle; - } - return st; -} - - -/** - * Allocate IR storage for a texture sampler. - * \param sampNum the sampler number/index - * \param texTarget one of TEXTURE_x_INDEX values - * \param size number of samplers (in case of sampler array) - */ -slang_ir_storage * -_slang_new_ir_storage_sampler(GLint sampNum, GLuint texTarget, GLint size) -{ - slang_ir_storage *st; - assert(texTarget < NUM_TEXTURE_TARGETS); - st = _slang_new_ir_storage(PROGRAM_SAMPLER, sampNum, size); - if (st) { - st->TexTarget = texTarget; - } - return st; -} - - - -/* XXX temporary function */ -void -_slang_copy_ir_storage(slang_ir_storage *dst, const slang_ir_storage *src) -{ - *dst = *src; - dst->Parent = NULL; -} - - - -static const char * -_slang_ir_name(slang_ir_opcode opcode) -{ - return _slang_ir_info(opcode)->IrName; -} - - - -#if 0 /* no longer needed with mempool */ -/** - * Since many IR nodes might point to the same IR storage info, we need - * to be careful when deleting things. - * Before deleting an IR tree, traverse it and do refcounting on the - * IR storage nodes. Use the refcount info during delete to free things - * properly. - */ -static void -_slang_refcount_storage(slang_ir_node *n) -{ - GLuint i; - if (!n) - return; - if (n->Store) - n->Store->RefCount++; - for (i = 0; i < 3; i++) - _slang_refcount_storage(n->Children[i]); -} -#endif - - -static void -_slang_free_ir(slang_ir_node *n) -{ - GLuint i; - if (!n) - return; - -#if 0 - if (n->Store) { - n->Store->RefCount--; - if (n->Store->RefCount == 0) { - _slang_free(n->Store); - n->Store = NULL; - } - } -#endif - - for (i = 0; i < 3; i++) - _slang_free_ir(n->Children[i]); - /* Do not free n->List since it's a child elsewhere */ - _slang_free(n); -} - - -/** - * Recursively free an IR tree. - */ -void -_slang_free_ir_tree(slang_ir_node *n) -{ -#if 0 - _slang_refcount_storage(n); -#endif - _slang_free_ir(n); -} - - -static const char * -storage_string(const slang_ir_storage *st) -{ - static const char *files[] = { - "TEMP", - "LOCAL_PARAM", - "ENV_PARAM", - "STATE", - "INPUT", - "OUTPUT", - "NAMED_PARAM", - "CONSTANT", - "UNIFORM", - "VARYING", - "WRITE_ONLY", - "ADDRESS", - "SAMPLER", - "UNDEFINED" - }; - static char s[100]; - assert(Elements(files) == PROGRAM_FILE_MAX); -#if 0 - if (st->Size == 1) - sprintf(s, "%s[%d]", files[st->File], st->Index); - else - sprintf(s, "%s[%d..%d]", files[st->File], st->Index, - st->Index + st->Size - 1); -#endif - assert(st->File < (GLint) (sizeof(files) / sizeof(files[0]))); - sprintf(s, "%s[%d]", files[st->File], st->Index); - return s; -} - - -static void -spaces(int n) -{ - while (n-- > 0) { - printf(" "); - } -} - - -void -_slang_print_ir_tree(const slang_ir_node *n, int indent) -{ -#define IND 0 - - if (!n) - return; -#if !IND - if (n->Opcode != IR_SEQ) -#else - printf("%3d:", indent); -#endif - spaces(indent); - - switch (n->Opcode) { - case IR_SEQ: -#if IND - printf("SEQ at %p\n", (void*) n); -#endif - assert(n->Children[0]); - assert(n->Children[1]); - _slang_print_ir_tree(n->Children[0], indent + IND); - _slang_print_ir_tree(n->Children[1], indent + IND); - break; - case IR_SCOPE: - printf("NEW SCOPE\n"); - assert(!n->Children[1]); - _slang_print_ir_tree(n->Children[0], indent + 3); - break; - case IR_COPY: - printf("COPY\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - _slang_print_ir_tree(n->Children[1], indent+3); - break; - case IR_LABEL: - printf("LABEL: %s\n", n->Label->Name); - break; - case IR_COND: - printf("COND\n"); - _slang_print_ir_tree(n->Children[0], indent + 3); - break; - - case IR_IF: - printf("IF \n"); - _slang_print_ir_tree(n->Children[0], indent+3); - spaces(indent); - printf("THEN\n"); - _slang_print_ir_tree(n->Children[1], indent+3); - if (n->Children[2]) { - spaces(indent); - printf("ELSE\n"); - _slang_print_ir_tree(n->Children[2], indent+3); - } - spaces(indent); - printf("ENDIF\n"); - break; - - case IR_BEGIN_SUB: - printf("BEGIN_SUB\n"); - break; - case IR_END_SUB: - printf("END_SUB\n"); - break; - case IR_RETURN: - printf("RETURN\n"); - break; - case IR_CALL: - printf("CALL %s\n", n->Label->Name); - break; - - case IR_LOOP: - printf("LOOP\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - if (n->Children[1]) { - spaces(indent); - printf("TAIL:\n"); - _slang_print_ir_tree(n->Children[1], indent+3); - } - spaces(indent); - printf("ENDLOOP\n"); - break; - case IR_CONT: - printf("CONT\n"); - break; - case IR_BREAK: - printf("BREAK\n"); - break; - case IR_BREAK_IF_TRUE: - printf("BREAK_IF_TRUE\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - case IR_CONT_IF_TRUE: - printf("CONT_IF_TRUE\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - - case IR_VAR: - printf("VAR %s%s at %s store %p\n", - (n->Var ? (char *) n->Var->a_name : "TEMP"), - _mesa_swizzle_string(n->Store->Swizzle, 0, 0), - storage_string(n->Store), (void*) n->Store); - break; - case IR_VAR_DECL: - printf("VAR_DECL %s (%p) at %s store %p\n", - (n->Var ? (char *) n->Var->a_name : "TEMP"), - (void*) n->Var, storage_string(n->Store), - (void*) n->Store); - break; - case IR_FIELD: - printf("FIELD %s of\n", n->Field); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - case IR_FLOAT: - printf("FLOAT %g %g %g %g\n", - n->Value[0], n->Value[1], n->Value[2], n->Value[3]); - break; - case IR_I_TO_F: - printf("INT_TO_FLOAT\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - case IR_F_TO_I: - printf("FLOAT_TO_INT\n"); - _slang_print_ir_tree(n->Children[0], indent+3); - break; - case IR_SWIZZLE: - printf("SWIZZLE %s of (store %p) \n", - _mesa_swizzle_string(n->Store->Swizzle, 0, 0), (void*) n->Store); - _slang_print_ir_tree(n->Children[0], indent + 3); - break; - default: - printf("%s (%p, %p) (store %p)\n", _slang_ir_name(n->Opcode), - (void*) n->Children[0], (void*) n->Children[1], (void*) n->Store); - _slang_print_ir_tree(n->Children[0], indent+3); - _slang_print_ir_tree(n->Children[1], indent+3); - } -} diff --git a/mesalib/src/mesa/shader/slang/slang_ir.h b/mesalib/src/mesa/shader/slang/slang_ir.h deleted file mode 100644 index 166b4e804..000000000 --- a/mesalib/src/mesa/shader/slang/slang_ir.h +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2005-2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_ir.h - * Mesa GLSL Intermediate Representation tree types and constants. - * \author Brian Paul - */ - - -#ifndef SLANG_IR_H -#define SLANG_IR_H - - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_label.h" -#include "main/mtypes.h" - - -/** - * Intermediate Representation opcodes - */ -typedef enum -{ - IR_NOP = 0, - IR_SEQ, /* sequence (eval left, then right) */ - IR_SCOPE, /* new variable scope (one child) */ - - IR_LABEL, /* target of a jump or cjump */ - - IR_COND, /* conditional expression/predicate */ - - IR_IF, /* high-level IF/then/else */ - /* Children[0] = conditional expression */ - /* Children[1] = if-true part */ - /* Children[2] = if-else part, or NULL */ - - IR_BEGIN_SUB, /* begin subroutine */ - IR_END_SUB, /* end subroutine */ - IR_RETURN, /* return from subroutine */ - IR_CALL, /* call subroutine */ - - IR_LOOP, /* high-level loop-begin / loop-end */ - /* Children[0] = loop body */ - /* Children[1] = loop tail code, or NULL */ - - IR_CONT, /* continue loop */ - /* n->Parent = ptr to parent IR_LOOP Node */ - IR_BREAK, /* break loop */ - - IR_BREAK_IF_TRUE, /**< Children[0] = the condition expression */ - IR_CONT_IF_TRUE, - - IR_COPY, /**< assignment/copy */ - IR_MOVE, /**< assembly MOV instruction */ - - /* vector ops: */ - IR_ADD, /**< assembly ADD instruction */ - IR_SUB, - IR_MUL, - IR_DIV, - IR_DOT4, - IR_DOT3, - IR_DOT2, - IR_NRM4, - IR_NRM3, - IR_CROSS, /* vec3 cross product */ - IR_LRP, - IR_CLAMP, - IR_MIN, - IR_MAX, - IR_CMP, /* = (op0 < 0) ? op1 : op2 */ - IR_SEQUAL, /* Set if args are equal (vector) */ - IR_SNEQUAL, /* Set if args are not equal (vector) */ - IR_SGE, /* Set if greater or equal (vector) */ - IR_SGT, /* Set if greater than (vector) */ - IR_SLE, /* Set if less or equal (vector) */ - IR_SLT, /* Set if less than (vector) */ - IR_POW, /* x^y */ - IR_EXP, /* e^x */ - IR_EXP2, /* 2^x */ - IR_LOG2, /* log base 2 */ - IR_RSQ, /* 1/sqrt() */ - IR_RCP, /* reciprocol */ - IR_FLOOR, - IR_FRAC, - IR_ABS, /* absolute value */ - IR_NEG, /* negate */ - IR_DDX, /* derivative w.r.t. X */ - IR_DDY, /* derivative w.r.t. Y */ - IR_SIN, /* sine */ - IR_COS, /* cosine */ - IR_NOISE1, /* noise(x) */ - IR_NOISE2, /* noise(x, y) */ - IR_NOISE3, /* noise(x, y, z) */ - IR_NOISE4, /* noise(x, y, z, w) */ - - IR_EQUAL, /* boolean equality */ - IR_NOTEQUAL,/* boolean inequality */ - IR_NOT, /* boolean not */ - - IR_VAR, /* variable reference */ - IR_VAR_DECL,/* var declaration */ - - IR_ELEMENT, /* array element */ - IR_FIELD, /* struct field */ - IR_SWIZZLE, /* swizzled storage access */ - - IR_TEX, /* texture lookup */ - IR_TEXB, /* texture lookup with LOD bias */ - IR_TEXP, /* texture lookup with projection */ - - IR_TEX_SH, /* texture lookup, shadow compare */ - IR_TEXB_SH, /* texture lookup with LOD bias, shadow compare */ - IR_TEXP_SH, /* texture lookup with projection, shadow compare */ - - IR_FLOAT, - IR_I_TO_F, /* int[4] to float[4] conversion */ - IR_F_TO_I, /* float[4] to int[4] conversion */ - - IR_KILL /* fragment kill/discard */ -} slang_ir_opcode; - - -/** - * Describes where data/variables are stored in the various register files. - * - * In the simple case, the File, Index and Size fields indicate where - * a variable is stored. For example, a vec3 variable may be stored - * as (File=PROGRAM_TEMPORARY, Index=6, Size=3). Or, File[Index]. - * Or, a program input like color may be stored as - * (File=PROGRAM_INPUT,Index=3,Size=4); - * - * For single-float values, the Swizzle field indicates which component - * of the vector contains the float. - * - * If IsIndirect is set, the storage is accessed through an indirect - * register lookup. The value in question will be located at: - * File[Index + IndirectFile[IndirectIndex]] - * - * This is primary used for indexing arrays. For example, consider this - * GLSL code: - * uniform int i; - * float a[10]; - * float x = a[i]; - * - * here, storage for a[i] would be described by (File=PROGRAM_TEMPORAY, - * Index=aPos, IndirectFile=PROGRAM_UNIFORM, IndirectIndex=iPos), which - * would mean TEMP[aPos + UNIFORM[iPos]] - */ -struct slang_ir_storage_ -{ - gl_register_file File; /**< PROGRAM_TEMPORARY, PROGRAM_INPUT, etc */ - GLint Index; /**< -1 means unallocated */ - GLint Size; /**< number of floats or ints */ - GLuint Swizzle; /**< Swizzle AND writemask info */ - GLint RefCount; /**< Used during IR tree delete */ - - GLboolean RelAddr; /* we'll remove this eventually */ - - GLboolean IsIndirect; - gl_register_file IndirectFile; - GLint IndirectIndex; - GLuint IndirectSwizzle; - GLuint TexTarget; /**< If File==PROGRAM_SAMPLER, one of TEXTURE_x_INDEX */ - - /** If Parent is non-null, Index is relative to parent. - * The other fields are ignored. - */ - struct slang_ir_storage_ *Parent; -}; - -typedef struct slang_ir_storage_ slang_ir_storage; - - -/** - * Intermediate Representation (IR) tree node - * Basically a binary tree, but IR_LRP and IR_CLAMP have three children. - */ -typedef struct slang_ir_node_ -{ - slang_ir_opcode Opcode; - struct slang_ir_node_ *Children[3]; - slang_ir_storage *Store; /**< location of result of this operation */ - GLint InstLocation; /**< Location of instruction emitted for this node */ - - /** special fields depending on Opcode: */ - const char *Field; /**< If Opcode == IR_FIELD */ - GLfloat Value[4]; /**< If Opcode == IR_FLOAT */ - slang_variable *Var; /**< If Opcode == IR_VAR or IR_VAR_DECL */ - struct slang_ir_node_ *List; /**< For various linked lists */ - struct slang_ir_node_ *Parent; /**< Pointer to logical parent (ie. loop) */ - slang_label *Label; /**< Used for branches */ - const char *Comment; /**< If Opcode == IR_COMMENT */ -} slang_ir_node; - - - -/** - * Assembly and IR info - */ -typedef struct -{ - slang_ir_opcode IrOpcode; - const char *IrName; - gl_inst_opcode InstOpcode; - GLuint ResultSize, NumParams; -} slang_ir_info; - - - -extern const slang_ir_info * -_slang_ir_info(slang_ir_opcode opcode); - - -extern void -_slang_init_ir_storage(slang_ir_storage *st, - gl_register_file file, GLint index, GLint size, - GLuint swizzle); - -extern slang_ir_storage * -_slang_new_ir_storage(gl_register_file file, GLint index, GLint size); - - -extern slang_ir_storage * -_slang_new_ir_storage_swz(gl_register_file file, GLint index, GLint size, - GLuint swizzle); - -extern slang_ir_storage * -_slang_new_ir_storage_relative(GLint index, GLint size, - slang_ir_storage *parent); - - -extern slang_ir_storage * -_slang_new_ir_storage_indirect(gl_register_file file, - GLint index, - GLint size, - gl_register_file indirectFile, - GLint indirectIndex, - GLuint indirectSwizzle); - -extern slang_ir_storage * -_slang_new_ir_storage_sampler(GLint sampNum, GLuint texTarget, GLint size); - - -extern void -_slang_copy_ir_storage(slang_ir_storage *dst, const slang_ir_storage *src); - - -extern void -_slang_free_ir_tree(slang_ir_node *n); - - -extern void -_slang_print_ir_tree(const slang_ir_node *n, int indent); - - -#endif /* SLANG_IR_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_label.c b/mesalib/src/mesa/shader/slang/slang_label.c deleted file mode 100644 index 225612a93..000000000 --- a/mesalib/src/mesa/shader/slang/slang_label.c +++ /dev/null @@ -1,104 +0,0 @@ - - -/** - * Functions for managing instruction labels. - * Basically, this is used to manage the problem of forward branches where - * we have a branch instruciton but don't know the target address yet. - */ - - -#include "slang_label.h" -#include "slang_mem.h" - - - -slang_label * -_slang_label_new(const char *name) -{ - slang_label *l = (slang_label *) _slang_alloc(sizeof(slang_label)); - if (l) { - l->Name = _slang_strdup(name); - l->Location = -1; - } - return l; -} - -/** - * As above, but suffix the name with a unique number. - */ -slang_label * -_slang_label_new_unique(const char *name) -{ - static int id = 1; - slang_label *l = (slang_label *) _slang_alloc(sizeof(slang_label)); - if (l) { - l->Name = (char *) _slang_alloc(strlen(name) + 10); - if (!l->Name) { - free(l); - return NULL; - } - sprintf(l->Name, "%s_%d", name, id); - id++; - l->Location = -1; - } - return l; -} - -void -_slang_label_delete(slang_label *l) -{ - if (l->Name) { - _slang_free(l->Name); - l->Name = NULL; - } - if (l->References) { - _slang_free(l->References); - l->References = NULL; - } - _slang_free(l); -} - - -void -_slang_label_add_reference(slang_label *l, GLuint inst) -{ - const GLuint oldSize = l->NumReferences * sizeof(GLuint); - assert(l->Location < 0); - l->References = _slang_realloc(l->References, - oldSize, oldSize + sizeof(GLuint)); - if (l->References) { - l->References[l->NumReferences] = inst; - l->NumReferences++; - } -} - - -GLint -_slang_label_get_location(const slang_label *l) -{ - return l->Location; -} - - -void -_slang_label_set_location(slang_label *l, GLint location, - struct gl_program *prog) -{ - GLuint i; - - assert(l->Location < 0); - assert(location >= 0); - - l->Location = location; - - /* for the instructions that were waiting to learn the label's location: */ - for (i = 0; i < l->NumReferences; i++) { - const GLuint j = l->References[i]; - prog->Instructions[j].BranchTarget = location; - } - - if (l->References) { - _slang_free(l->References); - l->References = NULL; - } -} diff --git a/mesalib/src/mesa/shader/slang/slang_label.h b/mesalib/src/mesa/shader/slang/slang_label.h deleted file mode 100644 index 87068ae7a..000000000 --- a/mesalib/src/mesa/shader/slang/slang_label.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef SLANG_LABEL_H -#define SLANG_LABEL_H 1 - -#include "main/imports.h" -#include "main/mtypes.h" -#include "shader/prog_instruction.h" - - -struct slang_label_ -{ - char *Name; - GLint Location; - /** - * List of instruction references (numbered starting at zero) which need - * their BranchTarget field filled in with the location eventually - * assigned to the label. - */ - GLuint NumReferences; - GLuint *References; /** Array [NumReferences] */ -}; - -typedef struct slang_label_ slang_label; - - -extern slang_label * -_slang_label_new(const char *name); - -extern slang_label * -_slang_label_new_unique(const char *name); - -extern void -_slang_label_delete(slang_label *l); - -extern void -_slang_label_add_reference(slang_label *l, GLuint inst); - -extern GLint -_slang_label_get_location(const slang_label *l); - -extern void -_slang_label_set_location(slang_label *l, GLint location, - struct gl_program *prog); - - -#endif /* SLANG_LABEL_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_link.c b/mesalib/src/mesa/shader/slang/slang_link.c deleted file mode 100644 index e8dca0142..000000000 --- a/mesalib/src/mesa/shader/slang/slang_link.c +++ /dev/null @@ -1,933 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 2008 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_link.c - * GLSL linker - * \author Brian Paul - */ - -#include "main/imports.h" -#include "main/context.h" -#include "main/macros.h" -#include "shader/program.h" -#include "shader/prog_instruction.h" -#include "shader/prog_parameter.h" -#include "shader/prog_print.h" -#include "shader/prog_statevars.h" -#include "shader/prog_uniform.h" -#include "shader/shader_api.h" -#include "slang_builtin.h" -#include "slang_link.h" - - -/** cast wrapper */ -static struct gl_vertex_program * -vertex_program(struct gl_program *prog) -{ - assert(prog->Target == GL_VERTEX_PROGRAM_ARB); - return (struct gl_vertex_program *) prog; -} - - -/** cast wrapper */ -static struct gl_fragment_program * -fragment_program(struct gl_program *prog) -{ - assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); - return (struct gl_fragment_program *) prog; -} - - -/** - * Record a linking error. - */ -static void -link_error(struct gl_shader_program *shProg, const char *msg) -{ - if (shProg->InfoLog) { - free(shProg->InfoLog); - } - shProg->InfoLog = _mesa_strdup(msg); - shProg->LinkStatus = GL_FALSE; -} - - - -/** - * Check if the given bit is either set or clear in both bitfields. - */ -static GLboolean -bits_agree(GLbitfield flags1, GLbitfield flags2, GLbitfield bit) -{ - return (flags1 & bit) == (flags2 & bit); -} - - -/** - * Linking varying vars involves rearranging varying vars so that the - * vertex program's output varyings matches the order of the fragment - * program's input varyings. - * We'll then rewrite instructions to replace PROGRAM_VARYING with either - * PROGRAM_INPUT or PROGRAM_OUTPUT depending on whether it's a vertex or - * fragment shader. - * This is also where we set program Input/OutputFlags to indicate - * which inputs are centroid-sampled, invariant, etc. - */ -static GLboolean -link_varying_vars(GLcontext *ctx, - struct gl_shader_program *shProg, struct gl_program *prog) -{ - GLuint *map, i, firstVarying, newFile; - GLbitfield *inOutFlags; - - map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint)); - if (!map) - return GL_FALSE; - - /* Varying variables are treated like other vertex program outputs - * (and like other fragment program inputs). The position of the - * first varying differs for vertex/fragment programs... - * Also, replace File=PROGRAM_VARYING with File=PROGRAM_INPUT/OUTPUT. - */ - if (prog->Target == GL_VERTEX_PROGRAM_ARB) { - firstVarying = VERT_RESULT_VAR0; - newFile = PROGRAM_OUTPUT; - inOutFlags = prog->OutputFlags; - } - else { - assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB); - firstVarying = FRAG_ATTRIB_VAR0; - newFile = PROGRAM_INPUT; - inOutFlags = prog->InputFlags; - } - - for (i = 0; i < prog->Varying->NumParameters; i++) { - /* see if this varying is in the linked varying list */ - const struct gl_program_parameter *var = prog->Varying->Parameters + i; - GLint j = _mesa_lookup_parameter_index(shProg->Varying, -1, var->Name); - if (j >= 0) { - /* varying is already in list, do some error checking */ - const struct gl_program_parameter *v = - &shProg->Varying->Parameters[j]; - if (var->Size != v->Size) { - link_error(shProg, "mismatched varying variable types"); - free(map); - return GL_FALSE; - } - if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) { - char msg[100]; - _mesa_snprintf(msg, sizeof(msg), - "centroid modifier mismatch for '%s'", var->Name); - link_error(shProg, msg); - free(map); - return GL_FALSE; - } - if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) { - char msg[100]; - _mesa_snprintf(msg, sizeof(msg), - "invariant modifier mismatch for '%s'", var->Name); - link_error(shProg, msg); - free(map); - return GL_FALSE; - } - } - else { - /* not already in linked list */ - j = _mesa_add_varying(shProg->Varying, var->Name, var->Size, - var->Flags); - } - - if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) { - link_error(shProg, "Too many varying variables"); - free(map); - return GL_FALSE; - } - - /* Map varying[i] to varying[j]. - * Note: the loop here takes care of arrays or large (sz>4) vars. - */ - { - GLint sz = var->Size; - while (sz > 0) { - inOutFlags[firstVarying + j] = var->Flags; - /*printf("Link varying from %d to %d\n", i, j);*/ - map[i++] = j++; - sz -= 4; - } - i--; /* go back one */ - } - } - - - /* OK, now scan the program/shader instructions looking for varying vars, - * replacing the old index with the new index. - */ - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - GLuint j; - - if (inst->DstReg.File == PROGRAM_VARYING) { - inst->DstReg.File = newFile; - inst->DstReg.Index = map[ inst->DstReg.Index ] + firstVarying; - } - - for (j = 0; j < 3; j++) { - if (inst->SrcReg[j].File == PROGRAM_VARYING) { - inst->SrcReg[j].File = newFile; - inst->SrcReg[j].Index = map[ inst->SrcReg[j].Index ] + firstVarying; - } - } - } - - free(map); - - /* these will get recomputed before linking is completed */ - prog->InputsRead = 0x0; - prog->OutputsWritten = 0x0; - - return GL_TRUE; -} - - -/** - * Build the shProg->Uniforms list. - * This is basically a list/index of all uniforms found in either/both of - * the vertex and fragment shaders. - * - * About uniforms: - * Each uniform has two indexes, one that points into the vertex - * program's parameter array and another that points into the fragment - * program's parameter array. When the user changes a uniform's value - * we have to change the value in the vertex and/or fragment program's - * parameter array. - * - * This function will be called twice to set up the two uniform->parameter - * mappings. - * - * If a uniform is only present in the vertex program OR fragment program - * then the fragment/vertex parameter index, respectively, will be -1. - */ -static GLboolean -link_uniform_vars(GLcontext *ctx, - struct gl_shader_program *shProg, - struct gl_program *prog, - GLuint *numSamplers) -{ - GLuint samplerMap[200]; /* max number of samplers declared, not used */ - GLuint i; - - for (i = 0; i < prog->Parameters->NumParameters; i++) { - const struct gl_program_parameter *p = prog->Parameters->Parameters + i; - - /* - * XXX FIX NEEDED HERE - * We should also be adding a uniform if p->Type == PROGRAM_STATE_VAR. - * For example, modelview matrix, light pos, etc. - * Also, we need to update the state-var name-generator code to - * generate GLSL-style names, like "gl_LightSource[0].position". - * Furthermore, we'll need to fix the state-var's size/datatype info. - */ - - if ((p->Type == PROGRAM_UNIFORM || p->Type == PROGRAM_SAMPLER) - && p->Used) { - /* add this uniform, indexing into the target's Parameters list */ - struct gl_uniform *uniform = - _mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i); - if (uniform) - uniform->Initialized = p->Initialized; - } - - /* The samplerMap[] table we build here is used to remap/re-index - * sampler references by TEX instructions. - */ - if (p->Type == PROGRAM_SAMPLER && p->Used) { - /* Allocate a new sampler index */ - GLuint oldSampNum = (GLuint) prog->Parameters->ParameterValues[i][0]; - GLuint newSampNum = *numSamplers; - if (newSampNum >= ctx->Const.MaxTextureImageUnits) { - char s[100]; - sprintf(s, "Too many texture samplers (%u, max is %u)", - newSampNum, ctx->Const.MaxTextureImageUnits); - link_error(shProg, s); - return GL_FALSE; - } - /* save old->new mapping in the table */ - if (oldSampNum < Elements(samplerMap)) - samplerMap[oldSampNum] = newSampNum; - /* update parameter's sampler index */ - prog->Parameters->ParameterValues[i][0] = (GLfloat) newSampNum; - (*numSamplers)++; - } - } - - /* OK, now scan the program/shader instructions looking for texture - * instructions using sampler vars. Replace old sampler indexes with - * new ones. - */ - prog->SamplersUsed = 0x0; - for (i = 0; i < prog->NumInstructions; i++) { - struct prog_instruction *inst = prog->Instructions + i; - if (_mesa_is_tex_instruction(inst->Opcode)) { - /* here, inst->TexSrcUnit is really the sampler unit */ - const GLint oldSampNum = inst->TexSrcUnit; - -#if 0 - printf("====== remap sampler from %d to %d\n", - inst->TexSrcUnit, samplerMap[ inst->TexSrcUnit ]); -#endif - - if (oldSampNum < Elements(samplerMap)) { - const GLuint newSampNum = samplerMap[oldSampNum]; - inst->TexSrcUnit = newSampNum; - prog->SamplerTargets[newSampNum] = inst->TexSrcTarget; - prog->SamplersUsed |= (1 << newSampNum); - if (inst->TexShadow) { - prog->ShadowSamplers |= (1 << newSampNum); - } - } - } - } - - return GL_TRUE; -} - - -/** - * Resolve binding of generic vertex attributes. - * For example, if the vertex shader declared "attribute vec4 foobar" we'll - * allocate a generic vertex attribute for "foobar" and plug that value into - * the vertex program instructions. - * But if the user called glBindAttributeLocation(), those bindings will - * have priority. - */ -static GLboolean -_slang_resolve_attributes(struct gl_shader_program *shProg, - const struct gl_program *origProg, - struct gl_program *linkedProg) -{ - GLint attribMap[MAX_VERTEX_GENERIC_ATTRIBS]; - GLuint i, j; - GLbitfield usedAttributes; /* generics only, not legacy attributes */ - GLbitfield inputsRead = 0x0; - - assert(origProg != linkedProg); - assert(origProg->Target == GL_VERTEX_PROGRAM_ARB); - assert(linkedProg->Target == GL_VERTEX_PROGRAM_ARB); - - if (!shProg->Attributes) - shProg->Attributes = _mesa_new_parameter_list(); - - if (linkedProg->Attributes) { - _mesa_free_parameter_list(linkedProg->Attributes); - } - linkedProg->Attributes = _mesa_new_parameter_list(); - - - /* Build a bitmask indicating which attribute indexes have been - * explicitly bound by the user with glBindAttributeLocation(). - */ - usedAttributes = 0x0; - for (i = 0; i < shProg->Attributes->NumParameters; i++) { - GLint attr = shProg->Attributes->Parameters[i].StateIndexes[0]; - usedAttributes |= (1 << attr); - } - - /* If gl_Vertex is used, that actually counts against the limit - * on generic vertex attributes. This avoids the ambiguity of - * whether glVertexAttrib4fv(0, v) sets legacy attribute 0 (vert pos) - * or generic attribute[0]. If gl_Vertex is used, we want the former. - */ - if (origProg->InputsRead & VERT_BIT_POS) { - usedAttributes |= 0x1; - } - - /* initialize the generic attribute map entries to -1 */ - for (i = 0; i < MAX_VERTEX_GENERIC_ATTRIBS; i++) { - attribMap[i] = -1; - } - - /* - * Scan program for generic attribute references - */ - for (i = 0; i < linkedProg->NumInstructions; i++) { - struct prog_instruction *inst = linkedProg->Instructions + i; - for (j = 0; j < 3; j++) { - if (inst->SrcReg[j].File == PROGRAM_INPUT) { - inputsRead |= (1 << inst->SrcReg[j].Index); - } - - if (inst->SrcReg[j].File == PROGRAM_INPUT && - inst->SrcReg[j].Index >= VERT_ATTRIB_GENERIC0) { - /* - * OK, we've found a generic vertex attribute reference. - */ - const GLint k = inst->SrcReg[j].Index - VERT_ATTRIB_GENERIC0; - - GLint attr = attribMap[k]; - - if (attr < 0) { - /* Need to figure out attribute mapping now. - */ - const char *name = origProg->Attributes->Parameters[k].Name; - const GLint size = origProg->Attributes->Parameters[k].Size; - const GLenum type =origProg->Attributes->Parameters[k].DataType; - GLint index; - - /* See if there's a user-defined attribute binding for - * this name. - */ - index = _mesa_lookup_parameter_index(shProg->Attributes, - -1, name); - if (index >= 0) { - /* Found a user-defined binding */ - attr = shProg->Attributes->Parameters[index].StateIndexes[0]; - } - else { - /* No user-defined binding, choose our own attribute number. - * Start at 1 since generic attribute 0 always aliases - * glVertex/position. - */ - for (attr = 0; attr < MAX_VERTEX_GENERIC_ATTRIBS; attr++) { - if (((1 << attr) & usedAttributes) == 0) - break; - } - if (attr == MAX_VERTEX_GENERIC_ATTRIBS) { - link_error(shProg, "Too many vertex attributes"); - return GL_FALSE; - } - - /* mark this attribute as used */ - usedAttributes |= (1 << attr); - } - - attribMap[k] = attr; - - /* Save the final name->attrib binding so it can be queried - * with glGetAttributeLocation(). - */ - _mesa_add_attribute(linkedProg->Attributes, name, - size, type, attr); - } - - assert(attr >= 0); - - /* update the instruction's src reg */ - inst->SrcReg[j].Index = VERT_ATTRIB_GENERIC0 + attr; - } - } - } - - /* Handle pre-defined attributes here (gl_Vertex, gl_Normal, etc). - * When the user queries the active attributes we need to include both - * the user-defined attributes and the built-in ones. - */ - for (i = VERT_ATTRIB_POS; i < VERT_ATTRIB_GENERIC0; i++) { - if (inputsRead & (1 << i)) { - _mesa_add_attribute(linkedProg->Attributes, - _slang_vert_attrib_name(i), - 4, /* size in floats */ - _slang_vert_attrib_type(i), - -1 /* attrib/input */); - } - } - - return GL_TRUE; -} - - -/** - * Scan program instructions to update the program's NumTemporaries field. - * Note: this implemenation relies on the code generator allocating - * temps in increasing order (0, 1, 2, ... ). - */ -static void -_slang_count_temporaries(struct gl_program *prog) -{ - GLuint i, j; - GLint maxIndex = -1; - - for (i = 0; i < prog->NumInstructions; i++) { - const struct prog_instruction *inst = prog->Instructions + i; - const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); - for (j = 0; j < numSrc; j++) { - if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { - if (maxIndex < inst->SrcReg[j].Index) - maxIndex = inst->SrcReg[j].Index; - } - if (inst->DstReg.File == PROGRAM_TEMPORARY) { - if (maxIndex < (GLint) inst->DstReg.Index) - maxIndex = inst->DstReg.Index; - } - } - } - - prog->NumTemporaries = (GLuint) (maxIndex + 1); -} - - -/** - * Scan program instructions to update the program's InputsRead and - * OutputsWritten fields. - */ -static void -_slang_update_inputs_outputs(struct gl_program *prog) -{ - GLuint i, j; - GLuint maxAddrReg = 0; - - prog->InputsRead = 0x0; - prog->OutputsWritten = 0x0; - - for (i = 0; i < prog->NumInstructions; i++) { - const struct prog_instruction *inst = prog->Instructions + i; - const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); - for (j = 0; j < numSrc; j++) { - if (inst->SrcReg[j].File == PROGRAM_INPUT) { - prog->InputsRead |= 1 << inst->SrcReg[j].Index; - } - else if (inst->SrcReg[j].File == PROGRAM_ADDRESS) { - maxAddrReg = MAX2(maxAddrReg, (GLuint) (inst->SrcReg[j].Index + 1)); - } - } - - if (inst->DstReg.File == PROGRAM_OUTPUT) { - prog->OutputsWritten |= BITFIELD64_BIT(inst->DstReg.Index); - if (inst->DstReg.RelAddr) { - /* If the output attribute is indexed with relative addressing - * we know that it must be a varying or texcoord such as - * gl_TexCoord[i] = v; In this case, mark all the texcoords - * or varying outputs as being written. It's not an error if - * a vertex shader writes varying vars that aren't used by the - * fragment shader. But it is an error for a fragment shader - * to use varyings that are not written by the vertex shader. - */ - if (prog->Target == GL_VERTEX_PROGRAM_ARB) { - if (inst->DstReg.Index == VERT_RESULT_TEX0) { - /* mark all texcoord outputs as written */ - const GLbitfield64 mask = - BITFIELD64_RANGE(VERT_RESULT_TEX0, - (VERT_RESULT_TEX0 - + MAX_TEXTURE_COORD_UNITS - 1)); - prog->OutputsWritten |= mask; - } - else if (inst->DstReg.Index == VERT_RESULT_VAR0) { - /* mark all generic varying outputs as written */ - const GLbitfield64 mask = - BITFIELD64_RANGE(VERT_RESULT_VAR0, - (VERT_RESULT_VAR0 + MAX_VARYING - 1)); - prog->OutputsWritten |= mask; - } - } - } - } - else if (inst->DstReg.File == PROGRAM_ADDRESS) { - maxAddrReg = MAX2(maxAddrReg, inst->DstReg.Index + 1); - } - } - prog->NumAddressRegs = maxAddrReg; -} - - - -/** - * Remove extra #version directives from the concatenated source string. - * Disable the extra ones by converting first two chars to //, a comment. - * This is a bit of hack to work around a preprocessor bug that only - * allows one #version directive per source. - */ -static void -remove_extra_version_directives(GLchar *source) -{ - GLuint verCount = 0; - while (1) { - char *ver = strstr(source, "#version"); - if (ver) { - verCount++; - if (verCount > 1) { - ver[0] = '/'; - ver[1] = '/'; - } - source += 8; - } - else { - break; - } - } -} - - - -/** - * Return a new shader whose source code is the concatenation of - * all the shader sources of the given type. - */ -static struct gl_shader * -concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) -{ - struct gl_shader *newShader; - const struct gl_shader *firstShader = NULL; - GLuint *shaderLengths; - GLchar *source; - GLuint totalLen = 0, len = 0; - GLuint i; - - shaderLengths = (GLuint *)malloc(shProg->NumShaders * sizeof(GLuint)); - if (!shaderLengths) { - return NULL; - } - - /* compute total size of new shader source code */ - for (i = 0; i < shProg->NumShaders; i++) { - const struct gl_shader *shader = shProg->Shaders[i]; - if (shader->Type == shaderType) { - shaderLengths[i] = strlen(shader->Source); - totalLen += shaderLengths[i]; - if (!firstShader) - firstShader = shader; - } - } - - if (totalLen == 0) { - free(shaderLengths); - return NULL; - } - - source = (GLchar *) malloc(totalLen + 1); - if (!source) { - free(shaderLengths); - return NULL; - } - - /* concatenate shaders */ - for (i = 0; i < shProg->NumShaders; i++) { - const struct gl_shader *shader = shProg->Shaders[i]; - if (shader->Type == shaderType) { - memcpy(source + len, shader->Source, shaderLengths[i]); - len += shaderLengths[i]; - } - } - source[len] = '\0'; - /* - printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source); - */ - - free(shaderLengths); - - remove_extra_version_directives(source); - - newShader = CALLOC_STRUCT(gl_shader); - if (!newShader) { - free(source); - return NULL; - } - - newShader->Type = shaderType; - newShader->Source = source; - newShader->Pragmas = firstShader->Pragmas; - - return newShader; -} - - -/** - * Search the shader program's list of shaders to find the one that - * defines main(). - * This will involve shader concatenation and recompilation if needed. - */ -static struct gl_shader * -get_main_shader(GLcontext *ctx, - struct gl_shader_program *shProg, GLenum type) -{ - struct gl_shader *shader = NULL; - GLuint i; - - /* - * Look for a shader that defines main() and has no unresolved references. - */ - for (i = 0; i < shProg->NumShaders; i++) { - shader = shProg->Shaders[i]; - if (shader->Type == type && - shader->Main && - !shader->UnresolvedRefs) { - /* All set! */ - return shader; - } - } - - /* - * There must have been unresolved references during the original - * compilation. Try concatenating all the shaders of the given type - * and recompile that. - */ - shader = concat_shaders(shProg, type); - - if (shader) { - _slang_compile(ctx, shader); - - /* Finally, check if recompiling failed */ - if (!shader->CompileStatus || - !shader->Main || - shader->UnresolvedRefs) { - link_error(shProg, "Unresolved symbols"); - _mesa_free_shader(ctx, shader); - return NULL; - } - } - - return shader; -} - - -/** - * Shader linker. Currently: - * - * 1. The last attached vertex shader and fragment shader are linked. - * 2. Varying vars in the two shaders are combined so their locations - * agree between the vertex and fragment stages. They're treated as - * vertex program output attribs and as fragment program input attribs. - * 3. The vertex and fragment programs are cloned and modified to update - * src/dst register references so they use the new, linked varying - * storage locations. - */ -void -_slang_link(GLcontext *ctx, - GLhandleARB programObj, - struct gl_shader_program *shProg) -{ - const struct gl_vertex_program *vertProg = NULL; - const struct gl_fragment_program *fragProg = NULL; - GLboolean vertNotify = GL_TRUE, fragNotify = GL_TRUE; - GLuint numSamplers = 0; - GLuint i; - - _mesa_clear_shader_program_data(ctx, shProg); - - /* Initialize LinkStatus to "success". Will be cleared if error. */ - shProg->LinkStatus = GL_TRUE; - - /* check that all programs compiled successfully */ - for (i = 0; i < shProg->NumShaders; i++) { - if (!shProg->Shaders[i]->CompileStatus) { - link_error(shProg, "linking with uncompiled shader\n"); - return; - } - } - - shProg->Uniforms = _mesa_new_uniform_list(); - shProg->Varying = _mesa_new_parameter_list(); - - /* - * Find the vertex and fragment shaders which define main() - */ - { - struct gl_shader *vertShader, *fragShader; - vertShader = get_main_shader(ctx, shProg, GL_VERTEX_SHADER); - fragShader = get_main_shader(ctx, shProg, GL_FRAGMENT_SHADER); - if (vertShader) - vertProg = vertex_program(vertShader->Program); - if (fragShader) - fragProg = fragment_program(fragShader->Program); - if (!shProg->LinkStatus) - return; - } - -#if FEATURE_es2_glsl - /* must have both a vertex and fragment program for ES2 */ - if (!vertProg) { - link_error(shProg, "missing vertex shader\n"); - return; - } - if (!fragProg) { - link_error(shProg, "missing fragment shader\n"); - return; - } -#endif - - /* - * Make copies of the vertex/fragment programs now since we'll be - * changing src/dst registers after merging the uniforms and varying vars. - */ - _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL); - if (vertProg) { - struct gl_vertex_program *linked_vprog = - _mesa_clone_vertex_program(ctx, vertProg); - shProg->VertexProgram = linked_vprog; /* refcount OK */ - /* vertex program ID not significant; just set Id for debugging purposes */ - shProg->VertexProgram->Base.Id = shProg->Name; - ASSERT(shProg->VertexProgram->Base.RefCount == 1); - } - - _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL); - if (fragProg) { - struct gl_fragment_program *linked_fprog = - _mesa_clone_fragment_program(ctx, fragProg); - shProg->FragmentProgram = linked_fprog; /* refcount OK */ - /* vertex program ID not significant; just set Id for debugging purposes */ - shProg->FragmentProgram->Base.Id = shProg->Name; - ASSERT(shProg->FragmentProgram->Base.RefCount == 1); - } - - /* link varying vars */ - if (shProg->VertexProgram) { - if (!link_varying_vars(ctx, shProg, &shProg->VertexProgram->Base)) - return; - } - if (shProg->FragmentProgram) { - if (!link_varying_vars(ctx, shProg, &shProg->FragmentProgram->Base)) - return; - } - - /* link uniform vars */ - if (shProg->VertexProgram) { - if (!link_uniform_vars(ctx, shProg, &shProg->VertexProgram->Base, - &numSamplers)) { - return; - } - } - if (shProg->FragmentProgram) { - if (!link_uniform_vars(ctx, shProg, &shProg->FragmentProgram->Base, - &numSamplers)) { - return; - } - } - - /*_mesa_print_uniforms(shProg->Uniforms);*/ - - if (shProg->VertexProgram) { - if (!_slang_resolve_attributes(shProg, &vertProg->Base, - &shProg->VertexProgram->Base)) { - return; - } - } - - if (shProg->VertexProgram) { - _slang_update_inputs_outputs(&shProg->VertexProgram->Base); - _slang_count_temporaries(&shProg->VertexProgram->Base); - if (!(shProg->VertexProgram->Base.OutputsWritten - & BITFIELD64_BIT(VERT_RESULT_HPOS))) { - /* the vertex program did not compute a vertex position */ - link_error(shProg, - "gl_Position was not written by vertex shader\n"); - return; - } - } - if (shProg->FragmentProgram) { - _slang_count_temporaries(&shProg->FragmentProgram->Base); - _slang_update_inputs_outputs(&shProg->FragmentProgram->Base); - } - - /* Check that all the varying vars needed by the fragment shader are - * actually produced by the vertex shader. - */ - if (shProg->FragmentProgram) { - const GLbitfield varyingRead - = shProg->FragmentProgram->Base.InputsRead >> FRAG_ATTRIB_VAR0; - const GLbitfield64 varyingWritten = shProg->VertexProgram ? - shProg->VertexProgram->Base.OutputsWritten >> VERT_RESULT_VAR0 : 0x0; - if ((varyingRead & varyingWritten) != varyingRead) { - link_error(shProg, - "Fragment program using varying vars not written by vertex shader\n"); - return; - } - } - - /* check that gl_FragColor and gl_FragData are not both written to */ - if (shProg->FragmentProgram) { - const GLbitfield64 outputsWritten = - shProg->FragmentProgram->Base.OutputsWritten; - if ((outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) && - (outputsWritten >= BITFIELD64_BIT(FRAG_RESULT_DATA0))) { - link_error(shProg, "Fragment program cannot write both gl_FragColor" - " and gl_FragData[].\n"); - return; - } - } - - - if (fragProg && shProg->FragmentProgram) { - /* Compute initial program's TexturesUsed info */ - _mesa_update_shader_textures_used(&shProg->FragmentProgram->Base); - - /* notify driver that a new fragment program has been compiled/linked */ - vertNotify = ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB, - &shProg->FragmentProgram->Base); - if (ctx->Shader.Flags & GLSL_DUMP) { - printf("Mesa pre-link fragment program:\n"); - _mesa_print_program(&fragProg->Base); - _mesa_print_program_parameters(ctx, &fragProg->Base); - - printf("Mesa post-link fragment program:\n"); - _mesa_print_program(&shProg->FragmentProgram->Base); - _mesa_print_program_parameters(ctx, &shProg->FragmentProgram->Base); - } - } - - if (vertProg && shProg->VertexProgram) { - /* Compute initial program's TexturesUsed info */ - _mesa_update_shader_textures_used(&shProg->VertexProgram->Base); - - /* notify driver that a new vertex program has been compiled/linked */ - fragNotify = ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, - &shProg->VertexProgram->Base); - if (ctx->Shader.Flags & GLSL_DUMP) { - printf("Mesa pre-link vertex program:\n"); - _mesa_print_program(&vertProg->Base); - _mesa_print_program_parameters(ctx, &vertProg->Base); - - printf("Mesa post-link vertex program:\n"); - _mesa_print_program(&shProg->VertexProgram->Base); - _mesa_print_program_parameters(ctx, &shProg->VertexProgram->Base); - } - } - - /* Debug: */ - if (0) { - if (shProg->VertexProgram) - _mesa_postprocess_program(ctx, &shProg->VertexProgram->Base); - if (shProg->FragmentProgram) - _mesa_postprocess_program(ctx, &shProg->FragmentProgram->Base); - } - - if (ctx->Shader.Flags & GLSL_DUMP) { - printf("Varying vars:\n"); - _mesa_print_parameter_list(shProg->Varying); - if (shProg->InfoLog) { - printf("Info Log: %s\n", shProg->InfoLog); - } - } - - if (!vertNotify || !fragNotify) { - /* driver rejected one/both of the vertex/fragment programs */ - if (!shProg->InfoLog) { - link_error(shProg, - "Vertex and/or fragment program rejected by driver\n"); - } - } - else { - shProg->LinkStatus = (shProg->VertexProgram || shProg->FragmentProgram); - } -} - diff --git a/mesalib/src/mesa/shader/slang/slang_log.c b/mesalib/src/mesa/shader/slang/slang_log.c deleted file mode 100644 index 9ff21417b..000000000 --- a/mesalib/src/mesa/shader/slang/slang_log.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * Copyright (C) 2009 VMware, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "main/imports.h" -#include "slang_log.h" -#include "slang_utility.h" - - - -static char *out_of_memory = "Error: Out of memory.\n"; - -void -slang_info_log_construct(slang_info_log * log) -{ - log->text = NULL; - log->dont_free_text = GL_FALSE; - log->error_flag = GL_FALSE; -} - -void -slang_info_log_destruct(slang_info_log * log) -{ - if (!log->dont_free_text) - free(log->text); -} - -static int -slang_info_log_message(slang_info_log * log, const char *prefix, - const char *msg) -{ - GLuint size; - - if (log->dont_free_text) - return 0; - size = slang_string_length(msg) + 2; - if (prefix != NULL) - size += slang_string_length(prefix) + 2; - if (log->text != NULL) { - GLuint old_len = slang_string_length(log->text); - log->text = (char *) - _mesa_realloc(log->text, old_len + 1, old_len + size); - } - else { - log->text = (char *) (malloc(size)); - if (log->text != NULL) - log->text[0] = '\0'; - } - if (log->text == NULL) - return 0; - if (prefix != NULL) { - slang_string_concat(log->text, prefix); - slang_string_concat(log->text, ": "); - } - slang_string_concat(log->text, msg); - slang_string_concat(log->text, "\n"); - - return 1; -} - -int -slang_info_log_print(slang_info_log * log, const char *msg, ...) -{ - va_list va; - char buf[1024]; - - va_start(va, msg); - vsprintf(buf, msg, va); - va_end(va); - return slang_info_log_message(log, NULL, buf); -} - -int -slang_info_log_error(slang_info_log * log, const char *msg, ...) -{ - va_list va; - char buf[1024]; - - va_start(va, msg); - vsprintf(buf, msg, va); - va_end(va); - log->error_flag = GL_TRUE; - if (slang_info_log_message(log, "Error", buf)) - return 1; - slang_info_log_memory(log); - return 0; -} - -int -slang_info_log_warning(slang_info_log * log, const char *msg, ...) -{ - va_list va; - char buf[1024]; - - va_start(va, msg); - vsprintf(buf, msg, va); - va_end(va); - if (slang_info_log_message(log, "Warning", buf)) - return 1; - slang_info_log_memory(log); - return 0; -} - -void -slang_info_log_memory(slang_info_log * log) -{ - if (!slang_info_log_message(log, "Error", "Out of memory.")) { - log->dont_free_text = GL_TRUE; - log->error_flag = GL_TRUE; - log->text = out_of_memory; - } -} diff --git a/mesalib/src/mesa/shader/slang/slang_log.h b/mesalib/src/mesa/shader/slang/slang_log.h deleted file mode 100644 index dcaba0285..000000000 --- a/mesalib/src/mesa/shader/slang/slang_log.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef SLANG_LOG_H -#define SLANG_LOG_H - - -typedef struct slang_info_log_ -{ - char *text; - GLboolean dont_free_text; - GLboolean error_flag; -} slang_info_log; - - -extern void -slang_info_log_construct(slang_info_log *); - -extern void -slang_info_log_destruct(slang_info_log *); - -extern int -slang_info_log_print(slang_info_log *, const char *, ...); - -extern int -slang_info_log_error(slang_info_log *, const char *, ...); - -extern int -slang_info_log_warning(slang_info_log *, const char *, ...); - -extern void -slang_info_log_memory(slang_info_log *); - - -#endif /* SLANG_LOG_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_mem.c b/mesalib/src/mesa/shader/slang/slang_mem.c deleted file mode 100644 index 5eaa7c442..000000000 --- a/mesalib/src/mesa/shader/slang/slang_mem.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_mem.c - * - * Memory manager for GLSL compiler. The general idea is to do all - * allocations out of a large pool then just free the pool when done - * compiling to avoid intricate malloc/free tracking and memory leaks. - * - * \author Brian Paul - */ - -#include "main/context.h" -#include "main/macros.h" -#include "slang_mem.h" - - -#define GRANULARITY 8 -#define ROUND_UP(B) ( ((B) + (GRANULARITY - 1)) & ~(GRANULARITY - 1) ) - - -/** If 1, use conventional malloc/free. Helpful for debugging */ -#define USE_MALLOC_FREE 0 - - -struct slang_mempool_ -{ - GLuint Size, Used, Count, Largest; - char *Data; - struct slang_mempool_ *Next; -}; - - -slang_mempool * -_slang_new_mempool(GLuint initialSize) -{ - slang_mempool *pool = (slang_mempool *) calloc(1, sizeof(slang_mempool)); - if (pool) { - pool->Data = (char *) calloc(1, initialSize); - /*printf("ALLOC MEMPOOL %d at %p\n", initialSize, pool->Data);*/ - if (!pool->Data) { - free(pool); - return NULL; - } - pool->Size = initialSize; - pool->Used = 0; - } - return pool; -} - - -void -_slang_delete_mempool(slang_mempool *pool) -{ - GLuint total = 0; - while (pool) { - slang_mempool *next = pool->Next; - /* - printf("DELETE MEMPOOL %u / %u count=%u largest=%u\n", - pool->Used, pool->Size, pool->Count, pool->Largest); - */ - total += pool->Used; - free(pool->Data); - free(pool); - pool = next; - } - /*printf("TOTAL ALLOCATED: %u\n", total);*/ -} - - -#ifdef DEBUG -static void -check_zero(const char *addr, GLuint n) -{ - GLuint i; - for (i = 0; i < n; i++) { - assert(addr[i]==0); - } -} -#endif - - -#ifdef DEBUG -static GLboolean -is_valid_address(const slang_mempool *pool, void *addr) -{ - while (pool) { - if ((char *) addr >= pool->Data && - (char *) addr < pool->Data + pool->Used) - return GL_TRUE; - - pool = pool->Next; - } - return GL_FALSE; -} -#endif - - -/** - * Alloc 'bytes' from shader mempool. - */ -void * -_slang_alloc(GLuint bytes) -{ -#if USE_MALLOC_FREE - return calloc(1, bytes); -#else - slang_mempool *pool; - GET_CURRENT_CONTEXT(ctx); - pool = (slang_mempool *) ctx->Shader.MemPool; - - if (bytes == 0) - bytes = 1; - - while (pool) { - if (pool->Used + bytes <= pool->Size) { - /* found room */ - void *addr = (void *) (pool->Data + pool->Used); -#ifdef DEBUG - check_zero((char*) addr, bytes); -#endif - pool->Used += ROUND_UP(bytes); - pool->Largest = MAX2(pool->Largest, bytes); - pool->Count++; - /*printf("alloc %u Used %u\n", bytes, pool->Used);*/ - return addr; - } - else if (pool->Next) { - /* try next block */ - pool = pool->Next; - } - else { - /* alloc new pool */ - const GLuint sz = MAX2(bytes, pool->Size); - pool->Next = _slang_new_mempool(sz); - if (!pool->Next) { - /* we're _really_ out of memory */ - return NULL; - } - else { - pool = pool->Next; - pool->Largest = bytes; - pool->Count++; - pool->Used = ROUND_UP(bytes); -#ifdef DEBUG - check_zero((char*) pool->Data, bytes); -#endif - return (void *) pool->Data; - } - } - } - return NULL; -#endif -} - - -void * -_slang_realloc(void *oldBuffer, GLuint oldSize, GLuint newSize) -{ -#if USE_MALLOC_FREE - return _mesa_realloc(oldBuffer, oldSize, newSize); -#else - GET_CURRENT_CONTEXT(ctx); - slang_mempool *pool = (slang_mempool *) ctx->Shader.MemPool; - (void) pool; - - if (newSize < oldSize) { - return oldBuffer; - } - else { - const GLuint copySize = (oldSize < newSize) ? oldSize : newSize; - void *newBuffer = _slang_alloc(newSize); - - if (oldBuffer) - ASSERT(is_valid_address(pool, oldBuffer)); - - if (newBuffer && oldBuffer && copySize > 0) - memcpy(newBuffer, oldBuffer, copySize); - - return newBuffer; - } -#endif -} - - -/** - * Clone string, storing in current mempool. - */ -char * -_slang_strdup(const char *s) -{ - if (s) { - size_t l = strlen(s); - char *s2 = (char *) _slang_alloc(l + 1); - if (s2) - strcpy(s2, s); - return s2; - } - else { - return NULL; - } -} - - -/** - * Don't actually free memory, but mark it (for debugging). - */ -void -_slang_free(void *addr) -{ -#if USE_MALLOC_FREE - free(addr); -#else - if (addr) { - GET_CURRENT_CONTEXT(ctx); - slang_mempool *pool = (slang_mempool *) ctx->Shader.MemPool; - (void) pool; - ASSERT(is_valid_address(pool, addr)); - } -#endif -} diff --git a/mesalib/src/mesa/shader/slang/slang_mem.h b/mesalib/src/mesa/shader/slang/slang_mem.h deleted file mode 100644 index b5bfae247..000000000 --- a/mesalib/src/mesa/shader/slang/slang_mem.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef SLANG_MEM_H -#define SLANG_MEM_H - - -#include "main/imports.h" - - -typedef struct slang_mempool_ slang_mempool; - - -extern slang_mempool * -_slang_new_mempool(GLuint initialSize); - -extern void -_slang_delete_mempool(slang_mempool *pool); - -extern void * -_slang_alloc(GLuint bytes); - -extern void * -_slang_realloc(void *oldBuffer, GLuint oldSize, GLuint newSize); - -extern char * -_slang_strdup(const char *s); - -extern void -_slang_free(void *addr); - - -#endif diff --git a/mesalib/src/mesa/shader/slang/slang_print.c b/mesalib/src/mesa/shader/slang/slang_print.c deleted file mode 100644 index 3c75523c4..000000000 --- a/mesalib/src/mesa/shader/slang/slang_print.c +++ /dev/null @@ -1,883 +0,0 @@ - -/** - * Dump/print a slang_operation tree - */ - - -#include "main/imports.h" -#include "slang_compile.h" -#include "slang_print.h" - - -static void -spaces(int n) -{ - while (n--) - printf(" "); -} - - -static void -print_type(const slang_fully_specified_type *t) -{ - switch (t->qualifier) { - case SLANG_QUAL_NONE: - /*printf("");*/ - break; - case SLANG_QUAL_CONST: - printf("const "); - break; - case SLANG_QUAL_ATTRIBUTE: - printf("attrib "); - break; - case SLANG_QUAL_VARYING: - printf("varying "); - break; - case SLANG_QUAL_UNIFORM: - printf("uniform "); - break; - case SLANG_QUAL_OUT: - printf("output "); - break; - case SLANG_QUAL_INOUT: - printf("inout "); - break; - case SLANG_QUAL_FIXEDOUTPUT: - printf("fixedoutput"); - break; - case SLANG_QUAL_FIXEDINPUT: - printf("fixedinput"); - break; - default: - printf("unknown qualifer!"); - } - - switch (t->specifier.type) { - case SLANG_SPEC_VOID: - printf("void"); - break; - case SLANG_SPEC_BOOL: - printf("bool"); - break; - case SLANG_SPEC_BVEC2: - printf("bvec2"); - break; - case SLANG_SPEC_BVEC3: - printf("bvec3"); - break; - case SLANG_SPEC_BVEC4: - printf("bvec4"); - break; - case SLANG_SPEC_INT: - printf("int"); - break; - case SLANG_SPEC_IVEC2: - printf("ivec2"); - break; - case SLANG_SPEC_IVEC3: - printf("ivec3"); - break; - case SLANG_SPEC_IVEC4: - printf("ivec4"); - break; - case SLANG_SPEC_FLOAT: - printf("float"); - break; - case SLANG_SPEC_VEC2: - printf("vec2"); - break; - case SLANG_SPEC_VEC3: - printf("vec3"); - break; - case SLANG_SPEC_VEC4: - printf("vec4"); - break; - case SLANG_SPEC_MAT2: - printf("mat2"); - break; - case SLANG_SPEC_MAT3: - printf("mat3"); - break; - case SLANG_SPEC_MAT4: - printf("mat4"); - break; - case SLANG_SPEC_MAT23: - printf("mat2x3"); - break; - case SLANG_SPEC_MAT32: - printf("mat3x2"); - break; - case SLANG_SPEC_MAT24: - printf("mat2x4"); - break; - case SLANG_SPEC_MAT42: - printf("mat4x2"); - break; - case SLANG_SPEC_MAT34: - printf("mat3x4"); - break; - case SLANG_SPEC_MAT43: - printf("mat4x3"); - break; - case SLANG_SPEC_SAMPLER_1D: - printf("sampler1D"); - break; - case SLANG_SPEC_SAMPLER_2D: - printf("sampler2D"); - break; - case SLANG_SPEC_SAMPLER_3D: - printf("sampler3D"); - break; - case SLANG_SPEC_SAMPLER_CUBE: - printf("samplerCube"); - break; - case SLANG_SPEC_SAMPLER_1D_SHADOW: - printf("sampler1DShadow"); - break; - case SLANG_SPEC_SAMPLER_2D_SHADOW: - printf("sampler2DShadow"); - break; - case SLANG_SPEC_STRUCT: - printf("struct"); - break; - case SLANG_SPEC_ARRAY: - printf("array"); - break; - default: - printf("unknown type"); - } - /*printf("\n");*/ -} - - -static void -print_variable(const slang_variable *v, int indent) -{ - spaces(indent); - printf("VAR "); - print_type(&v->type); - printf(" %s (at %p)", (char *) v->a_name, (void *) v); - if (v->initializer) { - printf(" :=\n"); - slang_print_tree(v->initializer, indent + 3); - } - else { - printf(";\n"); - } -} - - -static void -print_binary(const slang_operation *op, const char *oper, int indent) -{ - assert(op->num_children == 2); -#if 0 - printf("binary at %p locals=%p outer=%p\n", - (void *) op, - (void *) op->locals, - (void *) op->locals->outer_scope); -#endif - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("%s at %p locals=%p outer=%p\n", - oper, (void *) op, (void *) op->locals, - (void *) op->locals->outer_scope); - slang_print_tree(&op->children[1], indent + 3); -} - - -static void -print_generic2(const slang_operation *op, const char *oper, - const char *s, int indent) -{ - GLuint i; - if (oper) { - spaces(indent); - printf("%s %s at %p locals=%p outer=%p\n", - oper, s, (void *) op, (void *) op->locals, - (void *) op->locals->outer_scope); - } - for (i = 0; i < op->num_children; i++) { - spaces(indent); - printf("//child %u of %u:\n", i, op->num_children); - slang_print_tree(&op->children[i], indent); - } -} - -static void -print_generic(const slang_operation *op, const char *oper, int indent) -{ - print_generic2(op, oper, "", indent); -} - - -static const slang_variable_scope * -find_scope(const slang_variable_scope *s, slang_atom name) -{ - GLuint i; - for (i = 0; i < s->num_variables; i++) { - if (s->variables[i]->a_name == name) - return s; - } - if (s->outer_scope) - return find_scope(s->outer_scope, name); - else - return NULL; -} - -static const slang_variable * -find_var(const slang_variable_scope *s, slang_atom name) -{ - GLuint i; - for (i = 0; i < s->num_variables; i++) { - if (s->variables[i]->a_name == name) - return s->variables[i]; - } - if (s->outer_scope) - return find_var(s->outer_scope, name); - else - return NULL; -} - - -void -slang_print_tree(const slang_operation *op, int indent) -{ - GLuint i; - - switch (op->type) { - - case SLANG_OPER_NONE: - spaces(indent); - printf("SLANG_OPER_NONE\n"); - break; - - case SLANG_OPER_BLOCK_NO_NEW_SCOPE: - spaces(indent); - printf("{ locals=%p outer=%p\n", (void*)op->locals, (void*)op->locals->outer_scope); - print_generic(op, NULL, indent+3); - spaces(indent); - printf("}\n"); - break; - - case SLANG_OPER_BLOCK_NEW_SCOPE: - case SLANG_OPER_NON_INLINED_CALL: - spaces(indent); - printf("{{ // new scope locals=%p outer=%p: ", - (void *) op->locals, - (void *) op->locals->outer_scope); - for (i = 0; i < op->locals->num_variables; i++) { - printf("%s ", (char *) op->locals->variables[i]->a_name); - } - printf("\n"); - print_generic(op, NULL, indent+3); - spaces(indent); - printf("}}\n"); - break; - - case SLANG_OPER_VARIABLE_DECL: - assert(op->num_children == 0 || op->num_children == 1); - { - slang_variable *v; - v = _slang_variable_locate(op->locals, op->a_id, GL_TRUE); - if (v) { - const slang_variable_scope *scope; - spaces(indent); - printf("DECL (locals=%p outer=%p) ", (void*)op->locals, (void*) op->locals->outer_scope); - print_type(&v->type); - printf(" %s (%p)", (char *) op->a_id, - (void *) find_var(op->locals, op->a_id)); - - scope = find_scope(op->locals, op->a_id); - printf(" (in scope %p) ", (void *) scope); - assert(scope); - if (op->num_children == 1) { - printf(" :=\n"); - slang_print_tree(&op->children[0], indent + 3); - } - else if (v->initializer) { - printf(" := INITIALIZER\n"); - slang_print_tree(v->initializer, indent + 3); - } - else { - printf(";\n"); - } - /* - spaces(indent); - printf("TYPE: "); - print_type(&v->type); - spaces(indent); - printf("ADDR: %d size: %d\n", v->address, v->size); - */ - } - else { - spaces(indent); - printf("DECL %s (anonymous variable!!!!)\n", (char *) op->a_id); - } - } - break; - - case SLANG_OPER_ASM: - spaces(indent); - printf("ASM: %s at %p locals=%p outer=%p\n", - (char *) op->a_id, - (void *) op, - (void *) op->locals, - (void *) op->locals->outer_scope); - print_generic(op, "ASM", indent+3); - break; - - case SLANG_OPER_BREAK: - spaces(indent); - printf("BREAK\n"); - break; - - case SLANG_OPER_CONTINUE: - spaces(indent); - printf("CONTINUE\n"); - break; - - case SLANG_OPER_DISCARD: - spaces(indent); - printf("DISCARD\n"); - break; - - case SLANG_OPER_RETURN: - spaces(indent); - printf("RETURN\n"); - if (op->num_children > 0) - slang_print_tree(&op->children[0], indent + 3); - break; - - case SLANG_OPER_RETURN_INLINED: - spaces(indent); - printf("RETURN_INLINED\n"); - if (op->num_children > 0) - slang_print_tree(&op->children[0], indent + 3); - break; - - case SLANG_OPER_LABEL: - spaces(indent); - printf("LABEL %s\n", (char *) op->a_id); - break; - - case SLANG_OPER_EXPRESSION: - spaces(indent); - printf("EXPR: locals=%p outer=%p\n", - (void *) op->locals, - (void *) op->locals->outer_scope); - /*print_generic(op, "SLANG_OPER_EXPRESSION", indent);*/ - slang_print_tree(&op->children[0], indent + 3); - break; - - case SLANG_OPER_IF: - spaces(indent); - printf("IF\n"); - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("THEN\n"); - slang_print_tree(&op->children[1], indent + 3); - spaces(indent); - printf("ELSE\n"); - slang_print_tree(&op->children[2], indent + 3); - spaces(indent); - printf("ENDIF\n"); - break; - - case SLANG_OPER_WHILE: - assert(op->num_children == 2); - spaces(indent); - printf("WHILE LOOP: locals = %p\n", (void *) op->locals); - indent += 3; - spaces(indent); - printf("WHILE cond:\n"); - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("WHILE body:\n"); - slang_print_tree(&op->children[1], indent + 3); - indent -= 3; - spaces(indent); - printf("END WHILE LOOP\n"); - break; - - case SLANG_OPER_DO: - spaces(indent); - printf("DO LOOP: locals = %p\n", (void *) op->locals); - indent += 3; - spaces(indent); - printf("DO body:\n"); - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("DO cond:\n"); - slang_print_tree(&op->children[1], indent + 3); - indent -= 3; - spaces(indent); - printf("END DO LOOP\n"); - break; - - case SLANG_OPER_FOR: - spaces(indent); - printf("FOR LOOP: locals = %p\n", (void *) op->locals); - indent += 3; - spaces(indent); - printf("FOR init:\n"); - slang_print_tree(&op->children[0], indent + 3); - spaces(indent); - printf("FOR condition:\n"); - slang_print_tree(&op->children[1], indent + 3); - spaces(indent); - printf("FOR step:\n"); - slang_print_tree(&op->children[2], indent + 3); - spaces(indent); - printf("FOR body:\n"); - slang_print_tree(&op->children[3], indent + 3); - indent -= 3; - spaces(indent); - printf("ENDFOR\n"); - /* - print_generic(op, "FOR", indent + 3); - */ - break; - - case SLANG_OPER_VOID: - spaces(indent); - printf("(oper-void)\n"); - break; - - case SLANG_OPER_LITERAL_BOOL: - spaces(indent); - printf("LITERAL ("); - for (i = 0; i < op->literal_size; i++) - printf("%s ", op->literal[0] ? "TRUE" : "FALSE"); - printf(")\n"); - - break; - - case SLANG_OPER_LITERAL_INT: - spaces(indent); - printf("LITERAL ("); - for (i = 0; i < op->literal_size; i++) - printf("%d ", (int) op->literal[i]); - printf(")\n"); - break; - - case SLANG_OPER_LITERAL_FLOAT: - spaces(indent); - printf("LITERAL ("); - for (i = 0; i < op->literal_size; i++) - printf("%f ", op->literal[i]); - printf(")\n"); - break; - - case SLANG_OPER_IDENTIFIER: - { - const slang_variable_scope *scope; - spaces(indent); - if (op->var && op->var->a_name) { - scope = find_scope(op->locals, op->var->a_name); - printf("VAR %s (in scope %p)\n", (char *) op->var->a_name, - (void *) scope); - assert(scope); - } - else { - scope = find_scope(op->locals, op->a_id); - printf("VAR' %s (in scope %p) locals=%p outer=%p\n", - (char *) op->a_id, - (void *) scope, - (void *) op->locals, - (void *) op->locals->outer_scope); - /*assert(scope);*/ - } - } - break; - - case SLANG_OPER_SEQUENCE: - print_generic(op, "COMMA-SEQ", indent+3); - break; - - case SLANG_OPER_ASSIGN: - spaces(indent); - printf("ASSIGNMENT locals=%p outer=%p\n", - (void *) op->locals, - (void *) op->locals->outer_scope); - print_binary(op, ":=", indent); - break; - - case SLANG_OPER_ADDASSIGN: - spaces(indent); - printf("ASSIGN\n"); - print_binary(op, "+=", indent); - break; - - case SLANG_OPER_SUBASSIGN: - spaces(indent); - printf("ASSIGN\n"); - print_binary(op, "-=", indent); - break; - - case SLANG_OPER_MULASSIGN: - spaces(indent); - printf("ASSIGN\n"); - print_binary(op, "*=", indent); - break; - - case SLANG_OPER_DIVASSIGN: - spaces(indent); - printf("ASSIGN\n"); - print_binary(op, "/=", indent); - break; - - /*SLANG_OPER_MODASSIGN,*/ - /*SLANG_OPER_LSHASSIGN,*/ - /*SLANG_OPER_RSHASSIGN,*/ - /*SLANG_OPER_ORASSIGN,*/ - /*SLANG_OPER_XORASSIGN,*/ - /*SLANG_OPER_ANDASSIGN,*/ - case SLANG_OPER_SELECT: - spaces(indent); - printf("SLANG_OPER_SELECT n=%d\n", op->num_children); - assert(op->num_children == 3); - slang_print_tree(&op->children[0], indent+3); - spaces(indent); - printf("?\n"); - slang_print_tree(&op->children[1], indent+3); - spaces(indent); - printf(":\n"); - slang_print_tree(&op->children[2], indent+3); - break; - - case SLANG_OPER_LOGICALOR: - print_binary(op, "||", indent); - break; - - case SLANG_OPER_LOGICALXOR: - print_binary(op, "^^", indent); - break; - - case SLANG_OPER_LOGICALAND: - print_binary(op, "&&", indent); - break; - - /*SLANG_OPER_BITOR*/ - /*SLANG_OPER_BITXOR*/ - /*SLANG_OPER_BITAND*/ - case SLANG_OPER_EQUAL: - print_binary(op, "==", indent); - break; - - case SLANG_OPER_NOTEQUAL: - print_binary(op, "!=", indent); - break; - - case SLANG_OPER_LESS: - print_binary(op, "<", indent); - break; - - case SLANG_OPER_GREATER: - print_binary(op, ">", indent); - break; - - case SLANG_OPER_LESSEQUAL: - print_binary(op, "<=", indent); - break; - - case SLANG_OPER_GREATEREQUAL: - print_binary(op, ">=", indent); - break; - - /*SLANG_OPER_LSHIFT*/ - /*SLANG_OPER_RSHIFT*/ - case SLANG_OPER_ADD: - print_binary(op, "+", indent); - break; - - case SLANG_OPER_SUBTRACT: - print_binary(op, "-", indent); - break; - - case SLANG_OPER_MULTIPLY: - print_binary(op, "*", indent); - break; - - case SLANG_OPER_DIVIDE: - print_binary(op, "/", indent); - break; - - /*SLANG_OPER_MODULUS*/ - case SLANG_OPER_PREINCREMENT: - spaces(indent); - printf("PRE++\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_PREDECREMENT: - spaces(indent); - printf("PRE--\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_PLUS: - spaces(indent); - printf("SLANG_OPER_PLUS\n"); - break; - - case SLANG_OPER_MINUS: - spaces(indent); - printf("SLANG_OPER_MINUS\n"); - break; - - /*SLANG_OPER_COMPLEMENT*/ - case SLANG_OPER_NOT: - spaces(indent); - printf("NOT\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_SUBSCRIPT: - spaces(indent); - printf("SLANG_OPER_SUBSCRIPT locals=%p outer=%p\n", - (void *) op->locals, - (void *) op->locals->outer_scope); - print_generic(op, NULL, indent+3); - break; - - case SLANG_OPER_CALL: -#if 0 - slang_function *fun - = _slang_function_locate(A->space.funcs, oper->a_id, - oper->children, - oper->num_children, &A->space, A->atoms); -#endif - spaces(indent); - printf("CALL %s(\n", (char *) op->a_id); - for (i = 0; i < op->num_children; i++) { - slang_print_tree(&op->children[i], indent+3); - if (i + 1 < op->num_children) { - spaces(indent + 3); - printf(",\n"); - } - } - spaces(indent); - printf(")\n"); - break; - - case SLANG_OPER_METHOD: - spaces(indent); - printf("METHOD CALL %s.%s\n", (char *) op->a_obj, (char *) op->a_id); - break; - - case SLANG_OPER_FIELD: - spaces(indent); - printf("FIELD %s of\n", (char*) op->a_id); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_POSTINCREMENT: - spaces(indent); - printf("POST++\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - case SLANG_OPER_POSTDECREMENT: - spaces(indent); - printf("POST--\n"); - slang_print_tree(&op->children[0], indent+3); - break; - - default: - printf("unknown op->type %d\n", (int) op->type); - } - -} - - - -void -slang_print_function(const slang_function *f, GLboolean body) -{ - GLuint i; - -#if 0 - if (strcmp((char *) f->header.a_name, "main") != 0) - return; -#endif - - printf("FUNCTION %s ( scope=%p\n", - (char *) f->header.a_name, (void *) f->parameters); - - for (i = 0; i < f->param_count; i++) { - print_variable(f->parameters->variables[i], 3); - } - - printf(") param scope = %p\n", (void *) f->parameters); - - if (body && f->body) - slang_print_tree(f->body, 0); -} - - - - - -const char * -slang_type_qual_string(slang_type_qualifier q) -{ - switch (q) { - case SLANG_QUAL_NONE: - return "none"; - case SLANG_QUAL_CONST: - return "const"; - case SLANG_QUAL_ATTRIBUTE: - return "attribute"; - case SLANG_QUAL_VARYING: - return "varying"; - case SLANG_QUAL_UNIFORM: - return "uniform"; - case SLANG_QUAL_OUT: - return "out"; - case SLANG_QUAL_INOUT: - return "inout"; - case SLANG_QUAL_FIXEDOUTPUT: - return "fixedoutput"; - case SLANG_QUAL_FIXEDINPUT: - return "fixedinputk"; - default: - return "qual?"; - } -} - - -static const char * -slang_type_string(slang_type_specifier_type t) -{ - switch (t) { - case SLANG_SPEC_VOID: - return "void"; - case SLANG_SPEC_BOOL: - return "bool"; - case SLANG_SPEC_BVEC2: - return "bvec2"; - case SLANG_SPEC_BVEC3: - return "bvec3"; - case SLANG_SPEC_BVEC4: - return "bvec4"; - case SLANG_SPEC_INT: - return "int"; - case SLANG_SPEC_IVEC2: - return "ivec2"; - case SLANG_SPEC_IVEC3: - return "ivec3"; - case SLANG_SPEC_IVEC4: - return "ivec4"; - case SLANG_SPEC_FLOAT: - return "float"; - case SLANG_SPEC_VEC2: - return "vec2"; - case SLANG_SPEC_VEC3: - return "vec3"; - case SLANG_SPEC_VEC4: - return "vec4"; - case SLANG_SPEC_MAT2: - return "mat2"; - case SLANG_SPEC_MAT3: - return "mat3"; - case SLANG_SPEC_MAT4: - return "mat4"; - case SLANG_SPEC_SAMPLER_1D: - return "sampler1D"; - case SLANG_SPEC_SAMPLER_2D: - return "sampler2D"; - case SLANG_SPEC_SAMPLER_3D: - return "sampler3D"; - case SLANG_SPEC_SAMPLER_CUBE: - return "samplerCube"; - case SLANG_SPEC_SAMPLER_1D_SHADOW: - return "sampler1DShadow"; - case SLANG_SPEC_SAMPLER_2D_SHADOW: - return "sampler2DShadow"; - case SLANG_SPEC_SAMPLER_RECT: - return "sampler2DRect"; - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - return "sampler2DRectShadow"; - case SLANG_SPEC_STRUCT: - return "struct"; - case SLANG_SPEC_ARRAY: - return "array"; - default: - return "type?"; - } -} - - -static const char * -slang_fq_type_string(const slang_fully_specified_type *t) -{ - static char str[1000]; - sprintf(str, "%s %s", slang_type_qual_string(t->qualifier), - slang_type_string(t->specifier.type)); - return str; -} - - -void -slang_print_type(const slang_fully_specified_type *t) -{ - printf("%s %s", slang_type_qual_string(t->qualifier), - slang_type_string(t->specifier.type)); -} - - -#if 0 -static char * -slang_var_string(const slang_variable *v) -{ - static char str[1000]; - sprintf(str, "%s : %s", - (char *) v->a_name, - slang_fq_type_string(&v->type)); - return str; -} -#endif - - -void -slang_print_variable(const slang_variable *v) -{ - printf("Name: %s\n", (char *) v->a_name); - printf("Type: %s\n", slang_fq_type_string(&v->type)); -} - - -void -_slang_print_var_scope(const slang_variable_scope *vars, int indent) -{ - GLuint i; - - spaces(indent); - printf("Var scope %p %d vars:\n", (void *) vars, vars->num_variables); - for (i = 0; i < vars->num_variables; i++) { - spaces(indent + 3); - printf("%s (at %p)\n", (char *) vars->variables[i]->a_name, (void*) (vars->variables + i)); - } - spaces(indent + 3); - printf("outer_scope = %p\n", (void*) vars->outer_scope); - - if (vars->outer_scope) { - /*spaces(indent + 3);*/ - _slang_print_var_scope(vars->outer_scope, indent + 3); - } -} - - - -int -slang_checksum_tree(const slang_operation *op) -{ - int s = op->num_children; - GLuint i; - - for (i = 0; i < op->num_children; i++) { - s += slang_checksum_tree(&op->children[i]); - } - return s; -} diff --git a/mesalib/src/mesa/shader/slang/slang_print.h b/mesalib/src/mesa/shader/slang/slang_print.h deleted file mode 100644 index 46605c806..000000000 --- a/mesalib/src/mesa/shader/slang/slang_print.h +++ /dev/null @@ -1,29 +0,0 @@ - - -#ifndef SLANG_PRINT -#define SLANG_PRINT - -extern void -slang_print_function(const slang_function *f, GLboolean body); - -extern void -slang_print_tree(const slang_operation *op, int indent); - -extern const char * -slang_type_qual_string(slang_type_qualifier q); - -extern void -slang_print_type(const slang_fully_specified_type *t); - -extern void -slang_print_variable(const slang_variable *v); - -extern void -_slang_print_var_scope(const slang_variable_scope *s, int indent); - - -extern int -slang_checksum_tree(const slang_operation *op); - -#endif /* SLANG_PRINT */ - diff --git a/mesalib/src/mesa/shader/slang/slang_simplify.c b/mesalib/src/mesa/shader/slang/slang_simplify.c deleted file mode 100644 index 13b9ca3c8..000000000 --- a/mesalib/src/mesa/shader/slang/slang_simplify.c +++ /dev/null @@ -1,527 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 2005-2008 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * Functions for constant folding, built-in constant lookup, and function - * call casting. - */ - - -#include "main/imports.h" -#include "main/macros.h" -#include "main/get.h" -#include "slang_compile.h" -#include "slang_codegen.h" -#include "slang_simplify.h" -#include "slang_print.h" - - -#ifndef GL_MAX_FRAGMENT_UNIFORM_VECTORS -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#endif -#ifndef GL_MAX_VERTEX_UNIFORM_VECTORS -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#endif -#ifndef GL_MAX_VARYING_VECTORS -#define GL_MAX_VARYING_VECTORS 0x8DFC -#endif - - -/** - * Lookup the value of named constant, such as gl_MaxLights. - * \return value of constant, or -1 if unknown - */ -GLint -_slang_lookup_constant(const char *name) -{ - struct constant_info { - const char *Name; - const GLenum Token; - }; - static const struct constant_info info[] = { - { "gl_MaxClipPlanes", GL_MAX_CLIP_PLANES }, - { "gl_MaxCombinedTextureImageUnits", GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS }, - { "gl_MaxDrawBuffers", GL_MAX_DRAW_BUFFERS }, - { "gl_MaxFragmentUniformComponents", GL_MAX_FRAGMENT_UNIFORM_COMPONENTS }, - { "gl_MaxLights", GL_MAX_LIGHTS }, - { "gl_MaxTextureUnits", GL_MAX_TEXTURE_UNITS }, - { "gl_MaxTextureCoords", GL_MAX_TEXTURE_COORDS }, - { "gl_MaxVertexAttribs", GL_MAX_VERTEX_ATTRIBS }, - { "gl_MaxVertexUniformComponents", GL_MAX_VERTEX_UNIFORM_COMPONENTS }, - { "gl_MaxVaryingFloats", GL_MAX_VARYING_FLOATS }, - { "gl_MaxVertexTextureImageUnits", GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS }, - { "gl_MaxTextureImageUnits", GL_MAX_TEXTURE_IMAGE_UNITS }, -#if FEATURE_es2_glsl - { "gl_MaxVertexUniformVectors", GL_MAX_VERTEX_UNIFORM_VECTORS }, - { "gl_MaxVaryingVectors", GL_MAX_VARYING_VECTORS }, - { "gl_MaxFragmentUniformVectors", GL_MAX_FRAGMENT_UNIFORM_VECTORS }, -#endif - { NULL, 0 } - }; - GLuint i; - - for (i = 0; info[i].Name; i++) { - if (strcmp(info[i].Name, name) == 0) { - /* found */ - GLint values[16]; - values[0] = -1; - _mesa_GetIntegerv(info[i].Token, values); - ASSERT(values[0] >= 0); /* sanity check that glGetFloatv worked */ - return values[0]; - } - } - return -1; -} - - -static slang_operation_type -literal_type(slang_operation_type t1, slang_operation_type t2) -{ - if (t1 == SLANG_OPER_LITERAL_FLOAT || t2 == SLANG_OPER_LITERAL_FLOAT) - return SLANG_OPER_LITERAL_FLOAT; - else - return SLANG_OPER_LITERAL_INT; -} - - -/** - * Recursively traverse an AST tree, applying simplifications wherever - * possible. - * At the least, we do constant folding. We need to do that much so that - * compile-time expressions can be evaluated for things like array - * declarations. I.e.: float foo[3 + 5]; - */ -void -_slang_simplify(slang_operation *oper, - const slang_name_space * space, - slang_atom_pool * atoms) -{ - GLboolean isFloat[4]; - GLboolean isBool[4]; - GLuint i, n; - - if (oper->type == SLANG_OPER_IDENTIFIER) { - /* see if it's a named constant */ - GLint value = _slang_lookup_constant((char *) oper->a_id); - /*printf("value[%s] = %d\n", (char*) oper->a_id, value);*/ - if (value >= 0) { - oper->literal[0] = - oper->literal[1] = - oper->literal[2] = - oper->literal[3] = (GLfloat) value; - oper->type = SLANG_OPER_LITERAL_INT; - return; - } - /* look for user-defined constant */ - { - slang_variable *var; - var = _slang_variable_locate(oper->locals, oper->a_id, GL_TRUE); - if (var) { - if (var->type.qualifier == SLANG_QUAL_CONST && - var->initializer && - (var->initializer->type == SLANG_OPER_LITERAL_INT || - var->initializer->type == SLANG_OPER_LITERAL_FLOAT)) { - oper->literal[0] = var->initializer->literal[0]; - oper->literal[1] = var->initializer->literal[1]; - oper->literal[2] = var->initializer->literal[2]; - oper->literal[3] = var->initializer->literal[3]; - oper->literal_size = var->initializer->literal_size; - oper->type = var->initializer->type; - /* - printf("value[%s] = %f\n", - (char*) oper->a_id, oper->literal[0]); - */ - return; - } - } - } - } - - /* first, simplify children */ - for (i = 0; i < oper->num_children; i++) { - _slang_simplify(&oper->children[i], space, atoms); - } - - /* examine children */ - n = MIN2(oper->num_children, 4); - for (i = 0; i < n; i++) { - isFloat[i] = (oper->children[i].type == SLANG_OPER_LITERAL_FLOAT || - oper->children[i].type == SLANG_OPER_LITERAL_INT); - isBool[i] = (oper->children[i].type == SLANG_OPER_LITERAL_BOOL); - } - - if (oper->num_children == 2 && isFloat[0] && isFloat[1]) { - /* probably simple arithmetic */ - switch (oper->type) { - case SLANG_OPER_ADD: - for (i = 0; i < 4; i++) { - oper->literal[i] - = oper->children[0].literal[i] + oper->children[1].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - oper->type = literal_type(oper->children[0].type, - oper->children[1].type); - slang_operation_destruct(oper); /* frees unused children */ - return; - case SLANG_OPER_SUBTRACT: - for (i = 0; i < 4; i++) { - oper->literal[i] - = oper->children[0].literal[i] - oper->children[1].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - oper->type = literal_type(oper->children[0].type, - oper->children[1].type); - slang_operation_destruct(oper); - return; - case SLANG_OPER_MULTIPLY: - for (i = 0; i < 4; i++) { - oper->literal[i] - = oper->children[0].literal[i] * oper->children[1].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - oper->type = literal_type(oper->children[0].type, - oper->children[1].type); - slang_operation_destruct(oper); - return; - case SLANG_OPER_DIVIDE: - for (i = 0; i < 4; i++) { - oper->literal[i] - = oper->children[0].literal[i] / oper->children[1].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - oper->type = literal_type(oper->children[0].type, - oper->children[1].type); - slang_operation_destruct(oper); - return; - default: - ; /* nothing */ - } - } - - if (oper->num_children == 1 && isFloat[0]) { - switch (oper->type) { - case SLANG_OPER_MINUS: - for (i = 0; i < 4; i++) { - oper->literal[i] = -oper->children[0].literal[i]; - } - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_FLOAT; - return; - case SLANG_OPER_PLUS: - COPY_4V(oper->literal, oper->children[0].literal); - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_FLOAT; - return; - default: - ; /* nothing */ - } - } - - if (oper->num_children == 2 && isBool[0] && isBool[1]) { - /* simple boolean expression */ - switch (oper->type) { - case SLANG_OPER_LOGICALAND: - for (i = 0; i < 4; i++) { - const GLint a = oper->children[0].literal[i] ? 1 : 0; - const GLint b = oper->children[1].literal[i] ? 1 : 0; - oper->literal[i] = (GLfloat) (a && b); - } - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_BOOL; - return; - case SLANG_OPER_LOGICALOR: - for (i = 0; i < 4; i++) { - const GLint a = oper->children[0].literal[i] ? 1 : 0; - const GLint b = oper->children[1].literal[i] ? 1 : 0; - oper->literal[i] = (GLfloat) (a || b); - } - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_BOOL; - return; - case SLANG_OPER_LOGICALXOR: - for (i = 0; i < 4; i++) { - const GLint a = oper->children[0].literal[i] ? 1 : 0; - const GLint b = oper->children[1].literal[i] ? 1 : 0; - oper->literal[i] = (GLfloat) (a ^ b); - } - oper->literal_size = oper->children[0].literal_size; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_BOOL; - return; - default: - ; /* nothing */ - } - } - - if (oper->num_children == 4 - && isFloat[0] && isFloat[1] && isFloat[2] && isFloat[3]) { - /* vec4(flt, flt, flt, flt) constructor */ - if (oper->type == SLANG_OPER_CALL) { - if (strcmp((char *) oper->a_id, "vec4") == 0) { - oper->literal[0] = oper->children[0].literal[0]; - oper->literal[1] = oper->children[1].literal[0]; - oper->literal[2] = oper->children[2].literal[0]; - oper->literal[3] = oper->children[3].literal[0]; - oper->literal_size = 4; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_FLOAT; - return; - } - } - } - - if (oper->num_children == 3 && isFloat[0] && isFloat[1] && isFloat[2]) { - /* vec3(flt, flt, flt) constructor */ - if (oper->type == SLANG_OPER_CALL) { - if (strcmp((char *) oper->a_id, "vec3") == 0) { - oper->literal[0] = oper->children[0].literal[0]; - oper->literal[1] = oper->children[1].literal[0]; - oper->literal[2] = oper->children[2].literal[0]; - oper->literal[3] = oper->literal[2]; - oper->literal_size = 3; - slang_operation_destruct(oper); - oper->type = SLANG_OPER_LITERAL_FLOAT; - return; - } - } - } - - if (oper->num_children == 2 && isFloat[0] && isFloat[1]) { - /* vec2(flt, flt) constructor */ - if (oper->type == SLANG_OPER_CALL) { - if (strcmp((char *) oper->a_id, "vec2") == 0) { - oper->literal[0] = oper->children[0].literal[0]; - oper->literal[1] = oper->children[1].literal[0]; - oper->literal[2] = oper->literal[1]; - oper->literal[3] = oper->literal[1]; - oper->literal_size = 2; - slang_operation_destruct(oper); /* XXX oper->locals goes NULL! */ - oper->type = SLANG_OPER_LITERAL_FLOAT; - assert(oper->num_children == 0); - return; - } - } - } - - if (oper->num_children == 1 && isFloat[0]) { - /* vec2/3/4(flt, flt) constructor */ - if (oper->type == SLANG_OPER_CALL) { - const char *func = (const char *) oper->a_id; - if (strncmp(func, "vec", 3) == 0 && func[3] >= '2' && func[3] <= '4') { - oper->literal[0] = - oper->literal[1] = - oper->literal[2] = - oper->literal[3] = oper->children[0].literal[0]; - oper->literal_size = func[3] - '0'; - assert(oper->literal_size >= 2); - assert(oper->literal_size <= 4); - slang_operation_destruct(oper); /* XXX oper->locals goes NULL! */ - oper->type = SLANG_OPER_LITERAL_FLOAT; - assert(oper->num_children == 0); - return; - } - } - } -} - - - -/** - * Insert casts to try to adapt actual parameters to formal parameters for a - * function call when an exact match for the parameter types is not found. - * Example: - * void foo(int i, bool b) {} - * x = foo(3.15, 9); - * Gets translated into: - * x = foo(int(3.15), bool(9)) - */ -GLboolean -_slang_cast_func_params(slang_operation *callOper, const slang_function *fun, - const slang_name_space * space, - slang_atom_pool * atoms, slang_info_log *log) -{ - const GLboolean haveRetValue = _slang_function_has_return_value(fun); - const int numParams = fun->param_count - haveRetValue; - int i; - int dbg = 0; - - if (dbg) - printf("Adapt call of %d args to func %s (%d params)\n", - callOper->num_children, (char*) fun->header.a_name, numParams); - - for (i = 0; i < numParams; i++) { - slang_typeinfo argType; - slang_variable *paramVar = fun->parameters->variables[i]; - - /* Get type of arg[i] */ - if (!slang_typeinfo_construct(&argType)) - return GL_FALSE; - if (!_slang_typeof_operation(&callOper->children[i], space, - &argType, atoms, log)) { - slang_typeinfo_destruct(&argType); - return GL_FALSE; - } - - /* see if arg type matches parameter type */ - if (!slang_type_specifier_equal(&argType.spec, - ¶mVar->type.specifier)) { - /* need to adapt arg type to match param type */ - const char *constructorName = - slang_type_specifier_type_to_string(paramVar->type.specifier.type); - slang_operation *child = slang_operation_new(1); - - if (dbg) - printf("Need to adapt types of arg %d\n", i); - - slang_operation_copy(child, &callOper->children[i]); - child->locals->outer_scope = callOper->children[i].locals; - -#if 0 - if (_slang_sizeof_type_specifier(&argType.spec) > - _slang_sizeof_type_specifier(¶mVar->type.specifier)) { - } -#endif - - callOper->children[i].type = SLANG_OPER_CALL; - callOper->children[i].a_id = slang_atom_pool_atom(atoms, constructorName); - callOper->children[i].num_children = 1; - callOper->children[i].children = child; - } - - slang_typeinfo_destruct(&argType); - } - - if (dbg) { - printf("===== New call to %s with cast arguments ===============\n", - (char*) fun->header.a_name); - slang_print_tree(callOper, 5); - } - - return GL_TRUE; -} - - -/** - * Adapt the arguments for a function call to match the parameters of - * the given function. - * This is for: - * 1. converting/casting argument types to match parameters - * 2. breaking up vector/matrix types into individual components to - * satisfy constructors. - */ -GLboolean -_slang_adapt_call(slang_operation *callOper, const slang_function *fun, - const slang_name_space * space, - slang_atom_pool * atoms, slang_info_log *log) -{ - const GLboolean haveRetValue = _slang_function_has_return_value(fun); - const int numParams = fun->param_count - haveRetValue; - int i; - int dbg = 0; - - if (dbg) - printf("Adapt %d args to %d parameters for %s\n", - callOper->num_children, numParams, (char *) fun->header.a_name); - - /* Only try adapting for constructors */ - if (fun->kind != SLANG_FUNC_CONSTRUCTOR) - return GL_FALSE; - - if (callOper->num_children != numParams) { - /* number of arguments doesn't match number of parameters */ - - /* For constructor calls, we can try to unroll vector/matrix args - * into individual floats/ints and try to match the function params. - */ - for (i = 0; i < numParams; i++) { - slang_typeinfo argType; - GLint argSz, j; - - /* Get type of arg[i] */ - if (!slang_typeinfo_construct(&argType)) - return GL_FALSE; - if (!_slang_typeof_operation(&callOper->children[i], space, - &argType, atoms, log)) { - slang_typeinfo_destruct(&argType); - return GL_FALSE; - } - - /* - paramSz = _slang_sizeof_type_specifier(¶mVar->type.specifier); - assert(paramSz == 1); - */ - argSz = _slang_sizeof_type_specifier(&argType.spec); - if (argSz > 1) { - slang_operation origArg; - /* break up arg[i] into components */ - if (dbg) - printf("Break up arg %d from 1 to %d elements\n", i, argSz); - - slang_operation_construct(&origArg); - slang_operation_copy(&origArg, &callOper->children[i]); - - /* insert argSz-1 new children/args */ - for (j = 0; j < argSz - 1; j++) { - (void) slang_operation_insert(&callOper->num_children, - &callOper->children, i); - } - - /* replace arg[i+j] with subscript/index oper */ - for (j = 0; j < argSz; j++) { - callOper->children[i + j].type = SLANG_OPER_SUBSCRIPT; - callOper->children[i + j].locals = _slang_variable_scope_new(callOper->locals); - callOper->children[i + j].num_children = 2; - callOper->children[i + j].children = slang_operation_new(2); - slang_operation_copy(&callOper->children[i + j].children[0], - &origArg); - callOper->children[i + j].children[1].type - = SLANG_OPER_LITERAL_INT; - callOper->children[i + j].children[1].literal[0] = (GLfloat) j; - } - } - } - } - - if (callOper->num_children < (GLuint) numParams) { - /* still not enough args for all params */ - return GL_FALSE; - } - else if (callOper->num_children > (GLuint) numParams) { - /* now too many arguments */ - /* just truncate */ - callOper->num_children = (GLuint) numParams; - } - - if (dbg) { - printf("===== New call to %s with adapted arguments ===============\n", - (char*) fun->header.a_name); - slang_print_tree(callOper, 5); - } - - return GL_TRUE; -} diff --git a/mesalib/src/mesa/shader/slang/slang_simplify.h b/mesalib/src/mesa/shader/slang/slang_simplify.h deleted file mode 100644 index 8689c23b1..000000000 --- a/mesalib/src/mesa/shader/slang/slang_simplify.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 7.1 - * - * Copyright (C) 2005-2008 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SLANG_SIMPLIFY_H -#define SLANG_SIMPLIFY_H - - -extern GLint -_slang_lookup_constant(const char *name); - - -extern void -_slang_simplify(slang_operation *oper, - const slang_name_space * space, - slang_atom_pool * atoms); - - -extern GLboolean -_slang_cast_func_params(slang_operation *callOper, const slang_function *fun, - const slang_name_space * space, - slang_atom_pool * atoms, slang_info_log *log); - -extern GLboolean -_slang_adapt_call(slang_operation *callOper, const slang_function *fun, - const slang_name_space * space, - slang_atom_pool * atoms, slang_info_log *log); - - -#endif /* SLANG_SIMPLIFY_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_storage.c b/mesalib/src/mesa/shader/slang/slang_storage.c deleted file mode 100644 index 656e15670..000000000 --- a/mesalib/src/mesa/shader/slang/slang_storage.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_storage.c - * slang variable storage - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_storage.h" -#include "slang_mem.h" - -/* slang_storage_array */ - -GLboolean -slang_storage_array_construct(slang_storage_array * arr) -{ - arr->type = SLANG_STORE_AGGREGATE; - arr->aggregate = NULL; - arr->length = 0; - return GL_TRUE; -} - -GLvoid -slang_storage_array_destruct(slang_storage_array * arr) -{ - if (arr->aggregate != NULL) { - slang_storage_aggregate_destruct(arr->aggregate); - _slang_free(arr->aggregate); - } -} - -/* slang_storage_aggregate */ - -GLboolean -slang_storage_aggregate_construct(slang_storage_aggregate * agg) -{ - agg->arrays = NULL; - agg->count = 0; - return GL_TRUE; -} - -GLvoid -slang_storage_aggregate_destruct(slang_storage_aggregate * agg) -{ - GLuint i; - - for (i = 0; i < agg->count; i++) - slang_storage_array_destruct(agg->arrays + i); - _slang_free(agg->arrays); -} - -static slang_storage_array * -slang_storage_aggregate_push_new(slang_storage_aggregate * agg) -{ - slang_storage_array *arr = NULL; - - agg->arrays = (slang_storage_array *) - _slang_realloc(agg->arrays, - agg->count * sizeof(slang_storage_array), - (agg->count + 1) * sizeof(slang_storage_array)); - if (agg->arrays != NULL) { - arr = agg->arrays + agg->count; - if (!slang_storage_array_construct(arr)) - return NULL; - agg->count++; - } - return arr; -} - -/* _slang_aggregate_variable() */ - -static GLboolean -aggregate_vector(slang_storage_aggregate * agg, slang_storage_type basic_type, - GLuint row_count) -{ - slang_storage_array *arr = slang_storage_aggregate_push_new(agg); - if (arr == NULL) - return GL_FALSE; - arr->type = basic_type; - arr->length = row_count; - return GL_TRUE; -} - -static GLboolean -aggregate_matrix(slang_storage_aggregate * agg, slang_storage_type basic_type, - GLuint columns, GLuint rows) -{ - slang_storage_array *arr = slang_storage_aggregate_push_new(agg); - if (arr == NULL) - return GL_FALSE; - arr->type = SLANG_STORE_AGGREGATE; - arr->length = columns; - arr->aggregate = (slang_storage_aggregate *) - _slang_alloc(sizeof(slang_storage_aggregate)); - if (arr->aggregate == NULL) - return GL_FALSE; - if (!slang_storage_aggregate_construct(arr->aggregate)) { - _slang_free(arr->aggregate); - arr->aggregate = NULL; - return GL_FALSE; - } - if (!aggregate_vector(arr->aggregate, basic_type, rows)) - return GL_FALSE; - return GL_TRUE; -} - - -static GLboolean -aggregate_variables(slang_storage_aggregate * agg, - slang_variable_scope * vars, slang_function_scope * funcs, - slang_struct_scope * structs, - slang_variable_scope * globals, - slang_atom_pool * atoms) -{ - GLuint i; - - for (i = 0; i < vars->num_variables; i++) - if (!_slang_aggregate_variable(agg, &vars->variables[i]->type.specifier, - vars->variables[i]->array_len, funcs, - structs, globals, atoms)) - return GL_FALSE; - return GL_TRUE; -} - - -GLboolean -_slang_aggregate_variable(slang_storage_aggregate * agg, - slang_type_specifier * spec, GLuint array_len, - slang_function_scope * funcs, - slang_struct_scope * structs, - slang_variable_scope * vars, - slang_atom_pool * atoms) -{ - switch (spec->type) { - case SLANG_SPEC_BOOL: - return aggregate_vector(agg, SLANG_STORE_BOOL, 1); - case SLANG_SPEC_BVEC2: - return aggregate_vector(agg, SLANG_STORE_BOOL, 2); - case SLANG_SPEC_BVEC3: - return aggregate_vector(agg, SLANG_STORE_BOOL, 3); - case SLANG_SPEC_BVEC4: - return aggregate_vector(agg, SLANG_STORE_BOOL, 4); - case SLANG_SPEC_INT: - return aggregate_vector(agg, SLANG_STORE_INT, 1); - case SLANG_SPEC_IVEC2: - return aggregate_vector(agg, SLANG_STORE_INT, 2); - case SLANG_SPEC_IVEC3: - return aggregate_vector(agg, SLANG_STORE_INT, 3); - case SLANG_SPEC_IVEC4: - return aggregate_vector(agg, SLANG_STORE_INT, 4); - case SLANG_SPEC_FLOAT: - return aggregate_vector(agg, SLANG_STORE_FLOAT, 1); - case SLANG_SPEC_VEC2: - return aggregate_vector(agg, SLANG_STORE_FLOAT, 2); - case SLANG_SPEC_VEC3: - return aggregate_vector(agg, SLANG_STORE_FLOAT, 3); - case SLANG_SPEC_VEC4: - return aggregate_vector(agg, SLANG_STORE_FLOAT, 4); - case SLANG_SPEC_MAT2: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 2); - case SLANG_SPEC_MAT3: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 3); - case SLANG_SPEC_MAT4: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 4); - - case SLANG_SPEC_MAT23: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 3); - case SLANG_SPEC_MAT32: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 2); - case SLANG_SPEC_MAT24: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 2, 4); - case SLANG_SPEC_MAT42: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 2); - case SLANG_SPEC_MAT34: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 3, 4); - case SLANG_SPEC_MAT43: - return aggregate_matrix(agg, SLANG_STORE_FLOAT, 4, 3); - - case SLANG_SPEC_SAMPLER_1D: - case SLANG_SPEC_SAMPLER_2D: - case SLANG_SPEC_SAMPLER_3D: - case SLANG_SPEC_SAMPLER_CUBE: - case SLANG_SPEC_SAMPLER_1D_SHADOW: - case SLANG_SPEC_SAMPLER_2D_SHADOW: - case SLANG_SPEC_SAMPLER_RECT: - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - case SLANG_SPEC_SAMPLER_1D_ARRAY: - case SLANG_SPEC_SAMPLER_2D_ARRAY: - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - - return aggregate_vector(agg, SLANG_STORE_INT, 1); - case SLANG_SPEC_STRUCT: - return aggregate_variables(agg, spec->_struct->fields, funcs, structs, - vars, atoms); - case SLANG_SPEC_ARRAY: - { - slang_storage_array *arr; - - arr = slang_storage_aggregate_push_new(agg); - if (arr == NULL) - return GL_FALSE; - arr->type = SLANG_STORE_AGGREGATE; - arr->aggregate = (slang_storage_aggregate *) - _slang_alloc(sizeof(slang_storage_aggregate)); - if (arr->aggregate == NULL) - return GL_FALSE; - if (!slang_storage_aggregate_construct(arr->aggregate)) { - _slang_free(arr->aggregate); - arr->aggregate = NULL; - return GL_FALSE; - } - if (!_slang_aggregate_variable(arr->aggregate, spec->_array, 0, - funcs, structs, vars, atoms)) - return GL_FALSE; - arr->length = array_len; - /* TODO: check if 0 < arr->length <= 65535 */ - } - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -GLuint -_slang_sizeof_type(slang_storage_type type) -{ - if (type == SLANG_STORE_AGGREGATE) - return 0; - if (type == SLANG_STORE_VEC4) - return 4 * sizeof(GLfloat); - return sizeof(GLfloat); -} - - -GLuint -_slang_sizeof_aggregate(const slang_storage_aggregate * agg) -{ - GLuint i, size = 0; - - for (i = 0; i < agg->count; i++) { - slang_storage_array *arr = &agg->arrays[i]; - GLuint element_size; - - if (arr->type == SLANG_STORE_AGGREGATE) - element_size = _slang_sizeof_aggregate(arr->aggregate); - else - element_size = _slang_sizeof_type(arr->type); - size += element_size * arr->length; - } - return size; -} - - -#if 0 -GLboolean -_slang_flatten_aggregate(slang_storage_aggregate * flat, - const slang_storage_aggregate * agg) -{ - GLuint i; - - for (i = 0; i < agg->count; i++) { - GLuint j; - - for (j = 0; j < agg->arrays[i].length; j++) { - if (agg->arrays[i].type == SLANG_STORE_AGGREGATE) { - if (!_slang_flatten_aggregate(flat, agg->arrays[i].aggregate)) - return GL_FALSE; - } - else { - GLuint k, count; - slang_storage_type type; - - if (agg->arrays[i].type == SLANG_STORE_VEC4) { - count = 4; - type = SLANG_STORE_FLOAT; - } - else { - count = 1; - type = agg->arrays[i].type; - } - - for (k = 0; k < count; k++) { - slang_storage_array *arr; - - arr = slang_storage_aggregate_push_new(flat); - if (arr == NULL) - return GL_FALSE; - arr->type = type; - arr->length = 1; - } - } - } - } - return GL_TRUE; -} -#endif diff --git a/mesalib/src/mesa/shader/slang/slang_storage.h b/mesalib/src/mesa/shader/slang/slang_storage.h deleted file mode 100644 index 1876a36dd..000000000 --- a/mesalib/src/mesa/shader/slang/slang_storage.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SLANG_STORAGE_H -#define SLANG_STORAGE_H - -#include "slang_compile.h" - - -/* - * Program variable data storage is kept completely transparent to the - * front-end compiler. It is up to the back-end how the data is - * actually allocated. The slang_storage_type enum provides the basic - * information about how the memory is interpreted. This abstract - * piece of memory is called a data slot. A data slot of a particular - * type has a fixed size. - * - * For now, only the three basic types are supported, that is bool, - * int and float. Other built-in types like vector or matrix can - * easily be decomposed into a series of basic types. - * - * If the vec4 module is enabled, 4-component vectors of floats are - * used when possible. 4x4 matrices are constructed of 4 vec4 slots. - */ -typedef enum slang_storage_type_ -{ - /* core */ - SLANG_STORE_AGGREGATE, - SLANG_STORE_BOOL, - SLANG_STORE_INT, - SLANG_STORE_FLOAT, - /* vec4 */ - SLANG_STORE_VEC4 -} slang_storage_type; - - -/** - * The slang_storage_array structure groups data slots of the same - * type into an array. This array has a fixed length. Arrays are - * required to have a size equal to the sum of sizes of its - * elements. They are also required to support indirect - * addressing. That is, if B references first data slot in the array, - * S is the size of the data slot and I is the integral index that is - * not known at compile time, B+I*S references I-th data slot. - * - * This structure is also used to break down built-in data types that - * are not supported directly. Vectors, like vec3, are constructed - * from arrays of their basic types. Matrices are formed of an array - * of column vectors, which are in turn processed as other vectors. - */ -typedef struct slang_storage_array_ -{ - slang_storage_type type; - struct slang_storage_aggregate_ *aggregate; - GLuint length; -} slang_storage_array; - -GLboolean slang_storage_array_construct (slang_storage_array *); -GLvoid slang_storage_array_destruct (slang_storage_array *); - - -/** - * The slang_storage_aggregate structure relaxes the indirect - * addressing requirement for slang_storage_array - * structure. Aggregates are always accessed statically - its member - * addresses are well-known at compile time. For example, user-defined - * types are implemented as aggregates. Aggregates can collect data of - * a different type. - */ -typedef struct slang_storage_aggregate_ -{ - slang_storage_array *arrays; - GLuint count; -} slang_storage_aggregate; - -GLboolean slang_storage_aggregate_construct (slang_storage_aggregate *); -GLvoid slang_storage_aggregate_destruct (slang_storage_aggregate *); - - -extern GLboolean -_slang_aggregate_variable(slang_storage_aggregate *agg, - slang_type_specifier *spec, - GLuint array_len, - slang_function_scope *funcs, - slang_struct_scope *structs, - slang_variable_scope *vars, - slang_atom_pool *atoms); - -/* - * Returns the size (in machine units) of the given storage type. - * It is an error to pass-in SLANG_STORE_AGGREGATE. - * Returns 0 on error. - */ -extern GLuint -_slang_sizeof_type (slang_storage_type); - - -/** - * Returns total size (in machine units) of the given aggregate. - * Returns 0 on error. - */ -extern GLuint -_slang_sizeof_aggregate (const slang_storage_aggregate *); - - -#if 0 -/** - * Converts structured aggregate to a flat one, with arrays of generic - * type being one-element long. Returns GL_TRUE on success. Returns - * GL_FALSE otherwise. - */ -extern GLboolean -_slang_flatten_aggregate (slang_storage_aggregate *, - const slang_storage_aggregate *); - -#endif - -#endif /* SLANG_STORAGE_H */ diff --git a/mesalib/src/mesa/shader/slang/slang_typeinfo.c b/mesalib/src/mesa/shader/slang/slang_typeinfo.c deleted file mode 100644 index 0f96768b0..000000000 --- a/mesalib/src/mesa/shader/slang/slang_typeinfo.c +++ /dev/null @@ -1,1177 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_typeinfo.c - * slang type info - * \author Michal Krol - */ - -#include "main/imports.h" -#include "shader/prog_instruction.h" -#include "slang_typeinfo.h" -#include "slang_compile.h" -#include "slang_log.h" -#include "slang_mem.h" - - -/** - * Checks if a field selector is a general swizzle (an r-value swizzle - * with replicated components or an l-value swizzle mask) for a - * vector. Returns GL_TRUE if this is the case, <swz> is filled with - * swizzle information. Returns GL_FALSE otherwise. - */ -GLboolean -_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle * swz) -{ - GLuint i; - GLboolean xyzw = GL_FALSE, rgba = GL_FALSE, stpq = GL_FALSE; - - /* init to undefined. - * We rely on undefined/nil values to distinguish between - * regular swizzles and writemasks. - * For example, the swizzle ".xNNN" is the writemask ".x". - * That's different than the swizzle ".xxxx". - */ - for (i = 0; i < 4; i++) - swz->swizzle[i] = SWIZZLE_NIL; - - /* the swizzle can be at most 4-component long */ - swz->num_components = slang_string_length(field); - if (swz->num_components > 4) - return GL_FALSE; - - for (i = 0; i < swz->num_components; i++) { - /* mark which swizzle group is used */ - switch (field[i]) { - case 'x': - case 'y': - case 'z': - case 'w': - xyzw = GL_TRUE; - break; - case 'r': - case 'g': - case 'b': - case 'a': - rgba = GL_TRUE; - break; - case 's': - case 't': - case 'p': - case 'q': - stpq = GL_TRUE; - break; - default: - return GL_FALSE; - } - - /* collect swizzle component */ - switch (field[i]) { - case 'x': - case 'r': - case 's': - swz->swizzle[i] = 0; - break; - case 'y': - case 'g': - case 't': - swz->swizzle[i] = 1; - break; - case 'z': - case 'b': - case 'p': - swz->swizzle[i] = 2; - break; - case 'w': - case 'a': - case 'q': - swz->swizzle[i] = 3; - break; - } - - /* check if the component is valid for given vector's row count */ - if (rows <= swz->swizzle[i]) - return GL_FALSE; - } - - /* only one swizzle group can be used */ - if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq)) - return GL_FALSE; - - return GL_TRUE; -} - - - -/** - * Checks if a general swizzle is an l-value swizzle - these swizzles - * do not have duplicated fields. Returns GL_TRUE if this is a - * swizzle mask. Returns GL_FALSE otherwise - */ -static GLboolean -_slang_is_swizzle_mask(const slang_swizzle * swz, GLuint rows) -{ - GLuint i, c = 0; - - /* the swizzle may not be longer than the vector dim */ - if (swz->num_components > rows) - return GL_FALSE; - - /* the swizzle components cannot be duplicated */ - for (i = 0; i < swz->num_components; i++) { - if ((c & (1 << swz->swizzle[i])) != 0) - return GL_FALSE; - c |= 1 << swz->swizzle[i]; - } - - return GL_TRUE; -} - - -/** - * Combines (multiplies) two swizzles to form single swizzle. - * Example: "vec.wzyx.yx" --> "vec.zw". - */ -static void -_slang_multiply_swizzles(slang_swizzle * dst, const slang_swizzle * left, - const slang_swizzle * right) -{ - GLuint i; - - dst->num_components = right->num_components; - for (i = 0; i < right->num_components; i++) - dst->swizzle[i] = left->swizzle[right->swizzle[i]]; -} - - -typedef struct -{ - const char *name; - slang_type_specifier_type type; -} type_specifier_type_name; - -static const type_specifier_type_name type_specifier_type_names[] = { - {"void", SLANG_SPEC_VOID}, - {"bool", SLANG_SPEC_BOOL}, - {"bvec2", SLANG_SPEC_BVEC2}, - {"bvec3", SLANG_SPEC_BVEC3}, - {"bvec4", SLANG_SPEC_BVEC4}, - {"int", SLANG_SPEC_INT}, - {"ivec2", SLANG_SPEC_IVEC2}, - {"ivec3", SLANG_SPEC_IVEC3}, - {"ivec4", SLANG_SPEC_IVEC4}, - {"float", SLANG_SPEC_FLOAT}, - {"vec2", SLANG_SPEC_VEC2}, - {"vec3", SLANG_SPEC_VEC3}, - {"vec4", SLANG_SPEC_VEC4}, - {"mat2", SLANG_SPEC_MAT2}, - {"mat3", SLANG_SPEC_MAT3}, - {"mat4", SLANG_SPEC_MAT4}, - {"mat2x3", SLANG_SPEC_MAT23}, - {"mat3x2", SLANG_SPEC_MAT32}, - {"mat2x4", SLANG_SPEC_MAT24}, - {"mat4x2", SLANG_SPEC_MAT42}, - {"mat3x4", SLANG_SPEC_MAT34}, - {"mat4x3", SLANG_SPEC_MAT43}, - {"sampler1D", SLANG_SPEC_SAMPLER_1D}, - {"sampler2D", SLANG_SPEC_SAMPLER_2D}, - {"sampler3D", SLANG_SPEC_SAMPLER_3D}, - {"samplerCube", SLANG_SPEC_SAMPLER_CUBE}, - {"sampler1DShadow", SLANG_SPEC_SAMPLER_1D_SHADOW}, - {"sampler2DShadow", SLANG_SPEC_SAMPLER_2D_SHADOW}, - {"sampler2DRect", SLANG_SPEC_SAMPLER_RECT}, - {"sampler2DRectShadow", SLANG_SPEC_SAMPLER_RECT_SHADOW}, - {"sampler1DArray", SLANG_SPEC_SAMPLER_1D_ARRAY}, - {"sampler2DArray", SLANG_SPEC_SAMPLER_2D_ARRAY}, - {"sampler1DArrayShadow", SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW}, - {"sampler2DArrayShadow", SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW}, - {NULL, SLANG_SPEC_VOID} -}; - -slang_type_specifier_type -slang_type_specifier_type_from_string(const char *name) -{ - const type_specifier_type_name *p = type_specifier_type_names; - while (p->name != NULL) { - if (slang_string_compare(p->name, name) == 0) - break; - p++; - } - return p->type; -} - -const char * -slang_type_specifier_type_to_string(slang_type_specifier_type type) -{ - const type_specifier_type_name *p = type_specifier_type_names; - while (p->name != NULL) { - if (p->type == type) - break; - p++; - } - return p->name; -} - -/* slang_fully_specified_type */ - -int -slang_fully_specified_type_construct(slang_fully_specified_type * type) -{ - type->qualifier = SLANG_QUAL_NONE; - slang_type_specifier_ctr(&type->specifier); - return 1; -} - -void -slang_fully_specified_type_destruct(slang_fully_specified_type * type) -{ - slang_type_specifier_dtr(&type->specifier); -} - -int -slang_fully_specified_type_copy(slang_fully_specified_type * x, - const slang_fully_specified_type * y) -{ - slang_fully_specified_type z; - - if (!slang_fully_specified_type_construct(&z)) - return 0; - z.qualifier = y->qualifier; - z.precision = y->precision; - z.variant = y->variant; - z.centroid = y->centroid; - z.layout = y->layout; - z.array_len = y->array_len; - if (!slang_type_specifier_copy(&z.specifier, &y->specifier)) { - slang_fully_specified_type_destruct(&z); - return 0; - } - slang_fully_specified_type_destruct(x); - *x = z; - return 1; -} - - -/** - * Test if two fully specified types are compatible. This is a bit - * looser than testing for equality. We don't check the precision, - * variant, centroid, etc. information. - * XXX this may need some tweaking. - */ -GLboolean -slang_fully_specified_types_compatible(const slang_fully_specified_type * x, - const slang_fully_specified_type * y) -{ - if (!slang_type_specifier_equal(&x->specifier, &y->specifier)) - return GL_FALSE; - - if (x->qualifier == SLANG_QUAL_FIXEDINPUT && - y->qualifier == SLANG_QUAL_VARYING) - ; /* ok */ - else if (x->qualifier != y->qualifier) - return GL_FALSE; - - /* Note: don't compare precision, variant, centroid */ - - /* XXX array length? */ - - return GL_TRUE; -} - - -GLvoid -slang_type_specifier_ctr(slang_type_specifier * self) -{ - self->type = SLANG_SPEC_VOID; - self->_struct = NULL; - self->_array = NULL; -} - -GLvoid -slang_type_specifier_dtr(slang_type_specifier * self) -{ - if (self->_struct != NULL) { - slang_struct_destruct(self->_struct); - _slang_free(self->_struct); - } - if (self->_array != NULL) { - slang_type_specifier_dtr(self->_array); - _slang_free(self->_array); - } -} - -slang_type_specifier * -slang_type_specifier_new(slang_type_specifier_type type, - struct slang_struct_ *_struct, - struct slang_type_specifier_ *_array) -{ - slang_type_specifier *spec = - (slang_type_specifier *) _slang_alloc(sizeof(slang_type_specifier)); - if (spec) { - spec->type = type; - spec->_struct = _struct; - spec->_array = _array; - } - return spec; -} - -GLboolean -slang_type_specifier_copy(slang_type_specifier * x, - const slang_type_specifier * y) -{ - slang_type_specifier z; - - slang_type_specifier_ctr(&z); - z.type = y->type; - if (z.type == SLANG_SPEC_STRUCT) { - z._struct = (slang_struct *) _slang_alloc(sizeof(slang_struct)); - if (z._struct == NULL) { - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - if (!slang_struct_construct(z._struct)) { - _slang_free(z._struct); - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - if (!slang_struct_copy(z._struct, y->_struct)) { - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - } - else if (z.type == SLANG_SPEC_ARRAY) { - z._array = (slang_type_specifier *) - _slang_alloc(sizeof(slang_type_specifier)); - if (z._array == NULL) { - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - slang_type_specifier_ctr(z._array); - if (!slang_type_specifier_copy(z._array, y->_array)) { - slang_type_specifier_dtr(&z); - return GL_FALSE; - } - } - slang_type_specifier_dtr(x); - *x = z; - return GL_TRUE; -} - - -/** - * Test if two types are equal. - */ -GLboolean -slang_type_specifier_equal(const slang_type_specifier * x, - const slang_type_specifier * y) -{ - if (x->type != y->type) - return GL_FALSE; - if (x->type == SLANG_SPEC_STRUCT) - return slang_struct_equal(x->_struct, y->_struct); - if (x->type == SLANG_SPEC_ARRAY) - return slang_type_specifier_equal(x->_array, y->_array); - return GL_TRUE; -} - - -/** - * As above, but allow float/int casting. - */ -GLboolean -slang_type_specifier_compatible(const slang_type_specifier * x, - const slang_type_specifier * y) -{ - /* special case: float == int */ - if (x->type == SLANG_SPEC_INT && y->type == SLANG_SPEC_FLOAT) { - return GL_TRUE; - } - /* XXX may need to add bool/int compatibility, etc */ - - if (x->type != y->type) - return GL_FALSE; - if (x->type == SLANG_SPEC_STRUCT) - return slang_struct_equal(x->_struct, y->_struct); - if (x->type == SLANG_SPEC_ARRAY) - return slang_type_specifier_compatible(x->_array, y->_array); - return GL_TRUE; -} - - -GLboolean -slang_typeinfo_construct(slang_typeinfo * ti) -{ - memset(ti, 0, sizeof(*ti)); - slang_type_specifier_ctr(&ti->spec); - ti->array_len = 0; - return GL_TRUE; -} - -GLvoid -slang_typeinfo_destruct(slang_typeinfo * ti) -{ - slang_type_specifier_dtr(&ti->spec); -} - - - -/** - * Determine the return type of a function. - * \param a_name the function name - * \param param function parameters (overloading) - * \param num_params number of parameters to function - * \param space namespace to search - * \param spec returns the type - * \param funFound returns pointer to the function, or NULL if not found. - * \return GL_TRUE for success, GL_FALSE if failure (bad function name) - */ -static GLboolean -_slang_typeof_function(slang_atom a_name, - slang_operation * params, GLuint num_params, - const slang_name_space * space, - slang_type_specifier * spec, - slang_function **funFound, - slang_atom_pool *atoms, slang_info_log *log) -{ - GLboolean error; - - *funFound = _slang_function_locate(space->funcs, a_name, params, - num_params, space, atoms, log, &error); - if (error) - return GL_FALSE; - - if (!*funFound) - return GL_TRUE; /* yes, not false */ - - return slang_type_specifier_copy(spec, &(*funFound)->header.type.specifier); -} - - -/** - * Determine the type of a math function. - * \param name name of the operator, one of +,-,*,/ or unary - - * \param params array of function parameters - * \param num_params number of parameters - * \param space namespace to use - * \param spec returns the function's type - * \param atoms atom pool - * \return GL_TRUE for success, GL_FALSE if failure - */ -static GLboolean -typeof_math_call(const char *name, slang_operation *call, - const slang_name_space * space, - slang_type_specifier * spec, - slang_atom_pool * atoms, - slang_info_log *log) -{ - if (call->fun) { - /* we've previously resolved this function call */ - slang_type_specifier_copy(spec, &call->fun->header.type.specifier); - return GL_TRUE; - } - else { - slang_atom atom; - slang_function *fun; - - /* number of params: */ - assert(call->num_children == 1 || call->num_children == 2); - - atom = slang_atom_pool_atom(atoms, name); - if (!_slang_typeof_function(atom, call->children, call->num_children, - space, spec, &fun, atoms, log)) - return GL_FALSE; - - if (fun) { - /* Save pointer to save time in future */ - call->fun = fun; - return GL_TRUE; - } - return GL_FALSE; - } -} - - -/** - * Determine the return type of an operation. - * \param op the operation node - * \param space the namespace to use - * \param ti the returned type - * \param atoms atom pool - * \return GL_TRUE for success, GL_FALSE if failure - */ -GLboolean -_slang_typeof_operation(slang_operation * op, - const slang_name_space * space, - slang_typeinfo * ti, - slang_atom_pool * atoms, - slang_info_log *log) -{ - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - - switch (op->type) { - case SLANG_OPER_BLOCK_NO_NEW_SCOPE: - case SLANG_OPER_BLOCK_NEW_SCOPE: - case SLANG_OPER_ASM: - case SLANG_OPER_BREAK: - case SLANG_OPER_CONTINUE: - case SLANG_OPER_DISCARD: - case SLANG_OPER_RETURN: - case SLANG_OPER_IF: - case SLANG_OPER_WHILE: - case SLANG_OPER_DO: - case SLANG_OPER_FOR: - case SLANG_OPER_VOID: - ti->spec.type = SLANG_SPEC_VOID; - break; - case SLANG_OPER_EXPRESSION: - case SLANG_OPER_ASSIGN: - case SLANG_OPER_ADDASSIGN: - case SLANG_OPER_SUBASSIGN: - case SLANG_OPER_MULASSIGN: - case SLANG_OPER_DIVASSIGN: - case SLANG_OPER_PREINCREMENT: - case SLANG_OPER_PREDECREMENT: - if (!_slang_typeof_operation(op->children, space, ti, atoms, log)) - return GL_FALSE; - break; - case SLANG_OPER_LITERAL_BOOL: - if (op->literal_size == 1) - ti->spec.type = SLANG_SPEC_BOOL; - else if (op->literal_size == 2) - ti->spec.type = SLANG_SPEC_BVEC2; - else if (op->literal_size == 3) - ti->spec.type = SLANG_SPEC_BVEC3; - else if (op->literal_size == 4) - ti->spec.type = SLANG_SPEC_BVEC4; - else { - _mesa_problem(NULL, - "Unexpected bool literal_size %d in _slang_typeof_operation()", - op->literal_size); - ti->spec.type = SLANG_SPEC_BOOL; - } - break; - case SLANG_OPER_LOGICALOR: - case SLANG_OPER_LOGICALXOR: - case SLANG_OPER_LOGICALAND: - case SLANG_OPER_EQUAL: - case SLANG_OPER_NOTEQUAL: - case SLANG_OPER_LESS: - case SLANG_OPER_GREATER: - case SLANG_OPER_LESSEQUAL: - case SLANG_OPER_GREATEREQUAL: - case SLANG_OPER_NOT: - ti->spec.type = SLANG_SPEC_BOOL; - break; - case SLANG_OPER_LITERAL_INT: - if (op->literal_size == 1) - ti->spec.type = SLANG_SPEC_INT; - else if (op->literal_size == 2) - ti->spec.type = SLANG_SPEC_IVEC2; - else if (op->literal_size == 3) - ti->spec.type = SLANG_SPEC_IVEC3; - else if (op->literal_size == 4) - ti->spec.type = SLANG_SPEC_IVEC4; - else { - _mesa_problem(NULL, - "Unexpected int literal_size %d in _slang_typeof_operation()", - op->literal_size); - ti->spec.type = SLANG_SPEC_INT; - } - break; - case SLANG_OPER_LITERAL_FLOAT: - if (op->literal_size == 1) - ti->spec.type = SLANG_SPEC_FLOAT; - else if (op->literal_size == 2) - ti->spec.type = SLANG_SPEC_VEC2; - else if (op->literal_size == 3) - ti->spec.type = SLANG_SPEC_VEC3; - else if (op->literal_size == 4) - ti->spec.type = SLANG_SPEC_VEC4; - else { - _mesa_problem(NULL, - "Unexpected float literal_size %d in _slang_typeof_operation()", - op->literal_size); - ti->spec.type = SLANG_SPEC_FLOAT; - } - break; - case SLANG_OPER_IDENTIFIER: - case SLANG_OPER_VARIABLE_DECL: - { - slang_variable *var; - var = _slang_variable_locate(op->locals, op->a_id, GL_TRUE); - if (!var) { - slang_info_log_error(log, "undefined variable '%s'", - (char *) op->a_id); - return GL_FALSE; - } - if (!slang_type_specifier_copy(&ti->spec, &var->type.specifier)) { - slang_info_log_memory(log); - return GL_FALSE; - } - ti->can_be_referenced = GL_TRUE; - if (var->type.specifier.type == SLANG_SPEC_ARRAY && - var->type.array_len >= 1) { - /* the datatype is an array, ex: float[3] x; */ - ti->array_len = var->type.array_len; - } - else { - /* the variable is an array, ex: float x[3]; */ - ti->array_len = var->array_len; - } - } - break; - case SLANG_OPER_SEQUENCE: - /* TODO: check [0] and [1] if they match */ - if (!_slang_typeof_operation(&op->children[1], space, ti, atoms, log)) { - return GL_FALSE; - } - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - break; - /*case SLANG_OPER_MODASSIGN: */ - /*case SLANG_OPER_LSHASSIGN: */ - /*case SLANG_OPER_RSHASSIGN: */ - /*case SLANG_OPER_ORASSIGN: */ - /*case SLANG_OPER_XORASSIGN: */ - /*case SLANG_OPER_ANDASSIGN: */ - case SLANG_OPER_SELECT: - /* TODO: check [1] and [2] if they match */ - if (!_slang_typeof_operation(&op->children[1], space, ti, atoms, log)) { - return GL_FALSE; - } - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - break; - /*case SLANG_OPER_BITOR: */ - /*case SLANG_OPER_BITXOR: */ - /*case SLANG_OPER_BITAND: */ - /*case SLANG_OPER_LSHIFT: */ - /*case SLANG_OPER_RSHIFT: */ - case SLANG_OPER_ADD: - assert(op->num_children == 2); - if (!typeof_math_call("+", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - case SLANG_OPER_SUBTRACT: - assert(op->num_children == 2); - if (!typeof_math_call("-", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - case SLANG_OPER_MULTIPLY: - assert(op->num_children == 2); - if (!typeof_math_call("*", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - case SLANG_OPER_DIVIDE: - assert(op->num_children == 2); - if (!typeof_math_call("/", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - /*case SLANG_OPER_MODULUS: */ - case SLANG_OPER_PLUS: - if (!_slang_typeof_operation(op->children, space, ti, atoms, log)) - return GL_FALSE; - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - break; - case SLANG_OPER_MINUS: - assert(op->num_children == 1); - if (!typeof_math_call("-", op, space, &ti->spec, atoms, log)) - return GL_FALSE; - break; - /*case SLANG_OPER_COMPLEMENT: */ - case SLANG_OPER_SUBSCRIPT: - { - slang_typeinfo _ti; - - if (!slang_typeinfo_construct(&_ti)) - return GL_FALSE; - if (!_slang_typeof_operation(op->children, space, &_ti, atoms, log)) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - ti->can_be_referenced = _ti.can_be_referenced; - if (_ti.spec.type == SLANG_SPEC_ARRAY) { - if (!slang_type_specifier_copy(&ti->spec, _ti.spec._array)) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - } - else { - if (!_slang_type_is_vector(_ti.spec.type) - && !_slang_type_is_matrix(_ti.spec.type)) { - slang_typeinfo_destruct(&_ti); - slang_info_log_error(log, "cannot index a non-array type"); - return GL_FALSE; - } - ti->spec.type = _slang_type_base(_ti.spec.type); - } - slang_typeinfo_destruct(&_ti); - } - break; - case SLANG_OPER_CALL: - if (op->array_constructor) { - /* build array typeinfo */ - ti->spec.type = SLANG_SPEC_ARRAY; - ti->spec._array = (slang_type_specifier *) - _slang_alloc(sizeof(slang_type_specifier)); - slang_type_specifier_ctr(ti->spec._array); - - ti->spec._array->type = - slang_type_specifier_type_from_string((char *) op->a_id); - ti->array_len = op->num_children; - } - else if (op->fun) { - /* we've resolved this call before */ - slang_type_specifier_copy(&ti->spec, &op->fun->header.type.specifier); - } - else { - slang_function *fun; - if (!_slang_typeof_function(op->a_id, op->children, op->num_children, - space, &ti->spec, &fun, atoms, log)) - return GL_FALSE; - if (fun) { - /* save result for future use */ - op->fun = fun; - } - else { - slang_struct *s = - slang_struct_scope_find(space->structs, op->a_id, GL_TRUE); - if (s) { - /* struct initializer */ - ti->spec.type = SLANG_SPEC_STRUCT; - ti->spec._struct = - (slang_struct *) _slang_alloc(sizeof(slang_struct)); - if (ti->spec._struct == NULL) - return GL_FALSE; - if (!slang_struct_construct(ti->spec._struct)) { - _slang_free(ti->spec._struct); - ti->spec._struct = NULL; - return GL_FALSE; - } - if (!slang_struct_copy(ti->spec._struct, s)) - return GL_FALSE; - } - else { - /* float, int, vec4, mat3, etc. constructor? */ - const char *name; - slang_type_specifier_type type; - - name = slang_atom_pool_id(atoms, op->a_id); - type = slang_type_specifier_type_from_string(name); - if (type == SLANG_SPEC_VOID) { - slang_info_log_error(log, "undefined function '%s'", name); - return GL_FALSE; - } - ti->spec.type = type; - } - } - } - break; - case SLANG_OPER_METHOD: - /* at this time, GLSL 1.20 only has one method: array.length() - * which returns an integer. - */ - ti->spec.type = SLANG_SPEC_INT; - break; - case SLANG_OPER_FIELD: - { - slang_typeinfo _ti; - - if (!slang_typeinfo_construct(&_ti)) - return GL_FALSE; - if (!_slang_typeof_operation(op->children, space, &_ti, atoms, log)) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - if (_ti.spec.type == SLANG_SPEC_STRUCT) { - slang_variable *field; - - field = _slang_variable_locate(_ti.spec._struct->fields, op->a_id, - GL_FALSE); - if (field == NULL) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - if (!slang_type_specifier_copy(&ti->spec, &field->type.specifier)) { - slang_typeinfo_destruct(&_ti); - return GL_FALSE; - } - ti->can_be_referenced = _ti.can_be_referenced; - ti->array_len = field->array_len; - } - else { - GLuint rows; - const char *swizzle; - slang_type_specifier_type base; - - /* determine the swizzle of the field expression */ - if (!_slang_type_is_vector(_ti.spec.type)) { - slang_typeinfo_destruct(&_ti); - slang_info_log_error(log, "Can't swizzle scalar expression"); - return GL_FALSE; - } - rows = _slang_type_dim(_ti.spec.type); - swizzle = slang_atom_pool_id(atoms, op->a_id); - if (!_slang_is_swizzle(swizzle, rows, &ti->swz)) { - slang_typeinfo_destruct(&_ti); - slang_info_log_error(log, "bad swizzle '%s'", swizzle); - return GL_FALSE; - } - ti->is_swizzled = GL_TRUE; - ti->can_be_referenced = _ti.can_be_referenced - && _slang_is_swizzle_mask(&ti->swz, rows); - if (_ti.is_swizzled) { - slang_swizzle swz; - - /* swizzle the swizzle */ - _slang_multiply_swizzles(&swz, &_ti.swz, &ti->swz); - ti->swz = swz; - } - base = _slang_type_base(_ti.spec.type); - switch (ti->swz.num_components) { - case 1: - ti->spec.type = base; - break; - case 2: - switch (base) { - case SLANG_SPEC_FLOAT: - ti->spec.type = SLANG_SPEC_VEC2; - break; - case SLANG_SPEC_INT: - ti->spec.type = SLANG_SPEC_IVEC2; - break; - case SLANG_SPEC_BOOL: - ti->spec.type = SLANG_SPEC_BVEC2; - break; - default: - break; - } - break; - case 3: - switch (base) { - case SLANG_SPEC_FLOAT: - ti->spec.type = SLANG_SPEC_VEC3; - break; - case SLANG_SPEC_INT: - ti->spec.type = SLANG_SPEC_IVEC3; - break; - case SLANG_SPEC_BOOL: - ti->spec.type = SLANG_SPEC_BVEC3; - break; - default: - break; - } - break; - case 4: - switch (base) { - case SLANG_SPEC_FLOAT: - ti->spec.type = SLANG_SPEC_VEC4; - break; - case SLANG_SPEC_INT: - ti->spec.type = SLANG_SPEC_IVEC4; - break; - case SLANG_SPEC_BOOL: - ti->spec.type = SLANG_SPEC_BVEC4; - break; - default: - break; - } - break; - default: - break; - } - } - slang_typeinfo_destruct(&_ti); - } - break; - case SLANG_OPER_POSTINCREMENT: - case SLANG_OPER_POSTDECREMENT: - if (!_slang_typeof_operation(op->children, space, ti, atoms, log)) - return GL_FALSE; - ti->can_be_referenced = GL_FALSE; - ti->is_swizzled = GL_FALSE; - break; - default: - return GL_FALSE; - } - - return GL_TRUE; -} - - -/** - * Determine if a type is a matrix. - * \return GL_TRUE if is a matrix, GL_FALSE otherwise. - */ -GLboolean -_slang_type_is_matrix(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_MAT2: - case SLANG_SPEC_MAT3: - case SLANG_SPEC_MAT4: - case SLANG_SPEC_MAT23: - case SLANG_SPEC_MAT32: - case SLANG_SPEC_MAT24: - case SLANG_SPEC_MAT42: - case SLANG_SPEC_MAT34: - case SLANG_SPEC_MAT43: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * Determine if a type is a vector. - * \return GL_TRUE if is a vector, GL_FALSE otherwise. - */ -GLboolean -_slang_type_is_vector(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_VEC2: - case SLANG_SPEC_VEC3: - case SLANG_SPEC_VEC4: - case SLANG_SPEC_IVEC2: - case SLANG_SPEC_IVEC3: - case SLANG_SPEC_IVEC4: - case SLANG_SPEC_BVEC2: - case SLANG_SPEC_BVEC3: - case SLANG_SPEC_BVEC4: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * Determine if a type is a float, float vector or float matrix. - * \return GL_TRUE if so, GL_FALSE otherwise - */ -GLboolean -_slang_type_is_float_vec_mat(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_FLOAT: - case SLANG_SPEC_VEC2: - case SLANG_SPEC_VEC3: - case SLANG_SPEC_VEC4: - case SLANG_SPEC_MAT2: - case SLANG_SPEC_MAT3: - case SLANG_SPEC_MAT4: - case SLANG_SPEC_MAT23: - case SLANG_SPEC_MAT32: - case SLANG_SPEC_MAT24: - case SLANG_SPEC_MAT42: - case SLANG_SPEC_MAT34: - case SLANG_SPEC_MAT43: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/** - * Given a vector type, return the type of the vector's elements. - * For a matrix, return the type of the columns. - */ -slang_type_specifier_type -_slang_type_base(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_FLOAT: - case SLANG_SPEC_VEC2: - case SLANG_SPEC_VEC3: - case SLANG_SPEC_VEC4: - return SLANG_SPEC_FLOAT; - case SLANG_SPEC_INT: - case SLANG_SPEC_IVEC2: - case SLANG_SPEC_IVEC3: - case SLANG_SPEC_IVEC4: - return SLANG_SPEC_INT; - case SLANG_SPEC_BOOL: - case SLANG_SPEC_BVEC2: - case SLANG_SPEC_BVEC3: - case SLANG_SPEC_BVEC4: - return SLANG_SPEC_BOOL; - case SLANG_SPEC_MAT2: - return SLANG_SPEC_VEC2; - case SLANG_SPEC_MAT3: - return SLANG_SPEC_VEC3; - case SLANG_SPEC_MAT4: - return SLANG_SPEC_VEC4; - case SLANG_SPEC_MAT23: - return SLANG_SPEC_VEC3; - case SLANG_SPEC_MAT32: - return SLANG_SPEC_VEC2; - case SLANG_SPEC_MAT24: - return SLANG_SPEC_VEC4; - case SLANG_SPEC_MAT42: - return SLANG_SPEC_VEC2; - case SLANG_SPEC_MAT34: - return SLANG_SPEC_VEC4; - case SLANG_SPEC_MAT43: - return SLANG_SPEC_VEC3; - default: - return SLANG_SPEC_VOID; - } -} - - -/** - * Return the dimensionality of a vector, or for a matrix, return number - * of columns. - */ -GLuint -_slang_type_dim(slang_type_specifier_type ty) -{ - switch (ty) { - case SLANG_SPEC_FLOAT: - case SLANG_SPEC_INT: - case SLANG_SPEC_BOOL: - return 1; - case SLANG_SPEC_VEC2: - case SLANG_SPEC_IVEC2: - case SLANG_SPEC_BVEC2: - case SLANG_SPEC_MAT2: - return 2; - case SLANG_SPEC_VEC3: - case SLANG_SPEC_IVEC3: - case SLANG_SPEC_BVEC3: - case SLANG_SPEC_MAT3: - return 3; - case SLANG_SPEC_VEC4: - case SLANG_SPEC_IVEC4: - case SLANG_SPEC_BVEC4: - case SLANG_SPEC_MAT4: - return 4; - - case SLANG_SPEC_MAT23: - return 2; - case SLANG_SPEC_MAT32: - return 3; - case SLANG_SPEC_MAT24: - return 2; - case SLANG_SPEC_MAT42: - return 4; - case SLANG_SPEC_MAT34: - return 3; - case SLANG_SPEC_MAT43: - return 4; - - default: - return 0; - } -} - - -/** - * Return the GL_* type that corresponds to a SLANG_SPEC_* type. - */ -GLenum -_slang_gltype_from_specifier(const slang_type_specifier *type) -{ - switch (type->type) { - case SLANG_SPEC_BOOL: - return GL_BOOL; - case SLANG_SPEC_BVEC2: - return GL_BOOL_VEC2; - case SLANG_SPEC_BVEC3: - return GL_BOOL_VEC3; - case SLANG_SPEC_BVEC4: - return GL_BOOL_VEC4; - case SLANG_SPEC_INT: - return GL_INT; - case SLANG_SPEC_IVEC2: - return GL_INT_VEC2; - case SLANG_SPEC_IVEC3: - return GL_INT_VEC3; - case SLANG_SPEC_IVEC4: - return GL_INT_VEC4; - case SLANG_SPEC_FLOAT: - return GL_FLOAT; - case SLANG_SPEC_VEC2: - return GL_FLOAT_VEC2; - case SLANG_SPEC_VEC3: - return GL_FLOAT_VEC3; - case SLANG_SPEC_VEC4: - return GL_FLOAT_VEC4; - case SLANG_SPEC_MAT2: - return GL_FLOAT_MAT2; - case SLANG_SPEC_MAT3: - return GL_FLOAT_MAT3; - case SLANG_SPEC_MAT4: - return GL_FLOAT_MAT4; - case SLANG_SPEC_MAT23: - return GL_FLOAT_MAT2x3; - case SLANG_SPEC_MAT32: - return GL_FLOAT_MAT3x2; - case SLANG_SPEC_MAT24: - return GL_FLOAT_MAT2x4; - case SLANG_SPEC_MAT42: - return GL_FLOAT_MAT4x2; - case SLANG_SPEC_MAT34: - return GL_FLOAT_MAT3x4; - case SLANG_SPEC_MAT43: - return GL_FLOAT_MAT4x3; - case SLANG_SPEC_SAMPLER_1D: - return GL_SAMPLER_1D; - case SLANG_SPEC_SAMPLER_2D: - return GL_SAMPLER_2D; - case SLANG_SPEC_SAMPLER_3D: - return GL_SAMPLER_3D; - case SLANG_SPEC_SAMPLER_CUBE: - return GL_SAMPLER_CUBE; - case SLANG_SPEC_SAMPLER_1D_SHADOW: - return GL_SAMPLER_1D_SHADOW; - case SLANG_SPEC_SAMPLER_2D_SHADOW: - return GL_SAMPLER_2D_SHADOW; - case SLANG_SPEC_SAMPLER_RECT: - return GL_SAMPLER_2D_RECT_ARB; - case SLANG_SPEC_SAMPLER_RECT_SHADOW: - return GL_SAMPLER_2D_RECT_SHADOW_ARB; - case SLANG_SPEC_SAMPLER_1D_ARRAY: - return GL_SAMPLER_1D_ARRAY_EXT; - case SLANG_SPEC_SAMPLER_2D_ARRAY: - return GL_SAMPLER_2D_ARRAY_EXT; - case SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW: - return GL_SAMPLER_1D_ARRAY_SHADOW_EXT; - case SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW: - return GL_SAMPLER_2D_ARRAY_SHADOW_EXT; - case SLANG_SPEC_ARRAY: - return _slang_gltype_from_specifier(type->_array); - case SLANG_SPEC_STRUCT: - /* fall-through */ - default: - return GL_NONE; - } -} - diff --git a/mesalib/src/mesa/shader/slang/slang_typeinfo.h b/mesalib/src/mesa/shader/slang/slang_typeinfo.h deleted file mode 100644 index 9a6407a31..000000000 --- a/mesalib/src/mesa/shader/slang/slang_typeinfo.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 2005-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SLANG_TYPEINFO_H -#define SLANG_TYPEINFO_H 1 - -#include "main/imports.h" -#include "main/mtypes.h" -#include "slang_log.h" -#include "slang_utility.h" -#include "slang_vartable.h" - - -struct slang_operation_; - -struct slang_name_space_; - - - -/** - * Holds complete information about vector swizzle - the <swizzle> - * array contains vector component source indices, where 0 is "x", 1 - * is "y", 2 is "z" and 3 is "w". - * Example: "xwz" --> { 3, { 0, 3, 2, not used } }. - */ -typedef struct slang_swizzle_ -{ - GLuint num_components; - GLuint swizzle[4]; -} slang_swizzle; - -extern GLboolean -_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle *swz); - - -typedef enum slang_type_variant_ -{ - SLANG_VARIANT, /* the default */ - SLANG_INVARIANT /* indicates the "invariant" keyword */ -} slang_type_variant; - - -typedef enum slang_type_centroid_ -{ - SLANG_CENTER, /* the default */ - SLANG_CENTROID /* indicates the "centroid" keyword */ -} slang_type_centroid; - - -/** - * These only apply to gl_FragCoord, but other layout qualifiers may - * appear in the future. - */ -typedef enum slang_layout_qualifier_ -{ - SLANG_LAYOUT_NONE = 0x0, - SLANG_LAYOUT_UPPER_LEFT_BIT = 0x1, - SLANG_LAYOUT_PIXEL_CENTER_INTEGER_BIT = 0x2 -} slang_layout_qualifier; - - -typedef enum slang_type_qualifier_ -{ - SLANG_QUAL_NONE, - SLANG_QUAL_CONST, - SLANG_QUAL_ATTRIBUTE, - SLANG_QUAL_VARYING, - SLANG_QUAL_UNIFORM, - SLANG_QUAL_OUT, - SLANG_QUAL_INOUT, - SLANG_QUAL_FIXEDOUTPUT, /* internal */ - SLANG_QUAL_FIXEDINPUT /* internal */ -} slang_type_qualifier; - - -typedef enum slang_type_precision_ -{ - SLANG_PREC_DEFAULT, - SLANG_PREC_LOW, - SLANG_PREC_MEDIUM, - SLANG_PREC_HIGH -} slang_type_precision; - - -/** - * The basic shading language types (float, vec4, mat3, etc) - */ -typedef enum slang_type_specifier_type_ -{ - SLANG_SPEC_VOID, - SLANG_SPEC_BOOL, - SLANG_SPEC_BVEC2, - SLANG_SPEC_BVEC3, - SLANG_SPEC_BVEC4, - SLANG_SPEC_INT, - SLANG_SPEC_IVEC2, - SLANG_SPEC_IVEC3, - SLANG_SPEC_IVEC4, - SLANG_SPEC_FLOAT, - SLANG_SPEC_VEC2, - SLANG_SPEC_VEC3, - SLANG_SPEC_VEC4, - SLANG_SPEC_MAT2, - SLANG_SPEC_MAT3, - SLANG_SPEC_MAT4, - SLANG_SPEC_MAT23, - SLANG_SPEC_MAT32, - SLANG_SPEC_MAT24, - SLANG_SPEC_MAT42, - SLANG_SPEC_MAT34, - SLANG_SPEC_MAT43, - SLANG_SPEC_SAMPLER_1D, - SLANG_SPEC_SAMPLER_2D, - SLANG_SPEC_SAMPLER_3D, - SLANG_SPEC_SAMPLER_CUBE, - SLANG_SPEC_SAMPLER_RECT, - SLANG_SPEC_SAMPLER_1D_SHADOW, - SLANG_SPEC_SAMPLER_2D_SHADOW, - SLANG_SPEC_SAMPLER_RECT_SHADOW, - SLANG_SPEC_SAMPLER_1D_ARRAY, - SLANG_SPEC_SAMPLER_2D_ARRAY, - SLANG_SPEC_SAMPLER_1D_ARRAY_SHADOW, - SLANG_SPEC_SAMPLER_2D_ARRAY_SHADOW, - SLANG_SPEC_STRUCT, - SLANG_SPEC_ARRAY -} slang_type_specifier_type; - - -extern slang_type_specifier_type -slang_type_specifier_type_from_string(const char *); - -extern const char * -slang_type_specifier_type_to_string(slang_type_specifier_type); - - -/** - * Describes more sophisticated types, like structs and arrays. - */ -typedef struct slang_type_specifier_ -{ - slang_type_specifier_type type; - struct slang_struct_ *_struct; /**< if type == SLANG_SPEC_STRUCT */ - struct slang_type_specifier_ *_array; /**< if type == SLANG_SPEC_ARRAY */ -} slang_type_specifier; - - -extern GLvoid -slang_type_specifier_ctr(slang_type_specifier *); - -extern GLvoid -slang_type_specifier_dtr(slang_type_specifier *); - -extern slang_type_specifier * -slang_type_specifier_new(slang_type_specifier_type type, - struct slang_struct_ *_struct, - struct slang_type_specifier_ *_array); - - -extern GLboolean -slang_type_specifier_copy(slang_type_specifier *, const slang_type_specifier *); - -extern GLboolean -slang_type_specifier_equal(const slang_type_specifier *, - const slang_type_specifier *); - - -extern GLboolean -slang_type_specifier_compatible(const slang_type_specifier *x, - const slang_type_specifier *y); - - -typedef struct slang_fully_specified_type_ -{ - slang_type_qualifier qualifier; - slang_type_specifier specifier; - slang_type_precision precision; - slang_type_variant variant; - slang_type_centroid centroid; - slang_layout_qualifier layout; - GLint array_len; /**< -1 if not an array type */ -} slang_fully_specified_type; - -extern int -slang_fully_specified_type_construct(slang_fully_specified_type *); - -extern void -slang_fully_specified_type_destruct(slang_fully_specified_type *); - -extern int -slang_fully_specified_type_copy(slang_fully_specified_type *, - const slang_fully_specified_type *); - -GLboolean -slang_fully_specified_types_compatible(const slang_fully_specified_type * x, - const slang_fully_specified_type * y); - - -typedef struct slang_typeinfo_ -{ - GLboolean can_be_referenced; - GLboolean is_swizzled; - slang_swizzle swz; - slang_type_specifier spec; - GLuint array_len; -} slang_typeinfo; - -extern GLboolean -slang_typeinfo_construct(slang_typeinfo *); - -extern GLvoid -slang_typeinfo_destruct(slang_typeinfo *); - - -extern GLboolean -_slang_typeof_operation(struct slang_operation_ *, - const struct slang_name_space_ *, - slang_typeinfo *, slang_atom_pool *, - slang_info_log *log); - -extern GLboolean -_slang_type_is_matrix(slang_type_specifier_type); - -extern GLboolean -_slang_type_is_vector(slang_type_specifier_type); - -extern GLboolean -_slang_type_is_float_vec_mat(slang_type_specifier_type); - -extern slang_type_specifier_type -_slang_type_base(slang_type_specifier_type); - -extern GLuint -_slang_type_dim(slang_type_specifier_type); - -extern GLenum -_slang_gltype_from_specifier(const slang_type_specifier *type); - -#endif diff --git a/mesalib/src/mesa/shader/slang/slang_utility.c b/mesalib/src/mesa/shader/slang/slang_utility.c deleted file mode 100644 index e77404f69..000000000 --- a/mesalib/src/mesa/shader/slang/slang_utility.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * \file slang_utility.c - * slang utilities - * \author Michal Krol - */ - -#include "main/imports.h" -#include "slang_utility.h" -#include "slang_mem.h" - -char * -slang_string_concat (char *dst, const char *src) -{ - return strcpy (dst + strlen (dst), src); -} - - -/* slang_string */ - -GLvoid -slang_string_init (slang_string *self) -{ - self->data = NULL; - self->capacity = 0; - self->length = 0; - self->fail = GL_FALSE; -} - -GLvoid -slang_string_free (slang_string *self) -{ - if (self->data != NULL) - free(self->data); -} - -GLvoid -slang_string_reset (slang_string *self) -{ - self->length = 0; - self->fail = GL_FALSE; -} - -static GLboolean -grow (slang_string *self, GLuint size) -{ - if (self->fail) - return GL_FALSE; - if (size > self->capacity) { - /* do not overflow 32-bit range */ - assert (size < 0x80000000); - - self->data = (char *) (_mesa_realloc (self->data, self->capacity, size * 2)); - self->capacity = size * 2; - if (self->data == NULL) { - self->capacity = 0; - self->fail = GL_TRUE; - return GL_FALSE; - } - } - return GL_TRUE; -} - -GLvoid -slang_string_push (slang_string *self, const slang_string *str) -{ - if (str->fail) { - self->fail = GL_TRUE; - return; - } - if (grow (self, self->length + str->length)) { - memcpy (&self->data[self->length], str->data, str->length); - self->length += str->length; - } -} - -GLvoid -slang_string_pushc (slang_string *self, const char c) -{ - if (grow (self, self->length + 1)) { - self->data[self->length] = c; - self->length++; - } -} - -GLvoid -slang_string_pushs (slang_string *self, const char *cstr, GLuint len) -{ - if (grow (self, self->length + len)) { - memcpy (&self->data[self->length], cstr, len); - self->length += len; - } -} - -GLvoid -slang_string_pushi (slang_string *self, GLint i) -{ - char buffer[12]; - - sprintf (buffer, "%d", i); - slang_string_pushs (self, buffer, strlen (buffer)); -} - -const char * -slang_string_cstr (slang_string *self) -{ - if (grow (self, self->length + 1)) - self->data[self->length] = '\0'; - return self->data; -} - -/* slang_atom_pool */ - -void -slang_atom_pool_construct(slang_atom_pool * pool) -{ - GLuint i; - - for (i = 0; i < SLANG_ATOM_POOL_SIZE; i++) - pool->entries[i] = NULL; -} - -void -slang_atom_pool_destruct (slang_atom_pool * pool) -{ - GLuint i; - - for (i = 0; i < SLANG_ATOM_POOL_SIZE; i++) { - slang_atom_entry * entry; - - entry = pool->entries[i]; - while (entry != NULL) { - slang_atom_entry *next = entry->next; - _slang_free(entry->id); - _slang_free(entry); - entry = next; - } - } -} - -/* - * Search the atom pool for an atom with a given name. - * If atom is not found, create and add it to the pool. - * Returns ATOM_NULL if the atom was not found and the function failed - * to create a new atom. - */ -slang_atom -slang_atom_pool_atom(slang_atom_pool * pool, const char * id) -{ - GLuint hash; - const char * p = id; - slang_atom_entry ** entry; - - /* Hash a given string to a number in the range [0, ATOM_POOL_SIZE). */ - hash = 0; - while (*p != '\0') { - GLuint g; - - hash = (hash << 4) + (GLuint) (*p++); - g = hash & 0xf0000000; - if (g != 0) - hash ^= g >> 24; - hash &= ~g; - } - hash %= SLANG_ATOM_POOL_SIZE; - - /* Now the hash points to a linked list of atoms with names that - * have the same hash value. Search the linked list for a given - * name. - */ - entry = &pool->entries[hash]; - while (*entry != NULL) { - /* If the same, return the associated atom. */ - if (slang_string_compare((**entry).id, id) == 0) - return (slang_atom) (**entry).id; - /* Grab the next atom in the linked list. */ - entry = &(**entry).next; - } - - /* Okay, we have not found an atom. Create a new entry for it. - * Note that the <entry> points to the last entry's <next> field. - */ - *entry = (slang_atom_entry *) _slang_alloc(sizeof(slang_atom_entry)); - if (*entry == NULL) - return SLANG_ATOM_NULL; - - /* Initialize a new entry. Because we'll need the actual name of - * the atom, we use the pointer to this string as an actual atom's - * value. - */ - (**entry).next = NULL; - (**entry).id = _slang_strdup(id); - if ((**entry).id == NULL) - return SLANG_ATOM_NULL; - return (slang_atom) (**entry).id; -} - -/** - * Return the name of a given atom. - */ -const char * -slang_atom_pool_id(slang_atom_pool * pool, slang_atom atom) -{ - return (const char *) (atom); -} diff --git a/mesalib/src/mesa/shader/slang/slang_utility.h b/mesalib/src/mesa/shader/slang/slang_utility.h deleted file mode 100644 index 2c0d0bcbb..000000000 --- a/mesalib/src/mesa/shader/slang/slang_utility.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.3 - * - * Copyright (C) 2005-2007 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef SLANG_UTILITY_H -#define SLANG_UTILITY_H - - -/* Compile-time assertions. If the expression is zero, try to declare an - * array of size [-1] to cause compilation error. - */ -#define static_assert(expr) do { int _array[(expr) ? 1 : -1]; (void) _array[0]; } while (0) - - -#define slang_string_compare(str1, str2) strcmp (str1, str2) -#define slang_string_copy(dst, src) strcpy (dst, src) -#define slang_string_length(str) strlen (str) - -char *slang_string_concat (char *, const char *); - -/* slang_string */ - -typedef struct -{ - char *data; - GLuint length; - GLuint capacity; - GLboolean fail; -} slang_string; - -GLvoid -slang_string_init (slang_string *); - -GLvoid -slang_string_free (slang_string *); - -GLvoid -slang_string_reset (slang_string *); - -GLvoid -slang_string_push (slang_string *, const slang_string *); - -GLvoid -slang_string_pushc (slang_string *, const char); - -GLvoid -slang_string_pushs (slang_string *, const char *, GLuint); - -GLvoid -slang_string_pushi (slang_string *, GLint); - -const char * -slang_string_cstr (slang_string *); - -/* slang_atom */ - -typedef GLvoid *slang_atom; - -#define SLANG_ATOM_NULL ((slang_atom) 0) - -typedef struct slang_atom_entry_ -{ - char *id; - struct slang_atom_entry_ *next; -} slang_atom_entry; - -#define SLANG_ATOM_POOL_SIZE 1023 - -typedef struct slang_atom_pool_ -{ - slang_atom_entry *entries[SLANG_ATOM_POOL_SIZE]; -} slang_atom_pool; - -GLvoid slang_atom_pool_construct (slang_atom_pool *); -GLvoid slang_atom_pool_destruct (slang_atom_pool *); -slang_atom slang_atom_pool_atom (slang_atom_pool *, const char *); -const char *slang_atom_pool_id (slang_atom_pool *, slang_atom); - - -#endif diff --git a/mesalib/src/mesa/shader/slang/slang_vartable.c b/mesalib/src/mesa/shader/slang/slang_vartable.c deleted file mode 100644 index e07e3a226..000000000 --- a/mesalib/src/mesa/shader/slang/slang_vartable.c +++ /dev/null @@ -1,362 +0,0 @@ - -#include "main/imports.h" -#include "shader/program.h" -#include "shader/prog_print.h" -#include "slang_compile.h" -#include "slang_compile_variable.h" -#include "slang_emit.h" -#include "slang_mem.h" -#include "slang_vartable.h" -#include "slang_ir.h" - - -static int dbg = 0; - - -typedef enum { - FREE, - VAR, - TEMP -} TempState; - - -/** - * Variable/register info for one variable scope. - */ -struct table -{ - int Level; - int NumVars; - slang_variable **Vars; /* array [NumVars] */ - - TempState Temps[MAX_PROGRAM_TEMPS * 4]; /* per-component state */ - int ValSize[MAX_PROGRAM_TEMPS * 4]; /**< For debug only */ - - struct table *Parent; /** Parent scope table */ -}; - - -/** - * A variable table is a stack of tables, one per scope. - */ -struct slang_var_table_ -{ - GLint CurLevel; - GLuint MaxRegisters; - struct table *Top; /**< Table at top of stack */ -}; - - - -slang_var_table * -_slang_new_var_table(GLuint maxRegisters) -{ - slang_var_table *vt - = (slang_var_table *) _slang_alloc(sizeof(slang_var_table)); - if (vt) { - vt->MaxRegisters = maxRegisters; - } - return vt; -} - - -void -_slang_delete_var_table(slang_var_table *vt) -{ - if (vt->Top) { - _mesa_problem(NULL, "non-empty var table in _slang_delete_var_table()"); - return; - } - _slang_free(vt); -} - - - -/** - * Create new table on top of vartable stack. - * Used when we enter a {} block. - */ -void -_slang_push_var_table(slang_var_table *vt) -{ - struct table *t = (struct table *) _slang_alloc(sizeof(struct table)); - if (t) { - t->Level = vt->CurLevel++; - t->Parent = vt->Top; - if (t->Parent) { - /* copy the info indicating which temp regs are in use */ - memcpy(t->Temps, t->Parent->Temps, sizeof(t->Temps)); - memcpy(t->ValSize, t->Parent->ValSize, sizeof(t->ValSize)); - } - vt->Top = t; - if (dbg) printf("Pushing level %d\n", t->Level); - } -} - - -/** - * Pop top entry from variable table. - * Used when we leave a {} block. - */ -void -_slang_pop_var_table(slang_var_table *vt) -{ - struct table *t = vt->Top; - int i; - - if (dbg) printf("Popping level %d\n", t->Level); - - /* free the storage allocated for each variable */ - for (i = 0; i < t->NumVars; i++) { - slang_ir_storage *store = t->Vars[i]->store; - GLint j; - GLuint comp; - if (dbg) printf(" Free var %s, size %d at %d.%s\n", - (char*) t->Vars[i]->a_name, store->Size, - store->Index, - _mesa_swizzle_string(store->Swizzle, 0, 0)); - - if (store->File == PROGRAM_SAMPLER) { - /* samplers have no storage */ - continue; - } - - if (store->Size == 1) - comp = GET_SWZ(store->Swizzle, 0); - else - comp = 0; - - /* store->Index may be -1 if we run out of registers */ - if (store->Index >= 0) { - for (j = 0; j < store->Size; j++) { - assert(t->Temps[store->Index * 4 + j + comp] == VAR); - t->Temps[store->Index * 4 + j + comp] = FREE; - } - } - store->Index = -1; - } - if (t->Parent) { - /* just verify that any remaining allocations in this scope - * were for temps - */ - for (i = 0; i < (int) vt->MaxRegisters * 4; i++) { - if (t->Temps[i] != FREE && t->Parent->Temps[i] == FREE) { - if (dbg) printf(" Free reg %d\n", i/4); - assert(t->Temps[i] == TEMP); - } - } - } - - if (t->Vars) { - _slang_free(t->Vars); - t->Vars = NULL; - } - - vt->Top = t->Parent; - _slang_free(t); - vt->CurLevel--; -} - - -/** - * Add a new variable to the given var/symbol table. - */ -void -_slang_add_variable(slang_var_table *vt, slang_variable *v) -{ - struct table *t; - assert(vt); - t = vt->Top; - assert(t); - if (dbg) printf("Adding var %s, store %p\n", (char *) v->a_name, (void *) v->store); - t->Vars = (slang_variable **) - _slang_realloc(t->Vars, - t->NumVars * sizeof(slang_variable *), - (t->NumVars + 1) * sizeof(slang_variable *)); - t->Vars[t->NumVars] = v; - t->NumVars++; -} - - -/** - * Look for variable by name in given table. - * If not found, Parent table will be searched. - */ -slang_variable * -_slang_find_variable(const slang_var_table *vt, slang_atom name) -{ - struct table *t = vt->Top; - while (1) { - int i; - for (i = 0; i < t->NumVars; i++) { - if (t->Vars[i]->a_name == name) - return t->Vars[i]; - } - if (t->Parent) - t = t->Parent; - else - return NULL; - } -} - - -/** - * Allocation helper. - * \param size var size in floats - * \return position for var, measured in floats - */ -static GLint -alloc_reg(slang_var_table *vt, GLint size, GLboolean isTemp) -{ - struct table *t = vt->Top; - /* if size == 1, allocate anywhere, else, pos must be multiple of 4 */ - const GLuint step = (size == 1) ? 1 : 4; - GLuint i, j; - assert(size > 0); /* number of floats */ - - for (i = 0; i <= vt->MaxRegisters * 4 - size; i += step) { - GLuint found = 0; - for (j = 0; j < (GLuint) size; j++) { - assert(i + j < 4 * MAX_PROGRAM_TEMPS); - if (i + j < vt->MaxRegisters * 4 && t->Temps[i + j] == FREE) { - found++; - } - else { - break; - } - } - if (found == size) { - /* found block of size free regs */ - if (size > 1) - assert(i % 4 == 0); - for (j = 0; j < (GLuint) size; j++) { - assert(i + j < 4 * MAX_PROGRAM_TEMPS); - t->Temps[i + j] = isTemp ? TEMP : VAR; - } - assert(i < MAX_PROGRAM_TEMPS * 4); - t->ValSize[i] = size; - return i; - } - } - - /* if we get here, we ran out of registers */ - return -1; -} - - -/** - * Allocate temp register(s) for storing a variable. - * \param size size needed, in floats - * \param swizzle returns swizzle mask for accessing var in register - * \return register allocated, or -1 - */ -GLboolean -_slang_alloc_var(slang_var_table *vt, slang_ir_storage *store) -{ - struct table *t = vt->Top; - int i; - - if (store->File == PROGRAM_SAMPLER) { - /* don't really allocate storage */ - store->Index = 0; - return GL_TRUE; - } - - i = alloc_reg(vt, store->Size, GL_FALSE); - if (i < 0) - return GL_FALSE; - - store->Index = i / 4; - store->Swizzle = _slang_var_swizzle(store->Size, i % 4); - - if (dbg) - printf("Alloc var storage sz %d at %d.%s (level %d) store %p\n", - store->Size, store->Index, - _mesa_swizzle_string(store->Swizzle, 0, 0), - t->Level, - (void*) store); - - return GL_TRUE; -} - - - -/** - * Allocate temp register(s) for storing an unnamed intermediate value. - */ -GLboolean -_slang_alloc_temp(slang_var_table *vt, slang_ir_storage *store) -{ - struct table *t = vt->Top; - const int i = alloc_reg(vt, store->Size, GL_TRUE); - if (i < 0) - return GL_FALSE; - - assert(store->Index < 0); - - store->Index = i / 4; - store->Swizzle = _slang_var_swizzle(store->Size, i % 4); - - if (dbg) printf("Alloc temp sz %d at %d.%s (level %d) store %p\n", - store->Size, store->Index, - _mesa_swizzle_string(store->Swizzle, 0, 0), t->Level, - (void *) store); - - return GL_TRUE; -} - - -void -_slang_free_temp(slang_var_table *vt, slang_ir_storage *store) -{ - struct table *t = vt->Top; - GLuint i; - GLint r = store->Index; - assert(store->Size > 0); - assert(r >= 0); - assert((GLuint)r + store->Size <= vt->MaxRegisters * 4); - if (dbg) printf("Free temp sz %d at %d.%s (level %d) store %p\n", - store->Size, r, - _mesa_swizzle_string(store->Swizzle, 0, 0), - t->Level, (void *) store); - if (store->Size == 1) { - const GLuint comp = GET_SWZ(store->Swizzle, 0); - /* we can actually fail some of these assertions because of the - * troublesome IR_SWIZZLE handling. - */ -#if 0 - assert(store->Swizzle == MAKE_SWIZZLE4(comp, comp, comp, comp)); - assert(comp < 4); - assert(t->ValSize[r * 4 + comp] == 1); -#endif - assert(t->Temps[r * 4 + comp] == TEMP); - t->Temps[r * 4 + comp] = FREE; - } - else { - /*assert(store->Swizzle == SWIZZLE_NOOP);*/ - assert(t->ValSize[r*4] == store->Size); - for (i = 0; i < (GLuint) store->Size; i++) { - assert(t->Temps[r * 4 + i] == TEMP); - t->Temps[r * 4 + i] = FREE; - } - } -} - - -GLboolean -_slang_is_temp(const slang_var_table *vt, const slang_ir_storage *store) -{ - struct table *t = vt->Top; - GLuint comp; - assert(store->Index >= 0); - assert(store->Index < (int) vt->MaxRegisters); - if (store->Swizzle == SWIZZLE_NOOP) - comp = 0; - else - comp = GET_SWZ(store->Swizzle, 0); - - if (t->Temps[store->Index * 4 + comp] == TEMP) - return GL_TRUE; - else - return GL_FALSE; -} diff --git a/mesalib/src/mesa/shader/slang/slang_vartable.h b/mesalib/src/mesa/shader/slang/slang_vartable.h deleted file mode 100644 index 94bcd63f4..000000000 --- a/mesalib/src/mesa/shader/slang/slang_vartable.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef SLANG_VARTABLE_H -#define SLANG_VARTABLE_H - -struct slang_ir_storage_; - -typedef struct slang_var_table_ slang_var_table; - -struct slang_variable_; - -extern slang_var_table * -_slang_new_var_table(GLuint maxRegisters); - -extern void -_slang_delete_var_table(slang_var_table *vt); - -extern void -_slang_push_var_table(slang_var_table *parent); - -extern void -_slang_pop_var_table(slang_var_table *t); - -extern void -_slang_add_variable(slang_var_table *t, struct slang_variable_ *v); - -extern struct slang_variable_ * -_slang_find_variable(const slang_var_table *t, slang_atom name); - -extern GLboolean -_slang_alloc_var(slang_var_table *t, struct slang_ir_storage_ *store); - -extern GLboolean -_slang_alloc_temp(slang_var_table *t, struct slang_ir_storage_ *store); - -extern void -_slang_free_temp(slang_var_table *t, struct slang_ir_storage_ *store); - -extern GLboolean -_slang_is_temp(const slang_var_table *t, const struct slang_ir_storage_ *store); - - -#endif /* SLANG_VARTABLE_H */ diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak index 9f2e4e515..b35d09335 100644 --- a/mesalib/src/mesa/sources.mak +++ b/mesalib/src/mesa/sources.mak @@ -1,5 +1,10 @@ ### Lists of source files, included by Makefiles +# this is part of MAIN_SOURCES +MAIN_ES_SOURCES = \ + main/api_exec_es1.c \ + main/api_exec_es2.c + MAIN_SOURCES = \ main/api_arrayelt.c \ main/api_exec.c \ @@ -7,6 +12,8 @@ MAIN_SOURCES = \ main/api_noop.c \ main/api_validate.c \ main/accum.c \ + main/arbprogram.c \ + main/atifragshader.c \ main/attrib.c \ main/arrayobj.c \ main/blend.c \ @@ -25,6 +32,7 @@ MAIN_SOURCES = \ main/dlist.c \ main/dlopen.c \ main/drawpix.c \ + main/drawtex.c \ main/enable.c \ main/enums.c \ main/eval.c \ @@ -49,18 +57,20 @@ MAIN_SOURCES = \ main/mipmap.c \ main/mm.c \ main/multisample.c \ + main/nvprogram.c \ main/pixel.c \ main/pixelstore.c \ main/points.c \ main/polygon.c \ main/queryobj.c \ + main/querymatrix.c \ main/rastpos.c \ - main/rbadaptors.c \ main/readpix.c \ main/remap.c \ main/renderbuffer.c \ main/scissor.c \ - main/shaders.c \ + main/shaderapi.c \ + main/shaderobj.c \ main/shared.c \ main/state.c \ main/stencil.c \ @@ -76,21 +86,18 @@ MAIN_SOURCES = \ main/texgetimage.c \ main/teximage.c \ main/texobj.c \ + main/texpal.c \ main/texparam.c \ main/texrender.c \ main/texstate.c \ main/texstore.c \ + main/transformfeedback.c \ + main/uniforms.c \ main/varray.c \ main/version.c \ main/viewport.c \ - main/vtxfmt.c - -GLAPI_SOURCES = \ - glapi/glapi.c \ - glapi/glapi_dispatch.c \ - glapi/glapi_getproc.c \ - glapi/glapi_nop.c \ - glapi/glthread.c + main/vtxfmt.c \ + $(MAIN_ES_SOURCES) MATH_SOURCES = \ math/m_debug_clip.c \ @@ -180,6 +187,7 @@ STATETRACKER_SOURCES = \ state_tracker/st_atom_constbuf.c \ state_tracker/st_atom_depth.c \ state_tracker/st_atom_framebuffer.c \ + state_tracker/st_atom_msaa.c \ state_tracker/st_atom_pixeltransfer.c \ state_tracker/st_atom_sampler.c \ state_tracker/st_atom_scissor.c \ @@ -196,6 +204,8 @@ STATETRACKER_SOURCES = \ state_tracker/st_cb_condrender.c \ state_tracker/st_cb_flush.c \ state_tracker/st_cb_drawpixels.c \ + state_tracker/st_cb_drawtex.c \ + state_tracker/st_cb_eglimage.c \ state_tracker/st_cb_fbo.c \ state_tracker/st_cb_feedback.c \ state_tracker/st_cb_program.c \ @@ -204,64 +214,44 @@ STATETRACKER_SOURCES = \ state_tracker/st_cb_readpixels.c \ state_tracker/st_cb_strings.c \ state_tracker/st_cb_texture.c \ + state_tracker/st_cb_viewport.c \ + state_tracker/st_cb_xformfb.c \ state_tracker/st_context.c \ state_tracker/st_debug.c \ state_tracker/st_draw.c \ state_tracker/st_draw_feedback.c \ state_tracker/st_extensions.c \ state_tracker/st_format.c \ - state_tracker/st_framebuffer.c \ state_tracker/st_gen_mipmap.c \ + state_tracker/st_manager.c \ state_tracker/st_mesa_to_tgsi.c \ state_tracker/st_program.c \ state_tracker/st_texture.c -SHADER_SOURCES = \ - shader/arbprogparse.c \ - shader/arbprogram.c \ - shader/atifragshader.c \ - shader/hash_table.c \ - shader/lex.yy.c \ - shader/nvfragparse.c \ - shader/nvprogram.c \ - shader/nvvertparse.c \ - shader/program.c \ - shader/program_parse.tab.c \ - shader/program_parse_extra.c \ - shader/prog_cache.c \ - shader/prog_execute.c \ - shader/prog_instruction.c \ - shader/prog_noise.c \ - shader/prog_optimize.c \ - shader/prog_parameter.c \ - shader/prog_parameter_layout.c \ - shader/prog_print.c \ - shader/prog_statevars.c \ - shader/prog_uniform.c \ - shader/programopt.c \ - shader/symbol_table.c \ - shader/shader_api.c - -SLANG_SOURCES = \ - shader/slang/slang_builtin.c \ - shader/slang/slang_codegen.c \ - shader/slang/slang_compile.c \ - shader/slang/slang_compile_function.c \ - shader/slang/slang_compile_operation.c \ - shader/slang/slang_compile_struct.c \ - shader/slang/slang_compile_variable.c \ - shader/slang/slang_emit.c \ - shader/slang/slang_ir.c \ - shader/slang/slang_label.c \ - shader/slang/slang_link.c \ - shader/slang/slang_log.c \ - shader/slang/slang_mem.c \ - shader/slang/slang_print.c \ - shader/slang/slang_simplify.c \ - shader/slang/slang_storage.c \ - shader/slang/slang_typeinfo.c \ - shader/slang/slang_vartable.c \ - shader/slang/slang_utility.c +PROGRAM_SOURCES = \ + program/arbprogparse.c \ + program/hash_table.c \ + program/lex.yy.c \ + program/nvfragparse.c \ + program/nvvertparse.c \ + program/program.c \ + program/program_parse.tab.c \ + program/program_parse_extra.c \ + program/prog_cache.c \ + program/prog_execute.c \ + program/prog_instruction.c \ + program/prog_noise.c \ + program/prog_optimize.c \ + program/prog_parameter.c \ + program/prog_parameter_layout.c \ + program/prog_print.c \ + program/prog_statevars.c \ + program/prog_uniform.c \ + program/programopt.c \ + program/symbol_table.c + +SHADER_CXX_SOURCES = \ + program/ir_to_mesa.cpp ASM_C_SOURCES = \ x86/common_x86.c \ @@ -292,23 +282,14 @@ X86_SOURCES = \ x86/sse_normal.S \ x86/read_rgba_span_x86.S -X86_API = \ - x86/glapi_x86.S - X86-64_SOURCES = \ x86-64/xform4.S -X86-64_API = \ - x86-64/glapi_x86-64.S - SPARC_SOURCES = \ sparc/clip.S \ sparc/norm.S \ sparc/xform.S -SPARC_API = \ - sparc/glapi_sparc.S - COMMON_DRIVER_SOURCES = \ drivers/common/driverfuncs.c \ drivers/common/meta.c @@ -321,12 +302,14 @@ MESA_SOURCES = \ $(MATH_XFORM_SOURCES) \ $(VBO_SOURCES) \ $(TNL_SOURCES) \ - $(SHADER_SOURCES) \ + $(PROGRAM_SOURCES) \ $(SWRAST_SOURCES) \ $(SWRAST_SETUP_SOURCES) \ $(COMMON_DRIVER_SOURCES)\ - $(ASM_C_SOURCES) \ - $(SLANG_SOURCES) + $(ASM_C_SOURCES) + +MESA_CXX_SOURCES = \ + $(SHADER_CXX_SOURCES) # Sources for building Gallium drivers MESA_GALLIUM_SOURCES = \ @@ -334,15 +317,17 @@ MESA_GALLIUM_SOURCES = \ $(MATH_SOURCES) \ $(VBO_SOURCES) \ $(STATETRACKER_SOURCES) \ - $(SHADER_SOURCES) \ + $(PROGRAM_SOURCES) \ ppc/common_ppc.c \ - x86/common_x86.c \ - $(SLANG_SOURCES) + x86/common_x86.c + +MESA_GALLIUM_CXX_SOURCES = \ + $(SHADER_CXX_SOURCES) # All the core C sources, for dependency checking ALL_SOURCES = \ $(MESA_SOURCES) \ - $(GLAPI_SOURCES) \ + $(MESA_CXX_SOURCES) \ $(MESA_ASM_SOURCES) \ $(STATETRACKER_SOURCES) @@ -351,16 +336,14 @@ ALL_SOURCES = \ MESA_OBJECTS = \ $(MESA_SOURCES:.c=.o) \ + $(MESA_CXX_SOURCES:.cpp=.o) \ $(MESA_ASM_SOURCES:.S=.o) MESA_GALLIUM_OBJECTS = \ $(MESA_GALLIUM_SOURCES:.c=.o) \ + $(MESA_GALLIUM_CXX_SOURCES:.cpp=.o) \ $(MESA_ASM_SOURCES:.S=.o) -GLAPI_OBJECTS = \ - $(GLAPI_SOURCES:.c=.o) \ - $(GLAPI_ASM_SOURCES:.S=.o) - COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_SOURCES:.c=.o) @@ -368,14 +351,15 @@ COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_SOURCES:.c=.o) ### Other archives/libraries GLSL_LIBS = \ - $(TOP)/src/glsl/pp/libglslpp.a \ - $(TOP)/src/glsl/cl/libglslcl.a + $(TOP)/src/glsl/libglsl.a ### Include directories INCLUDE_DIRS = \ -I$(TOP)/include \ + -I$(TOP)/src/glsl \ -I$(TOP)/src/mesa \ + -I$(TOP)/src/mapi \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/auxiliary diff --git a/mesalib/src/mesa/swrast/s_aaline.h b/mesalib/src/mesa/swrast/s_aaline.h index f1d708ec8..922eb230e 100644 --- a/mesalib/src/mesa/swrast/s_aaline.h +++ b/mesalib/src/mesa/swrast/s_aaline.h @@ -28,7 +28,7 @@ #define S_AALINE_H -#include "swrast.h" +#include "main/mtypes.h" extern void diff --git a/mesalib/src/mesa/swrast/s_aatriangle.h b/mesalib/src/mesa/swrast/s_aatriangle.h index 4b57fa73a..9aed41a19 100644 --- a/mesalib/src/mesa/swrast/s_aatriangle.h +++ b/mesalib/src/mesa/swrast/s_aatriangle.h @@ -28,7 +28,7 @@ #define S_AATRIANGLE_H -#include "swrast.h" +#include "main/mtypes.h" extern void diff --git a/mesalib/src/mesa/swrast/s_alpha.h b/mesalib/src/mesa/swrast/s_alpha.h index 7a5b72e65..239484a97 100644 --- a/mesalib/src/mesa/swrast/s_alpha.h +++ b/mesalib/src/mesa/swrast/s_alpha.h @@ -28,7 +28,8 @@ #define S_ALPHA_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern GLint diff --git a/mesalib/src/mesa/swrast/s_atifragshader.c b/mesalib/src/mesa/swrast/s_atifragshader.c index 0f06cdf9f..1338b6802 100644 --- a/mesalib/src/mesa/swrast/s_atifragshader.c +++ b/mesalib/src/mesa/swrast/s_atifragshader.c @@ -21,10 +21,10 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" -#include "shader/atifragshader.h" +#include "main/atifragshader.h" #include "swrast/s_atifragshader.h" +#include "swrast/s_context.h" /** diff --git a/mesalib/src/mesa/swrast/s_atifragshader.h b/mesalib/src/mesa/swrast/s_atifragshader.h index 871a0c045..cce455a04 100644 --- a/mesalib/src/mesa/swrast/s_atifragshader.h +++ b/mesalib/src/mesa/swrast/s_atifragshader.h @@ -27,7 +27,8 @@ #define S_ATIFRAGSHADER_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern void diff --git a/mesalib/src/mesa/swrast/s_blend.h b/mesalib/src/mesa/swrast/s_blend.h index 8d5a81635..9cedde3bf 100644 --- a/mesalib/src/mesa/swrast/s_blend.h +++ b/mesalib/src/mesa/swrast/s_blend.h @@ -27,7 +27,8 @@ #define S_BLEND_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern void diff --git a/mesalib/src/mesa/swrast/s_clear.c b/mesalib/src/mesa/swrast/s_clear.c index 7b0a63391..efe500ae2 100644 --- a/mesalib/src/mesa/swrast/s_clear.c +++ b/mesalib/src/mesa/swrast/s_clear.c @@ -25,7 +25,6 @@ #include "main/glheader.h" #include "main/colormac.h" #include "main/condrender.h" -#include "main/formats.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c index 751966348..f76a2b68e 100644 --- a/mesalib/src/mesa/swrast/s_context.c +++ b/mesalib/src/mesa/swrast/s_context.c @@ -28,12 +28,11 @@ #include "main/imports.h" #include "main/bufferobj.h" -#include "main/context.h" #include "main/colormac.h" #include "main/mtypes.h" #include "main/teximage.h" -#include "shader/prog_parameter.h" -#include "shader/prog_statevars.h" +#include "program/prog_parameter.h" +#include "program/prog_statevars.h" #include "swrast.h" #include "s_blend.h" #include "s_context.h" @@ -951,7 +950,7 @@ _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ) v->attrib[FRAG_ATTRIB_COL1][2], v->attrib[FRAG_ATTRIB_COL1][3]); _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]); - _mesa_debug(ctx, "index %d\n", v->attrib[FRAG_ATTRIB_CI][0]); + _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]); _mesa_debug(ctx, "pointsize %f\n", v->pointSize); _mesa_debug(ctx, "\n"); } diff --git a/mesalib/src/mesa/swrast/s_context.h b/mesalib/src/mesa/swrast/s_context.h index 9059f9b5e..6d81f7476 100644 --- a/mesalib/src/mesa/swrast/s_context.h +++ b/mesalib/src/mesa/swrast/s_context.h @@ -43,8 +43,9 @@ #ifndef S_CONTEXT_H #define S_CONTEXT_H +#include "main/compiler.h" #include "main/mtypes.h" -#include "shader/prog_execute.h" +#include "program/prog_execute.h" #include "swrast.h" #include "s_span.h" diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c index ed637cac1..f952fd6ba 100644 --- a/mesalib/src/mesa/swrast/s_depth.c +++ b/mesalib/src/mesa/swrast/s_depth.c @@ -30,7 +30,6 @@ #include "main/imports.h" #include "s_depth.h" -#include "s_context.h" #include "s_span.h" diff --git a/mesalib/src/mesa/swrast/s_depth.h b/mesalib/src/mesa/swrast/s_depth.h index 7eae36674..878d242f5 100644 --- a/mesalib/src/mesa/swrast/s_depth.h +++ b/mesalib/src/mesa/swrast/s_depth.h @@ -27,7 +27,8 @@ #define S_DEPTH_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern GLuint diff --git a/mesalib/src/mesa/swrast/s_feedback.c b/mesalib/src/mesa/swrast/s_feedback.c index 373b1416e..6ac8ac73b 100644 --- a/mesalib/src/mesa/swrast/s_feedback.c +++ b/mesalib/src/mesa/swrast/s_feedback.c @@ -24,7 +24,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/feedback.h" #include "main/macros.h" diff --git a/mesalib/src/mesa/swrast/s_fog.c b/mesalib/src/mesa/swrast/s_fog.c index 3fc843921..689500a61 100644 --- a/mesalib/src/mesa/swrast/s_fog.c +++ b/mesalib/src/mesa/swrast/s_fog.c @@ -25,7 +25,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "s_context.h" diff --git a/mesalib/src/mesa/swrast/s_fog.h b/mesalib/src/mesa/swrast/s_fog.h index 06107de3f..a496746d1 100644 --- a/mesalib/src/mesa/swrast/s_fog.h +++ b/mesalib/src/mesa/swrast/s_fog.h @@ -28,7 +28,8 @@ #define S_FOG_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern GLfloat diff --git a/mesalib/src/mesa/swrast/s_fragprog.c b/mesalib/src/mesa/swrast/s_fragprog.c index 7c1de62e8..9facb44d9 100644 --- a/mesalib/src/mesa/swrast/s_fragprog.c +++ b/mesalib/src/mesa/swrast/s_fragprog.c @@ -24,9 +24,9 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" -#include "shader/prog_instruction.h" +#include "program/prog_instruction.h" +#include "s_context.h" #include "s_fragprog.h" #include "s_span.h" diff --git a/mesalib/src/mesa/swrast/s_fragprog.h b/mesalib/src/mesa/swrast/s_fragprog.h index e1b7e6791..92b9d01e1 100644 --- a/mesalib/src/mesa/swrast/s_fragprog.h +++ b/mesalib/src/mesa/swrast/s_fragprog.h @@ -27,7 +27,8 @@ #define S_FRAGPROG_H -#include "s_context.h" +#include "main/mtypes.h" +#include "s_span.h" extern void diff --git a/mesalib/src/mesa/swrast/s_logic.h b/mesalib/src/mesa/swrast/s_logic.h index e8cfae33f..d60951334 100644 --- a/mesalib/src/mesa/swrast/s_logic.h +++ b/mesalib/src/mesa/swrast/s_logic.h @@ -27,7 +27,8 @@ #define S_LOGIC_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern void _swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb, diff --git a/mesalib/src/mesa/swrast/s_masking.h b/mesalib/src/mesa/swrast/s_masking.h index 3ba4f8356..cb000da0f 100644 --- a/mesalib/src/mesa/swrast/s_masking.h +++ b/mesalib/src/mesa/swrast/s_masking.h @@ -27,7 +27,8 @@ #define S_MASKING_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern void diff --git a/mesalib/src/mesa/swrast/s_points.c b/mesalib/src/mesa/swrast/s_points.c index 1663ece82..12431662c 100644 --- a/mesalib/src/mesa/swrast/s_points.c +++ b/mesalib/src/mesa/swrast/s_points.c @@ -25,7 +25,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "s_context.h" #include "s_feedback.h" diff --git a/mesalib/src/mesa/swrast/s_readpix.c b/mesalib/src/mesa/swrast/s_readpix.c index 368311e14..1de481248 100644 --- a/mesalib/src/mesa/swrast/s_readpix.c +++ b/mesalib/src/mesa/swrast/s_readpix.c @@ -27,7 +27,6 @@ #include "main/bufferobj.h" #include "main/colormac.h" #include "main/convolve.h" -#include "main/context.h" #include "main/feedback.h" #include "main/formats.h" #include "main/image.h" @@ -192,7 +191,8 @@ fast_read_rgba_pixels( GLcontext *ctx, if (!rb) return GL_FALSE; - ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB); + ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB || + rb->_BaseFormat == GL_ALPHA); /* clipping should have already been done */ ASSERT(x + width <= (GLint) rb->Width); @@ -265,10 +265,18 @@ adjust_colors(const struct gl_framebuffer *fb, GLuint n, GLfloat rgba[][4]) const GLuint rShift = 8 - fb->Visual.redBits; const GLuint gShift = 8 - fb->Visual.greenBits; const GLuint bShift = 8 - fb->Visual.blueBits; - const GLfloat rScale = 1.0F / (GLfloat) ((1 << fb->Visual.redBits ) - 1); - const GLfloat gScale = 1.0F / (GLfloat) ((1 << fb->Visual.greenBits) - 1); - const GLfloat bScale = 1.0F / (GLfloat) ((1 << fb->Visual.blueBits ) - 1); + GLfloat rScale = 1.0F / (GLfloat) ((1 << fb->Visual.redBits ) - 1); + GLfloat gScale = 1.0F / (GLfloat) ((1 << fb->Visual.greenBits) - 1); + GLfloat bScale = 1.0F / (GLfloat) ((1 << fb->Visual.blueBits ) - 1); GLuint i; + + if (fb->Visual.redBits == 0) + rScale = 0; + if (fb->Visual.greenBits == 0) + gScale = 0; + if (fb->Visual.blueBits == 0) + bScale = 0; + for (i = 0; i < n; i++) { GLint r, g, b; /* convert float back to ubyte */ diff --git a/mesalib/src/mesa/swrast/s_span.c b/mesalib/src/mesa/swrast/s_span.c index 687c8eb0b..28c82990e 100644 --- a/mesalib/src/mesa/swrast/s_span.c +++ b/mesalib/src/mesa/swrast/s_span.c @@ -33,7 +33,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" #include "main/image.h" @@ -971,6 +970,10 @@ shade_texture_span(GLcontext *ctx, SWspan *span) if (span->primitive == GL_BITMAP && span->array->ChanType != GL_FLOAT) { convert_color_type(span, GL_FLOAT, 0); } + else { + span->array->rgba = (void *) span->array->attribs[FRAG_ATTRIB_COL0]; + } + if (span->primitive != GL_POINT || (span->interpMask & SPAN_RGBA) || ctx->Point.PointSprite) { @@ -1222,9 +1225,22 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) GLchan rgbaSave[MAX_WIDTH][4]; const GLuint fragOutput = multiFragOutputs ? buf : 0; + /* set span->array->rgba to colors for render buffer's datatype */ if (rb->DataType != span->array->ChanType || fragOutput > 0) { convert_color_type(span, rb->DataType, fragOutput); } + else { + if (rb->DataType == GL_UNSIGNED_BYTE) { + span->array->rgba = span->array->rgba8; + } + else if (rb->DataType == GL_UNSIGNED_SHORT) { + span->array->rgba = (void *) span->array->rgba16; + } + else { + span->array->rgba = (void *) + span->array->attribs[FRAG_ATTRIB_COL0]; + } + } if (!multiFragOutputs && numBuffers > 1) { /* save colors for second, third renderbuffer writes */ @@ -1232,7 +1248,8 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) 4 * span->end * sizeof(GLchan)); } - ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB); + ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB || + rb->_BaseFormat == GL_ALPHA); if (ctx->Color._LogicOpEnabled) { _swrast_logicop_rgba_span(ctx, rb, span); @@ -1330,7 +1347,8 @@ _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb, ASSERT(rb); ASSERT(rb->GetRow); - ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA); + ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA || + rb->_BaseFormat == GL_ALPHA); if (rb->DataType == dstType) { rb->GetRow(ctx, rb, length, x + skip, y, diff --git a/mesalib/src/mesa/swrast/s_stencil.h b/mesalib/src/mesa/swrast/s_stencil.h index cd6cbc57b..c076ebbe2 100644 --- a/mesalib/src/mesa/swrast/s_stencil.h +++ b/mesalib/src/mesa/swrast/s_stencil.h @@ -27,7 +27,8 @@ #define S_STENCIL_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c index f322663ad..2ac0aaa24 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.c +++ b/mesalib/src/mesa/swrast/s_texcombine.c @@ -29,7 +29,7 @@ #include "main/colormac.h" #include "main/image.h" #include "main/imports.h" -#include "shader/prog_instruction.h" +#include "program/prog_instruction.h" #include "s_context.h" #include "s_texcombine.h" diff --git a/mesalib/src/mesa/swrast/s_texcombine.h b/mesalib/src/mesa/swrast/s_texcombine.h index 9ed96efb8..4f5dfbe1a 100644 --- a/mesalib/src/mesa/swrast/s_texcombine.h +++ b/mesalib/src/mesa/swrast/s_texcombine.h @@ -27,7 +27,8 @@ #define S_TEXCOMBINE_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern void _swrast_texture_span( GLcontext *ctx, SWspan *span ); diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index 997c2f4bb..3fc554c5a 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -488,14 +488,15 @@ tex_array_slice(GLfloat coord, GLsizei size) /** * Compute nearest integer texcoords for given texobj and coordinate. + * NOTE: only used for depth texture sampling. */ static INLINE void nearest_texcoord(const struct gl_texture_object *texObj, + GLuint level, const GLfloat texcoord[4], GLint *i, GLint *j, GLint *k) { - const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *img = texObj->Image[0][baseLevel]; + const struct gl_texture_image *img = texObj->Image[0][level]; const GLint width = img->Width; const GLint height = img->Height; const GLint depth = img->Depth; @@ -534,15 +535,16 @@ nearest_texcoord(const struct gl_texture_object *texObj, /** * Compute linear integer texcoords for given texobj and coordinate. + * NOTE: only used for depth texture sampling. */ static INLINE void linear_texcoord(const struct gl_texture_object *texObj, + GLuint level, const GLfloat texcoord[4], GLint *i0, GLint *i1, GLint *j0, GLint *j1, GLint *slice, GLfloat *wi, GLfloat *wj) { - const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *img = texObj->Image[0][baseLevel]; + const struct gl_texture_image *img = texObj->Image[0][level]; const GLint width = img->Width; const GLint height = img->Height; const GLint depth = img->Depth; @@ -2963,7 +2965,26 @@ shadow_compare4(GLenum function, GLfloat coord, /** - * Sample a shadow/depth texture. + * Choose the mipmap level to use when sampling from a depth texture. + */ +static int +choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda) +{ + GLint level; + + lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod); + + level = (GLint) lambda; + + level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel); + + return level; +} + + +/** + * Sample a shadow/depth texture. This function is incomplete. It doesn't + * check for minification vs. magnification, etc. */ static void sample_depth_texture( GLcontext *ctx, @@ -2971,8 +2992,8 @@ sample_depth_texture( GLcontext *ctx, const GLfloat texcoords[][4], const GLfloat lambda[], GLfloat texel[][4] ) { - const GLint baseLevel = tObj->BaseLevel; - const struct gl_texture_image *img = tObj->Image[0][baseLevel]; + const GLint level = choose_depth_texture_level(tObj, lambda[0]); + const struct gl_texture_image *img = tObj->Image[0][level]; const GLint width = img->Width; const GLint height = img->Height; const GLint depth = img->Depth; @@ -2982,8 +3003,6 @@ sample_depth_texture( GLcontext *ctx, GLenum function; GLfloat result; - (void) lambda; - ASSERT(img->_BaseFormat == GL_DEPTH_COMPONENT || img->_BaseFormat == GL_DEPTH_STENCIL_EXT); @@ -3006,7 +3025,7 @@ sample_depth_texture( GLcontext *ctx, GLfloat depthSample; GLint col, row, slice; - nearest_texcoord(tObj, texcoords[i], &col, &row, &slice); + nearest_texcoord(tObj, level, texcoords[i], &col, &row, &slice); if (col >= 0 && row >= 0 && col < width && row < height && slice >= 0 && slice < depth) { @@ -3044,7 +3063,7 @@ sample_depth_texture( GLcontext *ctx, GLfloat wi, wj; GLuint useBorderTexel; - linear_texcoord(tObj, texcoords[i], &i0, &i1, &j0, &j1, &slice, + linear_texcoord(tObj, level, texcoords[i], &i0, &i1, &j0, &j1, &slice, &wi, &wj); useBorderTexel = 0; diff --git a/mesalib/src/mesa/swrast/s_texfilter.h b/mesalib/src/mesa/swrast/s_texfilter.h index 2e265d685..eceab5965 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.h +++ b/mesalib/src/mesa/swrast/s_texfilter.h @@ -27,7 +27,8 @@ #define S_TEXFILTER_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_context.h" extern texture_sample_func diff --git a/mesalib/src/mesa/swrast/s_triangle.c b/mesalib/src/mesa/swrast/s_triangle.c index 812dddf15..d1b369bcd 100644 --- a/mesalib/src/mesa/swrast/s_triangle.c +++ b/mesalib/src/mesa/swrast/s_triangle.c @@ -35,7 +35,7 @@ #include "main/imports.h" #include "main/macros.h" #include "main/texformat.h" -#include "shader/prog_instruction.h" +#include "program/prog_instruction.h" #include "s_aatriangle.h" #include "s_context.h" diff --git a/mesalib/src/mesa/swrast/s_zoom.h b/mesalib/src/mesa/swrast/s_zoom.h index 43917be65..09f624efa 100644 --- a/mesalib/src/mesa/swrast/s_zoom.h +++ b/mesalib/src/mesa/swrast/s_zoom.h @@ -25,7 +25,8 @@ #ifndef S_ZOOM_H #define S_ZOOM_H -#include "swrast.h" +#include "main/mtypes.h" +#include "s_span.h" extern void diff --git a/mesalib/src/mesa/swrast_setup/ss_context.c b/mesalib/src/mesa/swrast_setup/ss_context.c index ebd1574c4..0fcb7c77a 100644 --- a/mesalib/src/mesa/swrast_setup/ss_context.c +++ b/mesalib/src/mesa/swrast_setup/ss_context.c @@ -115,7 +115,7 @@ setup_vertex_format(GLcontext *ctx) GLboolean intColors = !ctx->FragmentProgram._Current && !ctx->ATIFragmentShader._Enabled && ctx->RenderMode == GL_RENDER - && CHAN_TYPE == GL_UNSIGNED_BYTE; + && CHAN_TYPE != GL_FLOAT; if (intColors != swsetup->intColors || !RENDERINPUTS_EQUAL(tnl->render_inputs_bitset, diff --git a/mesalib/src/mesa/swrast_setup/ss_context.h b/mesalib/src/mesa/swrast_setup/ss_context.h index 1ec293fad..56551ab27 100644 --- a/mesalib/src/mesa/swrast_setup/ss_context.h +++ b/mesalib/src/mesa/swrast_setup/ss_context.h @@ -28,9 +28,8 @@ #ifndef SS_CONTEXT_H #define SS_CONTEXT_H -#include "main/mtypes.h" +#include "main/glheader.h" #include "swrast/swrast.h" -#include "swrast_setup.h" #include "tnl/t_context.h" typedef struct { diff --git a/mesalib/src/mesa/swrast_setup/ss_triangle.c b/mesalib/src/mesa/swrast_setup/ss_triangle.c index bad0d8194..f22bc52f0 100644 --- a/mesalib/src/mesa/swrast_setup/ss_triangle.c +++ b/mesalib/src/mesa/swrast_setup/ss_triangle.c @@ -159,7 +159,7 @@ static void _swsetup_render_tri(GLcontext *ctx, } #define SS_COLOR(a,b) UNCLAMPED_FLOAT_TO_RGBA_CHAN(a,b) -#define SS_SPEC(a,b) UNCLAMPED_FLOAT_TO_RGB_CHAN(a,b) +#define SS_SPEC(a,b) COPY_4V(a,b) #define SS_IND(a,b) (a = b) #define IND (0) diff --git a/mesalib/src/mesa/swrast_setup/ss_triangle.h b/mesalib/src/mesa/swrast_setup/ss_triangle.h index 007fa2e91..ac553cbd0 100644 --- a/mesalib/src/mesa/swrast_setup/ss_triangle.h +++ b/mesalib/src/mesa/swrast_setup/ss_triangle.h @@ -29,7 +29,7 @@ #ifndef SS_TRIANGLE_H #define SS_TRIANGLE_H -#include "ss_context.h" +#include "main/mtypes.h" void _swsetup_trifuncs_init( GLcontext *ctx ); diff --git a/mesalib/src/mesa/swrast_setup/ss_vb.h b/mesalib/src/mesa/swrast_setup/ss_vb.h index 2ad1f56f3..944a3b78d 100644 --- a/mesalib/src/mesa/swrast_setup/ss_vb.h +++ b/mesalib/src/mesa/swrast_setup/ss_vb.h @@ -30,7 +30,6 @@ #define SS_VB_H #include "main/mtypes.h" -#include "swrast_setup.h" void _swsetup_vb_init( GLcontext *ctx ); void _swsetup_choose_rastersetup_func( GLcontext *ctx ); diff --git a/mesalib/src/mesa/tnl/t_context.h b/mesalib/src/mesa/tnl/t_context.h index ebaae6335..258906f79 100644 --- a/mesalib/src/mesa/tnl/t_context.h +++ b/mesalib/src/mesa/tnl/t_context.h @@ -53,9 +53,7 @@ #include "main/bitset.h" #include "main/mtypes.h" -#include "math/m_matrix.h" #include "math/m_vector.h" -#include "math/m_xform.h" #include "vbo/vbo.h" diff --git a/mesalib/src/mesa/tnl/t_rasterpos.c b/mesalib/src/mesa/tnl/t_rasterpos.c index 3596d162b..d82d5b507 100644 --- a/mesalib/src/mesa/tnl/t_rasterpos.c +++ b/mesalib/src/mesa/tnl/t_rasterpos.c @@ -25,7 +25,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/feedback.h" #include "main/light.h" #include "main/macros.h" diff --git a/mesalib/src/mesa/tnl/t_vb_cull.c b/mesalib/src/mesa/tnl/t_vb_cull.c index 712901acf..22df71667 100644 --- a/mesalib/src/mesa/tnl/t_vb_cull.c +++ b/mesalib/src/mesa/tnl/t_vb_cull.c @@ -28,7 +28,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/tnl/t_vb_fog.c b/mesalib/src/mesa/tnl/t_vb_fog.c index 4a0e6ad4f..9faae24ec 100644 --- a/mesalib/src/mesa/tnl/t_vb_fog.c +++ b/mesalib/src/mesa/tnl/t_vb_fog.c @@ -28,7 +28,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/tnl/t_vb_normals.c b/mesalib/src/mesa/tnl/t_vb_normals.c index 61ac40957..c2aa65567 100644 --- a/mesalib/src/mesa/tnl/t_vb_normals.c +++ b/mesalib/src/mesa/tnl/t_vb_normals.c @@ -28,7 +28,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/tnl/t_vb_program.c b/mesalib/src/mesa/tnl/t_vb_program.c index 0137e52fc..f3a338ef1 100644 --- a/mesalib/src/mesa/tnl/t_vb_program.c +++ b/mesalib/src/mesa/tnl/t_vb_program.c @@ -33,12 +33,12 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" -#include "shader/prog_instruction.h" -#include "shader/prog_statevars.h" -#include "shader/prog_execute.h" +#include "math/m_xform.h" +#include "program/prog_instruction.h" +#include "program/prog_statevars.h" +#include "program/prog_execute.h" #include "swrast/s_context.h" #include "tnl/tnl.h" diff --git a/mesalib/src/mesa/tnl/t_vb_render.c b/mesalib/src/mesa/tnl/t_vb_render.c index c1bebc994..7d991009a 100644 --- a/mesalib/src/mesa/tnl/t_vb_render.c +++ b/mesalib/src/mesa/tnl/t_vb_render.c @@ -44,6 +44,7 @@ #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" +#include "math/m_xform.h" #include "t_pipeline.h" diff --git a/mesalib/src/mesa/tnl/t_vb_texgen.c b/mesalib/src/mesa/tnl/t_vb_texgen.c index 9ef13bc96..950e0f54e 100644 --- a/mesalib/src/mesa/tnl/t_vb_texgen.c +++ b/mesalib/src/mesa/tnl/t_vb_texgen.c @@ -37,7 +37,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/tnl/t_vb_texmat.c b/mesalib/src/mesa/tnl/t_vb_texmat.c index 83688290e..985d137e5 100644 --- a/mesalib/src/mesa/tnl/t_vb_texmat.c +++ b/mesalib/src/mesa/tnl/t_vb_texmat.c @@ -28,7 +28,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/tnl/t_vb_vertex.c b/mesalib/src/mesa/tnl/t_vb_vertex.c index a27534256..453479227 100644 --- a/mesalib/src/mesa/tnl/t_vb_vertex.c +++ b/mesalib/src/mesa/tnl/t_vb_vertex.c @@ -28,7 +28,6 @@ #include "main/glheader.h" #include "main/colormac.h" -#include "main/context.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h index b24ecfd7c..07d31f6ce 100644 --- a/mesalib/src/mesa/vbo/vbo.h +++ b/mesalib/src/mesa/vbo/vbo.h @@ -45,6 +45,7 @@ struct _mesa_prim { GLuint start; GLuint count; GLint basevertex; + GLsizei num_instances; }; /* Would like to call this a "vbo_index_buffer", but this would be @@ -138,6 +139,30 @@ void GLAPIENTRY _vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params); void GLAPIENTRY +_vbo_Materialf(GLenum face, GLenum pname, GLfloat param); + +void GLAPIENTRY _vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +void GLAPIENTRY +_vbo_VertexAttrib1f(GLuint indx, GLfloat x); + +void GLAPIENTRY +_vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values); + +void GLAPIENTRY +_vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); + +void GLAPIENTRY +_vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values); + +void GLAPIENTRY +_vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); + +void GLAPIENTRY +_vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values); + +void GLAPIENTRY +_vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values); + #endif diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c index e3be39a34..580850574 100644 --- a/mesalib/src/mesa/vbo/vbo_context.c +++ b/mesalib/src/mesa/vbo/vbo_context.c @@ -198,9 +198,8 @@ GLboolean _vbo_CreateContext( GLcontext *ctx ) * vtxfmt mechanism can be removed now. */ vbo_exec_init( ctx ); -#if FEATURE_dlist - vbo_save_init( ctx ); -#endif + if (ctx->API == API_OPENGL) + vbo_save_init( ctx ); _math_init_eval(); @@ -232,9 +231,8 @@ void _vbo_DestroyContext( GLcontext *ctx ) } vbo_exec_destroy(ctx); -#if FEATURE_dlist - vbo_save_destroy(ctx); -#endif + if (ctx->API == API_OPENGL) + vbo_save_destroy(ctx); FREE(vbo); ctx->swtnl_im = NULL; } diff --git a/mesalib/src/mesa/vbo/vbo_context.h b/mesalib/src/mesa/vbo/vbo_context.h index 8b726dc8a..00cfc522a 100644 --- a/mesalib/src/mesa/vbo/vbo_context.h +++ b/mesalib/src/mesa/vbo/vbo_context.h @@ -54,9 +54,7 @@ #include "vbo.h" #include "vbo_attrib.h" #include "vbo_exec.h" -#if FEATURE_dlist #include "vbo_save.h" -#endif struct vbo_context { diff --git a/mesalib/src/mesa/vbo/vbo_exec.c b/mesalib/src/mesa/vbo/vbo_exec.c index a057befed..046fa8105 100644 --- a/mesalib/src/mesa/vbo/vbo_exec.c +++ b/mesalib/src/mesa/vbo/vbo_exec.c @@ -30,9 +30,10 @@ #include "main/glheader.h" #include "main/mtypes.h" #include "main/vtxfmt.h" - #include "vbo_context.h" + + void vbo_exec_init( GLcontext *ctx ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; @@ -74,7 +75,9 @@ void vbo_exec_destroy( GLcontext *ctx ) vbo_exec_array_destroy( exec ); } -/* Really want to install these callbacks to a central facility to be + +/** + * Really want to install these callbacks to a central facility to be * invoked according to the state flags. That will have to wait for a * mesa rework: */ @@ -87,8 +90,3 @@ void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state ) _ae_invalidate_state(ctx, new_state); } - - - - - diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h index 98c1f363d..33494f0ce 100644 --- a/mesalib/src/mesa/vbo/vbo_exec.h +++ b/mesalib/src/mesa/vbo/vbo_exec.h @@ -195,7 +195,4 @@ void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec, void vbo_exec_do_EvalCoord1f( struct vbo_exec_context *exec, GLfloat u); -extern GLboolean -vbo_validate_shaders(GLcontext *ctx); - #endif diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c index e40f5f9dc..9df75a840 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_api.c +++ b/mesalib/src/mesa/vbo/vbo_exec_api.c @@ -531,6 +531,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) exec->vtx.prim[i].pad = 0; exec->vtx.prim[i].start = exec->vtx.vert_count; exec->vtx.prim[i].count = 0; + exec->vtx.prim[i].num_instances = 1; ctx->Driver.CurrentExecPrimitive = mode; } @@ -849,8 +850,11 @@ void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ) NULL); } - /* Free the vertex buffer: + /* Free the vertex buffer. Unmap first if needed. */ + if (_mesa_bufferobj_mapped(exec->vtx.bufferobj)) { + ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, exec->vtx.bufferobj); + } _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); } @@ -954,6 +958,7 @@ _vbo_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) vbo_MultiTexCoord4f(target, s, t, r, q); } + void GLAPIENTRY _vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params) { @@ -962,7 +967,66 @@ _vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params) void GLAPIENTRY +_vbo_Materialf(GLenum face, GLenum pname, GLfloat param) +{ + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0F; + vbo_Materialfv(face, pname, p); +} + + +void GLAPIENTRY _vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { vbo_VertexAttrib4fARB(index, x, y, z, w); } + + +void GLAPIENTRY +_vbo_VertexAttrib1f(GLuint indx, GLfloat x) +{ + vbo_VertexAttrib1fARB(indx, x); +} + + +void GLAPIENTRY +_vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values) +{ + vbo_VertexAttrib1fvARB(indx, values); +} + + +void GLAPIENTRY +_vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) +{ + vbo_VertexAttrib2fARB(indx, x, y); +} + + +void GLAPIENTRY +_vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values) +{ + vbo_VertexAttrib2fvARB(indx, values); +} + + +void GLAPIENTRY +_vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) +{ + vbo_VertexAttrib3fARB(indx, x, y, z); +} + + +void GLAPIENTRY +_vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values) +{ + vbo_VertexAttrib3fvARB(indx, values); +} + + +void GLAPIENTRY +_vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values) +{ + vbo_VertexAttrib4fvARB(indx, values); +} diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index 90474da7c..1759e5788 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -30,7 +30,6 @@ #include "main/context.h" #include "main/state.h" #include "main/api_validate.h" -#include "main/api_noop.h" #include "main/varray.h" #include "main/bufferobj.h" #include "main/enums.h" @@ -40,7 +39,8 @@ /** - * Compute min and max elements for glDraw[Range]Elements() calls. + * Compute min and max elements by scanning the index buffer for + * glDraw[Range]Elements() calls. */ void vbo_get_minmax_index(GLcontext *ctx, @@ -112,6 +112,7 @@ vbo_get_minmax_index(GLcontext *ctx, /** * Check that element 'j' of the array has reasonable data. * Map VBO if needed. + * For debugging purposes; not normally used. */ static void check_array_data(GLcontext *ctx, struct gl_client_array *array, @@ -172,6 +173,7 @@ unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array) /** * Examine the array's data for NaNs, etc. + * For debug purposes; not normally used. */ static void check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType, @@ -249,7 +251,7 @@ check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count) /** - * Print info/data for glDrawArrays(). + * Print info/data for glDrawArrays(), for debugging. */ static void print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, @@ -295,6 +297,9 @@ print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec, /** + * Bind the VBO executor to the current vertex array object prior + * to drawing. + * * Just translate the arrayobj into a sane layout. */ static void @@ -334,6 +339,14 @@ bind_array_obj(GLcontext *ctx) } +/** + * Set the vbo->exec->inputs[] pointers to point to the enabled + * vertex arrays. This depends on the current vertex program/shader + * being executed because of whether or not generic vertex arrays + * alias the conventional vertex arrays. + * For arrays that aren't enabled, we set the input[attrib] pointer + * to point at a zero-stride current value "array". + */ static void recalculate_input_bindings(GLcontext *ctx) { @@ -453,27 +466,15 @@ recalculate_input_bindings(GLcontext *ctx) static void bind_arrays(GLcontext *ctx) { -#if 0 - if (ctx->Array.ArrayObj.Name != exec->array.array_obj) { - bind_array_obj(ctx); - recalculate_input_bindings(ctx); - } - else if (exec->array.program_mode != get_program_mode(ctx) || - exec->array.enabled_flags != ctx->Array.ArrayObj->_Enabled) { - recalculate_input_bindings(ctx); - } -#else bind_array_obj(ctx); recalculate_input_bindings(ctx); -#endif } -/*********************************************************************** - * API functions. +/** + * Called from glDrawArrays when in immediate mode (not display list mode). */ - static void GLAPIENTRY vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) { @@ -520,6 +521,7 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) prim[0].count = count; prim[0].indexed = 0; prim[0].basevertex = 0; + prim[0].num_instances = 1; vbo->draw_prims( ctx, exec->array.inputs, prim, 1, NULL, GL_TRUE, start, start + count - 1 ); @@ -533,7 +535,68 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) /** + * Called from glDrawArraysInstanced when in immediate mode (not + * display list mode). + */ +static void GLAPIENTRY +vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count, + GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + struct vbo_context *vbo = vbo_context(ctx); + struct vbo_exec_context *exec = &vbo->exec; + struct _mesa_prim prim[1]; + + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n", + _mesa_lookup_enum_by_nr(mode), start, count, primcount); + + if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, primcount)) + return; + + FLUSH_CURRENT( ctx, 0 ); + + if (!_mesa_valid_to_render(ctx, "glDrawArraysInstanced")) { + return; + } + +#if 0 /* debug */ + check_draw_arrays_data(ctx, start, count); +#endif + + bind_arrays( ctx ); + + /* Again... because we may have changed the bitmask of per-vertex varying + * attributes. If we regenerate the fixed-function vertex program now + * we may be able to prune down the number of vertex attributes which we + * need in the shader. + */ + if (ctx->NewState) + _mesa_update_state( ctx ); + + prim[0].begin = 1; + prim[0].end = 1; + prim[0].weak = 0; + prim[0].pad = 0; + prim[0].mode = mode; + prim[0].start = start; + prim[0].count = count; + prim[0].indexed = 0; + prim[0].basevertex = 0; + prim[0].num_instances = primcount; + + vbo->draw_prims( ctx, exec->array.inputs, prim, 1, NULL, + GL_TRUE, start, start + count - 1 ); + +#if 0 /* debug */ + print_draw_arrays(ctx, exec, mode, start, count); +#endif +} + + +/** * Map GL_ELEMENT_ARRAY_BUFFER and print contents. + * For debugging. */ static void dump_element_buffer(GLcontext *ctx, GLenum type) @@ -588,14 +651,18 @@ dump_element_buffer(GLcontext *ctx, GLenum type) } -/* Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */ +/** + * Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements. + * Do the rendering for a glDrawElements or glDrawRangeElements call after + * we've validated buffer bounds, etc. + */ static void vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode, GLboolean index_bounds_valid, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, - GLint basevertex) + GLint basevertex, GLint primcount) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; @@ -628,6 +695,7 @@ vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode, prim[0].count = count; prim[0].indexed = 1; prim[0].basevertex = basevertex; + prim[0].num_instances = primcount; /* Need to give special consideration to rendering a range of * indices starting somewhere above zero. Typically the @@ -664,6 +732,10 @@ vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode, index_bounds_valid, start, end ); } + +/** + * Called by glDrawRangeElementsBaseVertex() in immediate mode. + */ static void GLAPIENTRY vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, @@ -713,7 +785,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, start, end, count, type, indices, ctx->Array.ArrayObj->_MaxElement - 1, ctx->Array.ElementArrayBufferObj->Name, - ctx->Array.ElementArrayBufferObj->Size); + (int) ctx->Array.ElementArrayBufferObj->Size); } if (0) @@ -739,7 +811,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, start, end, count, type, indices, max, ctx->Array.ArrayObj->_MaxElement - 1, ctx->Array.ElementArrayBufferObj->Name, - ctx->Array.ElementArrayBufferObj->Size); + (int) ctx->Array.ElementArrayBufferObj->Size); } } /* XXX we could also find the min index and compare to 'start' @@ -769,10 +841,13 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, #endif vbo_validated_drawrangeelements(ctx, mode, GL_TRUE, start, end, - count, type, indices, basevertex); + count, type, indices, basevertex, 1); } +/** + * Called by glDrawRangeElements() in immediate mode. + */ static void GLAPIENTRY vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) @@ -790,6 +865,9 @@ vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, } +/** + * Called by glDrawElements() in immediate mode. + */ static void GLAPIENTRY vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) @@ -805,10 +883,13 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, - count, type, indices, 0); + count, type, indices, 0, 1); } +/** + * Called by glDrawElementsBaseVertex() in immediate mode. + */ static void GLAPIENTRY vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) @@ -825,11 +906,38 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, return; vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, - count, type, indices, basevertex); + count, type, indices, basevertex, 1); +} + + +/** + * Called by glDrawElementsInstanced() in immediate mode. + */ +static void GLAPIENTRY +vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices, GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, "glDrawElementsInstanced(%s, %d, %s, %p, %d)\n", + _mesa_lookup_enum_by_nr(mode), count, + _mesa_lookup_enum_by_nr(type), indices, primcount); + + if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices, + primcount)) + return; + + vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0, + count, type, indices, 0, primcount); } -/** Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */ +/** + * Inner support for both _mesa_MultiDrawElements() and + * _mesa_MultiDrawRangeElements(). + * This does the actual rendering after we've checked array indexes, etc. + */ static void vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, const GLsizei *count, GLenum type, @@ -861,7 +969,8 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, } /* Decide if we can do this all as one set of primitives sharing the - * same index buffer, or if we have to reset the index pointer per primitive. + * same index buffer, or if we have to reset the index pointer per + * primitive. */ bind_arrays( ctx ); @@ -926,6 +1035,7 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, prim[i].start = ((uintptr_t)indices[i] - min_index_ptr) / index_type_size; prim[i].count = count[i]; prim[i].indexed = 1; + prim[i].num_instances = 1; if (basevertex != NULL) prim[i].basevertex = basevertex[i]; else @@ -950,6 +1060,7 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, prim[0].start = 0; prim[0].count = count[i]; prim[0].indexed = 1; + prim[0].num_instances = 1; if (basevertex != NULL) prim[0].basevertex = basevertex[i]; else @@ -1009,14 +1120,13 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode, } -/*********************************************************************** - * Initialization +/** + * Plug in the immediate-mode vertex array drawing commands into the + * givven vbo_exec_context object. */ - void vbo_exec_array_init( struct vbo_exec_context *exec ) { -#if 1 exec->vtxfmt.DrawArrays = vbo_exec_DrawArrays; exec->vtxfmt.DrawElements = vbo_exec_DrawElements; exec->vtxfmt.DrawRangeElements = vbo_exec_DrawRangeElements; @@ -1024,15 +1134,8 @@ vbo_exec_array_init( struct vbo_exec_context *exec ) exec->vtxfmt.DrawElementsBaseVertex = vbo_exec_DrawElementsBaseVertex; exec->vtxfmt.DrawRangeElementsBaseVertex = vbo_exec_DrawRangeElementsBaseVertex; exec->vtxfmt.MultiDrawElementsBaseVertex = vbo_exec_MultiDrawElementsBaseVertex; -#else - exec->vtxfmt.DrawArrays = _mesa_noop_DrawArrays; - exec->vtxfmt.DrawElements = _mesa_noop_DrawElements; - exec->vtxfmt.DrawRangeElements = _mesa_noop_DrawRangeElements; - exec->vtxfmt.MultiDrawElementsEXT = _mesa_noop_MultiDrawElements; - exec->vtxfmt.DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex; - exec->vtxfmt.DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex; - exec->vtxfmt.MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex; -#endif + exec->vtxfmt.DrawArraysInstanced = vbo_exec_DrawArraysInstanced; + exec->vtxfmt.DrawElementsInstanced = vbo_exec_DrawElementsInstanced; } @@ -1043,7 +1146,13 @@ vbo_exec_array_destroy( struct vbo_exec_context *exec ) } -/* This API entrypoint is not ordinarily used */ + +/** + * The following functions are only used for OpenGL ES 1/2 support. + * And some aren't even supported (yet) in ES 1/2. + */ + + void GLAPIENTRY _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count) { @@ -1051,7 +1160,6 @@ _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count) } -/* This API entrypoint is not ordinarily used */ void GLAPIENTRY _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) @@ -1059,6 +1167,7 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, vbo_exec_DrawElements(mode, count, type, indices); } + void GLAPIENTRY _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) @@ -1067,7 +1176,6 @@ _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, } -/* This API entrypoint is not ordinarily used */ void GLAPIENTRY _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) @@ -1086,7 +1194,6 @@ _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, } -/* GL_EXT_multi_draw_arrays */ void GLAPIENTRY _mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount) diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c index 045af46da..84ae1b87f 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_draw.c +++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c @@ -27,7 +27,7 @@ #include "main/glheader.h" #include "main/bufferobj.h" -#include "main/context.h" +#include "main/compiler.h" #include "main/enums.h" #include "main/state.h" diff --git a/mesalib/src/mesa/vbo/vbo_save.c b/mesalib/src/mesa/vbo/vbo_save.c index fd9a13027..dd5570689 100644 --- a/mesalib/src/mesa/vbo/vbo_save.c +++ b/mesalib/src/mesa/vbo/vbo_save.c @@ -33,6 +33,8 @@ #include "vbo_context.h" +#if FEATURE_dlist + static void vbo_save_callback_init( GLcontext *ctx ) { @@ -117,3 +119,4 @@ void vbo_save_fallback( GLcontext *ctx, GLboolean fallback ) } +#endif /* FEATURE_dlist */ diff --git a/mesalib/src/mesa/vbo/vbo_save.h b/mesalib/src/mesa/vbo/vbo_save.h index 86bbd24f7..82ba6c8af 100644 --- a/mesalib/src/mesa/vbo/vbo_save.h +++ b/mesalib/src/mesa/vbo/vbo_save.h @@ -153,6 +153,7 @@ struct vbo_save_context { GLubyte *currentsz[VBO_ATTRIB_MAX]; }; +#if FEATURE_dlist void vbo_save_init( GLcontext *ctx ); void vbo_save_destroy( GLcontext *ctx ); @@ -181,4 +182,18 @@ void vbo_save_playback_vertex_list( GLcontext *ctx, void *data ); void vbo_save_api_init( struct vbo_save_context *save ); -#endif +#else /* FEATURE_dlist */ + +static INLINE void +vbo_save_init( GLcontext *ctx ) +{ +} + +static INLINE void +vbo_save_destroy( GLcontext *ctx ) +{ +} + +#endif /* FEATURE_dlist */ + +#endif /* VBO_SAVE_H */ diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c index a5d027982..c3727cb52 100644 --- a/mesalib/src/mesa/vbo/vbo_save_api.c +++ b/mesalib/src/mesa/vbo/vbo_save_api.c @@ -83,6 +83,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "vbo_context.h" +#if FEATURE_dlist + + #ifdef ERROR #undef ERROR #endif @@ -418,6 +421,7 @@ static void _save_wrap_buffers( GLcontext *ctx ) save->prim[0].pad = 0; save->prim[0].start = 0; save->prim[0].count = 0; + save->prim[0].num_instances = 1; save->prim_count = 1; } @@ -773,6 +777,7 @@ GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode ) save->prim[i].pad = 0; save->prim[i].start = save->vert_count; save->prim[i].count = 0; + save->prim[i].num_instances = 1; _mesa_install_save_vtxfmt( ctx, &save->vtxfmt ); ctx->Driver.SaveNeedFlush = 1; @@ -1261,3 +1266,5 @@ void vbo_save_api_init( struct vbo_save_context *save ) _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); } + +#endif /* FEATURE_dlist */ diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c index a7cf29acd..297fd8705 100644 --- a/mesalib/src/mesa/vbo/vbo_save_draw.c +++ b/mesalib/src/mesa/vbo/vbo_save_draw.c @@ -38,12 +38,16 @@ #include "vbo_context.h" -/* +#if FEATURE_dlist + + +/** * After playback, copy everything but the position from the * last vertex to the saved state */ -static void _playback_copy_to_current( GLcontext *ctx, - const struct vbo_save_vertex_list *node ) +static void +_playback_copy_to_current(GLcontext *ctx, + const struct vbo_save_vertex_list *node) { struct vbo_context *vbo = vbo_context(ctx); GLfloat vertex[VBO_ATTRIB_MAX * 4]; @@ -81,8 +85,7 @@ static void _playback_copy_to_current( GLcontext *ctx, node->attrsz[i], data); - if (memcmp(current, tmp, 4 * sizeof(GLfloat)) != 0) - { + if (memcmp(current, tmp, 4 * sizeof(GLfloat)) != 0) { memcpy(current, tmp, 4 * sizeof(GLfloat)); vbo->currval[i].Size = node->attrsz[i]; @@ -117,11 +120,12 @@ static void _playback_copy_to_current( GLcontext *ctx, -/* Treat the vertex storage as a VBO, define vertex arrays pointing +/** + * Treat the vertex storage as a VBO, define vertex arrays pointing * into it: */ -static void vbo_bind_vertex_list( GLcontext *ctx, - const struct vbo_save_vertex_list *node ) +static void vbo_bind_vertex_list(GLcontext *ctx, + const struct vbo_save_vertex_list *node) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_save_context *save = &vbo->save; @@ -175,7 +179,7 @@ static void vbo_bind_vertex_list( GLcontext *ctx, } for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { - GLuint src = map[attr]; + const GLuint src = map[attr]; if (node_attrsz[src]) { /* override the default array set above */ @@ -203,21 +207,23 @@ static void vbo_bind_vertex_list( GLcontext *ctx, _mesa_set_varying_vp_inputs( ctx, varying_inputs ); } -static void vbo_save_loopback_vertex_list( GLcontext *ctx, - const struct vbo_save_vertex_list *list ) + +static void +vbo_save_loopback_vertex_list(GLcontext *ctx, + const struct vbo_save_vertex_list *list) { const char *buffer = ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB, GL_READ_ONLY, /* ? */ - list->vertex_store->bufferobj); + list->vertex_store->bufferobj); - vbo_loopback_vertex_list( ctx, - (const GLfloat *)(buffer + list->buffer_offset), - list->attrsz, - list->prim, - list->prim_count, - list->wrap_count, - list->vertex_size); + vbo_loopback_vertex_list(ctx, + (const GLfloat *)(buffer + list->buffer_offset), + list->attrsz, + list->prim, + list->prim_count, + list->wrap_count, + list->vertex_size); ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, list->vertex_store->bufferobj); @@ -226,10 +232,14 @@ static void vbo_save_loopback_vertex_list( GLcontext *ctx, /** * Execute the buffer and save copied verts. + * This is called from the display list code when executing + * a drawing command. */ -void vbo_save_playback_vertex_list( GLcontext *ctx, void *data ) +void +vbo_save_playback_vertex_list(GLcontext *ctx, void *data) { - const struct vbo_save_vertex_list *node = (const struct vbo_save_vertex_list *) data; + const struct vbo_save_vertex_list *node = + (const struct vbo_save_vertex_list *) data; struct vbo_save_context *save = &vbo_context(ctx)->save; FLUSH_CURRENT(ctx, 0); @@ -274,17 +284,20 @@ void vbo_save_playback_vertex_list( GLcontext *ctx, void *data ) if (ctx->NewState) _mesa_update_state( ctx ); - vbo_context(ctx)->draw_prims( ctx, - save->inputs, - node->prim, - node->prim_count, - NULL, - GL_TRUE, - 0, /* Node is a VBO, so this is ok */ - node->count - 1); + vbo_context(ctx)->draw_prims(ctx, + save->inputs, + node->prim, + node->prim_count, + NULL, + GL_TRUE, + 0, /* Node is a VBO, so this is ok */ + node->count - 1); } /* Copy to current? */ _playback_copy_to_current( ctx, node ); } + + +#endif /* FEATURE_dlist */ diff --git a/mesalib/src/mesa/vbo/vbo_save_loopback.c b/mesalib/src/mesa/vbo/vbo_save_loopback.c index 3f581ea02..5d1c7e481 100644 --- a/mesalib/src/mesa/vbo/vbo_save_loopback.c +++ b/mesalib/src/mesa/vbo/vbo_save_loopback.c @@ -36,6 +36,8 @@ #include "vbo_context.h" +#if FEATURE_dlist + typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * ); @@ -188,3 +190,6 @@ void vbo_loopback_vertex_list( GLcontext *ctx, } } } + + +#endif /* FEATURE_dlist */ diff --git a/mesalib/src/talloc/SConscript b/mesalib/src/talloc/SConscript new file mode 100644 index 000000000..3bf7029bb --- /dev/null +++ b/mesalib/src/talloc/SConscript @@ -0,0 +1,20 @@ +Import('*') + +if env['platform'] != 'windows': + Return() + +env = env.Clone() + +talloc = env.SharedLibrary( + target = 'talloc', + source = ['talloc.c', 'talloc.def'], +) + +env.InstallSharedLibrary(talloc) + +if env['platform'] == 'windows': + talloc = env.FindIxes(talloc, 'LIBPREFIX', 'LIBSUFFIX') +else: + talloc = env.FindIxes(talloc, 'SHLIBPREFIX', 'SHLIBSUFFIX') + +Export('talloc') diff --git a/mesalib/src/talloc/gpl-3.0.txt b/mesalib/src/talloc/gpl-3.0.txt new file mode 100644 index 000000000..94a9ed024 --- /dev/null +++ b/mesalib/src/talloc/gpl-3.0.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/mesalib/src/talloc/lgpl-3.0.txt b/mesalib/src/talloc/lgpl-3.0.txt new file mode 100644 index 000000000..65c5ca88a --- /dev/null +++ b/mesalib/src/talloc/lgpl-3.0.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/mesalib/src/talloc/talloc.c b/mesalib/src/talloc/talloc.c new file mode 100644 index 000000000..cc01346a7 --- /dev/null +++ b/mesalib/src/talloc/talloc.c @@ -0,0 +1,2034 @@ +/* + Samba Unix SMB/CIFS implementation. + + Samba trivial allocation library - new interface + + NOTE: Please read talloc_guide.txt for full documentation + + Copyright (C) Andrew Tridgell 2004 + Copyright (C) Stefan Metzmacher 2006 + + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* + inspired by http://swapped.cc/halloc/ +*/ + +#include "talloc.h" +#include <string.h> + +#define TALLOC_MIN(a,b) ((a)<(b)?(a):(b)) + +/* Visual C++ 2008 compatibility */ +#if defined(_MSC_VER) && !defined(_cplusplus) +typedef size_t ssize_t; +#define inline __inline +#endif + +/* Xcode/gcc4.0 compatibility */ +#if defined(__APPLE__) || defined(__MINGW32__) +static size_t strnlen (const char* s, size_t n) +{ + size_t i; + for (i = 0; i < n; ++i) + { + if (s[i] == '\0') + break; + } + return i; +} +#endif + +/* Visual C++ 2008 & Xcode/gcc4.0 compatibility */ +#if !defined(_cplusplus) && (defined(WIN32) || defined(__APPLE__)) +typedef int bool; +#define false 0 +#define true 1 +#endif + + +#ifdef TALLOC_BUILD_VERSION_MAJOR +#if (TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR) +#error "TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR" +#endif +#endif + +#ifdef TALLOC_BUILD_VERSION_MINOR +#if (TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR) +#error "TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR" +#endif +#endif + +/* use this to force every realloc to change the pointer, to stress test + code that might not cope */ +#define ALWAYS_REALLOC 0 + + +#define MAX_TALLOC_SIZE 0x10000000 +#define TALLOC_MAGIC_BASE 0xe814ec70 +#define TALLOC_MAGIC ( \ + TALLOC_MAGIC_BASE + \ + (TALLOC_VERSION_MAJOR << 12) + \ + (TALLOC_VERSION_MINOR << 4) \ +) + +#define TALLOC_FLAG_FREE 0x01 +#define TALLOC_FLAG_LOOP 0x02 +#define TALLOC_FLAG_POOL 0x04 /* This is a talloc pool */ +#define TALLOC_FLAG_POOLMEM 0x08 /* This is allocated in a pool */ +#define TALLOC_MAGIC_REFERENCE ((const char *)1) + +/* by default we abort when given a bad pointer (such as when talloc_free() is called + on a pointer that came from malloc() */ +#ifndef TALLOC_ABORT +#define TALLOC_ABORT(reason) abort() +#endif + +#ifndef discard_const_p +#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T) +# define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr))) +#else +# define discard_const_p(type, ptr) ((type *)(ptr)) +#endif +#endif + +/* these macros gain us a few percent of speed on gcc */ +#if (__GNUC__ >= 3) +/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 + as its first argument */ +#ifndef likely +#define likely(x) __builtin_expect(!!(x), 1) +#endif +#ifndef unlikely +#define unlikely(x) __builtin_expect(!!(x), 0) +#endif +#else +#ifndef likely +#define likely(x) (x) +#endif +#ifndef unlikely +#define unlikely(x) (x) +#endif +#endif + +/* this null_context is only used if talloc_enable_leak_report() or + talloc_enable_leak_report_full() is called, otherwise it remains + NULL +*/ +static void *null_context; +static void *autofree_context; + +struct talloc_reference_handle { + struct talloc_reference_handle *next, *prev; + void *ptr; + const char *location; +}; + +typedef int (*talloc_destructor_t)(void *); + +struct talloc_chunk { + struct talloc_chunk *next, *prev; + struct talloc_chunk *parent, *child; + struct talloc_reference_handle *refs; + talloc_destructor_t destructor; + const char *name; + size_t size; + unsigned flags; + + /* + * "pool" has dual use: + * + * For the talloc pool itself (i.e. TALLOC_FLAG_POOL is set), "pool" + * marks the end of the currently allocated area. + * + * For members of the pool (i.e. TALLOC_FLAG_POOLMEM is set), "pool" + * is a pointer to the struct talloc_chunk of the pool that it was + * allocated from. This way children can quickly find the pool to chew + * from. + */ + void *pool; +}; + +/* 16 byte alignment seems to keep everyone happy */ +#define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15) +#define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc)) + +int talloc_version_major(void) +{ + return TALLOC_VERSION_MAJOR; +} + +int talloc_version_minor(void) +{ + return TALLOC_VERSION_MINOR; +} + +static void (*talloc_log_fn)(const char *message); + +void talloc_set_log_fn(void (*log_fn)(const char *message)) +{ + talloc_log_fn = log_fn; +} + +static void talloc_log(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); +static void talloc_log(const char *fmt, ...) +{ + va_list ap; + char *message; + + if (!talloc_log_fn) { + return; + } + + va_start(ap, fmt); + message = talloc_vasprintf(NULL, fmt, ap); + va_end(ap); + + talloc_log_fn(message); + talloc_free(message); +} + +static void talloc_log_stderr(const char *message) +{ + fprintf(stderr, "%s", message); +} + +void talloc_set_log_stderr(void) +{ + talloc_set_log_fn(talloc_log_stderr); +} + +static void (*talloc_abort_fn)(const char *reason); + +void talloc_set_abort_fn(void (*abort_fn)(const char *reason)) +{ + talloc_abort_fn = abort_fn; +} + +static void talloc_abort(const char *reason) +{ + talloc_log("%s\n", reason); + + if (!talloc_abort_fn) { + TALLOC_ABORT(reason); + } + + talloc_abort_fn(reason); +} + +static void talloc_abort_magic(unsigned magic) +{ + unsigned striped = magic - TALLOC_MAGIC_BASE; + unsigned major = (striped & 0xFFFFF000) >> 12; + unsigned minor = (striped & 0x00000FF0) >> 4; + talloc_log("Bad talloc magic[0x%08X/%u/%u] expected[0x%08X/%u/%u]\n", + magic, major, minor, + TALLOC_MAGIC, TALLOC_VERSION_MAJOR, TALLOC_VERSION_MINOR); + talloc_abort("Bad talloc magic value - wrong talloc version used/mixed"); +} + +static void talloc_abort_double_free(void) +{ + talloc_abort("Bad talloc magic value - double free"); +} + +static void talloc_abort_unknown_value(void) +{ + talloc_abort("Bad talloc magic value - unknown value"); +} + +/* panic if we get a bad magic value */ +static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr) +{ + const char *pp = (const char *)ptr; + struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE); + if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) { + if ((tc->flags & (~0xFFF)) == TALLOC_MAGIC_BASE) { + talloc_abort_magic(tc->flags & (~0xF)); + return NULL; + } + + if (tc->flags & TALLOC_FLAG_FREE) { + talloc_log("talloc: double free error - first free may be at %s\n", tc->name); + talloc_abort_double_free(); + return NULL; + } else { + talloc_abort_unknown_value(); + return NULL; + } + } + return tc; +} + +/* hook into the front of the list */ +#define _TLIST_ADD(list, p) \ +do { \ + if (!(list)) { \ + (list) = (p); \ + (p)->next = (p)->prev = NULL; \ + } else { \ + (list)->prev = (p); \ + (p)->next = (list); \ + (p)->prev = NULL; \ + (list) = (p); \ + }\ +} while (0) + +/* remove an element from a list - element doesn't have to be in list. */ +#define _TLIST_REMOVE(list, p) \ +do { \ + if ((p) == (list)) { \ + (list) = (p)->next; \ + if (list) (list)->prev = NULL; \ + } else { \ + if ((p)->prev) (p)->prev->next = (p)->next; \ + if ((p)->next) (p)->next->prev = (p)->prev; \ + } \ + if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \ +} while (0) + + +/* + return the parent chunk of a pointer +*/ +static inline struct talloc_chunk *talloc_parent_chunk(const void *ptr) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return NULL; + } + + tc = talloc_chunk_from_ptr(ptr); + while (tc->prev) tc=tc->prev; + + return tc->parent; +} + +void *talloc_parent(const void *ptr) +{ + struct talloc_chunk *tc = talloc_parent_chunk(ptr); + return tc? TC_PTR_FROM_CHUNK(tc) : NULL; +} + +/* + find parents name +*/ +const char *talloc_parent_name(const void *ptr) +{ + struct talloc_chunk *tc = talloc_parent_chunk(ptr); + return tc? tc->name : NULL; +} + +/* + A pool carries an in-pool object count count in the first 16 bytes. + bytes. This is done to support talloc_steal() to a parent outside of the + pool. The count includes the pool itself, so a talloc_free() on a pool will + only destroy the pool if the count has dropped to zero. A talloc_free() of a + pool member will reduce the count, and eventually also call free(3) on the + pool memory. + + The object count is not put into "struct talloc_chunk" because it is only + relevant for talloc pools and the alignment to 16 bytes would increase the + memory footprint of each talloc chunk by those 16 bytes. +*/ + +#define TALLOC_POOL_HDR_SIZE 16 + +static unsigned int *talloc_pool_objectcount(struct talloc_chunk *tc) +{ + return (unsigned int *)((char *)tc + sizeof(struct talloc_chunk)); +} + +/* + Allocate from a pool +*/ + +static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent, + size_t size) +{ + struct talloc_chunk *pool_ctx = NULL; + size_t space_left; + struct talloc_chunk *result; + size_t chunk_size; + + if (parent == NULL) { + return NULL; + } + + if (parent->flags & TALLOC_FLAG_POOL) { + pool_ctx = parent; + } + else if (parent->flags & TALLOC_FLAG_POOLMEM) { + pool_ctx = (struct talloc_chunk *)parent->pool; + } + + if (pool_ctx == NULL) { + return NULL; + } + + space_left = ((char *)pool_ctx + TC_HDR_SIZE + pool_ctx->size) + - ((char *)pool_ctx->pool); + + /* + * Align size to 16 bytes + */ + chunk_size = ((size + 15) & ~15); + + if (space_left < chunk_size) { + return NULL; + } + + result = (struct talloc_chunk *)pool_ctx->pool; + +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED) + VALGRIND_MAKE_MEM_UNDEFINED(result, size); +#endif + + pool_ctx->pool = (void *)((char *)result + chunk_size); + + result->flags = TALLOC_MAGIC | TALLOC_FLAG_POOLMEM; + result->pool = pool_ctx; + + *talloc_pool_objectcount(pool_ctx) += 1; + + return result; +} + +/* + Allocate a bit of memory as a child of an existing pointer +*/ +static inline void *__talloc(const void *context, size_t size) +{ + struct talloc_chunk *tc = NULL; + + if (unlikely(context == NULL)) { + context = null_context; + } + + if (unlikely(size >= MAX_TALLOC_SIZE)) { + return NULL; + } + + if (context != NULL) { + tc = talloc_alloc_pool(talloc_chunk_from_ptr(context), + TC_HDR_SIZE+size); + } + + if (tc == NULL) { + tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size); + if (unlikely(tc == NULL)) return NULL; + tc->flags = TALLOC_MAGIC; + tc->pool = NULL; + } + + tc->size = size; + tc->destructor = NULL; + tc->child = NULL; + tc->name = NULL; + tc->refs = NULL; + + if (likely(context)) { + struct talloc_chunk *parent = talloc_chunk_from_ptr(context); + + if (parent->child) { + parent->child->parent = NULL; + tc->next = parent->child; + tc->next->prev = tc; + } else { + tc->next = NULL; + } + tc->parent = parent; + tc->prev = NULL; + parent->child = tc; + } else { + tc->next = tc->prev = tc->parent = NULL; + } + + return TC_PTR_FROM_CHUNK(tc); +} + +/* + * Create a talloc pool + */ + +void *talloc_pool(const void *context, size_t size) +{ + void *result = __talloc(context, size + TALLOC_POOL_HDR_SIZE); + struct talloc_chunk *tc; + + if (unlikely(result == NULL)) { + return NULL; + } + + tc = talloc_chunk_from_ptr(result); + + tc->flags |= TALLOC_FLAG_POOL; + tc->pool = (char *)result + TALLOC_POOL_HDR_SIZE; + + *talloc_pool_objectcount(tc) = 1; + +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS) + VALGRIND_MAKE_MEM_NOACCESS(tc->pool, size); +#endif + + return result; +} + +/* + setup a destructor to be called on free of a pointer + the destructor should return 0 on success, or -1 on failure. + if the destructor fails then the free is failed, and the memory can + be continued to be used +*/ +void _talloc_set_destructor(const void *ptr, int (*destructor)(void *)) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + tc->destructor = destructor; +} + +/* + increase the reference count on a piece of memory. +*/ +int talloc_increase_ref_count(const void *ptr) +{ + if (unlikely(!talloc_reference(null_context, ptr))) { + return -1; + } + return 0; +} + +/* + helper for talloc_reference() + + this is referenced by a function pointer and should not be inline +*/ +static int talloc_reference_destructor(struct talloc_reference_handle *handle) +{ + struct talloc_chunk *ptr_tc = talloc_chunk_from_ptr(handle->ptr); + _TLIST_REMOVE(ptr_tc->refs, handle); + return 0; +} + +/* + more efficient way to add a name to a pointer - the name must point to a + true string constant +*/ +static inline void _talloc_set_name_const(const void *ptr, const char *name) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + tc->name = name; +} + +/* + internal talloc_named_const() +*/ +static inline void *_talloc_named_const(const void *context, size_t size, const char *name) +{ + void *ptr; + + ptr = __talloc(context, size); + if (unlikely(ptr == NULL)) { + return NULL; + } + + _talloc_set_name_const(ptr, name); + + return ptr; +} + +/* + make a secondary reference to a pointer, hanging off the given context. + the pointer remains valid until both the original caller and this given + context are freed. + + the major use for this is when two different structures need to reference the + same underlying data, and you want to be able to free the two instances separately, + and in either order +*/ +void *_talloc_reference_loc(const void *context, const void *ptr, const char *location) +{ + struct talloc_chunk *tc; + struct talloc_reference_handle *handle; + if (unlikely(ptr == NULL)) return NULL; + + tc = talloc_chunk_from_ptr(ptr); + handle = (struct talloc_reference_handle *)_talloc_named_const(context, + sizeof(struct talloc_reference_handle), + TALLOC_MAGIC_REFERENCE); + if (unlikely(handle == NULL)) return NULL; + + /* note that we hang the destructor off the handle, not the + main context as that allows the caller to still setup their + own destructor on the context if they want to */ + talloc_set_destructor(handle, talloc_reference_destructor); + handle->ptr = discard_const_p(void, ptr); + handle->location = location; + _TLIST_ADD(tc->refs, handle); + return handle->ptr; +} + +static void *_talloc_steal_internal(const void *new_ctx, const void *ptr); + +/* + internal talloc_free call +*/ +static inline int _talloc_free_internal(void *ptr, const char *location) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return -1; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (unlikely(tc->refs)) { + int is_child; + /* check this is a reference from a child or grantchild + * back to it's parent or grantparent + * + * in that case we need to remove the reference and + * call another instance of talloc_free() on the current + * pointer. + */ + is_child = talloc_is_parent(tc->refs, ptr); + _talloc_free_internal(tc->refs, location); + if (is_child) { + return _talloc_free_internal(ptr, location); + } + return -1; + } + + if (unlikely(tc->flags & TALLOC_FLAG_LOOP)) { + /* we have a free loop - stop looping */ + return 0; + } + + if (unlikely(tc->destructor)) { + talloc_destructor_t d = tc->destructor; + if (d == (talloc_destructor_t)-1) { + return -1; + } + tc->destructor = (talloc_destructor_t)-1; + if (d(ptr) == -1) { + tc->destructor = d; + return -1; + } + tc->destructor = NULL; + } + + if (tc->parent) { + _TLIST_REMOVE(tc->parent->child, tc); + if (tc->parent->child) { + tc->parent->child->parent = tc->parent; + } + } else { + if (tc->prev) tc->prev->next = tc->next; + if (tc->next) tc->next->prev = tc->prev; + } + + tc->flags |= TALLOC_FLAG_LOOP; + + while (tc->child) { + /* we need to work out who will own an abandoned child + if it cannot be freed. In priority order, the first + choice is owner of any remaining reference to this + pointer, the second choice is our parent, and the + final choice is the null context. */ + void *child = TC_PTR_FROM_CHUNK(tc->child); + const void *new_parent = null_context; + if (unlikely(tc->child->refs)) { + struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs); + if (p) new_parent = TC_PTR_FROM_CHUNK(p); + } + if (unlikely(_talloc_free_internal(child, location) == -1)) { + if (new_parent == null_context) { + struct talloc_chunk *p = talloc_parent_chunk(ptr); + if (p) new_parent = TC_PTR_FROM_CHUNK(p); + } + _talloc_steal_internal(new_parent, child); + } + } + + tc->flags |= TALLOC_FLAG_FREE; + + /* we mark the freed memory with where we called the free + * from. This means on a double free error we can report where + * the first free came from + */ + tc->name = location; + + if (tc->flags & (TALLOC_FLAG_POOL|TALLOC_FLAG_POOLMEM)) { + struct talloc_chunk *pool; + unsigned int *pool_object_count; + + pool = (tc->flags & TALLOC_FLAG_POOL) + ? tc : (struct talloc_chunk *)tc->pool; + + pool_object_count = talloc_pool_objectcount(pool); + + if (*pool_object_count == 0) { + talloc_abort("Pool object count zero!"); + return 0; + } + + *pool_object_count -= 1; + + if (*pool_object_count == 0) { + free(pool); + } + } + else { + free(tc); + } + return 0; +} + +/* + move a lump of memory from one talloc context to another return the + ptr on success, or NULL if it could not be transferred. + passing NULL as ptr will always return NULL with no side effects. +*/ +static void *_talloc_steal_internal(const void *new_ctx, const void *ptr) +{ + struct talloc_chunk *tc, *new_tc; + + if (unlikely(!ptr)) { + return NULL; + } + + if (unlikely(new_ctx == NULL)) { + new_ctx = null_context; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (unlikely(new_ctx == NULL)) { + if (tc->parent) { + _TLIST_REMOVE(tc->parent->child, tc); + if (tc->parent->child) { + tc->parent->child->parent = tc->parent; + } + } else { + if (tc->prev) tc->prev->next = tc->next; + if (tc->next) tc->next->prev = tc->prev; + } + + tc->parent = tc->next = tc->prev = NULL; + return discard_const_p(void, ptr); + } + + new_tc = talloc_chunk_from_ptr(new_ctx); + + if (unlikely(tc == new_tc || tc->parent == new_tc)) { + return discard_const_p(void, ptr); + } + + if (tc->parent) { + _TLIST_REMOVE(tc->parent->child, tc); + if (tc->parent->child) { + tc->parent->child->parent = tc->parent; + } + } else { + if (tc->prev) tc->prev->next = tc->next; + if (tc->next) tc->next->prev = tc->prev; + } + + tc->parent = new_tc; + if (new_tc->child) new_tc->child->parent = NULL; + _TLIST_ADD(new_tc->child, tc); + + return discard_const_p(void, ptr); +} + +/* + move a lump of memory from one talloc context to another return the + ptr on success, or NULL if it could not be transferred. + passing NULL as ptr will always return NULL with no side effects. +*/ +void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return NULL; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (unlikely(tc->refs != NULL) && talloc_parent(ptr) != new_ctx) { + struct talloc_reference_handle *h; + + talloc_log("WARNING: talloc_steal with references at %s\n", + location); + + for (h=tc->refs; h; h=h->next) { + talloc_log("\treference at %s\n", + h->location); + } + } + + return _talloc_steal_internal(new_ctx, ptr); +} + +/* + this is like a talloc_steal(), but you must supply the old + parent. This resolves the ambiguity in a talloc_steal() which is + called on a context that has more than one parent (via references) + + The old parent can be either a reference or a parent +*/ +void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr) +{ + struct talloc_chunk *tc; + struct talloc_reference_handle *h; + + if (unlikely(ptr == NULL)) { + return NULL; + } + + if (old_parent == talloc_parent(ptr)) { + return _talloc_steal_internal(new_parent, ptr); + } + + tc = talloc_chunk_from_ptr(ptr); + for (h=tc->refs;h;h=h->next) { + if (talloc_parent(h) == old_parent) { + if (_talloc_steal_internal(new_parent, h) != h) { + return NULL; + } + return discard_const_p(void, ptr); + } + } + + /* it wasn't a parent */ + return NULL; +} + +/* + remove a secondary reference to a pointer. This undo's what + talloc_reference() has done. The context and pointer arguments + must match those given to a talloc_reference() +*/ +static inline int talloc_unreference(const void *context, const void *ptr) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + struct talloc_reference_handle *h; + + if (unlikely(context == NULL)) { + context = null_context; + } + + for (h=tc->refs;h;h=h->next) { + struct talloc_chunk *p = talloc_parent_chunk(h); + if (p == NULL) { + if (context == NULL) break; + } else if (TC_PTR_FROM_CHUNK(p) == context) { + break; + } + } + if (h == NULL) { + return -1; + } + + return _talloc_free_internal(h, __location__); +} + +/* + remove a specific parent context from a pointer. This is a more + controlled varient of talloc_free() +*/ +int talloc_unlink(const void *context, void *ptr) +{ + struct talloc_chunk *tc_p, *new_p; + void *new_parent; + + if (ptr == NULL) { + return -1; + } + + if (context == NULL) { + context = null_context; + } + + if (talloc_unreference(context, ptr) == 0) { + return 0; + } + + if (context == NULL) { + if (talloc_parent_chunk(ptr) != NULL) { + return -1; + } + } else { + if (talloc_chunk_from_ptr(context) != talloc_parent_chunk(ptr)) { + return -1; + } + } + + tc_p = talloc_chunk_from_ptr(ptr); + + if (tc_p->refs == NULL) { + return _talloc_free_internal(ptr, __location__); + } + + new_p = talloc_parent_chunk(tc_p->refs); + if (new_p) { + new_parent = TC_PTR_FROM_CHUNK(new_p); + } else { + new_parent = NULL; + } + + if (talloc_unreference(new_parent, ptr) != 0) { + return -1; + } + + _talloc_steal_internal(new_parent, ptr); + + return 0; +} + +/* + add a name to an existing pointer - va_list version +*/ +static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); + +static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + tc->name = talloc_vasprintf(ptr, fmt, ap); + if (likely(tc->name)) { + _talloc_set_name_const(tc->name, ".name"); + } + return tc->name; +} + +/* + add a name to an existing pointer +*/ +const char *talloc_set_name(const void *ptr, const char *fmt, ...) +{ + const char *name; + va_list ap; + va_start(ap, fmt); + name = talloc_set_name_v(ptr, fmt, ap); + va_end(ap); + return name; +} + + +/* + create a named talloc pointer. Any talloc pointer can be named, and + talloc_named() operates just like talloc() except that it allows you + to name the pointer. +*/ +void *talloc_named(const void *context, size_t size, const char *fmt, ...) +{ + va_list ap; + void *ptr; + const char *name; + + ptr = __talloc(context, size); + if (unlikely(ptr == NULL)) return NULL; + + va_start(ap, fmt); + name = talloc_set_name_v(ptr, fmt, ap); + va_end(ap); + + if (unlikely(name == NULL)) { + _talloc_free_internal(ptr, __location__); + return NULL; + } + + return ptr; +} + +/* + return the name of a talloc ptr, or "UNNAMED" +*/ +const char *talloc_get_name(const void *ptr) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + if (unlikely(tc->name == TALLOC_MAGIC_REFERENCE)) { + return ".reference"; + } + if (likely(tc->name)) { + return tc->name; + } + return "UNNAMED"; +} + + +/* + check if a pointer has the given name. If it does, return the pointer, + otherwise return NULL +*/ +void *talloc_check_name(const void *ptr, const char *name) +{ + const char *pname; + if (unlikely(ptr == NULL)) return NULL; + pname = talloc_get_name(ptr); + if (likely(pname == name || strcmp(pname, name) == 0)) { + return discard_const_p(void, ptr); + } + return NULL; +} + +static void talloc_abort_type_missmatch(const char *location, + const char *name, + const char *expected) +{ + const char *reason; + + reason = talloc_asprintf(NULL, + "%s: Type mismatch: name[%s] expected[%s]", + location, + name?name:"NULL", + expected); + if (!reason) { + reason = "Type mismatch"; + } + + talloc_abort(reason); +} + +void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location) +{ + const char *pname; + + if (unlikely(ptr == NULL)) { + talloc_abort_type_missmatch(location, NULL, name); + return NULL; + } + + pname = talloc_get_name(ptr); + if (likely(pname == name || strcmp(pname, name) == 0)) { + return discard_const_p(void, ptr); + } + + talloc_abort_type_missmatch(location, pname, name); + return NULL; +} + +/* + this is for compatibility with older versions of talloc +*/ +void *talloc_init(const char *fmt, ...) +{ + va_list ap; + void *ptr; + const char *name; + + /* + * samba3 expects talloc_report_depth_cb(NULL, ...) + * reports all talloc'ed memory, so we need to enable + * null_tracking + */ + talloc_enable_null_tracking(); + + ptr = __talloc(NULL, 0); + if (unlikely(ptr == NULL)) return NULL; + + va_start(ap, fmt); + name = talloc_set_name_v(ptr, fmt, ap); + va_end(ap); + + if (unlikely(name == NULL)) { + _talloc_free_internal(ptr, __location__); + return NULL; + } + + return ptr; +} + +/* + this is a replacement for the Samba3 talloc_destroy_pool functionality. It + should probably not be used in new code. It's in here to keep the talloc + code consistent across Samba 3 and 4. +*/ +void talloc_free_children(void *ptr) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return; + } + + tc = talloc_chunk_from_ptr(ptr); + + while (tc->child) { + /* we need to work out who will own an abandoned child + if it cannot be freed. In priority order, the first + choice is owner of any remaining reference to this + pointer, the second choice is our parent, and the + final choice is the null context. */ + void *child = TC_PTR_FROM_CHUNK(tc->child); + const void *new_parent = null_context; + if (unlikely(tc->child->refs)) { + struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs); + if (p) new_parent = TC_PTR_FROM_CHUNK(p); + } + if (unlikely(talloc_free(child) == -1)) { + if (new_parent == null_context) { + struct talloc_chunk *p = talloc_parent_chunk(ptr); + if (p) new_parent = TC_PTR_FROM_CHUNK(p); + } + _talloc_steal_internal(new_parent, child); + } + } + + if ((tc->flags & TALLOC_FLAG_POOL) + && (*talloc_pool_objectcount(tc) == 1)) { + tc->pool = ((char *)tc + TC_HDR_SIZE + TALLOC_POOL_HDR_SIZE); +#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS) + VALGRIND_MAKE_MEM_NOACCESS( + tc->pool, tc->size - TALLOC_POOL_HDR_SIZE); +#endif + } +} + +/* + Allocate a bit of memory as a child of an existing pointer +*/ +void *_talloc(const void *context, size_t size) +{ + return __talloc(context, size); +} + +/* + externally callable talloc_set_name_const() +*/ +void talloc_set_name_const(const void *ptr, const char *name) +{ + _talloc_set_name_const(ptr, name); +} + +/* + create a named talloc pointer. Any talloc pointer can be named, and + talloc_named() operates just like talloc() except that it allows you + to name the pointer. +*/ +void *talloc_named_const(const void *context, size_t size, const char *name) +{ + return _talloc_named_const(context, size, name); +} + +/* + free a talloc pointer. This also frees all child pointers of this + pointer recursively + + return 0 if the memory is actually freed, otherwise -1. The memory + will not be freed if the ref_count is > 1 or the destructor (if + any) returns non-zero +*/ +int _talloc_free(void *ptr, const char *location) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return -1; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (unlikely(tc->refs != NULL)) { + struct talloc_reference_handle *h; + + talloc_log("ERROR: talloc_free with references at %s\n", + location); + + for (h=tc->refs; h; h=h->next) { + talloc_log("\treference at %s\n", + h->location); + } + return -1; + } + + return _talloc_free_internal(ptr, location); +} + + + +/* + A talloc version of realloc. The context argument is only used if + ptr is NULL +*/ +void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name) +{ + struct talloc_chunk *tc; + void *new_ptr; + bool malloced = false; + + /* size zero is equivalent to free() */ + if (unlikely(size == 0)) { + talloc_unlink(context, ptr); + return NULL; + } + + if (unlikely(size >= MAX_TALLOC_SIZE)) { + return NULL; + } + + /* realloc(NULL) is equivalent to malloc() */ + if (ptr == NULL) { + return _talloc_named_const(context, size, name); + } + + tc = talloc_chunk_from_ptr(ptr); + + /* don't allow realloc on referenced pointers */ + if (unlikely(tc->refs)) { + return NULL; + } + + /* don't let anybody try to realloc a talloc_pool */ + if (unlikely(tc->flags & TALLOC_FLAG_POOL)) { + return NULL; + } + + /* don't shrink if we have less than 1k to gain */ + if ((size < tc->size) && ((tc->size - size) < 1024)) { + tc->size = size; + return ptr; + } + + /* by resetting magic we catch users of the old memory */ + tc->flags |= TALLOC_FLAG_FREE; + +#if ALWAYS_REALLOC + new_ptr = malloc(size + TC_HDR_SIZE); + if (new_ptr) { + memcpy(new_ptr, tc, tc->size + TC_HDR_SIZE); + free(tc); + } +#else + if (tc->flags & TALLOC_FLAG_POOLMEM) { + + new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE); + *talloc_pool_objectcount((struct talloc_chunk *) + (tc->pool)) -= 1; + + if (new_ptr == NULL) { + new_ptr = malloc(TC_HDR_SIZE+size); + malloced = true; + } + + if (new_ptr) { + memcpy(new_ptr, tc, TALLOC_MIN(tc->size,size) + TC_HDR_SIZE); + } + } + else { + new_ptr = realloc(tc, size + TC_HDR_SIZE); + } +#endif + if (unlikely(!new_ptr)) { + tc->flags &= ~TALLOC_FLAG_FREE; + return NULL; + } + + tc = (struct talloc_chunk *)new_ptr; + tc->flags &= ~TALLOC_FLAG_FREE; + if (malloced) { + tc->flags &= ~TALLOC_FLAG_POOLMEM; + } + if (tc->parent) { + tc->parent->child = tc; + } + if (tc->child) { + tc->child->parent = tc; + } + + if (tc->prev) { + tc->prev->next = tc; + } + if (tc->next) { + tc->next->prev = tc; + } + + tc->size = size; + _talloc_set_name_const(TC_PTR_FROM_CHUNK(tc), name); + + return TC_PTR_FROM_CHUNK(tc); +} + +/* + a wrapper around talloc_steal() for situations where you are moving a pointer + between two structures, and want the old pointer to be set to NULL +*/ +void *_talloc_move(const void *new_ctx, const void *_pptr) +{ + const void **pptr = discard_const_p(const void *,_pptr); + void *ret = talloc_steal(new_ctx, discard_const_p(void, *pptr)); + (*pptr) = NULL; + return ret; +} + +/* + return the total size of a talloc pool (subtree) +*/ +size_t talloc_total_size(const void *ptr) +{ + size_t total = 0; + struct talloc_chunk *c, *tc; + + if (ptr == NULL) { + ptr = null_context; + } + if (ptr == NULL) { + return 0; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (tc->flags & TALLOC_FLAG_LOOP) { + return 0; + } + + tc->flags |= TALLOC_FLAG_LOOP; + + if (likely(tc->name != TALLOC_MAGIC_REFERENCE)) { + total = tc->size; + } + for (c=tc->child;c;c=c->next) { + total += talloc_total_size(TC_PTR_FROM_CHUNK(c)); + } + + tc->flags &= ~TALLOC_FLAG_LOOP; + + return total; +} + +/* + return the total number of blocks in a talloc pool (subtree) +*/ +size_t talloc_total_blocks(const void *ptr) +{ + size_t total = 0; + struct talloc_chunk *c, *tc; + + if (ptr == NULL) { + ptr = null_context; + } + if (ptr == NULL) { + return 0; + } + + tc = talloc_chunk_from_ptr(ptr); + + if (tc->flags & TALLOC_FLAG_LOOP) { + return 0; + } + + tc->flags |= TALLOC_FLAG_LOOP; + + total++; + for (c=tc->child;c;c=c->next) { + total += talloc_total_blocks(TC_PTR_FROM_CHUNK(c)); + } + + tc->flags &= ~TALLOC_FLAG_LOOP; + + return total; +} + +/* + return the number of external references to a pointer +*/ +size_t talloc_reference_count(const void *ptr) +{ + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); + struct talloc_reference_handle *h; + size_t ret = 0; + + for (h=tc->refs;h;h=h->next) { + ret++; + } + return ret; +} + +/* + report on memory usage by all children of a pointer, giving a full tree view +*/ +void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, + void (*callback)(const void *ptr, + int depth, int max_depth, + int is_ref, + void *private_data), + void *private_data) +{ + struct talloc_chunk *c, *tc; + + if (ptr == NULL) { + ptr = null_context; + } + if (ptr == NULL) return; + + tc = talloc_chunk_from_ptr(ptr); + + if (tc->flags & TALLOC_FLAG_LOOP) { + return; + } + + callback(ptr, depth, max_depth, 0, private_data); + + if (max_depth >= 0 && depth >= max_depth) { + return; + } + + tc->flags |= TALLOC_FLAG_LOOP; + for (c=tc->child;c;c=c->next) { + if (c->name == TALLOC_MAGIC_REFERENCE) { + struct talloc_reference_handle *h = (struct talloc_reference_handle *)TC_PTR_FROM_CHUNK(c); + callback(h->ptr, depth + 1, max_depth, 1, private_data); + } else { + talloc_report_depth_cb(TC_PTR_FROM_CHUNK(c), depth + 1, max_depth, callback, private_data); + } + } + tc->flags &= ~TALLOC_FLAG_LOOP; +} + +static void talloc_report_depth_FILE_helper(const void *ptr, int depth, int max_depth, int is_ref, void *_f) +{ + const char *name = talloc_get_name(ptr); + FILE *f = (FILE *)_f; + + if (is_ref) { + fprintf(f, "%*sreference to: %s\n", depth*4, "", name); + return; + } + + if (depth == 0) { + fprintf(f,"%stalloc report on '%s' (total %6lu bytes in %3lu blocks)\n", + (max_depth < 0 ? "full " :""), name, + (unsigned long)talloc_total_size(ptr), + (unsigned long)talloc_total_blocks(ptr)); + return; + } + + fprintf(f, "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d) %p\n", + depth*4, "", + name, + (unsigned long)talloc_total_size(ptr), + (unsigned long)talloc_total_blocks(ptr), + (int)talloc_reference_count(ptr), ptr); + +#if 0 + fprintf(f, "content: "); + if (talloc_total_size(ptr)) { + int tot = talloc_total_size(ptr); + int i; + + for (i = 0; i < tot; i++) { + if ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) { + fprintf(f, "%c", ((char *)ptr)[i]); + } else { + fprintf(f, "~%02x", ((char *)ptr)[i]); + } + } + } + fprintf(f, "\n"); +#endif +} + +/* + report on memory usage by all children of a pointer, giving a full tree view +*/ +void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f) +{ + if (f) { + talloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f); + fflush(f); + } +} + +/* + report on memory usage by all children of a pointer, giving a full tree view +*/ +void talloc_report_full(const void *ptr, FILE *f) +{ + talloc_report_depth_file(ptr, 0, -1, f); +} + +/* + report on memory usage by all children of a pointer +*/ +void talloc_report(const void *ptr, FILE *f) +{ + talloc_report_depth_file(ptr, 0, 1, f); +} + +/* + report on any memory hanging off the null context +*/ +static void talloc_report_null(void) +{ + if (talloc_total_size(null_context) != 0) { + talloc_report(null_context, stderr); + } +} + +/* + report on any memory hanging off the null context +*/ +static void talloc_report_null_full(void) +{ + if (talloc_total_size(null_context) != 0) { + talloc_report_full(null_context, stderr); + } +} + +/* + enable tracking of the NULL context +*/ +void talloc_enable_null_tracking(void) +{ + if (null_context == NULL) { + null_context = _talloc_named_const(NULL, 0, "null_context"); + if (autofree_context != NULL) { + talloc_reparent(NULL, null_context, autofree_context); + } + } +} + +/* + enable tracking of the NULL context, not moving the autofree context + into the NULL context. This is needed for the talloc testsuite +*/ +void talloc_enable_null_tracking_no_autofree(void) +{ + if (null_context == NULL) { + null_context = _talloc_named_const(NULL, 0, "null_context"); + } +} + +/* + disable tracking of the NULL context +*/ +void talloc_disable_null_tracking(void) +{ + if (null_context != NULL) { + /* we have to move any children onto the real NULL + context */ + struct talloc_chunk *tc, *tc2; + tc = talloc_chunk_from_ptr(null_context); + for (tc2 = tc->child; tc2; tc2=tc2->next) { + if (tc2->parent == tc) tc2->parent = NULL; + if (tc2->prev == tc) tc2->prev = NULL; + } + for (tc2 = tc->next; tc2; tc2=tc2->next) { + if (tc2->parent == tc) tc2->parent = NULL; + if (tc2->prev == tc) tc2->prev = NULL; + } + tc->child = NULL; + tc->next = NULL; + } + talloc_free(null_context); + null_context = NULL; +} + +/* + enable leak reporting on exit +*/ +void talloc_enable_leak_report(void) +{ + talloc_enable_null_tracking(); + atexit(talloc_report_null); +} + +/* + enable full leak reporting on exit +*/ +void talloc_enable_leak_report_full(void) +{ + talloc_enable_null_tracking(); + atexit(talloc_report_null_full); +} + +/* + talloc and zero memory. +*/ +void *_talloc_zero(const void *ctx, size_t size, const char *name) +{ + void *p = _talloc_named_const(ctx, size, name); + + if (p) { + memset(p, '\0', size); + } + + return p; +} + +/* + memdup with a talloc. +*/ +void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name) +{ + void *newp = _talloc_named_const(t, size, name); + + if (likely(newp)) { + memcpy(newp, p, size); + } + + return newp; +} + +static inline char *__talloc_strlendup(const void *t, const char *p, size_t len) +{ + char *ret; + + ret = (char *)__talloc(t, len + 1); + if (unlikely(!ret)) return NULL; + + memcpy(ret, p, len); + ret[len] = 0; + + _talloc_set_name_const(ret, ret); + return ret; +} + +/* + strdup with a talloc +*/ +char *talloc_strdup(const void *t, const char *p) +{ + if (unlikely(!p)) return NULL; + return __talloc_strlendup(t, p, strlen(p)); +} + +/* + strndup with a talloc +*/ +char *talloc_strndup(const void *t, const char *p, size_t n) +{ + if (unlikely(!p)) return NULL; + return __talloc_strlendup(t, p, strnlen(p, n)); +} + +static inline char *__talloc_strlendup_append(char *s, size_t slen, + const char *a, size_t alen) +{ + char *ret; + + ret = talloc_realloc(NULL, s, char, slen + alen + 1); + if (unlikely(!ret)) return NULL; + + /* append the string and the trailing \0 */ + memcpy(&ret[slen], a, alen); + ret[slen+alen] = 0; + + _talloc_set_name_const(ret, ret); + return ret; +} + +/* + * Appends at the end of the string. + */ +char *talloc_strdup_append(char *s, const char *a) +{ + if (unlikely(!s)) { + return talloc_strdup(NULL, a); + } + + if (unlikely(!a)) { + return s; + } + + return __talloc_strlendup_append(s, strlen(s), a, strlen(a)); +} + +/* + * Appends at the end of the talloc'ed buffer, + * not the end of the string. + */ +char *talloc_strdup_append_buffer(char *s, const char *a) +{ + size_t slen; + + if (unlikely(!s)) { + return talloc_strdup(NULL, a); + } + + if (unlikely(!a)) { + return s; + } + + slen = talloc_get_size(s); + if (likely(slen > 0)) { + slen--; + } + + return __talloc_strlendup_append(s, slen, a, strlen(a)); +} + +/* + * Appends at the end of the string. + */ +char *talloc_strndup_append(char *s, const char *a, size_t n) +{ + if (unlikely(!s)) { + return talloc_strdup(NULL, a); + } + + if (unlikely(!a)) { + return s; + } + + return __talloc_strlendup_append(s, strlen(s), a, strnlen(a, n)); +} + +/* + * Appends at the end of the talloc'ed buffer, + * not the end of the string. + */ +char *talloc_strndup_append_buffer(char *s, const char *a, size_t n) +{ + size_t slen; + + if (unlikely(!s)) { + return talloc_strdup(NULL, a); + } + + if (unlikely(!a)) { + return s; + } + + slen = talloc_get_size(s); + if (likely(slen > 0)) { + slen--; + } + + return __talloc_strlendup_append(s, slen, a, strnlen(a, n)); +} + +#ifndef va_copy +#ifdef HAVE___VA_COPY +#define va_copy(dest, src) __va_copy(dest, src) +#else +#define va_copy(dest, src) (dest) = (src) +#endif +#endif + +char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) +{ + int len; + char *ret; + va_list ap2; + char c; + + /* this call looks strange, but it makes it work on older solaris boxes */ + va_copy(ap2, ap); + #ifdef _MSC_VER + /* MSVC runtime needs to use _vcsprintf to return buffer size; vsnprintf would return -1 */ + len = _vscprintf(fmt, ap2); + #else + len = vsnprintf(&c, 1, fmt, ap2); + #endif + va_end(ap2); + if (unlikely(len < 0)) { + return NULL; + } + + ret = (char *)__talloc(t, len+1); + if (unlikely(!ret)) return NULL; + + va_copy(ap2, ap); + vsnprintf(ret, len+1, fmt, ap2); + va_end(ap2); + + _talloc_set_name_const(ret, ret); + return ret; +} + + +/* + Perform string formatting, and return a pointer to newly allocated + memory holding the result, inside a memory pool. + */ +char *talloc_asprintf(const void *t, const char *fmt, ...) +{ + va_list ap; + char *ret; + + va_start(ap, fmt); + ret = talloc_vasprintf(t, fmt, ap); + va_end(ap); + return ret; +} + +static inline char *__talloc_vaslenprintf_append(char *s, size_t slen, + const char *fmt, va_list ap) + PRINTF_ATTRIBUTE(3,0); + +static inline char *__talloc_vaslenprintf_append(char *s, size_t slen, + const char *fmt, va_list ap) +{ + ssize_t alen; + va_list ap2; + char c; + + va_copy(ap2, ap); + #ifdef _MSC_VER + /* MSVC runtime needs to use _vcsprintf to return buffer size; vsnprintf would return -1 */ + alen = _vscprintf(fmt, ap2); + #else + alen = vsnprintf(&c, 1, fmt, ap2); + #endif + va_end(ap2); + + if (alen <= 0) { + /* Either the vsnprintf failed or the format resulted in + * no characters being formatted. In the former case, we + * ought to return NULL, in the latter we ought to return + * the original string. Most current callers of this + * function expect it to never return NULL. + */ + return s; + } + + s = talloc_realloc(NULL, s, char, slen + alen + 1); + if (!s) return NULL; + + va_copy(ap2, ap); + vsnprintf(s + slen, alen + 1, fmt, ap2); + va_end(ap2); + + _talloc_set_name_const(s, s); + return s; +} + +/** + * Realloc @p s to append the formatted result of @p fmt and @p ap, + * and return @p s, which may have moved. Good for gradually + * accumulating output into a string buffer. Appends at the end + * of the string. + **/ +char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) +{ + if (unlikely(!s)) { + return talloc_vasprintf(NULL, fmt, ap); + } + + return __talloc_vaslenprintf_append(s, strlen(s), fmt, ap); +} + +/** + * Realloc @p s to append the formatted result of @p fmt and @p ap, + * and return @p s, which may have moved. Always appends at the + * end of the talloc'ed buffer, not the end of the string. + **/ +char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) +{ + size_t slen; + + if (unlikely(!s)) { + return talloc_vasprintf(NULL, fmt, ap); + } + + slen = talloc_get_size(s); + if (likely(slen > 0)) { + slen--; + } + + return __talloc_vaslenprintf_append(s, slen, fmt, ap); +} + +/* + Realloc @p s to append the formatted result of @p fmt and return @p + s, which may have moved. Good for gradually accumulating output + into a string buffer. + */ +char *talloc_asprintf_append(char *s, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + s = talloc_vasprintf_append(s, fmt, ap); + va_end(ap); + return s; +} + +/* + Realloc @p s to append the formatted result of @p fmt and return @p + s, which may have moved. Good for gradually accumulating output + into a buffer. + */ +char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + s = talloc_vasprintf_append_buffer(s, fmt, ap); + va_end(ap); + return s; +} + +/* + alloc an array, checking for integer overflow in the array size +*/ +void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name) +{ + if (count >= MAX_TALLOC_SIZE/el_size) { + return NULL; + } + return _talloc_named_const(ctx, el_size * count, name); +} + +/* + alloc an zero array, checking for integer overflow in the array size +*/ +void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name) +{ + if (count >= MAX_TALLOC_SIZE/el_size) { + return NULL; + } + return _talloc_zero(ctx, el_size * count, name); +} + +/* + realloc an array, checking for integer overflow in the array size +*/ +void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name) +{ + if (count >= MAX_TALLOC_SIZE/el_size) { + return NULL; + } + return _talloc_realloc(ctx, ptr, el_size * count, name); +} + +/* + a function version of talloc_realloc(), so it can be passed as a function pointer + to libraries that want a realloc function (a realloc function encapsulates + all the basic capabilities of an allocation library, which is why this is useful) +*/ +void *talloc_realloc_fn(const void *context, void *ptr, size_t size) +{ + return _talloc_realloc(context, ptr, size, NULL); +} + + +static int talloc_autofree_destructor(void *ptr) +{ + autofree_context = NULL; + return 0; +} + +static void talloc_autofree(void) +{ + talloc_free(autofree_context); +} + +/* + return a context which will be auto-freed on exit + this is useful for reducing the noise in leak reports +*/ +void *talloc_autofree_context(void) +{ + if (autofree_context == NULL) { + autofree_context = _talloc_named_const(NULL, 0, "autofree_context"); + talloc_set_destructor(autofree_context, talloc_autofree_destructor); + atexit(talloc_autofree); + } + return autofree_context; +} + +size_t talloc_get_size(const void *context) +{ + struct talloc_chunk *tc; + + if (context == NULL) { + context = null_context; + } + if (context == NULL) { + return 0; + } + + tc = talloc_chunk_from_ptr(context); + + return tc->size; +} + +/* + find a parent of this context that has the given name, if any +*/ +void *talloc_find_parent_byname(const void *context, const char *name) +{ + struct talloc_chunk *tc; + + if (context == NULL) { + return NULL; + } + + tc = talloc_chunk_from_ptr(context); + while (tc) { + if (tc->name && strcmp(tc->name, name) == 0) { + return TC_PTR_FROM_CHUNK(tc); + } + while (tc && tc->prev) tc = tc->prev; + if (tc) { + tc = tc->parent; + } + } + return NULL; +} + +/* + show the parentage of a context +*/ +void talloc_show_parents(const void *context, FILE *file) +{ + struct talloc_chunk *tc; + + if (context == NULL) { + fprintf(file, "talloc no parents for NULL\n"); + return; + } + + tc = talloc_chunk_from_ptr(context); + fprintf(file, "talloc parents of '%s'\n", talloc_get_name(context)); + while (tc) { + fprintf(file, "\t'%s'\n", talloc_get_name(TC_PTR_FROM_CHUNK(tc))); + while (tc && tc->prev) tc = tc->prev; + if (tc) { + tc = tc->parent; + } + } + fflush(file); +} + +/* + return 1 if ptr is a parent of context +*/ +int talloc_is_parent(const void *context, const void *ptr) +{ + struct talloc_chunk *tc; + + if (context == NULL) { + return 0; + } + + tc = talloc_chunk_from_ptr(context); + while (tc) { + if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1; + while (tc && tc->prev) tc = tc->prev; + if (tc) { + tc = tc->parent; + } + } + return 0; +} diff --git a/mesalib/src/talloc/talloc.def b/mesalib/src/talloc/talloc.def new file mode 100644 index 000000000..13d7a159c --- /dev/null +++ b/mesalib/src/talloc/talloc.def @@ -0,0 +1,63 @@ +EXPORTS + _talloc + _talloc_array + _talloc_free + _talloc_get_type_abort + _talloc_memdup + _talloc_move + _talloc_realloc + _talloc_realloc_array + _talloc_reference_loc + _talloc_set_destructor + _talloc_steal_loc + _talloc_zero + _talloc_zero_array + talloc_asprintf + talloc_asprintf_append + talloc_asprintf_append_buffer + talloc_autofree_context + talloc_check_name + talloc_disable_null_tracking + talloc_enable_leak_report + talloc_enable_leak_report_full + talloc_enable_null_tracking + talloc_enable_null_tracking_no_autofree + talloc_find_parent_byname + talloc_free_children + talloc_get_name + talloc_get_size + talloc_increase_ref_count + talloc_init + talloc_is_parent + talloc_named + talloc_named_const + talloc_parent + talloc_parent_name + talloc_pool + talloc_realloc_fn + talloc_reference_count + talloc_reparent + talloc_report + talloc_report_depth_cb + talloc_report_depth_file + talloc_report_full + talloc_set_abort_fn + talloc_set_log_fn + talloc_set_log_stderr + talloc_set_name + talloc_set_name_const + talloc_show_parents + talloc_strdup + talloc_strdup_append + talloc_strdup_append_buffer + talloc_strndup + talloc_strndup_append + talloc_strndup_append_buffer + talloc_total_blocks + talloc_total_size + talloc_unlink + talloc_vasprintf + talloc_vasprintf_append + talloc_vasprintf_append_buffer + talloc_version_major + talloc_version_minor diff --git a/mesalib/src/talloc/talloc.h b/mesalib/src/talloc/talloc.h new file mode 100644 index 000000000..f549a17fb --- /dev/null +++ b/mesalib/src/talloc/talloc.h @@ -0,0 +1,202 @@ +#ifndef _TALLOC_H_ +#define _TALLOC_H_ +/* + Unix SMB/CIFS implementation. + Samba temporary memory allocation functions + + Copyright (C) Andrew Tridgell 2004-2005 + Copyright (C) Stefan Metzmacher 2006 + + ** NOTE! The following LGPL license applies to the talloc + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> + +#define TALLOC_VERSION_MAJOR 2 +#define TALLOC_VERSION_MINOR 0 + +int talloc_version_major(void); +int talloc_version_minor(void); + +/* this is only needed for compatibility with the old talloc */ +typedef void TALLOC_CTX; + +/* + this uses a little trick to allow __LINE__ to be stringified +*/ +#ifndef __location__ +#define __TALLOC_STRING_LINE1__(s) #s +#define __TALLOC_STRING_LINE2__(s) __TALLOC_STRING_LINE1__(s) +#define __TALLOC_STRING_LINE3__ __TALLOC_STRING_LINE2__(__LINE__) +#define __location__ __FILE__ ":" __TALLOC_STRING_LINE3__ +#endif + +#ifndef TALLOC_DEPRECATED +#define TALLOC_DEPRECATED 0 +#endif + +#ifndef PRINTF_ATTRIBUTE +#if (__GNUC__ >= 3) +/** Use gcc attribute to check printf fns. a1 is the 1-based index of + * the parameter containing the format, and a2 the index of the first + * argument. Note that some gcc 2.x versions don't handle this + * properly **/ +#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) +#else +#define PRINTF_ATTRIBUTE(a1, a2) +#endif +#endif + +/* try to make talloc_set_destructor() and talloc_steal() type safe, + if we have a recent gcc */ +#if (__GNUC__ >= 3) +#define _TALLOC_TYPEOF(ptr) __typeof__(ptr) +#define talloc_set_destructor(ptr, function) \ + do { \ + int (*_talloc_destructor_fn)(_TALLOC_TYPEOF(ptr)) = (function); \ + _talloc_set_destructor((ptr), (int (*)(void *))_talloc_destructor_fn); \ + } while(0) +/* this extremely strange macro is to avoid some braindamaged warning + stupidity in gcc 4.1.x */ +#define talloc_steal(ctx, ptr) ({ _TALLOC_TYPEOF(ptr) __talloc_steal_ret = (_TALLOC_TYPEOF(ptr))_talloc_steal_loc((ctx),(ptr), __location__); __talloc_steal_ret; }) +#else +#define talloc_set_destructor(ptr, function) \ + _talloc_set_destructor((ptr), (int (*)(void *))(function)) +#define _TALLOC_TYPEOF(ptr) void * +#define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal_loc((ctx),(ptr), __location__) +#endif + +#define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference_loc((ctx),(ptr), __location__) +#define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr)) + +/* useful macros for creating type checked pointers */ +#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) +#define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__) +#define talloc_ptrtype(ctx, ptr) (_TALLOC_TYPEOF(ptr))talloc_size(ctx, sizeof(*(ptr))) + +#define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__) + +#define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type) +#define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__) + +#define talloc_zero_array(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type) +#define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type) +#define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__) +#define talloc_array_ptrtype(ctx, ptr, count) (_TALLOC_TYPEOF(ptr))talloc_array_size(ctx, sizeof(*(ptr)), count) +#define talloc_array_length(ctx) (talloc_get_size(ctx)/sizeof(*ctx)) + +#define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type) +#define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__) + +#define talloc_memdup(t, p, size) _talloc_memdup(t, p, size, __location__) + +#define talloc_set_type(ptr, type) talloc_set_name_const(ptr, #type) +#define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type) +#define talloc_get_type_abort(ptr, type) (type *)_talloc_get_type_abort(ptr, #type, __location__) + +#define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type) +#define talloc_free(ctx) _talloc_free(ctx, __location__) + + +#if TALLOC_DEPRECATED +#define talloc_zero_p(ctx, type) talloc_zero(ctx, type) +#define talloc_p(ctx, type) talloc(ctx, type) +#define talloc_array_p(ctx, type, count) talloc_array(ctx, type, count) +#define talloc_realloc_p(ctx, p, type, count) talloc_realloc(ctx, p, type, count) +#define talloc_destroy(ctx) talloc_free(ctx) +#define talloc_append_string(c, s, a) (s?talloc_strdup_append(s,a):talloc_strdup(c, a)) +#endif + +#define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0) + +/* The following definitions come from talloc.c */ +void *_talloc(const void *context, size_t size); +void *talloc_pool(const void *context, size_t size); +void _talloc_set_destructor(const void *ptr, int (*_destructor)(void *)); +int talloc_increase_ref_count(const void *ptr); +size_t talloc_reference_count(const void *ptr); +void *_talloc_reference_loc(const void *context, const void *ptr, const char *location); +int talloc_unlink(const void *context, void *ptr); +const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +void talloc_set_name_const(const void *ptr, const char *name); +void *talloc_named(const void *context, size_t size, + const char *fmt, ...) PRINTF_ATTRIBUTE(3,4); +void *talloc_named_const(const void *context, size_t size, const char *name); +const char *talloc_get_name(const void *ptr); +void *talloc_check_name(const void *ptr, const char *name); +void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location); +void *talloc_parent(const void *ptr); +const char *talloc_parent_name(const void *ptr); +void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); +int _talloc_free(void *ptr, const char *location); +void talloc_free_children(void *ptr); +void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name); +void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location); +void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr); +void *_talloc_move(const void *new_ctx, const void *pptr); +size_t talloc_total_size(const void *ptr); +size_t talloc_total_blocks(const void *ptr); +void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, + void (*callback)(const void *ptr, + int depth, int max_depth, + int is_ref, + void *private_data), + void *private_data); +void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f); +void talloc_report_full(const void *ptr, FILE *f); +void talloc_report(const void *ptr, FILE *f); +void talloc_enable_null_tracking(void); +void talloc_enable_null_tracking_no_autofree(void); +void talloc_disable_null_tracking(void); +void talloc_enable_leak_report(void); +void talloc_enable_leak_report_full(void); +void *_talloc_zero(const void *ctx, size_t size, const char *name); +void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name); +void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name); +void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name); +void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name); +void *talloc_realloc_fn(const void *context, void *ptr, size_t size); +void *talloc_autofree_context(void); +size_t talloc_get_size(const void *ctx); +void *talloc_find_parent_byname(const void *ctx, const char *name); +void talloc_show_parents(const void *context, FILE *file); +int talloc_is_parent(const void *context, const void *ptr); + +char *talloc_strdup(const void *t, const char *p); +char *talloc_strdup_append(char *s, const char *a); +char *talloc_strdup_append_buffer(char *s, const char *a); + +char *talloc_strndup(const void *t, const char *p, size_t n); +char *talloc_strndup_append(char *s, const char *a, size_t n); +char *talloc_strndup_append_buffer(char *s, const char *a, size_t n); + +char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); +char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); +char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); + +char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); + +void talloc_set_abort_fn(void (*abort_fn)(const char *reason)); +void talloc_set_log_fn(void (*log_fn)(const char *message)); +void talloc_set_log_stderr(void); + +#endif diff --git a/mesalib/src/talloc/talloc_guide.txt b/mesalib/src/talloc/talloc_guide.txt new file mode 100644 index 000000000..01de80666 --- /dev/null +++ b/mesalib/src/talloc/talloc_guide.txt @@ -0,0 +1,757 @@ +Using talloc in Samba4 +====================== + +.. contents:: + +Andrew Tridgell +August 2009 + +The most current version of this document is available at + http://samba.org/ftp/unpacked/talloc/talloc_guide.txt + +If you are used to the "old" talloc from Samba3 before 3.0.20 then please read +this carefully, as talloc has changed a lot. With 3.0.20 (or 3.0.14?) the +Samba4 talloc has been ported back to Samba3, so this guide applies to both. + +The new talloc is a hierarchical, reference counted memory pool system +with destructors. Quite a mouthful really, but not too bad once you +get used to it. + +Perhaps the biggest change from Samba3 is that there is no distinction +between a "talloc context" and a "talloc pointer". Any pointer +returned from talloc() is itself a valid talloc context. This means +you can do this:: + + struct foo *X = talloc(mem_ctx, struct foo); + X->name = talloc_strdup(X, "foo"); + +and the pointer X->name would be a "child" of the talloc context "X" +which is itself a child of mem_ctx. So if you do talloc_free(mem_ctx) +then it is all destroyed, whereas if you do talloc_free(X) then just X +and X->name are destroyed, and if you do talloc_free(X->name) then +just the name element of X is destroyed. + +If you think about this, then what this effectively gives you is an +n-ary tree, where you can free any part of the tree with +talloc_free(). + +If you find this confusing, then I suggest you run the testsuite to +watch talloc in action. You may also like to add your own tests to +testsuite.c to clarify how some particular situation is handled. + + +Performance +----------- + +All the additional features of talloc() over malloc() do come at a +price. We have a simple performance test in Samba4 that measures +talloc() versus malloc() performance, and it seems that talloc() is +about 4% slower than malloc() on my x86 Debian Linux box. For Samba, +the great reduction in code complexity that we get by using talloc +makes this worthwhile, especially as the total overhead of +talloc/malloc in Samba is already quite small. + + +talloc API +---------- + +The following is a complete guide to the talloc API. Read it all at +least twice. + +Multi-threading +--------------- + +talloc itself does not deal with threads. It is thread-safe (assuming +the underlying "malloc" is), as long as each thread uses different +memory contexts. +If two threads uses the same context then they need to synchronize in +order to be safe. In particular: +- when using talloc_enable_leak_report(), giving directly NULL as a +parent context implicitly refers to a hidden "null context" global +variable, so this should not be used in a multi-threaded environment +without proper synchronization ; +- the context returned by talloc_autofree_context() is also global so +shouldn't be used by several threads simultaneously without +synchronization. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc(const void *context, type); + +The talloc() macro is the core of the talloc library. It takes a +memory context and a type, and returns a pointer to a new area of +memory of the given type. + +The returned pointer is itself a talloc context, so you can use it as +the context argument to more calls to talloc if you wish. + +The returned pointer is a "child" of the supplied context. This means +that if you talloc_free() the context then the new child disappears as +well. Alternatively you can free just the child. + +The context argument to talloc() can be NULL, in which case a new top +level context is created. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_size(const void *context, size_t size); + +The function talloc_size() should be used when you don't have a +convenient type to pass to talloc(). Unlike talloc(), it is not type +safe (as it returns a void *), so you are on your own for type checking. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(typeof(ptr)) talloc_ptrtype(const void *ctx, ptr); + +The talloc_ptrtype() macro should be used when you have a pointer and +want to allocate memory to point at with this pointer. When compiling +with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_size() +and talloc_get_name() will return the current location in the source file. +and not the type. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +int talloc_free(void *ptr); + +The talloc_free() function frees a piece of talloc memory, and all its +children. You can call talloc_free() on any pointer returned by +talloc(). + +The return value of talloc_free() indicates success or failure, with 0 +returned for success and -1 for failure. The only possible failure +condition is if the pointer had a destructor attached to it and the +destructor returned -1. See talloc_set_destructor() for details on +destructors. + +If this pointer has an additional parent when talloc_free() is called +then the memory is not actually released, but instead the most +recently established parent is destroyed. See talloc_reference() for +details on establishing additional parents. + +For more control on which parent is removed, see talloc_unlink() + +talloc_free() operates recursively on its children. + +From the 2.0 version of talloc, as a special case, talloc_free() is +refused on pointers that have more than one parent, as talloc would +have no way of knowing which parent should be removed. To free a +pointer that has more than one parent please use talloc_unlink(). + +To help you find problems in your code caused by this behaviour, if +you do try and free a pointer with more than one parent then the +talloc logging function will be called to give output like this: + + ERROR: talloc_free with references at some_dir/source/foo.c:123 + reference at some_dir/source/other.c:325 + reference at some_dir/source/third.c:121 + +Please see the documentation for talloc_set_log_fn() and +talloc_set_log_stderr() for more information on talloc logging +functions. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +int talloc_free_children(void *ptr); + +The talloc_free_children() walks along the list of all children of a +talloc context and talloc_free()s only the children, not the context +itself. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_reference(const void *context, const void *ptr); + +The talloc_reference() function makes "context" an additional parent +of "ptr". + +The return value of talloc_reference() is always the original pointer +"ptr", unless talloc ran out of memory in creating the reference in +which case it will return NULL (each additional reference consumes +around 48 bytes of memory on intel x86 platforms). + +If "ptr" is NULL, then the function is a no-op, and simply returns NULL. + +After creating a reference you can free it in one of the following +ways: + + - you can talloc_free() any parent of the original pointer. That + will reduce the number of parents of this pointer by 1, and will + cause this pointer to be freed if it runs out of parents. + + - you can talloc_free() the pointer itself. That will destroy the + most recently established parent to the pointer and leave the + pointer as a child of its current parent. + +For more control on which parent to remove, see talloc_unlink() + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +int talloc_unlink(const void *context, const void *ptr); + +The talloc_unlink() function removes a specific parent from ptr. The +context passed must either be a context used in talloc_reference() +with this pointer, or must be a direct parent of ptr. + +Note that if the parent has already been removed using talloc_free() +then this function will fail and will return -1. Likewise, if "ptr" +is NULL, then the function will make no modifications and return -1. + +Usually you can just use talloc_free() instead of talloc_unlink(), but +sometimes it is useful to have the additional control on which parent +is removed. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_destructor(const void *ptr, int (*destructor)(void *)); + +The function talloc_set_destructor() sets the "destructor" for the +pointer "ptr". A destructor is a function that is called when the +memory used by a pointer is about to be released. The destructor +receives the pointer as an argument, and should return 0 for success +and -1 for failure. + +The destructor can do anything it wants to, including freeing other +pieces of memory. A common use for destructors is to clean up +operating system resources (such as open file descriptors) contained +in the structure the destructor is placed on. + +You can only place one destructor on a pointer. If you need more than +one destructor then you can create a zero-length child of the pointer +and place an additional destructor on that. + +To remove a destructor call talloc_set_destructor() with NULL for the +destructor. + +If your destructor attempts to talloc_free() the pointer that it is +the destructor for then talloc_free() will return -1 and the free will +be ignored. This would be a pointless operation anyway, as the +destructor is only called when the memory is just about to go away. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +int talloc_increase_ref_count(const void *ptr); + +The talloc_increase_ref_count(ptr) function is exactly equivalent to: + + talloc_reference(NULL, ptr); + +You can use either syntax, depending on which you think is clearer in +your code. + +It returns 0 on success and -1 on failure. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +size_t talloc_reference_count(const void *ptr); + +Return the number of references to the pointer. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_name(const void *ptr, const char *fmt, ...); + +Each talloc pointer has a "name". The name is used principally for +debugging purposes, although it is also possible to set and get the +name on a pointer in as a way of "marking" pointers in your code. + +The main use for names on pointer is for "talloc reports". See +talloc_report() and talloc_report_full() for details. Also see +talloc_enable_leak_report() and talloc_enable_leak_report_full(). + +The talloc_set_name() function allocates memory as a child of the +pointer. It is logically equivalent to: + talloc_set_name_const(ptr, talloc_asprintf(ptr, fmt, ...)); + +Note that multiple calls to talloc_set_name() will allocate more +memory without releasing the name. All of the memory is released when +the ptr is freed using talloc_free(). + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_name_const(const void *ptr, const char *name); + +The function talloc_set_name_const() is just like talloc_set_name(), +but it takes a string constant, and is much faster. It is extensively +used by the "auto naming" macros, such as talloc_p(). + +This function does not allocate any memory. It just copies the +supplied pointer into the internal representation of the talloc +ptr. This means you must not pass a name pointer to memory that will +disappear before the ptr is freed with talloc_free(). + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_named(const void *context, size_t size, const char *fmt, ...); + +The talloc_named() function creates a named talloc pointer. It is +equivalent to: + + ptr = talloc_size(context, size); + talloc_set_name(ptr, fmt, ....); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_named_const(const void *context, size_t size, const char *name); + +This is equivalent to:: + + ptr = talloc_size(context, size); + talloc_set_name_const(ptr, name); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +const char *talloc_get_name(const void *ptr); + +This returns the current name for the given talloc pointer. See +talloc_set_name() for details. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_init(const char *fmt, ...); + +This function creates a zero length named talloc context as a top +level context. It is equivalent to:: + + talloc_named(NULL, 0, fmt, ...); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_new(void *ctx); + +This is a utility macro that creates a new memory context hanging +off an exiting context, automatically naming it "talloc_new: __location__" +where __location__ is the source line it is called from. It is +particularly useful for creating a new temporary working context. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc_realloc(const void *context, void *ptr, type, count); + +The talloc_realloc() macro changes the size of a talloc +pointer. The "count" argument is the number of elements of type "type" +that you want the resulting pointer to hold. + +talloc_realloc() has the following equivalences:: + + talloc_realloc(context, NULL, type, 1) ==> talloc(context, type); + talloc_realloc(context, NULL, type, N) ==> talloc_array(context, type, N); + talloc_realloc(context, ptr, type, 0) ==> talloc_free(ptr); + +The "context" argument is only used if "ptr" is NULL, otherwise it is +ignored. + +talloc_realloc() returns the new pointer, or NULL on failure. The call +will fail either due to a lack of memory, or because the pointer has +more than one parent (see talloc_reference()). + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_realloc_size(const void *context, void *ptr, size_t size); + +the talloc_realloc_size() function is useful when the type is not +known so the typesafe talloc_realloc() cannot be used. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_steal(const void *new_ctx, const void *ptr); + +The talloc_steal() function changes the parent context of a talloc +pointer. It is typically used when the context that the pointer is +currently a child of is going to be freed and you wish to keep the +memory for a longer time. + +The talloc_steal() function returns the pointer that you pass it. It +does not have any failure modes. + +NOTE: It is possible to produce loops in the parent/child relationship +if you are not careful with talloc_steal(). No guarantees are provided +as to your sanity or the safety of your data if you do this. + +talloc_steal (new_ctx, NULL) will return NULL with no sideeffects. + +Note that if you try and call talloc_steal() on a pointer that has +more than one parent then the result is ambiguous. Talloc will choose +to remove the parent that is currently indicated by talloc_parent() +and replace it with the chosen parent. You will also get a message +like this via the talloc logging functions: + + WARNING: talloc_steal with references at some_dir/source/foo.c:123 + reference at some_dir/source/other.c:325 + reference at some_dir/source/third.c:121 + +To unambiguously change the parent of a pointer please see the +function talloc_reparent(). See the talloc_set_log_fn() documentation +for more information on talloc logging. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr); + +The talloc_reparent() function changes the parent context of a talloc +pointer. It is typically used when the context that the pointer is +currently a child of is going to be freed and you wish to keep the +memory for a longer time. + +The talloc_reparent() function returns the pointer that you pass it. It +does not have any failure modes. + +The difference between talloc_reparent() and talloc_steal() is that +talloc_reparent() can specify which parent you wish to change. This is +useful when a pointer has multiple parents via references. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_parent(const void *ptr); + +The talloc_parent() function returns the current talloc parent. This +is usually the pointer under which this memory was originally created, +but it may have changed due to a talloc_steal() or talloc_reparent() + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +size_t talloc_total_size(const void *ptr); + +The talloc_total_size() function returns the total size in bytes used +by this pointer and all child pointers. Mostly useful for debugging. + +Passing NULL is allowed, but it will only give a meaningful result if +talloc_enable_leak_report() or talloc_enable_leak_report_full() has +been called. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +size_t talloc_total_blocks(const void *ptr); + +The talloc_total_blocks() function returns the total memory block +count used by this pointer and all child pointers. Mostly useful for +debugging. + +Passing NULL is allowed, but it will only give a meaningful result if +talloc_enable_leak_report() or talloc_enable_leak_report_full() has +been called. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, + void (*callback)(const void *ptr, + int depth, int max_depth, + int is_ref, + void *priv), + void *priv); + +This provides a more flexible reports than talloc_report(). It +will recursively call the callback for the entire tree of memory +referenced by the pointer. References in the tree are passed with +is_ref = 1 and the pointer that is referenced. + +You can pass NULL for the pointer, in which case a report is +printed for the top level memory context, but only if +talloc_enable_leak_report() or talloc_enable_leak_report_full() +has been called. + +The recursion is stopped when depth >= max_depth. +max_depth = -1 means only stop at leaf nodes. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f); + +This provides a more flexible reports than talloc_report(). It +will let you specify the depth and max_depth. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_report(const void *ptr, FILE *f); + +The talloc_report() function prints a summary report of all memory +used by ptr. One line of report is printed for each immediate child of +ptr, showing the total memory and number of blocks used by that child. + +You can pass NULL for the pointer, in which case a report is printed +for the top level memory context, but only if +talloc_enable_leak_report() or talloc_enable_leak_report_full() has +been called. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_report_full(const void *ptr, FILE *f); + +This provides a more detailed report than talloc_report(). It will +recursively print the ensire tree of memory referenced by the +pointer. References in the tree are shown by giving the name of the +pointer that is referenced. + +You can pass NULL for the pointer, in which case a report is printed +for the top level memory context, but only if +talloc_enable_leak_report() or talloc_enable_leak_report_full() has +been called. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_enable_leak_report(void); + +This enables calling of talloc_report(NULL, stderr) when the program +exits. In Samba4 this is enabled by using the --leak-report command +line option. + +For it to be useful, this function must be called before any other +talloc function as it establishes a "null context" that acts as the +top of the tree. If you don't call this function first then passing +NULL to talloc_report() or talloc_report_full() won't give you the +full tree printout. + +Here is a typical talloc report: + +talloc report on 'null_context' (total 267 bytes in 15 blocks) + libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks + libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks + iconv(UTF8,CP850) contains 42 bytes in 2 blocks + libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks + iconv(CP850,UTF8) contains 42 bytes in 2 blocks + iconv(UTF8,UTF-16LE) contains 45 bytes in 2 blocks + iconv(UTF-16LE,UTF8) contains 45 bytes in 2 blocks + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_enable_leak_report_full(void); + +This enables calling of talloc_report_full(NULL, stderr) when the +program exits. In Samba4 this is enabled by using the +--leak-report-full command line option. + +For it to be useful, this function must be called before any other +talloc function as it establishes a "null context" that acts as the +top of the tree. If you don't call this function first then passing +NULL to talloc_report() or talloc_report_full() won't give you the +full tree printout. + +Here is a typical full report: + +full talloc report on 'root' (total 18 bytes in 8 blocks) + p1 contains 18 bytes in 7 blocks (ref 0) + r1 contains 13 bytes in 2 blocks (ref 0) + reference to: p2 + p2 contains 1 bytes in 1 blocks (ref 1) + x3 contains 1 bytes in 1 blocks (ref 0) + x2 contains 1 bytes in 1 blocks (ref 0) + x1 contains 1 bytes in 1 blocks (ref 0) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_enable_null_tracking(void); + +This enables tracking of the NULL memory context without enabling leak +reporting on exit. Useful for when you want to do your own leak +reporting call via talloc_report_null_full(); + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_disable_null_tracking(void); + +This disables tracking of the NULL memory context. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc_zero(const void *ctx, type); + +The talloc_zero() macro is equivalent to:: + + ptr = talloc(ctx, type); + if (ptr) memset(ptr, 0, sizeof(type)); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_zero_size(const void *ctx, size_t size) + +The talloc_zero_size() function is useful when you don't have a known type + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_memdup(const void *ctx, const void *p, size_t size); + +The talloc_memdup() function is equivalent to:: + + ptr = talloc_size(ctx, size); + if (ptr) memcpy(ptr, p, size); + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_strdup(const void *ctx, const char *p); + +The talloc_strdup() function is equivalent to:: + + ptr = talloc_size(ctx, strlen(p)+1); + if (ptr) memcpy(ptr, p, strlen(p)+1); + +This functions sets the name of the new pointer to the passed +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_strndup(const void *t, const char *p, size_t n); + +The talloc_strndup() function is the talloc equivalent of the C +library function strndup() + +This functions sets the name of the new pointer to the passed +string. This is equivalent to: + talloc_set_name_const(ptr, ptr) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_append_string(const void *t, char *orig, const char *append); + +The talloc_append_string() function appends the given formatted +string to the given string. + +This function sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_vasprintf(const void *t, const char *fmt, va_list ap); + +The talloc_vasprintf() function is the talloc equivalent of the C +library function vasprintf() + +This functions sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_asprintf(const void *t, const char *fmt, ...); + +The talloc_asprintf() function is the talloc equivalent of the C +library function asprintf() + +This functions sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_asprintf_append(char *s, const char *fmt, ...); + +The talloc_asprintf_append() function appends the given formatted +string to the given string. +Use this varient when the string in the current talloc buffer may +have been truncated in length. + +This functions sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...); + +The talloc_asprintf_append() function appends the given formatted +string to the end of the currently allocated talloc buffer. +Use this varient when the string in the current talloc buffer has +not been changed. + +This functions sets the name of the new pointer to the new +string. This is equivalent to:: + + talloc_set_name_const(ptr, ptr) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +((type *)talloc_array(const void *ctx, type, uint_t count); + +The talloc_array() macro is equivalent to:: + + (type *)talloc_size(ctx, sizeof(type) * count); + +except that it provides integer overflow protection for the multiply, +returning NULL if the multiply overflows. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_array_size(const void *ctx, size_t size, uint_t count); + +The talloc_array_size() function is useful when the type is not +known. It operates in the same way as talloc_array(), but takes a size +instead of a type. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(typeof(ptr)) talloc_array_ptrtype(const void *ctx, ptr, uint_t count); + +The talloc_ptrtype() macro should be used when you have a pointer to an array +and want to allocate memory of an array to point at with this pointer. When compiling +with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_array_size() +and talloc_get_name() will return the current location in the source file. +and not the type. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_realloc_fn(const void *ctx, void *ptr, size_t size); + +This is a non-macro version of talloc_realloc(), which is useful +as libraries sometimes want a ralloc function pointer. A realloc() +implementation encapsulates the functionality of malloc(), free() and +realloc() in one call, which is why it is useful to be able to pass +around a single function pointer. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_autofree_context(void); + +This is a handy utility function that returns a talloc context +which will be automatically freed on program exit. This can be used +to reduce the noise in memory leak reports. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_check_name(const void *ptr, const char *name); + +This function checks if a pointer has the specified name. If it does +then the pointer is returned. It it doesn't then NULL is returned. + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc_get_type(const void *ptr, type); + +This macro allows you to do type checking on talloc pointers. It is +particularly useful for void* private pointers. It is equivalent to +this:: + + (type *)talloc_check_name(ptr, #type) + + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +talloc_set_type(const void *ptr, type); + +This macro allows you to force the name of a pointer to be a +particular type. This can be used in conjunction with +talloc_get_type() to do type checking on void* pointers. + +It is equivalent to this:: + + talloc_set_name_const(ptr, #type) + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +talloc_get_size(const void *ctx); + +This function lets you know the amount of memory alloced so far by +this context. It does NOT account for subcontext memory. +This can be used to calculate the size of an array. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void *talloc_find_parent_byname(const void *ctx, const char *name); + +Find a parent memory context of the current context that has the given +name. This can be very useful in complex programs where it may be +difficult to pass all information down to the level you need, but you +know the structure you want is a parent of another context. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +(type *)talloc_find_parent_bytype(ctx, type); + +Like talloc_find_parent_byname() but takes a type, making it typesafe. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_log_fn(void (*log_fn)(const char *message)); + +This function sets a logging function that talloc will use for +warnings and errors. By default talloc will not print any warnings or +errors. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +void talloc_set_log_stderr(void) + +This sets the talloc log function to write log messages to stderr |